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

Function gzgetc

freebsd/contrib/zlib/gzread.c:450–477  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

448# undef gzgetc
449#endif
450int ZEXPORT gzgetc(file)
451 gzFile file;
452{
453 int ret;
454 unsigned char buf[1];
455 gz_statep state;
456
457 /* get internal structure */
458 if (file == NULL)
459 return -1;
460 state = (gz_statep)file;
461
462 /* check that we're reading and that there's no (serious) error */
463 if (state->mode != GZ_READ ||
464 (state->err != Z_OK && state->err != Z_BUF_ERROR))
465 return -1;
466
467 /* try output buffer (no need to check for skip request) */
468 if (state->x.have) {
469 state->x.have--;
470 state->x.pos++;
471 return *(state->x.next)++;
472 }
473
474 /* nothing there -- try gz_read() */
475 ret = gz_read(state, buf, 1);
476 return ret < 1 ? -1 : buf[0];
477}
478
479int ZEXPORT gzgetc_(file)
480gzFile file;

Callers 2

gzgetc_Function · 0.70
test_gzioFunction · 0.50

Calls 1

gz_readFunction · 0.70

Tested by 1

test_gzioFunction · 0.40