26 int ZEXPORT uncompress (dest, destLen, source, sourceLen)
35 stream.next_in = (Bytef*)source;
36 stream.avail_in = (uInt)sourceLen;
38 if ((uLong)stream.avail_in != sourceLen)
return Z_BUF_ERROR;
40 stream.next_out = dest;
41 stream.avail_out = (uInt)*destLen;
42 if ((uLong)stream.avail_out != *destLen)
return Z_BUF_ERROR;
44 stream.zalloc = (alloc_func)0;
45 stream.zfree = (free_func)0;
47 err = inflateInit(&stream);
48 if (err != Z_OK)
return err;
50 err = inflate(&stream, Z_FINISH);
51 if (err != Z_STREAM_END) {
53 if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
57 *destLen = stream.total_out;
59 err = inflateEnd(&stream);