#1 2014-07-17 03:54:13

vbz007
Member
Registered: 2014-07-17
Posts: 5

Bug! SynZip

{{ in-memory ZLib DEFLATE compression }
function CompressMem(src, dst: pointer; srcLen, dstLen: integer;
 
  CompressionLevel: integer=6; ZipFormat: Boolean=false) : integer;
 
/// in-memory ZLib INFLATE decompression
function UnCompressMem(src, dst: pointer; srcLen, dstLen: integer) : integer;
 
/// ZLib DEFLATE compression from memory into a stream
function CompressStream(src: pointer; srcLen: integer;
  aStream: TStream; CompressionLevel:integer=6; ZipFormat: Boolean=false): cardinal;
 
/// ZLib INFLATE decompression from memory into a stream
// - return the number of bytes written into the stream
// - if checkCRC if not nil, it will contain thecrc32  (if aStream is nil, it will
// fast calculate the crc of the the uncompressed memory block)
function UnCompressStream(src: pointer; srcLen: integer; aStream: TStream; checkCRC: PCardinal): cardinal;

function Result is error!!

CODE:

var
  fm:TFileStream;
  s:AnsiString;
begin
  fm:=TFileStream.Create(ExtractFilePath(ParamStr(0))+'4.zlib',fmCreate or fmOpenReadWrite);
  try
    s:='this is test!';
    CompressStream(@s[1],Length(s),fm);
  finally
    FreeAndNil(fm);
  end;
end;

Error:
fm.size=0;

function CompressString(const data: RawByteString; failIfGrow: boolean = false;
  CompressionLevel: integer=6) : RawByteString;

Result is also Error!

Last edited by vbz007 (2014-07-17 04:54:33)

Offline

#2 2014-07-17 06:32:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,207
Website

Re: Bug! SynZip

On our side, we have fm.size=13 for the first sample, and no problem with CompressString.
Zip compression is tested in our regression suite - TestSQL3.dpr, very regularly.

Are you sure you are using the latest unstable 1.18 source code, with the proper .obj files supplied?
Perhaps your IDE paths are wrong, and mix several ZLib instances.

Offline

#3 2014-07-17 10:13:44

vbz007
Member
Registered: 2014-07-17
Posts: 5

Re: Bug! SynZip

Carefully read the SynZip code!  Discover Link two obj.
My test exclusively using the SynZip;
my delphi path exists zlibEx.
Obj file is not compatible.

I tested again using the [mORMot Framework]'obj, Results are correct.

No Bug.... I'm sorry!

Offline

#4 2014-07-17 16:55:11

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,207
Website

Re: Bug! SynZip

Perhaps we should rename our two .obj to avoid such issue...
sad

Offline

Board footer

Powered by FluxBB