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