• Home
  • Raw
  • Download

Lines Matching refs:state

25     struct inflate_state *state;  in zlib_inflateReset()  local
27 if (strm == NULL || strm->state == NULL) return Z_STREAM_ERROR; in zlib_inflateReset()
28 state = (struct inflate_state *)strm->state; in zlib_inflateReset()
29 strm->total_in = strm->total_out = state->total = 0; in zlib_inflateReset()
32 state->mode = HEAD; in zlib_inflateReset()
33 state->last = 0; in zlib_inflateReset()
34 state->havedict = 0; in zlib_inflateReset()
35 state->dmax = 32768U; in zlib_inflateReset()
36 state->hold = 0; in zlib_inflateReset()
37 state->bits = 0; in zlib_inflateReset()
38 state->lencode = state->distcode = state->next = state->codes; in zlib_inflateReset()
41 state->wsize = 1U << state->wbits; in zlib_inflateReset()
42 state->write = 0; in zlib_inflateReset()
43 state->whave = 0; in zlib_inflateReset()
50 struct inflate_state *state; in zlib_inflateInit2() local
55 state = &WS(strm)->inflate_state; in zlib_inflateInit2()
56 strm->state = (struct internal_state *)state; in zlib_inflateInit2()
59 state->wrap = 0; in zlib_inflateInit2()
63 state->wrap = (windowBits >> 4) + 1; in zlib_inflateInit2()
68 state->wbits = (unsigned)windowBits; in zlib_inflateInit2()
69 state->window = &WS(strm)->working_window[0]; in zlib_inflateInit2()
78 static void zlib_fixedtables(struct inflate_state *state) in zlib_fixedtables() argument
81 state->lencode = lenfix; in zlib_fixedtables()
82 state->lenbits = 9; in zlib_fixedtables()
83 state->distcode = distfix; in zlib_fixedtables()
84 state->distbits = 5; in zlib_fixedtables()
103 struct inflate_state *state; in zlib_updatewindow() local
106 state = (struct inflate_state *)strm->state; in zlib_updatewindow()
110 if (copy >= state->wsize) { in zlib_updatewindow()
111 memcpy(state->window, strm->next_out - state->wsize, state->wsize); in zlib_updatewindow()
112 state->write = 0; in zlib_updatewindow()
113 state->whave = state->wsize; in zlib_updatewindow()
116 dist = state->wsize - state->write; in zlib_updatewindow()
118 memcpy(state->window + state->write, strm->next_out - copy, dist); in zlib_updatewindow()
121 memcpy(state->window, strm->next_out - copy, copy); in zlib_updatewindow()
122 state->write = copy; in zlib_updatewindow()
123 state->whave = state->wsize; in zlib_updatewindow()
126 state->write += dist; in zlib_updatewindow()
127 if (state->write == state->wsize) state->write = 0; in zlib_updatewindow()
128 if (state->whave < state->wsize) state->whave += dist; in zlib_updatewindow()
148 struct inflate_state *state; in zlib_inflateSyncPacket() local
150 if (strm == NULL || strm->state == NULL) return Z_STREAM_ERROR; in zlib_inflateSyncPacket()
151 state = (struct inflate_state *)strm->state; in zlib_inflateSyncPacket()
153 if (state->mode == STORED && state->bits == 0) { in zlib_inflateSyncPacket()
154 state->mode = TYPE; in zlib_inflateSyncPacket()
172 hold = state->hold; \
173 bits = state->bits; \
183 state->hold = hold; \
184 state->bits = bits; \
319 struct inflate_state *state; in zlib_inflate() local
338 if (strm == NULL || strm->state == NULL || in zlib_inflate()
342 state = (struct inflate_state *)strm->state; in zlib_inflate()
344 if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ in zlib_inflate()
350 switch (state->mode) { in zlib_inflate()
352 if (state->wrap == 0) { in zlib_inflate()
353 state->mode = TYPEDO; in zlib_inflate()
360 state->mode = BAD; in zlib_inflate()
365 state->mode = BAD; in zlib_inflate()
370 if (len > state->wbits) { in zlib_inflate()
372 state->mode = BAD; in zlib_inflate()
375 state->dmax = 1U << len; in zlib_inflate()
376 strm->adler = state->check = zlib_adler32(0L, NULL, 0); in zlib_inflate()
377 state->mode = hold & 0x200 ? DICTID : TYPE; in zlib_inflate()
382 strm->adler = state->check = REVERSE(hold); in zlib_inflate()
384 state->mode = DICT; in zlib_inflate()
386 if (state->havedict == 0) { in zlib_inflate()
390 strm->adler = state->check = zlib_adler32(0L, NULL, 0); in zlib_inflate()
391 state->mode = TYPE; in zlib_inflate()
395 if (state->last) { in zlib_inflate()
397 state->mode = CHECK; in zlib_inflate()
401 state->last = BITS(1); in zlib_inflate()
405 state->mode = STORED; in zlib_inflate()
408 zlib_fixedtables(state); in zlib_inflate()
409 state->mode = LEN; /* decode codes */ in zlib_inflate()
412 state->mode = TABLE; in zlib_inflate()
416 state->mode = BAD; in zlib_inflate()
425 state->mode = BAD; in zlib_inflate()
428 state->length = (unsigned)hold & 0xffff; in zlib_inflate()
430 state->mode = COPY; in zlib_inflate()
432 copy = state->length; in zlib_inflate()
442 state->length -= copy; in zlib_inflate()
445 state->mode = TYPE; in zlib_inflate()
449 state->nlen = BITS(5) + 257; in zlib_inflate()
451 state->ndist = BITS(5) + 1; in zlib_inflate()
453 state->ncode = BITS(4) + 4; in zlib_inflate()
456 if (state->nlen > 286 || state->ndist > 30) { in zlib_inflate()
458 state->mode = BAD; in zlib_inflate()
462 state->have = 0; in zlib_inflate()
463 state->mode = LENLENS; in zlib_inflate()
465 while (state->have < state->ncode) { in zlib_inflate()
467 state->lens[order[state->have++]] = (unsigned short)BITS(3); in zlib_inflate()
470 while (state->have < 19) in zlib_inflate()
471 state->lens[order[state->have++]] = 0; in zlib_inflate()
472 state->next = state->codes; in zlib_inflate()
473 state->lencode = (code const *)(state->next); in zlib_inflate()
474 state->lenbits = 7; in zlib_inflate()
475 ret = zlib_inflate_table(CODES, state->lens, 19, &(state->next), in zlib_inflate()
476 &(state->lenbits), state->work); in zlib_inflate()
479 state->mode = BAD; in zlib_inflate()
482 state->have = 0; in zlib_inflate()
483 state->mode = CODELENS; in zlib_inflate()
485 while (state->have < state->nlen + state->ndist) { in zlib_inflate()
487 this = state->lencode[BITS(state->lenbits)]; in zlib_inflate()
494 state->lens[state->have++] = this.val; in zlib_inflate()
500 if (state->have == 0) { in zlib_inflate()
502 state->mode = BAD; in zlib_inflate()
505 len = state->lens[state->have - 1]; in zlib_inflate()
523 if (state->have + copy > state->nlen + state->ndist) { in zlib_inflate()
525 state->mode = BAD; in zlib_inflate()
529 state->lens[state->have++] = (unsigned short)len; in zlib_inflate()
534 if (state->mode == BAD) break; in zlib_inflate()
537 state->next = state->codes; in zlib_inflate()
538 state->lencode = (code const *)(state->next); in zlib_inflate()
539 state->lenbits = 9; in zlib_inflate()
540 ret = zlib_inflate_table(LENS, state->lens, state->nlen, &(state->next), in zlib_inflate()
541 &(state->lenbits), state->work); in zlib_inflate()
544 state->mode = BAD; in zlib_inflate()
547 state->distcode = (code const *)(state->next); in zlib_inflate()
548 state->distbits = 6; in zlib_inflate()
549 ret = zlib_inflate_table(DISTS, state->lens + state->nlen, state->ndist, in zlib_inflate()
550 &(state->next), &(state->distbits), state->work); in zlib_inflate()
553 state->mode = BAD; in zlib_inflate()
556 state->mode = LEN; in zlib_inflate()
565 this = state->lencode[BITS(state->lenbits)]; in zlib_inflate()
572 this = state->lencode[last.val + in zlib_inflate()
580 state->length = (unsigned)this.val; in zlib_inflate()
582 state->mode = LIT; in zlib_inflate()
586 state->mode = TYPE; in zlib_inflate()
591 state->mode = BAD; in zlib_inflate()
594 state->extra = (unsigned)(this.op) & 15; in zlib_inflate()
595 state->mode = LENEXT; in zlib_inflate()
597 if (state->extra) { in zlib_inflate()
598 NEEDBITS(state->extra); in zlib_inflate()
599 state->length += BITS(state->extra); in zlib_inflate()
600 DROPBITS(state->extra); in zlib_inflate()
602 state->mode = DIST; in zlib_inflate()
605 this = state->distcode[BITS(state->distbits)]; in zlib_inflate()
612 this = state->distcode[last.val + in zlib_inflate()
622 state->mode = BAD; in zlib_inflate()
625 state->offset = (unsigned)this.val; in zlib_inflate()
626 state->extra = (unsigned)(this.op) & 15; in zlib_inflate()
627 state->mode = DISTEXT; in zlib_inflate()
629 if (state->extra) { in zlib_inflate()
630 NEEDBITS(state->extra); in zlib_inflate()
631 state->offset += BITS(state->extra); in zlib_inflate()
632 DROPBITS(state->extra); in zlib_inflate()
635 if (state->offset > state->dmax) { in zlib_inflate()
637 state->mode = BAD; in zlib_inflate()
641 if (state->offset > state->whave + out - left) { in zlib_inflate()
643 state->mode = BAD; in zlib_inflate()
646 state->mode = MATCH; in zlib_inflate()
650 if (state->offset > copy) { /* copy from window */ in zlib_inflate()
651 copy = state->offset - copy; in zlib_inflate()
652 if (copy > state->write) { in zlib_inflate()
653 copy -= state->write; in zlib_inflate()
654 from = state->window + (state->wsize - copy); in zlib_inflate()
657 from = state->window + (state->write - copy); in zlib_inflate()
658 if (copy > state->length) copy = state->length; in zlib_inflate()
661 from = put - state->offset; in zlib_inflate()
662 copy = state->length; in zlib_inflate()
666 state->length -= copy; in zlib_inflate()
670 if (state->length == 0) state->mode = LEN; in zlib_inflate()
674 *put++ = (unsigned char)(state->length); in zlib_inflate()
676 state->mode = LEN; in zlib_inflate()
679 if (state->wrap) { in zlib_inflate()
683 state->total += out; in zlib_inflate()
685 strm->adler = state->check = in zlib_inflate()
686 UPDATE(state->check, put - out, out); in zlib_inflate()
689 REVERSE(hold)) != state->check) { in zlib_inflate()
691 state->mode = BAD; in zlib_inflate()
696 state->mode = DONE; in zlib_inflate()
717 if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) in zlib_inflate()
724 state->total += out; in zlib_inflate()
725 if (state->wrap && out) in zlib_inflate()
726 strm->adler = state->check = in zlib_inflate()
727 UPDATE(state->check, strm->next_out - out, out); in zlib_inflate()
729 strm->data_type = state->bits + (state->last ? 64 : 0) + in zlib_inflate()
730 (state->mode == TYPE ? 128 : 0); in zlib_inflate()
744 if (strm == NULL || strm->state == NULL) in zlib_inflateEnd()
759 struct inflate_state *state = (struct inflate_state *)z->state; in zlib_inflateIncomp() local
763 if (state->mode != TYPE && state->mode != HEAD) in zlib_inflateIncomp()
776 z->adler = state->check = in zlib_inflateIncomp()
777 UPDATE(state->check, z->next_in, z->avail_in); in zlib_inflateIncomp()
782 state->total += z->avail_in; in zlib_inflateIncomp()