]> git.saurik.com Git - wxWidgets.git/blobdiff - src/zlib/infblock.c
extending calculation of visible region
[wxWidgets.git] / src / zlib / infblock.c
index 353ca4032e4b044a85f46a0cb8d48994a5e257f4..437a3b130c965da6afa165f22bab00315155dea4 100644 (file)
@@ -1,5 +1,5 @@
 /* infblock.c -- interpret and process block types to last block
 /* infblock.c -- interpret and process block types to last block
- * Copyright (C) 1995-1998 Mark Adler
+ * Copyright (C) 1995-2002 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -259,10 +259,12 @@ int r;
                              &s->sub.trees.tb, s->hufts, z);
       if (t != Z_OK)
       {
                              &s->sub.trees.tb, s->hufts, z);
       if (t != Z_OK)
       {
-        ZFREE(z, s->sub.trees.blens);
         r = t;
         if (r == Z_DATA_ERROR)
         r = t;
         if (r == Z_DATA_ERROR)
+        {
+          ZFREE(z, s->sub.trees.blens);
           s->mode = BAD;
           s->mode = BAD;
+        }
         LEAVE
       }
       s->sub.trees.index = 0;
         LEAVE
       }
       s->sub.trees.index = 0;
@@ -323,11 +325,13 @@ int r;
         t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
                                   s->sub.trees.blens, &bl, &bd, &tl, &td,
                                   s->hufts, z);
         t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
                                   s->sub.trees.blens, &bl, &bd, &tl, &td,
                                   s->hufts, z);
-        ZFREE(z, s->sub.trees.blens);
         if (t != Z_OK)
         {
           if (t == (uInt)Z_DATA_ERROR)
         if (t != Z_OK)
         {
           if (t == (uInt)Z_DATA_ERROR)
+          {
+            ZFREE(z, s->sub.trees.blens);
             s->mode = BAD;
             s->mode = BAD;
+          }
           r = t;
           LEAVE
         }
           r = t;
           LEAVE
         }
@@ -339,6 +343,7 @@ int r;
         }
         s->sub.decode.codes = c;
       }
         }
         s->sub.decode.codes = c;
       }
+      ZFREE(z, s->sub.trees.blens);
       s->mode = CODES;
     case CODES:
       UPDATE
       s->mode = CODES;
     case CODES:
       UPDATE
@@ -355,13 +360,6 @@ int r;
         s->mode = TYPE;
         break;
       }
         s->mode = TYPE;
         break;
       }
-      if (k > 7)              /* return unused byte, if any */
-      {
-        Assert(k < 16, "inflate_codes grabbed too many bytes")
-        k -= 8;
-        n++;
-        p--;                    /* can always return one */
-      }
       s->mode = DRY;
     case DRY:
       FLUSH
       s->mode = DRY;
     case DRY:
       FLUSH