14 #define exop word.what.Exop 15 #define bits word.what.Bits 19 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
75 ZFREE(z, s->sub.trees.blens);
81 s->read = s->write = s->window;
83 z->adler = s->check = (*s->checkfn)(0L, (
const Bytef *)
Z_NULL, 0);
84 Tracev((stderr,
"inflate: blocks reset\n"));
110 s->end = s->window +
w;
113 Tracev((stderr,
"inflate: blocks allocated\n"));
136 while (1)
switch (s->mode)
145 Tracev((stderr,
"inflate: stored block%s\n",
146 s->last ?
" (last)" :
""));
153 Tracev((stderr,
"inflate: fixed codes block%s\n",
154 s->last ?
" (last)" :
""));
162 if (s->sub.decode.codes ==
Z_NULL)
172 Tracev((stderr,
"inflate: dynamic codes block%s\n",
173 s->last ?
" (last)" :
""));
180 z->msg = (
char*)
"invalid block type";
187 if ((((~b) >> 16) & 0xffff) != (b & 0xffff))
190 z->msg = (
char*)
"invalid stored block lengths";
194 s->sub.left = (
uInt)b & 0xffff;
196 Tracev((stderr,
"inflate: stored length %u\n", s->sub.left));
209 if ((s->sub.left -= t) != 0)
211 Tracev((stderr,
"inflate: stored end, %lu total out\n",
212 z->total_out + (q >= s->read ? q - s->read :
213 (s->end - s->read) + (q - s->window))));
214 s->mode = s->last ?
DRY :
TYPE;
218 s->sub.trees.table = t = (
uInt)b & 0x3fff;
219 #ifndef PKZIP_BUG_WORKAROUND 220 if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29)
223 z->msg = (
char*)
"too many length or distance symbols";
228 t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);
235 s->sub.trees.index = 0;
236 Tracev((stderr,
"inflate: table sizes ok\n"));
239 while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))
242 s->sub.trees.blens[
border[s->sub.trees.index++]] = (
uInt)b & 7;
245 while (s->sub.trees.index < 19)
246 s->sub.trees.blens[
border[s->sub.trees.index++]] = 0;
249 &s->sub.trees.tb, s->hufts, z);
255 ZFREE(z, s->sub.trees.blens);
260 s->sub.trees.index = 0;
261 Tracev((stderr,
"inflate: bits tree ok\n"));
264 while (t = s->sub.trees.table,
265 s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))
278 s->sub.trees.blens[s->sub.trees.index++] =
c;
282 i = c == 18 ? 7 : c - 14;
283 j = c == 18 ? 11 : 3;
288 i = s->sub.trees.index;
289 t = s->sub.trees.table;
290 if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) ||
293 ZFREE(z, s->sub.trees.blens);
295 z->msg = (
char*)
"invalid bit length repeat";
299 c = c == 16 ? s->sub.trees.blens[i - 1] : 0;
301 s->sub.trees.blens[i++] =
c;
303 s->sub.trees.index =
i;
314 t = s->sub.trees.table;
316 s->sub.trees.blens, &bl, &bd, &tl, &td,
322 ZFREE(z, s->sub.trees.blens);
328 Tracev((stderr,
"inflate: trees ok\n"));
334 s->sub.decode.codes =
c;
336 ZFREE(z, s->sub.trees.blens);
345 Tracev((stderr,
"inflate: codes end, %lu total out\n",
346 z->total_out + (q >= s->read ? q - s->read :
347 (s->end - s->read) + (q - s->window))));
356 if (s->read != s->write)
369 #ifdef NEED_DUMMY_RETURN 383 Tracev((stderr,
"inflate: blocks freed\n"));
local void inflate_blocks_reset(inflate_blocks_statef *s, z_streamp z, uLongf *c)
local int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
local int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r)
local int inflate_trees_bits(uIntf *c, uIntf *bb, inflate_huft *FAR *tb, inflate_huft *hp, z_streamp z)
struct inflate_blocks_state FAR inflate_blocks_statef
local inflate_blocks_statef * inflate_blocks_new(z_streamp z, check_func c, uInt w)
#define ZALLOC(strm, items, size)
GLdouble GLdouble GLdouble GLdouble q
GLfloat GLfloat GLfloat GLfloat h
GLboolean GLboolean GLboolean b
GLint GLint GLsizei GLsizei GLsizei GLint border
local void inflate_codes_free(inflate_codes_statef *c, z_streamp z)
GLdouble GLdouble GLdouble r
local const uInt inflate_mask[17]
void zmemcpy(Bytef *dest, const Bytef *source, uInt len)
#define ZFREE(strm, addr)
local int inflate_blocks_free(inflate_blocks_statef *s, z_streamp z)
struct inflate_huft_s FAR inflate_huft
GLubyte GLubyte GLubyte GLubyte w
local int inflate_trees_dynamic(uInt nl, uInt nd, uIntf *c, uIntf *bl, uIntf *bd, inflate_huft *FAR *tl, inflate_huft *FAR *td, inflate_huft *hp, z_streamp z)
local inflate_codes_statef * inflate_codes_new(uInt bl, uInt bd, inflate_huft *tl, inflate_huft *td, z_streamp z)
local int inflate_flush(inflate_blocks_statef *s, z_streamp z, int r)
local int inflate_trees_fixed(uIntf *bl, uIntf *bd, const inflate_huft *FAR *tl, const inflate_huft *FAR *td, z_streamp z)
struct inflate_codes_state FAR inflate_codes_statef