zdelta 2.1 Manual


Contents

  1. Prologue
  2. Introduction
  3. Compile Options
  4. Utility functions
  5. Basic functions
  6. Advanced functions
  7. Constants
  8. struct zd_stream_s
  9. Checksum functions
  10. Misc

Prologue

'zdelta' differential compression library version 2.1, October 2003

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications.

  1. The origin of this software must not be misrepresented ; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.
The 'zdelta' libraray was build by modifying the zlib compression library written by Jean-loup Gailly jloup@gzip.org and Mark Adler madler@alumni.caltech.edu

This manual was created by modifying the zlib manual.

Visit http://cis.poly.edu/zdelta for the official zdelta web page.


Introduction

The 'zdelta' compression library provides in-memory delta compression and decompression functions, including integrity checks of the uncompressed data. The library supports multiple reference files - in the current implementation their number is limitted up to 4.

Compression can be done in a single step if the buffers are large enough (for example if an input files are mmap'ed), or can be done by repeated calls of the compression function. In the latter case, the application must provide more input and/or consume the output (providing more output space) before each call. TODO: streaming on the reference data

The library does not install any signal handler. The decoder checks the consistency of the compressed data, so the library should never crash even in case of corrupted input.


Compile Options

The maximum number of reference buffers is specified at compile time by the macro REFNUM. Its value must be greater than or equal to 1 and smaller than or equal to 4. REFNUM defaults to 1. The compression format for a single reference buffer is optimized, so if you intend to use only 1 reference buffer, you should compile the library with REFNUM equal to 1. The compression format for values greater than 1 is the same, however, there could be slight decrease in speed for greater REFNUM values.

In some applications (for example an http proxy server) the size of the compressed data can often be as small as the zdelta checksum and the zdelta header. Such applications could significantly benefit from suppressing the zdelta header and the zdelta checksum. This can be done at compile time by defining the NO_ERROR_CHECK macro.


Utility functions

The following utility functions are implemented on top of the basic stream-oriented functions. To simplify the interface, some default options are assumed (compression level and memory usage, standard memory allocation functions). The source code of these utility functions can easily be modified if you need special options.

Function list

Function description

int zd_compress (const Bytef *ref, uLong rsize, const Bytef *tar, uLong tsize, const Bytef *delta, uLongf *dsize);
Compresses the target buffer with respect to the reference buffer into the delta buffer. rsize is the byte length of the reference buffer, and tsize is the byte length of the target buffer. Upon entry, dsize is the total size of the delta buffer. Upon exit, dsize is the actual size of the compressed delta buffer.
NOTE: A good estimate for the initial value of dsize is 0.1% larger than tsize plus 12; in some rare occassions, however, zdelta may expand the data more than this! The user should check the return codes for those cases.

This function can be used to zd_compress a whole file at once if the input file is mmap'ed.

zd_compress returns ZD_OK if success, ZD_MEM_ERROR if there was not enough memory, ZD_BUF_ERROR if there was not enough room in the output buffer.

int zd_compress1 (const Bytef *ref, uLong rsize, const Bytef *tar, uLong tsize, Bytef **delta, uLongf *dsize);
Same as zd_compress, but with dynamic memory allocation for the output buffer.
Compresses the target buffer with respect to the reference buffer into the delta buffer. rsize is the byte length of the reference buffer, and tsize is the byte length of the target buffer. Upon entry *delta should be NULL, *dsize should be 0 or the expected compressed byte length (NOTE: zd_compress1 will iniliatilly allocate *dsize bytes to store the delta). Upon exit, *delta points to the delta buffer (allocated by zdelta), and dsize is the byte length of the compressed delta buffer - the actual space allocated by zdelta could be larger than dsize bytes.

This function can be used to zd_compress1 a whole file at once if the input file is mmap'ed.

zd_compress1 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory.

int zd_compressN (const Bytef *ref[ ], uLong rsize[ ], int rw, const Bytef *tar, uLong tsize, Bytef *delta, uLongf *dsize);
Compresses the target buffer with respect to 1 or more (up to REFNUM) reference buffers into the delta buffer. ref[ ] is an array of reference buffers, rsize is an array containg the bytes length of the reference buffers, rw is the number of reference buffers, and tsize is the byte length of the target buffer. Upon entry, dsize is the total byte length of the delta buffer. Upon exit, dsize is the actual byte length of the compressed data in the delta buffer.
NOTE: A good estimate for the initial value of dsize is 0.1% larger than tsize plus 12; in some rare occassions, however, zdelta may expand the data more than this! The user should check the return codes for those cases.
In order to use this function zdelta must be compiled with REFNUM greater than 1.

This function can be used to zd_compressN a whole file at once if the input file is mmap'ed.

zd_compress returns ZD_OK if success, ZD_MEM_ERROR if there was not enough memory, ZD_BUF_ERROR if there was not enough room in the output buffer.

int zd_compressN1 (const Bytef *ref[ ], uLong rsize[ ], int rw, const Bytef *tar, uLong tsize, Bytef **delta, uLongf *dsize);
Same as zd_compressN, but with dynamic memory allocation for the output buffer.
Compresses the target buffer with respect to 1 or more (up REFNUM) reference buffers into the delta buffer. ref[ ] is an array of reference buffers, rsize is an array containg the bytes lengths of the reference buffers, rw is the number of reference buffers, and tsize is the byte length of the target buffer. Upon entry *delta should be NULL, *dsize should be 0 or the expected compressed byte length (NOTE: zd_compressN1 will iniliatilly allocate *dsize bytes to store the delta). compressed size or 0. Upon exit, *delta points to the delta buffer (allocated by zdelta), and dsize is the byte length of the compressed data in the delta buffer - the actual space allocated by zdelta could be larger than dsize bytes.
NOTE: in some rare occassions zdelta may expand the data! The user should check the return codes for those cases.
In order to use this function zdelta must be compiled with REFNUM greater than 1.

This function can be used to zd_compressN1 a whole file at once if the input file is mmap'ed.

zd_compress returns ZD_OK if success, ZD_MEM_ERROR if there was not enough memory.

int zd_uncompress (const Bytef *ref, uLong rsize, Bytef *tar, uLongf *tsize, const Bytef *delta, uLong dsize);
Decompresses the delta buffer with respect to the reference buffer into the target buffer. rsize is the byte length of the reference buffer, and dsize is the byte length of the delta buffer. Upon entry, tsize is the total byte length of the target buffer (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, tsize is the byte length of the uncompressed data in the tar buffer.

This function can be used to zd_uncompress a whole file at once if the input file is mmap'ed.

zd_uncompress returns ZD_OK if success, ZD_MEM_ERROR if there was not enough memory, ZD_BUF_ERROR if there was not enough room in the output buffer, or ZD_DATA_ERROR if the input data was corrupted.

int zd_uncompress1 (const Bytef *ref, uLong rsize, Bytef **tar, uLongf *tsize, const Bytef *delta, uLong dsize);
Same as zd_uncompress, but with dynamic memory allocation for the output buffer.
Decompresses the delta buffer with respect to the reference buffer into the target buffer. rsize is the byte length of the reference buffer, and dsize is the byte length of the delta buffer. Upon entry *tar should be NULL, *tsize should be 0 or the expected uncompressed byte length (NOTE: zd_uncompress1 will iniliatilly allocate *tsize bytes to store the decompressed data). Upon exit, *tar points to the uncompressed target buffer (allocated by zdelta), and tsize is the byte length of the uncompressed data in the tar buffer - the actual space allocated by zdelta could be larger than tsize.

This function can be used to zd_uncompress1 a whole file at once if the input file is mmap'ed.

zd_uncompress1 returns ZD_OK if success, ZD_MEM_ERROR if there was not enough memory, or ZD_DATA_ERROR if the input data was corrupted.

int zd_uncompressN (const Bytef *ref[ ], uLong rsize[ ], int rw, Bytef *tar, uLong *tsize, const Bytef *delta, uLongf dsize);
Decompresses the delta buffer with respect to 1 or more (up to REFNUM) reference buffers into the tar buffer. ref[ ] is an array of reference buffers, rsize is an array containg the bytes lengths of the reference buffers, rw is the number of reference buffers, and tsize is the byte length of the target buffer.
In order to use this function zdelta must be compiled with REFNUM greater than 1.

Upon entry, tsize is the total byte length of the target buffer (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, tsize is the byte length of the uncompressed data in the tar buffer.

This function can be used to zd_uncompressN a whole file at once if the input file is mmap'ed.

zd_uncompressN returns ZD_OK if success, ZD_MEM_ERROR if there was not enough memory, ZD_BUF_ERROR if there was not enough room in the output buffer, or ZD_DATA_ERROR if the input data was corrupted.

int zd_uncompressN1(const Bytef *ref[ ], uLong rsize[ ], int rw, Bytef **tar, uLongf *tsize, const Bytef *delta, uLong dsize);
Same as zd_uncompressN, but with dynamic memory allocation for the output buffer.
Decompresses the delta buffer with respect to 1 or more (up to REFNUM) reference buffers into the tar buffer. ref[ ] is an array of reference buffers, rsize is an array containg the bytes lengths of the reference buffers, rw is the number of reference buffers, and tsize is the byte length of the target buffer. Upon entry *tar should be NULL, *tsize should be 0 or the expected uncompressed byte length (NOTE: zd_uncompressN1 will iniliatilly allocate *tsize bytes to store the decompressed data). Upon exit, *tar points to the uncompressed target buffer (allocated by zdelta), and tsize is the byte length of the uncompressed data in the tar buffer - the actual space allocated by zdelta could be larger than tsize bytes.
In order to use this function zdelta must be compiled with REFNUM greater than 1.

This function can be used to zd_uncompressN1 a whole file at once if the input file is mmap'ed.

zd_uncompressN1 returns ZD_OK if success, ZD_MEM_ERROR if there was not enough memory, or ZD_DATA_ERROR if the input data was corrupted.


Basic functions

Function list

Function description

const char * zdlibVersion (void);
The application can compare zdlibVersion and ZDLIB_VERSION for consistency. If the first character differs, the library code actually used is not compatible with the zdlib.h header file used by the application. This check is automatically made by zd_deflateInit and zd_inflateInit.

int zd_deflateInit (zd_streamp strm, int level);
Initializes the internal stream state for compression. The fields zalloc, zfree and opaque must be initialized before by the caller. If zalloc and zfree are set to ZD_NULL, zd_deflateInit updates them to use default allocation functions.

The compression level must be ZD_DEFAULT_COMPRESSION, or between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time).

ZD_DEFAULT_COMPRESSION requests a default compromise between speed and compression (currently equivalent to level 6).

zd_deflateInit returns ZD_OK if success, ZD_MEM_ERROR if there was not enough memory, ZD_STREAM_ERROR if level is not a valid compression level, ZD_VERSION_ERROR if the zdlib library version (zdlib_version) is incompatible with the version assumed by the caller (ZDLIB_VERSION). msg is set to null if there is no error message. zd_deflateInit does not perform any compression: this will be done by zd_deflate().

int zd_deflate (zd_streamp strm, int flush);
zd_deflate compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush.

The detailed semantics are as follows. zd_deflate performs one or both of the following actions:

Before the call of zd_deflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating avail_in or avail_out accordingly ; avail_out should never be zero before the call. The application can consume the compressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of zd_deflate(). If zd_deflate returns ZD_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending.

If the parameter flush is set to ZD_SYNC_FLUSH, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input data available so far. (In particular avail_in is zero after the call if enough output space has been provided before the call.) Flushing may degrade compression for some compression algorithms and so it should be used only when necessary.

If flush is set to ZD_FULL_FLUSH, all output is flushed as with Z_SYNC_FLUSH, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired. Using ZD_FULL_FLUSH too often can seriously degrade the compression.

If zd_deflate returns with avail_out == 0, this function must be called again with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out).

If the parameter flush is set to ZD_FINISH, pending input is processed, pending output is flushed and zd_deflate returns with ZD_STREAM_END if there was enough output space ; if zd_deflate returns with ZD_OK, this function must be called again with ZD_FINISH and more output space (updated avail_out) but no more input data, until it returns with ZD_STREAM_END or an error. After zd_deflate has returned ZD_STREAM_END, the only possible operations on the stream are zd_deflateReset or zd_deflateEnd.

ZD_FINISH can be used immediately after zd_deflateInit if all the compression is to be done in a single step. In this case, avail_out must be at least 0.1% larger than avail_in plus 12 bytes. If deflate does not return ZD_STREAM_END, then it must be called again as described above.

zd_deflate() sets strm-> zd_adler to the zs_adler32 checksum of all input read so far (that is, total_in bytes).

zd_deflate() returns ZD_OK if some progress has been made (more input processed or more output produced), ZD_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to ZD_FINISH), ZD_STREAM_ERROR if the stream state was inconsistent (for example if next_in or next_out was NULL), ZD_BUF_ERROR if no progress is possible (for example avail_in or avail_out was zero).

