diff options
Diffstat (limited to 'zlib.h')
-rw-r--r-- | zlib.h | 37 |
1 files changed, 22 insertions, 15 deletions
@@ -1,5 +1,5 @@ | |||
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.0, March 9th, 2003 | 2 | version 1.2.0.1, March 17th, 2003 |
3 | 3 | ||
4 | Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler | 4 | Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler |
5 | 5 | ||
@@ -37,7 +37,7 @@ | |||
37 | extern "C" { | 37 | extern "C" { |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #define ZLIB_VERSION "1.2.0" | 40 | #define ZLIB_VERSION "1.2.0.1" |
41 | 41 | ||
42 | /* | 42 | /* |
43 | The 'zlib' compression library provides in-memory compression and | 43 | The 'zlib' compression library provides in-memory compression and |
@@ -165,6 +165,7 @@ typedef z_stream FAR *z_streamp; | |||
165 | 165 | ||
166 | #define Z_FILTERED 1 | 166 | #define Z_FILTERED 1 |
167 | #define Z_HUFFMAN_ONLY 2 | 167 | #define Z_HUFFMAN_ONLY 2 |
168 | #define Z_RLE 3 | ||
168 | #define Z_DEFAULT_STRATEGY 0 | 169 | #define Z_DEFAULT_STRATEGY 0 |
169 | /* compression strategy; see deflateInit2() below for details */ | 170 | /* compression strategy; see deflateInit2() below for details */ |
170 | 171 | ||
@@ -461,14 +462,16 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, | |||
461 | 462 | ||
462 | The strategy parameter is used to tune the compression algorithm. Use the | 463 | The strategy parameter is used to tune the compression algorithm. Use the |
463 | value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a | 464 | value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a |
464 | filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no | 465 | filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no |
465 | string match). Filtered data consists mostly of small values with a | 466 | string match), or Z_RLE to limit match distances to one (run-length |
466 | somewhat random distribution. In this case, the compression algorithm is | 467 | encoding). Filtered data consists mostly of small values with a somewhat |
467 | tuned to compress them better. The effect of Z_FILTERED is to force more | 468 | random distribution. In this case, the compression algorithm is tuned to |
468 | Huffman coding and less string matching; it is somewhat intermediate | 469 | compress them better. The effect of Z_FILTERED is to force more Huffman |
469 | between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects | 470 | coding and less string matching; it is somewhat intermediate between |
470 | the compression ratio but not the correctness of the compressed output even | 471 | Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as |
471 | if it is not set appropriately. | 472 | Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy |
473 | parameter only affects the compression ratio but not the correctness of the | ||
474 | compressed output even if it is not set appropriately. | ||
472 | 475 | ||
473 | deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | 476 | deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough |
474 | memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid | 477 | memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid |
@@ -843,8 +846,9 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | |||
843 | Opens a gzip (.gz) file for reading or writing. The mode parameter | 846 | Opens a gzip (.gz) file for reading or writing. The mode parameter |
844 | is as in fopen ("rb" or "wb") but can also include a compression level | 847 | is as in fopen ("rb" or "wb") but can also include a compression level |
845 | ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for | 848 | ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for |
846 | Huffman only compression as in "wb1h". (See the description | 849 | Huffman only compression as in "wb1h", or 'R' for run-length encoding |
847 | of deflateInit2 for more information about the strategy parameter.) | 850 | as in "wb1R". (See the description of deflateInit2 for more information |
851 | about the strategy parameter.) | ||
848 | 852 | ||
849 | gzopen can be used to read a file which is not in gzip format; in this | 853 | gzopen can be used to read a file which is not in gzip format; in this |
850 | case gzread will directly read from the file without decompression. | 854 | case gzread will directly read from the file without decompression. |
@@ -896,9 +900,12 @@ ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); | |||
896 | Converts, formats, and writes the args to the compressed file under | 900 | Converts, formats, and writes the args to the compressed file under |
897 | control of the format string, as in fprintf. gzprintf returns the number of | 901 | control of the format string, as in fprintf. gzprintf returns the number of |
898 | uncompressed bytes actually written (0 in case of error). The number of | 902 | uncompressed bytes actually written (0 in case of error). The number of |
899 | uncompressed bytes written is limited to 4095. The caller should assure | 903 | uncompressed bytes written is limited to 4095. The caller should assure that |
900 | that this limit is not exceeded, since otherwise a buffer overflow may | 904 | this limit is not exceeded. If it is exceeded, then either gzprintf() will |
901 | result. | 905 | return an error (0) with nothing written, or there will be a buffer overflow |
906 | with unpredictable consequences. The latter is possible only if zlib was | ||
907 | compiled with insecure variants of printf, i.e. sprintf() or vsprintf() | ||
908 | because the secure snprintf() or vsnprintf() functions were not available. | ||
902 | */ | 909 | */ |
903 | 910 | ||
904 | ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); | 911 | ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); |