]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
send_bits_trace: placate -Wformat
authorIlya Leoshkevich <iii@linux.ibm.com>
Tue, 21 Jul 2020 11:18:10 +0000 (13:18 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sun, 23 Aug 2020 08:07:07 +0000 (10:07 +0200)
value, which can be uint64_t, is printed using %llx, which, strictly
speaking, is not correct, and triggers -Wformat.

Since we don't really know what type value can have (send_bits_trace
is a macro), don't use <inttypes.h>, but rather cast it to long long.
Also cast length to int in order to prevent similar issues in the
future.

trees_emit.h

index 512429f3d7ddd61498d85d0a0bd3a3248979c212..dfce22bfc046f2d97563b8a385ab2685172e9228 100644 (file)
@@ -24,7 +24,7 @@ extern ZLIB_INTERNAL const int base_dist[D_CODES];
 /* Bit buffer and deflate code stderr tracing */
 #ifdef ZLIB_DEBUG
 #  define send_bits_trace(s, value, length) { \
-        Tracevv((stderr, " l %2d v %4llx ", length, value)); \
+        Tracevv((stderr, " l %2d v %4llx ", (int)(length), (long long)(value))); \
         Assert(length > 0 && length <= BIT_BUF_SIZE, "invalid length"); \
     }
 #  define send_code_trace(s, c) \