diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2012-03-14 11:16:22 -0700 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2012-03-14 11:16:22 -0700 |
| commit | da32fd28927eeed480185184f1a3847f828235d1 (patch) | |
| tree | 9836e25b278ec57e10dd827c88a257b9c134adb3 | |
| parent | 50a1738fcb0e5d1e84275cfe3a052c5e32449b84 (diff) | |
| download | zlib-da32fd28927eeed480185184f1a3847f828235d1.tar.gz zlib-da32fd28927eeed480185184f1a3847f828235d1.tar.bz2 zlib-da32fd28927eeed480185184f1a3847f828235d1.zip | |
Improve inflate() documentation on the use of Z_FINISH.
| -rw-r--r-- | zlib.h | 19 |
1 files changed, 11 insertions, 8 deletions
| @@ -452,14 +452,17 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); | |||
| 452 | error. However if all decompression is to be performed in a single step (a | 452 | error. However if all decompression is to be performed in a single step (a |
| 453 | single call of inflate), the parameter flush should be set to Z_FINISH. In | 453 | single call of inflate), the parameter flush should be set to Z_FINISH. In |
| 454 | this case all pending input is processed and all pending output is flushed; | 454 | this case all pending input is processed and all pending output is flushed; |
| 455 | avail_out must be large enough to hold all the uncompressed data. (The size | 455 | avail_out must be large enough to hold all of the uncompressed data for the |
| 456 | of the uncompressed data may have been saved by the compressor for this | 456 | operation to complete. (The size of the uncompressed data may have been |
| 457 | purpose.) The next operation on this stream must be inflateEnd to deallocate | 457 | saved by the compressor for this purpose.) The use of Z_FINISH is not |
| 458 | the decompression state. The use of Z_FINISH is not required to perform an | 458 | required to perform an inflation in one step. However it may be used to |
| 459 | inflation in one step. However it may be used to inform inflate that a | 459 | inform inflate that a faster approach can be used for the single inflate() |
| 460 | faster approach can be used for the single inflate() call. Z_FINISH also | 460 | call. Z_FINISH also informs inflate to not maintain a sliding window if the |
| 461 | informs inflate to not maintain a sliding window if the stream completes, | 461 | stream completes, which reduces inflate's memory footprint. If the stream |
| 462 | which reduces inflate's memory footprint. | 462 | does not complete, either because not all of the stream is provided or not |
| 463 | enough output space is provided, then a sliding window will be allocated and | ||
| 464 | inflate() can be called again to continue the operation as if Z_NO_FLUSH had | ||
| 465 | been used. | ||
| 463 | 466 | ||
| 464 | In this implementation, inflate() always flushes as much output as | 467 | In this implementation, inflate() always flushes as much output as |
| 465 | possible to the output buffer, and always uses the faster approach on the | 468 | possible to the output buffer, and always uses the faster approach on the |
