diff options
Diffstat (limited to 'zlib.h')
-rw-r--r-- | zlib.h | 169 |
1 files changed, 125 insertions, 44 deletions
@@ -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.3.3, October 2nd, 2006 | 2 | version 1.2.3.4, December 21st, 2009 |
3 | 3 | ||
4 | Copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler | 4 | Copyright (C) 1995-2009 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 |
@@ -37,8 +37,8 @@ | |||
37 | extern "C" { | 37 | extern "C" { |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #define ZLIB_VERSION "1.2.3.3" | 40 | #define ZLIB_VERSION "1.2.3.4" |
41 | #define ZLIB_VERNUM 0x1233 | 41 | #define ZLIB_VERNUM 0x1234 |
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 3 | 44 | #define ZLIB_VER_REVISION 3 |
@@ -163,11 +163,12 @@ typedef gz_header FAR *gz_headerp; | |||
163 | /* constants */ | 163 | /* constants */ |
164 | 164 | ||
165 | #define Z_NO_FLUSH 0 | 165 | #define Z_NO_FLUSH 0 |
166 | #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ | 166 | #define Z_PARTIAL_FLUSH 1 |
167 | #define Z_SYNC_FLUSH 2 | 167 | #define Z_SYNC_FLUSH 2 |
168 | #define Z_FULL_FLUSH 3 | 168 | #define Z_FULL_FLUSH 3 |
169 | #define Z_FINISH 4 | 169 | #define Z_FINISH 4 |
170 | #define Z_BLOCK 5 | 170 | #define Z_BLOCK 5 |
171 | #define Z_TREES 6 | ||
171 | /* Allowed flush values; see deflate() and inflate() below for details */ | 172 | /* Allowed flush values; see deflate() and inflate() below for details */ |
172 | 173 | ||
173 | #define Z_OK 0 | 174 | #define Z_OK 0 |
@@ -273,7 +274,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); | |||
273 | output buffer because there might be more output pending. | 274 | output buffer because there might be more output pending. |
274 | 275 | ||
275 | Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to | 276 | Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to |
276 | decide how much data to accumualte before producing output, in order to | 277 | decide how much data to accumulate before producing output, in order to |
277 | maximize compression. | 278 | maximize compression. |
278 | 279 | ||
279 | If the parameter flush is set to Z_SYNC_FLUSH, all pending output is | 280 | If the parameter flush is set to Z_SYNC_FLUSH, all pending output is |
@@ -281,7 +282,26 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); | |||
281 | that the decompressor can get all input data available so far. (In particular | 282 | that the decompressor can get all input data available so far. (In particular |
282 | avail_in is zero after the call if enough output space has been provided | 283 | avail_in is zero after the call if enough output space has been provided |
283 | before the call.) Flushing may degrade compression for some compression | 284 | before the call.) Flushing may degrade compression for some compression |
284 | algorithms and so it should be used only when necessary. | 285 | algorithms and so it should be used only when necessary. This completes the |
286 | current deflate block and follows it with an empty stored block that is three | ||
287 | bits plus filler bits to the next byte, followed by four bytes (00 00 ff ff). | ||
288 | |||
289 | If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the | ||
290 | output buffer, but the output is not aligned to a byte boundary. All of the | ||
291 | input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. | ||
292 | This completes the current deflate block and follows it with an empty fixed | ||
293 | codes block that is 10 bits long. This assures that enough bytes are output | ||
294 | in order for the decompressor to finish the block before the empty fixed code | ||
295 | block. | ||
296 | |||
297 | If flush is set to Z_BLOCK, a deflate block is completed and emitted, as | ||
298 | for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to | ||
299 | seven bits of the current block are held to be written as the next byte after | ||
300 | the next deflate block is completed. In this case, the decompressor may not | ||
301 | be provided enough bits at this point in order to complete decompression of | ||
302 | the data provided so far to the compressor. It may need to wait for the next | ||
303 | block to be emitted. This is for advanced applications that need to control | ||
304 | the emission of deflate blocks. | ||
285 | 305 | ||
286 | If flush is set to Z_FULL_FLUSH, all output is flushed as with | 306 | If flush is set to Z_FULL_FLUSH, all output is flushed as with |
287 | Z_SYNC_FLUSH, and the compression state is reset so that decompression can | 307 | Z_SYNC_FLUSH, and the compression state is reset so that decompression can |
@@ -321,7 +341,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); | |||
321 | processed or more output produced), Z_STREAM_END if all input has been | 341 | processed or more output produced), Z_STREAM_END if all input has been |
322 | consumed and all output has been produced (only when flush is set to | 342 | consumed and all output has been produced (only when flush is set to |
323 | Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example | 343 | Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example |
324 | if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible | 344 | if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible |
325 | (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not | 345 | (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not |
326 | fatal, and deflate() can be called again with more input and more output | 346 | fatal, and deflate() can be called again with more input and more output |
327 | space to continue compressing. | 347 | space to continue compressing. |
@@ -396,8 +416,8 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); | |||
396 | must be called again after making room in the output buffer because there | 416 | must be called again after making room in the output buffer because there |
397 | might be more output pending. | 417 | might be more output pending. |
398 | 418 | ||
399 | The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, | 419 | The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, |
400 | Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much | 420 | Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much |
401 | output as possible to the output buffer. Z_BLOCK requests that inflate() stop | 421 | output as possible to the output buffer. Z_BLOCK requests that inflate() stop |
402 | if and when it gets to the next deflate block boundary. When decoding the | 422 | if and when it gets to the next deflate block boundary. When decoding the |
403 | zlib or gzip format, this will cause inflate() to return immediately after | 423 | zlib or gzip format, this will cause inflate() to return immediately after |
@@ -415,7 +435,16 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); | |||
415 | uncompressed data from that block has been written to strm->next_out. The | 435 | uncompressed data from that block has been written to strm->next_out. The |
416 | number of unused bits may in general be greater than seven, except when | 436 | number of unused bits may in general be greater than seven, except when |
417 | bit 7 of data_type is set, in which case the number of unused bits will be | 437 | bit 7 of data_type is set, in which case the number of unused bits will be |
418 | less than eight. | 438 | less than eight. data_type is set as noted here every time inflate() |
439 | returns for all flush options, and so can be used to determine the amount | ||
440 | of currently consumed input in bits. | ||
441 | |||
442 | The Z_TREES option behaves as Z_BLOCK does, but it also returns when the | ||
443 | end of each deflate block header is reached, before any actual data in that | ||
444 | block is decoded. This allows the caller to determine the length of the | ||
445 | deflate block header for later use in random access within a deflate block. | ||
446 | 256 is added to the value of strm->data_type when inflate() returns | ||
447 | immediately after reaching the end of the deflate block header. | ||
419 | 448 | ||
420 | inflate() should normally be called until it returns Z_STREAM_END or an | 449 | inflate() should normally be called until it returns Z_STREAM_END or an |
421 | error. However if all decompression is to be performed in a single step | 450 | error. However if all decompression is to be performed in a single step |
@@ -432,7 +461,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); | |||
432 | possible to the output buffer, and always uses the faster approach on the | 461 | possible to the output buffer, and always uses the faster approach on the |
433 | first call. So the only effect of the flush parameter in this implementation | 462 | first call. So the only effect of the flush parameter in this implementation |
434 | is on the return value of inflate(), as noted below, or when it returns early | 463 | is on the return value of inflate(), as noted below, or when it returns early |
435 | because Z_BLOCK is used. | 464 | because Z_BLOCK or Z_TREES is used. |
436 | 465 | ||
437 | If a preset dictionary is needed after this call (see inflateSetDictionary | 466 | If a preset dictionary is needed after this call (see inflateSetDictionary |
438 | below), inflate sets strm->adler to the adler32 checksum of the dictionary | 467 | below), inflate sets strm->adler to the adler32 checksum of the dictionary |
@@ -443,12 +472,12 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); | |||
443 | checksum is equal to that saved by the compressor and returns Z_STREAM_END | 472 | checksum is equal to that saved by the compressor and returns Z_STREAM_END |
444 | only if the checksum is correct. | 473 | only if the checksum is correct. |
445 | 474 | ||
446 | inflate() will decompress and check either zlib-wrapped or gzip-wrapped | 475 | inflate() can decompress and check either zlib-wrapped or gzip-wrapped |
447 | deflate data. The header type is detected automatically. Any information | 476 | deflate data. The header type is detected automatically, if requested when |
448 | contained in the gzip header is not retained, so applications that need that | 477 | initializing with inflateInit2(). Any information contained in the gzip |
449 | information should instead use raw inflate, see inflateInit2() below, or | 478 | header is not retained, so applications that need that information should |
450 | inflateBack() and perform their own processing of the gzip header and | 479 | instead use raw inflate, see inflateInit2() below, or inflateBack() and |
451 | trailer. | 480 | perform their own processing of the gzip header and trailer. |
452 | 481 | ||
453 | inflate() returns Z_OK if some progress has been made (more input processed | 482 | inflate() returns Z_OK if some progress has been made (more input processed |
454 | or more output produced), Z_STREAM_END if the end of the compressed data has | 483 | or more output produced), Z_STREAM_END if the end of the compressed data has |
@@ -456,7 +485,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); | |||
456 | preset dictionary is needed at this point, Z_DATA_ERROR if the input data was | 485 | preset dictionary is needed at this point, Z_DATA_ERROR if the input data was |
457 | corrupted (input stream not conforming to the zlib format or incorrect check | 486 | corrupted (input stream not conforming to the zlib format or incorrect check |
458 | value), Z_STREAM_ERROR if the stream structure was inconsistent (for example | 487 | value), Z_STREAM_ERROR if the stream structure was inconsistent (for example |
459 | if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, | 488 | next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, |
460 | Z_BUF_ERROR if no progress is possible or if there was not enough room in the | 489 | Z_BUF_ERROR if no progress is possible or if there was not enough room in the |
461 | output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and | 490 | output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and |
462 | inflate() can be called again with more input and more output space to | 491 | inflate() can be called again with more input and more output space to |
@@ -529,12 +558,12 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, | |||
529 | random distribution. In this case, the compression algorithm is tuned to | 558 | random distribution. In this case, the compression algorithm is tuned to |
530 | compress them better. The effect of Z_FILTERED is to force more Huffman | 559 | compress them better. The effect of Z_FILTERED is to force more Huffman |
531 | coding and less string matching; it is somewhat intermediate between | 560 | coding and less string matching; it is somewhat intermediate between |
532 | Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as | 561 | Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as |
533 | Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy | 562 | fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The |
534 | parameter only affects the compression ratio but not the correctness of the | 563 | strategy parameter only affects the compression ratio but not the |
535 | compressed output even if it is not set appropriately. Z_FIXED prevents the | 564 | correctness of the compressed output even if it is not set appropriately. |
536 | use of dynamic Huffman codes, allowing for a simpler decoder for special | 565 | Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler |
537 | applications. | 566 | decoder for special applications. |
538 | 567 | ||
539 | deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | 568 | deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough |
540 | memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid | 569 | memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid |
@@ -561,11 +590,11 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, | |||
561 | 590 | ||
562 | Depending on the size of the compression data structures selected by | 591 | Depending on the size of the compression data structures selected by |
563 | deflateInit or deflateInit2, a part of the dictionary may in effect be | 592 | deflateInit or deflateInit2, a part of the dictionary may in effect be |
564 | discarded, for example if the dictionary is larger than the window size in | 593 | discarded, for example if the dictionary is larger than the window size |
565 | deflate or deflate2. Thus the strings most likely to be useful should be | 594 | provided in deflateInit or deflateInit2. Thus the strings most likely to be |
566 | put at the end of the dictionary, not at the front. In addition, the | 595 | useful should be put at the end of the dictionary, not at the front. In |
567 | current implementation of deflate will use at most the window size minus | 596 | addition, the current implementation of deflate will use at most the window |
568 | 262 bytes of the provided dictionary. | 597 | size minus 262 bytes of the provided dictionary. |
569 | 598 | ||
570 | Upon return of this function, strm->adler is set to the adler32 value | 599 | Upon return of this function, strm->adler is set to the adler32 value |
571 | of the dictionary; the decompressor may later use this value to determine | 600 | of the dictionary; the decompressor may later use this value to determine |
@@ -575,7 +604,7 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, | |||
575 | adler32 value is not computed and strm->adler is not set. | 604 | adler32 value is not computed and strm->adler is not set. |
576 | 605 | ||
577 | deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a | 606 | deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a |
578 | parameter is invalid (such as NULL dictionary) or the stream state is | 607 | parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is |
579 | inconsistent (for example if deflate has already been called for this stream | 608 | inconsistent (for example if deflate has already been called for this stream |
580 | or if the compression method is bsort). deflateSetDictionary does not | 609 | or if the compression method is bsort). deflateSetDictionary does not |
581 | perform any compression: this will be done by deflate(). | 610 | perform any compression: this will be done by deflate(). |
@@ -595,7 +624,7 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, | |||
595 | 624 | ||
596 | deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not | 625 | deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not |
597 | enough memory, Z_STREAM_ERROR if the source stream state was inconsistent | 626 | enough memory, Z_STREAM_ERROR if the source stream state was inconsistent |
598 | (such as zalloc being NULL). msg is left unchanged in both source and | 627 | (such as zalloc being Z_NULL). msg is left unchanged in both source and |
599 | destination. | 628 | destination. |
600 | */ | 629 | */ |
601 | 630 | ||
@@ -607,7 +636,7 @@ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); | |||
607 | that may have been set by deflateInit2. | 636 | that may have been set by deflateInit2. |
608 | 637 | ||
609 | deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source | 638 | deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source |
610 | stream state was inconsistent (such as zalloc or state being NULL). | 639 | stream state was inconsistent (such as zalloc or state being Z_NULL). |
611 | */ | 640 | */ |
612 | 641 | ||
613 | ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, | 642 | ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, |
@@ -760,7 +789,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, | |||
760 | dictionary that was used for compression is provided. | 789 | dictionary that was used for compression is provided. |
761 | 790 | ||
762 | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a | 791 | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a |
763 | parameter is invalid (such as NULL dictionary) or the stream state is | 792 | parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is |
764 | inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the | 793 | inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the |
765 | expected one (incorrect adler32 value). inflateSetDictionary does not | 794 | expected one (incorrect adler32 value). inflateSetDictionary does not |
766 | perform any decompression: this will be done by subsequent calls of | 795 | perform any decompression: this will be done by subsequent calls of |
@@ -794,7 +823,7 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, | |||
794 | 823 | ||
795 | inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not | 824 | inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not |
796 | enough memory, Z_STREAM_ERROR if the source stream state was inconsistent | 825 | enough memory, Z_STREAM_ERROR if the source stream state was inconsistent |
797 | (such as zalloc being NULL). msg is left unchanged in both source and | 826 | (such as zalloc being Z_NULL). msg is left unchanged in both source and |
798 | destination. | 827 | destination. |
799 | */ | 828 | */ |
800 | 829 | ||
@@ -805,7 +834,19 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); | |||
805 | The stream will keep attributes that may have been set by inflateInit2. | 834 | The stream will keep attributes that may have been set by inflateInit2. |
806 | 835 | ||
807 | inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source | 836 | inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source |
808 | stream state was inconsistent (such as zalloc or state being NULL). | 837 | stream state was inconsistent (such as zalloc or state being Z_NULL). |
838 | */ | ||
839 | |||
840 | ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, | ||
841 | int windowBits)); | ||
842 | /* | ||
843 | This function is the same as inflateReset, but it also permits changing | ||
844 | the wrap and window size requests. The windowBits parameter is | ||
845 | interpreted the same as it is for inflateInit2. | ||
846 | |||
847 | inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
848 | stream state was inconsistent (such as zalloc or state being Z_NULL), or if | ||
849 | the windowBits parameter is invalid. | ||
809 | */ | 850 | */ |
810 | 851 | ||
811 | ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, | 852 | ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, |
@@ -820,10 +861,43 @@ ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, | |||
820 | inflateReset(). bits must be less than or equal to 16, and that many of the | 861 | inflateReset(). bits must be less than or equal to 16, and that many of the |
821 | least significant bits of value will be inserted in the input. | 862 | least significant bits of value will be inserted in the input. |
822 | 863 | ||
864 | If bits is negative, then the input stream bit buffer is emptied. Then | ||
865 | inflatePrime() can be called again to put bits in the buffer. This is used | ||
866 | to clear out bits leftover after feeding inflate a block description prior | ||
867 | to feeding inflate codes. | ||
868 | |||
823 | inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source | 869 | inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source |
824 | stream state was inconsistent. | 870 | stream state was inconsistent. |
825 | */ | 871 | */ |
826 | 872 | ||
873 | ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); | ||
874 | /* | ||
875 | This function returns two values, one in the lower 16 bits of the return | ||
876 | value, and the other in the remaining upper bits, obtained by shifting the | ||
877 | return value down 16 bits. If the upper value is -1 and the lower value is | ||
878 | zero, then inflate() is currently decoding information outside of a block. | ||
879 | If the upper value is -1 and the lower value is non-zero, then inflate is in | ||
880 | the middle of a stored block, with the lower value equaling the number of | ||
881 | bytes from the input remaining to copy. If the upper value is not -1, then | ||
882 | it is the number of bits back from the current bit position in the input of | ||
883 | the code (literal or length/distance pair) currently being processed. In | ||
884 | that case the lower value is the number of bytes already emitted for that | ||
885 | code. | ||
886 | |||
887 | A code is being processed if inflate is waiting for more input to complete | ||
888 | decoding of the code, or if it has completed decoding but is waiting for | ||
889 | more output space to write the literal or match data. | ||
890 | |||
891 | inflateMark() is used to mark locations in the input data for random | ||
892 | access, which may be at bit positions, and to note those cases where the | ||
893 | output of a code may span boundaries of random access blocks. The current | ||
894 | location in the input stream can be determined from avail_in and data_type | ||
895 | as noted in the description for the Z_BLOCK flush parameter for inflate. | ||
896 | |||
897 | inflateMark returns the value noted above or -1 << 16 if the provided | ||
898 | source stream state was inconsistent. | ||
899 | */ | ||
900 | |||
827 | ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, | 901 | ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, |
828 | gz_headerp head)); | 902 | gz_headerp head)); |
829 | /* | 903 | /* |
@@ -833,9 +907,9 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, | |||
833 | As inflate() processes the gzip stream, head->done is zero until the header | 907 | As inflate() processes the gzip stream, head->done is zero until the header |
834 | is completed, at which time head->done is set to one. If a zlib stream is | 908 | is completed, at which time head->done is set to one. If a zlib stream is |
835 | being decoded, then head->done is set to -1 to indicate that there will be | 909 | being decoded, then head->done is set to -1 to indicate that there will be |
836 | no gzip header information forthcoming. Note that Z_BLOCK can be used to | 910 | no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be |
837 | force inflate() to return immediately after header processing is complete | 911 | used to force inflate() to return immediately after header processing is |
838 | and before any actual data is decompressed. | 912 | complete and before any actual data is decompressed. |
839 | 913 | ||
840 | The text, time, xflags, and os fields are filled in with the gzip header | 914 | The text, time, xflags, and os fields are filled in with the gzip header |
841 | contents. hcrc is set to true if there is a header CRC. (The header CRC | 915 | contents. hcrc is set to true if there is a header CRC. (The header CRC |
@@ -952,7 +1026,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, | |||
952 | nature of the error), or Z_STREAM_ERROR if the stream was not properly | 1026 | nature of the error), or Z_STREAM_ERROR if the stream was not properly |
953 | initialized. In the case of Z_BUF_ERROR, an input or output error can be | 1027 | initialized. In the case of Z_BUF_ERROR, an input or output error can be |
954 | distinguished using strm->next_in which will be Z_NULL only if in() returned | 1028 | distinguished using strm->next_in which will be Z_NULL only if in() returned |
955 | an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to | 1029 | an error. If strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to |
956 | out() returning non-zero. (in() will always be called before out(), so | 1030 | out() returning non-zero. (in() will always be called before out(), so |
957 | strm->next_in is assured to be defined if out() returns non-zero.) Note | 1031 | strm->next_in is assured to be defined if out() returns non-zero.) Note |
958 | that inflateBack() cannot return Z_OK. | 1032 | that inflateBack() cannot return Z_OK. |
@@ -1065,7 +1139,7 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, | |||
1065 | entire uncompressed data. (The size of the uncompressed data must have | 1139 | entire uncompressed data. (The size of the uncompressed data must have |
1066 | been saved previously by the compressor and transmitted to the decompressor | 1140 | been saved previously by the compressor and transmitted to the decompressor |
1067 | by some mechanism outside the scope of this compression library.) | 1141 | by some mechanism outside the scope of this compression library.) |
1068 | Upon exit, destLen is the actual size of the compressed buffer. | 1142 | Upon exit, destLen is the actual size of the uncompressed buffer. |
1069 | This function can be used to decompress a whole file at once if the | 1143 | This function can be used to decompress a whole file at once if the |
1070 | input file is mmap'ed. | 1144 | input file is mmap'ed. |
1071 | 1145 | ||
@@ -1279,7 +1353,7 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); | |||
1279 | ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); | 1353 | ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); |
1280 | /* | 1354 | /* |
1281 | Update a running Adler-32 checksum with the bytes buf[0..len-1] and | 1355 | Update a running Adler-32 checksum with the bytes buf[0..len-1] and |
1282 | return the updated checksum. If buf is NULL, this function returns | 1356 | return the updated checksum. If buf is Z_NULL, this function returns |
1283 | the required initial value for the checksum. | 1357 | the required initial value for the checksum. |
1284 | An Adler-32 checksum is almost as reliable as a CRC32 but can be computed | 1358 | An Adler-32 checksum is almost as reliable as a CRC32 but can be computed |
1285 | much faster. Usage example: | 1359 | much faster. Usage example: |
@@ -1305,7 +1379,7 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, | |||
1305 | ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); | 1379 | ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); |
1306 | /* | 1380 | /* |
1307 | Update a running CRC-32 with the bytes buf[0..len-1] and return the | 1381 | Update a running CRC-32 with the bytes buf[0..len-1] and return the |
1308 | updated CRC-32. If buf is NULL, this function returns the required initial | 1382 | updated CRC-32. If buf is Z_NULL, this function returns the required initial |
1309 | value for the for the crc. Pre- and post-conditioning (one's complement) is | 1383 | value for the for the crc. Pre- and post-conditioning (one's complement) is |
1310 | performed within this function so it shouldn't be done by the application. | 1384 | performed within this function so it shouldn't be done by the application. |
1311 | Usage example: | 1385 | Usage example: |
@@ -1369,12 +1443,19 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, | |||
1369 | ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off64_t)); | 1443 | ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off64_t)); |
1370 | #endif | 1444 | #endif |
1371 | 1445 | ||
1372 | #if _FILE_OFFSET_BITS == 64 | 1446 | #if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS == 64 |
1373 | # define gzopen gzopen64 | 1447 | # define gzopen gzopen64 |
1374 | # define gzseek gzseek64 | 1448 | # define gzseek gzseek64 |
1375 | # define gztell gztell64 | 1449 | # define gztell gztell64 |
1376 | # define adler32_combine adler32_combine64 | 1450 | # define adler32_combine adler32_combine64 |
1377 | # define crc32_combine crc32_combine64 | 1451 | # define crc32_combine crc32_combine64 |
1452 | # ifndef _LARGEFILE64_SOURCE | ||
1453 | ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); | ||
1454 | ZEXTERN off_t ZEXPORT gzseek64 OF((gzFile, off_t, int)); | ||
1455 | ZEXTERN off_t ZEXPORT gztell64 OF((gzFile)); | ||
1456 | ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off_t)); | ||
1457 | ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off_t)); | ||
1458 | # endif | ||
1378 | #else | 1459 | #else |
1379 | ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); | 1460 | ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); |
1380 | ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); | 1461 | ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); |