int zd_deflateEnd (zd_streamp strm);
All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output.

zd_deflateEnd returns ZD_OK if success, ZD_STREAM_ERROR if the stream state was inconsistent, ZD_DATA_ERROR if the stream was freed prematurely (some input or output was discarded). In the error case, msg may be set but then points to a static string (which must not be deallocated).

int zd_inflateInit (zd_streamp strm);
Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. If next_in is not ZD_NULL and avail_in is large enough (the exact value depends on the compression method), zd_inflateInit determines the compression method from the zdlib header and allocates all data structures accordingly ; otherwise the allocation will be deferred to the first call of inflate. If zalloc and zfree are set to ZD_NULL, zd_inflateInit updates them to use default allocation functions.

zd_inflateInit returns ZD_OK if success, ZD_MEM_ERROR if there was not enough memory, ZD_VERSION_ERROR if the zdlib library version is incompatible with the version assumed by the caller. msg is set to null if there is no error message. zd_inflateInit does not perform any decompression apart from reading the zdlib header if present: this will be done by zd_inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.)

int zd_inflate (zd_streamp strm, int flush);
zd_inflate decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may some introduce some output latency (reading input without producing any output) except when forced to flush.

The detailed semantics are as follows. zd_inflate performs one or both of the following actions:

Before the call of zd_inflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating the next_* and avail_* values accordingly. The application can consume the uncompressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of zd_inflate(). If zd_inflate returns ZD_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending.

