deflateBound

Name

deflateBound -- compute compressed data size

Synopsis

#include <zlib.h>

int deflateBound(z_streamp stream, uLong sourceLen);

Description

The deflateBound() function shall estimate the size of buffer required to compress sourceLen bytes of data. If successful, the value returned shall be an upper bound for the size of buffer required to compress sourceLen bytes of data, using the parameters stored in stream, in a single call to deflate() with flush set to Z_FINISH.

On entry, stream should have been initialized via a call to deflateInit_() or deflateInit2_().

Return Value

The deflateBound() shall return a value representing the upper bound of an array to allocate to hold the compressed data in a single call to deflate(). If the stream is not correctly initialized, or is NULL, then deflateBound() may return a conservative value that may be larger than sourceLen.

Errors

None defined.