]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed several warnings in example and fuzzers. #409
authorNathan Moinvaziri <nathan@nathanm.com>
Thu, 19 Sep 2019 16:57:42 +0000 (09:57 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 19 Sep 2019 19:02:01 +0000 (21:02 +0200)
test/example.c
test/fuzz/checksum_fuzzer.c
test/fuzz/minigzip_fuzzer.c
test/fuzz/standalone_fuzz_target_runner.c

index bd1665ee91fda10f3ffd0910c8e8059e35cf01c1..4b78f21d8570f042ff687ff0cb9701bd1f5e1f55 100644 (file)
@@ -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) {
index 10fc138fb82d215a5418d133c30869d9fff1578b..a50a9a6876457cdf78b9e1b3d864aa878500111d 100644 (file)
@@ -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);
 
index d0c35571f7ffaf78304f0e3721edc8ab22634e68..5d2f1066a07297edb1a6860519c707b3b176703f 100644 (file)
@@ -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);
index 5a5c750967262e16282de2909d51f689d6b2e0a8..91144efb24651ad3de14fbed6739f666a10ca82a 100644 (file)
@@ -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);
   }