MCPcopy Create free account
hub / github.com/MariaDB/server / gzsetparams

Function gzsetparams

zlib/gzwrite.c:630–664  ·  view source on GitHub ↗

-- see zlib.h -- */

Source from the content-addressed store, hash-verified

628
629/* -- see zlib.h -- */
630int ZEXPORT gzsetparams(gzFile file, int level, int strategy) {
631 gz_statep state;
632 z_streamp strm;
633
634 /* get internal structure */
635 if (file == NULL)
636 return Z_STREAM_ERROR;
637 state = (gz_statep)file;
638 strm = &(state->strm);
639
640 /* check that we're compressing and that there's no (serious) error */
641 if (state->mode != GZ_WRITE || (state->err != Z_OK && !state->again) ||
642 state->direct)
643 return Z_STREAM_ERROR;
644 gz_error(state, Z_OK, NULL);
645
646 /* if no change is requested, then do nothing */
647 if (level == state->level && strategy == state->strategy)
648 return Z_OK;
649
650 /* check for seek request */
651 if (state->skip && gz_zero(state) == -1)
652 return state->err;
653
654 /* change compression parameters for subsequent input */
655 if (state->size) {
656 /* flush previous input with previous parameters before changing */
657 if (strm->avail_in && gz_comp(state, Z_BLOCK) == -1)
658 return state->err;
659 deflateParams(strm, level, strategy);
660 }
661 state->level = level;
662 state->strategy = strategy;
663 return Z_OK;
664}
665
666/* -- see zlib.h -- */
667int ZEXPORT gzclose_w(gzFile file) {

Callers

nothing calls this directly

Calls 4

gz_errorFunction · 0.85
gz_zeroFunction · 0.85
gz_compFunction · 0.85
deflateParamsFunction · 0.85

Tested by

no test coverage detected