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

Function gzfread

extlibs/minizip/src/gzread.c:452–482  ·  view source on GitHub ↗

-- see zlib.h -- */

(buf, size, nitems, file)

Source from the content-addressed store, hash-verified

450
451/* -- see zlib.h -- */
452z_size_t ZEXPORT gzfread(buf, size, nitems, file)
453voidp buf;
454z_size_t size;
455z_size_t nitems;
456
457gzFile file;
458{
459 z_size_t len;
460 gz_statep state;
461
462 /* get internal structure */
463 if (file == NULL)
464 return 0;
465 state = (gz_statep)file;
466
467 /* check that we're reading and that there's no (serious) error */
468 if (state->mode != GZ_READ ||
469 (state->err != Z_OK && state->err != Z_BUF_ERROR))
470 return 0;
471
472 /* compute bytes to read -- error on overflow */
473 len = nitems * size;
474 if (size && len / size != nitems)
475 {
476 gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t");
477 return 0;
478 }
479
480 /* read len or fewer bytes to buf, return the number of full items read */
481 return len ? gz_read(state, buf, len) / size : 0;
482}
483
484/* -- see zlib.h -- */
485#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