summaryrefslogtreecommitdiff
path: root/zlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'zlib.h')
-rw-r--r--zlib.h110
1 files changed, 73 insertions, 37 deletions
diff --git a/zlib.h b/zlib.h
index bfbba83..7c0a2d8 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1,7 +1,7 @@
1/* zlib.h -- interface of the 'zlib' general purpose compression library 1/* zlib.h -- interface of the 'zlib' general purpose compression library
2 version 1.2.5, April 19th, 2010 2 version 1.2.5.1, September 10th, 2011
3 3
4 Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler 4 Copyright (C) 1995-2011 Jean-loup Gailly and Mark Adler
5 5
6 This software is provided 'as-is', without any express or implied 6 This software is provided 'as-is', without any express or implied
7 warranty. In no event will the authors be held liable for any damages 7 warranty. In no event will the authors be held liable for any damages
@@ -24,8 +24,8 @@
24 24
25 25
26 The data format used by the zlib library is described by RFCs (Request for 26 The data format used by the zlib library is described by RFCs (Request for
27 Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt 27 Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
28 (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). 28 (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
29*/ 29*/
30 30
31#ifndef ZLIB_H 31#ifndef ZLIB_H
@@ -37,12 +37,12 @@
37extern "C" { 37extern "C" {
38#endif 38#endif
39 39
40#define ZLIB_VERSION "1.2.5" 40#define ZLIB_VERSION "1.2.5.1"
41#define ZLIB_VERNUM 0x1250 41#define ZLIB_VERNUM 0x1251
42#define ZLIB_VER_MAJOR 1 42#define ZLIB_VER_MAJOR 1
43#define ZLIB_VER_MINOR 2 43#define ZLIB_VER_MINOR 2
44#define ZLIB_VER_REVISION 5 44#define ZLIB_VER_REVISION 5
45#define ZLIB_VER_SUBREVISION 0 45#define ZLIB_VER_SUBREVISION 1
46 46
47/* 47/*
48 The 'zlib' compression library provides in-memory compression and 48 The 'zlib' compression library provides in-memory compression and
@@ -85,11 +85,11 @@ struct internal_state;
85typedef struct z_stream_s { 85typedef struct z_stream_s {
86 Bytef *next_in; /* next input byte */ 86 Bytef *next_in; /* next input byte */
87 uInt avail_in; /* number of bytes available at next_in */ 87 uInt avail_in; /* number of bytes available at next_in */
88 uLong total_in; /* total nb of input bytes read so far */ 88 uLong total_in; /* total number of input bytes read so far */
89 89
90 Bytef *next_out; /* next output byte should be put there */ 90 Bytef *next_out; /* next output byte should be put there */
91 uInt avail_out; /* remaining free space at next_out */ 91 uInt avail_out; /* remaining free space at next_out */
92 uLong total_out; /* total nb of bytes output so far */ 92 uLong total_out; /* total number of bytes output so far */
93 93
94 char *msg; /* last error message, NULL if no error */ 94 char *msg; /* last error message, NULL if no error */
95 struct internal_state FAR *state; /* not visible by applications */ 95 struct internal_state FAR *state; /* not visible by applications */
@@ -327,8 +327,9 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
327 327
328 Z_FINISH can be used immediately after deflateInit if all the compression 328 Z_FINISH can be used immediately after deflateInit if all the compression
329 is to be done in a single step. In this case, avail_out must be at least the 329 is to be done in a single step. In this case, avail_out must be at least the
330 value returned by deflateBound (see below). If deflate does not return 330 value returned by deflateBound (see below). Then deflate is guaranteed to
331 Z_STREAM_END, then it must be called again as described above. 331 return Z_STREAM_END. If not enough output space is provided, deflate will
332 not return Z_STREAM_END, and it must be called again as described above.
332 333
333 deflate() sets strm->adler to the adler32 checksum of all input read 334 deflate() sets strm->adler to the adler32 checksum of all input read
334 so far (that is, total_in bytes). 335 so far (that is, total_in bytes).
@@ -688,8 +689,27 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
688 deflation of sourceLen bytes. It must be called after deflateInit() or 689 deflation of sourceLen bytes. It must be called after deflateInit() or
689 deflateInit2(), and after deflateSetHeader(), if used. This would be used 690 deflateInit2(), and after deflateSetHeader(), if used. This would be used
690 to allocate an output buffer for deflation in a single pass, and so would be 691 to allocate an output buffer for deflation in a single pass, and so would be
691 called before deflate(). 692 called before deflate(). If that first deflate() call is provided the
692*/ 693 sourceLen input bytes, an output buffer allocated to the size returned by
694 deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
695 to return Z_STREAM_END. Note that it is possible for the compressed size to
696 be larger than the value returned by deflateBound() if flush options other
697 than Z_FINISH or Z_NO_FLUSH are used.
698*/
699
700ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
701 unsigned *pending,
702 int *bits));
703/*
704 deflatePending() returns the number of bytes and bits of output that have
705 been generated, but not yet provided in the available output. The bytes not
706 provided would be due to the available output space having being consumed.
707 The number of bits of output not provided are between 0 and 7, where they
708 await more bits to join them in order to fill out a full byte.
709
710 deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
711 stream state was inconsistent.
712 */
693 713
694ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, 714ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
695 int bits, 715 int bits,
@@ -805,17 +825,21 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
805 825
806ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); 826ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
807/* 827/*
808 Skips invalid compressed data until a full flush point (see above the 828 Skips invalid compressed data until a possible full flush point (see above
809 description of deflate with Z_FULL_FLUSH) can be found, or until all 829 for the description of deflate with Z_FULL_FLUSH) can be found, or until all
810 available input is skipped. No output is provided. 830 available input is skipped. No output is provided.
811 831
812 inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR 832 inflateSync searches for a 00 00 FF FF pattern in the compressed data.
813 if no more input was provided, Z_DATA_ERROR if no flush point has been 833 All full flush points have this pattern, but not all occurences of this
814 found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the 834 pattern are full flush points.
815 success case, the application may save the current current value of total_in 835
816 which indicates where valid compressed data was found. In the error case, 836 inflateSync returns Z_OK if a possible full flush point has been found,
817 the application may repeatedly call inflateSync, providing more input each 837 Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
818 time, until success or end of the input data. 838 has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
839 In the success case, the application may save the current current value of
840 total_in which indicates where valid compressed data was found. In the
841 error case, the application may repeatedly call inflateSync, providing more
842 input each time, until success or end of the input data.
819*/ 843*/
820 844
821ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, 845ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
@@ -962,7 +986,7 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
962 See inflateBack() for the usage of these routines. 986 See inflateBack() for the usage of these routines.
963 987
964 inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of 988 inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
965 the paramaters are invalid, Z_MEM_ERROR if the internal state could not be 989 the parameters are invalid, Z_MEM_ERROR if the internal state could not be
966 allocated, or Z_VERSION_ERROR if the version of the library does not match 990 allocated, or Z_VERSION_ERROR if the version of the library does not match
967 the version of the header file. 991 the version of the header file.
968*/ 992*/
@@ -1256,7 +1280,7 @@ ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
1256 error. 1280 error.
1257*/ 1281*/
1258 1282
1259ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); 1283ZEXTERN int ZEXPORTVA gzprintf ON((gzFile file, const char *format, ...));
1260/* 1284/*
1261 Converts, formats, and writes the arguments to the compressed file under 1285 Converts, formats, and writes the arguments to the compressed file under
1262 control of the format string, as in fprintf. gzprintf returns the number of 1286 control of the format string, as in fprintf. gzprintf returns the number of
@@ -1492,7 +1516,9 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
1492 Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 1516 Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
1493 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for 1517 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
1494 each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of 1518 each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
1495 seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. 1519 seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note
1520 that the z_off_t type (like off_t) is a signed integer. If len2 is
1521 negative, the result has no meaning or utility.
1496*/ 1522*/
1497 1523
1498ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); 1524ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
@@ -1544,17 +1570,18 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
1544 const char *version, 1570 const char *version,
1545 int stream_size)); 1571 int stream_size));
1546#define deflateInit(strm, level) \ 1572#define deflateInit(strm, level) \
1547 deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) 1573 deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
1548#define inflateInit(strm) \ 1574#define inflateInit(strm) \
1549 inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) 1575 inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
1550#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ 1576#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
1551 deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ 1577 deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
1552 (strategy), ZLIB_VERSION, sizeof(z_stream)) 1578 (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
1553#define inflateInit2(strm, windowBits) \ 1579#define inflateInit2(strm, windowBits) \
1554 inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) 1580 inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
1581 (int)sizeof(z_stream))
1555#define inflateBackInit(strm, windowBits, window) \ 1582#define inflateBackInit(strm, windowBits, window) \
1556 inflateBackInit_((strm), (windowBits), (window), \ 1583 inflateBackInit_((strm), (windowBits), (window), \
1557 ZLIB_VERSION, sizeof(z_stream)) 1584 ZLIB_VERSION, (int)sizeof(z_stream))
1558 1585
1559/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or 1586/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
1560 * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if 1587 * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
@@ -1572,13 +1599,22 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
1572#endif 1599#endif
1573 1600
1574#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 1601#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
1575# define gzopen gzopen64 1602# ifdef Z_PREFIX_SET
1576# define gzseek gzseek64 1603# define z_gzopen z_gzopen64
1577# define gztell gztell64 1604# define z_gzseek z_gzseek64
1578# define gzoffset gzoffset64 1605# define z_gztell z_gztell64
1579# define adler32_combine adler32_combine64 1606# define z_gzoffset z_gzoffset64
1580# define crc32_combine crc32_combine64 1607# define z_adler32_combine z_adler32_combine64
1581# ifdef _LARGEFILE64_SOURCE 1608# define z_crc32_combine z_crc32_combine64
1609# else
1610# define gzopen gzopen64
1611# define gzseek gzseek64
1612# define gztell gztell64
1613# define gzoffset gzoffset64
1614# define adler32_combine adler32_combine64
1615# define crc32_combine crc32_combine64
1616# endif
1617# ifndef _LARGEFILE64_SOURCE
1582 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); 1618 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
1583 ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); 1619 ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
1584 ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); 1620 ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));