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

Function gzclose_r

extern/zlib/src/gzread.c:577–602  ·  view source on GitHub ↗

-- see zlib.h -- */

Source from the content-addressed store, hash-verified

575
576/* -- see zlib.h -- */
577int ZEXPORT gzclose_r(gzFile file) {
578 int ret, err;
579 gz_statep state;
580
581 /* get internal structure */
582 if (file == NULL)
583 return Z_STREAM_ERROR;
584 state = (gz_statep)file;
585
586 /* check that we're reading */
587 if (state->mode != GZ_READ)
588 return Z_STREAM_ERROR;
589
590 /* free memory and close file */
591 if (state->size) {
592 inflateEnd(&(state->strm));
593 free(state->out);
594 free(state->in);
595 }
596 err = state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK;
597 gz_error(state, Z_OK, NULL);
598 free(state->path);
599 ret = close(state->fd);
600 free(state);
601 return ret ? Z_ERRNO : err;
602}

Callers 1

gzcloseFunction · 0.85

Calls 1

gz_errorFunction · 0.85

Tested by

no test coverage detected