X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e6ebb51430cd8e4a9a11c6c5a5ca7c3ff9d7a72a..d835f05e11b928b56ecdf9dc305069044dede118:/src/zlib/infblock.c?ds=sidebyside diff --git a/src/zlib/infblock.c b/src/zlib/infblock.c index 087d4d2ac3..437a3b130c 100644 --- a/src/zlib/infblock.c +++ b/src/zlib/infblock.c @@ -1,5 +1,5 @@ /* 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 */ @@ -65,7 +65,7 @@ local const uInt border[] = { /* Order of the bit length code lengths */ */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ void inflate_blocks_reset(inflate_blocks_statef* s, z_streamp z, uLongf* c) #else void inflate_blocks_reset(s, z, c) @@ -89,7 +89,7 @@ uLongf *c; Tracev((stderr, "inflate: blocks reset\n")); } -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ inflate_blocks_statef *inflate_blocks_new(z_streamp z, check_func c, uInt w) #else inflate_blocks_statef *inflate_blocks_new(z, c, w) @@ -123,7 +123,7 @@ uInt w; return s; } -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ int inflate_blocks(inflate_blocks_statef* s, z_streamp z, int r) #else int inflate_blocks(s, z, r) @@ -259,10 +259,12 @@ int r; &s->sub.trees.tb, s->hufts, z); if (t != Z_OK) { - ZFREE(z, s->sub.trees.blens); r = t; if (r == Z_DATA_ERROR) + { + ZFREE(z, s->sub.trees.blens); s->mode = BAD; + } 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); - ZFREE(z, s->sub.trees.blens); if (t != Z_OK) { if (t == (uInt)Z_DATA_ERROR) + { + ZFREE(z, s->sub.trees.blens); s->mode = BAD; + } r = t; LEAVE } @@ -339,6 +343,7 @@ int r; } s->sub.decode.codes = c; } + ZFREE(z, s->sub.trees.blens); s->mode = CODES; case CODES: UPDATE @@ -355,13 +360,6 @@ int r; 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 @@ -380,7 +378,7 @@ int r; } } -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ int inflate_blocks_free(inflate_blocks_statef* s, z_streamp z) #else int inflate_blocks_free(s, z) @@ -396,7 +394,7 @@ z_streamp z; return Z_OK; } -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ void inflate_set_dictionary(inflate_blocks_statef* s, const Bytef* d, uInt n) #else void inflate_set_dictionary(s, d, n) @@ -413,7 +411,7 @@ uInt n; * by Z_SYNC_FLUSH or Z_FULL_FLUSH. * IN assertion: s != Z_NULL */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ int inflate_blocks_sync_point(inflate_blocks_statef* s) #else int inflate_blocks_sync_point(s)