ZLibcompr function always returns me buf
Brought to you by:
tomz
Following are the snap of the code.
if (ZLSetup)
{
char dest[100];
char result[100];
uLongf destLen = 100;
char source[] = "a string to compress";
int err;
uLongf sourceLen = strlen(source) + 1;
err = ZLibcompress2(ZLibRef, (Bytef *)dest, &destLen,
(Bytef *)source,
sourceLen, Z_DEFAULT_COMPRESSION);
ULong lUncompLen = 100;
err = ZLibuncompress(ZLibRef,(Bytef *)result,
&lUncompLen,
(const Bytef *)dest, destLen);
}
but ZLibcompress2 always returns Z_BUF_ERROR
regardless of the destination
buffer size.