Skip to content

Commit

Permalink
Document in zlib.h the initialization of stream fields by the Init
Browse files Browse the repository at this point in the history
and Reset functions.
  • Loading branch information
madler committed Jul 10, 2023
1 parent 263a982 commit a88f727
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions zlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level);
Initializes the internal stream state for compression. The fields
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
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:
1 gives best speed, 9 gives best compression, 0 gives no compression at all
Expand Down Expand Up @@ -383,7 +383,8 @@ ZEXTERN int ZEXPORT inflateInit(z_streamp strm);
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
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
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
Expand Down Expand Up @@ -696,7 +697,7 @@ ZEXTERN int ZEXPORT deflateReset(z_streamp strm);
This function is equivalent to deflateEnd followed by deflateInit, but
does not free and reallocate the internal compression state. The stream
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
stream state was inconsistent (such as zalloc or state being Z_NULL).
Expand Down Expand Up @@ -962,6 +963,7 @@ ZEXTERN int ZEXPORT inflateReset(z_streamp strm);
This function is equivalent to inflateEnd followed by inflateInit,
but does not free and reallocate the internal decompression state. The
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
stream state was inconsistent (such as zalloc or state being Z_NULL).
Expand Down

0 comments on commit a88f727

Please sign in to comment.