98    void makefixed 
OF((
void));
 
  105     struct inflate_state FAR *state;
 
  107     if (strm == Z_NULL || strm->state == Z_NULL) 
return Z_STREAM_ERROR;
 
  108     state = (
struct inflate_state FAR *)strm->state;
 
  109     strm->total_in = strm->total_out = state->total = 0;
 
  112         strm->adler = state->wrap & 1;
 
  116     state->dmax = 32768U;
 
  117     state->head = Z_NULL;
 
  120     state->lencode = state->distcode = state->next = state->codes;
 
  123     Tracev((stderr, 
"inflate: reset\n"));
 
  129     struct inflate_state FAR *state;
 
  131     if (strm == Z_NULL || strm->state == Z_NULL) 
return Z_STREAM_ERROR;
 
  132     state = (
struct inflate_state FAR *)strm->state;
 
  142     struct inflate_state FAR *state;
 
  145     if (strm == Z_NULL || strm->state == Z_NULL) 
return Z_STREAM_ERROR;
 
  146     state = (
struct inflate_state FAR *)strm->state;
 
  149     if (windowBits < 0) {
 
  151         windowBits = -windowBits;
 
  154         wrap = (windowBits >> 4) + 1;
 
  162     if (windowBits && (windowBits < 8 || windowBits > 15))
 
  163         return Z_STREAM_ERROR;
 
  164     if (state->window != Z_NULL && state->wbits != (
unsigned)windowBits) {
 
  165         ZFREE(strm, state->window);
 
  166         state->window = Z_NULL;
 
  171     state->wbits = (unsigned)windowBits;
 
  175 int ZEXPORT 
inflateInit2_(z_streamp strm, 
int windowBits, 
const char *version, 
int stream_size)
 
  178     struct inflate_state FAR *state;
 
  180     if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
 
  181         stream_size != (
int)(
sizeof(z_stream)))
 
  182         return Z_VERSION_ERROR;
 
  183     if (strm == Z_NULL) 
return Z_STREAM_ERROR;
 
  185     if (strm->zalloc == (alloc_func)0) {
 
  187         return Z_STREAM_ERROR;
 
  190         strm->opaque = (voidpf)0;
 
  193     if (strm->zfree == (free_func)0)
 
  195         return Z_STREAM_ERROR;
 
  199     state = (
struct inflate_state FAR *)
 
  200             ZALLOC(strm, 1, 
sizeof(
struct inflate_state));
 
  201     if (state == Z_NULL) 
return Z_MEM_ERROR;
 
  202     Tracev((stderr, 
"inflate: allocated\n"));
 
  204     state->window = Z_NULL;
 
  208         strm->state = Z_NULL;
 
  213 int ZEXPORT 
inflateInit_(z_streamp strm, 
const char *version, 
int stream_size)
 
  220     struct inflate_state FAR *state;
 
  222     if (strm == Z_NULL || strm->state == Z_NULL) 
return Z_STREAM_ERROR;
 
  223     state = (
struct inflate_state FAR *)strm->state;
 
  229     if (bits > 16 || state->bits + bits > 32) 
return Z_STREAM_ERROR;
 
  230     value &= (1
L << bits) - 1;
 
  231     state->hold += value << state->bits;
 
  249     static int virgin = 1;
 
  250     static code *lenfix, *distfix;
 
  251     static code fixed[544];
 
  260         while (sym < 144) state->lens[sym++] = 8;
 
  261         while (sym < 256) state->lens[sym++] = 9;
 
  262         while (sym < 280) state->lens[sym++] = 7;
 
  263         while (sym < 288) state->lens[sym++] = 8;
 
  267         inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
 
  271         while (sym < 32) state->lens[sym++] = 5;
 
  274         inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
 
  280 #   include "inffixed.h" 
  282     state->lencode = lenfix;
 
  284     state->distcode = distfix;
 
  312     struct inflate_state state;
 
  315     puts(
"    /* inffixed.h -- table for decoding fixed codes");
 
  316     puts(
"     * Generated automatically by makefixed().");
 
  319     puts(
"    /* WARNING: this file should *not* be used by applications.");
 
  320     puts(
"       It is part of the implementation of this library and is");
 
  321     puts(
"       subject to change. Applications should only use zlib.h.");
 
  325     printf(
"    static const code lenfix[%u] = {", size);
 
  328         if ((low % 7) == 0) printf(
"\n        ");
 
  329         printf(
"{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
 
  330                state.lencode[low].bits, state.lencode[low].val);
 
  331         if (++low == size) 
break;
 
  336     printf(
"\n    static const code distfix[%u] = {", size);
 
  339         if ((low % 6) == 0) printf(
"\n        ");
 
  340         printf(
"{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
 
  341                state.distcode[low].val);
 
  342         if (++low == size) 
break;
 
  365     struct inflate_state FAR *state;
 
  368     state = (
struct inflate_state FAR *)strm->state;
 
  371     if (state->window == Z_NULL) {
 
  372         state->window = (
unsigned char FAR *)
 
  373                         ZALLOC(strm, 1U << state->wbits,
 
  374                                sizeof(
unsigned char));
 
  375         if (state->window == Z_NULL) 
return 1;
 
  379     if (state->wsize == 0) {
 
  380         state->wsize = 1U << state->wbits;
 
  386     copy = out - strm->avail_out;
 
  387     if (copy >= state->wsize) {
 
  388         zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
 
  390         state->whave = state->wsize;
 
  393         dist = state->wsize - state->wnext;
 
  394         if (dist > copy) dist = 
copy;
 
  395         zmemcpy(state->window + state->wnext, strm->next_out - copy, dist);
 
  398             zmemcpy(state->window, strm->next_out - copy, copy);
 
  400             state->whave = state->wsize;
 
  403             state->wnext += dist;
 
  404             if (state->wnext == state->wsize) state->wnext = 0;
 
  405             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     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 = (code 
const 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 = (code 
const 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 = (code 
const 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)))
 
 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;
 
 1250     unsigned long dictid;
 
 1251     unsigned char *next;
 
 1256     if (strm == Z_NULL || strm->state == Z_NULL) 
return Z_STREAM_ERROR;
 
 1257     state = (
struct inflate_state FAR *)strm->state;
 
 1258     if (state->wrap != 0 && state->mode != DICT)
 
 1259         return Z_STREAM_ERROR;
 
 1262     if (state->mode == DICT) {
 
 1264         dictid = 
adler32(dictid, dictionary, dictLength);
 
 1265         if (dictid != state->check)
 
 1266             return Z_DATA_ERROR;
 
 1271     next = strm->next_out;
 
 1272     avail = strm->avail_out;
 
 1273     strm->next_out = (Bytef *)dictionary + dictLength;
 
 1274     strm->avail_out = 0;
 
 1276     strm->avail_out = avail;
 
 1277     strm->next_out = next;
 
 1282     state->havedict = 1;
 
 1283     Tracev((stderr, 
"inflate:   dictionary set\n"));
 
 1289     struct inflate_state FAR *state;
 
 1292     if (strm == Z_NULL || strm->state == Z_NULL) 
return Z_STREAM_ERROR;
 
 1293     state = (
struct inflate_state FAR *)strm->state;
 
 1294     if ((state->wrap & 2) == 0) 
return Z_STREAM_ERROR;
 
 1320     while (next < len && got < 4) {
 
 1321         if ((
int)(buf[next]) == (got < 2 ? 0 : 0xff))
 
 1336     unsigned long in, out;      
 
 1337     unsigned char buf[4];       
 
 1338     struct inflate_state FAR *state;
 
 1341     if (strm == Z_NULL || strm->state == Z_NULL) 
return Z_STREAM_ERROR;
 
 1342     state = (
struct inflate_state FAR *)strm->state;
 
 1343     if (strm->avail_in == 0 && state->bits < 8) 
return Z_BUF_ERROR;
 
 1346     if (state->mode != SYNC) {
 
 1348         state->hold <<= state->bits & 7;
 
 1349         state->bits -= state->bits & 7;
 
 1351         while (state->bits >= 8) {
 
 1352             buf[len++] = (
unsigned char)(state->hold);
 
 1361     len = 
syncsearch(&(state->have), strm->next_in, strm->avail_in);
 
 1362     strm->avail_in -= len;
 
 1363     strm->next_in += len;
 
 1364     strm->total_in += len;
 
 1367     if (state->have != 4) 
return Z_DATA_ERROR;
 
 1368     in = strm->total_in;  out = strm->total_out;
 
 1370     strm->total_in = in;  strm->total_out = out;
 
 1385     struct inflate_state FAR *state;
 
 1387     if (strm == Z_NULL || strm->state == Z_NULL) 
return Z_STREAM_ERROR;
 
 1388     state = (
struct inflate_state FAR *)strm->state;
 
 1389     return state->mode == STORED && state->bits == 0;
 
 1394     struct inflate_state FAR *state;
 
 1395     struct inflate_state FAR *
copy;
 
 1396     unsigned char FAR *window;
 
 1400     if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
 
 1401         source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
 
 1402         return Z_STREAM_ERROR;
 
 1403     state = (
struct inflate_state FAR *)source->state;
 
 1406     copy = (
struct inflate_state FAR *)
 
 1407            ZALLOC(source, 1, 
sizeof(
struct inflate_state));
 
 1408     if (copy == Z_NULL) 
return Z_MEM_ERROR;
 
 1410     if (state->window != Z_NULL) {
 
 1411         window = (
unsigned char FAR *)
 
 1412                  ZALLOC(source, 1U << state->wbits, 
sizeof(
unsigned char));
 
 1413         if (window == Z_NULL) {
 
 1414             ZFREE(source, copy);
 
 1420     zmemcpy((voidpf)dest, (voidpf)source, 
sizeof(z_stream));
 
 1421     zmemcpy((voidpf)copy, (voidpf)state, 
sizeof(
struct inflate_state));
 
 1422     if (state->lencode >= state->codes &&
 
 1423         state->lencode <= state->codes + ENOUGH - 1) {
 
 1424         copy->lencode = copy->codes + (state->lencode - state->codes);
 
 1425         copy->distcode = copy->codes + (state->distcode - state->codes);
 
 1427     copy->next = copy->codes + (state->next - state->codes);
 
 1428     if (window != Z_NULL) {
 
 1429         wsize = 1U << state->wbits;
 
 1430         zmemcpy(window, state->window, wsize);
 
 1432     copy->window = window;
 
 1439     struct inflate_state FAR *state;
 
 1441     if (strm == Z_NULL || strm->state == Z_NULL) 
return Z_STREAM_ERROR;
 
 1442     state = (
struct inflate_state FAR *)strm->state;
 
 1443     state->sane = !subvert;
 
 1444 #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
 
 1448     return Z_DATA_ERROR;
 
 1454     struct inflate_state FAR *state;
 
 1456     if (strm == Z_NULL || strm->state == Z_NULL) 
return -1
L << 16;
 
 1457     state = (
struct inflate_state FAR *)strm->state;
 
 1458     return ((
long)(state->back) << 16) +
 
 1459         (state->mode == COPY ? state->length :
 
 1460             (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)
 
void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start)
 
int ZEXPORT inflateInit_(z_streamp strm, const char *version, int stream_size)
 
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)
 
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)
 
void copy(std::vector< T > &main, const std::vector< T > &data)
 
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)
 
local unsigned syncsearch(unsigned FAR *have, unsigned char FAR *buf, unsigned 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)
 
local int updatewindow(z_streamp strm, unsigned out)
 
int ZEXPORT inflateReset(z_streamp strm)