Bug 3245 – Easy bug fix available for disabled unit test code in std.encoding

Status
RESOLVED
Resolution
FIXED
Severity
trivial
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2009-08-11T21:59:00Z
Last change time
2015-06-09T01:28:06Z
Assigned to
andrei
Creator
y0uf00bar

Comments

Comment #0 by y0uf00bar — 2009-08-11T21:59:39Z
Bug: unittest line 55 in std.encoding was disabled by version(none) Rationale: Re-enabling unittest at line 55 results in failure. Fix: At line 1059 inside template EncoderInstance(CharType : char). Current version: dchar decodeReverseViaRead()() { auto c = read; .... Fixed version: dchar decodeReverseViaRead()() { dchar c = read; .... Its obvious after failure point is pinned, even if not knowing the exact specs, as decodeReverseViaRead must return a dchar, and variable c accumulates left shifted bits in the loop, same as the nearby safeDecodeViaRead method. In UTF-8,the auto c = read makes a char type only (thank you zerobugs debugger), so high bits put in c are thrown away, and function may return character 0. Re-enabled unittest code ran succesfully after above fix.
Comment #1 by andrei — 2009-08-12T00:23:37Z
Terrific, thanks. I looked at that and couldn't figure the problem.
Comment #2 by andrei — 2009-08-28T12:43:36Z
Thanks for the precise instructions.