From 0df9ea4dc01086574184470042a2fc3e00a9d6a3 Mon Sep 17 00:00:00 2001 From: Rose <83477269+AtariDreams@users.noreply.github.com> Date: Tue, 2 May 2023 11:45:41 -0400 Subject: [PATCH] Use the correct format specifiers. opt_len, static_len, bits_sent, etc. are all unsigned longs, not signed longs. --- test/example.c | 2 +- test/minigzip.c | 2 +- trees.c | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/example.c b/test/example.c index 1470bc842..9d62a30b9 100644 --- a/test/example.c +++ b/test/example.c @@ -362,7 +362,7 @@ void test_large_inflate(compr, comprLen, uncompr, uncomprLen) CHECK_ERR(err, "inflateEnd"); if (d_stream.total_out != 2*uncomprLen + comprLen/2) { - fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); + fprintf(stderr, "bad large inflate: %lu\n", d_stream.total_out); exit(1); } else { printf("large_inflate(): OK\n"); diff --git a/test/minigzip.c b/test/minigzip.c index a649d2b3d..4b16cb444 100644 --- a/test/minigzip.c +++ b/test/minigzip.c @@ -109,7 +109,7 @@ static char *strwinerror (error) LocalFree(msgbuf); } else { - sprintf(buf, "unknown win32 error (%ld)", error); + sprintf(buf, "unknown win32 error (%u)", error); } SetLastError(lasterr); diff --git a/trees.c b/trees.c index 5f305c472..72f06a0bf 100644 --- a/trees.c +++ b/trees.c @@ -820,7 +820,7 @@ local int build_bl_tree(s) } /* Update opt_len to include the bit length tree and counts */ s->opt_len += 3*((ulg)max_blindex + 1) + 5 + 5 + 4; - Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + Tracev((stderr, "\ndyn trees: dyn %lu, stat %lu", s->opt_len, s->static_len)); return max_blindex; @@ -848,13 +848,13 @@ local void send_all_trees(s, lcodes, dcodes, blcodes) Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); } - Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + Tracev((stderr, "\nbl tree: sent %lu", s->bits_sent)); send_tree(s, (ct_data *)s->dyn_ltree, lcodes - 1); /* literal tree */ - Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + Tracev((stderr, "\nlit tree: sent %lu", s->bits_sent)); send_tree(s, (ct_data *)s->dyn_dtree, dcodes - 1); /* distance tree */ - Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); + Tracev((stderr, "\ndist tree: sent %lu", s->bits_sent)); } /* =========================================================================== @@ -927,11 +927,11 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) /* Construct the literal and distance trees */ build_tree(s, (tree_desc *)(&(s->l_desc))); - Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + Tracev((stderr, "\nlit data: dyn %lu, stat %lu", s->opt_len, s->static_len)); build_tree(s, (tree_desc *)(&(s->d_desc))); - Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + Tracev((stderr, "\ndist data: dyn %lu, stat %lu", s->opt_len, s->static_len)); /* At this point, opt_len and static_len are the total bit lengths of * the compressed block data, excluding the tree representations.