MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / inflateInit2_

Function inflateInit2_

zlib/inflate.c:144–185  ·  view source on GitHub ↗
(strm, windowBits, version, stream_size)

Source from the content-addressed store, hash-verified

142}
143
144int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
145z_streamp strm;
146int windowBits;
147const char *version;
148int stream_size;
149{
150 struct inflate_state FAR *state;
151
152 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
153 stream_size != (int)(sizeof(z_stream)))
154 return Z_VERSION_ERROR;
155 if (strm == Z_NULL) return Z_STREAM_ERROR;
156 strm->msg = Z_NULL; /* in case we return an error */
157 if (strm->zalloc == (alloc_func)0) {
158 strm->zalloc = zcalloc;
159 strm->opaque = (voidpf)0;
160 }
161 if (strm->zfree == (free_func)0) strm->zfree = zcfree;
162 state = (struct inflate_state FAR *)
163 ZALLOC(strm, 1, sizeof(struct inflate_state));
164 if (state == Z_NULL) return Z_MEM_ERROR;
165 Tracev((stderr, "inflate: allocated\n"));
166 strm->state = (struct internal_state FAR *)state;
167 if (windowBits < 0) {
168 state->wrap = 0;
169 windowBits = -windowBits;
170 }
171 else {
172 state->wrap = (windowBits >> 4) + 1;
173#ifdef GUNZIP
174 if (windowBits < 48) windowBits &= 15;
175#endif
176 }
177 if (windowBits < 8 || windowBits > 15) {
178 ZFREE(strm, state);
179 strm->state = Z_NULL;
180 return Z_STREAM_ERROR;
181 }
182 state->wbits = (unsigned)windowBits;
183 state->window = Z_NULL;
184 return inflateReset(strm);
185}
186
187int ZEXPORT inflateInit_(strm, version, stream_size)
188z_streamp strm;

Callers 1

inflateInit_Function · 0.85

Calls 1

inflateResetFunction · 0.85

Tested by

no test coverage detected