Don't assume that sizeof (long) == 4 when computing statistics.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 1 Jul 2010 18:46:56 +0000 (11:46 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 1 Jul 2010 18:46:56 +0000 (11:46 -0700)
* gzip.c (get_method): Don't assume sizeof (long) == 4.
* zip.c (zip): Likewise.

gzip.c
zip.c

diff --git a/gzip.c b/gzip.c
index 4762e88a17f9660ea76a7d4ed85015d806f98344..411ca429175bb7057aa3ee5b02d3f9763838eb71 100644 (file)
--- a/gzip.c
+++ b/gzip.c
@@ -1391,7 +1391,7 @@ local int get_method(in)
             while (get_char() != 0) /* null */ ;
         }
         if (part_nb == 1) {
-            header_bytes = inptr + 2*sizeof(long); /* include crc and size */
+            header_bytes = inptr + 2*4; /* include crc and size */
         }
 
     } else if (memcmp(magic, PKZIP_MAGIC, 2) == 0 && inptr == 2
diff --git a/zip.c b/zip.c
index a30a5617edbe19d04eb6d7f6ee1d74f355357052..dc4a21cac1c91e8b29572f21ec7e1e05446ce88b 100644 (file)
--- a/zip.c
+++ b/zip.c
@@ -96,7 +96,7 @@ int zip(in, out)
     /* Write the crc and uncompressed size */
     put_long(crc);
     put_long((ulg)bytes_in);
-    header_bytes += 2*sizeof(long);
+    header_bytes += 2*4;
 
     flush_outbuf();
     return OK;