Parcourir la source

+ Patch to allow uncompressed data after compressed data from Sergei Gorelkin

git-svn-id: trunk@3825 -
michael il y a 19 ans
Parent
commit
1e0d556788
1 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. 7 1
      fcl/inc/zstream.pp

+ 7 - 1
fcl/inc/zstream.pp

@@ -312,6 +312,8 @@ end;
 
 destructor TDecompressionStream.Destroy;
 begin
+  if FZRec.avail_in <> 0 then
+    Source.Seek(-FZRec.avail_in, soFromCurrent);
   inflateEnd(FZRec);
   inherited Destroy;
 end;
@@ -345,7 +347,11 @@ begin
       FStrmPos := Source.Position;
       Progress(Self);
     end;
-    DeCompressionCheck(inflate(FZRec, 0));
+    if DeCompressionCheck(inflate(FZRec, 0)) = Z_STREAM_END then
+	begin
+	  Result := Count - FZRec.avail_out;
+	  Exit;
+	end;
   end;
   Result := Count;
 end;