Lines Matching refs:state

47 local void fixedtables OF((struct inflate_state FAR *state));
60 struct inflate_state FAR *state; in inflateBackInit_() local
76 state = (struct inflate_state FAR *)ZALLOC(strm, 1, in inflateBackInit_()
78 if (state == Z_NULL) return Z_MEM_ERROR; in inflateBackInit_()
80 strm->state = (struct internal_state FAR *)state; in inflateBackInit_()
81 state->dmax = 32768U; in inflateBackInit_()
82 state->wbits = windowBits; in inflateBackInit_()
83 state->wsize = 1U << windowBits; in inflateBackInit_()
84 state->window = window; in inflateBackInit_()
85 state->write = 0; in inflateBackInit_()
86 state->whave = 0; in inflateBackInit_()
101 fixedtables(struct inflate_state FAR *state) in fixedtables() argument
115 while (sym < 144) state->lens[sym++] = 8; in fixedtables()
116 while (sym < 256) state->lens[sym++] = 9; in fixedtables()
117 while (sym < 280) state->lens[sym++] = 7; in fixedtables()
118 while (sym < 288) state->lens[sym++] = 8; in fixedtables()
122 inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); in fixedtables()
126 while (sym < 32) state->lens[sym++] = 5; in fixedtables()
129 inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); in fixedtables()
137 state->lencode = lenfix; in fixedtables()
138 state->lenbits = 9; in fixedtables()
139 state->distcode = distfix; in fixedtables()
140 state->distbits = 5; in fixedtables()
152 hold = state->hold; \
153 bits = state->bits; \
163 state->hold = hold; \
164 state->bits = bits; \
231 put = state->window; \
232 left = state->wsize; \
233 state->whave = left; \
272 struct inflate_state FAR *state; in inflateBack() local
288 if (strm == Z_NULL || strm->state == Z_NULL) in inflateBack()
290 state = (struct inflate_state FAR *)strm->state; in inflateBack()
294 state->mode = TYPE; in inflateBack()
295 state->last = 0; in inflateBack()
296 state->whave = 0; in inflateBack()
301 put = state->window; in inflateBack()
302 left = state->wsize; in inflateBack()
306 switch (state->mode) { in inflateBack()
309 if (state->last) { in inflateBack()
311 state->mode = DONE; in inflateBack()
315 state->last = BITS(1); in inflateBack()
320 state->last ? " (last)" : "")); in inflateBack()
321 state->mode = STORED; in inflateBack()
324 fixedtables(state); in inflateBack()
326 state->last ? " (last)" : "")); in inflateBack()
327 state->mode = LEN; /* decode codes */ in inflateBack()
331 state->last ? " (last)" : "")); in inflateBack()
332 state->mode = TABLE; in inflateBack()
336 state->mode = BAD; in inflateBack()
347 state->mode = BAD; in inflateBack()
350 state->length = (unsigned)hold & 0xffff; in inflateBack()
352 state->length)); in inflateBack()
356 while (state->length != 0) { in inflateBack()
357 copy = state->length; in inflateBack()
367 state->length -= copy; in inflateBack()
370 state->mode = TYPE; in inflateBack()
376 state->nlen = BITS(5) + 257; in inflateBack()
378 state->ndist = BITS(5) + 1; in inflateBack()
380 state->ncode = BITS(4) + 4; in inflateBack()
383 if (state->nlen > 286 || state->ndist > 30) { in inflateBack()
385 state->mode = BAD; in inflateBack()
392 state->have = 0; in inflateBack()
393 while (state->have < state->ncode) { in inflateBack()
395 state->lens[order[state->have++]] = (unsigned short)BITS(3); in inflateBack()
398 while (state->have < 19) in inflateBack()
399 state->lens[order[state->have++]] = 0; in inflateBack()
400 state->next = state->codes; in inflateBack()
401 state->lencode = (code const FAR *)(state->next); in inflateBack()
402 state->lenbits = 7; in inflateBack()
403 ret = inflate_table(CODES, state->lens, 19, &(state->next), in inflateBack()
404 &(state->lenbits), state->work); in inflateBack()
407 state->mode = BAD; in inflateBack()
413 state->have = 0; in inflateBack()
414 while (state->have < state->nlen + state->ndist) { in inflateBack()
416 this = state->lencode[BITS(state->lenbits)]; in inflateBack()
423 state->lens[state->have++] = this.val; in inflateBack()
429 if (state->have == 0) { in inflateBack()
431 state->mode = BAD; in inflateBack()
434 len = (unsigned)(state->lens[state->have - 1]); in inflateBack()
452 if (state->have + copy > state->nlen + state->ndist) { in inflateBack()
454 state->mode = BAD; in inflateBack()
458 state->lens[state->have++] = (unsigned short)len; in inflateBack()
463 if (state->mode == BAD) break; in inflateBack()
466 state->next = state->codes; in inflateBack()
467 state->lencode = (code const FAR *)(state->next); in inflateBack()
468 state->lenbits = 9; in inflateBack()
469 ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), in inflateBack()
470 &(state->lenbits), state->work); in inflateBack()
473 state->mode = BAD; in inflateBack()
476 state->distcode = (code const FAR *)(state->next); in inflateBack()
477 state->distbits = 6; in inflateBack()
478 ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, in inflateBack()
479 &(state->next), &(state->distbits), state->work); in inflateBack()
482 state->mode = BAD; in inflateBack()
486 state->mode = LEN; in inflateBack()
493 if (state->whave < state->wsize) in inflateBack()
494 state->whave = state->wsize - left; in inflateBack()
495 inflate_fast(strm, state->wsize); in inflateBack()
502 this = state->lencode[BITS(state->lenbits)]; in inflateBack()
509 this = state->lencode[last.val + in inflateBack()
517 state->length = (unsigned)this.val; in inflateBack()
525 *put++ = (unsigned char)(state->length); in inflateBack()
527 state->mode = LEN; in inflateBack()
534 state->mode = TYPE; in inflateBack()
541 state->mode = BAD; in inflateBack()
546 state->extra = (unsigned)(this.op) & 15; in inflateBack()
547 if (state->extra != 0) { in inflateBack()
548 NEEDBITS(state->extra); in inflateBack()
549 state->length += BITS(state->extra); in inflateBack()
550 DROPBITS(state->extra); in inflateBack()
552 Tracevv((stderr, "inflate: length %u\n", state->length)); in inflateBack()
556 this = state->distcode[BITS(state->distbits)]; in inflateBack()
563 this = state->distcode[last.val + in inflateBack()
573 state->mode = BAD; in inflateBack()
576 state->offset = (unsigned)this.val; in inflateBack()
579 state->extra = (unsigned)(this.op) & 15; in inflateBack()
580 if (state->extra != 0) { in inflateBack()
581 NEEDBITS(state->extra); in inflateBack()
582 state->offset += BITS(state->extra); in inflateBack()
583 DROPBITS(state->extra); in inflateBack()
585 if (state->offset > state->wsize - (state->whave < state->wsize ? in inflateBack()
588 state->mode = BAD; in inflateBack()
591 Tracevv((stderr, "inflate: distance %u\n", state->offset)); in inflateBack()
596 copy = state->wsize - state->offset; in inflateBack()
602 from = put - state->offset; in inflateBack()
605 if (copy > state->length) copy = state->length; in inflateBack()
606 state->length -= copy; in inflateBack()
611 } while (state->length != 0); in inflateBack()
617 if (left < state->wsize) { in inflateBack()
618 if (out(out_desc, state->window, state->wsize - left)) in inflateBack()
642 if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) in inflateBackEnd()
644 ZFREE(strm, strm->state); in inflateBackEnd()
645 strm->state = Z_NULL; in inflateBackEnd()