bug-gzip
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gzip 1.4 warnings


From: Mark Adler
Subject: gzip 1.4 warnings
Date: Wed, 3 Feb 2010 19:17:43 -0800

Jim,

Below is a patch to avoid some compiler warnings on the use of signed and 
unsigned integers.

Mark


--- inflate-1.4.c       2010-01-20 05:15:12.000000000 -0800
+++ inflate.c   2010-02-03 19:12:10.000000000 -0800
@@ -410,7 +410,8 @@
         w += l;                 /* previous table always l bits */
 
         /* compute minimum size table less than or equal to l bits */
-        z = (z = g - w) > (unsigned)l ? l : z;  /* upper limit on table size */
+        z = g - w;
+        if (z > (unsigned)l) z = (unsigned)l;   /* upper limit on table size */
         if ((f = 1 << (j = k - w)) > a + 1)     /* try a k-w bit table */
         {                       /* too few codes for k-w bit table */
           f -= a + 1;           /* deduct codes from patterns left */
--- unlzw-1.4.c 2010-01-20 06:05:56.000000000 -0800
+++ unlzw.c     2010-02-03 19:15:17.000000000 -0800
@@ -241,7 +241,7 @@
 
     resetbuf:
         o = posbits >> 3;
-        e = o <= insize ? insize - o : 0;
+        e = (unsigned)o <= insize ? insize - o : 0;
 
         for (i = 0 ; i < e ; ++i) {
             inbuf[i] = inbuf[i+o];





reply via email to

[Prev in Thread] Current Thread [Next in Thread]