From: Nathan Moinvaziri Date: Thu, 19 Sep 2019 16:57:42 +0000 (-0700) Subject: Fixed several warnings in example and fuzzers. #409 X-Git-Tag: 1.9.9-b1~431 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b080dd07b679c86d84cf3b4eea7ee3437e8fa0a3;p=thirdparty%2Fzlib-ng.git Fixed several warnings in example and fuzzers. #409 --- diff --git a/test/example.c b/test/example.c index bd1665ee..4b78f21d 100644 --- a/test/example.c +++ b/test/example.c @@ -561,7 +561,7 @@ void test_deflate_bound(unsigned char *compr, size_t comprLen) c_stream.zfree = zfree; c_stream.opaque = (voidpf)0; c_stream.avail_in = len; - c_stream.next_in = hello; + c_stream.next_in = (const unsigned char *)hello; c_stream.avail_out = 0; c_stream.next_out = outBuf; @@ -608,7 +608,7 @@ void test_deflate_copy(unsigned char *compr, size_t comprLen) err = PREFIX(deflateInit)(&c_stream, Z_DEFAULT_COMPRESSION); CHECK_ERR(err, "deflateInit"); - c_stream.next_in = hello; + c_stream.next_in = (const unsigned char *)hello; c_stream.next_out = compr; while (c_stream.total_in != len && c_stream.total_out < comprLen) { @@ -656,7 +656,7 @@ void test_deflate_get_dict(unsigned char *compr, size_t comprLen) c_stream.next_out = compr; c_stream.avail_out = (uInt)comprLen; - c_stream.next_in = hello; + c_stream.next_in = (const unsigned char *)hello; c_stream.avail_in = (unsigned int)strlen(hello)+1; err = PREFIX(deflate)(&c_stream, Z_FINISH); @@ -701,7 +701,7 @@ void test_deflate_pending(unsigned char *compr, size_t comprLen) err = PREFIX(deflateInit)(&c_stream, Z_DEFAULT_COMPRESSION); CHECK_ERR(err, "deflateInit"); - c_stream.next_in = hello; + c_stream.next_in = (const unsigned char *)hello; c_stream.next_out = compr; while (c_stream.total_in != len && c_stream.total_out < comprLen) { @@ -761,7 +761,7 @@ void test_deflate_pending(unsigned char *compr, size_t comprLen) printf("deflatePrime(): OK\n"); } - c_stream.next_in = hello; + c_stream.next_in = (const unsigned char *)hello; c_stream.next_out = compr; while (c_stream.total_in != len && c_stream.total_out < comprLen) { @@ -858,7 +858,7 @@ void test_deflate_tune(unsigned char *compr, size_t comprLen) printf("deflateTune(): OK\n"); } - c_stream.next_in = hello; + c_stream.next_in = (const unsigned char *)hello; c_stream.next_out = compr; while (c_stream.total_in != len && c_stream.total_out < comprLen) { diff --git a/test/fuzz/checksum_fuzzer.c b/test/fuzz/checksum_fuzzer.c index 10fc138f..a50a9a68 100644 --- a/test/fuzz/checksum_fuzzer.c +++ b/test/fuzz/checksum_fuzzer.c @@ -41,6 +41,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataLen) { uint32_t crc4 = PREFIX(crc32_combine_op)(crc1, crc3, op); crc1 = PREFIX(crc32_z)(crc1, data + offset, buffSize); assert(crc1 == crc4); + (void)crc4; } crc1 = PREFIX(crc32_z)(crc1, data + offset, dataLen % buffSize); diff --git a/test/fuzz/minigzip_fuzzer.c b/test/fuzz/minigzip_fuzzer.c index d0c35571..5d2f1066 100644 --- a/test/fuzz/minigzip_fuzzer.c +++ b/test/fuzz/minigzip_fuzzer.c @@ -62,7 +62,7 @@ #define BUFLENW (BUFLEN * 3) /* write buffer size */ #define MAX_NAME_LEN 1024 -static char *prog; +static const char *prog = "minigzip_fuzzer"; void error (const char *msg); void gz_compress (FILE *in, gzFile out); diff --git a/test/fuzz/standalone_fuzz_target_runner.c b/test/fuzz/standalone_fuzz_target_runner.c index 5a5c7509..91144efb 100644 --- a/test/fuzz/standalone_fuzz_target_runner.c +++ b/test/fuzz/standalone_fuzz_target_runner.c @@ -28,6 +28,7 @@ int main(int argc, char **argv) { free(buf); err = fclose(f); assert(err == 0); + (void)err; fprintf(stderr, "Done: %s: (%d bytes)\n", argv[i], (int)n_read); }