From 85e0910e6ec2b81ff4b9232015a30b369aef8c0c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 27 Jun 2022 13:16:28 -0500 Subject: gzip: match printf format to arg type This pacifies gcc -Wformat -DDEBUG. * bits.c (send_bits): * deflate.c (check_match): * inflate.c (huft_build, inflate_codes): * trees.c (send_code, gen_codes, flush_block): Use correct printf formats for signed vs unsigned integers. --- inflate.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'inflate.c') diff --git a/inflate.c b/inflate.c index f54eb65..199a935 100644 --- a/inflate.c +++ b/inflate.c @@ -310,8 +310,18 @@ int *m /* maximum lookup bits, returns actual */ memzero(c, sizeof(c)); p = b; i = n; do { - Tracecv(*p, (stderr, (n-i >= ' ' && n-i <= '~' ? "%c %d\n" : "0x%x %d\n"), - n-i, *p)); +#ifdef DEBUG + if (1 < verbose && *p) + { + if (' ' <= n - i && n - i <= '~') + { + char ch = n - i; + fprintf (stderr, "%c %u\n", ch, *p); + } + else + fprintf (stderr, "0x%x %u\n", n - i, *p); + } +#endif c[*p]++; /* assume all entries <= BMAX */ p++; /* Can't combine with above line (Solaris bug) */ } while (--i); @@ -572,7 +582,7 @@ inflate_codes(struct huft *tl, struct huft *td, int bl, int bd) NEEDBITS(e) d = w - t->v.n - ((unsigned)b & mask_bits[e]); DUMPBITS(e) - Tracevv((stderr,"\\[%d,%d]", w-d, n)); + Tracevv ((stderr, "\\[%u,%u]", w - d, n)); /* do the copy */ do { -- cgit v1.2.1