[Lazarus] Decompressing zip stream

Leonardo M. Ramé l.rame at griensu.com
Fri Sep 2 20:56:31 CEST 2011


Hi, I posted this same question in fpc-devel list a week ago, with no
answer. I hope somebody can help me here.

The attached file, is a WAV audio compressed with TurboPower Abbrevia
using Delphi 7, then stored in a blob field in a database.

I'm trying to migrate an app to Lazarus that must read and write those files
using the same format as the Delphi version. I cannot use Abbrevia here,
because of some incompatibilities with Linux 64bits (the new app must
run in 32/64bits linux/win/mac).

While trying to decompress the streams using TInflater class from zipper unit
using this code, I get "buffer error" message when calling DeCompress
method. I must add that the error only happens with a group of streams,
specially with the small ones:

var
  lUnzip: TInflater;
  lInStream: TMemoryStream;
  lOutStream: TMemoryStream;
begin
  lInStream := TMemoryStream.Create;
  lOutStream := TMemoryStream.Create;

  lInStream.LoadFromFile('inputfile.file');
  lInStream.Position:= 0;
  lUnzip := TInflater.Create(lInStream, lOutStream, lInStream.Size);
  try
    lUnzip.DeCompress;
    lOutStream.Position:=0;
    lOutStream.SaveToFile('output.wav');
  finally
    lInStream.Free;
    lOutStream.Free;
    lUnzip.Free;
  end;
end;

I'm using fpc 2.7.1 from today and Lazarus 0.9.31 Rev 32139 from SVN on
Linux 64bits.

Any hint?

-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: error.file
Type: application/octet-stream
Size: 68127 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110902/dc5a438d/attachment-0002.obj>


More information about the Lazarus mailing list