strm provides the memory allocation functions and window buffer on input, and provides information on the unused input on return. For Z_DATA_ERROR returns, strm will also provide an error message. in() and out() are the call-back input and output functions. When inflateBack() needs more input, it calls in(). When inflateBack() has filled the window with output, or when it comple
(strm, in, in_desc, out, out_desc)
| 248 | are not correct, i.e. strm is Z_NULL or the state was not initialized. |
| 249 | */ |
| 250 | int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) |
| 251 | z_streamp strm; |
| 252 | in_func in; |
| 253 | void FAR *in_desc; |
| 254 | out_func out; |
| 255 | void FAR *out_desc; |
| 256 | { |
| 257 | struct inflate_state FAR *state; |
| 258 | z_const unsigned char FAR *next; /* next input */ |
| 259 | unsigned char FAR *put; /* next output */ |
| 260 | unsigned have, left; /* available input and output */ |
| 261 | unsigned long hold; /* bit buffer */ |
| 262 | unsigned bits; /* bits in bit buffer */ |
| 263 | unsigned copy; /* number of stored or match bytes to copy */ |
| 264 | unsigned char FAR *from; /* where to copy match bytes from */ |
| 265 | code here; /* current decoding table entry */ |
| 266 | code last; /* parent table entry */ |
| 267 | unsigned len; /* length to copy for repeats, bits to drop */ |
| 268 | int ret; /* return code */ |
| 269 | static const unsigned short order[19] = /* permutation of code lengths */ |
| 270 | {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; |
| 271 | |
| 272 | /* Check that the strm exists and that the state was initialized */ |
| 273 | if (strm == Z_NULL || strm->state == Z_NULL) |
| 274 | return Z_STREAM_ERROR; |
| 275 | state = (struct inflate_state FAR *)strm->state; |
| 276 | |
| 277 | /* Reset the state */ |
| 278 | strm->msg = Z_NULL; |
| 279 | state->mode = TYPE; |
| 280 | state->last = 0; |
| 281 | state->whave = 0; |
| 282 | next = strm->next_in; |
| 283 | have = next != Z_NULL ? strm->avail_in : 0; |
| 284 | hold = 0; |
| 285 | bits = 0; |
| 286 | put = state->window; |
| 287 | left = state->wsize; |
| 288 | |
| 289 | /* Inflate until end of block marked as last */ |
| 290 | for (;;) |
| 291 | switch (state->mode) { |
| 292 | case TYPE: |
| 293 | /* determine and dispatch block type */ |
| 294 | if (state->last) { |
| 295 | BYTEBITS(); |
| 296 | state->mode = DONE; |
| 297 | break; |
| 298 | } |
| 299 | NEEDBITS(3); |
| 300 | state->last = BITS(1); |
| 301 | DROPBITS(1); |
| 302 | switch (BITS(2)) { |
| 303 | case 0: /* stored block */ |
| 304 | Tracev((stderr, "inflate: stored block%s\n", |
| 305 | state->last ? " (last)" : "")); |
| 306 | state->mode = STORED; |
| 307 | break; |
nothing calls this directly
no test coverage detected