This patch allows zlib to compile cleanly with the -Wcast-qual gcc
warning enabled, but only if ZLIB_CONST is defined, which adds
const to next_in and msg in z_stream and in the in_func prototype.
A --const option is added to ./configure which adds -DZLIB_CONST
to the compile flags, and adds -Wcast-qual to the compile flags
when ZLIBGCCWARN is set in the environment.
Previously, the bit buffer would hold 1 to 16 bits after "all" of the
output is provided after a Z_BLOCK deflate() call. Now at most seven
bits remain in the output buffer after Z_BLOCK. flush_pending() now
flushes the bit buffer before copying out the byte buffer, in order
for it to really flush as much as possible.
Z_PARTIAL_FLUSH would sometimes emit two empty static blocks instead
of one in order to provide enough lookahead for inflate to be able
to decode what was last compressed. inflate no longer needs that
much lookahead, so this removes the possibility of emitting the
second empty static block. Z_PARTIAL_FLUSH will now emit only one
empty static block.