Recent

Author Topic: Fixed Bzip2 unpacker from Synopse  (Read 394 times)

domasz

  • Hero Member
  • *****
  • Posts: 629
Fixed Bzip2 unpacker from Synopse
« on: April 13, 2026, 08:09:54 am »
So here's a Bz2 decompression unit for FPC created by Synopse. It didn't handle big files well. I fixed it with AI and now it does. I tested with 7 GB files and works fine.

Changes:
1) it needed to know the size of unpacked data. now it doesn't
2) it unpacked all data from memory to memory. now it works with streams

This is pure Pascal, no DLLs needed


Code: Pascal  [Select][+][-]
  1. uses SynBzPas, bufStream;
  2.  
  3. [...]
  4.   var
  5.     InS, OutS: TBufferedFileStream;
  6.     Err: Integer;
  7.   begin
  8.     InS := TBufferedFileStream.Create('packed.bz2', fmOpenRead or fmShareDenyNone);
  9.     try
  10.       OutS := TBufferedFileStream.Create('unpacked.mp4', fmCreate);
  11.       try
  12.         if not UnCompressBzStream(InS, OutS, @Err) then
  13.           ShowMEssage('Decompression failed: ', Err);
  14.       finally
  15.         OutS.Free;
  16.       end;
  17.     finally
  18.       InS.Free;
  19.     end;
« Last Edit: April 13, 2026, 08:13:10 am by domasz »

 

TinyPortal © 2005-2018