If the parameter flush is set to ZD_SYNC_FLUSH, zd_inflate flushes as much output as possible to the output buffer. The flushing behavior of inflate is not specified for values of the flush parameter other than ZD_SYNC_FLUSH and ZD_FINISH, but the current implementation actually flushes as much output as possible anyway.

zd_inflate() should normally be called until it returns ZD_STREAM_END or an error. However if all decompression is to be performed in a single step (a single call of zd_inflate), the parameter flush should be set to ZD_FINISH. In this case all pending input is processed and all pending output is flushed ; avail_out must be large enough to hold all the uncompressed data. (The size of the uncompressed data may have been saved by the compressor for this purpose.) The next operation on this stream must be zd_inflateEnd to deallocate the decompression state. The use of ZD_FINISH is never required, but can be used to inform inflate that a faster routine may be used for the single zd_inflate() call.

zd_inflate() sets strm-> adler to the adler32 checksum of all output produced so far (that is, total_out bytes) and returns ZD_OK, ZD_STREAM_END or an error code as described below. At the end of the stream, zd_inflate() checks that its computed zd_adler32 checksum is equal to that saved by the compressor and returns ZD_STREAM_END only if the checksum is correct.

zd_inflate() returns ZD_OK if some progress has been made (more input processed or more output produced), ZD_STREAM_END if the end of the compressed data has been reached and all uncompressed output has been produced, ZD_DATA_ERROR if the input data was corrupted (input stream not conforming to the zdlib format or incorrect adler32 checksum), ZD_STREAM_ERROR if the stream structure was inconsistent (for example if next_in or next_out was NULL), ZD_MEM_ERROR if there was not enough memory, ZD_BUF_ERROR if no progress is possible or if there was not enough room in the output buffer when ZD_FINISH is used. In the ZD_DATA_ERROR case, the application may then call zd_inflateSync to look for a good compression block.

