fcl-res: #0 as terminator is still needed (anyway toread is still needed - for some resource generator this value can be 0 and #0 terminator doesn't exist).

git-svn-id: trunk@37687 -
This commit is contained in:
maciej-izak 2017-12-06 10:19:52 +00:00
parent d4acc80ba6
commit 919cc7f307

View File

@ -311,7 +311,6 @@ end;
function TVersionResource.ReadWideString(toread: integer): string; function TVersionResource.ReadWideString(toread: integer): string;
var w : word; var w : word;
ws : widestring; ws : widestring;
i: integer = 0;
begin begin
ws:=''; ws:='';
if toread=0 then if toread=0 then
@ -319,17 +318,13 @@ begin
w:=0; w:=0;
repeat repeat
RawData.ReadBuffer(w,2); RawData.ReadBuffer(w,2);
if (toread=-1) and (w = 0) then break; if (w = 0) then break;
{$IFDEF ENDIAN_BIG} {$IFDEF ENDIAN_BIG}
w:=SwapEndian(w); w:=SwapEndian(w);
{$ENDIF} {$ENDIF}
ws:=ws+widechar(w); ws:=ws+widechar(w);
inc(i); until false;
until i = toread;
Result:=ws; Result:=ws;
// last #0 should be excluded (#0 is implicitly added for string)
if (toread<>-1) and (Result[i] = #0) then
SetLength(Result, i-1);
end; end;
procedure TVersionResource.WriteFixedBlockLength(const position: int64); procedure TVersionResource.WriteFixedBlockLength(const position: int64);