Document in zlib.h the initialization of stream fields by the Init

and Reset functions.
This commit is contained in:
Mark Adler 2023-07-10 11:27:50 -07:00
parent 263a982866
commit a88f727dbe

8
zlib.h
View File

@ -230,7 +230,7 @@ ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level);
Initializes the internal stream state for compression. The fields Initializes the internal stream state for compression. The fields
zalloc, zfree and opaque must be initialized before by the caller. If zalloc, zfree and opaque must be initialized before by the caller. If
zalloc and zfree are set to Z_NULL, deflateInit updates them to use default zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
allocation functions. allocation functions. total_in, total_out, adler, and msg are initialized.
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
1 gives best speed, 9 gives best compression, 0 gives no compression at all 1 gives best speed, 9 gives best compression, 0 gives no compression at all
@ -383,7 +383,8 @@ ZEXTERN int ZEXPORT inflateInit(z_streamp strm);
read or consumed. The allocation of a sliding window will be deferred to read or consumed. The allocation of a sliding window will be deferred to
the first call of inflate (if the decompression does not complete on the the first call of inflate (if the decompression does not complete on the
first call). If zalloc and zfree are set to Z_NULL, inflateInit updates first call). If zalloc and zfree are set to Z_NULL, inflateInit updates
them to use default allocation functions. them to use default allocation functions. total_in, total_out, adler, and
msg are initialized.
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
@ -696,7 +697,7 @@ ZEXTERN int ZEXPORT deflateReset(z_streamp strm);
This function is equivalent to deflateEnd followed by deflateInit, but This function is equivalent to deflateEnd followed by deflateInit, but
does not free and reallocate the internal compression state. The stream does not free and reallocate the internal compression state. The stream
will leave the compression level and any other attributes that may have been will leave the compression level and any other attributes that may have been
set unchanged. set unchanged. total_in, total_out, adler, and msg are initialized.
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being Z_NULL). stream state was inconsistent (such as zalloc or state being Z_NULL).
@ -962,6 +963,7 @@ ZEXTERN int ZEXPORT inflateReset(z_streamp strm);
This function is equivalent to inflateEnd followed by inflateInit, This function is equivalent to inflateEnd followed by inflateInit,
but does not free and reallocate the internal decompression state. The but does not free and reallocate the internal decompression state. The
stream will keep attributes that may have been set by inflateInit2. stream will keep attributes that may have been set by inflateInit2.
total_in, total_out, adler, and msg are initialized.
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being Z_NULL). stream state was inconsistent (such as zalloc or state being Z_NULL).