int zd_inflateEnd (zd_streamp strm);
All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output.

zd_inflateEnd returns ZD_OK if success, ZD_STREAM_ERROR if the stream state was inconsistent. In the error case, msg may be set but then points to a static string (which must not be deallocated).


Advanced functions

The following functions are needed only in some special applications.

Function list

Function description

int zd_deflateReset (zd_streamp strm);
This function is equivalent to zd_deflateEnd followed by zd_deflateInit, but does not free and reallocate all the internal compression state. The stream will keep the same compression level and any other attributes that may have been set by zd_deflateInit2.

zd_deflateReset returns ZD_OK if success, or ZD_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being NULL).

int zd_deflateParams (zd_streamp strm, int level, int strategy);
Dynamically update the compression level and compression strategy. The interpretation of level and strategy is as in zd_deflateInit2. This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression level is changed, the input available so far is compressed with the old level (and may be flushed); the new level will take effect only at the next call of zd_deflate().

Before the call of zd_deflateParams, the stream state must be set as for a call of zd_deflate(), since the currently available input may have to be compressed and flushed. In particular, strm-> avail_out must be non-zero.

zd_deflateParams returns ZD_OK if success, ZD_STREAM_ERROR if the source stream state was inconsistent or if a parameter was invalid, ZD_BUF_ERROR if strm-&gtavail_out was zero.

