<dd> The application can compare <ahref="#zlibVersion">zlibVersion</a> and ZLIB_VERSION for consistency.
If the first character differs, the library code actually used is
not compatible with the zlib.h header file used by the application.
This check is automatically made by <ahref="#deflateInit">deflateInit</a> and <ahref="#inflateInit">inflateInit</a>.
<p>
<fontcolor="Blue"><dt> int <aname="deflateInit">deflateInit</a> (<ahref="#z_streamp">z_streamp</a> strm, int level);</font>
<dd>
Initializes the internal stream <ahref="#state">state</a> for compression. The fields
<ahref="#zalloc">zalloc</a>, <ahref="#zfree">zfree</a> and <ahref="#opaque">opaque</a> must be initialized before by the caller.
If <ahref="#zalloc">zalloc</a> and <ahref="#zfree">zfree</a> are set to <ahref="#Z_NULL">Z_NULL</a>, <ahref="#deflateInit">deflateInit</a> updates them to
use default allocation functions.
<p>
The compression level must be <ahref="#Z_DEFAULT_COMPRESSION">Z_DEFAULT_COMPRESSION</a>, or between 0 and 9:
1 gives best speed, 9 gives best compression, 0 gives no compression at
all (the input data is simply copied a block at a time).
<p>
<ahref="#Z_DEFAULT_COMPRESSION">Z_DEFAULT_COMPRESSION</a> requests a default compromise between speed and
compression (currently equivalent to level 6).
<p>
<ahref="#deflateInit">deflateInit</a> returns <ahref="#Z_OK">Z_OK</a> if success, <ahref="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
enough memory, <ahref="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if level is not a valid compression level,
<ahref="#Z_VERSION_ERROR">Z_VERSION_ERROR</a> if the zlib library version (<ahref="#zlib_version">zlib_version</a>) is incompatible
with the version assumed by the caller (ZLIB_VERSION).
<ahref="#msg">msg</a> is set to null if there is no error message. <ahref="#deflateInit">deflateInit</a> does not
perform any compression: this will be done by <ahref="#deflate">deflate</a>().
<p>
<fontcolor="Blue"><dt> int <aname="deflate">deflate</a> (<ahref="#z_streamp">z_streamp</a> strm, int flush);</font>
<dd>
<ahref="#deflate">deflate</a> compresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce some
output latency (reading input without producing any output) except when
forced to flush.<p>
The detailed semantics are as follows. <ahref="#deflate">deflate</a> performs one or both of the
following actions:
<ul>
<li> Compress more input starting at <ahref="#next_in">next_in</a> and update <ahref="#next_in">next_in</a> and <ahref="#avail_in">avail_in</a>
accordingly. If not all input can be processed (because there is not
enough room in the output buffer), <ahref="#next_in">next_in</a> and <ahref="#avail_in">avail_in</a> are updated and
processing will resume at this point for the next call of <ahref="#deflate">deflate</a>().
Provide more output starting at <ahref="#next_out">next_out</a> and update <ahref="#next_out">next_out</a> and <ahref="#avail_out">avail_out</a>
accordingly. This action is forced if the parameter flush is non zero.
Forcing flush frequently degrades the compression ratio, so this parameter
should be set only when necessary (in interactive applications).
Some output may be provided even if flush is not set.
</ul><p>
Before the call of <ahref="#deflate">deflate</a>(), the application should ensure that at least
one of the actions is possible, by providing more input and/or consuming
more output, and updating <ahref="#avail_in">avail_in</a> or <ahref="#avail_out">avail_out</a> accordingly ; <ahref="#avail_out">avail_out</a>
should never be zero before the call. The application can consume the
compressed output when it wants, for example when the output buffer is full
(<ahref="#avail_out">avail_out</a> == 0), or after each call of <ahref="#deflate">deflate</a>(). If <ahref="#deflate">deflate</a> returns <ahref="#Z_OK">Z_OK</a>
and with zero <ahref="#avail_out">avail_out</a>, it must be called again after making room in the
output buffer because there might be more output pending.
<p>
If the parameter flush is set to <ahref="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>, all pending output is
flushed to the output buffer and the output is aligned on a byte boundary, so
that the decompressor can get all input data available so far. (In particular
<ahref="#avail_in">avail_in</a> is zero after the call if enough output space has been provided
before the call.) Flushing may degrade compression for some compression
algorithms and so it should be used only when necessary.
<p>
If flush is set to <ahref="#Z_FULL_FLUSH">Z_FULL_FLUSH</a>, all output is flushed as with
<ahref="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>, and the compression <ahref="#state">state</a> is reset so that decompression can
restart from this point if previous compressed data has been damaged or if
random access is desired. Using <ahref="#Z_FULL_FLUSH">Z_FULL_FLUSH</a> too often can seriously degrade
the compression.
<p>
If <ahref="#deflate">deflate</a> returns with <ahref="#avail_out">avail_out</a> == 0, this function must be called again
with the same value of the flush parameter and more output space (updated
<ahref="#avail_out">avail_out</a>), until the flush is complete (<ahref="#deflate">deflate</a> returns with non-zero
<ahref="#avail_out">avail_out</a>).
<p>
If the parameter flush is set to <ahref="#Z_FINISH">Z_FINISH</a>, pending input is processed,
pending output is flushed and <ahref="#deflate">deflate</a> returns with <ahref="#Z_STREAM_END">Z_STREAM_END</a> if there
was enough output space ; if <ahref="#deflate">deflate</a> returns with <ahref="#Z_OK">Z_OK</a>, this function must be
called again with <ahref="#Z_FINISH">Z_FINISH</a> and more output space (updated <ahref="#avail_out">avail_out</a>) but no
more input data, until it returns with <ahref="#Z_STREAM_END">Z_STREAM_END</a> or an error. After
<ahref="#deflate">deflate</a> has returned <ahref="#Z_STREAM_END">Z_STREAM_END</a>, the only possible operations on the
stream are <ahref="#deflateReset">deflateReset</a> or <ahref="#deflateEnd">deflateEnd</a>.
Initializes the internal stream <ahref="#state">state</a> for decompression. The fields
<ahref="#next_in">next_in</a>, <ahref="#avail_in">avail_in</a>, <ahref="#zalloc">zalloc</a>, <ahref="#zfree">zfree</a> and <ahref="#opaque">opaque</a> must be initialized before by
the caller. If <ahref="#next_in">next_in</a> is not <ahref="#Z_NULL">Z_NULL</a> and <ahref="#avail_in">avail_in</a> is large enough (the exact
value depends on the compression method), <ahref="#inflateInit">inflateInit</a> determines the
compression method from the zlib header and allocates all data structures
accordingly ; otherwise the allocation will be deferred to the first call of
<ahref="#inflate">inflate</a>. If <ahref="#zalloc">zalloc</a> and <ahref="#zfree">zfree</a> are set to <ahref="#Z_NULL">Z_NULL</a>, <ahref="#inflateInit">inflateInit</a> updates them to
use default allocation functions.
<p>
<ahref="#inflateInit">inflateInit</a> returns <ahref="#Z_OK">Z_OK</a> if success, <ahref="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
memory, <ahref="#Z_VERSION_ERROR">Z_VERSION_ERROR</a> if the zlib library version is incompatible with the
version assumed by the caller. <ahref="#msg">msg</a> is set to null if there is no error
message. <ahref="#inflateInit">inflateInit</a> does not perform any decompression apart from reading
the zlib header if present: this will be done by <ahref="#inflate">inflate</a>(). (So <ahref="#next_in">next_in</a> and
<ahref="#avail_in">avail_in</a> may be modified, but <ahref="#next_out">next_out</a> and <ahref="#avail_out">avail_out</a> are unchanged.)
<p>
<fontcolor="Blue"><dt> int <aname="inflate">inflate</a> (<ahref="#z_streamp">z_streamp</a> strm, int flush);</font>
<dd>
<ahref="#inflate">inflate</a> decompresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may some
introduce some output latency (reading input without producing any output)
except when forced to flush.
<p>
The detailed semantics are as follows. <ahref="#inflate">inflate</a> performs one or both of the
following actions:
<ul>
<li> Decompress more input starting at <ahref="#next_in">next_in</a> and update <ahref="#next_in">next_in</a> and <ahref="#avail_in">avail_in</a>
accordingly. If not all input can be processed (because there is not
enough room in the output buffer), <ahref="#next_in">next_in</a> is updated and processing
will resume at this point for the next call of <ahref="#inflate">inflate</a>().
Before the call of <ahref="#inflate">inflate</a>(), the application should ensure that at least
one of the actions is possible, by providing more input and/or consuming
more output, and updating the next_* and avail_* values accordingly.
The application can consume the uncompressed output when it wants, for
example when the output buffer is full (<ahref="#avail_out">avail_out</a> == 0), or after each
call of <ahref="#inflate">inflate</a>(). If <ahref="#inflate">inflate</a> returns <ahref="#Z_OK">Z_OK</a> and with zero <ahref="#avail_out">avail_out</a>, it
must be called again after making room in the output buffer because there
might be more output pending.
<p>
If the parameter flush is set to <ahref="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>, <ahref="#inflate">inflate</a> flushes as much
output as possible to the output buffer. The flushing behavior of <ahref="#inflate">inflate</a> is
not specified for values of the flush parameter other than <ahref="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>
and <ahref="#Z_FINISH">Z_FINISH</a>, but the current implementation actually flushes as much output
as possible anyway.
<p>
<ahref="#inflate">inflate</a>() should normally be called until it returns <ahref="#Z_STREAM_END">Z_STREAM_END</a> or an
error. However if all decompression is to be performed in a single step
(a single call of <ahref="#inflate">inflate</a>), the parameter flush should be set to
<ahref="#Z_FINISH">Z_FINISH</a>. In this case all pending input is processed and all pending
output is flushed ; <ahref="#avail_out">avail_out</a> must be large enough to hold all the
uncompressed data. (The size of the uncompressed data may have been saved
by the compressor for this purpose.) The next operation on this stream must
be <ahref="#inflateEnd">inflateEnd</a> to deallocate the decompression <ahref="#state">state</a>. The use of <ahref="#Z_FINISH">Z_FINISH</a>
is never required, but can be used to inform <ahref="#inflate">inflate</a> that a faster routine
may be used for the single <ahref="#inflate">inflate</a>() call.
<p>
If a preset dictionary is needed at this point (see <ahref="#inflateSetDictionary">inflateSetDictionary</a>
below), <ahref="#inflate">inflate</a> sets strm-<ahref="#adler">adler</a> to the <ahref="#adler32">adler32</a> checksum of the
it sets strm-> <ahref="#adler">adler</a> to the <ahref="#adler32">adler32</a> checksum of all output produced
so far (that is, <ahref="#total_out">total_out</a> bytes) and returns <ahref="#Z_OK">Z_OK</a>, <ahref="#Z_STREAM_END">Z_STREAM_END</a> or
an error code as described below. At the end of the stream, <ahref="#inflate">inflate</a>()
checks that its computed <ahref="#adler32">adler32</a> checksum is equal to that saved by the
compressor and returns <ahref="#Z_STREAM_END">Z_STREAM_END</a> only if the checksum is correct.
<p>
<ahref="#inflate">inflate</a>() returns <ahref="#Z_OK">Z_OK</a> if some progress has been made (more input processed
or more output produced), <ahref="#Z_STREAM_END">Z_STREAM_END</a> if the end of the compressed data has
been reached and all uncompressed output has been produced, <ahref="#Z_NEED_DICT">Z_NEED_DICT</a> if a
preset dictionary is needed at this point, <ahref="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the input data was
corrupted (input stream not conforming to the zlib format or incorrect
<ahref="#adler32">adler32</a> checksum), <ahref="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream structure was inconsistent
(for example if <ahref="#next_in">next_in</a> or <ahref="#next_out">next_out</a> was NULL), <ahref="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
enough memory, <ahref="#Z_BUF_ERROR">Z_BUF_ERROR</a> if no progress is possible or if there was not
enough room in the output buffer when <ahref="#Z_FINISH">Z_FINISH</a> is used. In the <ahref="#Z_DATA_ERROR">Z_DATA_ERROR</a>
case, the application may then call <ahref="#inflateSync">inflateSync</a> to look for a good
compression block.
<p>
<fontcolor="Blue"><dt> int <aname="inflateEnd">inflateEnd</a> (<ahref="#z_streamp">z_streamp</a> strm);</font>
<dd>
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any
pending output.
<p>
<ahref="#inflateEnd">inflateEnd</a> returns <ahref="#Z_OK">Z_OK</a> if success, <ahref="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream <ahref="#state">state</a>
was inconsistent. In the error case, <ahref="#msg">msg</a> may be set but then points to a
The following functions are needed only in some special applications.
<h3> Function list </h3>
<ul>
<li> int <ahref="#deflateInit2">deflateInit2</a> (<ahref="#z_streamp">z_streamp</a> strm,
<li> int <ahref="#deflateSetDictionary">deflateSetDictionary</a> (<ahref="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt dictLength);
<li> int <ahref="#deflateCopy">deflateCopy</a> (<ahref="#z_streamp">z_streamp</a> dest, <ahref="#z_streamp">z_streamp</a> source);
<li> int <ahref="#deflateReset">deflateReset</a> (<ahref="#z_streamp">z_streamp</a> strm);
<li> int <ahref="#deflateParams">deflateParams</a> (<ahref="#z_streamp">z_streamp</a> strm, int level, int strategy);
<li> int <ahref="#inflateInit2">inflateInit2</a> (<ahref="#z_streamp">z_streamp</a> strm, int windowBits);
<li> int <ahref="#inflateSetDictionary">inflateSetDictionary</a> (<ahref="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt dictLength);
<li> int <ahref="#inflateSync">inflateSync</a> (<ahref="#z_streamp">z_streamp</a> strm);
<li> int <ahref="#inflateReset">inflateReset</a> (<ahref="#z_streamp">z_streamp</a> strm);
</ul>
<h3> Function description </h3>
<dl>
<fontcolor="Blue"><dt> int <aname="deflateInit2">deflateInit2</a> (<ahref="#z_streamp">z_streamp</a> strm, int level, int method, int windowBits, int memLevel, int strategy);</font>
<dd> This is another version of <ahref="#deflateInit">deflateInit</a> with more compression options. The
fields <ahref="#next_in">next_in</a>, <ahref="#zalloc">zalloc</a>, <ahref="#zfree">zfree</a> and <ahref="#opaque">opaque</a> must be initialized before by
the caller.<p>
The method parameter is the compression method. It must be <ahref="#Z_DEFLATED">Z_DEFLATED</a> in
this version of the library.<p>
The windowBits parameter is the base two logarithm of the window size
(the size of the history buffer). It should be in the range 8..15 for this
version of the library. Larger values of this parameter result in better
compression at the expense of memory usage. The default value is 15 if
<ahref="#deflateInit">deflateInit</a> is used instead.<p>
The memLevel parameter specifies how much memory should be allocated
for the internal compression <ahref="#state">state</a>. memLevel=1 uses minimum memory but
is slow and reduces compression ratio ; memLevel=9 uses maximum memory
for optimal speed. The default value is 8. See zconf.h for total memory
usage as a function of windowBits and memLevel.<p>
The strategy parameter is used to tune the compression algorithm. Use the
value <ahref="#Z_DEFAULT_STRATEGY">Z_DEFAULT_STRATEGY</a> for normal data, <ahref="#Z_FILTERED">Z_FILTERED</a> for data produced by a
filter (or predictor), or <ahref="#Z_HUFFMAN_ONLY">Z_HUFFMAN_ONLY</a> to force Huffman encoding only (no
string match). Filtered data consists mostly of small values with a
somewhat random distribution. In this case, the compression algorithm is
tuned to <ahref="#compress">compress</a> them better. The effect of <ahref="#Z_FILTERED">Z_FILTERED</a> is to force more
Huffman coding and less string matching ; it is somewhat intermediate
between Z_DEFAULT and <ahref="#Z_HUFFMAN_ONLY">Z_HUFFMAN_ONLY</a>. The strategy parameter only affects
the compression ratio but not the correctness of the compressed output even
if it is not set appropriately.<p>
<ahref="#deflateInit2">deflateInit2</a> returns <ahref="#Z_OK">Z_OK</a> if success, <ahref="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
memory, <ahref="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a parameter is invalid (such as an invalid
method). <ahref="#msg">msg</a> is set to null if there is no error message. <ahref="#deflateInit2">deflateInit2</a> does
not perform any compression: this will be done by <ahref="#deflate">deflate</a>().<p>
<fontcolor="Blue"><dt> int <aname="deflateSetDictionary">deflateSetDictionary</a> (<ahref="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt dictLength);</font>
<dd>
Initializes the compression dictionary from the given byte sequence
without producing any compressed output. This function must be called
immediately after <ahref="#deflateInit">deflateInit</a>, <ahref="#deflateInit2">deflateInit2</a> or <ahref="#deflateReset">deflateReset</a>, before any
call of <ahref="#deflate">deflate</a>. The compressor and decompressor must use exactly the same
dictionary (see <ahref="#inflateSetDictionary">inflateSetDictionary</a>).<p>
The dictionary should consist of strings (byte sequences) that are likely
to be encountered later in the data to be compressed, with the most commonly
used strings preferably put towards the end of the dictionary. Using a
dictionary is most useful when the data to be compressed is short and can be
predicted with good accuracy ; the data can then be compressed better than
with the default empty dictionary.<p>
Depending on the size of the compression data structures selected by
<ahref="#deflateInit">deflateInit</a> or <ahref="#deflateInit2">deflateInit2</a>, a part of the dictionary may in effect be
discarded, for example if the dictionary is larger than the window size in
<ahref="#deflate">deflate</a> or deflate2. Thus the strings most likely to be useful should be
put at the end of the dictionary, not at the front.<p>
Upon return of this function, strm-> <ahref="#adler">adler</a> is set to the Adler32 value
of the dictionary ; the decompressor may later use this value to determine
which dictionary has been used by the compressor. (The Adler32 value
applies to the whole dictionary even if only a subset of the dictionary is
actually used by the compressor.)<p>
<ahref="#deflateSetDictionary">deflateSetDictionary</a> returns <ahref="#Z_OK">Z_OK</a> if success, or <ahref="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a
parameter is invalid (such as NULL dictionary) or the stream <ahref="#state">state</a> is
inconsistent (for example if <ahref="#deflate">deflate</a> has already been called for this stream
or if the compression method is bsort). <ahref="#deflateSetDictionary">deflateSetDictionary</a> does not
perform any compression: this will be done by <ahref="#deflate">deflate</a>().<p>
<fontcolor="Blue"><dt> int <aname="deflateCopy">deflateCopy</a> (<ahref="#z_streamp">z_streamp</a> dest, <ahref="#z_streamp">z_streamp</a> source);</font>
<dd>
Sets the destination stream as a complete copy of the source stream.<p>
This function can be useful when several compression strategies will be
tried, for example when there are several ways of pre-processing the input
data with a filter. The streams that will be discarded should then be freed
by calling <ahref="#deflateEnd">deflateEnd</a>. Note that <ahref="#deflateCopy">deflateCopy</a> duplicates the internal
compression <ahref="#state">state</a> which can be quite large, so this strategy is slow and
can consume lots of memory.<p>
<ahref="#deflateCopy">deflateCopy</a> returns <ahref="#Z_OK">Z_OK</a> if success, <ahref="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
enough memory, <ahref="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source stream <ahref="#state">state</a> was inconsistent
(such as <ahref="#zalloc">zalloc</a> being NULL). <ahref="#msg">msg</a> is left unchanged in both source and
destination.<p>
<fontcolor="Blue"><dt> int <aname="deflateReset">deflateReset</a> (<ahref="#z_streamp">z_streamp</a> strm);</font>
<dd> This function is equivalent to <ahref="#deflateEnd">deflateEnd</a> followed by <ahref="#deflateInit">deflateInit</a>,
but does not free and reallocate all the internal compression <ahref="#state">state</a>.
The stream will keep the same compression level and any other attributes
that may have been set by <ahref="#deflateInit2">deflateInit2</a>.<p>
<ahref="#deflateReset">deflateReset</a> returns <ahref="#Z_OK">Z_OK</a> if success, or <ahref="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source
stream <ahref="#state">state</a> was inconsistent (such as <ahref="#zalloc">zalloc</a> or <ahref="#state">state</a> being NULL).<p>
<fontcolor="Blue"><dt> int <aname="deflateParams">deflateParams</a> (<ahref="#z_streamp">z_streamp</a> strm, int level, int strategy);</font>
<dd>
Dynamically update the compression level and compression strategy. The
interpretation of level and strategy is as in <ahref="#deflateInit2">deflateInit2</a>. This can be
used to switch between compression and straight copy of the input data, or
to switch to a different kind of input data requiring a different
strategy. If the compression level is changed, the input available so far
is compressed with the old level (and may be flushed); the new level will
take effect only at the next call of <ahref="#deflate">deflate</a>().<p>
Before the call of <ahref="#deflateParams">deflateParams</a>, the stream <ahref="#state">state</a> must be set as for
a call of <ahref="#deflate">deflate</a>(), since the currently available input may have to
<ahref="#deflateParams">deflateParams</a> returns <ahref="#Z_OK">Z_OK</a> if success, <ahref="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source
stream <ahref="#state">state</a> was inconsistent or if a parameter was invalid, <ahref="#Z_BUF_ERROR">Z_BUF_ERROR</a>
if strm->avail_out was zero.<p>
<fontcolor="Blue"><dt> int <aname="inflateInit2">inflateInit2</a> (<ahref="#z_streamp">z_streamp</a> strm, int windowBits);</font>
<dd> This is another version of <ahref="#inflateInit">inflateInit</a> with an extra parameter. The
fields <ahref="#next_in">next_in</a>, <ahref="#avail_in">avail_in</a>, <ahref="#zalloc">zalloc</a>, <ahref="#zfree">zfree</a> and <ahref="#opaque">opaque</a> must be initialized
before by the caller.<p>
The windowBits parameter is the base two logarithm of the maximum window
size (the size of the history buffer). It should be in the range 8..15 for
this version of the library. The default value is 15 if <ahref="#inflateInit">inflateInit</a> is used
instead. If a compressed stream with a larger window size is given as
input, <ahref="#inflate">inflate</a>() will return with the error code <ahref="#Z_DATA_ERROR">Z_DATA_ERROR</a> instead of
trying to allocate a larger window.<p>
<ahref="#inflateInit2">inflateInit2</a> returns <ahref="#Z_OK">Z_OK</a> if success, <ahref="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
memory, <ahref="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a parameter is invalid (such as a negative
memLevel). <ahref="#msg">msg</a> is set to null if there is no error message. <ahref="#inflateInit2">inflateInit2</a>
does not perform any decompression apart from reading the zlib header if
present: this will be done by <ahref="#inflate">inflate</a>(). (So <ahref="#next_in">next_in</a> and <ahref="#avail_in">avail_in</a> may be
modified, but <ahref="#next_out">next_out</a> and <ahref="#avail_out">avail_out</a> are unchanged.)<p>
<fontcolor="Blue"><dt> int <aname="inflateSetDictionary">inflateSetDictionary</a> (<ahref="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt dictLength);</font>
<dd>
Initializes the decompression dictionary from the given uncompressed byte
sequence. This function must be called immediately after a call of <ahref="#inflate">inflate</a>
if this call returned <ahref="#Z_NEED_DICT">Z_NEED_DICT</a>. The dictionary chosen by the compressor
can be determined from the Adler32 value returned by this call of
<ahref="#inflate">inflate</a>. The compressor and decompressor must use exactly the same
dictionary (see <ahref="#deflateSetDictionary">deflateSetDictionary</a>).<p>
<ahref="#inflateSetDictionary">inflateSetDictionary</a> returns <ahref="#Z_OK">Z_OK</a> if success, <ahref="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a
parameter is invalid (such as NULL dictionary) or the stream <ahref="#state">state</a> is
inconsistent, <ahref="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the given dictionary doesn't match the
expected one (incorrect Adler32 value). <ahref="#inflateSetDictionary">inflateSetDictionary</a> does not
perform any decompression: this will be done by subsequent calls of
<ahref="#inflate">inflate</a>().<p>
<fontcolor="Blue"><dt> int <aname="inflateSync">inflateSync</a> (<ahref="#z_streamp">z_streamp</a> strm);</font>
<dd> Skips invalid compressed data until a full flush point (see above the
description of <ahref="#deflate">deflate</a> with <ahref="#Z_FULL_FLUSH">Z_FULL_FLUSH</a>) can be found, or until all
available input is skipped. No output is provided.<p>
<ahref="#inflateSync">inflateSync</a> returns <ahref="#Z_OK">Z_OK</a> if a full flush point has been found, <ahref="#Z_BUF_ERROR">Z_BUF_ERROR</a>
if no more input was provided, <ahref="#Z_DATA_ERROR">Z_DATA_ERROR</a> if no flush point has been found,
or <ahref="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream structure was inconsistent. In the success
case, the application may save the current current value of <ahref="#total_in">total_in</a> which
indicates where valid compressed data was found. In the error case, the
application may repeatedly call <ahref="#inflateSync">inflateSync</a>, providing more input each time,
until success or end of the input data.<p>
<fontcolor="Blue"><dt> int <aname="inflateReset">inflateReset</a> (<ahref="#z_streamp">z_streamp</a> strm);</font>
<dd>
This function is equivalent to <ahref="#inflateEnd">inflateEnd</a> followed by <ahref="#inflateInit">inflateInit</a>,
but does not free and reallocate all the internal decompression <ahref="#state">state</a>.
The stream will keep attributes that may have been set by <ahref="#inflateInit2">inflateInit2</a>.
<p>
<ahref="#inflateReset">inflateReset</a> returns <ahref="#Z_OK">Z_OK</a> if success, or <ahref="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source
stream <ahref="#state">state</a> was inconsistent (such as <ahref="#zalloc">zalloc</a> or <ahref="#state">state</a> being NULL).