/* infblock.c -- interpret and process block types to last block
- * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
*/
#include "zutil.h"
*/
+#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)
inflate_blocks_statef *s;
z_streamp z;
uLongf *c;
+#endif
{
if (c != Z_NULL)
*c = s->check;
Tracev((stderr, "inflate: blocks reset\n"));
}
-
+#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)
z_streamp z;
check_func c;
uInt w;
+#endif
{
inflate_blocks_statef *s;
return s;
}
-
+#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)
inflate_blocks_statef *s;
z_streamp z;
int r;
+#endif
{
uInt t; /* temporary storage */
uLong b; /* bit buffer */
&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;
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
}
}
s->sub.decode.codes = c;
}
+ ZFREE(z, s->sub.trees.blens);
s->mode = CODES;
case CODES:
UPDATE
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
}
}
-
+#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)
inflate_blocks_statef *s;
z_streamp z;
+#endif
{
inflate_blocks_reset(s, z, Z_NULL);
ZFREE(z, s->window);
return Z_OK;
}
-
+#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)
inflate_blocks_statef *s;
const Bytef *d;
uInt n;
+#endif
{
zmemcpy(s->window, d, n);
s->read = s->write = s->window + n;
}
-
/* Returns true if inflate is currently at the end of a block generated
- * by Z_SYNC_FLUSH or Z_FULL_FLUSH.
+ * by Z_SYNC_FLUSH or Z_FULL_FLUSH.
* IN assertion: s != Z_NULL
*/
+#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)
inflate_blocks_statef *s;
+#endif
{
return s->mode == LENS;
}