diff options
| author | Josh Triplett <josh@joshtriplett.org> | 2020-08-16 16:12:13 -0700 |
|---|---|---|
| committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2020-08-20 12:05:55 +0200 |
| commit | 1a46fb9ee1b6926eb8635d32d7f7c1c023a79625 (patch) | |
| tree | af3d0eff7f5f3441046033b93ac07bc0d534ee2f | |
| parent | 7b590b36669e3b2f45040b0f8f9a5f03768b8549 (diff) | |
| download | Project-Tick-1a46fb9ee1b6926eb8635d32d7f7c1c023a79625.tar.gz Project-Tick-1a46fb9ee1b6926eb8635d32d7f7c1c023a79625.zip | |
Fix testsuite warnings on Windows, using PRIu64
zlib-ng already counts on inttypes.h and stdint.h, so use those to avoid
printf-related warnings by casting integer fields whose size may vary to
uint64_t and printing them that way.
| -rw-r--r-- | test/example.c | 3 | ||||
| -rw-r--r-- | test/fuzz/example_large_fuzzer.c | 2 | ||||
| -rw-r--r-- | test/infcover.c | 10 | ||||
| -rw-r--r-- | trees_emit.h | 7 |
4 files changed, 14 insertions, 8 deletions
diff --git a/test/example.c b/test/example.c index c744fe71ec..70969f46e5 100644 --- a/test/example.c +++ b/test/example.c @@ -16,6 +16,7 @@ #include <string.h> #include <stdlib.h> #include <inttypes.h> +#include <stdint.h> #define TESTFILE "foo.gz" @@ -452,7 +453,7 @@ void test_large_inflate(unsigned char *compr, size_t comprLen, unsigned char *un CHECK_ERR(err, "inflateEnd"); if (d_stream.total_out != 2*uncomprLen + diff) { - fprintf(stderr, "bad large inflate: %zu\n", d_stream.total_out); + fprintf(stderr, "bad large inflate: %" PRIu64 "\n", (uint64_t)d_stream.total_out); exit(1); } else { printf("large_inflate(): OK\n"); diff --git a/test/fuzz/example_large_fuzzer.c b/test/fuzz/example_large_fuzzer.c index 4f90a7ff72..bd27a84f12 100644 --- a/test/fuzz/example_large_fuzzer.c +++ b/test/fuzz/example_large_fuzzer.c @@ -109,7 +109,7 @@ void test_large_inflate(unsigned char *compr, size_t comprLen, unsigned char *un CHECK_ERR(err, "inflateEnd"); if (d_stream.total_out != 2 * uncomprLen + diff) { - fprintf(stderr, "bad large inflate: %zu\n", d_stream.total_out); + fprintf(stderr, "bad large inflate: %" PRIu64 "\n", (uint64_t)d_stream.total_out); exit(1); } } diff --git a/test/infcover.c b/test/infcover.c index 6c96bb5650..ebba626cf5 100644 --- a/test/infcover.c +++ b/test/infcover.c @@ -10,6 +10,8 @@ #include <string.h> #undef NDEBUG #include <assert.h> +#include <inttypes.h> +#include <stdint.h> /* get definition of internal structure so we can mess with it (see pull()), and so we can call inflate_trees() (see cover5()) */ @@ -184,14 +186,14 @@ static void mem_limit(PREFIX3(stream) *strm, size_t limit) { static void mem_used(PREFIX3(stream) *strm, char *prefix) { struct mem_zone *zone = strm->opaque; - fprintf(stderr, "%s: %zu allocated\n", prefix, zone->total); + fprintf(stderr, "%s: %" PRIu64 " allocated\n", prefix, (uint64_t)zone->total); } /* show the high water allocation in bytes */ static void mem_high(PREFIX3(stream) *strm, char *prefix) { struct mem_zone *zone = strm->opaque; - fprintf(stderr, "%s: %zu high water mark\n", prefix, zone->highwater); + fprintf(stderr, "%s: %" PRIu64 " high water mark\n", prefix, (uint64_t)zone->highwater); } /* release the memory allocation zone -- if there are any surprises, notify */ @@ -215,8 +217,8 @@ static void mem_done(PREFIX3(stream) *strm, char *prefix) { /* issue alerts about anything unexpected */ if (count || zone->total) - fprintf(stderr, "** %s: %zu bytes in %d blocks not freed\n", - prefix, zone->total, count); + fprintf(stderr, "** %s: %" PRIu64 " bytes in %d blocks not freed\n", + prefix, (uint64_t)zone->total, count); if (zone->notlifo) fprintf(stderr, "** %s: %d frees not LIFO\n", prefix, zone->notlifo); if (zone->rogue) diff --git a/trees_emit.h b/trees_emit.h index 4cb17db85c..512429f3d7 100644 --- a/trees_emit.h +++ b/trees_emit.h @@ -6,8 +6,11 @@ #ifdef ZLIB_DEBUG # include <ctype.h> +# include <inttypes.h> +# include <stdint.h> #endif + /* trees.h */ extern ZLIB_INTERNAL const ct_data static_ltree[L_CODES+2]; extern ZLIB_INTERNAL const ct_data static_dtree[D_CODES]; @@ -170,8 +173,8 @@ static inline void zng_emit_end_block(deflate_state *s, const ct_data *ltree, co send_code(s, END_BLOCK, ltree, bi_buf, bi_valid); s->bi_valid = bi_valid; s->bi_buf = bi_buf; - Tracev((stderr, "\n+++ Emit End Block: Last: %u Pending: %u Total Out: %zu\n", - last, s->pending, s->strm->total_out)); + Tracev((stderr, "\n+++ Emit End Block: Last: %u Pending: %u Total Out: %" PRIu64 "\n", + last, s->pending, (uint64_t)s->strm->total_out)); (void)last; } |
