|
The windowBits parameter is the base two logarithm of the maximum window |
|
size (the size of the history buffer). It should be in the range 8..15 for |
|
this version of the library. The default value is 15 if inflateInit is used |
|
instead. windowBits must be greater than or equal to the windowBits value |
|
provided to deflateInit2() while compressing, or it must be equal to 15 if |
|
deflateInit2() was not used. If a compressed stream with a larger window |
|
size is given as input, inflate() will return with the error code |
|
Z_DATA_ERROR instead of trying to allocate a larger window. |
For raw and gzip streams, which don't declare a window size in the header, if the caller provides a large enough output buffer, then the decompression may succeed despite requiring a larger window size than provided; the Z_DATA_ERROR seems to be triggered only when match distance exceeds the window + already written data in the buffer.
I presume this is only an issue with the documentation and not with the code. (It confused my LLM, I figured I'd report it here in case clarifying the documentation is useful.)
zlib/zlib.h
Lines 866 to 873 in e3dc0a8
For raw and gzip streams, which don't declare a window size in the header, if the caller provides a large enough output buffer, then the decompression may succeed despite requiring a larger window size than provided; the
Z_DATA_ERRORseems to be triggered only when match distance exceeds the window + already written data in the buffer.I presume this is only an issue with the documentation and not with the code. (It confused my LLM, I figured I'd report it here in case clarifying the documentation is useful.)