uncompress -- uncompress data


#include <zlib.h>

int uncompress(Bytef * dest, uLongf * destLen, const Bytef * source, uLong sourceLen);


The uncompress() function shall attempt to uncompress sourceLen bytes of data in the buffer source, placing the result in the buffer dest.

On entry, destLen should point to a value describing the size of the dest buffer. The application should ensure that this value is large enough to hold the entire uncompressed data.

Note: The LSB does not describe any mechanism by which a compressor can communicate the size required to the uncompressor.

On successful exit, the variable referenced by destLen shall be updated to hold the length of uncompressed data in dest.

Return Value

On success, uncompress() shall return Z_OK. Otherwise, uncompress() shall return a value to indicate the error.


On error, uncompress() shall return a value as described below:


The buffer dest was not large enough to hold the uncompressed data.


Insufficient memory.


The compressed data (referenced by source) was corrupted.