Lines Matching full:state
28 struct inflate_state FAR *state; in inflateBackInit_() local
51 state = (struct inflate_state FAR *)ZALLOC(strm, 1, in inflateBackInit_()
53 if (state == Z_NULL) return Z_MEM_ERROR; in inflateBackInit_()
55 strm->state = (struct internal_state FAR *)state; in inflateBackInit_()
56 state->dmax = 32768U; in inflateBackInit_()
57 state->wbits = (uInt)windowBits; in inflateBackInit_()
58 state->wsize = 1U << windowBits; in inflateBackInit_()
59 state->window = window; in inflateBackInit_()
60 state->wnext = 0; in inflateBackInit_()
61 state->whave = 0; in inflateBackInit_()
62 state->sane = 1; in inflateBackInit_()
67 Return state with length and distance decoding tables and index sizes set to
76 local void fixedtables(struct inflate_state FAR *state) { in fixedtables() argument
89 while (sym < 144) state->lens[sym++] = 8; in fixedtables()
90 while (sym < 256) state->lens[sym++] = 9; in fixedtables()
91 while (sym < 280) state->lens[sym++] = 7; in fixedtables()
92 while (sym < 288) state->lens[sym++] = 8; in fixedtables()
96 inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); in fixedtables()
100 while (sym < 32) state->lens[sym++] = 5; in fixedtables()
103 inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); in fixedtables()
111 state->lencode = lenfix; in fixedtables()
112 state->lenbits = 9; in fixedtables()
113 state->distcode = distfix; in fixedtables()
114 state->distbits = 5; in fixedtables()
119 /* Load returned state from inflate_fast() */
126 hold = state->hold; \
127 bits = state->bits; \
130 /* Set state from registers for inflate_fast() */
137 state->hold = hold; \
138 state->bits = bits; \
205 put = state->window; \
206 left = state->wsize; \
207 state->whave = left; \
238 error, or Z_MEM_ERROR if it could not allocate memory for the state.
240 are not correct, i.e. strm is Z_NULL or the state was not initialized.
244 struct inflate_state FAR *state; in inflateBack() local
259 /* Check that the strm exists and that the state was initialized */ in inflateBack()
260 if (strm == Z_NULL || strm->state == Z_NULL) in inflateBack()
262 state = (struct inflate_state FAR *)strm->state; in inflateBack()
264 /* Reset the state */ in inflateBack()
266 state->mode = TYPE; in inflateBack()
267 state->last = 0; in inflateBack()
268 state->whave = 0; in inflateBack()
273 put = state->window; in inflateBack()
274 left = state->wsize; in inflateBack()
278 switch (state->mode) { in inflateBack()
281 if (state->last) { in inflateBack()
283 state->mode = DONE; in inflateBack()
287 state->last = BITS(1); in inflateBack()
292 state->last ? " (last)" : "")); in inflateBack()
293 state->mode = STORED; in inflateBack()
296 fixedtables(state); in inflateBack()
298 state->last ? " (last)" : "")); in inflateBack()
299 state->mode = LEN; /* decode codes */ in inflateBack()
303 state->last ? " (last)" : "")); in inflateBack()
304 state->mode = TABLE; in inflateBack()
308 state->mode = BAD; in inflateBack()
319 state->mode = BAD; in inflateBack()
322 state->length = (unsigned)hold & 0xffff; in inflateBack()
324 state->length)); in inflateBack()
328 while (state->length != 0) { in inflateBack()
329 copy = state->length; in inflateBack()
339 state->length -= copy; in inflateBack()
342 state->mode = TYPE; in inflateBack()
348 state->nlen = BITS(5) + 257; in inflateBack()
350 state->ndist = BITS(5) + 1; in inflateBack()
352 state->ncode = BITS(4) + 4; in inflateBack()
355 if (state->nlen > 286 || state->ndist > 30) { in inflateBack()
357 state->mode = BAD; in inflateBack()
364 state->have = 0; in inflateBack()
365 while (state->have < state->ncode) { in inflateBack()
367 state->lens[order[state->have++]] = (unsigned short)BITS(3); in inflateBack()
370 while (state->have < 19) in inflateBack()
371 state->lens[order[state->have++]] = 0; in inflateBack()
372 state->next = state->codes; in inflateBack()
373 state->lencode = (code const FAR *)(state->next); in inflateBack()
374 state->lenbits = 7; in inflateBack()
375 ret = inflate_table(CODES, state->lens, 19, &(state->next), in inflateBack()
376 &(state->lenbits), state->work); in inflateBack()
379 state->mode = BAD; in inflateBack()
385 state->have = 0; in inflateBack()
386 while (state->have < state->nlen + state->ndist) { in inflateBack()
388 here = state->lencode[BITS(state->lenbits)]; in inflateBack()
394 state->lens[state->have++] = here.val; in inflateBack()
400 if (state->have == 0) { in inflateBack()
402 state->mode = BAD; in inflateBack()
405 len = (unsigned)(state->lens[state->have - 1]); in inflateBack()
423 if (state->have + copy > state->nlen + state->ndist) { in inflateBack()
425 state->mode = BAD; in inflateBack()
429 state->lens[state->have++] = (unsigned short)len; in inflateBack()
434 if (state->mode == BAD) break; in inflateBack()
437 if (state->lens[256] == 0) { in inflateBack()
439 state->mode = BAD; in inflateBack()
446 state->next = state->codes; in inflateBack()
447 state->lencode = (code const FAR *)(state->next); in inflateBack()
448 state->lenbits = 9; in inflateBack()
449 ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), in inflateBack()
450 &(state->lenbits), state->work); in inflateBack()
453 state->mode = BAD; in inflateBack()
456 state->distcode = (code const FAR *)(state->next); in inflateBack()
457 state->distbits = 6; in inflateBack()
458 ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, in inflateBack()
459 &(state->next), &(state->distbits), state->work); in inflateBack()
462 state->mode = BAD; in inflateBack()
466 state->mode = LEN; in inflateBack()
473 if (state->whave < state->wsize) in inflateBack()
474 state->whave = state->wsize - left; in inflateBack()
475 inflate_fast(strm, state->wsize); in inflateBack()
482 here = state->lencode[BITS(state->lenbits)]; in inflateBack()
489 here = state->lencode[last.val + in inflateBack()
497 state->length = (unsigned)here.val; in inflateBack()
505 *put++ = (unsigned char)(state->length); in inflateBack()
507 state->mode = LEN; in inflateBack()
514 state->mode = TYPE; in inflateBack()
521 state->mode = BAD; in inflateBack()
526 state->extra = (unsigned)(here.op) & 15; in inflateBack()
527 if (state->extra != 0) { in inflateBack()
528 NEEDBITS(state->extra); in inflateBack()
529 state->length += BITS(state->extra); in inflateBack()
530 DROPBITS(state->extra); in inflateBack()
532 Tracevv((stderr, "inflate: length %u\n", state->length)); in inflateBack()
536 here = state->distcode[BITS(state->distbits)]; in inflateBack()
543 here = state->distcode[last.val + in inflateBack()
553 state->mode = BAD; in inflateBack()
556 state->offset = (unsigned)here.val; in inflateBack()
559 state->extra = (unsigned)(here.op) & 15; in inflateBack()
560 if (state->extra != 0) { in inflateBack()
561 NEEDBITS(state->extra); in inflateBack()
562 state->offset += BITS(state->extra); in inflateBack()
563 DROPBITS(state->extra); in inflateBack()
565 if (state->offset > state->wsize - (state->whave < state->wsize ? in inflateBack()
568 state->mode = BAD; in inflateBack()
571 Tracevv((stderr, "inflate: distance %u\n", state->offset)); in inflateBack()
576 copy = state->wsize - state->offset; in inflateBack()
582 from = put - state->offset; in inflateBack()
585 if (copy > state->length) copy = state->length; in inflateBack()
586 state->length -= copy; in inflateBack()
591 } while (state->length != 0); in inflateBack()
611 if (left < state->wsize) { in inflateBack()
612 if (out(out_desc, state->window, state->wsize - left) && in inflateBack()
622 if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) in inflateBackEnd()
624 ZFREE(strm, strm->state); in inflateBackEnd()
625 strm->state = Z_NULL; in inflateBackEnd()