diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-12-29 13:19:27 -0800 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2012-01-07 14:08:02 -0800 |
commit | 0b828b4aa6c962ab46eae624578d77b35395b2c1 (patch) | |
tree | 6c61daa3f02cd938d5f2434a3c3be2998866a43d /trees.c | |
parent | 8f5eceefe8b384d7c18813519cb337efef21a0f3 (diff) | |
download | zlib-0b828b4aa6c962ab46eae624578d77b35395b2c1.tar.gz zlib-0b828b4aa6c962ab46eae624578d77b35395b2c1.tar.bz2 zlib-0b828b4aa6c962ab46eae624578d77b35395b2c1.zip |
Write out all of the available bits when using Z_BLOCK.
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.
Diffstat (limited to 'trees.c')
-rw-r--r-- | trees.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -877,6 +877,15 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) | |||
877 | } | 877 | } |
878 | 878 | ||
879 | /* =========================================================================== | 879 | /* =========================================================================== |
880 | * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) | ||
881 | */ | ||
882 | void ZLIB_INTERNAL _tr_flush_bits(s) | ||
883 | deflate_state *s; | ||
884 | { | ||
885 | bi_flush(s); | ||
886 | } | ||
887 | |||
888 | /* =========================================================================== | ||
880 | * Send one empty static block to give enough lookahead for inflate. | 889 | * Send one empty static block to give enough lookahead for inflate. |
881 | * This takes 10 bits, of which 7 may remain in the bit buffer. | 890 | * This takes 10 bits, of which 7 may remain in the bit buffer. |
882 | */ | 891 | */ |