| 138 | } |
| 139 | |
| 140 | int ZEXPORT inflateReset2(z_streamp strm, int windowBits) |
| 141 | { |
| 142 | int wrap; |
| 143 | struct inflate_state FAR *state; |
| 144 | |
| 145 | /* get the state */ |
| 146 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; |
| 147 | state = (struct inflate_state FAR *)strm->state; |
| 148 | |
| 149 | /* extract wrap request from windowBits parameter */ |
| 150 | if (windowBits < 0) { |
| 151 | wrap = 0; |
| 152 | windowBits = -windowBits; |
| 153 | } |
| 154 | else { |
| 155 | wrap = (windowBits >> 4) + 1; |
| 156 | #ifdef GUNZIP |
| 157 | if (windowBits < 48) |
| 158 | windowBits &= 15; |
| 159 | #endif |
| 160 | } |
| 161 | |
| 162 | /* set number of window bits, free window if different */ |
| 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; |
| 168 | } |
| 169 | |
| 170 | /* update state and reset the rest of it */ |
| 171 | state->wrap = wrap; |
| 172 | state->wbits = (unsigned)windowBits; |
| 173 | return inflateReset(strm); |
| 174 | } |
| 175 | |
| 176 | int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, const char *version, int stream_size) |
| 177 | { |
no test coverage detected