MCPcopy Create free account
hub / github.com/F-Stack/f-stack / gzgetc

Function gzgetc

freebsd/contrib/zstd/zlibWrapper/gzread.c:471–498  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

469#endif
470
471int ZEXPORT gzgetc(file)
472 gzFile file;
473{
474 int ret;
475 unsigned char buf[1];
476 gz_statep state;
477
478 /* get internal structure */
479 if (file == NULL)
480 return -1;
481 state.file = file;
482
483 /* check that we're reading and that there's no (serious) error */
484 if (state.state->mode != GZ_READ ||
485 (state.state->err != Z_OK && state.state->err != Z_BUF_ERROR))
486 return -1;
487
488 /* try output buffer (no need to check for skip request) */
489 if (state.state->x.have) {
490 state.state->x.have--;
491 state.state->x.pos++;
492 return *(state.state->x.next)++;
493 }
494
495 /* nothing there -- try gz_read() */
496 ret = (int)gz_read(state, buf, 1);
497 return ret < 1 ? -1 : buf[0];
498}
499
500int ZEXPORT gzgetc_(file)
501gzFile file;

Callers 3

gzgetc_Function · 0.70
test_gzioFunction · 0.50
test_gzioFunction · 0.50

Calls 1

gz_readFunction · 0.70

Tested by 2

test_gzioFunction · 0.40
test_gzioFunction · 0.40