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

Function gzfread

extern/zlib/src/gzread.c:377–400  ·  view source on GitHub ↗

-- see zlib.h -- */

Source from the content-addressed store, hash-verified

375
376/* -- see zlib.h -- */
377z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, gzFile file) {
378 z_size_t len;
379 gz_statep state;
380
381 /* get internal structure */
382 if (file == NULL)
383 return 0;
384 state = (gz_statep)file;
385
386 /* check that we're reading and that there's no (serious) error */
387 if (state->mode != GZ_READ ||
388 (state->err != Z_OK && state->err != Z_BUF_ERROR))
389 return 0;
390
391 /* compute bytes to read -- error on overflow */
392 len = nitems * size;
393 if (size && len / size != nitems) {
394 gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t");
395 return 0;
396 }
397
398 /* read len or fewer bytes to buf, return the number of full items read */
399 return len ? gz_read(state, buf, len) / size : 0;
400}
401
402/* -- see zlib.h -- */
403#ifdef Z_PREFIX_SET

Callers

nothing calls this directly

Calls 2

gz_errorFunction · 0.85
gz_readFunction · 0.85

Tested by

no test coverage detected