Chris@4: /* infback9.c -- inflate deflate64 data using a call-back interface Chris@4: * Copyright (C) 1995-2008 Mark Adler Chris@4: * For conditions of distribution and use, see copyright notice in zlib.h Chris@4: */ Chris@4: Chris@4: #include "zutil.h" Chris@4: #include "infback9.h" Chris@4: #include "inftree9.h" Chris@4: #include "inflate9.h" Chris@4: Chris@4: #define WSIZE 65536UL Chris@4: Chris@4: /* Chris@4: strm provides memory allocation functions in zalloc and zfree, or Chris@4: Z_NULL to use the library memory allocation functions. Chris@4: Chris@4: window is a user-supplied window and output buffer that is 64K bytes. Chris@4: */ Chris@4: int ZEXPORT inflateBack9Init_(strm, window, version, stream_size) Chris@4: z_stream FAR *strm; Chris@4: unsigned char FAR *window; Chris@4: const char *version; Chris@4: int stream_size; Chris@4: { Chris@4: struct inflate_state FAR *state; Chris@4: Chris@4: if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || Chris@4: stream_size != (int)(sizeof(z_stream))) Chris@4: return Z_VERSION_ERROR; Chris@4: if (strm == Z_NULL || window == Z_NULL) Chris@4: return Z_STREAM_ERROR; Chris@4: strm->msg = Z_NULL; /* in case we return an error */ Chris@4: if (strm->zalloc == (alloc_func)0) { Chris@4: strm->zalloc = zcalloc; Chris@4: strm->opaque = (voidpf)0; Chris@4: } Chris@4: if (strm->zfree == (free_func)0) strm->zfree = zcfree; Chris@4: state = (struct inflate_state FAR *)ZALLOC(strm, 1, Chris@4: sizeof(struct inflate_state)); Chris@4: if (state == Z_NULL) return Z_MEM_ERROR; Chris@4: Tracev((stderr, "inflate: allocated\n")); Chris@4: strm->state = (voidpf)state; Chris@4: state->window = window; Chris@4: return Z_OK; Chris@4: } Chris@4: Chris@4: /* Chris@4: Build and output length and distance decoding tables for fixed code Chris@4: decoding. Chris@4: */ Chris@4: #ifdef MAKEFIXED Chris@4: #include Chris@4: Chris@4: void makefixed9(void) Chris@4: { Chris@4: unsigned sym, bits, low, size; Chris@4: code *next, *lenfix, *distfix; Chris@4: struct inflate_state state; Chris@4: code fixed[544]; Chris@4: Chris@4: /* literal/length table */ Chris@4: sym = 0; Chris@4: while (sym < 144) state.lens[sym++] = 8; Chris@4: while (sym < 256) state.lens[sym++] = 9; Chris@4: while (sym < 280) state.lens[sym++] = 7; Chris@4: while (sym < 288) state.lens[sym++] = 8; Chris@4: next = fixed; Chris@4: lenfix = next; Chris@4: bits = 9; Chris@4: inflate_table9(LENS, state.lens, 288, &(next), &(bits), state.work); Chris@4: Chris@4: /* distance table */ Chris@4: sym = 0; Chris@4: while (sym < 32) state.lens[sym++] = 5; Chris@4: distfix = next; Chris@4: bits = 5; Chris@4: inflate_table9(DISTS, state.lens, 32, &(next), &(bits), state.work); Chris@4: Chris@4: /* write tables */ Chris@4: puts(" /* inffix9.h -- table for decoding deflate64 fixed codes"); Chris@4: puts(" * Generated automatically by makefixed9()."); Chris@4: puts(" */"); Chris@4: puts(""); Chris@4: puts(" /* WARNING: this file should *not* be used by applications."); Chris@4: puts(" It is part of the implementation of this library and is"); Chris@4: puts(" subject to change. Applications should only use zlib.h."); Chris@4: puts(" */"); Chris@4: puts(""); Chris@4: size = 1U << 9; Chris@4: printf(" static const code lenfix[%u] = {", size); Chris@4: low = 0; Chris@4: for (;;) { Chris@4: if ((low % 6) == 0) printf("\n "); Chris@4: printf("{%u,%u,%d}", lenfix[low].op, lenfix[low].bits, Chris@4: lenfix[low].val); Chris@4: if (++low == size) break; Chris@4: putchar(','); Chris@4: } Chris@4: puts("\n };"); Chris@4: size = 1U << 5; Chris@4: printf("\n static const code distfix[%u] = {", size); Chris@4: low = 0; Chris@4: for (;;) { Chris@4: if ((low % 5) == 0) printf("\n "); Chris@4: printf("{%u,%u,%d}", distfix[low].op, distfix[low].bits, Chris@4: distfix[low].val); Chris@4: if (++low == size) break; Chris@4: putchar(','); Chris@4: } Chris@4: puts("\n };"); Chris@4: } Chris@4: #endif /* MAKEFIXED */ Chris@4: Chris@4: /* Macros for inflateBack(): */ Chris@4: Chris@4: /* Clear the input bit accumulator */ Chris@4: #define INITBITS() \ Chris@4: do { \ Chris@4: hold = 0; \ Chris@4: bits = 0; \ Chris@4: } while (0) Chris@4: Chris@4: /* Assure that some input is available. If input is requested, but denied, Chris@4: then return a Z_BUF_ERROR from inflateBack(). */ Chris@4: #define PULL() \ Chris@4: do { \ Chris@4: if (have == 0) { \ Chris@4: have = in(in_desc, &next); \ Chris@4: if (have == 0) { \ Chris@4: next = Z_NULL; \ Chris@4: ret = Z_BUF_ERROR; \ Chris@4: goto inf_leave; \ Chris@4: } \ Chris@4: } \ Chris@4: } while (0) Chris@4: Chris@4: /* Get a byte of input into the bit accumulator, or return from inflateBack() Chris@4: with an error if there is no input available. */ Chris@4: #define PULLBYTE() \ Chris@4: do { \ Chris@4: PULL(); \ Chris@4: have--; \ Chris@4: hold += (unsigned long)(*next++) << bits; \ Chris@4: bits += 8; \ Chris@4: } while (0) Chris@4: Chris@4: /* Assure that there are at least n bits in the bit accumulator. If there is Chris@4: not enough available input to do that, then return from inflateBack() with Chris@4: an error. */ Chris@4: #define NEEDBITS(n) \ Chris@4: do { \ Chris@4: while (bits < (unsigned)(n)) \ Chris@4: PULLBYTE(); \ Chris@4: } while (0) Chris@4: Chris@4: /* Return the low n bits of the bit accumulator (n <= 16) */ Chris@4: #define BITS(n) \ Chris@4: ((unsigned)hold & ((1U << (n)) - 1)) Chris@4: Chris@4: /* Remove n bits from the bit accumulator */ Chris@4: #define DROPBITS(n) \ Chris@4: do { \ Chris@4: hold >>= (n); \ Chris@4: bits -= (unsigned)(n); \ Chris@4: } while (0) Chris@4: Chris@4: /* Remove zero to seven bits as needed to go to a byte boundary */ Chris@4: #define BYTEBITS() \ Chris@4: do { \ Chris@4: hold >>= bits & 7; \ Chris@4: bits -= bits & 7; \ Chris@4: } while (0) Chris@4: Chris@4: /* Assure that some output space is available, by writing out the window Chris@4: if it's full. If the write fails, return from inflateBack() with a Chris@4: Z_BUF_ERROR. */ Chris@4: #define ROOM() \ Chris@4: do { \ Chris@4: if (left == 0) { \ Chris@4: put = window; \ Chris@4: left = WSIZE; \ Chris@4: wrap = 1; \ Chris@4: if (out(out_desc, put, (unsigned)left)) { \ Chris@4: ret = Z_BUF_ERROR; \ Chris@4: goto inf_leave; \ Chris@4: } \ Chris@4: } \ Chris@4: } while (0) Chris@4: Chris@4: /* Chris@4: strm provides the memory allocation functions and window buffer on input, Chris@4: and provides information on the unused input on return. For Z_DATA_ERROR Chris@4: returns, strm will also provide an error message. Chris@4: Chris@4: in() and out() are the call-back input and output functions. When Chris@4: inflateBack() needs more input, it calls in(). When inflateBack() has Chris@4: filled the window with output, or when it completes with data in the Chris@4: window, it calls out() to write out the data. The application must not Chris@4: change the provided input until in() is called again or inflateBack() Chris@4: returns. The application must not change the window/output buffer until Chris@4: inflateBack() returns. Chris@4: Chris@4: in() and out() are called with a descriptor parameter provided in the Chris@4: inflateBack() call. This parameter can be a structure that provides the Chris@4: information required to do the read or write, as well as accumulated Chris@4: information on the input and output such as totals and check values. Chris@4: Chris@4: in() should return zero on failure. out() should return non-zero on Chris@4: failure. If either in() or out() fails, than inflateBack() returns a Chris@4: Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it Chris@4: was in() or out() that caused in the error. Otherwise, inflateBack() Chris@4: returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format Chris@4: error, or Z_MEM_ERROR if it could not allocate memory for the state. Chris@4: inflateBack() can also return Z_STREAM_ERROR if the input parameters Chris@4: are not correct, i.e. strm is Z_NULL or the state was not initialized. Chris@4: */ Chris@4: int ZEXPORT inflateBack9(strm, in, in_desc, out, out_desc) Chris@4: z_stream FAR *strm; Chris@4: in_func in; Chris@4: void FAR *in_desc; Chris@4: out_func out; Chris@4: void FAR *out_desc; Chris@4: { Chris@4: struct inflate_state FAR *state; Chris@4: unsigned char FAR *next; /* next input */ Chris@4: unsigned char FAR *put; /* next output */ Chris@4: unsigned have; /* available input */ Chris@4: unsigned long left; /* available output */ Chris@4: inflate_mode mode; /* current inflate mode */ Chris@4: int lastblock; /* true if processing last block */ Chris@4: int wrap; /* true if the window has wrapped */ Chris@4: unsigned long write; /* window write index */ Chris@4: unsigned char FAR *window; /* allocated sliding window, if needed */ Chris@4: unsigned long hold; /* bit buffer */ Chris@4: unsigned bits; /* bits in bit buffer */ Chris@4: unsigned extra; /* extra bits needed */ Chris@4: unsigned long length; /* literal or length of data to copy */ Chris@4: unsigned long offset; /* distance back to copy string from */ Chris@4: unsigned long copy; /* number of stored or match bytes to copy */ Chris@4: unsigned char FAR *from; /* where to copy match bytes from */ Chris@4: code const FAR *lencode; /* starting table for length/literal codes */ Chris@4: code const FAR *distcode; /* starting table for distance codes */ Chris@4: unsigned lenbits; /* index bits for lencode */ Chris@4: unsigned distbits; /* index bits for distcode */ Chris@4: code here; /* current decoding table entry */ Chris@4: code last; /* parent table entry */ Chris@4: unsigned len; /* length to copy for repeats, bits to drop */ Chris@4: int ret; /* return code */ Chris@4: static const unsigned short order[19] = /* permutation of code lengths */ Chris@4: {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; Chris@4: #include "inffix9.h" Chris@4: Chris@4: /* Check that the strm exists and that the state was initialized */ Chris@4: if (strm == Z_NULL || strm->state == Z_NULL) Chris@4: return Z_STREAM_ERROR; Chris@4: state = (struct inflate_state FAR *)strm->state; Chris@4: Chris@4: /* Reset the state */ Chris@4: strm->msg = Z_NULL; Chris@4: mode = TYPE; Chris@4: lastblock = 0; Chris@4: write = 0; Chris@4: wrap = 0; Chris@4: window = state->window; Chris@4: next = strm->next_in; Chris@4: have = next != Z_NULL ? strm->avail_in : 0; Chris@4: hold = 0; Chris@4: bits = 0; Chris@4: put = window; Chris@4: left = WSIZE; Chris@4: lencode = Z_NULL; Chris@4: distcode = Z_NULL; Chris@4: Chris@4: /* Inflate until end of block marked as last */ Chris@4: for (;;) Chris@4: switch (mode) { Chris@4: case TYPE: Chris@4: /* determine and dispatch block type */ Chris@4: if (lastblock) { Chris@4: BYTEBITS(); Chris@4: mode = DONE; Chris@4: break; Chris@4: } Chris@4: NEEDBITS(3); Chris@4: lastblock = BITS(1); Chris@4: DROPBITS(1); Chris@4: switch (BITS(2)) { Chris@4: case 0: /* stored block */ Chris@4: Tracev((stderr, "inflate: stored block%s\n", Chris@4: lastblock ? " (last)" : "")); Chris@4: mode = STORED; Chris@4: break; Chris@4: case 1: /* fixed block */ Chris@4: lencode = lenfix; Chris@4: lenbits = 9; Chris@4: distcode = distfix; Chris@4: distbits = 5; Chris@4: Tracev((stderr, "inflate: fixed codes block%s\n", Chris@4: lastblock ? " (last)" : "")); Chris@4: mode = LEN; /* decode codes */ Chris@4: break; Chris@4: case 2: /* dynamic block */ Chris@4: Tracev((stderr, "inflate: dynamic codes block%s\n", Chris@4: lastblock ? " (last)" : "")); Chris@4: mode = TABLE; Chris@4: break; Chris@4: case 3: Chris@4: strm->msg = (char *)"invalid block type"; Chris@4: mode = BAD; Chris@4: } Chris@4: DROPBITS(2); Chris@4: break; Chris@4: Chris@4: case STORED: Chris@4: /* get and verify stored block length */ Chris@4: BYTEBITS(); /* go to byte boundary */ Chris@4: NEEDBITS(32); Chris@4: if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { Chris@4: strm->msg = (char *)"invalid stored block lengths"; Chris@4: mode = BAD; Chris@4: break; Chris@4: } Chris@4: length = (unsigned)hold & 0xffff; Chris@4: Tracev((stderr, "inflate: stored length %lu\n", Chris@4: length)); Chris@4: INITBITS(); Chris@4: Chris@4: /* copy stored block from input to output */ Chris@4: while (length != 0) { Chris@4: copy = length; Chris@4: PULL(); Chris@4: ROOM(); Chris@4: if (copy > have) copy = have; Chris@4: if (copy > left) copy = left; Chris@4: zmemcpy(put, next, copy); Chris@4: have -= copy; Chris@4: next += copy; Chris@4: left -= copy; Chris@4: put += copy; Chris@4: length -= copy; Chris@4: } Chris@4: Tracev((stderr, "inflate: stored end\n")); Chris@4: mode = TYPE; Chris@4: break; Chris@4: Chris@4: case TABLE: Chris@4: /* get dynamic table entries descriptor */ Chris@4: NEEDBITS(14); Chris@4: state->nlen = BITS(5) + 257; Chris@4: DROPBITS(5); Chris@4: state->ndist = BITS(5) + 1; Chris@4: DROPBITS(5); Chris@4: state->ncode = BITS(4) + 4; Chris@4: DROPBITS(4); Chris@4: if (state->nlen > 286) { Chris@4: strm->msg = (char *)"too many length symbols"; Chris@4: mode = BAD; Chris@4: break; Chris@4: } Chris@4: Tracev((stderr, "inflate: table sizes ok\n")); Chris@4: Chris@4: /* get code length code lengths (not a typo) */ Chris@4: state->have = 0; Chris@4: while (state->have < state->ncode) { Chris@4: NEEDBITS(3); Chris@4: state->lens[order[state->have++]] = (unsigned short)BITS(3); Chris@4: DROPBITS(3); Chris@4: } Chris@4: while (state->have < 19) Chris@4: state->lens[order[state->have++]] = 0; Chris@4: state->next = state->codes; Chris@4: lencode = (code const FAR *)(state->next); Chris@4: lenbits = 7; Chris@4: ret = inflate_table9(CODES, state->lens, 19, &(state->next), Chris@4: &(lenbits), state->work); Chris@4: if (ret) { Chris@4: strm->msg = (char *)"invalid code lengths set"; Chris@4: mode = BAD; Chris@4: break; Chris@4: } Chris@4: Tracev((stderr, "inflate: code lengths ok\n")); Chris@4: Chris@4: /* get length and distance code code lengths */ Chris@4: state->have = 0; Chris@4: while (state->have < state->nlen + state->ndist) { Chris@4: for (;;) { Chris@4: here = lencode[BITS(lenbits)]; Chris@4: if ((unsigned)(here.bits) <= bits) break; Chris@4: PULLBYTE(); Chris@4: } Chris@4: if (here.val < 16) { Chris@4: NEEDBITS(here.bits); Chris@4: DROPBITS(here.bits); Chris@4: state->lens[state->have++] = here.val; Chris@4: } Chris@4: else { Chris@4: if (here.val == 16) { Chris@4: NEEDBITS(here.bits + 2); Chris@4: DROPBITS(here.bits); Chris@4: if (state->have == 0) { Chris@4: strm->msg = (char *)"invalid bit length repeat"; Chris@4: mode = BAD; Chris@4: break; Chris@4: } Chris@4: len = (unsigned)(state->lens[state->have - 1]); Chris@4: copy = 3 + BITS(2); Chris@4: DROPBITS(2); Chris@4: } Chris@4: else if (here.val == 17) { Chris@4: NEEDBITS(here.bits + 3); Chris@4: DROPBITS(here.bits); Chris@4: len = 0; Chris@4: copy = 3 + BITS(3); Chris@4: DROPBITS(3); Chris@4: } Chris@4: else { Chris@4: NEEDBITS(here.bits + 7); Chris@4: DROPBITS(here.bits); Chris@4: len = 0; Chris@4: copy = 11 + BITS(7); Chris@4: DROPBITS(7); Chris@4: } Chris@4: if (state->have + copy > state->nlen + state->ndist) { Chris@4: strm->msg = (char *)"invalid bit length repeat"; Chris@4: mode = BAD; Chris@4: break; Chris@4: } Chris@4: while (copy--) Chris@4: state->lens[state->have++] = (unsigned short)len; Chris@4: } Chris@4: } Chris@4: Chris@4: /* handle error breaks in while */ Chris@4: if (mode == BAD) break; Chris@4: Chris@4: /* check for end-of-block code (better have one) */ Chris@4: if (state->lens[256] == 0) { Chris@4: strm->msg = (char *)"invalid code -- missing end-of-block"; Chris@4: mode = BAD; Chris@4: break; Chris@4: } Chris@4: Chris@4: /* build code tables -- note: do not change the lenbits or distbits Chris@4: values here (9 and 6) without reading the comments in inftree9.h Chris@4: concerning the ENOUGH constants, which depend on those values */ Chris@4: state->next = state->codes; Chris@4: lencode = (code const FAR *)(state->next); Chris@4: lenbits = 9; Chris@4: ret = inflate_table9(LENS, state->lens, state->nlen, Chris@4: &(state->next), &(lenbits), state->work); Chris@4: if (ret) { Chris@4: strm->msg = (char *)"invalid literal/lengths set"; Chris@4: mode = BAD; Chris@4: break; Chris@4: } Chris@4: distcode = (code const FAR *)(state->next); Chris@4: distbits = 6; Chris@4: ret = inflate_table9(DISTS, state->lens + state->nlen, Chris@4: state->ndist, &(state->next), &(distbits), Chris@4: state->work); Chris@4: if (ret) { Chris@4: strm->msg = (char *)"invalid distances set"; Chris@4: mode = BAD; Chris@4: break; Chris@4: } Chris@4: Tracev((stderr, "inflate: codes ok\n")); Chris@4: mode = LEN; Chris@4: Chris@4: case LEN: Chris@4: /* get a literal, length, or end-of-block code */ Chris@4: for (;;) { Chris@4: here = lencode[BITS(lenbits)]; Chris@4: if ((unsigned)(here.bits) <= bits) break; Chris@4: PULLBYTE(); Chris@4: } Chris@4: if (here.op && (here.op & 0xf0) == 0) { Chris@4: last = here; Chris@4: for (;;) { Chris@4: here = lencode[last.val + Chris@4: (BITS(last.bits + last.op) >> last.bits)]; Chris@4: if ((unsigned)(last.bits + here.bits) <= bits) break; Chris@4: PULLBYTE(); Chris@4: } Chris@4: DROPBITS(last.bits); Chris@4: } Chris@4: DROPBITS(here.bits); Chris@4: length = (unsigned)here.val; Chris@4: Chris@4: /* process literal */ Chris@4: if (here.op == 0) { Chris@4: Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? Chris@4: "inflate: literal '%c'\n" : Chris@4: "inflate: literal 0x%02x\n", here.val)); Chris@4: ROOM(); Chris@4: *put++ = (unsigned char)(length); Chris@4: left--; Chris@4: mode = LEN; Chris@4: break; Chris@4: } Chris@4: Chris@4: /* process end of block */ Chris@4: if (here.op & 32) { Chris@4: Tracevv((stderr, "inflate: end of block\n")); Chris@4: mode = TYPE; Chris@4: break; Chris@4: } Chris@4: Chris@4: /* invalid code */ Chris@4: if (here.op & 64) { Chris@4: strm->msg = (char *)"invalid literal/length code"; Chris@4: mode = BAD; Chris@4: break; Chris@4: } Chris@4: Chris@4: /* length code -- get extra bits, if any */ Chris@4: extra = (unsigned)(here.op) & 31; Chris@4: if (extra != 0) { Chris@4: NEEDBITS(extra); Chris@4: length += BITS(extra); Chris@4: DROPBITS(extra); Chris@4: } Chris@4: Tracevv((stderr, "inflate: length %lu\n", length)); Chris@4: Chris@4: /* get distance code */ Chris@4: for (;;) { Chris@4: here = distcode[BITS(distbits)]; Chris@4: if ((unsigned)(here.bits) <= bits) break; Chris@4: PULLBYTE(); Chris@4: } Chris@4: if ((here.op & 0xf0) == 0) { Chris@4: last = here; Chris@4: for (;;) { Chris@4: here = distcode[last.val + Chris@4: (BITS(last.bits + last.op) >> last.bits)]; Chris@4: if ((unsigned)(last.bits + here.bits) <= bits) break; Chris@4: PULLBYTE(); Chris@4: } Chris@4: DROPBITS(last.bits); Chris@4: } Chris@4: DROPBITS(here.bits); Chris@4: if (here.op & 64) { Chris@4: strm->msg = (char *)"invalid distance code"; Chris@4: mode = BAD; Chris@4: break; Chris@4: } Chris@4: offset = (unsigned)here.val; Chris@4: Chris@4: /* get distance extra bits, if any */ Chris@4: extra = (unsigned)(here.op) & 15; Chris@4: if (extra != 0) { Chris@4: NEEDBITS(extra); Chris@4: offset += BITS(extra); Chris@4: DROPBITS(extra); Chris@4: } Chris@4: if (offset > WSIZE - (wrap ? 0: left)) { Chris@4: strm->msg = (char *)"invalid distance too far back"; Chris@4: mode = BAD; Chris@4: break; Chris@4: } Chris@4: Tracevv((stderr, "inflate: distance %lu\n", offset)); Chris@4: Chris@4: /* copy match from window to output */ Chris@4: do { Chris@4: ROOM(); Chris@4: copy = WSIZE - offset; Chris@4: if (copy < left) { Chris@4: from = put + copy; Chris@4: copy = left - copy; Chris@4: } Chris@4: else { Chris@4: from = put - offset; Chris@4: copy = left; Chris@4: } Chris@4: if (copy > length) copy = length; Chris@4: length -= copy; Chris@4: left -= copy; Chris@4: do { Chris@4: *put++ = *from++; Chris@4: } while (--copy); Chris@4: } while (length != 0); Chris@4: break; Chris@4: Chris@4: case DONE: Chris@4: /* inflate stream terminated properly -- write leftover output */ Chris@4: ret = Z_STREAM_END; Chris@4: if (left < WSIZE) { Chris@4: if (out(out_desc, window, (unsigned)(WSIZE - left))) Chris@4: ret = Z_BUF_ERROR; Chris@4: } Chris@4: goto inf_leave; Chris@4: Chris@4: case BAD: Chris@4: ret = Z_DATA_ERROR; Chris@4: goto inf_leave; Chris@4: Chris@4: default: /* can't happen, but makes compilers happy */ Chris@4: ret = Z_STREAM_ERROR; Chris@4: goto inf_leave; Chris@4: } Chris@4: Chris@4: /* Return unused input */ Chris@4: inf_leave: Chris@4: strm->next_in = next; Chris@4: strm->avail_in = have; Chris@4: return ret; Chris@4: } Chris@4: Chris@4: int ZEXPORT inflateBack9End(strm) Chris@4: z_stream FAR *strm; Chris@4: { Chris@4: if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) Chris@4: return Z_STREAM_ERROR; Chris@4: ZFREE(strm, strm->state); Chris@4: strm->state = Z_NULL; Chris@4: Tracev((stderr, "inflate: end\n")); Chris@4: return Z_OK; Chris@4: }