Forráskód Böngészése

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

git-svn-id: trunk@3825 -
michael 19 éve
szülő
commit
1e0d556788
1 módosított fájl, 7 hozzáadás és 1 törlés
  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;