Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is available, an end-of-block is encountered, or a data error is encountered. When large enough input and output buffers are supplied to inflate(), for example, a 16K input buffer and a 64K output buffer, more than 95% of the inflate execution time i
(strm, start)
| 65 | output space. |
| 66 | */ |
| 67 | void inflate_fast(strm, start) |
| 68 | z_streamp strm; |
| 69 | unsigned start; /* inflate()'s starting value for strm->avail_out */ |
| 70 | { |
| 71 | struct inflate_state FAR *state; |
| 72 | unsigned char FAR *in; /* local strm->next_in */ |
| 73 | unsigned char FAR *last; /* while in < last, enough input available */ |
| 74 | unsigned char FAR *out; /* local strm->next_out */ |
| 75 | unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ |
| 76 | unsigned char FAR *end; /* while out < end, enough space available */ |
| 77 | #ifdef INFLATE_STRICT |
| 78 | unsigned dmax; /* maximum distance from zlib header */ |
| 79 | #endif |
| 80 | unsigned wsize; /* window size or zero if not using window */ |
| 81 | unsigned whave; /* valid bytes in the window */ |
| 82 | unsigned write; /* window write index */ |
| 83 | unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ |
| 84 | unsigned long hold; /* local strm->hold */ |
| 85 | unsigned bits; /* local strm->bits */ |
| 86 | code const FAR *lcode; /* local strm->lencode */ |
| 87 | code const FAR *dcode; /* local strm->distcode */ |
| 88 | unsigned lmask; /* mask for first level of length codes */ |
| 89 | unsigned dmask; /* mask for first level of distance codes */ |
| 90 | code this; /* retrieved table entry */ |
| 91 | unsigned op; /* code bits, operation, extra bits, or */ |
| 92 | /* window position, window bytes to copy */ |
| 93 | unsigned len; /* match length, unused bytes */ |
| 94 | unsigned dist; /* match distance */ |
| 95 | unsigned char FAR *from; /* where to copy match from */ |
| 96 | |
| 97 | /* copy state to local variables */ |
| 98 | state = (struct inflate_state FAR *)strm->state; |
| 99 | in = strm->next_in - OFF; |
| 100 | last = in + (strm->avail_in - 5); |
| 101 | out = strm->next_out - OFF; |
| 102 | beg = out - (start - strm->avail_out); |
| 103 | end = out + (strm->avail_out - 257); |
| 104 | #ifdef INFLATE_STRICT |
| 105 | dmax = state->dmax; |
| 106 | #endif |
| 107 | wsize = state->wsize; |
| 108 | whave = state->whave; |
| 109 | write = state->write; |
| 110 | window = state->window; |
| 111 | hold = state->hold; |
| 112 | bits = state->bits; |
| 113 | lcode = state->lencode; |
| 114 | dcode = state->distcode; |
| 115 | lmask = (1U << state->lenbits) - 1; |
| 116 | dmask = (1U << state->distbits) - 1; |
| 117 | |
| 118 | /* decode literals and length/distances until end-of-block or not enough |
| 119 | input data or output space */ |
| 120 | do { |
| 121 | if (bits < 15) { |
| 122 | hold += (unsigned long)(PUP(in)) << bits; |
| 123 | bits += 8; |
| 124 | hold += (unsigned long)(PUP(in)) << bits; |
no outgoing calls
no test coverage detected