]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix warnings variable set but not used.
authorVladislav Shchapov <vladislav@shchapov.ru>
Sun, 17 May 2026 15:55:05 +0000 (20:55 +0500)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 29 May 2026 21:18:09 +0000 (23:18 +0200)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
test/fuzz/fuzzer_example_large.c
test/test_gzio.cc

index f80b91963b469f445b7eefa8183792c07b676f85..6c1ed2491e821d6fe4c8f3455356a25bb9b590e9 100644 (file)
@@ -14,8 +14,6 @@
     } \
 }
 
-static const uint8_t *data;
-static size_t dataLen;
 static alloc_func zalloc = NULL;
 static free_func zfree = NULL;
 static unsigned int diff;
@@ -109,6 +107,7 @@ void test_large_inflate(unsigned char *compr, size_t comprLen, unsigned char *un
 }
 
 int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size) {
+    Z_UNUSED(d);
     size_t comprLen = 100 + 3 * size;
     size_t uncomprLen = comprLen;
     uint8_t *compr, *uncompr;
@@ -119,8 +118,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size) {
     if (size < 1 || size > kMaxSize)
         return 0;
 
-    data = d;
-    dataLen = size;
     compr = (uint8_t *)calloc(1, comprLen);
     uncompr = (uint8_t *)calloc(1, uncomprLen);
 
index 032e3e1c5178186829d661397c68c036bae9086b..598ced96da690285415c7187ab1b5099c8f5da30 100644 (file)
@@ -23,14 +23,12 @@ TEST(gzip, readwrite) {
     fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n");
     GTEST_SKIP();
 #else
-    uint8_t compr[128], uncompr[128];
-    uint32_t compr_len = sizeof(compr), uncompr_len = sizeof(uncompr);
-    size_t read;
+    uint8_t uncompr[128];
+    uint32_t compr_len, uncompr_len = sizeof(uncompr);
     int64_t pos;
     gzFile file;
     int err;
 
-    Z_UNUSED(compr);
     /* Write gz file with test data */
     file = PREFIX(gzopen)(TESTFILE, "wb");
     ASSERT_TRUE(file != NULL);
@@ -82,7 +80,7 @@ TEST(gzip, readwrite) {
     EXPECT_EQ(PREFIX(gzeof)(file), 0);
     /* Read first hello, hello! string with gzfread */
     strcpy((char*)uncompr, "garbages");
-    read = PREFIX(gzfread)(uncompr, uncompr_len, 1, file);
+    PREFIX(gzfread)(uncompr, uncompr_len, 1, file);
     EXPECT_STREQ((const char *)uncompr, hello);
 
     pos = PREFIX(gzoffset)(file);
@@ -101,6 +99,5 @@ TEST(gzip, readwrite) {
     PREFIX(gzclose)(file);
 
     EXPECT_EQ(PREFIX(gzclose)(NULL), Z_STREAM_ERROR);
-    Z_UNUSED(read);
 #endif
 }