Browse Source

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 -
maciej-izak 7 years ago
parent
commit
919cc7f307
1 changed files with 2 additions and 7 deletions
  1. 2 7
      packages/fcl-res/src/versionresource.pp

+ 2 - 7
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);