inflate — Attempts to decompress data until either the input buffer is empty or the output buffer is full.
Libz.lib
#include <zlib.h>
int inflate(z_streamp stream, int flush);
On success, inflate()
shall return Z_OK if decompression
progress has been
made,
or Z_STREAM_END if all of the input
data
has been decompressed and there was sufficient space in the output
buffer to store the uncompressed result.
On error, inflate() shall return a value to
indicate
the error.
Note: If inflate() returns Z_OK and has set
avail_out
to zero, the function should be called again with the same value for flush, and with updatednext_out
andavail_out
until inflate() returns with either Z_OK or Z_STREAM_END and a non-zeroavail_out
.
On success, inflate()
shall set the adler
to the Adler-32
checksum of
the output produced so far (i.e. total_out
bytes).
The inflate()
function shall attempt to
decompress
data until either the input buffer is empty or the output buffer is
full.
The stream references a
z_stream structure. Before the first call
to
inflate(), this structure
should have been initialized by a call to inflateInit2_().
Note: inflateInit2_() is only in the binary standard; source level applications should initialize stream via a call to inflateInit() or inflateInit2().
The inflate() function shall perform one or both of the following actions:
Decompress input data from next_in
and update next_in
, avail_in
and total_in
to reflect the data that
has been decompressed.
Fill the output buffer referenced by next_out
,
and update next_out
,
avail_out
, and total_out
to reflect the
decompressed data that has been placed there. If flush
is not Z_NO_FLUSH
, and avail_out
indicates that there is
still space in
output buffer, this action shall always occur (see below for further
details).
The inflate()
function shall return when
either
avail_in
reaches zero (indicating that
all the input
data has been compressed), or avail_out
reaches
zero (indicating that the output buffer is full).
On success, the inflate()
function shall
set the
adler
field of the stream
to the Adler-32 checksum of all the input data compressed
so far (represented by total_in
).
To decompress data until either the input buffer is empty or the
output buffer is full:
#include <stdio.h> |
The parameter flush
determines
when uncompressed bytes
are added to the output buffer in next_out
.
If flush is Z_NO_FLUSH
,
inflate()
may return with some data pending output, and not yet added to the
output buffer.
If flush
is Z_SYNC_FLUSH
,
inflate() shall flush all pending output to
next_out
, and update
next_out
and avail_out
accordingly.
If flush
is set to Z_BLOCK
,
inflate() shall stop adding data to the
output
buffer if and when the next compressed block boundary is reached.
If flush
is set to Z_FINISH
,
all of the compressed input shall be decompressed and added to
the output. If there is insufficient output space (i.e. the compressed
input data uncompresses to more than avail_out
bytes), then inflate() shall fail and return
Z_BUF_ERROR.
On error, inflate()
shall return a value
as described below, and may set the msg
field of stream to point to a string
describing the error:
For additional information or queries on this page send feedback
© 2007-2009 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user. |
|