Lines Matching refs:state

19 local void fixedtables OF((struct inflate_state FAR *state));
31 struct inflate_state FAR *state; in inflateBackInit_() local
54 state = (struct inflate_state FAR *)ZALLOC(strm, 1, in inflateBackInit_()
56 if (state == Z_NULL) return Z_MEM_ERROR; in inflateBackInit_()
58 strm->state = (struct internal_state FAR *)state; in inflateBackInit_()
59 state->dmax = 32768U; in inflateBackInit_()
60 state->wbits = (uInt)windowBits; in inflateBackInit_()
61 state->wsize = 1U << windowBits; in inflateBackInit_()
62 state->window = window; in inflateBackInit_()
63 state->wnext = 0; in inflateBackInit_()
64 state->whave = 0; in inflateBackInit_()
78 local void fixedtables(struct inflate_state FAR *state) in fixedtables() argument
92 while (sym < 144) state->lens[sym++] = 8; in fixedtables()
93 while (sym < 256) state->lens[sym++] = 9; in fixedtables()
94 while (sym < 280) state->lens[sym++] = 7; in fixedtables()
95 while (sym < 288) state->lens[sym++] = 8; in fixedtables()
99 inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); in fixedtables()
103 while (sym < 32) state->lens[sym++] = 5; in fixedtables()
106 inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); in fixedtables()
114 state->lencode = lenfix; in fixedtables()
115 state->lenbits = 9; in fixedtables()
116 state->distcode = distfix; in fixedtables()
117 state->distbits = 5; in fixedtables()
129 hold = state->hold; \
130 bits = state->bits; \
140 state->hold = hold; \
141 state->bits = bits; \
208 put = state->window; \
209 left = state->wsize; \
210 state->whave = left; \
248 struct inflate_state FAR *state; in inflateBack() local
264 if (strm == Z_NULL || strm->state == Z_NULL) in inflateBack()
266 state = (struct inflate_state FAR *)strm->state; in inflateBack()
270 state->mode = TYPE; in inflateBack()
271 state->last = 0; in inflateBack()
272 state->whave = 0; in inflateBack()
277 put = state->window; in inflateBack()
278 left = state->wsize; in inflateBack()
282 switch (state->mode) { in inflateBack()
285 if (state->last) { in inflateBack()
287 state->mode = DONE; in inflateBack()
291 state->last = BITS(1); in inflateBack()
296 state->last ? " (last)" : "")); in inflateBack()
297 state->mode = STORED; in inflateBack()
300 fixedtables(state); in inflateBack()
302 state->last ? " (last)" : "")); in inflateBack()
303 state->mode = LEN; /* decode codes */ in inflateBack()
307 state->last ? " (last)" : "")); in inflateBack()
308 state->mode = TABLE; in inflateBack()
312 state->mode = BAD; in inflateBack()
323 state->mode = BAD; in inflateBack()
326 state->length = (unsigned)hold & 0xffff; in inflateBack()
328 state->length)); in inflateBack()
332 while (state->length != 0) { in inflateBack()
333 copy = state->length; in inflateBack()
343 state->length -= copy; in inflateBack()
346 state->mode = TYPE; in inflateBack()
352 state->nlen = BITS(5) + 257; in inflateBack()
354 state->ndist = BITS(5) + 1; in inflateBack()
356 state->ncode = BITS(4) + 4; in inflateBack()
359 if (state->nlen > 286 || state->ndist > 30) { in inflateBack()
361 state->mode = BAD; in inflateBack()
368 state->have = 0; in inflateBack()
369 while (state->have < state->ncode) { in inflateBack()
371 state->lens[order[state->have++]] = (unsigned short)BITS(3); in inflateBack()
374 while (state->have < 19) in inflateBack()
375 state->lens[order[state->have++]] = 0; in inflateBack()
376 state->next = state->codes; in inflateBack()
377 state->lencode = (code const FAR *)(state->next); in inflateBack()
378 state->lenbits = 7; in inflateBack()
379 ret = inflate_table(CODES, state->lens, 19, &(state->next), in inflateBack()
380 &(state->lenbits), state->work); in inflateBack()
383 state->mode = BAD; in inflateBack()
389 state->have = 0; in inflateBack()
390 while (state->have < state->nlen + state->ndist) { in inflateBack()
392 here = state->lencode[BITS(state->lenbits)]; in inflateBack()
398 state->lens[state->have++] = here.val; in inflateBack()
404 if (state->have == 0) { in inflateBack()
406 state->mode = BAD; in inflateBack()
409 len = (unsigned)(state->lens[state->have - 1]); in inflateBack()
427 if (state->have + copy > state->nlen + state->ndist) { in inflateBack()
429 state->mode = BAD; in inflateBack()
433 state->lens[state->have++] = (unsigned short)len; in inflateBack()
438 if (state->mode == BAD) break; in inflateBack()
441 if (state->lens[256] == 0) { in inflateBack()
443 state->mode = BAD; in inflateBack()
450 state->next = state->codes; in inflateBack()
451 state->lencode = (code const FAR *)(state->next); in inflateBack()
452 state->lenbits = 9; in inflateBack()
453 ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), in inflateBack()
454 &(state->lenbits), state->work); in inflateBack()
457 state->mode = BAD; in inflateBack()
460 state->distcode = (code const FAR *)(state->next); in inflateBack()
461 state->distbits = 6; in inflateBack()
462 ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, in inflateBack()
463 &(state->next), &(state->distbits), state->work); in inflateBack()
466 state->mode = BAD; in inflateBack()
470 state->mode = LEN; in inflateBack()
476 if (state->whave < state->wsize) in inflateBack()
477 state->whave = state->wsize - left; in inflateBack()
478 inflate_fast(strm, state->wsize); in inflateBack()
485 here = state->lencode[BITS(state->lenbits)]; in inflateBack()
492 here = state->lencode[last.val + in inflateBack()
500 state->length = (unsigned)here.val; in inflateBack()
508 *put++ = (unsigned char)(state->length); in inflateBack()
510 state->mode = LEN; in inflateBack()
517 state->mode = TYPE; in inflateBack()
524 state->mode = BAD; in inflateBack()
529 state->extra = (unsigned)(here.op) & 15; in inflateBack()
530 if (state->extra != 0) { in inflateBack()
531 NEEDBITS(state->extra); in inflateBack()
532 state->length += BITS(state->extra); in inflateBack()
533 DROPBITS(state->extra); in inflateBack()
535 Tracevv((stderr, "inflate: length %u\n", state->length)); in inflateBack()
539 here = state->distcode[BITS(state->distbits)]; in inflateBack()
546 here = state->distcode[last.val + in inflateBack()
556 state->mode = BAD; in inflateBack()
559 state->offset = (unsigned)here.val; in inflateBack()
562 state->extra = (unsigned)(here.op) & 15; in inflateBack()
563 if (state->extra != 0) { in inflateBack()
564 NEEDBITS(state->extra); in inflateBack()
565 state->offset += BITS(state->extra); in inflateBack()
566 DROPBITS(state->extra); in inflateBack()
568 if (state->offset > state->wsize - (state->whave < state->wsize ? in inflateBack()
571 state->mode = BAD; in inflateBack()
574 Tracevv((stderr, "inflate: distance %u\n", state->offset)); in inflateBack()
579 copy = state->wsize - state->offset; in inflateBack()
585 from = put - state->offset; in inflateBack()
588 if (copy > state->length) copy = state->length; in inflateBack()
589 state->length -= copy; in inflateBack()
594 } while (state->length != 0); in inflateBack()
600 if (left < state->wsize) { in inflateBack()
601 if (out(out_desc, state->window, state->wsize - left)) in inflateBack()
624 if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) in inflateBackEnd()
626 ZFREE(strm, strm->state); in inflateBackEnd()
627 strm->state = Z_NULL; in inflateBackEnd()