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