zlib.h (230837) | zlib.h (237248) |
---|---|
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.6, January 29th, 2012 | 2 version 1.2.7, May 2nd, 2012 |
3 4 Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler 5 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 8 arising from the use of this software. 9 10 Permission is granted to anyone to use this software for any purpose, --- 21 unchanged lines hidden (view full) --- 32#define ZLIB_H 33 34#include "zconf.h" 35 36#ifdef __cplusplus 37extern "C" { 38#endif 39 | 3 4 Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler 5 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 8 arising from the use of this software. 9 10 Permission is granted to anyone to use this software for any purpose, --- 21 unchanged lines hidden (view full) --- 32#define ZLIB_H 33 34#include "zconf.h" 35 36#ifdef __cplusplus 37extern "C" { 38#endif 39 |
40#define ZLIB_VERSION "1.2.6" 41#define ZLIB_VERNUM 0x1260 | 40#define ZLIB_VERSION "1.2.7" 41#define ZLIB_VERNUM 0x1270 |
42#define ZLIB_VER_MAJOR 1 43#define ZLIB_VER_MINOR 2 | 42#define ZLIB_VER_MAJOR 1 43#define ZLIB_VER_MINOR 2 |
44#define ZLIB_VER_REVISION 6 | 44#define ZLIB_VER_REVISION 7 |
45#define ZLIB_VER_SUBREVISION 0 46 47/* 48 The 'zlib' compression library provides in-memory compression and 49 decompression functions, including integrity checks of the uncompressed data. 50 This version of the library supports only one compression method (deflation) 51 but other algorithms will be added later and will have the same stream 52 interface. --- 394 unchanged lines hidden (view full) --- 447 deflate block header for later use in random access within a deflate block. 448 256 is added to the value of strm->data_type when inflate() returns 449 immediately after reaching the end of the deflate block header. 450 451 inflate() should normally be called until it returns Z_STREAM_END or an 452 error. However if all decompression is to be performed in a single step (a 453 single call of inflate), the parameter flush should be set to Z_FINISH. In 454 this case all pending input is processed and all pending output is flushed; | 45#define ZLIB_VER_SUBREVISION 0 46 47/* 48 The 'zlib' compression library provides in-memory compression and 49 decompression functions, including integrity checks of the uncompressed data. 50 This version of the library supports only one compression method (deflation) 51 but other algorithms will be added later and will have the same stream 52 interface. --- 394 unchanged lines hidden (view full) --- 447 deflate block header for later use in random access within a deflate block. 448 256 is added to the value of strm->data_type when inflate() returns 449 immediately after reaching the end of the deflate block header. 450 451 inflate() should normally be called until it returns Z_STREAM_END or an 452 error. However if all decompression is to be performed in a single step (a 453 single call of inflate), the parameter flush should be set to Z_FINISH. In 454 this case all pending input is processed and all pending output is flushed; |
455 avail_out must be large enough to hold all the uncompressed data. (The size 456 of the uncompressed data may have been saved by the compressor for this 457 purpose.) The next operation on this stream must be inflateEnd to deallocate 458 the decompression state. The use of Z_FINISH is not required to perform an 459 inflation in one step. However it may be used to inform inflate that a 460 faster approach can be used for the single inflate() call. Z_FINISH also 461 informs inflate to not maintain a sliding window if the stream completes, 462 which reduces inflate's memory footprint. | 455 avail_out must be large enough to hold all of the uncompressed data for the 456 operation to complete. (The size of the uncompressed data may have been 457 saved by the compressor for this purpose.) The use of Z_FINISH is not 458 required to perform an inflation in one step. However it may be used to 459 inform inflate that a faster approach can be used for the single inflate() 460 call. Z_FINISH also informs inflate to not maintain a sliding window if the 461 stream completes, which reduces inflate's memory footprint. If the stream 462 does not complete, either because not all of the stream is provided or not 463 enough output space is provided, then a sliding window will be allocated and 464 inflate() can be called again to continue the operation as if Z_NO_FLUSH had 465 been used. |
463 464 In this implementation, inflate() always flushes as much output as 465 possible to the output buffer, and always uses the faster approach on the 466 first call. So the effects of the flush parameter in this implementation are 467 on the return value of inflate() as noted below, when inflate() returns early 468 when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of 469 memory for a sliding window when Z_FINISH is used. 470 --- 741 unchanged lines hidden (view full) --- 1212 compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' 1213 for fixed code compression as in "wb9F". (See the description of 1214 deflateInit2 for more information about the strategy parameter.) 'T' will 1215 request transparent writing or appending with no compression and not using 1216 the gzip format. 1217 1218 "a" can be used instead of "w" to request that the gzip stream that will 1219 be written be appended to the file. "+" will result in an error, since | 466 467 In this implementation, inflate() always flushes as much output as 468 possible to the output buffer, and always uses the faster approach on the 469 first call. So the effects of the flush parameter in this implementation are 470 on the return value of inflate() as noted below, when inflate() returns early 471 when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of 472 memory for a sliding window when Z_FINISH is used. 473 --- 741 unchanged lines hidden (view full) --- 1215 compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' 1216 for fixed code compression as in "wb9F". (See the description of 1217 deflateInit2 for more information about the strategy parameter.) 'T' will 1218 request transparent writing or appending with no compression and not using 1219 the gzip format. 1220 1221 "a" can be used instead of "w" to request that the gzip stream that will 1222 be written be appended to the file. "+" will result in an error, since |
1220 reading and writing to the same gzip file is not supported. | 1223 reading and writing to the same gzip file is not supported. The addition of 1224 "x" when writing will create the file exclusively, which fails if the file 1225 already exists. On systems that support it, the addition of "e" when 1226 reading or writing will set the flag to close the file on an execve() call. |
1221 1222 These functions, as well as gzip, will read and decode a sequence of gzip 1223 streams in a file. The append function of gzopen() can be used to create 1224 such a file. (Also see gzflush() for another way to do this.) When 1225 appending, gzopen does not test whether the file begins with a gzip stream, 1226 nor does it look for the end of the gzip streams to begin appending. gzopen 1227 will simply append a gzip stream to the existing file. 1228 --- 344 unchanged lines hidden (view full) --- 1573 that the z_off_t type (like off_t) is a signed integer. If len2 is 1574 negative, the result has no meaning or utility. 1575*/ 1576 1577ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); 1578/* 1579 Update a running CRC-32 with the bytes buf[0..len-1] and return the 1580 updated CRC-32. If buf is Z_NULL, this function returns the required | 1227 1228 These functions, as well as gzip, will read and decode a sequence of gzip 1229 streams in a file. The append function of gzopen() can be used to create 1230 such a file. (Also see gzflush() for another way to do this.) When 1231 appending, gzopen does not test whether the file begins with a gzip stream, 1232 nor does it look for the end of the gzip streams to begin appending. gzopen 1233 will simply append a gzip stream to the existing file. 1234 --- 344 unchanged lines hidden (view full) --- 1579 that the z_off_t type (like off_t) is a signed integer. If len2 is 1580 negative, the result has no meaning or utility. 1581*/ 1582 1583ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); 1584/* 1585 Update a running CRC-32 with the bytes buf[0..len-1] and return the 1586 updated CRC-32. If buf is Z_NULL, this function returns the required |
1581 initial value for the for the crc. Pre- and post-conditioning (one's 1582 complement) is performed within this function so it shouldn't be done by the 1583 application. | 1587 initial value for the crc. Pre- and post-conditioning (one's complement) is 1588 performed within this function so it shouldn't be done by the application. |
1584 1585 Usage example: 1586 1587 uLong crc = crc32(0L, Z_NULL, 0); 1588 1589 while (read_buffer(buffer, length) != EOF) { 1590 crc = crc32(crc, buffer, length); 1591 } --- 53 unchanged lines hidden (view full) --- 1645 * behavior could change in the future, perhaps even capriciously. They can 1646 * only be used by the gzgetc() macro. You have been warned. 1647 */ 1648struct gzFile_s { 1649 unsigned have; 1650 unsigned char *next; 1651 z_off64_t pos; 1652}; | 1589 1590 Usage example: 1591 1592 uLong crc = crc32(0L, Z_NULL, 0); 1593 1594 while (read_buffer(buffer, length) != EOF) { 1595 crc = crc32(crc, buffer, length); 1596 } --- 53 unchanged lines hidden (view full) --- 1650 * behavior could change in the future, perhaps even capriciously. They can 1651 * only be used by the gzgetc() macro. You have been warned. 1652 */ 1653struct gzFile_s { 1654 unsigned have; 1655 unsigned char *next; 1656 z_off64_t pos; 1657}; |
1653ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); 1654#define gzgetc(g) \ 1655 ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc_(g)) | 1658ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ 1659#ifdef Z_PREFIX_SET 1660# undef z_gzgetc 1661# define z_gzgetc(g) \ 1662 ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) 1663#else 1664# define gzgetc(g) \ 1665 ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) 1666#endif |
1656 1657/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or 1658 * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if 1659 * both are true, the application gets the *64 functions, and the regular 1660 * functions are changed to 64 bits) -- in case these are set on systems 1661 * without large file support, _LFS64_LARGEFILE must also be true 1662 */ | 1667 1668/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or 1669 * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if 1670 * both are true, the application gets the *64 functions, and the regular 1671 * functions are changed to 64 bits) -- in case these are set on systems 1672 * without large file support, _LFS64_LARGEFILE must also be true 1673 */ |
1663#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 | 1674#ifdef Z_LARGE64 |
1664 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); 1665 ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); 1666 ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); 1667 ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); 1668 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); 1669 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); 1670#endif 1671 | 1675 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); 1676 ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); 1677 ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); 1678 ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); 1679 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); 1680 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); 1681#endif 1682 |
1672#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 | 1683#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) |
1673# ifdef Z_PREFIX_SET 1674# define z_gzopen z_gzopen64 1675# define z_gzseek z_gzseek64 1676# define z_gztell z_gztell64 1677# define z_gzoffset z_gzoffset64 1678# define z_adler32_combine z_adler32_combine64 1679# define z_crc32_combine z_crc32_combine64 1680# else 1681# define gzopen gzopen64 1682# define gzseek gzseek64 1683# define gztell gztell64 1684# define gzoffset gzoffset64 1685# define adler32_combine adler32_combine64 1686# define crc32_combine crc32_combine64 1687# endif | 1684# ifdef Z_PREFIX_SET 1685# define z_gzopen z_gzopen64 1686# define z_gzseek z_gzseek64 1687# define z_gztell z_gztell64 1688# define z_gzoffset z_gzoffset64 1689# define z_adler32_combine z_adler32_combine64 1690# define z_crc32_combine z_crc32_combine64 1691# else 1692# define gzopen gzopen64 1693# define gzseek gzseek64 1694# define gztell gztell64 1695# define gzoffset gzoffset64 1696# define adler32_combine adler32_combine64 1697# define crc32_combine crc32_combine64 1698# endif |
1688# ifndef _LARGEFILE64_SOURCE | 1699# ifndef Z_LARGE64 |
1689 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); 1690 ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); 1691 ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); 1692 ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); 1693 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); 1694 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); 1695# endif 1696#else --- 15 unchanged lines hidden (view full) --- 1712/* hack for buggy compilers */ 1713#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) 1714 struct internal_state {int dummy;}; 1715#endif 1716 1717/* undocumented functions */ 1718ZEXTERN const char * ZEXPORT zError OF((int)); 1719ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); | 1700 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); 1701 ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); 1702 ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); 1703 ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); 1704 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); 1705 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); 1706# endif 1707#else --- 15 unchanged lines hidden (view full) --- 1723/* hack for buggy compilers */ 1724#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) 1725 struct internal_state {int dummy;}; 1726#endif 1727 1728/* undocumented functions */ 1729ZEXTERN const char * ZEXPORT zError OF((int)); 1730ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); |
1720ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); | 1731ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); |
1721ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); 1722ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); 1723ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); | 1732ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); 1733ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); 1734ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); |
1724#ifndef Z_SOLO 1725 ZEXTERN unsigned long ZEXPORT gzflags OF((void)); | 1735#if defined(_WIN32) && !defined(Z_SOLO) 1736ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, 1737 const char *mode)); |
1726#endif 1727 1728#ifdef __cplusplus 1729} 1730#endif 1731 1732#endif /* ZLIB_H */ | 1738#endif 1739 1740#ifdef __cplusplus 1741} 1742#endif 1743 1744#endif /* ZLIB_H */ |