int zd_inflateSync (zd_streamp strm);
Skips invalid compressed data until a full flush point (see above the description of zd_deflate with ZD_FULL_FLUSH) can be found, or until all available input is skipped. No output is provided.

zd_inflateSync returns ZD_OK if a full flush point has been found, ZD_BUF_ERROR if no more input was provided, ZD_DATA_ERROR if no flush point has been found, or ZD_STREAM_ERROR if the stream structure was inconsistent. In the success case, the application may save the current current value of total_in which indicates where valid compressed data was found. In the error case, the application may repeatedly call zd_inflateSync, providing more input each time, until success or end of the input data.

int zd_inflateReset (zd_streamp strm);
This function is equivalent to zd_inflateEnd followed by zd_inflateInit, but does not free and reallocate all the internal decompression state. The stream will keep attributes that may have been set by zd_inflateInit2.

zd_inflateReset returns ZD_OK if success, or ZD_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being NULL).


Checksum functions

These functions are not related to compression but are exported anyway because they might be useful in applications using the compression library.

Function list

Function description

uLong zd_adler32 (uLong adler, const Bytef *buf, uInt len);
Update a running Adler-32 checksum with the bytes buf[0..len-1] and return the updated checksum. If buf is NULL, this function returns the required initial value for the checksum.

An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster. Usage example:

     uLong adler = zd_adler32(0L, ZD_NULL, 0);

     while (read_buffer(buffer, length) != EOF) {
       adler = zd_adler32(adler, buffer, length);
     }
     if (adler != original_adler) error();
   

struct zd_stream_s

