You are not logged in.
Pages: 1
{{ 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
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
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
Pages: 1