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

Function main

freebsd/contrib/zlib/test/example.c:545–602  ·  view source on GitHub ↗
(argc, argv)

Source from the content-addressed store, hash-verified

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

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