example.c File Reference

#include <stdio.h>
#include "zlib.h"

Include dependency graph for example.c:

Go to the source code of this file.

Defines

#define TESTFILE   "foo.gz"
#define CHECK_ERR(err, msg)

Functions

void test_compress OF ((Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen))
void test_gzio OF ((const char *fname, Byte *uncompr, uLong uncomprLen))
void test_deflate OF ((Byte *compr, uLong comprLen))
void test_flush OF ((Byte *compr, uLong *comprLen))
int main OF ((int argc, char *argv[]))
void test_compress (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
void test_gzio (char *fname, Byte *uncompr, uLong uncomprLen) const
void test_deflate (Byte *compr, uLong comprLen)
void test_inflate (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
void test_large_deflate (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
void test_large_inflate (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
void test_flush (Byte *compr, uLong *comprLen)
void test_sync (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
void test_dict_deflate (Byte *compr, uLong comprLen)
void test_dict_inflate (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
int main (int argc, argv)

Variables

const char hello [] = "hello, hello!"
const char dictionary [] = "hello"
uLong dictId


Define Documentation

#define CHECK_ERR err,
msg   ) 
 

Value:

{ \
    if (err != Z_OK) { \
        fprintf(stderr, "%s error: %d\n", msg, err); \
        exit(1); \
    } \
}

Definition at line 22 of file example.c.

Referenced by test_compress(), test_deflate(), test_dict_deflate(), test_dict_inflate(), test_flush(), test_inflate(), test_large_deflate(), test_large_inflate(), and test_sync().

#define TESTFILE   "foo.gz"
 

Definition at line 19 of file example.c.

Referenced by main().


Function Documentation

int main int  argc,
argv 
 

Definition at line 514 of file example.c.

References calloc(), exit(), fprintf(), free, int(), printf, stderr, strcmp, test_compress(), test_deflate(), test_dict_deflate(), test_dict_inflate(), test_flush(), test_gzio(), test_inflate(), test_large_deflate(), test_large_inflate(), test_sync(), TESTFILE, Z_NULL, ZLIB_VERNUM, ZLIB_VERSION, zlibCompileFlags(), and zlibVersion().

int main OF (int argc, char *argv[])   ) 
 

void test_flush OF (Byte *compr, uLong *comprLen)   ) 
 

void test_deflate OF (Byte *compr, uLong comprLen)   ) 
 

void test_gzio OF (const char *fname, Byte *uncompr, uLong uncomprLen)   ) 
 

void test_compress OF (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)   ) 
 

void test_compress Byte compr,
uLong  comprLen,
Byte uncompr,
uLong  uncomprLen
 

Definition at line 59 of file example.c.

References CHECK_ERR, compress, err, exit(), fprintf(), hello, printf, stderr, strcmp, strcpy(), strlen(), and uncompress().

Referenced by main().

void test_deflate Byte compr,
uLong  comprLen
 

Definition at line 169 of file example.c.

References z_stream_s::avail_in, z_stream_s::avail_out, CHECK_ERR, deflate(), deflateInit, err, hello, z_stream_s::next_in, z_stream_s::next_out, z_stream_s::opaque, strlen(), z_stream_s::total_in, z_stream_s::total_out, Z_DEFAULT_COMPRESSION, Z_FINISH, Z_NO_FLUSH, Z_STREAM_END, z_stream_s::zalloc, and z_stream_s::zfree.

Referenced by main().

void test_dict_deflate Byte compr,
uLong  comprLen
 

Definition at line 426 of file example.c.

References z_stream_s::adler, z_stream_s::avail_in, z_stream_s::avail_out, CHECK_ERR, deflate(), deflateEnd(), deflateInit, deflateSetDictionary(), dictId, dictionary, err, exit(), fprintf(), hello, z_stream_s::next_in, z_stream_s::next_out, z_stream_s::opaque, stderr, strlen(), Z_BEST_COMPRESSION, Z_FINISH, Z_STREAM_END, z_stream_s::zalloc, and z_stream_s::zfree.

Referenced by main().

void test_dict_inflate Byte compr,
uLong  comprLen,
Byte uncompr,
uLong  uncomprLen
 

Definition at line 463 of file example.c.

