]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed casting warnings in trees.c with count being int and freq being uint16_t.
authorNathan Moinvaziri <nathan@nathanm.com>
Wed, 27 May 2020 00:21:13 +0000 (17:21 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 30 May 2020 19:25:18 +0000 (21:25 +0200)
Changed to use uint16_t for all counting variable types.

  trees.c(431,45): warning C4244: '+=': conversion from 'int' to 'uint16_t', possible loss of data
  trees.c(431,45): warning C4244: '+=': conversion from 'int' to 'uint16_t', possible loss of data

trees.c

diff --git a/trees.c b/trees.c
index dc7757e8a9a6e3f99ba6034949deb549f1f4bd29..cfa041206cd3f95306065d4f176f4e5eb0147ebd 100644 (file)
--- a/trees.c
+++ b/trees.c
@@ -413,9 +413,9 @@ static void scan_tree(deflate_state *s, ct_data *tree, int max_code) {
     int prevlen = -1;          /* last emitted length */
     int curlen;                /* length of current code */
     int nextlen = tree[0].Len; /* length of next code */
-    int count = 0;             /* repeat count of the current code */
-    int max_count = 7;         /* max repeat count */
-    int min_count = 4;         /* min repeat count */
+    uint16_t count = 0;        /* repeat count of the current code */
+    uint16_t max_count = 7;    /* max repeat count */
+    uint16_t min_count = 4;    /* min repeat count */
 
     if (nextlen == 0)
         max_count = 138, min_count = 3;