-- see zlib.h -- */
(file, flush)
| 557 | |
| 558 | /* -- see zlib.h -- */ |
| 559 | int ZEXPORT gzflush(file, flush) |
| 560 | gzFile file; |
| 561 | int flush; |
| 562 | { |
| 563 | gz_statep state; |
| 564 | |
| 565 | /* get internal structure */ |
| 566 | if (file == NULL) |
| 567 | return Z_STREAM_ERROR; |
| 568 | state.file = file; |
| 569 | |
| 570 | /* check that we're writing and that there's no error */ |
| 571 | if (state.state->mode != GZ_WRITE || state.state->err != Z_OK) |
| 572 | return Z_STREAM_ERROR; |
| 573 | |
| 574 | /* check flush parameter */ |
| 575 | if (flush < 0 || flush > Z_FINISH) |
| 576 | return Z_STREAM_ERROR; |
| 577 | |
| 578 | /* check for seek request */ |
| 579 | if (state.state->seek) { |
| 580 | state.state->seek = 0; |
| 581 | if (gz_zero(state, state.state->skip) == -1) |
| 582 | return state.state->err; |
| 583 | } |
| 584 | |
| 585 | /* compress remaining data with requested flush */ |
| 586 | (void)gz_comp(state, flush); |
| 587 | return state.state->err; |
| 588 | } |
| 589 | |
| 590 | /* -- see zlib.h -- */ |
| 591 | int ZEXPORT gzsetparams(file, level, strategy) |