MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / gzsetparams

Function gzsetparams

extern/zlib/src/gzwrite.c:557–592  ·  view source on GitHub ↗

-- see zlib.h -- */

Source from the content-addressed store, hash-verified

555
556/* -- see zlib.h -- */
557int ZEXPORT gzsetparams(gzFile file, int level, int strategy) {
558 gz_statep state;
559 z_streamp strm;
560
561 /* get internal structure */
562 if (file == NULL)
563 return Z_STREAM_ERROR;
564 state = (gz_statep)file;
565 strm = &(state->strm);
566
567 /* check that we're writing and that there's no error */
568 if (state->mode != GZ_WRITE || state->err != Z_OK || state->direct)
569 return Z_STREAM_ERROR;
570
571 /* if no change is requested, then do nothing */
572 if (level == state->level && strategy == state->strategy)
573 return Z_OK;
574
575 /* check for seek request */
576 if (state->seek) {
577 state->seek = 0;
578 if (gz_zero(state, state->skip) == -1)
579 return state->err;
580 }
581
582 /* change compression parameters for subsequent input */
583 if (state->size) {
584 /* flush previous input with previous parameters before changing */
585 if (strm->avail_in && gz_comp(state, Z_BLOCK) == -1)
586 return state->err;
587 deflateParams(strm, level, strategy);
588 }
589 state->level = level;
590 state->strategy = strategy;
591 return Z_OK;
592}
593
594/* -- see zlib.h -- */
595int ZEXPORT gzclose_w(gzFile 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