While running valgrind on fpcdoc, I got a warning in
Procedure SetString (Out S : UnicodeString; Buf : PUnicodeChar; Len : SizeInt);

It assumes that the Buf is null terminated, and tries to use that information to truncate the length. The ansistring version: Procedure SetString (Out S : AnsiString; Buf : PChar; Len : SizeInt); simply sets the length and moves the chars from Buf. Why is does the UnicodeString version only move the chars until the first #0000?

The reason ValGrind complains is probably that SetStrings assumes that Buf is null terminated:
      BufLen := IndexWord(Buf^, Len+1, 0);
IndexWord reads Len+1 words, I would change that code to
      BufLen := IndexWord(Buf^, Len, 0);
At least, if this scanning is actually useful for UnicodeStrings, unlike for Ansistrings. Otherwiser it may as well be removed.

Vincent
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to