From 78a9f84fd626edc23d4ab5bb946a76db45716d8a Mon Sep 17 00:00:00 2001 From: Nathan Moinvaziri Date: Sun, 24 May 2020 21:30:52 -0700 Subject: [PATCH] Fixed warning about bi_flush being defined but not used. #592 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit trees_emit.h:75:13: warning: ‘bi_flush’ defined but not used --- trees.c | 29 +++++++++++++++++++++++++++++ trees_emit.h | 28 ---------------------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/trees.c b/trees.c index 24fa12a6..dc7757e8 100644 --- a/trees.c +++ b/trees.c @@ -75,6 +75,7 @@ static int build_bl_tree (deflate_state *s); static void send_all_trees (deflate_state *s, int lcodes, int dcodes, int blcodes); static void compress_block (deflate_state *s, const ct_data *ltree, const ct_data *dtree); static int detect_data_type (deflate_state *s); +static void bi_flush (deflate_state *s); /* =========================================================================== * Initialize the tree data structures for a new zlib stream. @@ -778,6 +779,34 @@ static int detect_data_type(deflate_state *s) { return Z_BINARY; } +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +static void bi_flush(deflate_state *s) { + if (s->bi_valid == 64) { + put_uint64(s, s->bi_buf); + s->bi_buf = 0; + s->bi_valid = 0; + } + else { + if (s->bi_valid >= 32) { + put_uint32(s, (uint32_t)s->bi_buf); + s->bi_buf >>= 32; + s->bi_valid -= 32; + } + if (s->bi_valid >= 16) { + put_short(s, (uint16_t)s->bi_buf); + s->bi_buf >>= 16; + s->bi_valid -= 16; + } + if (s->bi_valid >= 8) { + put_byte(s, s->bi_buf); + s->bi_buf >>= 8; + s->bi_valid -= 8; + } + } +} + /* =========================================================================== * Reverse the first len bits of a code, using straightforward code (a faster * method would use a table) diff --git a/trees_emit.h b/trees_emit.h index e429ad56..efc4a71b 100644 --- a/trees_emit.h +++ b/trees_emit.h @@ -69,34 +69,6 @@ extern ZLIB_INTERNAL const int base_dist[D_CODES]; send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid) #endif -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -static void bi_flush(deflate_state *s) { - if (s->bi_valid == 64) { - put_uint64(s, s->bi_buf); - s->bi_buf = 0; - s->bi_valid = 0; - } - else { - if (s->bi_valid >= 32) { - put_uint32(s, (uint32_t)s->bi_buf); - s->bi_buf >>= 32; - s->bi_valid -= 32; - } - if (s->bi_valid >= 16) { - put_short(s, (uint16_t)s->bi_buf); - s->bi_buf >>= 16; - s->bi_valid -= 16; - } - if (s->bi_valid >= 8) { - put_byte(s, s->bi_buf); - s->bi_buf >>= 8; - s->bi_valid -= 8; - } - } -} - /* =========================================================================== * Flush the bit buffer and align the output on a byte boundary */ -- 2.47.2