-- see zlib.h -- */
(file, level, strategy)
| 586 | |
| 587 | /* -- see zlib.h -- */ |
| 588 | int ZEXPORT gzsetparams(file, level, strategy) |
| 589 | gzFile file; |
| 590 | int level; |
| 591 | int strategy; |
| 592 | { |
| 593 | gz_statep state; |
| 594 | z_streamp strm; |
| 595 | |
| 596 | /* get internal structure */ |
| 597 | if (file == NULL) |
| 598 | return Z_STREAM_ERROR; |
| 599 | state = (gz_statep)file; |
| 600 | strm = &(state->strm); |
| 601 | |
| 602 | /* check that we're writing and that there's no error */ |
| 603 | if (state->mode != GZ_WRITE || state->err != Z_OK) |
| 604 | return Z_STREAM_ERROR; |
| 605 | |
| 606 | /* if no change is requested, then do nothing */ |
| 607 | if (level == state->level && strategy == state->strategy) |
| 608 | return Z_OK; |
| 609 | |
| 610 | /* check for seek request */ |
| 611 | if (state->seek) { |
| 612 | state->seek = 0; |
| 613 | if (gz_zero(state, state->skip) == -1) |
| 614 | return state->err; |
| 615 | } |
| 616 | |
| 617 | /* change compression parameters for subsequent input */ |
| 618 | if (state->size) { |
| 619 | /* flush previous input with previous parameters before changing */ |
| 620 | if (strm->avail_in && gz_comp(state, Z_BLOCK) == -1) |
| 621 | return state->err; |
| 622 | deflateParams(strm, level, strategy); |
| 623 | } |
| 624 | state->level = level; |
| 625 | state->strategy = strategy; |
| 626 | return Z_OK; |
| 627 | } |
| 628 | |
| 629 | /* -- see zlib.h -- */ |
| 630 | int ZEXPORT gzclose_w(file) |
nothing calls this directly
no test coverage detected