The deflateInit_() function shall initialize the compression system. On entry, stream shall refer to a user supplied z_stream object (a z_stream_s structure). The following fields shall be set on entry:
a pointer to an alloc_func function, used to allocate state information.
If this is
NULL, a default allocation function will be used.
a pointer to a free_func function, used to free memory
allocated by the
zalloc function. If this is
a default free function will be used.
alloc_func is not
opaque is a user supplied pointer to data
that will be passed to the
If the version requested is not compatible with
the version implemented, or if the size of the
provided in stream_size does not match the size
in the library
implementation, deflateInit_() shall fail, and return
The level supplied shall be a value between
9, or the value
Z_DEFAULT_COMPRESSION. A level
1 requests the highest speed, while a
9 requests the highest compression.
A level of
0 indicates that no
compression should be used, and the output shall be the same as the input.
The deflateInit_() function is not in the source standard; it is only in the binary standard. Source applications should use the deflateInit() macro.
The deflateInit_() function is equivalent to
deflateInit2_(stream, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, version, stream_size);
On success, the deflateInit_() function shall return
Otherwise, deflateInit_() shall return
a value as described below to indicate the error.
On error, deflateInit_() shall return one of the following error indicators:
Insufficient memory available.
The version requested is not compatible with the library version, or the z_stream size differs from that used by the library.
In addition, the
msg field of the
may be set to an error message.