From 919cc7f3071b2ef4f5b354859e9aeb21833a7d1b Mon Sep 17 00:00:00 2001 From: maciej-izak <mizak.public@gmail.com> Date: Wed, 6 Dec 2017 10:19:52 +0000 Subject: [PATCH] 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 - --- packages/fcl-res/src/versionresource.pp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/fcl-res/src/versionresource.pp b/packages/fcl-res/src/versionresource.pp index 65ea243862..3d49ea2a42 100644 --- a/packages/fcl-res/src/versionresource.pp +++ b/packages/fcl-res/src/versionresource.pp @@ -311,7 +311,6 @@ end; function TVersionResource.ReadWideString(toread: integer): string; var w : word; ws : widestring; - i: integer = 0; begin ws:=''; if toread=0 then @@ -319,17 +318,13 @@ begin w:=0; repeat RawData.ReadBuffer(w,2); - if (toread=-1) and (w = 0) then break; + if (w = 0) then break; {$IFDEF ENDIAN_BIG} w:=SwapEndian(w); {$ENDIF} ws:=ws+widechar(w); - inc(i); - until i = toread; + until false; 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; procedure TVersionResource.WriteFixedBlockLength(const position: int64);