Bug 12320 – std.stdio.LockingTextReader populates .front in .empty

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-08T11:35:00Z
Last change time
2015-02-18T03:39:51Z
Assigned to
nobody
Creator
peter.alexander.au

Comments

Comment #0 by peter.alexander.au — 2014-03-08T11:35:55Z
In std.stdio.LockingTextReader, if you call .front after calling popFront, the value will be dchar.init. You have to call .empty before .front to get a meaningful value. This is fine for the vast majority of use cases, but if you happen to know a file has so many bytes then you might call .front without calling .empty, and that should work.
Comment #1 by ag0aep6g — 2014-11-07T14:29:59Z
Comment #2 by github-bugzilla — 2014-11-13T19:53:42Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/3d058e285352998a445acc30c401a13ab1ba0b4d fix LockingTextReader: issues 13686 and 12320 Issue 13686 (Reading unicode string with readf ("%s") produces a wrong string) is fixed by reading all chars of a multibyte sequence and decoding. Before, each char was mistaken for a dchar. Issue 12320 (std.stdio.LockingTextReader populates .front in .empty) is fixed by moving the work from empty to popFront. https://github.com/D-Programming-Language/phobos/commit/a0ca85550a74cd20b435db6ac6da2f9e4902ab96 Merge pull request #2663 from aG0aep6G/lockingtextreader fix LockingTextReader: issues 13686 and 12320
Comment #3 by github-bugzilla — 2015-02-18T03:39:51Z