diff options
| author | Mika Lindqvist <postmaster@raasu.org> | 2025-10-09 11:40:16 +0300 |
|---|---|---|
| committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2025-10-22 13:17:13 +0200 |
| commit | 7b29794c1807fcdeb1b81729a1d7ae1ac93fbd8b (patch) | |
| tree | f75d419023930084ea11b919a23b935e0892fdda /test | |
| parent | fa09b0558fd30943a65c45e360703c15ec0a72e3 (diff) | |
| download | Project-Tick-7b29794c1807fcdeb1b81729a1d7ae1ac93fbd8b.tar.gz Project-Tick-7b29794c1807fcdeb1b81729a1d7ae1ac93fbd8b.zip | |
Fix type mismatch on platforms where int32_t and uint32_t use long instead of int
* Based on PR #1934
Diffstat (limited to 'test')
| -rw-r--r-- | test/example.c | 10 | ||||
| -rw-r--r-- | test/infcover.c | 4 | ||||
| -rw-r--r-- | test/minideflate.c | 9 | ||||
| -rw-r--r-- | test/minigzip.c | 2 | ||||
| -rw-r--r-- | test/switchlevels.c | 3 |
5 files changed, 15 insertions, 13 deletions
diff --git a/test/example.c b/test/example.c index f52cad427d..5393fa5de9 100644 --- a/test/example.c +++ b/test/example.c @@ -74,7 +74,7 @@ static void test_gzio(const char *fname, unsigned char *uncompr, z_size_t uncomp #ifdef NO_GZCOMPRESS fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); #else - int err; + z_int32_t err; size_t read; size_t len = strlen(hello)+1; gzFile file; @@ -653,7 +653,7 @@ static void test_deflate_get_dict(unsigned char *compr, size_t comprLen) { PREFIX3(stream) c_stream; /* compression stream */ int err; unsigned char *dictNew = NULL; - unsigned int *dictLen; + z_uint32_t *dictLen; c_stream.zalloc = zalloc; c_stream.zfree = zfree; @@ -674,7 +674,7 @@ static void test_deflate_get_dict(unsigned char *compr, size_t comprLen) { error("deflate should report Z_STREAM_END\n"); dictNew = calloc(256, 1); - dictLen = (unsigned int *)calloc(4, 1); + dictLen = (z_uint32_t *)calloc(4, 1); err = PREFIX(deflateGetDictionary)(&c_stream, dictNew, dictLen); CHECK_ERR(err, "deflateGetDictionary"); @@ -695,8 +695,8 @@ static void test_deflate_get_dict(unsigned char *compr, size_t comprLen) { static void test_deflate_pending(unsigned char *compr, size_t comprLen) { PREFIX3(stream) c_stream; /* compression stream */ int err; - int *bits = calloc(256, 1); - unsigned *ped = calloc(256, 1); + z_int32_t *bits = calloc(256, 1); + z_uint32_t *ped = calloc(256, 1); size_t len = strlen(hello)+1; diff --git a/test/infcover.c b/test/infcover.c index e436888b9b..91b6b57961 100644 --- a/test/infcover.c +++ b/test/infcover.c @@ -442,7 +442,7 @@ static void cover_wrap(void) { } /* input and output functions for inflateBack() */ -static unsigned pull(void *desc, z_const unsigned char **buf) { +static z_uint32_t pull(void *desc, z_const unsigned char **buf) { static unsigned int next = 0; static unsigned char dat[] = {0x63, 0, 2, 0}; struct inflate_state *state; @@ -457,7 +457,7 @@ static unsigned pull(void *desc, z_const unsigned char **buf) { return next < sizeof(dat) ? (*buf = dat + next++, 1) : 0; } -static int push(void *desc, unsigned char *buf, unsigned len) { +static z_int32_t push(void *desc, unsigned char *buf, z_uint32_t len) { buf += len; Z_UNUSED(buf); return desc != NULL; /* force error if desc not null */ diff --git a/test/minideflate.c b/test/minideflate.c index 9190d77bc1..ab8dc5313c 100644 --- a/test/minideflate.c +++ b/test/minideflate.c @@ -5,6 +5,7 @@ #include "zbuild.h" +#include <inttypes.h> #include <stdio.h> #include <assert.h> @@ -48,12 +49,12 @@ static void deflate_params(FILE *fin, FILE *fout, int32_t read_buf_size, int32_t read_buf = (uint8_t *)malloc(read_buf_size); if (read_buf == NULL) { - fprintf(stderr, "failed to create read buffer (%d)\n", read_buf_size); + fprintf(stderr, "failed to create read buffer (%" PRId32 ")\n", read_buf_size); return; } write_buf = (uint8_t *)malloc(write_buf_size); if (write_buf == NULL) { - fprintf(stderr, "failed to create write buffer (%d)\n", write_buf_size); + fprintf(stderr, "failed to create write buffer (%" PRId32 ")\n", write_buf_size); free(read_buf); return; } @@ -134,12 +135,12 @@ static void inflate_params(FILE *fin, FILE *fout, int32_t read_buf_size, int32_t read_buf = (uint8_t *)malloc(read_buf_size); if (read_buf == NULL) { - fprintf(stderr, "failed to create read buffer (%d)\n", read_buf_size); + fprintf(stderr, "failed to create read buffer (%" PRId32 ")\n", read_buf_size); return; } write_buf = (uint8_t *)malloc(write_buf_size); if (write_buf == NULL) { - fprintf(stderr, "failed to create write buffer (%d)\n", write_buf_size); + fprintf(stderr, "failed to create write buffer (%" PRId32 ")\n", write_buf_size); free(read_buf); return; } diff --git a/test/minigzip.c b/test/minigzip.c index e26364dd98..446b12e652 100644 --- a/test/minigzip.c +++ b/test/minigzip.c @@ -73,7 +73,7 @@ static void error(const char *msg) { */ static void gz_fatal(gzFile file) { - int err; + z_int32_t err; fprintf(stderr, "%s: %s\n", prog, PREFIX(gzerror)(file, &err)); PREFIX(gzclose)(file); exit(1); diff --git a/test/switchlevels.c b/test/switchlevels.c index b31bc0f95c..2d6ca0e69b 100644 --- a/test/switchlevels.c +++ b/test/switchlevels.c @@ -9,6 +9,7 @@ # include "zlib-ng.h" #endif +#include <inttypes.h> #include <stdio.h> #if defined(_WIN32) || defined(__CYGWIN__) @@ -95,7 +96,7 @@ static int compress_chunk(PREFIX3(stream) *strm, int level, int size, int last) goto free_buf; } if (strm->avail_in != 0) { - fprintf(stderr, "deflate() did not consume %d bytes of input\n", strm->avail_in); + fprintf(stderr, "deflate() did not consume %" PRIu32 " bytes of input\n", strm->avail_in); goto free_buf; } if (write_all(buf + size, compsize - strm->avail_out) != 0) { |
