========================================================================= */
| 416 | |
| 417 | /* ========================================================================= */ |
| 418 | int ZEXPORT deflateResetKeep (z_streamp strm) |
| 419 | { |
| 420 | deflate_state *s; |
| 421 | |
| 422 | if (strm == Z_NULL || strm->state == Z_NULL || |
| 423 | strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { |
| 424 | return Z_STREAM_ERROR; |
| 425 | } |
| 426 | |
| 427 | strm->total_in = strm->total_out = 0; |
| 428 | strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ |
| 429 | strm->data_type = Z_UNKNOWN; |
| 430 | |
| 431 | s = (deflate_state *)strm->state; |
| 432 | s->pending = 0; |
| 433 | s->pending_out = s->pending_buf; |
| 434 | |
| 435 | if (s->wrap < 0) { |
| 436 | s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ |
| 437 | } |
| 438 | s->status = s->wrap ? INIT_STATE : BUSY_STATE; |
| 439 | strm->adler = |
| 440 | #ifdef GZIP |
| 441 | s->wrap == 2 ? crc32(0L, Z_NULL, 0) : |
| 442 | #endif |
| 443 | adler32(0L, Z_NULL, 0); |
| 444 | s->last_flush = Z_NO_FLUSH; |
| 445 | |
| 446 | _tr_init(s); |
| 447 | |
| 448 | return Z_OK; |
| 449 | } |
| 450 | |
| 451 | /* ========================================================================= */ |
| 452 | int ZEXPORT deflateReset (z_streamp strm) |
no test coverage detected