From 0b828b4aa6c962ab46eae624578d77b35395b2c1 Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Thu, 29 Dec 2011 13:19:27 -0800 Subject: 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. --- trees.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'trees.c') diff --git a/trees.c b/trees.c index d5e1a56..8c32b21 100644 --- a/trees.c +++ b/trees.c @@ -876,6 +876,15 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ } +/* =========================================================================== + * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) + */ +void ZLIB_INTERNAL _tr_flush_bits(s) + deflate_state *s; +{ + bi_flush(s); +} + /* =========================================================================== * Send one empty static block to give enough lookahead for inflate. * This takes 10 bits, of which 7 may remain in the bit buffer. -- cgit v1.2.3-55-g6feb