]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed warning about bi_flush being defined but not used. #592
authorNathan Moinvaziri <nathan@nathanm.com>
Mon, 25 May 2020 04:30:52 +0000 (21:30 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 30 May 2020 19:25:18 +0000 (21:25 +0200)
    trees_emit.h:75:13: warning: ‘bi_flush’ defined but not used

trees.c
trees_emit.h

diff --git a/trees.c b/trees.c
index 24fa12a6557e55c3e0a7cd29490e3f42fd3096fe..dc7757e8a9a6e3f99ba6034949deb549f1f4bd29 100644 (file)
--- 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)
index e429ad568c13e0ae88d1eec54ae9bca7ea7d5fd7..efc4a71b0f83db7ca1e7ed35a9e1445106b4f340 100644 (file)
@@ -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
  */