summaryrefslogtreecommitdiff
path: root/zlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'zlib.h')
-rw-r--r--zlib.h109
1 files changed, 87 insertions, 22 deletions
diff --git a/zlib.h b/zlib.h
index 2d239a2..95370d4 100644
--- a/zlib.h
+++ b/zlib.h
@@ -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.1, March 17th, 2003 2 version 1.2.0.2, July 13th, 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
@@ -28,8 +28,8 @@
28 (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). 28 (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
29*/ 29*/
30 30
31#ifndef _ZLIB_H 31#ifndef ZLIB_H
32#define _ZLIB_H 32#define ZLIB_H
33 33
34#include "zconf.h" 34#include "zconf.h"
35 35
@@ -37,7 +37,8 @@
37extern "C" { 37extern "C" {
38#endif 38#endif
39 39
40#define ZLIB_VERSION "1.2.0.1" 40#define ZLIB_VERSION "1.2.0.2"
41#define ZLIB_VERNUM 0x1202
41 42
42/* 43/*
43 The 'zlib' compression library provides in-memory compression and 44 The 'zlib' compression library provides in-memory compression and
@@ -334,9 +335,9 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
334ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); 335ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
335/* 336/*
336 inflate decompresses as much data as possible, and stops when the input 337 inflate decompresses as much data as possible, and stops when the input
337 buffer becomes empty or the output buffer becomes full. It may some 338 buffer becomes empty or the output buffer becomes full. It may introduce
338 introduce some output latency (reading input without producing any output) 339 some output latency (reading input without producing any output) except when
339 except when forced to flush. 340 forced to flush.
340 341
341 The detailed semantics are as follows. inflate performs one or both of the 342 The detailed semantics are as follows. inflate performs one or both of the
342 following actions: 343 following actions:
@@ -586,20 +587,28 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
586 The windowBits parameter is the base two logarithm of the maximum window 587 The windowBits parameter is the base two logarithm of the maximum window
587 size (the size of the history buffer). It should be in the range 8..15 for 588 size (the size of the history buffer). It should be in the range 8..15 for
588 this version of the library. The default value is 15 if inflateInit is used 589 this version of the library. The default value is 15 if inflateInit is used
589 instead. If a compressed stream with a larger window size is given as 590 instead. windowBits must be greater than or equal to the windowBits value
590 input, inflate() will return with the error code Z_DATA_ERROR instead of 591 provided to deflateInit2() while compressing, or it must be equal to 15 if
591 trying to allocate a larger window. 592 deflateInit2() was not used. If a compressed stream with a larger window
592 593 size is given as input, inflate() will return with the error code
593 windowBits can also be -8..-15 for raw inflate. In this case, -windowBits 594 Z_DATA_ERROR instead of trying to allocate a larger window.
594 determines the window size. inflate() will then process raw deflate data, 595
596 windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
597 determines the window size. inflate() will then process raw deflate data,
595 not looking for a zlib or gzip header, not generating a check value, and not 598 not looking for a zlib or gzip header, not generating a check value, and not
596 looking for any check values for comparison at the end of the stream. This 599 looking for any check values for comparison at the end of the stream. This
597 is for use with other formats that use the deflate compressed data format 600 is for use with other formats that use the deflate compressed data format
598 such as zip. Those formats provide their own check values. If a custom 601 such as zip. Those formats provide their own check values. If a custom
599 format is developed using the raw deflate format for compressed data, it is 602 format is developed using the raw deflate format for compressed data, it is
600 recommended that a check value such as an adler32 or a crc32 be applied to 603 recommended that a check value such as an adler32 or a crc32 be applied to
601 the uncompressed data as is done in the zlib, gzip, and zip formats. For 604 the uncompressed data as is done in the zlib, gzip, and zip formats. For
602 most applications, the zlib format should be used as is. 605 most applications, the zlib format should be used as is. Note that comments
606 above on the use in deflateInit2() applies to the magnitude of windowBits.
607
608 windowBits can also be greater than 15 for optional gzip decoding. Add
609 32 to windowBits to enable zlib and gzip decoding with automatic header
610 detection, or add 16 to decode only the gzip format (the zlib format will
611 return a Z_DATA_ERROR).
603 612
604 inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 613 inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
605 memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative 614 memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
@@ -771,6 +780,45 @@ ZEXTERN int ZEXPORT inflateBackEnd(z_stream FAR *strm);
771 state was inconsistent. 780 state was inconsistent.
772*/ 781*/
773 782
783ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
784/* Return flags indicating compile-time options.
785
786 Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
787 1.0: size of uInt
788 3.2: size of uLong
789 5.4: size of voidpf (pointers)
790 7.6: size of z_off_t
791
792 Debug options:
793 8: DEBUG
794 9-11: 0 (reserved)
795
796 One-time table building (smaller code, but not thread-safe if true):
797 12: BUILDFIXED -- build static block decoding tables when needed
798 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
799 14,15: 0 (reserved)
800
801 Library content (indicates missing functionality):
802 16: NO_DEFLATE -- gz* functions cannot compress (to avoid linking deflate
803 code when not needed)
804 17: NO_GUNZIP -- inflate can't detect and decode gzip streams, to avoid
805 linking crc code
806 18-19: 0 (reserved)
807
808 Operation variations (changes in library functionality):
809 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
810 21: FASTEST -- deflate algorithm with only one, lowest compression level
811 22,23: 0 (reserved)
812
813 The sprintf variant used by gzprintf (zero is best):
814 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
815 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
816 26: 0 = returns value, 1 = void -- 1 means inferred string length returned
817
818 Remainder:
819 27-31: 0 (reserved)
820 */
821
774 822
775 /* utility functions */ 823 /* utility functions */
776 824
@@ -901,10 +949,10 @@ ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
901 control of the format string, as in fprintf. gzprintf returns the number of 949 control of the format string, as in fprintf. gzprintf returns the number of
902 uncompressed bytes actually written (0 in case of error). The number of 950 uncompressed bytes actually written (0 in case of error). The number of
903 uncompressed bytes written is limited to 4095. The caller should assure that 951 uncompressed bytes written is limited to 4095. The caller should assure that
904 this limit is not exceeded. If it is exceeded, then either gzprintf() will 952 this limit is not exceeded. If it is exceeded, then gzprintf() will return
905 return an error (0) with nothing written, or there will be a buffer overflow 953 return an error (0) with nothing written. In this case, there may also be a
906 with unpredictable consequences. The latter is possible only if zlib was 954 buffer overflow with unpredictable consequences, which is possible only if
907 compiled with insecure variants of printf, i.e. sprintf() or vsprintf() 955 zlib was compiled with the insecure functions sprintf() or vsprintf()
908 because the secure snprintf() or vsnprintf() functions were not available. 956 because the secure snprintf() or vsnprintf() functions were not available.
909*/ 957*/
910 958
@@ -936,6 +984,16 @@ ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
936 or -1 in case of end of file or error. 984 or -1 in case of end of file or error.
937*/ 985*/
938 986
987ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
988/*
989 Push one character back onto the stream to be read again later.
990 Only one character of push-back is allowed. gzungetc() returns the
991 character pushed, or -1 on failure. gzungetc() will fail if a
992 character has been pushed but not read yet, or if c is -1. The pushed
993 character will be discarded if the stream is repositioned with gzseek()
994 or gzrewind().
995*/
996
939ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); 997ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
940/* 998/*
941 Flushes all pending output into the compressed file. The parameter 999 Flushes all pending output into the compressed file. The parameter
@@ -1002,6 +1060,13 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
1002 to get the exact error code. 1060 to get the exact error code.
1003*/ 1061*/
1004 1062
1063ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
1064/*
1065 Clears the error and end-of-file flags for file. This is analogous to the
1066 clearerr() function in stdio. This is useful for continuing to read a gzip
1067 file that is being written concurrently.
1068*/
1069
1005 /* checksum functions */ 1070 /* checksum functions */
1006 1071
1007/* 1072/*
@@ -1077,7 +1142,7 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits,
1077 ZLIB_VERSION, sizeof(z_stream)) 1142 ZLIB_VERSION, sizeof(z_stream))
1078 1143
1079 1144
1080#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) 1145#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
1081 struct internal_state {int dummy;}; /* hack for buggy compilers */ 1146 struct internal_state {int dummy;}; /* hack for buggy compilers */
1082#endif 1147#endif
1083 1148
@@ -1089,4 +1154,4 @@ ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
1089} 1154}
1090#endif 1155#endif
1091 1156
1092#endif /* _ZLIB_H */ 1157#endif /* ZLIB_H */