zlib 1.1.3
This commit is contained in:
149
zlib.h
149
zlib.h
@@ -1,5 +1,5 @@
|
||||
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
||||
version 1.1.2, March 19th, 1998
|
||||
version 1.1.3, July 9th, 1998
|
||||
|
||||
Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ZLIB_VERSION "1.1.2"
|
||||
#define ZLIB_VERSION "1.1.3"
|
||||
|
||||
/*
|
||||
The 'zlib' compression library provides in-memory compression and
|
||||
@@ -168,7 +168,7 @@ typedef z_stream FAR *z_streamp;
|
||||
|
||||
/* basic functions */
|
||||
|
||||
extern const char * ZEXPORT zlibVersion OF((void));
|
||||
ZEXTERN const char * ZEXPORT zlibVersion OF((void));
|
||||
/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
|
||||
If the first character differs, the library code actually used is
|
||||
not compatible with the zlib.h header file used by the application.
|
||||
@@ -176,7 +176,7 @@ extern const char * ZEXPORT zlibVersion OF((void));
|
||||
*/
|
||||
|
||||
/*
|
||||
extern int ZEXPORT deflateInit OF((z_streamp strm, int level));
|
||||
ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
|
||||
|
||||
Initializes the internal stream state for compression. The fields
|
||||
zalloc, zfree and opaque must be initialized before by the caller.
|
||||
@@ -198,7 +198,7 @@ extern int ZEXPORT deflateInit OF((z_streamp strm, int level));
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT deflate OF((z_streamp strm, int flush));
|
||||
ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
|
||||
/*
|
||||
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
|
||||
@@ -271,11 +271,12 @@ extern int ZEXPORT deflate OF((z_streamp strm, int flush));
|
||||
processed or more output produced), Z_STREAM_END if all input has been
|
||||
consumed and all output has been produced (only when flush is set to
|
||||
Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
|
||||
if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible.
|
||||
if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
|
||||
(for example avail_in or avail_out was zero).
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT deflateEnd OF((z_streamp strm));
|
||||
ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
|
||||
/*
|
||||
All dynamically allocated data structures for this stream are freed.
|
||||
This function discards any unprocessed input and does not flush any
|
||||
@@ -290,7 +291,7 @@ extern int ZEXPORT deflateEnd OF((z_streamp strm));
|
||||
|
||||
|
||||
/*
|
||||
extern int ZEXPORT inflateInit OF((z_streamp strm));
|
||||
ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
|
||||
|
||||
Initializes the internal stream state for decompression. The fields
|
||||
next_in, avail_in, zalloc, zfree and opaque must be initialized before by
|
||||
@@ -310,7 +311,7 @@ extern int ZEXPORT inflateInit OF((z_streamp strm));
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT inflate OF((z_streamp strm, int flush));
|
||||
ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
|
||||
/*
|
||||
inflate decompresses as much data as possible, and stops when the input
|
||||
buffer becomes empty or the output buffer becomes full. It may some
|
||||
@@ -379,7 +380,7 @@ extern int ZEXPORT inflate OF((z_streamp strm, int flush));
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT inflateEnd OF((z_streamp strm));
|
||||
ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
|
||||
/*
|
||||
All dynamically allocated data structures for this stream are freed.
|
||||
This function discards any unprocessed input and does not flush any
|
||||
@@ -397,12 +398,12 @@ extern int ZEXPORT inflateEnd OF((z_streamp strm));
|
||||
*/
|
||||
|
||||
/*
|
||||
extern int ZEXPORT deflateInit2 OF((z_streamp strm,
|
||||
int level,
|
||||
int method,
|
||||
int windowBits,
|
||||
int memLevel,
|
||||
int strategy));
|
||||
ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
|
||||
int level,
|
||||
int method,
|
||||
int windowBits,
|
||||
int memLevel,
|
||||
int strategy));
|
||||
|
||||
This is another version of deflateInit with more compression options. The
|
||||
fields next_in, zalloc, zfree and opaque must be initialized before by
|
||||
@@ -440,14 +441,14 @@ extern int ZEXPORT deflateInit2 OF((z_streamp strm,
|
||||
not perform any compression: this will be done by deflate().
|
||||
*/
|
||||
|
||||
extern int ZEXPORT deflateSetDictionary OF((z_streamp strm,
|
||||
const Bytef *dictionary,
|
||||
uInt dictLength));
|
||||
ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
|
||||
const Bytef *dictionary,
|
||||
uInt dictLength));
|
||||
/*
|
||||
Initializes the compression dictionary from the given byte sequence
|
||||
without producing any compressed output. This function must be called
|
||||
immediately after deflateInit or deflateInit2, before any call of
|
||||
deflate. The compressor and decompressor must use exactly the same
|
||||
immediately after deflateInit, deflateInit2 or deflateReset, before any
|
||||
call of deflate. The compressor and decompressor must use exactly the same
|
||||
dictionary (see inflateSetDictionary).
|
||||
|
||||
The dictionary should consist of strings (byte sequences) that are likely
|
||||
@@ -476,8 +477,8 @@ extern int ZEXPORT deflateSetDictionary OF((z_streamp strm,
|
||||
perform any compression: this will be done by deflate().
|
||||
*/
|
||||
|
||||
extern int ZEXPORT deflateCopy OF((z_streamp dest,
|
||||
z_streamp source));
|
||||
ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
|
||||
z_streamp source));
|
||||
/*
|
||||
Sets the destination stream as a complete copy of the source stream.
|
||||
|
||||
@@ -494,7 +495,7 @@ extern int ZEXPORT deflateCopy OF((z_streamp dest,
|
||||
destination.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT deflateReset OF((z_streamp strm));
|
||||
ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
|
||||
/*
|
||||
This function is equivalent to deflateEnd followed by deflateInit,
|
||||
but does not free and reallocate all the internal compression state.
|
||||
@@ -505,7 +506,9 @@ extern int ZEXPORT deflateReset OF((z_streamp strm));
|
||||
stream state was inconsistent (such as zalloc or state being NULL).
|
||||
*/
|
||||
|
||||
extern int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy));
|
||||
ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
|
||||
int level,
|
||||
int strategy));
|
||||
/*
|
||||
Dynamically update the compression level and compression strategy. The
|
||||
interpretation of level and strategy is as in deflateInit2. This can be
|
||||
@@ -525,8 +528,8 @@ extern int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy));
|
||||
*/
|
||||
|
||||
/*
|
||||
extern int ZEXPORT inflateInit2 OF((z_streamp strm,
|
||||
int windowBits));
|
||||
ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
|
||||
int windowBits));
|
||||
|
||||
This is another version of inflateInit with an extra parameter. The
|
||||
fields next_in, avail_in, zalloc, zfree and opaque must be initialized
|
||||
@@ -547,9 +550,9 @@ extern int ZEXPORT inflateInit2 OF((z_streamp strm,
|
||||
modified, but next_out and avail_out are unchanged.)
|
||||
*/
|
||||
|
||||
extern int ZEXPORT inflateSetDictionary OF((z_streamp strm,
|
||||
const Bytef *dictionary,
|
||||
uInt dictLength));
|
||||
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
|
||||
const Bytef *dictionary,
|
||||
uInt dictLength));
|
||||
/*
|
||||
Initializes the decompression dictionary from the given uncompressed byte
|
||||
sequence. This function must be called immediately after a call of inflate
|
||||
@@ -566,7 +569,7 @@ extern int ZEXPORT inflateSetDictionary OF((z_streamp strm,
|
||||
inflate().
|
||||
*/
|
||||
|
||||
extern int ZEXPORT inflateSync OF((z_streamp strm));
|
||||
ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
|
||||
/*
|
||||
Skips invalid compressed data until a full flush point (see above the
|
||||
description of deflate with Z_FULL_FLUSH) can be found, or until all
|
||||
@@ -581,7 +584,7 @@ extern int ZEXPORT inflateSync OF((z_streamp strm));
|
||||
until success or end of the input data.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT inflateReset OF((z_streamp strm));
|
||||
ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
|
||||
/*
|
||||
This function is equivalent to inflateEnd followed by inflateInit,
|
||||
but does not free and reallocate all the internal decompression state.
|
||||
@@ -602,8 +605,8 @@ extern int ZEXPORT inflateReset OF((z_streamp strm));
|
||||
utility functions can easily be modified if you need special options.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
|
||||
const Bytef *source, uLong sourceLen));
|
||||
ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
|
||||
const Bytef *source, uLong sourceLen));
|
||||
/*
|
||||
Compresses the source buffer into the destination buffer. sourceLen is
|
||||
the byte length of the source buffer. Upon entry, destLen is the total
|
||||
@@ -617,9 +620,9 @@ extern int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
|
||||
buffer.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
|
||||
const Bytef *source, uLong sourceLen,
|
||||
int level));
|
||||
ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
|
||||
const Bytef *source, uLong sourceLen,
|
||||
int level));
|
||||
/*
|
||||
Compresses the source buffer into the destination buffer. The level
|
||||
parameter has the same meaning as in deflateInit. sourceLen is the byte
|
||||
@@ -632,8 +635,8 @@ extern int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
|
||||
Z_STREAM_ERROR if the level parameter is invalid.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
|
||||
const Bytef *source, uLong sourceLen));
|
||||
ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
|
||||
const Bytef *source, uLong sourceLen));
|
||||
/*
|
||||
Decompresses the source buffer into the destination buffer. sourceLen is
|
||||
the byte length of the source buffer. Upon entry, destLen is the total
|
||||
@@ -653,7 +656,7 @@ extern int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
|
||||
|
||||
typedef voidp gzFile;
|
||||
|
||||
extern gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
|
||||
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
|
||||
/*
|
||||
Opens a gzip (.gz) file for reading or writing. The mode parameter
|
||||
is as in fopen ("rb" or "wb") but can also include a compression level
|
||||
@@ -669,7 +672,7 @@ extern gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
|
||||
can be checked to distinguish the two cases (if errno is zero, the
|
||||
zlib error is Z_MEM_ERROR). */
|
||||
|
||||
extern gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
|
||||
ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
|
||||
/*
|
||||
gzdopen() associates a gzFile with the file descriptor fd. File
|
||||
descriptors are obtained from calls like open, dup, creat, pipe or
|
||||
@@ -682,7 +685,7 @@ extern gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
|
||||
the (de)compression state.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
|
||||
ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
|
||||
/*
|
||||
Dynamically update the compression level or strategy. See the description
|
||||
of deflateInit2 for the meaning of these parameters.
|
||||
@@ -690,7 +693,7 @@ extern int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
|
||||
opened for writing.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
|
||||
ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
|
||||
/*
|
||||
Reads the given number of uncompressed bytes from the compressed file.
|
||||
If the input file was not in gzip format, gzread copies the given number
|
||||
@@ -698,28 +701,29 @@ extern int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
|
||||
gzread returns the number of uncompressed bytes actually read (0 for
|
||||
end of file, -1 for error). */
|
||||
|
||||
extern int ZEXPORT gzwrite OF((gzFile file, const voidp buf, unsigned len));
|
||||
ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
|
||||
const voidp buf, unsigned len));
|
||||
/*
|
||||
Writes the given number of uncompressed bytes into the compressed file.
|
||||
gzwrite returns the number of uncompressed bytes actually written
|
||||
(0 in case of error).
|
||||
*/
|
||||
|
||||
extern int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
|
||||
ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
|
||||
/*
|
||||
Converts, formats, and writes the args to the compressed file under
|
||||
control of the format string, as in fprintf. gzprintf returns the number of
|
||||
uncompressed bytes actually written (0 in case of error).
|
||||
*/
|
||||
|
||||
extern int ZEXPORT gzputs OF((gzFile file, const char *s));
|
||||
ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
|
||||
/*
|
||||
Writes the given null-terminated string to the compressed file, excluding
|
||||
the terminating null character.
|
||||
gzputs returns the number of characters written, or -1 in case of error.
|
||||
*/
|
||||
|
||||
extern char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
|
||||
ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
|
||||
/*
|
||||
Reads bytes from the compressed file until len-1 characters are read, or
|
||||
a newline character is read and transferred to buf, or an end-of-file
|
||||
@@ -728,19 +732,19 @@ extern char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
|
||||
gzgets returns buf, or Z_NULL in case of error.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT gzputc OF((gzFile file, int c));
|
||||
ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
|
||||
/*
|
||||
Writes c, converted to an unsigned char, into the compressed file.
|
||||
gzputc returns the value that was written, or -1 in case of error.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT gzgetc OF((gzFile file));
|
||||
ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
|
||||
/*
|
||||
Reads one byte from the compressed file. gzgetc returns this byte
|
||||
or -1 in case of end of file or error.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT gzflush OF((gzFile file, int flush));
|
||||
ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
|
||||
/*
|
||||
Flushes all pending output into the compressed file. The parameter
|
||||
flush is as in the deflate() function. The return value is the zlib
|
||||
@@ -750,10 +754,11 @@ extern int ZEXPORT gzflush OF((gzFile file, int flush));
|
||||
degrade compression.
|
||||
*/
|
||||
|
||||
extern z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence));
|
||||
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
|
||||
z_off_t offset, int whence));
|
||||
/*
|
||||
Sets the starting position for the next gzread or gzwrite on the given
|
||||
compressed file. The offset represents a number of bytes in the
|
||||
Sets the starting position for the next gzread or gzwrite on the
|
||||
given compressed file. The offset represents a number of bytes in the
|
||||
uncompressed data stream. The whence parameter is defined as in lseek(2);
|
||||
the value SEEK_END is not supported.
|
||||
If the file is opened for reading, this function is emulated but can be
|
||||
@@ -767,14 +772,14 @@ extern z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence));
|
||||
would be before the current position.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT gzrewind OF((gzFile file));
|
||||
ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
|
||||
/*
|
||||
Rewinds the given file. This function is supported only for reading.
|
||||
|
||||
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
|
||||
*/
|
||||
|
||||
extern z_off_t ZEXPORT gztell OF((gzFile file));
|
||||
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
|
||||
/*
|
||||
Returns the starting position for the next gzread or gzwrite on the
|
||||
given compressed file. This position represents a number of bytes in the
|
||||
@@ -783,20 +788,20 @@ extern z_off_t ZEXPORT gztell OF((gzFile file));
|
||||
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
|
||||
*/
|
||||
|
||||
extern int ZEXPORT gzeof OF((gzFile file));
|
||||
ZEXTERN int ZEXPORT gzeof OF((gzFile file));
|
||||
/*
|
||||
Returns 1 when EOF has previously been detected reading the given
|
||||
input stream, otherwise zero.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT gzclose OF((gzFile file));
|
||||
ZEXTERN int ZEXPORT gzclose OF((gzFile file));
|
||||
/*
|
||||
Flushes all pending output if necessary, closes the compressed file
|
||||
and deallocates all the (de)compression state. The return value is the zlib
|
||||
error number (see function gzerror below).
|
||||
*/
|
||||
|
||||
extern const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
|
||||
ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
|
||||
/*
|
||||
Returns the error message for the last error which occurred on the
|
||||
given compressed file. errnum is set to zlib error number. If an
|
||||
@@ -813,7 +818,7 @@ extern const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
|
||||
compression library.
|
||||
*/
|
||||
|
||||
extern uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
|
||||
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
|
||||
|
||||
/*
|
||||
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
|
||||
@@ -830,7 +835,7 @@ extern uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
|
||||
if (adler != original_adler) error();
|
||||
*/
|
||||
|
||||
extern uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
|
||||
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
|
||||
/*
|
||||
Update a running crc with the bytes buf[0..len-1] and return the updated
|
||||
crc. If buf is NULL, this function returns the required initial value
|
||||
@@ -852,16 +857,16 @@ extern uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
|
||||
/* deflateInit and inflateInit are macros to allow checking the zlib version
|
||||
* and the compiler's view of z_stream:
|
||||
*/
|
||||
extern int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
|
||||
const char *version, int stream_size));
|
||||
extern int ZEXPORT inflateInit_ OF((z_streamp strm,
|
||||
const char *version, int stream_size));
|
||||
extern int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
|
||||
int windowBits, int memLevel,
|
||||
int strategy, const char *version,
|
||||
int stream_size));
|
||||
extern int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
|
||||
ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
|
||||
const char *version, int stream_size));
|
||||
ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
|
||||
const char *version, int stream_size));
|
||||
ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
|
||||
int windowBits, int memLevel,
|
||||
int strategy, const char *version,
|
||||
int stream_size));
|
||||
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
|
||||
const char *version, int stream_size));
|
||||
#define deflateInit(strm, level) \
|
||||
deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
|
||||
#define inflateInit(strm) \
|
||||
@@ -877,9 +882,9 @@ extern int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
|
||||
struct internal_state {int dummy;}; /* hack for buggy compilers */
|
||||
#endif
|
||||
|
||||
extern const char * ZEXPORT zError OF((int err));
|
||||
extern int ZEXPORT inflateSyncPoint OF((z_streamp z));
|
||||
extern const uLongf * ZEXPORT get_crc_table OF((void));
|
||||
ZEXTERN const char * ZEXPORT zError OF((int err));
|
||||
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
|
||||
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user