MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / gzsetparams

Function gzsetparams

extlibs/minizip/src/gzwrite.c:628–670  ·  view source on GitHub ↗

-- see zlib.h -- */

(file, level, strategy)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

gz_zeroFunction · 0.85
gz_compFunction · 0.85
deflateParamsFunction · 0.85

Tested by

no test coverage detected