Go to the documentation of this file.
16 #if defined(VMS) || defined(RISCOS)
17 # define TESTFILE "foo-gz"
19 # define TESTFILE "foo.gz"
22 #define CHECK_ERR(err, msg) { \
24 fprintf(stderr, "%s error: %d\n", msg, err); \
50 int main OF((
int argc,
char *argv[]));
55 void *myalloc
OF((
void *,
unsigned,
unsigned));
56 void myfree
OF((
void *,
void *));
58 void *myalloc(q,
n,
m)
66 void myfree(
void *q,
void *
p)
72 static alloc_func
zalloc = myalloc;
73 static free_func
zfree = myfree;
77 static alloc_func
zalloc = (alloc_func)0;
78 static free_func
zfree = (free_func)0;
89 Byte *compr, *uncompr;
90 uLong comprLen, uncomprLen;
98 strcpy((
char*)uncompr,
"garbage");
103 if (strcmp((
char*)uncompr,
hello)) {
104 fprintf(
stderr,
"bad uncompress\n");
107 printf(
"uncompress(): %s\n", (
char *)uncompr);
120 fprintf(
stderr,
"NO_GZCOMPRESS -- gz* functions cannot compress\n");
129 fprintf(
stderr,
"gzopen error\n");
146 fprintf(
stderr,
"gzopen error\n");
149 strcpy((
char*)uncompr,
"garbage");
155 if (strcmp((
char*)uncompr,
hello)) {
156 fprintf(
stderr,
"bad gzread: %s\n", (
char*)uncompr);
159 printf(
"gzread(): %s\n", (
char*)uncompr);
164 fprintf(
stderr,
"gzseek error, pos=%ld, gztell=%ld\n",
170 fprintf(
stderr,
"gzgetc error\n");
175 fprintf(
stderr,
"gzungetc error\n");
179 gzgets(
file, (
char*)uncompr, (
int)uncomprLen);
180 if (strlen((
char*)uncompr) != 7) {
184 if (strcmp((
char*)uncompr,
hello + 6)) {
185 fprintf(
stderr,
"bad gzgets after gzseek\n");
188 printf(
"gzgets() after gzseek: %s\n", (
char*)uncompr);
239 Byte *compr, *uncompr;
240 uLong comprLen, uncomprLen;
245 strcpy((
char*)uncompr,
"garbage");
268 if (strcmp((
char*)uncompr,
hello)) {
269 fprintf(
stderr,
"bad inflate\n");
272 printf(
"inflate(): %s\n", (
char *)uncompr);
280 Byte *compr, *uncompr;
281 uLong comprLen, uncomprLen;
304 fprintf(
stderr,
"deflate not greedy\n");
324 fprintf(
stderr,
"deflate should report Z_STREAM_END\n");
335 Byte *compr, *uncompr;
336 uLong comprLen, uncomprLen;
341 strcpy((
char*)uncompr,
"garbage");
364 if (d_stream.
total_out != 2*uncomprLen + comprLen/2) {
368 printf(
"large_inflate(): OK\n");
414 Byte *compr, *uncompr;
415 uLong comprLen, uncomprLen;
420 strcpy((
char*)uncompr,
"garbage");
444 fprintf(
stderr,
"inflate should report Z_STREAM_END\n");
450 printf(
"after inflateSync(): hel%s\n", (
char *)uncompr);
483 fprintf(
stderr,
"deflate should report Z_STREAM_END\n");
494 Byte *compr, *uncompr;
495 uLong comprLen, uncomprLen;
500 strcpy((
char*)uncompr,
"garbage");
520 fprintf(
stderr,
"unexpected dictionary");
532 if (strcmp((
char*)uncompr,
hello)) {
533 fprintf(
stderr,
"bad inflate with dict\n");
536 printf(
"inflate with dictionary: %s\n", (
char *)uncompr);
548 Byte *compr, *uncompr;
550 uLong uncomprLen = comprLen;
554 fprintf(
stderr,
"incompatible zlib version\n");
558 fprintf(
stderr,
"warning: different zlib version linked: %s\n",
562 printf(
"zlib version %s = 0x%04x, compile flags = 0x%lx\n",
565 compr = (
Byte*)calloc((
uInt)comprLen, 1);
566 uncompr = (
Byte*)calloc((
uInt)uncomprLen, 1);
571 printf(
"out of memory\n");
582 uncompr, uncomprLen);
592 test_sync(compr, comprLen, uncompr, uncomprLen);
593 comprLen = uncomprLen;
int ZEXPORT gzputc(gzFile file, int c)
int ZEXPORT inflateEnd(z_streamp strm)
#define Z_DEFAULT_COMPRESSION
void test_sync(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
int ZEXPORT inflateSync(z_streamp strm)
int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
int ZEXPORT inflate(z_streamp strm, int flush)
void test_flush(Byte *compr, uLong *comprLen)
const grpc_generator::File * file
uLong ZEXPORT zlibCompileFlags()
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
int ZEXPORTVA gzprintf(gzFile file, const char *format, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12, int a13, int a14, int a15, int a16, int a17, int a18, int a19, int a20)
const char *ZEXPORT gzerror(gzFile file, int *errnum)
_Use_decl_annotations_ int __cdecl printf(const char *_Format,...)
int ZEXPORT deflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength)
int ZEXPORT gzungetc(int c, gzFile file)
z_off_t ZEXPORT gztell(gzFile file)
void test_deflate(Byte *compr, uLong comprLen)
z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence)
char *ZEXPORT gzgets(gzFile file, char *buf, int len)
const char *ZEXPORT zlibVersion()
void test_deflate OF((Byte *compr, uLong comprLen))
#define CHECK_ERR(err, msg)
int ZEXPORT deflateParams(z_streamp strm, int level, int strategy)
int ZEXPORT deflateEnd(z_streamp strm)
void test_dict_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
#define deflateInit(strm, level)
static const char dictionary[]
#define Z_BEST_COMPRESSION
static z_const char hello[]
void test_gzio(char *fname, Byte *uncompr, uLong uncomprLen) const
int ZEXPORT gzputs(gzFile file, const char *str)
void test_large_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
int ZEXPORT deflate(z_streamp strm, int flush)
void test_compress(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
int ZEXPORT inflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength)
gzFile ZEXPORT gzopen(char *path, const char *mode) const
void test_dict_deflate(Byte *compr, uLong comprLen)
void test_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
int ZEXPORT gzclose(gzFile file)
void test_large_deflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
int ZEXPORT gzread(gzFile file, voidp buf, unsigned len)
#define inflateInit(strm)
#define Z_DEFAULT_STRATEGY
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:20