| 174 | } |
| 175 | |
| 176 | int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, const char *version, int stream_size) |
| 177 | { |
| 178 | int ret; |
| 179 | struct inflate_state FAR *state; |
| 180 | |
| 181 | if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || |
| 182 | stream_size != (int)(sizeof(z_stream))) |
| 183 | return Z_VERSION_ERROR; |
| 184 | if (strm == Z_NULL) return Z_STREAM_ERROR; |
| 185 | strm->msg = Z_NULL; /* in case we return an error */ |
| 186 | if (strm->zalloc == (alloc_func)0) { |
| 187 | #ifdef Z_SOLO |
| 188 | return Z_STREAM_ERROR; |
| 189 | #else |
| 190 | strm->zalloc = zcalloc; |
| 191 | strm->opaque = (voidpf)0; |
| 192 | #endif |
| 193 | } |
| 194 | if (strm->zfree == (free_func)0) |
| 195 | #ifdef Z_SOLO |
| 196 | return Z_STREAM_ERROR; |
| 197 | #else |
| 198 | strm->zfree = zcfree; |
| 199 | #endif |
| 200 | state = (struct inflate_state FAR *) |
| 201 | ZALLOC(strm, 1, sizeof(struct inflate_state)); |
| 202 | if (state == Z_NULL) return Z_MEM_ERROR; |
| 203 | Tracev((stderr, "inflate: allocated\n")); |
| 204 | strm->state = (struct internal_state FAR *)state; |
| 205 | state->window = Z_NULL; |
| 206 | ret = inflateReset2(strm, windowBits); |
| 207 | if (ret != Z_OK) { |
| 208 | ZFREE(strm, state); |
| 209 | strm->state = Z_NULL; |
| 210 | } |
| 211 | return ret; |
| 212 | } |
| 213 | |
| 214 | int ZEXPORT inflateInit_(z_streamp strm, const char *version, int stream_size) |
| 215 | { |
no test coverage detected