99 void makefixed
OF((
void));
106 struct inflate_state FAR *state;
108 if (strm == Z_NULL || strm->state == Z_NULL)
return Z_STREAM_ERROR;
109 state = (
struct inflate_state FAR *)strm->state;
110 strm->total_in = strm->total_out = state->total = 0;
113 strm->adler = state->wrap & 1;
117 state->dmax = 32768U;
118 state->head = Z_NULL;
121 state->lencode = state->distcode = state->next = state->codes;
124 Tracev((stderr,
"inflate: reset\n"));
130 struct inflate_state FAR *state;
132 if (strm == Z_NULL || strm->state == Z_NULL)
return Z_STREAM_ERROR;
133 state = (
struct inflate_state FAR *)strm->state;
143 struct inflate_state FAR *state;
146 if (strm == Z_NULL || strm->state == Z_NULL)
return Z_STREAM_ERROR;
147 state = (
struct inflate_state FAR *)strm->state;
150 if (windowBits < 0) {
152 windowBits = -windowBits;
155 wrap = (windowBits >> 4) + 1;
163 if (windowBits && (windowBits < 8 || windowBits > 15))
164 return Z_STREAM_ERROR;
165 if (state->window != Z_NULL && state->wbits != (
unsigned)windowBits) {
166 ZFREE(strm, state->window);
167 state->window = Z_NULL;
172 state->wbits = (unsigned)windowBits;
176 int ZEXPORT
inflateInit2_(z_streamp strm,
int windowBits,
const char *version,
int stream_size)
179 struct inflate_state FAR *state;
181 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
182 stream_size != (
int)(
sizeof(z_stream)))
183 return Z_VERSION_ERROR;
184 if (strm == Z_NULL)
return Z_STREAM_ERROR;
186 if (strm->zalloc == (alloc_func)0) {
188 return Z_STREAM_ERROR;
191 strm->opaque = (voidpf)0;
194 if (strm->zfree == (free_func)0)
196 return Z_STREAM_ERROR;
200 state = (
struct inflate_state FAR *)
201 ZALLOC(strm, 1,
sizeof(
struct inflate_state));
202 if (state == Z_NULL)
return Z_MEM_ERROR;
203 Tracev((stderr,
"inflate: allocated\n"));
205 state->window = Z_NULL;
209 strm->state = Z_NULL;
214 int ZEXPORT
inflateInit_(z_streamp strm,
const char *version,
int stream_size)
221 struct inflate_state FAR *state;
223 if (strm == Z_NULL || strm->state == Z_NULL)
return Z_STREAM_ERROR;
224 state = (
struct inflate_state FAR *)strm->state;
230 if (bits > 16 || state->bits + bits > 32)
return Z_STREAM_ERROR;
231 value &= (1
L << bits) - 1;
232 state->hold += value << state->bits;
250 static int virgin = 1;
251 static code *lenfix, *distfix;
252 static code fixed[544];
261 while (sym < 144) state->lens[sym++] = 8;
262 while (sym < 256) state->lens[sym++] = 9;
263 while (sym < 280) state->lens[sym++] = 7;
264 while (sym < 288) state->lens[sym++] = 8;
268 inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
272 while (sym < 32) state->lens[sym++] = 5;
275 inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
281 # include "inffixed.h"
283 state->lencode = lenfix;
285 state->distcode = distfix;
313 struct inflate_state state;
316 puts(
" /* inffixed.h -- table for decoding fixed codes");
317 puts(
" * Generated automatically by makefixed().");
320 puts(
" /* WARNING: this file should *not* be used by applications.");
321 puts(
" It is part of the implementation of this library and is");
322 puts(
" subject to change. Applications should only use zlib.h.");
326 printf(
" static const code lenfix[%u] = {", size);
329 if ((low % 7) == 0) printf(
"\n ");
330 printf(
"{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
331 state.lencode[low].bits, state.lencode[low].val);
332 if (++low == size)
break;
337 printf(
"\n static const code distfix[%u] = {", size);
340 if ((low % 6) == 0) printf(
"\n ");
341 printf(
"{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
342 state.distcode[low].val);
343 if (++low == size)
break;
366 struct inflate_state FAR *state;
369 state = (
struct inflate_state FAR *)strm->state;
372 if (state->window == Z_NULL) {
373 state->window = (
unsigned char FAR *)
374 ZALLOC(strm, 1U << state->wbits,
375 sizeof(
unsigned char));
376 if (state->window == Z_NULL)
return 1;
380 if (state->wsize == 0) {
381 state->wsize = 1U << state->wbits;
388 if (copy >= state->wsize) {
389 zmemcpy(state->window, end - state->wsize, state->wsize);
391 state->whave = state->wsize;
394 dist = state->wsize - state->wnext;
395 if (dist > copy) dist = copy;
396 zmemcpy(state->window + state->wnext, end - copy, dist);
399 zmemcpy(state->window, end - copy, copy);
401 state->whave = state->wsize;
404 state->wnext += dist;
405 if (state->wnext == state->wsize) state->wnext = 0;
406 if (state->whave < state->wsize) state->whave += dist;
415 # define UPDATE(check, buf, len) \
416 (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
418 # define UPDATE(check, buf, len) adler32(check, buf, len)
423 # define CRC2(check, word) \
425 hbuf[0] = (unsigned char)(word); \
426 hbuf[1] = (unsigned char)((word) >> 8); \
427 check = crc32(check, hbuf, 2); \
430 # define CRC4(check, word) \
432 hbuf[0] = (unsigned char)(word); \
433 hbuf[1] = (unsigned char)((word) >> 8); \
434 hbuf[2] = (unsigned char)((word) >> 16); \
435 hbuf[3] = (unsigned char)((word) >> 24); \
436 check = crc32(check, hbuf, 4); \
443 put = strm->next_out; \
444 left = strm->avail_out; \
445 next = strm->next_in; \
446 have = strm->avail_in; \
447 hold = state->hold; \
448 bits = state->bits; \
454 strm->next_out = put; \
455 strm->avail_out = left; \
456 strm->next_in = next; \
457 strm->avail_in = have; \
458 state->hold = hold; \
459 state->bits = bits; \
473 if (have == 0) goto inf_leave; \
475 hold += (unsigned long)(*next++) << bits; \
481 #define NEEDBITS(n) \
483 while (bits < (unsigned)(n)) \
489 ((unsigned)hold & ((1U << (n)) - 1))
492 #define DROPBITS(n) \
495 bits -= (unsigned)(n); \
587 int ZEXPORT
inflate(z_streamp strm,
int flush)
589 struct inflate_state FAR *state;
590 z_const
unsigned char FAR *next;
591 unsigned char FAR *put;
597 unsigned char FAR *from;
603 unsigned char hbuf[4];
605 static const unsigned short order[19] =
606 {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
608 if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
609 (strm->next_in == Z_NULL && strm->avail_in != 0))
610 return Z_STREAM_ERROR;
612 state = (
struct inflate_state FAR *)strm->state;
613 if (state->mode == TYPE) state->mode = TYPEDO;
619 switch (state->mode) {
621 if (state->wrap == 0) {
622 state->mode = TYPEDO;
627 if ((state->wrap & 2) && hold == 0x8b1f) {
628 state->check =
crc32(0
L, Z_NULL, 0);
629 CRC2(state->check, hold);
635 if (state->head != Z_NULL)
636 state->head->done = -1;
637 if (!(state->wrap & 1) ||
641 ((
BITS(8) << 8) + (hold >> 8)) % 31) {
642 strm->msg = (
char *)
"incorrect header check";
646 if (
BITS(4) != Z_DEFLATED) {
647 strm->msg = (
char *)
"unknown compression method";
653 if (state->wbits == 0)
655 else if (len > state->wbits) {
656 strm->msg = (
char *)
"invalid window size";
660 state->dmax = 1U << len;
661 Tracev((stderr,
"inflate: zlib header ok\n"));
662 strm->adler = state->check =
adler32(0
L, Z_NULL, 0);
663 state->mode = hold & 0x200 ? DICTID : TYPE;
669 state->flags = (int)(hold);
670 if ((state->flags & 0xff) != Z_DEFLATED) {
671 strm->msg = (
char *)
"unknown compression method";
675 if (state->flags & 0xe000) {
676 strm->msg = (
char *)
"unknown header flags set";
680 if (state->head != Z_NULL)
681 state->head->text = (int)((hold >> 8) & 1);
682 if (state->flags & 0x0200)
CRC2(state->check, hold);
687 if (state->head != Z_NULL)
688 state->head->time = hold;
689 if (state->flags & 0x0200)
CRC4(state->check, hold);
691 state->mode = OS_zlib;
694 if (state->head != Z_NULL) {
695 state->head->xflags = (int)(hold & 0xff);
696 state->head->os = (int)(hold >> 8);
698 if (state->flags & 0x0200)
CRC2(state->check, hold);
702 if (state->flags & 0x0400) {
704 state->length = (unsigned)(hold);
705 if (state->head != Z_NULL)
706 state->head->extra_len = (unsigned)hold;
707 if (state->flags & 0x0200)
CRC2(state->check, hold);
710 else if (state->head != Z_NULL)
711 state->head->extra = Z_NULL;
714 if (state->flags & 0x0400) {
715 copy = state->length;
716 if (copy > have) copy = have;
718 if (state->head != Z_NULL &&
719 state->head->extra != Z_NULL) {
720 len = state->head->extra_len - state->length;
721 zmemcpy(state->head->extra + len, next,
722 len + copy > state->head->extra_max ?
723 state->head->extra_max - len : copy);
725 if (state->flags & 0x0200)
726 state->check =
crc32(state->check, next, copy);
729 state->length -= copy;
731 if (state->length)
goto inf_leave;
736 if (state->flags & 0x0800) {
737 if (have == 0)
goto inf_leave;
740 len = (unsigned)(next[copy++]);
741 if (state->head != Z_NULL &&
742 state->head->name != Z_NULL &&
743 state->length < state->head->name_max)
744 state->head->name[state->length++] = len;
745 }
while (len && copy < have);
746 if (state->flags & 0x0200)
747 state->check =
crc32(state->check, next, copy);
750 if (len)
goto inf_leave;
752 else if (state->head != Z_NULL)
753 state->head->name = Z_NULL;
755 state->mode = COMMENT;
757 if (state->flags & 0x1000) {
758 if (have == 0)
goto inf_leave;
761 len = (unsigned)(next[copy++]);
762 if (state->head != Z_NULL &&
763 state->head->comment != Z_NULL &&
764 state->length < state->head->comm_max)
765 state->head->comment[state->length++] = len;
766 }
while (len && copy < have);
767 if (state->flags & 0x0200)
768 state->check =
crc32(state->check, next, copy);
771 if (len)
goto inf_leave;
773 else if (state->head != Z_NULL)
774 state->head->comment = Z_NULL;
777 if (state->flags & 0x0200) {
779 if (hold != (state->check & 0xffff)) {
780 strm->msg = (
char *)
"header crc mismatch";
786 if (state->head != Z_NULL) {
787 state->head->hcrc = (int)((state->flags >> 9) & 1);
788 state->head->done = 1;
790 strm->adler = state->check =
crc32(0
L, Z_NULL, 0);
796 strm->adler = state->check = ZSWAP32(hold);
800 if (state->havedict == 0) {
804 strm->adler = state->check =
adler32(0
L, Z_NULL, 0);
807 if (flush == Z_BLOCK || flush == Z_TREES)
goto inf_leave;
815 state->last =
BITS(1);
819 Tracev((stderr,
"inflate: stored block%s\n",
820 state->last ?
" (last)" :
""));
821 state->mode = STORED;
825 Tracev((stderr,
"inflate: fixed codes block%s\n",
826 state->last ?
" (last)" :
""));
828 if (flush == Z_TREES) {
834 Tracev((stderr,
"inflate: dynamic codes block%s\n",
835 state->last ?
" (last)" :
""));
839 strm->msg = (
char *)
"invalid block type";
847 if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
848 strm->msg = (
char *)
"invalid stored block lengths";
852 state->length = (unsigned)hold & 0xffff;
853 Tracev((stderr,
"inflate: stored length %u\n",
857 if (flush == Z_TREES)
goto inf_leave;
861 copy = state->length;
863 if (copy > have) copy = have;
864 if (copy > left) copy =
left;
865 if (copy == 0)
goto inf_leave;
871 state->length -= copy;
874 Tracev((stderr,
"inflate: stored end\n"));
879 state->nlen =
BITS(5) + 257;
881 state->ndist =
BITS(5) + 1;
883 state->ncode =
BITS(4) + 4;
885 #ifndef PKZIP_BUG_WORKAROUND
886 if (state->nlen > 286 || state->ndist > 30) {
887 strm->msg = (
char *)
"too many length or distance symbols";
892 Tracev((stderr,
"inflate: table sizes ok\n"));
894 state->mode = LENLENS;
896 while (state->have < state->ncode) {
898 state->lens[order[state->have++]] = (
unsigned short)
BITS(3);
901 while (state->have < 19)
902 state->lens[order[state->have++]] = 0;
903 state->next = state->codes;
904 state->lencode = (
const code FAR *)(state->next);
907 &(state->lenbits), state->work);
909 strm->msg = (
char *)
"invalid code lengths set";
913 Tracev((stderr,
"inflate: code lengths ok\n"));
915 state->mode = CODELENS;
917 while (state->have < state->nlen + state->ndist) {
919 here = state->lencode[
BITS(state->lenbits)];
920 if ((
unsigned)(here.bits) <= bits)
break;
925 state->lens[state->have++] = here.val;
928 if (here.val == 16) {
931 if (state->have == 0) {
932 strm->msg = (
char *)
"invalid bit length repeat";
936 len = state->lens[state->have - 1];
940 else if (here.val == 17) {
954 if (state->have + copy > state->nlen + state->ndist) {
955 strm->msg = (
char *)
"invalid bit length repeat";
960 state->lens[state->have++] = (
unsigned short)len;
965 if (state->mode == BAD)
break;
968 if (state->lens[256] == 0) {
969 strm->msg = (
char *)
"invalid code -- missing end-of-block";
977 state->next = state->codes;
978 state->lencode = (
const code FAR *)(state->next);
980 ret =
inflate_table(LENS, state->lens, state->nlen, &(state->next),
981 &(state->lenbits), state->work);
983 strm->msg = (
char *)
"invalid literal/lengths set";
987 state->distcode = (
const code FAR *)(state->next);
989 ret =
inflate_table(DISTS, state->lens + state->nlen, state->ndist,
990 &(state->next), &(state->distbits), state->work);
992 strm->msg = (
char *)
"invalid distances set";
996 Tracev((stderr,
"inflate: codes ok\n"));
998 if (flush == Z_TREES)
goto inf_leave;
1002 if (have >= 6 && left >= 258) {
1006 if (state->mode == TYPE)
1012 here = state->lencode[
BITS(state->lenbits)];
1013 if ((
unsigned)(here.bits) <= bits)
break;
1016 if (here.op && (here.op & 0xf0) == 0) {
1019 here = state->lencode[last.val +
1020 (
BITS(last.bits + last.op) >> last.bits)];
1021 if ((
unsigned)(last.bits + here.bits) <= bits)
break;
1025 state->back += last.bits;
1028 state->back += here.bits;
1029 state->length = (unsigned)here.val;
1030 if ((
int)(here.op) == 0) {
1031 Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
1032 "inflate: literal '%c'\n" :
1033 "inflate: literal 0x%02x\n", here.val));
1038 Tracevv((stderr,
"inflate: end of block\n"));
1044 strm->msg = (
char *)
"invalid literal/length code";
1048 state->extra = (unsigned)(here.op) & 15;
1049 state->mode = LENEXT;
1053 state->length +=
BITS(state->extra);
1055 state->back += state->extra;
1057 Tracevv((stderr,
"inflate: length %u\n", state->length));
1058 state->was = state->length;
1062 here = state->distcode[
BITS(state->distbits)];
1063 if ((
unsigned)(here.bits) <= bits)
break;
1066 if ((here.op & 0xf0) == 0) {
1069 here = state->distcode[last.val +
1070 (
BITS(last.bits + last.op) >> last.bits)];
1071 if ((
unsigned)(last.bits + here.bits) <= bits)
break;
1075 state->back += last.bits;
1078 state->back += here.bits;
1080 strm->msg = (
char *)
"invalid distance code";
1084 state->offset = (unsigned)here.val;
1085 state->extra = (
unsigned)(here.op) & 15;
1086 state->mode = DISTEXT;
1090 state->offset +=
BITS(state->extra);
1092 state->back += state->extra;
1094 #ifdef INFLATE_STRICT
1095 if (state->offset > state->dmax) {
1096 strm->msg = (
char *)
"invalid distance too far back";
1101 Tracevv((stderr,
"inflate: distance %u\n", state->offset));
1102 state->mode =
MATCH;
1104 if (left == 0)
goto inf_leave;
1106 if (state->offset > copy) {
1107 copy = state->offset - copy;
1108 if (copy > state->whave) {
1110 strm->msg = (
char *)
"invalid distance too far back";
1114 #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
1115 Trace((stderr,
"inflate.c too far\n"));
1116 copy -= state->whave;
1117 if (copy > state->length) copy = state->length;
1118 if (copy > left) copy =
left;
1120 state->length -= copy;
1124 if (state->length == 0) state->mode = LEN;
1128 if (copy > state->wnext) {
1129 copy -= state->wnext;
1130 from = state->window + (state->wsize - copy);
1133 from = state->window + (state->wnext - copy);
1134 if (copy > state->length) copy = state->length;
1137 from = put - state->offset;
1138 copy = state->length;
1140 if (copy > left) copy =
left;
1142 state->length -= copy;
1146 if (state->length == 0) state->mode = LEN;
1149 if (left == 0)
goto inf_leave;
1150 *put++ = (
unsigned char)(state->length);
1158 strm->total_out += out;
1159 state->total += out;
1161 strm->adler = state->check =
1162 UPDATE(state->check, put - out, out);
1166 state->flags ? hold :
1168 ZSWAP32(hold)) != state->check) {
1169 strm->msg = (
char *)
"incorrect data check";
1174 Tracev((stderr,
"inflate: check matches trailer\n"));
1177 state->mode = LENGTH;
1179 if (state->wrap && state->flags) {
1181 if (hold != (state->total & 0xffffffffUL)) {
1182 strm->msg = (
char *)
"incorrect length check";
1187 Tracev((stderr,
"inflate: length matches trailer\n"));
1201 return Z_STREAM_ERROR;
1212 if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
1213 (state->mode < CHECK || flush != Z_FINISH)))
1214 if (
updatewindow(strm, strm->next_out, out - strm->avail_out)) {
1218 in -= strm->avail_in;
1219 out -= strm->avail_out;
1220 strm->total_in += in;
1221 strm->total_out += out;
1222 state->total += out;
1223 if (state->wrap && out)
1224 strm->adler = state->check =
1225 UPDATE(state->check, strm->next_out - out, out);
1226 strm->data_type = state->bits + (state->last ? 64 : 0) +
1227 (state->mode == TYPE ? 128 : 0) +
1228 (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
1229 if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
1236 struct inflate_state FAR *state;
1237 if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
1238 return Z_STREAM_ERROR;
1239 state = (
struct inflate_state FAR *)strm->state;
1240 if (state->window != Z_NULL) ZFREE(strm, state->window);
1241 ZFREE(strm, strm->state);
1242 strm->state = Z_NULL;
1243 Tracev((stderr,
"inflate: end\n"));
1249 struct inflate_state FAR *state;
1252 if (strm == Z_NULL || strm->state == Z_NULL)
return Z_STREAM_ERROR;
1253 state = (
struct inflate_state FAR *)strm->state;
1256 if (state->whave && dictionary != Z_NULL) {
1257 zmemcpy(dictionary, state->window + state->wnext,
1258 state->whave - state->wnext);
1259 zmemcpy(dictionary + state->whave - state->wnext,
1260 state->window, state->wnext);
1262 if (dictLength != Z_NULL)
1263 *dictLength = state->whave;
1269 struct inflate_state FAR *state;
1270 unsigned long dictid;
1274 if (strm == Z_NULL || strm->state == Z_NULL)
return Z_STREAM_ERROR;
1275 state = (
struct inflate_state FAR *)strm->state;
1276 if (state->wrap != 0 && state->mode != DICT)
1277 return Z_STREAM_ERROR;
1280 if (state->mode == DICT) {
1282 dictid =
adler32(dictid, dictionary, dictLength);
1283 if (dictid != state->check)
1284 return Z_DATA_ERROR;
1289 ret =
updatewindow(strm, dictionary + dictLength, dictLength);
1294 state->havedict = 1;
1295 Tracev((stderr,
"inflate: dictionary set\n"));
1301 struct inflate_state FAR *state;
1304 if (strm == Z_NULL || strm->state == Z_NULL)
return Z_STREAM_ERROR;
1305 state = (
struct inflate_state FAR *)strm->state;
1306 if ((state->wrap & 2) == 0)
return Z_STREAM_ERROR;
1332 while (next < len && got < 4) {
1333 if ((
int)(buf[next]) == (got < 2 ? 0 : 0xff))
1348 unsigned long in, out;
1349 unsigned char buf[4];
1350 struct inflate_state FAR *state;
1353 if (strm == Z_NULL || strm->state == Z_NULL)
return Z_STREAM_ERROR;
1354 state = (
struct inflate_state FAR *)strm->state;
1355 if (strm->avail_in == 0 && state->bits < 8)
return Z_BUF_ERROR;
1358 if (state->mode != SYNC) {
1360 state->hold <<= state->bits & 7;
1361 state->bits -= state->bits & 7;
1363 while (state->bits >= 8) {
1364 buf[len++] = (
unsigned char)(state->hold);
1373 len =
syncsearch(&(state->have), strm->next_in, strm->avail_in);
1374 strm->avail_in -= len;
1375 strm->next_in += len;
1376 strm->total_in += len;
1379 if (state->have != 4)
return Z_DATA_ERROR;
1380 in = strm->total_in; out = strm->total_out;
1382 strm->total_in = in; strm->total_out = out;
1397 struct inflate_state FAR *state;
1399 if (strm == Z_NULL || strm->state == Z_NULL)
return Z_STREAM_ERROR;
1400 state = (
struct inflate_state FAR *)strm->state;
1401 return state->mode == STORED && state->bits == 0;
1406 struct inflate_state FAR *state;
1407 struct inflate_state FAR *copy;
1408 unsigned char FAR *window;
1412 if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
1413 source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
1414 return Z_STREAM_ERROR;
1415 state = (
struct inflate_state FAR *)source->state;
1418 copy = (
struct inflate_state FAR *)
1419 ZALLOC(source, 1,
sizeof(
struct inflate_state));
1420 if (copy == Z_NULL)
return Z_MEM_ERROR;
1422 if (state->window != Z_NULL) {
1423 window = (
unsigned char FAR *)
1424 ZALLOC(source, 1U << state->wbits,
sizeof(
unsigned char));
1425 if (window == Z_NULL) {
1426 ZFREE(source, copy);
1432 zmemcpy((voidpf)dest, (voidpf)source,
sizeof(z_stream));
1433 zmemcpy((voidpf)copy, (voidpf)state,
sizeof(
struct inflate_state));
1434 if (state->lencode >= state->codes &&
1435 state->lencode <= state->codes + ENOUGH - 1) {
1436 copy->lencode = copy->codes + (state->lencode - state->codes);
1437 copy->distcode = copy->codes + (state->distcode - state->codes);
1439 copy->next = copy->codes + (state->next - state->codes);
1440 if (window != Z_NULL) {
1441 wsize = 1U << state->wbits;
1442 zmemcpy(window, state->window, wsize);
1444 copy->window = window;
1451 struct inflate_state FAR *state;
1453 if (strm == Z_NULL || strm->state == Z_NULL)
return Z_STREAM_ERROR;
1454 state = (
struct inflate_state FAR *)strm->state;
1455 state->sane = !subvert;
1456 #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
1460 return Z_DATA_ERROR;
1466 struct inflate_state FAR *state;
1468 if (strm == Z_NULL || strm->state == Z_NULL)
return -1
L << 16;
1469 state = (
struct inflate_state FAR *)strm->state;
1470 return ((
long)(state->back) << 16) +
1471 (state->mode == COPY ? state->length :
1472 (state->mode ==
MATCH ? state->was - state->length : 0));
int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens, unsigned codes, code FAR *FAR *table, unsigned FAR *bits, unsigned short FAR *work)
int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, const char *version, int stream_size)
unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, uInt len)
int ZEXPORT inflateSync(z_streamp strm)
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size)
int ZEXPORT inflateGetDictionary(z_streamp strm, Bytef *dictionary, uInt *dictLength)
void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start)
int ZEXPORT inflateInit_(z_streamp strm, const char *version, int stream_size)
local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy)
int ZEXPORT inflateReset2(z_streamp strm, int windowBits)
int ZEXPORT inflateUndermine(z_streamp strm, int subvert)
int ZEXPORT inflateCopy(z_streamp dest, z_streamp source)
local unsigned syncsearch(unsigned FAR *have, const unsigned char FAR *buf, unsigned len)
uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)
void ZLIB_INTERNAL zmemcpy(Bytef *dest, const Bytef *source, uInt len)
#define CRC2(check, word)
int ZEXPORT inflateResetKeep(z_streamp strm)
local void fixedtables OF((struct inflate_state FAR *state))
int ZEXPORT inflateSyncPoint(z_streamp strm)
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
#define UPDATE(check, buf, len)
bool MATCH(const char *a, const char *b)
int ZEXPORT inflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength)
#define CRC4(check, word)
int ZEXPORT inflatePrime(z_streamp strm, int bits, int value)
int ZEXPORT inflateEnd(z_streamp strm)
int ZEXPORT inflateGetHeader(z_streamp strm, gz_headerp head)
int ZEXPORT inflate(z_streamp strm, int flush)
local void fixedtables(struct inflate_state FAR *state)
long ZEXPORT inflateMark(z_streamp strm)
int ZEXPORT inflateReset(z_streamp strm)