Improve inflate() documentation on the use of Z_FINISH.
This commit is contained in:
19
zlib.h
19
zlib.h
@@ -452,14 +452,17 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
|
|||||||
error. However if all decompression is to be performed in a single step (a
|
error. However if all decompression is to be performed in a single step (a
|
||||||
single call of inflate), the parameter flush should be set to Z_FINISH. In
|
single call of inflate), the parameter flush should be set to Z_FINISH. In
|
||||||
this case all pending input is processed and all pending output is flushed;
|
this case all pending input is processed and all pending output is flushed;
|
||||||
avail_out must be large enough to hold all the uncompressed data. (The size
|
avail_out must be large enough to hold all of the uncompressed data for the
|
||||||
of the uncompressed data may have been saved by the compressor for this
|
operation to complete. (The size of the uncompressed data may have been
|
||||||
purpose.) The next operation on this stream must be inflateEnd to deallocate
|
saved by the compressor for this purpose.) The use of Z_FINISH is not
|
||||||
the decompression state. The use of Z_FINISH is not required to perform an
|
required to perform an inflation in one step. However it may be used to
|
||||||
inflation in one step. However it may be used to inform inflate that a
|
inform inflate that a faster approach can be used for the single inflate()
|
||||||
faster approach can be used for the single inflate() call. Z_FINISH also
|
call. Z_FINISH also informs inflate to not maintain a sliding window if the
|
||||||
informs inflate to not maintain a sliding window if the stream completes,
|
stream completes, which reduces inflate's memory footprint. If the stream
|
||||||
which reduces inflate's memory footprint.
|
does not complete, either because not all of the stream is provided or not
|
||||||
|
enough output space is provided, then a sliding window will be allocated and
|
||||||
|
inflate() can be called again to continue the operation as if Z_NO_FLUSH had
|
||||||
|
been used.
|
||||||
|
|
||||||
In this implementation, inflate() always flushes as much output as
|
In this implementation, inflate() always flushes as much output as
|
||||||
possible to the output buffer, and always uses the faster approach on the
|
possible to the output buffer, and always uses the faster approach on the
|
||||||
|
|||||||
Reference in New Issue
Block a user