/* example.c -- usage example of the zlib compression library
* Copyright (C) 1995-2004 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#include <stdio.h>
#include "zlib.h"
#ifdef ZLIB_STDC
# include <string.h>
# include <stdlib.h>
#endif
#else
#endif
exit(1); \
} \
}
/* "hello world" would be more standard, but the repeated "hello"
* stresses the compression code better, sorry...
*/
/* ===========================================================================
* Test compress() and uncompress()
*/
{
int err;
exit(1);
} else {
}
}
/* ===========================================================================
*/
const char *fname; /* compressed file name */
{
#ifdef NO_GZCOMPRESS
#else
int err;
exit(1);
}
exit(1);
}
exit(1);
}
exit(1);
}
exit(1);
}
exit(1);
} else {
}
exit(1);
}
exit(1);
}
exit(1);
}
exit(1);
}
exit(1);
} else {
}
#endif
}
/* ===========================================================================
* Test deflate() with small buffers
*/
{
int err;
}
/* Finish the stream, still forcing small buffers: */
for (;;) {
if (err == Z_STREAM_END) break;
}
}
/* ===========================================================================
* Test inflate() with small buffers
*/
{
int err;
if (err == Z_STREAM_END) break;
}
exit(1);
} else {
}
}
/* ===========================================================================
* Test deflate() with large buffers and dynamic change of compression level
*/
{
int err;
/* At this point, uncompr is still mostly zeroes, so it should compress
* very well:
*/
exit(1);
}
/* Feed in already compressed data and switch to no compression: */
/* Switch back to compressing mode: */
if (err != Z_STREAM_END) {
exit(1);
}
}
/* ===========================================================================
* Test inflate() with large buffers
*/
{
int err;
for (;;) {
if (err == Z_STREAM_END) break;
}
exit(1);
} else {
printf("large_inflate(): OK\n");
}
}
/* ===========================================================================
* Test deflate() with full flush
*/
{
int err;
if (err != Z_STREAM_END) {
}
}
/* ===========================================================================
* Test inflateSync()
*/
{
int err;
if (err != Z_DATA_ERROR) {
/* Because of incorrect adler32 */
exit(1);
}
}
/* ===========================================================================
* Test deflate() with preset dictionary
*/
{
int err;
if (err != Z_STREAM_END) {
exit(1);
}
}
/* ===========================================================================
* Test inflate() with a preset dictionary
*/
{
int err;
for (;;) {
if (err == Z_STREAM_END) break;
if (err == Z_NEED_DICT) {
exit(1);
}
sizeof(dictionary));
}
}
exit(1);
} else {
}
}
/* ===========================================================================
* Usage: example [output.gz [input.gz]]
*/
int argc;
char *argv[];
{
if (zlibVersion()[0] != myVersion[0]) {
exit(1);
}
printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n",
/* compr and uncompr are cleared to avoid reading uninitialized
* data and to ensure that uncompr compresses well.
*/
printf("out of memory\n");
exit(1);
}
return 0;
}