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

Function gzgetc

extlibs/minizip/src/gzread.c:490–519  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

488# undef gzgetc
489#endif
490int ZEXPORT gzgetc(file)
491
492gzFile file;
493{
494 int ret;
495 unsigned char buf[1];
496 gz_statep state;
497
498 /* get internal structure */
499 if (file == NULL)
500 return -1;
501 state = (gz_statep)file;
502
503 /* check that we're reading and that there's no (serious) error */
504 if (state->mode != GZ_READ ||
505 (state->err != Z_OK && state->err != Z_BUF_ERROR))
506 return -1;
507
508 /* try output buffer (no need to check for skip request) */
509 if (state->x.have)
510 {
511 state->x.have--;
512 state->x.pos++;
513 return *(state->x.next)++;
514 }
515
516 /* nothing there -- try gz_read() */
517 ret = gz_read(state, buf, 1);
518 return ret < 1 ? -1 : buf[0];
519}
520
521int ZEXPORT gzgetc_(file)
522

Callers 1

gzgetc_Function · 0.85

Calls 1

gz_readFunction · 0.85

Tested by

no test coverage detected