MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / inflateReset2

Function inflateReset2

extern/zlib/src/inflate.c:141–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
142 int wrap;
143 struct inflate_state FAR *state;
144
145 /* get the state */
146 if (inflateStateCheck(strm)) 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 if (windowBits < -15)
152 return Z_STREAM_ERROR;
153 wrap = 0;
154 windowBits = -windowBits;
155 }
156 else {
157 wrap = (windowBits >> 4) + 5;
158#ifdef GUNZIP
159 if (windowBits < 48)
160 windowBits &= 15;
161#endif
162 }
163
164 /* set number of window bits, free window if different */
165 if (windowBits && (windowBits < 8 || windowBits > 15))
166 return Z_STREAM_ERROR;
167 if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
168 ZFREE(strm, state->window);
169 state->window = Z_NULL;
170 }
171
172 /* update state and reset the rest of it */
173 state->wrap = wrap;
174 state->wbits = (unsigned)windowBits;
175 return inflateReset(strm);
176}
177
178int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
179 const char *version, int stream_size) {

Callers 1

inflateInit2_Function · 0.85

Calls 2

inflateStateCheckFunction · 0.85
inflateResetFunction · 0.85

Tested by

no test coverage detected