References z_stream_s::adler, z_stream_s::avail_in, z_stream_s::avail_out, CHECK_ERR, dictId, err, exit(), fprintf(), inflate(), inflateInit, z_stream_s::next_in, z_stream_s::next_out, z_stream_s::opaque, stderr, strcpy(), Z_NEED_DICT, Z_NO_FLUSH, Z_STREAM_END, z_stream_s::zalloc, and z_stream_s::zfree.

Referenced by main().

void test_flush Byte compr,
uLong *  comprLen
 

Definition at line 344 of file example.c.

References z_stream_s::avail_in, z_stream_s::avail_out, CHECK_ERR, deflate(), deflateEnd(), deflateInit, err, hello, z_stream_s::next_in, z_stream_s::next_out, z_stream_s::opaque, strlen(), z_stream_s::total_out, Z_DEFAULT_COMPRESSION, Z_FINISH, Z_FULL_FLUSH, Z_STREAM_END, z_stream_s::zalloc, and z_stream_s::zfree.

Referenced by main().

void test_gzio char *  fname,
Byte uncompr,
uLong  uncomprLen
const
 

Definition at line 85 of file example.c.

References err, exit(), fprintf(), gzclose(), gzerror(), gzgetc(), gzgets(), gzopen(), gzprintf(), gzputc(), gzputs(), gzread(), gzseek(), gztell(), gzungetc(), hello, int(), L, NULL, pos, printf, SEEK_CUR, stderr, strcmp, strcpy(), strlen(), and z_off_t.

Referenced by main().

void test_inflate Byte compr,
uLong  comprLen,
Byte uncompr,
uLong  uncomprLen
 

Definition at line 207 of file example.c.

References z_stream_s::avail_in, z_stream_s::avail_out, CHECK_ERR, err, exit(), fprintf(), hello, inflate(), inflateEnd(), inflateInit, z_stream_s::next_in, z_stream_s::next_out, z_stream_s::opaque, printf, stderr, strcmp, strcpy(), z_stream_s::total_in, z_stream_s::total_out, Z_NO_FLUSH, Z_STREAM_END, z_stream_s::zalloc, and z_stream_s::zfree.

Referenced by main().

void test_large_deflate Byte compr,
uLong  comprLen,
Byte uncompr,
uLong  uncomprLen
 

Definition at line 248 of file example.c.

References z_stream_s::avail_in, z_stream_s::avail_out, CHECK_ERR, deflate(), deflateEnd(), deflateInit, deflateParams(), err, exit(), fprintf(), z_stream_s::next_in, z_stream_s::next_out, z_stream_s::opaque, stderr, Z_BEST_COMPRESSION, Z_BEST_SPEED, Z_DEFAULT_STRATEGY, Z_FILTERED, Z_FINISH, Z_NO_COMPRESSION, Z_NO_FLUSH, Z_STREAM_END, z_stream_s::zalloc, and z_stream_s::zfree.

Referenced by main().

void test_large_inflate Byte compr,
uLong  comprLen,
Byte uncompr,
uLong  uncomprLen
 

Definition at line 303 of file example.c.

References z_stream_s::avail_in, z_stream_s::avail_out, CHECK_ERR, err, inflate(), inflateInit, z_stream_s::next_in, z_stream_s::next_out, z_stream_s::opaque, strcpy(), Z_NO_FLUSH, Z_STREAM_END, z_stream_s::zalloc, and z_stream_s::zfree.

Referenced by main().

void test_sync Byte compr,
uLong  comprLen,
Byte uncompr,
uLong  uncomprLen
 

Definition at line 382 of file example.c.

References z_stream_s::avail_in, z_stream_s::avail_out, CHECK_ERR, err, exit(), fprintf(), inflate(), inflateEnd(), inflateInit, inflateSync(), z_stream_s::next_in, z_stream_s::next_out, z_stream_s::opaque, printf, stderr, strcpy(), Z_DATA_ERROR, Z_FINISH, Z_NO_FLUSH, z_stream_s::zalloc, and z_stream_s::zfree.

Referenced by main().


Variable Documentation

uLong dictId
 

Definition at line 35 of file example.c.

Referenced by test_dict_deflate(), and test_dict_inflate().

const char dictionary[] = "hello"
 

Definition at line 34 of file example.c.

Referenced by test_dict_deflate().

const char hello[] = "hello, hello!"
 

Definition at line 29 of file example.c.

Referenced by test_compress(), test_deflate(), test_dict_deflate(), test_flush(), test_gzio(), and test_inflate().


Generated on Fri Apr 14 23:20:40 2006 for minix by  doxygen 1.4.6