typedef struct zd_stream_s {
    Bytef    *next_in;  /* next input byte */
    uInt     avail_in;  /* number of bytes available at next_in */
    uLong    total_in;  /* total nb of input bytes read so far */

    Bytef    *next_out; /* next output byte should be put there */
    uInt     avail_out; /* remaining free space at next_out */
    uLong    total_out; /* total nb of bytes output so far */

    Bytef    *base[REFNUM];      /* pointers to the reference/base buffers */
    uLong    base_out[REFNUM];   /* bytes read from the corresponding reference buffer */
    uLong    base_avail[REFNUM]; /* available bytes in the correspoing reference buffer */
    int      refnum;                                                        /* number of reference buffers */
    
    char     *msg;      /* last error message, NULL if no error */
    struct internal_state FAR *state; /* not visible by applications */

    alloc_func zalloc;  /* used to allocate the internal state */
    free_func  zfree;   /* used to free the internal state */
    voidpf     opaque;  /* private data object passed to zalloc and zfree */

    int     data_type;  /* best guess about the data type: ascii or binary */
    uLong   adler;      /* zd_adler32 value of the uncompressed data */
    uLong   reserved;   /* reserved for future use */
} zd_stream ;

typedef zd_stream FAR * zd_streamp;
The application must update next_in and avail_in when avail_in has dropped to zero. It must update next_out and avail_out when avail_out has dropped to zero. The application must initialize zalloc, zfree and opaque before calling the init function. All other fields are set by the compression library and must not be updated by the application.

The opaque value provided by the application will be passed as the first parameter for calls of zalloc and zfree. This can be useful for custom memory management. The compression library attaches no meaning to the opaque value.

zalloc must return ZD_NULL if there is not enough memory for the object. If zlib is used in a multi-threaded application, zalloc and zfree must be thread safe.

On 16-bit systems, the functions zalloc and zfree must be able to allocate exactly 65536 bytes, but will not be required to allocate more than this if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers returned by zalloc for objects of exactly 65536 bytes *must* have their offset normalized to zero. The default allocation function provided by this library ensures this (see zutil.c). To reduce memory requirements and avoid any allocation of 64K objects, at the expense of compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).

The fields total_in and total_out can be used for statistics or progress reports. After compression, total_in holds the total size of the uncompressed data and may be saved for use in the decompressor (particularly if the decompressor wants to decompress everything in a single step).


Constants

#define ZD_NO_FLUSH      0
#define ZD_SYNC_FLUSH    2
#define ZD_FULL_FLUSH    3
#define ZD_FINISH        4
/* Allowed flush values ; see zd_deflate() below for details */

#define ZD_OK            0
#define ZD_STREAM_END    1
#define ZD_ERRNO        (-1)
#define ZD_STREAM_ERROR (-2)
#define ZD_DATA_ERROR   (-3)
#define ZD_MEM_ERROR    (-4)
#define ZD_BUF_ERROR    (-5)
#define ZD_VERSION_ERROR (-6)
/* Return codes for the compression/decompression functions. Negative
 * values are errors, positive values are used for special but normal events.
 */

#define ZD_NO_COMPRESSION         0
#define ZD_BEST_SPEED             1
#define ZD_BEST_COMPRESSION       9
#define ZD_DEFAULT_COMPRESSION  (-1)
/* compression levels */

#define ZD_FILTERED            5
#define ZD_HUFFMAN_ONLY        0
#define ZD_DEFAULT_STRATEGY    7
/* compression strategy ; see deflateInit2() below for details */

#define ZD_DEFLATED   8
/* The zd_deflate compression method (the only one supported in this version) */

#define ZD_NULL  0  /* for initializing zalloc, zfree, opaque */

#ifndef REFNUM
#define REFNUM 1            /* reference window number; defaluts to 1; must be between 1 and 4 */
#endif


Misc

zd_deflateInit and zd_inflateInit are macros to allow checking the zlib version and the compiler's view of zd_stream.

Other functions:

const char * zd_zError (int err);

Last update: 23 october 2003
dtrend01@utopia.poly.edu