Skip to content

Commit

Permalink
Fix missing FChunkStarted check in EndChunk.
Browse files Browse the repository at this point in the history
This was causing an extra empty stream to be written after every chunk (each 2 bytes, with lzma2).
  • Loading branch information
jordanrussell authored Nov 12, 2024
1 parent 56e4e0a commit 86eeba3
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Projects/Src/Compiler.CompressionHandler.pas
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,15 @@ procedure TCompressionHandler.NewChunk(const ACompressorClass: TCustomCompressor

procedure TCompressionHandler.EndChunk;
begin
if Assigned(FCompressor) then begin
FCompressor.Finish;
{ In case we didn't get a ProgressProc call after the final block: }
FCompiler.SetBytesCompressedSoFar(FInitialBytesCompressedSoFar);
FCompiler.AddBytesCompressedSoFar(FChunkBytesRead);
FCompiler.CallIdleProc;
end;

if not FChunkStarted then
Exit;
FChunkStarted := False;

FCompressor.Finish;
{ In case we didn't get a ProgressProc call after the final block: }
FCompiler.SetBytesCompressedSoFar(FInitialBytesCompressedSoFar);
FCompiler.AddBytesCompressedSoFar(FChunkBytesRead);
FCompiler.CallIdleProc;
end;

procedure TCompressionHandler.CompressFile(const SourceFile: TFile;
Expand Down Expand Up @@ -315,4 +315,4 @@ procedure TCompressionHandler.ProgressProc(BytesProcessed: Cardinal);
FCompiler.CallIdleProc;
end;

end.
end.

0 comments on commit 86eeba3

Please sign in to comment.