www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1450] New: Registry: invalid UTF-8 sequence

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1450

           Summary: Registry: invalid UTF-8 sequence
           Product: D
           Version: 1.020
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: keystuffs netscape.net


I get this error when I use the function value_EXPAND_SZ:
  std.stdio.writefln(key.getValue("").value_EXPAND_SZ());

This is caused because the value returned is 2 characters too long. 

The function value_EXPAND_SZ use the function ExpandEnvironmentStringsA. In the
documentation found here:
http://msdn2.microsoft.com/en-us/library/ms724265.aspx, this function return
the string length, plus terminating null character, plus one.

This means that the variable "newValue" returned by value_EXPAND_SZ contains 2
extra characters.

To resolve the bug, I changed the last line by:
  return newValue[0 .. newValue.length - 2];


-- 
Aug 29 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1450


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed dmd 1.021 and 2.004


-- 
Sep 28 2007