Rev 1896 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1896 | Rev 3926 | ||
---|---|---|---|
Line 1... | Line 1... | ||
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.5, April 19th, 2010 |
2 | version 1.2.8, April 28th, 2013 |
Line 3... | Line 3... | ||
3 | 3 | ||
Line 4... | Line 4... | ||
4 | Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler |
4 | Copyright (C) 1995-2013 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 |
Line 22... | Line 22... | ||
22 | Jean-loup Gailly Mark Adler |
22 | Jean-loup Gailly Mark Adler |
23 | jloup@gzip.org madler@alumni.caltech.edu |
23 | jloup@gzip.org madler@alumni.caltech.edu |
Line 24... | Line 24... | ||
24 | 24 | ||
25 | 25 | ||
26 | The data format used by the zlib library is described by RFCs (Request for |
26 | The data format used by the zlib library is described by RFCs (Request for |
27 | Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt |
27 | Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 |
Line 28... | Line 28... | ||
28 | (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). |
28 | (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). |
29 | */ |
29 | */ |
Line 35... | Line 35... | ||
35 | 35 | ||
36 | #ifdef __cplusplus |
36 | #ifdef __cplusplus |
37 | extern "C" { |
37 | extern "C" { |
Line 38... | Line 38... | ||
38 | #endif |
38 | #endif |
39 | 39 | ||
40 | #define ZLIB_VERSION "1.2.5" |
40 | #define ZLIB_VERSION "1.2.8" |
41 | #define ZLIB_VERNUM 0x1250 |
41 | #define ZLIB_VERNUM 0x1280 |
42 | #define ZLIB_VER_MAJOR 1 |
42 | #define ZLIB_VER_MAJOR 1 |
43 | #define ZLIB_VER_MINOR 2 |
43 | #define ZLIB_VER_MINOR 2 |
Line 44... | Line 44... | ||
44 | #define ZLIB_VER_REVISION 5 |
44 | #define ZLIB_VER_REVISION 8 |
45 | #define ZLIB_VER_SUBREVISION 0 |
45 | #define ZLIB_VER_SUBREVISION 0 |
46 | 46 | ||
Line 81... | Line 81... | ||
81 | typedef void (*free_func) OF((voidpf opaque, voidpf address)); |
81 | typedef void (*free_func) OF((voidpf opaque, voidpf address)); |
Line 82... | Line 82... | ||
82 | 82 | ||
Line 83... | Line 83... | ||
83 | struct internal_state; |
83 | struct internal_state; |
84 | 84 | ||
85 | typedef struct z_stream_s { |
85 | typedef struct z_stream_s { |
86 | Bytef *next_in; /* next input byte */ |
86 | z_const Bytef *next_in; /* next input byte */ |
Line 87... | Line 87... | ||
87 | uInt avail_in; /* number of bytes available at next_in */ |
87 | uInt avail_in; /* number of bytes available at next_in */ |
88 | uLong total_in; /* total nb of input bytes read so far */ |
88 | uLong total_in; /* total number of input bytes read so far */ |
89 | 89 | ||
Line 90... | Line 90... | ||
90 | Bytef *next_out; /* next output byte should be put there */ |
90 | Bytef *next_out; /* next output byte should be put there */ |
91 | uInt avail_out; /* remaining free space at next_out */ |
91 | uInt avail_out; /* remaining free space at next_out */ |
Line 92... | Line 92... | ||
92 | uLong total_out; /* total nb of bytes output so far */ |
92 | uLong total_out; /* total number of bytes output so far */ |
93 | 93 | ||
94 | char *msg; /* last error message, NULL if no error */ |
94 | z_const char *msg; /* last error message, NULL if no error */ |
Line 325... | Line 325... | ||
325 | deflate has returned Z_STREAM_END, the only possible operations on the stream |
325 | deflate has returned Z_STREAM_END, the only possible operations on the stream |
326 | are deflateReset or deflateEnd. |
326 | are deflateReset or deflateEnd. |
Line 327... | Line 327... | ||
327 | 327 | ||
328 | Z_FINISH can be used immediately after deflateInit if all the compression |
328 | Z_FINISH can be used immediately after deflateInit if all the compression |
329 | is to be done in a single step. In this case, avail_out must be at least the |
329 | is to be done in a single step. In this case, avail_out must be at least the |
- | 330 | value returned by deflateBound (see below). Then deflate is guaranteed to |
|
330 | value returned by deflateBound (see below). If deflate does not return |
331 | return Z_STREAM_END. If not enough output space is provided, deflate will |
Line 331... | Line 332... | ||
331 | Z_STREAM_END, then it must be called again as described above. |
332 | not return Z_STREAM_END, and it must be called again as described above. |
332 | 333 | ||
Line 333... | Line 334... | ||
333 | deflate() sets strm->adler to the adler32 checksum of all input read |
334 | deflate() sets strm->adler to the adler32 checksum of all input read |
Line 449... | Line 450... | ||
449 | 450 | ||
450 | inflate() should normally be called until it returns Z_STREAM_END or an |
451 | inflate() should normally be called until it returns Z_STREAM_END or an |
451 | error. However if all decompression is to be performed in a single step (a |
452 | error. However if all decompression is to be performed in a single step (a |
452 | single call of inflate), the parameter flush should be set to Z_FINISH. In |
453 | single call of inflate), the parameter flush should be set to Z_FINISH. In |
453 | this case all pending input is processed and all pending output is flushed; |
454 | this case all pending input is processed and all pending output is flushed; |
454 | avail_out must be large enough to hold all the uncompressed data. (The size |
455 | avail_out must be large enough to hold all of the uncompressed data for the |
455 | of the uncompressed data may have been saved by the compressor for this |
456 | operation to complete. (The size of the uncompressed data may have been |
456 | purpose.) The next operation on this stream must be inflateEnd to deallocate |
457 | saved by the compressor for this purpose.) The use of Z_FINISH is not |
457 | the decompression state. The use of Z_FINISH is never required, but can be |
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 |
|
458 | used to inform inflate that a faster approach may be used for the single |
464 | inflate() can be called again to continue the operation as if Z_NO_FLUSH had |
Line 459... | Line 465... | ||
459 | inflate() call. |
465 | been used. |
460 | 466 | ||
461 | In this implementation, inflate() always flushes as much output as |
467 | In this implementation, inflate() always flushes as much output as |
462 | possible to the output buffer, and always uses the faster approach on the |
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 |
|
463 | first call. So the only effect of the flush parameter in this implementation |
470 | on the return value of inflate() as noted below, when inflate() returns early |
Line 464... | Line 471... | ||
464 | is on the return value of inflate(), as noted below, or when it returns early |
471 | when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of |
465 | because Z_BLOCK or Z_TREES is used. |
472 | memory for a sliding window when Z_FINISH is used. |
466 | 473 | ||
467 | If a preset dictionary is needed after this call (see inflateSetDictionary |
474 | If a preset dictionary is needed after this call (see inflateSetDictionary |
468 | below), inflate sets strm->adler to the adler32 checksum of the dictionary |
475 | below), inflate sets strm->adler to the Adler-32 checksum of the dictionary |
469 | chosen by the compressor and returns Z_NEED_DICT; otherwise it sets |
476 | chosen by the compressor and returns Z_NEED_DICT; otherwise it sets |
470 | strm->adler to the adler32 checksum of all output produced so far (that is, |
477 | strm->adler to the Adler-32 checksum of all output produced so far (that is, |
471 | total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described |
478 | total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described |
Line 472... | Line 479... | ||
472 | below. At the end of the stream, inflate() checks that its computed adler32 |
479 | below. At the end of the stream, inflate() checks that its computed adler32 |
473 | checksum is equal to that saved by the compressor and returns Z_STREAM_END |
480 | checksum is equal to that saved by the compressor and returns Z_STREAM_END |
474 | only if the checksum is correct. |
481 | only if the checksum is correct. |
475 | 482 | ||
476 | inflate() can decompress and check either zlib-wrapped or gzip-wrapped |
483 | inflate() can decompress and check either zlib-wrapped or gzip-wrapped |
477 | deflate data. The header type is detected automatically, if requested when |
484 | deflate data. The header type is detected automatically, if requested when |
- | 485 | initializing with inflateInit2(). Any information contained in the gzip |
|
- | 486 | header is not retained, so applications that need that information should |
|
Line 478... | Line 487... | ||
478 | initializing with inflateInit2(). Any information contained in the gzip |
487 | instead use raw inflate, see inflateInit2() below, or inflateBack() and |
479 | header is not retained, so applications that need that information should |
488 | perform their own processing of the gzip header and trailer. When processing |
480 | instead use raw inflate, see inflateInit2() below, or inflateBack() and |
489 | gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output |
481 | perform their own processing of the gzip header and trailer. |
490 | producted so far. The CRC-32 is checked against the gzip trailer. |
Line 578... | Line 587... | ||
578 | ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, |
587 | ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, |
579 | const Bytef *dictionary, |
588 | const Bytef *dictionary, |
580 | uInt dictLength)); |
589 | uInt dictLength)); |
581 | /* |
590 | /* |
582 | Initializes the compression dictionary from the given byte sequence |
591 | Initializes the compression dictionary from the given byte sequence |
583 | without producing any compressed output. This function must be called |
592 | without producing any compressed output. When using the zlib format, this |
584 | immediately after deflateInit, deflateInit2 or deflateReset, before any call |
593 | function must be called immediately after deflateInit, deflateInit2 or |
- | 594 | deflateReset, and before any call of deflate. When doing raw deflate, this |
|
- | 595 | function must be called either before any call of deflate, or immediately |
|
- | 596 | after the completion of a deflate block, i.e. after all input has been |
|
- | 597 | consumed and all output has been delivered when using any of the flush |
|
- | 598 | options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The |
|
585 | of deflate. The compressor and decompressor must use exactly the same |
599 | compressor and decompressor must use exactly the same dictionary (see |
586 | dictionary (see inflateSetDictionary). |
600 | inflateSetDictionary). |
Line 587... | Line 601... | ||
587 | 601 | ||
588 | The dictionary should consist of strings (byte sequences) that are likely |
602 | The dictionary should consist of strings (byte sequences) that are likely |
589 | to be encountered later in the data to be compressed, with the most commonly |
603 | to be encountered later in the data to be compressed, with the most commonly |
590 | used strings preferably put towards the end of the dictionary. Using a |
604 | used strings preferably put towards the end of the dictionary. Using a |
Line 608... | Line 622... | ||
608 | adler32 value is not computed and strm->adler is not set. |
622 | adler32 value is not computed and strm->adler is not set. |
Line 609... | Line 623... | ||
609 | 623 | ||
610 | deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a |
624 | deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a |
611 | parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is |
625 | parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is |
612 | inconsistent (for example if deflate has already been called for this stream |
626 | inconsistent (for example if deflate has already been called for this stream |
613 | or if the compression method is bsort). deflateSetDictionary does not |
627 | or if not at a block boundary for raw deflate). deflateSetDictionary does |
614 | perform any compression: this will be done by deflate(). |
628 | not perform any compression: this will be done by deflate(). |
Line 615... | Line 629... | ||
615 | */ |
629 | */ |
616 | 630 | ||
617 | ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, |
631 | ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, |
Line 686... | Line 700... | ||
686 | /* |
700 | /* |
687 | deflateBound() returns an upper bound on the compressed size after |
701 | deflateBound() returns an upper bound on the compressed size after |
688 | deflation of sourceLen bytes. It must be called after deflateInit() or |
702 | deflation of sourceLen bytes. It must be called after deflateInit() or |
689 | deflateInit2(), and after deflateSetHeader(), if used. This would be used |
703 | deflateInit2(), and after deflateSetHeader(), if used. This would be used |
690 | to allocate an output buffer for deflation in a single pass, and so would be |
704 | to allocate an output buffer for deflation in a single pass, and so would be |
- | 705 | called before deflate(). If that first deflate() call is provided the |
|
- | 706 | sourceLen input bytes, an output buffer allocated to the size returned by |
|
- | 707 | deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed |
|
- | 708 | to return Z_STREAM_END. Note that it is possible for the compressed size to |
|
- | 709 | be larger than the value returned by deflateBound() if flush options other |
|
- | 710 | than Z_FINISH or Z_NO_FLUSH are used. |
|
- | 711 | */ |
|
- | 712 | ||
- | 713 | ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, |
|
- | 714 | unsigned *pending, |
|
- | 715 | int *bits)); |
|
- | 716 | /* |
|
- | 717 | deflatePending() returns the number of bytes and bits of output that have |
|
- | 718 | been generated, but not yet provided in the available output. The bytes not |
|
- | 719 | provided would be due to the available output space having being consumed. |
|
- | 720 | The number of bits of output not provided are between 0 and 7, where they |
|
- | 721 | await more bits to join them in order to fill out a full byte. If pending |
|
- | 722 | or bits are Z_NULL, then those values are not set. |
|
- | 723 | ||
- | 724 | deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source |
|
691 | called before deflate(). |
725 | stream state was inconsistent. |
692 | */ |
726 | */ |
Line 693... | Line 727... | ||
693 | 727 | ||
694 | ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, |
728 | ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, |
695 | int bits, |
729 | int bits, |
Line 701... | Line 735... | ||
701 | function can only be used for raw deflate, and must be used before the first |
735 | function can only be used for raw deflate, and must be used before the first |
702 | deflate() call after a deflateInit2() or deflateReset(). bits must be less |
736 | deflate() call after a deflateInit2() or deflateReset(). bits must be less |
703 | than or equal to 16, and that many of the least significant bits of value |
737 | than or equal to 16, and that many of the least significant bits of value |
704 | will be inserted in the output. |
738 | will be inserted in the output. |
Line 705... | Line 739... | ||
705 | 739 | ||
- | 740 | deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough |
|
706 | deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source |
741 | room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the |
707 | stream state was inconsistent. |
742 | source stream state was inconsistent. |
Line 708... | Line 743... | ||
708 | */ |
743 | */ |
709 | 744 | ||
710 | ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, |
745 | ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, |
Line 788... | Line 823... | ||
788 | Initializes the decompression dictionary from the given uncompressed byte |
823 | Initializes the decompression dictionary from the given uncompressed byte |
789 | sequence. This function must be called immediately after a call of inflate, |
824 | sequence. This function must be called immediately after a call of inflate, |
790 | if that call returned Z_NEED_DICT. The dictionary chosen by the compressor |
825 | if that call returned Z_NEED_DICT. The dictionary chosen by the compressor |
791 | can be determined from the adler32 value returned by that call of inflate. |
826 | can be determined from the adler32 value returned by that call of inflate. |
792 | The compressor and decompressor must use exactly the same dictionary (see |
827 | The compressor and decompressor must use exactly the same dictionary (see |
793 | deflateSetDictionary). For raw inflate, this function can be called |
828 | deflateSetDictionary). For raw inflate, this function can be called at any |
794 | immediately after inflateInit2() or inflateReset() and before any call of |
829 | time to set the dictionary. If the provided dictionary is smaller than the |
- | 830 | window and there is already data in the window, then the provided dictionary |
|
795 | inflate() to set the dictionary. The application must insure that the |
831 | will amend what's there. The application must insure that the dictionary |
796 | dictionary that was used for compression is provided. |
832 | that was used for compression is provided. |
Line 797... | Line 833... | ||
797 | 833 | ||
798 | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a |
834 | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a |
799 | parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is |
835 | parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is |
800 | inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the |
836 | inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the |
801 | expected one (incorrect adler32 value). inflateSetDictionary does not |
837 | expected one (incorrect adler32 value). inflateSetDictionary does not |
802 | perform any decompression: this will be done by subsequent calls of |
838 | perform any decompression: this will be done by subsequent calls of |
803 | inflate(). |
839 | inflate(). |
Line -... | Line 840... | ||
- | 840 | */ |
|
- | 841 | ||
- | 842 | ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, |
|
- | 843 | Bytef *dictionary, |
|
- | 844 | uInt *dictLength)); |
|
- | 845 | /* |
|
- | 846 | Returns the sliding dictionary being maintained by inflate. dictLength is |
|
- | 847 | set to the number of bytes in the dictionary, and that many bytes are copied |
|
- | 848 | to dictionary. dictionary must have enough space, where 32768 bytes is |
|
- | 849 | always enough. If inflateGetDictionary() is called with dictionary equal to |
|
- | 850 | Z_NULL, then only the dictionary length is returned, and nothing is copied. |
|
- | 851 | Similary, if dictLength is Z_NULL, then it is not set. |
|
- | 852 | ||
- | 853 | inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the |
|
- | 854 | stream state is inconsistent. |
|
804 | */ |
855 | */ |
805 | 856 | ||
806 | ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); |
857 | ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); |
807 | /* |
858 | /* |
808 | Skips invalid compressed data until a full flush point (see above the |
859 | Skips invalid compressed data until a possible full flush point (see above |
Line -... | Line 860... | ||
- | 860 | for the description of deflate with Z_FULL_FLUSH) can be found, or until all |
|
- | 861 | available input is skipped. No output is provided. |
|
- | 862 | ||
- | 863 | inflateSync searches for a 00 00 FF FF pattern in the compressed data. |
|
809 | description of deflate with Z_FULL_FLUSH) can be found, or until all |
864 | All full flush points have this pattern, but not all occurrences of this |
810 | available input is skipped. No output is provided. |
865 | pattern are full flush points. |
811 | 866 | ||
812 | inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR |
867 | inflateSync returns Z_OK if a possible full flush point has been found, |
813 | if no more input was provided, Z_DATA_ERROR if no flush point has been |
868 | Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point |
814 | found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the |
869 | has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. |
815 | success case, the application may save the current current value of total_in |
870 | In the success case, the application may save the current current value of |
816 | which indicates where valid compressed data was found. In the error case, |
871 | total_in which indicates where valid compressed data was found. In the |
Line 817... | Line 872... | ||
817 | the application may repeatedly call inflateSync, providing more input each |
872 | error case, the application may repeatedly call inflateSync, providing more |
818 | time, until success or end of the input data. |
873 | input each time, until success or end of the input data. |
819 | */ |
874 | */ |
Line 960... | Line 1015... | ||
960 | deflate streams. |
1015 | deflate streams. |
Line 961... | Line 1016... | ||
961 | 1016 | ||
Line 962... | Line 1017... | ||
962 | See inflateBack() for the usage of these routines. |
1017 | See inflateBack() for the usage of these routines. |
963 | 1018 | ||
964 | inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of |
1019 | inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of |
965 | the paramaters are invalid, Z_MEM_ERROR if the internal state could not be |
1020 | the parameters are invalid, Z_MEM_ERROR if the internal state could not be |
966 | allocated, or Z_VERSION_ERROR if the version of the library does not match |
1021 | allocated, or Z_VERSION_ERROR if the version of the library does not match |
Line 967... | Line 1022... | ||
967 | the version of the header file. |
1022 | the version of the header file. |
- | 1023 | */ |
|
968 | */ |
1024 | |
Line 969... | Line 1025... | ||
969 | 1025 | typedef unsigned (*in_func) OF((void FAR *, |
|
970 | typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); |
1026 | z_const unsigned char FAR * FAR *)); |
971 | typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); |
1027 | typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); |
972 | 1028 | ||
973 | ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, |
1029 | ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, |
974 | in_func in, void FAR *in_desc, |
1030 | in_func in, void FAR *in_desc, |
975 | out_func out, void FAR *out_desc)); |
1031 | out_func out, void FAR *out_desc)); |
976 | /* |
1032 | /* |
- | 1033 | inflateBack() does a raw inflate with a single call using a call-back |
|
977 | inflateBack() does a raw inflate with a single call using a call-back |
1034 | interface for input and output. This is potentially more efficient than |
978 | interface for input and output. This is more efficient than inflate() for |
1035 | inflate() for file i/o applications, in that it avoids copying between the |
Line 979... | Line 1036... | ||
979 | file i/o applications in that it avoids copying between the output and the |
1036 | output and the sliding window by simply making the window itself the output |
980 | sliding window by simply making the window itself the output buffer. This |
1037 | buffer. inflate() can be faster on modern CPUs when used with large |
981 | function trusts the application to not change the output buffer passed by |
1038 | buffers. inflateBack() trusts the application to not change the output |
982 | the output function, at least until inflateBack() returns. |
1039 | buffer passed by the output function, at least until inflateBack() returns. |
Line 1086... | Line 1143... | ||
1086 | 1143 | ||
1087 | Remainder: |
1144 | Remainder: |
1088 | 27-31: 0 (reserved) |
1145 | 27-31: 0 (reserved) |
Line -... | Line 1146... | ||
- | 1146 | */ |
|
Line 1089... | Line 1147... | ||
1089 | */ |
1147 | |
Line 1090... | Line 1148... | ||
1090 | 1148 | #ifndef Z_SOLO |
|
1091 | 1149 | ||
Line 1147... | Line 1205... | ||
1147 | mechanism outside the scope of this compression library.) Upon exit, destLen |
1205 | mechanism outside the scope of this compression library.) Upon exit, destLen |
1148 | is the actual size of the uncompressed buffer. |
1206 | is the actual size of the uncompressed buffer. |
Line 1149... | Line 1207... | ||
1149 | 1207 | ||
1150 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not |
1208 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not |
1151 | enough memory, Z_BUF_ERROR if there was not enough room in the output |
1209 | enough memory, Z_BUF_ERROR if there was not enough room in the output |
- | 1210 | buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In |
|
- | 1211 | the case where there is not enough room, uncompress() will fill the output |
|
1152 | buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. |
1212 | buffer with the uncompressed data up to that point. |
Line 1153... | Line -... | ||
1153 | */ |
- | |
1154 | 1213 | */ |
|
Line 1155... | Line 1214... | ||
1155 | 1214 | ||
1156 | /* gzip file access functions */ |
1215 | /* gzip file access functions */ |
1157 | 1216 | ||
1158 | /* |
1217 | /* |
1159 | This library supports reading and writing files in gzip (.gz) format with |
1218 | This library supports reading and writing files in gzip (.gz) format with |
1160 | an interface similar to that of stdio, using the functions that start with |
1219 | an interface similar to that of stdio, using the functions that start with |
Line 1161... | Line 1220... | ||
1161 | "gz". The gzip format is different from the zlib format. gzip is a gzip |
1220 | "gz". The gzip format is different from the zlib format. gzip is a gzip |
Line 1162... | Line 1221... | ||
1162 | wrapper, documented in RFC 1952, wrapped around a deflate stream. |
1221 | wrapper, documented in RFC 1952, wrapped around a deflate stream. |
1163 | */ |
1222 | */ |
Line 1164... | Line 1223... | ||
1164 | 1223 | ||
1165 | typedef voidp gzFile; /* opaque gzip file descriptor */ |
1224 | typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ |
1166 | 1225 | ||
1167 | /* |
1226 | /* |
1168 | ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); |
1227 | ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); |
1169 | 1228 | ||
- | 1229 | Opens a gzip (.gz) file for reading or writing. The mode parameter is as |
|
- | 1230 | in fopen ("rb" or "wb") but can also include a compression level ("wb9") or |
|
- | 1231 | a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only |
|
1170 | Opens a gzip (.gz) file for reading or writing. The mode parameter is as |
1232 | compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' |
1171 | in fopen ("rb" or "wb") but can also include a compression level ("wb9") or |
1233 | for fixed code compression as in "wb9F". (See the description of |
1172 | a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only |
1234 | deflateInit2 for more information about the strategy parameter.) 'T' will |
- | 1235 | request transparent writing or appending with no compression and not using |
|
- | 1236 | the gzip format. |
|
- | 1237 | ||
- | 1238 | "a" can be used instead of "w" to request that the gzip stream that will |
|
- | 1239 | be written be appended to the file. "+" will result in an error, since |
|
- | 1240 | reading and writing to the same gzip file is not supported. The addition of |
|
- | 1241 | "x" when writing will create the file exclusively, which fails if the file |
|
- | 1242 | already exists. On systems that support it, the addition of "e" when |
|
- | 1243 | reading or writing will set the flag to close the file on an execve() call. |
|
- | 1244 | ||
Line 1173... | Line 1245... | ||
1173 | compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' |
1245 | These functions, as well as gzip, will read and decode a sequence of gzip |
1174 | for fixed code compression as in "wb9F". (See the description of |
1246 | streams in a file. The append function of gzopen() can be used to create |
- | 1247 | such a file. (Also see gzflush() for another way to do this.) When |
|
- | 1248 | appending, gzopen does not test whether the file begins with a gzip stream, |
|
Line 1175... | Line 1249... | ||
1175 | deflateInit2 for more information about the strategy parameter.) Also "a" |
1249 | nor does it look for the end of the gzip streams to begin appending. gzopen |
1176 | can be used instead of "w" to request that the gzip stream that will be |
1250 | will simply append a gzip stream to the existing file. |
1177 | written be appended to the file. "+" will result in an error, since reading |
1251 | |
1178 | and writing to the same gzip file is not supported. |
1252 | gzopen can be used to read a file which is not in gzip format; in this |
Line 1195... | Line 1269... | ||
1195 | 1269 | ||
1196 | The next call of gzclose on the returned gzFile will also close the file |
1270 | The next call of gzclose on the returned gzFile will also close the file |
1197 | descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor |
1271 | descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor |
1198 | fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, |
1272 | fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, |
1199 | mode);. The duplicated descriptor should be saved to avoid a leak, since |
1273 | mode);. The duplicated descriptor should be saved to avoid a leak, since |
- | 1274 | gzdopen does not close fd if it fails. If you are using fileno() to get the |
|
- | 1275 | file descriptor from a FILE *, then you will have to use dup() to avoid |
|
- | 1276 | double-close()ing the file descriptor. Both gzclose() and fclose() will |
|
- | 1277 | close the associated file descriptor, so they need to have different file |
|
Line 1200... | Line 1278... | ||
1200 | gzdopen does not close fd if it fails. |
1278 | descriptors. |
1201 | 1279 | ||
1202 | gzdopen returns NULL if there was insufficient memory to allocate the |
1280 | gzdopen returns NULL if there was insufficient memory to allocate the |
1203 | gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not |
1281 | gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not |
Line 1233... | Line 1311... | ||
1233 | */ |
1311 | */ |
Line 1234... | Line 1312... | ||
1234 | 1312 | ||
1235 | ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); |
1313 | ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); |
1236 | /* |
1314 | /* |
1237 | Reads the given number of uncompressed bytes from the compressed file. If |
1315 | Reads the given number of uncompressed bytes from the compressed file. If |
1238 | the input file was not in gzip format, gzread copies the given number of |
1316 | the input file is not in gzip format, gzread copies the given number of |
Line 1239... | Line 1317... | ||
1239 | bytes into the buffer. |
1317 | bytes into the buffer directly from the file. |
1240 | 1318 | ||
1241 | After reaching the end of a gzip stream in the input, gzread will continue |
1319 | After reaching the end of a gzip stream in the input, gzread will continue |
- | 1320 | to read, looking for another gzip stream. Any number of gzip streams may be |
|
- | 1321 | concatenated in the input file, and will all be decompressed by gzread(). |
|
- | 1322 | If something other than a gzip stream is encountered after a gzip stream, |
|
- | 1323 | that remaining trailing garbage is ignored (and no error is returned). |
|
- | 1324 | ||
- | 1325 | gzread can be used to read a gzip file that is being concurrently written. |
|
- | 1326 | Upon reaching the end of the input, gzread will return with the available |
|
- | 1327 | data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then |
|
- | 1328 | gzclearerr can be used to clear the end of file indicator in order to permit |
|
1242 | to read, looking for another gzip stream, or failing that, reading the rest |
1329 | gzread to be tried again. Z_OK indicates that a gzip stream was completed |
- | 1330 | on the last gzread. Z_BUF_ERROR indicates that the input file ended in the |
|
- | 1331 | middle of a gzip stream. Note that gzread does not return -1 in the event |
|
- | 1332 | of an incomplete gzip stream. This error is deferred until gzclose(), which |
|
1243 | of the input file directly without decompression. The entire input file |
1333 | will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip |
Line 1244... | Line 1334... | ||
1244 | will be read if gzread is called until it returns less than the requested |
1334 | stream. Alternatively, gzerror can be used before gzclose to detect this |
1245 | len. |
1335 | case. |
1246 | 1336 | ||
Line 1254... | Line 1344... | ||
1254 | Writes the given number of uncompressed bytes into the compressed file. |
1344 | Writes the given number of uncompressed bytes into the compressed file. |
1255 | gzwrite returns the number of uncompressed bytes written or 0 in case of |
1345 | gzwrite returns the number of uncompressed bytes written or 0 in case of |
1256 | error. |
1346 | error. |
1257 | */ |
1347 | */ |
Line 1258... | Line 1348... | ||
1258 | 1348 | ||
1259 | ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); |
1349 | ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); |
1260 | /* |
1350 | /* |
1261 | Converts, formats, and writes the arguments to the compressed file under |
1351 | Converts, formats, and writes the arguments to the compressed file under |
1262 | control of the format string, as in fprintf. gzprintf returns the number of |
1352 | control of the format string, as in fprintf. gzprintf returns the number of |
1263 | uncompressed bytes actually written, or 0 in case of error. The number of |
1353 | uncompressed bytes actually written, or 0 in case of error. The number of |
Line 1299... | Line 1389... | ||
1299 | */ |
1389 | */ |
Line 1300... | Line 1390... | ||
1300 | 1390 | ||
1301 | ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); |
1391 | ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); |
1302 | /* |
1392 | /* |
- | 1393 | Reads one byte from the compressed file. gzgetc returns this byte or -1 |
|
- | 1394 | in case of end of file or error. This is implemented as a macro for speed. |
|
- | 1395 | As such, it does not do all of the checking the other functions do. I.e. |
|
1303 | Reads one byte from the compressed file. gzgetc returns this byte or -1 |
1396 | it does not check to see if file is NULL, nor whether the structure file |
1304 | in case of end of file or error. |
1397 | points to has been clobbered or not. |
Line 1305... | Line 1398... | ||
1305 | */ |
1398 | */ |
1306 | 1399 | ||
1307 | ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); |
1400 | ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); |
Line 1395... | Line 1488... | ||
1395 | */ |
1488 | */ |
Line 1396... | Line 1489... | ||
1396 | 1489 | ||
1397 | ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); |
1490 | ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); |
1398 | /* |
1491 | /* |
1399 | Returns true (1) if file is being copied directly while reading, or false |
1492 | Returns true (1) if file is being copied directly while reading, or false |
1400 | (0) if file is a gzip stream being decompressed. This state can change from |
- | |
1401 | false to true while reading the input file if the end of a gzip stream is |
- | |
Line 1402... | Line 1493... | ||
1402 | reached, but is followed by data that is not another gzip stream. |
1493 | (0) if file is a gzip stream being decompressed. |
1403 | 1494 | ||
Line 1404... | Line 1495... | ||
1404 | If the input file is empty, gzdirect() will return true, since the input |
1495 | If the input file is empty, gzdirect() will return true, since the input |
1405 | does not contain a gzip stream. |
1496 | does not contain a gzip stream. |
1406 | 1497 | ||
1407 | If gzdirect() is used immediately after gzopen() or gzdopen() it will |
1498 | If gzdirect() is used immediately after gzopen() or gzdopen() it will |
- | 1499 | cause buffers to be allocated to allow reading the file to determine if it |
|
- | 1500 | is a gzip file. Therefore if gzbuffer() is used, it should be called before |
|
- | 1501 | gzdirect(). |
|
- | 1502 | ||
- | 1503 | When writing, gzdirect() returns true (1) if transparent writing was |
|
- | 1504 | requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: |
|
- | 1505 | gzdirect() is not needed when writing. Transparent writing must be |
|
1408 | cause buffers to be allocated to allow reading the file to determine if it |
1506 | explicitly requested, so the application already knows the answer. When |
Line 1409... | Line 1507... | ||
1409 | is a gzip file. Therefore if gzbuffer() is used, it should be called before |
1507 | linking statically, using gzdirect() will include all of the zlib code for |
1410 | gzdirect(). |
1508 | gzip file reading and decompression, which may not be desired.) |
1411 | */ |
1509 | */ |
Line 1417... | Line 1515... | ||
1417 | cannot call gzerror with file, since its structures have been deallocated. |
1515 | cannot call gzerror with file, since its structures have been deallocated. |
1418 | gzclose must not be called more than once on the same file, just as free |
1516 | gzclose must not be called more than once on the same file, just as free |
1419 | must not be called more than once on the same allocation. |
1517 | must not be called more than once on the same allocation. |
Line 1420... | Line 1518... | ||
1420 | 1518 | ||
- | 1519 | gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a |
|
1421 | gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a |
1520 | file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the |
1422 | file operation error, or Z_OK on success. |
1521 | last read ended in the middle of a gzip stream, or Z_OK on success. |
Line 1423... | Line 1522... | ||
1423 | */ |
1522 | */ |
1424 | 1523 | ||
1425 | ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); |
1524 | ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); |
Line 1455... | Line 1554... | ||
1455 | Clears the error and end-of-file flags for file. This is analogous to the |
1554 | Clears the error and end-of-file flags for file. This is analogous to the |
1456 | clearerr() function in stdio. This is useful for continuing to read a gzip |
1555 | clearerr() function in stdio. This is useful for continuing to read a gzip |
1457 | file that is being written concurrently. |
1556 | file that is being written concurrently. |
1458 | */ |
1557 | */ |
Line -... | Line 1558... | ||
- | 1558 | ||
Line 1459... | Line 1559... | ||
1459 | 1559 | #endif /* !Z_SOLO */ |
|
Line 1460... | Line 1560... | ||
1460 | 1560 | ||
1461 | /* checksum functions */ |
1561 | /* checksum functions */ |
Line 1490... | Line 1590... | ||
1490 | z_off_t len2)); |
1590 | z_off_t len2)); |
Line 1491... | Line 1591... | ||
1491 | 1591 | ||
1492 | Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 |
1592 | Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 |
1493 | and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for |
1593 | and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for |
1494 | each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of |
1594 | each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of |
- | 1595 | seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note |
|
- | 1596 | that the z_off_t type (like off_t) is a signed integer. If len2 is |
|
1495 | seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. |
1597 | negative, the result has no meaning or utility. |
Line 1496... | Line 1598... | ||
1496 | */ |
1598 | */ |
1497 | 1599 | ||
1498 | ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); |
1600 | ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); |
1499 | /* |
1601 | /* |
1500 | Update a running CRC-32 with the bytes buf[0..len-1] and return the |
1602 | Update a running CRC-32 with the bytes buf[0..len-1] and return the |
1501 | updated CRC-32. If buf is Z_NULL, this function returns the required |
1603 | updated CRC-32. If buf is Z_NULL, this function returns the required |
1502 | initial value for the for the crc. Pre- and post-conditioning (one's |
- | |
Line 1503... | Line 1604... | ||
1503 | complement) is performed within this function so it shouldn't be done by the |
1604 | initial value for the crc. Pre- and post-conditioning (one's complement) is |
Line 1504... | Line 1605... | ||
1504 | application. |
1605 | performed within this function so it shouldn't be done by the application. |
Line 1542... | Line 1643... | ||
1542 | ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, |
1643 | ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, |
1543 | unsigned char FAR *window, |
1644 | unsigned char FAR *window, |
1544 | const char *version, |
1645 | const char *version, |
1545 | int stream_size)); |
1646 | int stream_size)); |
1546 | #define deflateInit(strm, level) \ |
1647 | #define deflateInit(strm, level) \ |
1547 | deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) |
1648 | deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) |
1548 | #define inflateInit(strm) \ |
1649 | #define inflateInit(strm) \ |
1549 | inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) |
1650 | inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) |
1550 | #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ |
1651 | #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ |
1551 | deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ |
1652 | deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ |
1552 | (strategy), ZLIB_VERSION, sizeof(z_stream)) |
1653 | (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) |
1553 | #define inflateInit2(strm, windowBits) \ |
1654 | #define inflateInit2(strm, windowBits) \ |
1554 | inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) |
1655 | inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ |
- | 1656 | (int)sizeof(z_stream)) |
|
1555 | #define inflateBackInit(strm, windowBits, window) \ |
1657 | #define inflateBackInit(strm, windowBits, window) \ |
1556 | inflateBackInit_((strm), (windowBits), (window), \ |
1658 | inflateBackInit_((strm), (windowBits), (window), \ |
1557 | ZLIB_VERSION, sizeof(z_stream)) |
1659 | ZLIB_VERSION, (int)sizeof(z_stream)) |
- | 1660 | ||
- | 1661 | #ifndef Z_SOLO |
|
- | 1662 | ||
- | 1663 | /* gzgetc() macro and its supporting function and exposed data structure. Note |
|
- | 1664 | * that the real internal state is much larger than the exposed structure. |
|
- | 1665 | * This abbreviated structure exposes just enough for the gzgetc() macro. The |
|
- | 1666 | * user should not mess with these exposed elements, since their names or |
|
- | 1667 | * behavior could change in the future, perhaps even capriciously. They can |
|
- | 1668 | * only be used by the gzgetc() macro. You have been warned. |
|
- | 1669 | */ |
|
- | 1670 | struct gzFile_s { |
|
- | 1671 | unsigned have; |
|
- | 1672 | unsigned char *next; |
|
- | 1673 | z_off64_t pos; |
|
- | 1674 | }; |
|
- | 1675 | ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ |
|
- | 1676 | #ifdef Z_PREFIX_SET |
|
- | 1677 | # undef z_gzgetc |
|
- | 1678 | # define z_gzgetc(g) \ |
|
- | 1679 | ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) |
|
- | 1680 | #else |
|
- | 1681 | # define gzgetc(g) \ |
|
- | 1682 | ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) |
|
- | 1683 | #endif |
|
Line 1558... | Line 1684... | ||
1558 | 1684 | ||
1559 | /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or |
1685 | /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or |
1560 | * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if |
1686 | * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if |
1561 | * both are true, the application gets the *64 functions, and the regular |
1687 | * both are true, the application gets the *64 functions, and the regular |
1562 | * functions are changed to 64 bits) -- in case these are set on systems |
1688 | * functions are changed to 64 bits) -- in case these are set on systems |
1563 | * without large file support, _LFS64_LARGEFILE must also be true |
1689 | * without large file support, _LFS64_LARGEFILE must also be true |
1564 | */ |
1690 | */ |
1565 | #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 |
1691 | #ifdef Z_LARGE64 |
1566 | ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); |
1692 | ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); |
1567 | ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); |
1693 | ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); |
1568 | ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); |
1694 | ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); |
1569 | ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); |
1695 | ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); |
1570 | ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); |
1696 | ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); |
1571 | ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); |
1697 | ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); |
Line 1572... | Line 1698... | ||
1572 | #endif |
1698 | #endif |
- | 1699 | ||
- | 1700 | #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) |
|
- | 1701 | # ifdef Z_PREFIX_SET |
|
- | 1702 | # define z_gzopen z_gzopen64 |
|
- | 1703 | # define z_gzseek z_gzseek64 |
|
- | 1704 | # define z_gztell z_gztell64 |
|
- | 1705 | # define z_gzoffset z_gzoffset64 |
|
- | 1706 | # define z_adler32_combine z_adler32_combine64 |
|
1573 | 1707 | # define z_crc32_combine z_crc32_combine64 |
|
1574 | #if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 |
1708 | # else |
1575 | # define gzopen gzopen64 |
1709 | # define gzopen gzopen64 |
1576 | # define gzseek gzseek64 |
1710 | # define gzseek gzseek64 |
1577 | # define gztell gztell64 |
1711 | # define gztell gztell64 |
1578 | # define gzoffset gzoffset64 |
1712 | # define gzoffset gzoffset64 |
- | 1713 | # define adler32_combine adler32_combine64 |
|
1579 | # define adler32_combine adler32_combine64 |
1714 | # define crc32_combine crc32_combine64 |
1580 | # define crc32_combine crc32_combine64 |
1715 | # endif |
1581 | # ifdef _LARGEFILE64_SOURCE |
1716 | # ifndef Z_LARGE64 |
1582 | ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); |
1717 | ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); |
1583 | ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); |
1718 | ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); |
1584 | ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); |
1719 | ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); |
Line 1593... | Line 1728... | ||
1593 | ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); |
1728 | ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); |
1594 | ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); |
1729 | ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); |
1595 | ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); |
1730 | ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); |
1596 | #endif |
1731 | #endif |
Line -... | Line 1732... | ||
- | 1732 | ||
- | 1733 | #else /* Z_SOLO */ |
|
- | 1734 | ||
- | 1735 | ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); |
|
- | 1736 | ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); |
|
- | 1737 | ||
- | 1738 | #endif /* !Z_SOLO */ |
|
1597 | 1739 | ||
1598 | /* hack for buggy compilers */ |
1740 | /* hack for buggy compilers */ |
1599 | #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) |
1741 | #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) |
1600 | struct internal_state {int dummy;}; |
1742 | struct internal_state {int dummy;}; |
Line 1601... | Line 1743... | ||
1601 | #endif |
1743 | #endif |
1602 | 1744 | ||
1603 | /* undocumented functions */ |
1745 | /* undocumented functions */ |
1604 | ZEXTERN const char * ZEXPORT zError OF((int)); |
1746 | ZEXTERN const char * ZEXPORT zError OF((int)); |
1605 | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); |
1747 | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); |
- | 1748 | ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); |
|
- | 1749 | ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); |
|
- | 1750 | ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); |
|
- | 1751 | ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); |
|
- | 1752 | #if defined(_WIN32) && !defined(Z_SOLO) |
|
- | 1753 | ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, |
|
- | 1754 | const char *mode)); |
|
- | 1755 | #endif |
|
- | 1756 | #if defined(STDC) || defined(Z_HAVE_STDARG_H) |
|
- | 1757 | # ifndef Z_SOLO |
|
- | 1758 | ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, |
|
- | 1759 | const char *format, |
|
- | 1760 | va_list va)); |
|
Line 1606... | Line 1761... | ||
1606 | ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); |
1761 | # endif |
1607 | ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); |
1762 | #endif |
1608 | 1763 |