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

Function gz_uncompress

freebsd/contrib/zstd/zlibWrapper/examples/minigzip.c:435–455  ·  view source on GitHub ↗

=========================================================================== * Uncompress input to output then close both files. */

(in, out)

Source from the content-addressed store, hash-verified

433 * Uncompress input to output then close both files.
434 */
435void gz_uncompress(in, out)
436 gzFile in;
437 FILE *out;
438{
439 local char buf[BUFLEN];
440 int len;
441 int err;
442
443 for (;;) {
444 len = gzread(in, buf, sizeof(buf));
445 if (len < 0) error (gzerror(in, &err));
446 if (len == 0) break;
447
448 if ((int)fwrite(buf, 1, (unsigned)len, out) != len) {
449 error("failed fwrite");
450 }
451 }
452 if (fclose(out)) error("failed fclose");
453
454 if (gzclose(in) != Z_OK) error("failed gzclose");
455}
456
457
458/* ===========================================================================

Callers 2

file_uncompressFunction · 0.70
mainFunction · 0.70

Calls 3

gzreadFunction · 0.70
errorFunction · 0.70
gzcloseFunction · 0.70

Tested by

no test coverage detected