Lines Matching full:state
26 * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset)
30 * - Add comments on state->bits assertion in inffast.c
96 struct inflate_state FAR *state; in inflateStateCheck() local
100 state = (struct inflate_state FAR *)strm->state; in inflateStateCheck()
101 if (state == Z_NULL || state->strm != strm || in inflateStateCheck()
102 state->mode < HEAD || state->mode > SYNC) in inflateStateCheck()
108 struct inflate_state FAR *state; in inflateResetKeep() local
111 state = (struct inflate_state FAR *)strm->state; in inflateResetKeep()
112 strm->total_in = strm->total_out = state->total = 0; in inflateResetKeep()
114 if (state->wrap) /* to support ill-conceived Java test suite */ in inflateResetKeep()
115 strm->adler = state->wrap & 1; in inflateResetKeep()
116 state->mode = HEAD; in inflateResetKeep()
117 state->last = 0; in inflateResetKeep()
118 state->havedict = 0; in inflateResetKeep()
119 state->flags = -1; in inflateResetKeep()
120 state->dmax = 32768U; in inflateResetKeep()
121 state->head = Z_NULL; in inflateResetKeep()
122 state->hold = 0; in inflateResetKeep()
123 state->bits = 0; in inflateResetKeep()
124 state->lencode = state->distcode = state->next = state->codes; in inflateResetKeep()
125 state->sane = 1; in inflateResetKeep()
126 state->back = -1; in inflateResetKeep()
132 struct inflate_state FAR *state; in inflateReset() local
135 state = (struct inflate_state FAR *)strm->state; in inflateReset()
136 state->wsize = 0; in inflateReset()
137 state->whave = 0; in inflateReset()
138 state->wnext = 0; in inflateReset()
144 struct inflate_state FAR *state; in inflateReset2() local
146 /* get the state */ in inflateReset2()
148 state = (struct inflate_state FAR *)strm->state; in inflateReset2()
168 if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { in inflateReset2()
169 ZFREE(strm, state->window); in inflateReset2()
170 state->window = Z_NULL; in inflateReset2()
173 /* update state and reset the rest of it */ in inflateReset2()
174 state->wrap = wrap; in inflateReset2()
175 state->wbits = (unsigned)windowBits; in inflateReset2()
182 struct inflate_state FAR *state; in inflateInit2_() local
203 state = (struct inflate_state FAR *) in inflateInit2_()
205 if (state == Z_NULL) return Z_MEM_ERROR; in inflateInit2_()
207 strm->state = (struct internal_state FAR *)state; in inflateInit2_()
208 state->strm = strm; in inflateInit2_()
209 state->window = Z_NULL; in inflateInit2_()
210 state->mode = HEAD; /* to pass state test in inflateReset2() */ in inflateInit2_()
211 state->check = 1L; /* 1L is the result of adler32() zero length data */ in inflateInit2_()
214 ZFREE(strm, state); in inflateInit2_()
215 strm->state = Z_NULL; in inflateInit2_()
226 struct inflate_state FAR *state; in inflatePrime() local
231 state = (struct inflate_state FAR *)strm->state; in inflatePrime()
233 state->hold = 0; in inflatePrime()
234 state->bits = 0; in inflatePrime()
237 if (bits > 16 || state->bits + (uInt)bits > 32) return Z_STREAM_ERROR; in inflatePrime()
239 state->hold += (unsigned)value << state->bits; in inflatePrime()
240 state->bits += (uInt)bits; in inflatePrime()
245 Return state with length and distance decoding tables and index sizes set to
254 local void fixedtables(struct inflate_state FAR *state) { in fixedtables() argument
267 while (sym < 144) state->lens[sym++] = 8; in fixedtables()
268 while (sym < 256) state->lens[sym++] = 9; in fixedtables()
269 while (sym < 280) state->lens[sym++] = 7; in fixedtables()
270 while (sym < 288) state->lens[sym++] = 8; in fixedtables()
274 inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); in fixedtables()
278 while (sym < 32) state->lens[sym++] = 5; in fixedtables()
281 inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); in fixedtables()
289 state->lencode = lenfix; in fixedtables()
290 state->lenbits = 9; in fixedtables()
291 state->distcode = distfix; in fixedtables()
292 state->distbits = 5; in fixedtables()
319 struct inflate_state state; in makefixed() local
321 fixedtables(&state); in makefixed()
336 printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op, in makefixed()
337 state.lencode[low].bits, state.lencode[low].val); in makefixed()
347 printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, in makefixed()
348 state.distcode[low].val); in makefixed()
371 struct inflate_state FAR *state; in updatewindow() local
374 state = (struct inflate_state FAR *)strm->state; in updatewindow()
377 if (state->window == Z_NULL) { in updatewindow()
378 unsigned wsize = 1U << state->wbits; in updatewindow()
379 state->window = (unsigned char FAR *) in updatewindow()
382 if (state->window == Z_NULL) return 1; in updatewindow()
390 zmemzero(state->window + wsize, CHUNKCOPY_CHUNK_SIZE); in updatewindow()
395 if (state->wsize == 0) { in updatewindow()
396 state->wsize = 1U << state->wbits; in updatewindow()
397 state->wnext = 0; in updatewindow()
398 state->whave = 0; in updatewindow()
401 /* copy state->wsize or less output bytes into the circular window */ in updatewindow()
402 if (copy >= state->wsize) { in updatewindow()
403 zmemcpy(state->window, end - state->wsize, state->wsize); in updatewindow()
404 state->wnext = 0; in updatewindow()
405 state->whave = state->wsize; in updatewindow()
408 dist = state->wsize - state->wnext; in updatewindow()
410 zmemcpy(state->window + state->wnext, end - copy, dist); in updatewindow()
413 zmemcpy(state->window, end - copy, copy); in updatewindow()
414 state->wnext = copy; in updatewindow()
415 state->whave = state->wsize; in updatewindow()
418 state->wnext += dist; in updatewindow()
419 if (state->wnext == state->wsize) state->wnext = 0; in updatewindow()
420 if (state->whave < state->wsize) state->whave += dist; in updatewindow()
431 (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
455 /* Load registers with state in inflate() for speed */
462 hold = state->hold; \
463 bits = state->bits; \
466 /* Restore state from registers in inflate() */
473 state->hold = hold; \
474 state->bits = bits; \
521 inflate() uses a state machine to process as much input data and generate as
522 much output data as possible before returning. The state machine is
525 for (;;) switch (state) {
531 state = STATEm;
538 next state. The NEEDBITS() macro is usually the way the state evaluates
561 state information is maintained to continue the loop where it left off
563 would all have to actually be part of the saved state in case NEEDBITS()
572 state = STATEx;
575 As shown above, if the next state is also the next case, then the break
578 A state may also return if there is not enough output space available to
579 complete that state. Those states are copying stored data, writing a
603 struct inflate_state FAR *state; in inflate() local
626 state = (struct inflate_state FAR *)strm->state; in inflate()
627 if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ in inflate()
633 switch (state->mode) { in inflate()
635 if (state->wrap == 0) { in inflate()
636 state->mode = TYPEDO; in inflate()
641 if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ in inflate()
642 if (state->wbits == 0) in inflate()
643 state->wbits = 15; in inflate()
644 state->check = crc32(0L, Z_NULL, 0); in inflate()
645 CRC2(state->check, hold); in inflate()
647 state->mode = FLAGS; in inflate()
650 if (state->head != Z_NULL) in inflate()
651 state->head->done = -1; in inflate()
652 if (!(state->wrap & 1) || /* check if zlib header allowed */ in inflate()
658 state->mode = BAD; in inflate()
663 state->mode = BAD; in inflate()
668 if (state->wbits == 0) in inflate()
669 state->wbits = len; in inflate()
670 if (len > 15 || len > state->wbits) { in inflate()
672 state->mode = BAD; in inflate()
675 state->dmax = 1U << len; in inflate()
676 state->flags = 0; /* indicate zlib header */ in inflate()
678 strm->adler = state->check = adler32(0L, Z_NULL, 0); in inflate()
679 state->mode = hold & 0x200 ? DICTID : TYPE; in inflate()
685 state->flags = (int)(hold); in inflate()
686 if ((state->flags & 0xff) != Z_DEFLATED) { in inflate()
688 state->mode = BAD; in inflate()
691 if (state->flags & 0xe000) { in inflate()
693 state->mode = BAD; in inflate()
696 if (state->head != Z_NULL) in inflate()
697 state->head->text = (int)((hold >> 8) & 1); in inflate()
698 if ((state->flags & 0x0200) && (state->wrap & 4)) in inflate()
699 CRC2(state->check, hold); in inflate()
701 state->mode = TIME; in inflate()
705 if (state->head != Z_NULL) in inflate()
706 state->head->time = hold; in inflate()
707 if ((state->flags & 0x0200) && (state->wrap & 4)) in inflate()
708 CRC4(state->check, hold); in inflate()
710 state->mode = OS; in inflate()
714 if (state->head != Z_NULL) { in inflate()
715 state->head->xflags = (int)(hold & 0xff); in inflate()
716 state->head->os = (int)(hold >> 8); in inflate()
718 if ((state->flags & 0x0200) && (state->wrap & 4)) in inflate()
719 CRC2(state->check, hold); in inflate()
721 state->mode = EXLEN; in inflate()
724 if (state->flags & 0x0400) { in inflate()
726 state->length = (unsigned)(hold); in inflate()
727 if (state->head != Z_NULL) in inflate()
728 state->head->extra_len = (unsigned)hold; in inflate()
729 if ((state->flags & 0x0200) && (state->wrap & 4)) in inflate()
730 CRC2(state->check, hold); in inflate()
733 else if (state->head != Z_NULL) in inflate()
734 state->head->extra = Z_NULL; in inflate()
735 state->mode = EXTRA; in inflate()
738 if (state->flags & 0x0400) { in inflate()
739 copy = state->length; in inflate()
742 if (state->head != Z_NULL && in inflate()
743 state->head->extra != Z_NULL && in inflate()
744 (len = state->head->extra_len - state->length) < in inflate()
745 state->head->extra_max) { in inflate()
746 zmemcpy(state->head->extra + len, next, in inflate()
747 len + copy > state->head->extra_max ? in inflate()
748 state->head->extra_max - len : copy); in inflate()
750 if ((state->flags & 0x0200) && (state->wrap & 4)) in inflate()
751 state->check = crc32(state->check, next, copy); in inflate()
754 state->length -= copy; in inflate()
756 if (state->length) goto inf_leave; in inflate()
758 state->length = 0; in inflate()
759 state->mode = NAME; in inflate()
762 if (state->flags & 0x0800) { in inflate()
767 if (state->head != Z_NULL && in inflate()
768 state->head->name != Z_NULL && in inflate()
769 state->length < state->head->name_max) in inflate()
770 state->head->name[state->length++] = (Bytef)len; in inflate()
772 if ((state->flags & 0x0200) && (state->wrap & 4)) in inflate()
773 state->check = crc32(state->check, next, copy); in inflate()
778 else if (state->head != Z_NULL) in inflate()
779 state->head->name = Z_NULL; in inflate()
780 state->length = 0; in inflate()
781 state->mode = COMMENT; in inflate()
784 if (state->flags & 0x1000) { in inflate()
789 if (state->head != Z_NULL && in inflate()
790 state->head->comment != Z_NULL && in inflate()
791 state->length < state->head->comm_max) in inflate()
792 state->head->comment[state->length++] = (Bytef)len; in inflate()
794 if ((state->flags & 0x0200) && (state->wrap & 4)) in inflate()
795 state->check = crc32(state->check, next, copy); in inflate()
800 else if (state->head != Z_NULL) in inflate()
801 state->head->comment = Z_NULL; in inflate()
802 state->mode = HCRC; in inflate()
805 if (state->flags & 0x0200) { in inflate()
807 if ((state->wrap & 4) && hold != (state->check & 0xffff)) { in inflate()
809 state->mode = BAD; in inflate()
814 if (state->head != Z_NULL) { in inflate()
815 state->head->hcrc = (int)((state->flags >> 9) & 1); in inflate()
816 state->head->done = 1; in inflate()
818 strm->adler = state->check = crc32(0L, Z_NULL, 0); in inflate()
819 state->mode = TYPE; in inflate()
824 strm->adler = state->check = ZSWAP32(hold); in inflate()
826 state->mode = DICT; in inflate()
829 if (state->havedict == 0) { in inflate()
833 strm->adler = state->check = adler32(0L, Z_NULL, 0); in inflate()
834 state->mode = TYPE; in inflate()
840 if (state->last) { in inflate()
842 state->mode = CHECK; in inflate()
846 state->last = BITS(1); in inflate()
851 state->last ? " (last)" : "")); in inflate()
852 state->mode = STORED; in inflate()
855 fixedtables(state); in inflate()
857 state->last ? " (last)" : "")); in inflate()
858 state->mode = LEN_; /* decode codes */ in inflate()
866 state->last ? " (last)" : "")); in inflate()
867 state->mode = TABLE; in inflate()
871 state->mode = BAD; in inflate()
880 state->mode = BAD; in inflate()
883 state->length = (unsigned)hold & 0xffff; in inflate()
885 state->length)); in inflate()
887 state->mode = COPY_; in inflate()
891 state->mode = COPY; in inflate()
894 copy = state->length; in inflate()
904 state->length -= copy; in inflate()
908 state->mode = TYPE; in inflate()
912 state->nlen = BITS(5) + 257; in inflate()
914 state->ndist = BITS(5) + 1; in inflate()
916 state->ncode = BITS(4) + 4; in inflate()
919 if (state->nlen > 286 || state->ndist > 30) { in inflate()
921 state->mode = BAD; in inflate()
926 state->have = 0; in inflate()
927 state->mode = LENLENS; in inflate()
930 while (state->have < state->ncode) { in inflate()
932 state->lens[order[state->have++]] = (unsigned short)BITS(3); in inflate()
935 while (state->have < 19) in inflate()
936 state->lens[order[state->have++]] = 0; in inflate()
937 state->next = state->codes; in inflate()
938 state->lencode = (const code FAR *)(state->next); in inflate()
939 state->lenbits = 7; in inflate()
940 ret = inflate_table(CODES, state->lens, 19, &(state->next), in inflate()
941 &(state->lenbits), state->work); in inflate()
944 state->mode = BAD; in inflate()
948 state->have = 0; in inflate()
949 state->mode = CODELENS; in inflate()
952 while (state->have < state->nlen + state->ndist) { in inflate()
954 here = state->lencode[BITS(state->lenbits)]; in inflate()
960 state->lens[state->have++] = here.val; in inflate()
966 if (state->have == 0) { in inflate()
968 state->mode = BAD; in inflate()
971 len = state->lens[state->have - 1]; in inflate()
989 if (state->have + copy > state->nlen + state->ndist) { in inflate()
991 state->mode = BAD; in inflate()
995 state->lens[state->have++] = (unsigned short)len; in inflate()
1000 if (state->mode == BAD) break; in inflate()
1003 if (state->lens[256] == 0) { in inflate()
1005 state->mode = BAD; in inflate()
1012 state->next = state->codes; in inflate()
1013 state->lencode = (const code FAR *)(state->next); in inflate()
1014 state->lenbits = 10; in inflate()
1015 ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), in inflate()
1016 &(state->lenbits), state->work); in inflate()
1019 state->mode = BAD; in inflate()
1022 state->distcode = (const code FAR *)(state->next); in inflate()
1023 state->distbits = 9; in inflate()
1024 ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, in inflate()
1025 &(state->next), &(state->distbits), state->work); in inflate()
1028 state->mode = BAD; in inflate()
1032 state->mode = LEN_; in inflate()
1036 state->mode = LEN; in inflate()
1044 if (state->mode == TYPE) in inflate()
1045 state->back = -1; in inflate()
1048 state->back = 0; in inflate()
1050 here = state->lencode[BITS(state->lenbits)]; in inflate()
1057 here = state->lencode[last.val + in inflate()
1063 state->back += last.bits; in inflate()
1066 state->back += here.bits; in inflate()
1067 state->length = (unsigned)here.val; in inflate()
1072 state->mode = LIT; in inflate()
1077 state->back = -1; in inflate()
1078 state->mode = TYPE; in inflate()
1083 state->mode = BAD; in inflate()
1086 state->extra = (unsigned)(here.op) & 15; in inflate()
1087 state->mode = LENEXT; in inflate()
1090 if (state->extra) { in inflate()
1091 NEEDBITS(state->extra); in inflate()
1092 state->length += BITS(state->extra); in inflate()
1093 DROPBITS(state->extra); in inflate()
1094 state->back += state->extra; in inflate()
1096 Tracevv((stderr, "inflate: length %u\n", state->length)); in inflate()
1097 state->was = state->length; in inflate()
1098 state->mode = DIST; in inflate()
1102 here = state->distcode[BITS(state->distbits)]; in inflate()
1109 here = state->distcode[last.val + in inflate()
1115 state->back += last.bits; in inflate()
1118 state->back += here.bits; in inflate()
1121 state->mode = BAD; in inflate()
1124 state->offset = (unsigned)here.val; in inflate()
1125 state->extra = (unsigned)(here.op) & 15; in inflate()
1126 state->mode = DISTEXT; in inflate()
1129 if (state->extra) { in inflate()
1130 NEEDBITS(state->extra); in inflate()
1131 state->offset += BITS(state->extra); in inflate()
1132 DROPBITS(state->extra); in inflate()
1133 state->back += state->extra; in inflate()
1136 if (state->offset > state->dmax) { in inflate()
1138 state->mode = BAD; in inflate()
1142 Tracevv((stderr, "inflate: distance %u\n", state->offset)); in inflate()
1143 state->mode = MATCH; in inflate()
1148 if (state->offset > copy) { /* copy from window */ in inflate()
1149 copy = state->offset - copy; in inflate()
1150 if (copy > state->whave) { in inflate()
1151 if (state->sane) { in inflate()
1153 state->mode = BAD; in inflate()
1158 copy -= state->whave; in inflate()
1159 if (copy > state->length) copy = state->length; in inflate()
1162 state->length -= copy; in inflate()
1166 if (state->length == 0) state->mode = LEN; in inflate()
1170 if (copy > state->wnext) { in inflate()
1171 copy -= state->wnext; in inflate()
1172 from = state->window + (state->wsize - copy); in inflate()
1175 from = state->window + (state->wnext - copy); in inflate()
1176 if (copy > state->length) copy = state->length; in inflate()
1181 copy = state->length; in inflate()
1183 put = chunkcopy_lapped_safe(put, state->offset, copy, put + left); in inflate()
1186 state->length -= copy; in inflate()
1187 if (state->length == 0) state->mode = LEN; in inflate()
1191 *put++ = (unsigned char)(state->length); in inflate()
1193 state->mode = LEN; in inflate()
1196 if (state->wrap) { in inflate()
1200 state->total += out; in inflate()
1201 if ((state->wrap & 4) && out) in inflate()
1202 strm->adler = state->check = in inflate()
1203 UPDATE_CHECK(state->check, put - out, out); in inflate()
1205 if ((state->wrap & 4) && ( in inflate()
1207 state->flags ? hold : in inflate()
1209 ZSWAP32(hold)) != state->check) { in inflate()
1211 state->mode = BAD; in inflate()
1218 state->mode = LENGTH; in inflate()
1221 if (state->wrap && state->flags) { in inflate()
1223 if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) { in inflate()
1225 state->mode = BAD; in inflate()
1232 state->mode = DONE; in inflate()
1251 error. Call updatewindow() to create and/or update the window state. in inflate()
1279 if (state->wsize || (out != strm->avail_out && state->mode < BAD && in inflate()
1280 (state->mode < CHECK || flush != Z_FINISH))) in inflate()
1282 state->mode = MEM; in inflate()
1289 state->total += out; in inflate()
1290 if ((state->wrap & 4) && out) in inflate()
1291 strm->adler = state->check = in inflate()
1292 UPDATE_CHECK(state->check, strm->next_out - out, out); in inflate()
1293 strm->data_type = (int)state->bits + (state->last ? 64 : 0) + in inflate()
1294 (state->mode == TYPE ? 128 : 0) + in inflate()
1295 (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); in inflate()
1302 struct inflate_state FAR *state; in inflateEnd() local
1305 state = (struct inflate_state FAR *)strm->state; in inflateEnd()
1306 if (state->window != Z_NULL) ZFREE(strm, state->window); in inflateEnd()
1307 ZFREE(strm, strm->state); in inflateEnd()
1308 strm->state = Z_NULL; in inflateEnd()
1315 struct inflate_state FAR *state; in inflateGetDictionary() local
1317 /* check state */ in inflateGetDictionary()
1319 state = (struct inflate_state FAR *)strm->state; in inflateGetDictionary()
1322 if (state->whave && dictionary != Z_NULL) { in inflateGetDictionary()
1323 zmemcpy(dictionary, state->window + state->wnext, in inflateGetDictionary()
1324 state->whave - state->wnext); in inflateGetDictionary()
1325 zmemcpy(dictionary + state->whave - state->wnext, in inflateGetDictionary()
1326 state->window, state->wnext); in inflateGetDictionary()
1329 *dictLength = state->whave; in inflateGetDictionary()
1335 struct inflate_state FAR *state; in inflateSetDictionary() local
1339 /* check state */ in inflateSetDictionary()
1341 state = (struct inflate_state FAR *)strm->state; in inflateSetDictionary()
1342 if (state->wrap != 0 && state->mode != DICT) in inflateSetDictionary()
1346 if (state->mode == DICT) { in inflateSetDictionary()
1349 if (dictid != state->check) in inflateSetDictionary()
1357 state->mode = MEM; in inflateSetDictionary()
1360 state->havedict = 1; in inflateSetDictionary()
1366 struct inflate_state FAR *state; in inflateGetHeader() local
1368 /* check state */ in inflateGetHeader()
1370 state = (struct inflate_state FAR *)strm->state; in inflateGetHeader()
1371 if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; in inflateGetHeader()
1374 state->head = head; in inflateGetHeader()
1383 state. If on return *have equals four, then the pattern was found and the
1387 called again with more data and the *have state. *have is initialized to
1415 struct inflate_state FAR *state; in inflateSync() local
1419 state = (struct inflate_state FAR *)strm->state; in inflateSync()
1420 if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; in inflateSync()
1423 if (state->mode != SYNC) { in inflateSync()
1424 state->mode = SYNC; in inflateSync()
1425 state->hold >>= state->bits & 7; in inflateSync()
1426 state->bits -= state->bits & 7; in inflateSync()
1428 while (state->bits >= 8) { in inflateSync()
1429 buf[len++] = (unsigned char)(state->hold); in inflateSync()
1430 state->hold >>= 8; in inflateSync()
1431 state->bits -= 8; in inflateSync()
1433 state->have = 0; in inflateSync()
1434 syncsearch(&(state->have), buf, len); in inflateSync()
1438 len = syncsearch(&(state->have), strm->next_in, strm->avail_in); in inflateSync()
1444 if (state->have != 4) return Z_DATA_ERROR; in inflateSync()
1445 if (state->flags == -1) in inflateSync()
1446 state->wrap = 0; /* if no header yet, treat as raw */ in inflateSync()
1448 state->wrap &= ~4; /* no point in computing a check value now */ in inflateSync()
1449 flags = state->flags; in inflateSync()
1453 state->flags = flags; in inflateSync()
1454 state->mode = TYPE; in inflateSync()
1467 struct inflate_state FAR *state; in inflateSyncPoint() local
1470 state = (struct inflate_state FAR *)strm->state; in inflateSyncPoint()
1471 return state->mode == STORED && state->bits == 0; in inflateSyncPoint()
1475 struct inflate_state FAR *state; in inflateCopy() local
1483 state = (struct inflate_state FAR *)source->state; in inflateCopy()
1490 if (state->window != Z_NULL) { in inflateCopy()
1492 source, (1U << state->wbits) + CHUNKCOPY_CHUNK_SIZE, in inflateCopy()
1500 /* copy state */ in inflateCopy()
1502 zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state)); in inflateCopy()
1504 if (state->lencode >= state->codes && in inflateCopy()
1505 state->lencode <= state->codes + ENOUGH - 1) { in inflateCopy()
1506 copy->lencode = copy->codes + (state->lencode - state->codes); in inflateCopy()
1507 copy->distcode = copy->codes + (state->distcode - state->codes); in inflateCopy()
1509 copy->next = copy->codes + (state->next - state->codes); in inflateCopy()
1511 wsize = 1U << state->wbits; in inflateCopy()
1512 zmemcpy(window, state->window, wsize); in inflateCopy()
1515 dest->state = (struct internal_state FAR *)copy; in inflateCopy()
1520 struct inflate_state FAR *state; in inflateUndermine() local
1523 state = (struct inflate_state FAR *)strm->state; in inflateUndermine()
1525 state->sane = !subvert; in inflateUndermine()
1529 state->sane = 1; in inflateUndermine()
1535 struct inflate_state FAR *state; in inflateValidate() local
1538 state = (struct inflate_state FAR *)strm->state; in inflateValidate()
1539 if (check && state->wrap) in inflateValidate()
1540 state->wrap |= 4; in inflateValidate()
1542 state->wrap &= ~4; in inflateValidate()
1547 struct inflate_state FAR *state; in inflateMark() local
1551 state = (struct inflate_state FAR *)strm->state; in inflateMark()
1552 return (long)(((unsigned long)((long)state->back)) << 16) + in inflateMark()
1553 (state->mode == COPY ? state->length : in inflateMark()
1554 (state->mode == MATCH ? state->was - state->length : 0)); in inflateMark()
1558 struct inflate_state FAR *state; in inflateCodesUsed() local
1560 state = (struct inflate_state FAR *)strm->state; in inflateCodesUsed()
1561 return (unsigned long)(state->next - state->codes); in inflateCodesUsed()