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

Function main

freebsd/contrib/zstd/zlibWrapper/examples/example_original.c:562–618  ·  view source on GitHub ↗
(argc, argv)

Source from the content-addressed store, hash-verified

560 */
561
562int main(argc, argv)
563 int argc;
564 char *argv[];
565{
566 Byte *compr, *uncompr;
567 uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
568 uLong uncomprLen = comprLen;
569 static const char* myVersion = ZLIB_VERSION;
570
571 if (zlibVersion()[0] != myVersion[0]) {
572 fprintf(stderr, "incompatible zlib version\n");
573 exit(1);
574
575 } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) {
576 fprintf(stderr, "warning: different zlib version\n");
577 }
578
579 printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n",
580 ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags());
581
582 compr = (Byte*)calloc((uInt)comprLen, 1);
583 uncompr = (Byte*)calloc((uInt)uncomprLen, 1);
584 /* compr and uncompr are cleared to avoid reading uninitialized
585 * data and to ensure that uncompr compresses well.
586 */
587 if (compr == Z_NULL || uncompr == Z_NULL) {
588 printf("out of memory\n");
589 exit(1);
590 }
591
592#ifdef Z_SOLO
593 argc = strlen(argv[0]);
594#else
595 test_compress(compr, comprLen, uncompr, uncomprLen);
596
597 test_gzio((argc > 1 ? argv[1] : TESTFILE),
598 uncompr, uncomprLen);
599#endif
600
601 test_deflate(compr, comprLen);
602 test_inflate(compr, comprLen, uncompr, uncomprLen);
603
604 test_large_deflate(compr, comprLen, uncompr, uncomprLen);
605 test_large_inflate(compr, comprLen, uncompr, uncomprLen);
606
607 test_flush(compr, &comprLen);
608 test_sync(compr, comprLen, uncompr, uncomprLen);
609 comprLen = uncomprLen;
610
611 test_dict_deflate(compr, comprLen);
612 test_dict_inflate(compr, comprLen, uncompr, uncomprLen);
613
614 free(compr);
615 free(uncompr);
616
617 return 0;
618}

Callers

nothing calls this directly

Calls 15

zlibVersionFunction · 0.85
strcmpFunction · 0.85
zlibCompileFlagsFunction · 0.85
callocFunction · 0.85
test_compressFunction · 0.70
test_gzioFunction · 0.70
test_deflateFunction · 0.70
test_inflateFunction · 0.70
test_large_deflateFunction · 0.70
test_large_inflateFunction · 0.70
test_flushFunction · 0.70
test_syncFunction · 0.70

Tested by

no test coverage detected