summaryrefslogtreecommitdiff
path: root/zlib.h
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 22:52:17 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 22:52:17 -0700
commit913afb9174bb474104049906c1382dec81826424 (patch)
tree46bb8ca746088f81382b4f33970b9d43c33d9ba3 /zlib.h
parentbcf78a20978d76f64b7cd46d1a4d7a79a578c77b (diff)
downloadzlib-0.79.tar.gz
zlib-0.79.tar.bz2
zlib-0.79.zip
zlib 0.79v0.79
Diffstat (limited to '')
-rw-r--r--zlib.h96
1 files changed, 47 insertions, 49 deletions
diff --git a/zlib.h b/zlib.h
index d1f2ca9..6983fb7 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 0.7 April 14th, 1995. 2 version 0.79 April 28th, 1995.
3 3
4 Copyright (C) 1995 Jean-loup Gailly and Mark Adler 4 Copyright (C) 1995 Jean-loup Gailly and Mark Adler
5 5
@@ -28,7 +28,7 @@
28 28
29#include "zconf.h" 29#include "zconf.h"
30 30
31#define ZLIB_VERSION "0.7" 31#define ZLIB_VERSION "0.79"
32 32
33/* 33/*
34 The 'zlib' compression library provides in-memory compression and 34 The 'zlib' compression library provides in-memory compression and
@@ -88,7 +88,7 @@ typedef struct z_stream_s {
88 88
89 zalloc must return Z_NULL if there is not enough memory for the object. 89 zalloc must return Z_NULL if there is not enough memory for the object.
90 On 16-bit systems, the functions zalloc and zfree must be able to allocate 90 On 16-bit systems, the functions zalloc and zfree must be able to allocate
91 exactly 65536 bytes, but will not be require to allocate more than this 91 exactly 65536 bytes, but will not be required to allocate more than this
92 if the symbol MAXSEG_64K is defined (see zconf.h). 92 if the symbol MAXSEG_64K is defined (see zconf.h).
93 93
94 The fields total_in and total_out can be used for statistics or 94 The fields total_in and total_out can be used for statistics or
@@ -152,10 +152,10 @@ extern int deflateInit __P((z_stream *strm, int level));
152 to level 6). 152 to level 6).
153 153
154 deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not 154 deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
155 enough memory, Z_STREAM_ERROR if the stream state was inconsistent (such 155 enough memory, Z_STREAM_ERROR if level is not a valid compression level.
156 as zalloc being NULL). msg is set to null if there is no error message. 156 msg is set to null if there is no error message. deflateInit does not
157 deflateInit does not perform any compression: this will be done by 157 perform any compression: this will be done by deflate().
158 deflate(). */ 158*/
159 159
160 160
161extern int deflate __P((z_stream *strm, int flush)); 161extern int deflate __P((z_stream *strm, int flush));
@@ -164,8 +164,8 @@ extern int deflate __P((z_stream *strm, int flush));
164 164
165 - Compress more input starting at next_in and update next_in and avail_in 165 - Compress more input starting at next_in and update next_in and avail_in
166 accordingly. If not all input can be processed (because there is not 166 accordingly. If not all input can be processed (because there is not
167 enough room in the output buffer), next_in is updated and processing 167 enough room in the output buffer), next_in and avail_in are updated and
168 will resume at this point for the next call of deflate(). 168 processing will resume at this point for the next call of deflate().
169 169
170 - Provide more output starting at next_out and update next_out and avail_out 170 - Provide more output starting at next_out and update next_out and avail_out
171 accordingly. This action is forced if the parameter flush is non zero. 171 accordingly. This action is forced if the parameter flush is non zero.
@@ -175,20 +175,21 @@ extern int deflate __P((z_stream *strm, int flush));
175 175
176 Before the call of deflate(), the application should ensure that at least 176 Before the call of deflate(), the application should ensure that at least
177 one of the actions is possible, by providing more input and/or consuming 177 one of the actions is possible, by providing more input and/or consuming
178 more output, and updating avail_in or avail_out accordingly. 178 more output, and updating avail_in or avail_out accordingly; avail_out
179 The application can consume the compressed output when the output 179 should never be zero before the call. The application can consume the
180 buffer is full (avail_out == 0), or after each call of deflate(). 180 compressed output when it wants, for example when the output buffer is full
181 (avail_out == 0), or after each call of deflate().
181 182
182 If the parameter flush is set to Z_PARTIAL_FLUSH, the current compression 183 If the parameter flush is set to Z_PARTIAL_FLUSH, the current compression
183 block is byte aligned and flushed to the output buffer so that the 184 block is terminated and flushed to the output buffer so that the
184 decompressor can get all input data available so far; if the compression 185 decompressor can get all input data available so far. For method 9, a future
185 method is 8 (deflate without partial flush capability), the current block 186 variant on method 8, the current block will be flushed but not terminated.
186 is terminated. If flush is set to Z_FULL_FLUSH, the compression block is 187 If flush is set to Z_FULL_FLUSH, the compression block is terminated, a
187 terminated, a special marker is output and the compression dictionary is 188 special marker is output and the compression dictionary is discarded; this
188 discarded; this is useful to allow the decompressor to synchronize if one 189 is useful to allow the decompressor to synchronize if one compressed block
189 compressed block has been damaged. 190 has been damaged (see inflateSync below). Flushing degrades compression and
190 Flushing degrades compression and so should be used only when necessary. 191 so should be used only when necessary. Using Z_FULL_FLUSH too often can
191 Using Z_FULL_FLUSH too often can seriously degrade the compression. 192 seriously degrade the compression.
192 193
193 If the parameter flush is set to Z_FINISH, all pending input is 194 If the parameter flush is set to Z_FINISH, all pending input is
194 processed and all pending output is flushed. The next operation on this 195 processed and all pending output is flushed. The next operation on this
@@ -197,19 +198,18 @@ extern int deflate __P((z_stream *strm, int flush));
197 or a call of deflateEnd to deallocate the compression state. Z_FINISH can 198 or a call of deflateEnd to deallocate the compression state. Z_FINISH can
198 be used immediately after deflateInit if all the compression is to be 199 be used immediately after deflateInit if all the compression is to be
199 done in a single step. In this case, avail_out must be at least 0.1% 200 done in a single step. In this case, avail_out must be at least 0.1%
200 larger than avail_in plus 8 bytes. 201 larger than avail_in plus 12 bytes.
201 202
202 deflate() may update strm->data_type if it can make a good guess about 203 deflate() may update data_type if it can make a good guess about
203 the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered 204 the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
204 binary. This field is only for information purposes and does not affect 205 binary. This field is only for information purposes and does not affect
205 the compression algorithm in any manner. 206 the compression algorithm in any manner.
206 207
207 deflate() return Z_OK if some progress has been made (more input processed 208 deflate() returns Z_OK if some progress has been made (more input processed
208 or more output produced), Z_STREAM_ERROR if the stream state was 209 or more output produced), Z_STREAM_ERROR if the stream state was
209 inconsistent (for example if next_in or next_out was NULL), Z_BUF_ERROR if 210 inconsistent (for example if next_in or next_out was NULL), Z_BUF_ERROR if
210 no progress is possible or if there was not enough room in the output buffer 211 no progress is possible or if there was not enough room in the output buffer
211 when Z_FINISH is used. 212 when Z_FINISH is used. ??? to be changed (use Z_STEAM_END) */
212*/
213 213
214 214
215extern int deflateEnd __P((z_stream *strm)); 215extern int deflateEnd __P((z_stream *strm));
@@ -232,8 +232,7 @@ extern int inflateInit __P((z_stream *strm));
232 functions. 232 functions.
233 233
234 inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not 234 inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
235 enough memory, Z_STREAM_ERROR if the stream state was inconsistent (such 235 enough memory. msg is set to null if there is no error message.
236 as zalloc being NULL). msg is set to null if there is no error message.
237 inflateInit does not perform any decompression: this will be done by 236 inflateInit does not perform any decompression: this will be done by
238 inflate(). 237 inflate().
239*/ 238*/
@@ -255,8 +254,9 @@ extern int inflate __P((z_stream *strm, int flush));
255 Before the call of inflate(), the application should ensure that at least 254 Before the call of inflate(), the application should ensure that at least
256 one of the actions is possible, by providing more input and/or consuming 255 one of the actions is possible, by providing more input and/or consuming
257 more output, and updating the next_* and avail_* values accordingly. 256 more output, and updating the next_* and avail_* values accordingly.
258 The application can consume the uncompressed output when the output 257 The application can consume the uncompressed output when it wants, for
259 buffer is full (avail_out == 0), or after each call of inflate(). 258 example when the output buffer is full (avail_out == 0), or after each
259 call of inflate().
260 260
261 If the parameter flush is set to Z_PARTIAL_FLUSH, inflate flushes as much 261 If the parameter flush is set to Z_PARTIAL_FLUSH, inflate flushes as much
262 output as possible to the output buffer. The flushing behavior of inflate is 262 output as possible to the output buffer. The flushing behavior of inflate is
@@ -275,13 +275,13 @@ extern int inflate __P((z_stream *strm, int flush));
275 275
276 inflate() returns Z_OK if some progress has been made (more input 276 inflate() returns Z_OK if some progress has been made (more input
277 processed or more output produced), Z_STREAM_END if the end of the 277 processed or more output produced), Z_STREAM_END if the end of the
278 compressed data has been reached, Z_DATA_ERROR if the input data was 278 compressed data has been reached and all uncompressed output has been
279 corrupted, Z_STREAM_ERROR if the stream structure was inconsistent (for 279 produced, Z_DATA_ERROR if the input data was corrupted, Z_STREAM_ERROR if
280 example if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough 280 the stream structure was inconsistent (for example if next_in or next_out
281 memory, Z_BUF_ERROR if no progress is possible or if there was not enough 281 was NULL), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no
282 room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, 282 progress is possible or if there was not enough room in the output buffer
283 the application may then call inflateSync to look for a good compression 283 when Z_FINISH is used. In the Z_DATA_ERROR case, the application may then
284 block. 284 call inflateSync to look for a good compression block.
285*/ 285*/
286 286
287 287
@@ -318,9 +318,9 @@ extern int deflateInit2 __P((z_stream *strm,
318 318
319 The windowBits parameter is the base two logarithm of the window size 319 The windowBits parameter is the base two logarithm of the window size
320 (the size of the history buffer). It should be in the range 8..15 for this 320 (the size of the history buffer). It should be in the range 8..15 for this
321 version of the library (the value 16 will be allowed soon). Larger values 321 version of the library (the value 16 will be allowed for method 9). Larger
322 of this parameter result in better compression at the expense of memory 322 values of this parameter result in better compression at the expense of
323 usage. The default value is 15 if deflateInit is used instead. 323 memory usage. The default value is 15 if deflateInit is used instead.
324 324
325 The memLevel parameter specifies how much memory should be allocated 325 The memLevel parameter specifies how much memory should be allocated
326 for the internal compression state. memLevel=1 uses minimum memory but 326 for the internal compression state. memLevel=1 uses minimum memory but
@@ -338,8 +338,8 @@ extern int deflateInit2 __P((z_stream *strm,
338 338
339 If next_in is not null, the library will use this buffer to hold also 339 If next_in is not null, the library will use this buffer to hold also
340 some history information; the buffer must either hold the entire input 340 some history information; the buffer must either hold the entire input
341 data, or have at least (1<<windowBits) bytes and be writable. If next_in is 341 data, or have at least 1<<(windowBits+1) bytes and be writable. If next_in
342 null, the library will allocate its own history buffer (and leave next_in 342 is null, the library will allocate its own history buffer (and leave next_in
343 null). next_out need not be provided here but must be provided by the 343 null). next_out need not be provided here but must be provided by the
344 application for the next call of deflate(). 344 application for the next call of deflate().
345 345
@@ -350,8 +350,7 @@ extern int deflateInit2 __P((z_stream *strm,
350 reset by the library in this case. 350 reset by the library in this case.
351 351
352 deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was 352 deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was
353 not enough memory, Z_STREAM_ERROR if the stream state was inconsistent 353 not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as
354 (such as zalloc being NULL) or the parameters are invalid (such as
355 an invalid method). msg is set to null if there is no error message. 354 an invalid method). msg is set to null if there is no error message.
356 deflateInit2 does not perform any compression: this will be done by 355 deflateInit2 does not perform any compression: this will be done by
357 deflate(). 356 deflate().
@@ -406,7 +405,7 @@ extern int inflateInit2 __P((z_stream *strm,
406 405
407 If next_out is not null, the library will use this buffer for the history 406 If next_out is not null, the library will use this buffer for the history
408 buffer; the buffer must either be large enough to hold the entire output 407 buffer; the buffer must either be large enough to hold the entire output
409 data, or have at least 1<<(windowBits-1) bytes. If next_out is null, the 408 data, or have at least 1<<windowBits bytes. If next_out is null, the
410 library will allocate its own buffer (and leave next_out null). next_in 409 library will allocate its own buffer (and leave next_out null). next_in
411 need not be provided here but must be provided by the application for the 410 need not be provided here but must be provided by the application for the
412 next call of inflate(). 411 next call of inflate().
@@ -418,9 +417,8 @@ extern int inflateInit2 __P((z_stream *strm,
418 avail_out is zero and all output has been consumed. 417 avail_out is zero and all output has been consumed.
419 418
420 inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was 419 inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was
421 not enough memory, Z_STREAM_ERROR if the stream state was inconsistent 420 not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as
422 (such as zalloc being NULL) or the parameters are invalid (such as 421 windowBits < 8). msg is set to null if there is no error message.
423 windowBits < 9). msg is set to null if there is no error message.
424 inflateInit2 does not perform any compression: this will be done by 422 inflateInit2 does not perform any compression: this will be done by
425 inflate(). 423 inflate().
426*/ 424*/
@@ -585,7 +583,7 @@ extern uLong crc32 __P((uLong crc, Byte *buf, uInt len));
585/* 583/*
586 Update a running crc with the bytes buf[0..len-1] and return the updated 584 Update a running crc with the bytes buf[0..len-1] and return the updated
587 crc. If buf is NULL, this function returns the required initial value 585 crc. If buf is NULL, this function returns the required initial value
588 for the crc (0). Pre- and post-conditioning (one's complement) is performed 586 for the crc. Pre- and post-conditioning (one's complement) is performed
589 within this function so it shouldn't be done by the application. 587 within this function so it shouldn't be done by the application.
590 Usage example: 588 Usage example:
591 589