uncompress

Name

uncompress -- uncompress data

Synopsis

#include <zlib.h>

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

Description

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.

Errors

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

Z_BUF_ERROR

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

Z_MEM_ERROR

Insufficient memory.

Z_DATA_ERROR

The compressed data (referenced by source) was corrupted.