]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed integer casting and signed comparison warning in test_gzio.
authorNathan Moinvaziri <nathan@nathanm.com>
Wed, 1 Jul 2020 03:00:30 +0000 (20:00 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Wed, 1 Jul 2020 21:06:53 +0000 (23:06 +0200)
    example.c(199,57): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
    example.c:207:32: warning: comparison between signed and unsigned integer expressions

test/example.c

index 80cb82cb5f976b7aa9e5e650152c03e6404dfac4..c1161a7e73d85ab1aae5b20b0c66ea5c07b0e734 100644 (file)
@@ -81,11 +81,12 @@ void test_gzio(const char *fname, unsigned char *uncompr, z_size_t uncomprLen) {
 #ifdef NO_GZCOMPRESS
     fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n");
 #else
-    int err, read;
+    int err;
+    size_t read;
     size_t len = strlen(hello)+1;
-    z_off64_t comprLen;
     gzFile file;
     z_off64_t pos;
+    z_off64_t comprLen;
 
     /* Write gz file with test data */
     file = PREFIX(gzopen)(fname, "wb");
@@ -203,7 +204,7 @@ void test_gzio(const char *fname, unsigned char *uncompr, z_size_t uncomprLen) {
         printf("gzgets(): %s\n", (char*)uncompr);
     }
     pos = PREFIX(gzoffset)(file);
-    if (pos < 0 || (size_t)pos != (comprLen + 10)) {
+    if (pos < 0 || pos != (comprLen + 10)) {
         fprintf(stderr, "gzoffset err: wrong offset at end\n");
         exit(1);
     }