OLD | NEW |
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.8, April 28th, 2013 | 2 version 1.2.5, April 19th, 2010 |
3 | 3 |
4 Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler | 4 Copyright (C) 1995-2010 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 |
8 arising from the use of this software. | 8 arising from the use of this software. |
9 | 9 |
10 Permission is granted to anyone to use this software for any purpose, | 10 Permission is granted to anyone to use this software for any purpose, |
11 including commercial applications, and to alter it and redistribute it | 11 including commercial applications, and to alter it and redistribute it |
12 freely, subject to the following restrictions: | 12 freely, subject to the following restrictions: |
13 | 13 |
14 1. The origin of this software must not be misrepresented; you must not | 14 1. The origin of this software must not be misrepresented; you must not |
15 claim that you wrote the original software. If you use this software | 15 claim that you wrote the original software. If you use this software |
16 in a product, an acknowledgment in the product documentation would be | 16 in a product, an acknowledgment in the product documentation would be |
17 appreciated but is not required. | 17 appreciated but is not required. |
18 2. Altered source versions must be plainly marked as such, and must not be | 18 2. Altered source versions must be plainly marked as such, and must not be |
19 misrepresented as being the original software. | 19 misrepresented as being the original software. |
20 3. This notice may not be removed or altered from any source distribution. | 20 3. This notice may not be removed or altered from any source distribution. |
21 | 21 |
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 |
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://tools.ietf.org/html/rfc1950 | 27 Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt |
28 (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). | 28 (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). |
29 */ | 29 */ |
30 | 30 |
31 #ifndef ZLIB_H | 31 #ifndef ZLIB_H |
32 #define ZLIB_H | 32 #define ZLIB_H |
33 | 33 |
34 #include "zconf.h" | 34 #include "zconf.h" |
35 | 35 |
36 #ifdef __cplusplus | 36 #ifdef __cplusplus |
37 extern "C" { | 37 extern "C" { |
38 #endif | 38 #endif |
39 | 39 |
40 #define ZLIB_VERSION "1.2.8" | 40 #define ZLIB_VERSION "1.2.5" |
41 #define ZLIB_VERNUM 0x1280 | 41 #define ZLIB_VERNUM 0x1250 |
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 8 | 44 #define ZLIB_VER_REVISION 5 |
45 #define ZLIB_VER_SUBREVISION 0 | 45 #define ZLIB_VER_SUBREVISION 0 |
46 | 46 |
47 /* | 47 /* |
48 The 'zlib' compression library provides in-memory compression and | 48 The 'zlib' compression library provides in-memory compression and |
49 decompression functions, including integrity checks of the uncompressed data. | 49 decompression functions, including integrity checks of the uncompressed data. |
50 This version of the library supports only one compression method (deflation) | 50 This version of the library supports only one compression method (deflation) |
51 but other algorithms will be added later and will have the same stream | 51 but other algorithms will be added later and will have the same stream |
52 interface. | 52 interface. |
53 | 53 |
54 Compression can be done in a single step if the buffers are large enough, | 54 Compression can be done in a single step if the buffers are large enough, |
(...skipping 21 matching lines...) Expand all Loading... |
76 the consistency of the compressed data, so the library should never crash | 76 the consistency of the compressed data, so the library should never crash |
77 even in case of corrupted input. | 77 even in case of corrupted input. |
78 */ | 78 */ |
79 | 79 |
80 typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); | 80 typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); |
81 typedef void (*free_func) OF((voidpf opaque, voidpf address)); | 81 typedef void (*free_func) OF((voidpf opaque, voidpf address)); |
82 | 82 |
83 struct internal_state; | 83 struct internal_state; |
84 | 84 |
85 typedef struct z_stream_s { | 85 typedef struct z_stream_s { |
86 z_const Bytef *next_in; /* next input byte */ | 86 Bytef *next_in; /* next input byte */ |
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 number of input bytes read so far */ | 88 uLong total_in; /* total nb of input bytes read so far */ |
89 | 89 |
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 */ |
92 uLong total_out; /* total number of bytes output so far */ | 92 uLong total_out; /* total nb of bytes output so far */ |
93 | 93 |
94 z_const char *msg; /* last error message, NULL if no error */ | 94 char *msg; /* last error message, NULL if no error */ |
95 struct internal_state FAR *state; /* not visible by applications */ | 95 struct internal_state FAR *state; /* not visible by applications */ |
96 | 96 |
97 alloc_func zalloc; /* used to allocate the internal state */ | 97 alloc_func zalloc; /* used to allocate the internal state */ |
98 free_func zfree; /* used to free the internal state */ | 98 free_func zfree; /* used to free the internal state */ |
99 voidpf opaque; /* private data object passed to zalloc and zfree */ | 99 voidpf opaque; /* private data object passed to zalloc and zfree */ |
100 | 100 |
101 int data_type; /* best guess about the data type: binary or text */ | 101 int data_type; /* best guess about the data type: binary or text */ |
102 uLong adler; /* adler32 value of the uncompressed data */ | 102 uLong adler; /* adler32 value of the uncompressed data */ |
103 uLong reserved; /* reserved for future use */ | 103 uLong reserved; /* reserved for future use */ |
104 int clas; | 104 int clas; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 If the parameter flush is set to Z_FINISH, pending input is processed, | 325 If the parameter flush is set to Z_FINISH, pending input is processed, |
326 pending output is flushed and deflate returns with Z_STREAM_END if there was | 326 pending output is flushed and deflate returns with Z_STREAM_END if there was |
327 enough output space; if deflate returns with Z_OK, this function must be | 327 enough output space; if deflate returns with Z_OK, this function must be |
328 called again with Z_FINISH and more output space (updated avail_out) but no | 328 called again with Z_FINISH and more output space (updated avail_out) but no |
329 more input data, until it returns with Z_STREAM_END or an error. After | 329 more input data, until it returns with Z_STREAM_END or an error. After |
330 deflate has returned Z_STREAM_END, the only possible operations on the stream | 330 deflate has returned Z_STREAM_END, the only possible operations on the stream |
331 are deflateReset or deflateEnd. | 331 are deflateReset or deflateEnd. |
332 | 332 |
333 Z_FINISH can be used immediately after deflateInit if all the compression | 333 Z_FINISH can be used immediately after deflateInit if all the compression |
334 is to be done in a single step. In this case, avail_out must be at least the | 334 is to be done in a single step. In this case, avail_out must be at least the |
335 value returned by deflateBound (see below). Then deflate is guaranteed to | 335 value returned by deflateBound (see below). If deflate does not return |
336 return Z_STREAM_END. If not enough output space is provided, deflate will | 336 Z_STREAM_END, then it must be called again as described above. |
337 not return Z_STREAM_END, and it must be called again as described above. | |
338 | 337 |
339 deflate() sets strm->adler to the adler32 checksum of all input read | 338 deflate() sets strm->adler to the adler32 checksum of all input read |
340 so far (that is, total_in bytes). | 339 so far (that is, total_in bytes). |
341 | 340 |
342 deflate() may update strm->data_type if it can make a good guess about | 341 deflate() may update strm->data_type if it can make a good guess about |
343 the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered | 342 the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered |
344 binary. This field is only for information purposes and does not affect the | 343 binary. This field is only for information purposes and does not affect the |
345 compression algorithm in any manner. | 344 compression algorithm in any manner. |
346 | 345 |
347 deflate() returns Z_OK if some progress has been made (more input | 346 deflate() returns Z_OK if some progress has been made (more input |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 end of each deflate block header is reached, before any actual data in that | 449 end of each deflate block header is reached, before any actual data in that |
451 block is decoded. This allows the caller to determine the length of the | 450 block is decoded. This allows the caller to determine the length of the |
452 deflate block header for later use in random access within a deflate block. | 451 deflate block header for later use in random access within a deflate block. |
453 256 is added to the value of strm->data_type when inflate() returns | 452 256 is added to the value of strm->data_type when inflate() returns |
454 immediately after reaching the end of the deflate block header. | 453 immediately after reaching the end of the deflate block header. |
455 | 454 |
456 inflate() should normally be called until it returns Z_STREAM_END or an | 455 inflate() should normally be called until it returns Z_STREAM_END or an |
457 error. However if all decompression is to be performed in a single step (a | 456 error. However if all decompression is to be performed in a single step (a |
458 single call of inflate), the parameter flush should be set to Z_FINISH. In | 457 single call of inflate), the parameter flush should be set to Z_FINISH. In |
459 this case all pending input is processed and all pending output is flushed; | 458 this case all pending input is processed and all pending output is flushed; |
460 avail_out must be large enough to hold all of the uncompressed data for the | 459 avail_out must be large enough to hold all the uncompressed data. (The size |
461 operation to complete. (The size of the uncompressed data may have been | 460 of the uncompressed data may have been saved by the compressor for this |
462 saved by the compressor for this purpose.) The use of Z_FINISH is not | 461 purpose.) The next operation on this stream must be inflateEnd to deallocate |
463 required to perform an inflation in one step. However it may be used to | 462 the decompression state. The use of Z_FINISH is never required, but can be |
464 inform inflate that a faster approach can be used for the single inflate() | 463 used to inform inflate that a faster approach may be used for the single |
465 call. Z_FINISH also informs inflate to not maintain a sliding window if the | 464 inflate() call. |
466 stream completes, which reduces inflate's memory footprint. If the stream | |
467 does not complete, either because not all of the stream is provided or not | |
468 enough output space is provided, then a sliding window will be allocated and | |
469 inflate() can be called again to continue the operation as if Z_NO_FLUSH had | |
470 been used. | |
471 | 465 |
472 In this implementation, inflate() always flushes as much output as | 466 In this implementation, inflate() always flushes as much output as |
473 possible to the output buffer, and always uses the faster approach on the | 467 possible to the output buffer, and always uses the faster approach on the |
474 first call. So the effects of the flush parameter in this implementation are | 468 first call. So the only effect of the flush parameter in this implementation |
475 on the return value of inflate() as noted below, when inflate() returns early | 469 is on the return value of inflate(), as noted below, or when it returns early |
476 when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of | 470 because Z_BLOCK or Z_TREES is used. |
477 memory for a sliding window when Z_FINISH is used. | |
478 | 471 |
479 If a preset dictionary is needed after this call (see inflateSetDictionary | 472 If a preset dictionary is needed after this call (see inflateSetDictionary |
480 below), inflate sets strm->adler to the Adler-32 checksum of the dictionary | 473 below), inflate sets strm->adler to the adler32 checksum of the dictionary |
481 chosen by the compressor and returns Z_NEED_DICT; otherwise it sets | 474 chosen by the compressor and returns Z_NEED_DICT; otherwise it sets |
482 strm->adler to the Adler-32 checksum of all output produced so far (that is, | 475 strm->adler to the adler32 checksum of all output produced so far (that is, |
483 total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described | 476 total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described |
484 below. At the end of the stream, inflate() checks that its computed adler32 | 477 below. At the end of the stream, inflate() checks that its computed adler32 |
485 checksum is equal to that saved by the compressor and returns Z_STREAM_END | 478 checksum is equal to that saved by the compressor and returns Z_STREAM_END |
486 only if the checksum is correct. | 479 only if the checksum is correct. |
487 | 480 |
488 inflate() can decompress and check either zlib-wrapped or gzip-wrapped | 481 inflate() can decompress and check either zlib-wrapped or gzip-wrapped |
489 deflate data. The header type is detected automatically, if requested when | 482 deflate data. The header type is detected automatically, if requested when |
490 initializing with inflateInit2(). Any information contained in the gzip | 483 initializing with inflateInit2(). Any information contained in the gzip |
491 header is not retained, so applications that need that information should | 484 header is not retained, so applications that need that information should |
492 instead use raw inflate, see inflateInit2() below, or inflateBack() and | 485 instead use raw inflate, see inflateInit2() below, or inflateBack() and |
493 perform their own processing of the gzip header and trailer. When processing | 486 perform their own processing of the gzip header and trailer. |
494 gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output | |
495 producted so far. The CRC-32 is checked against the gzip trailer. | |
496 | 487 |
497 inflate() returns Z_OK if some progress has been made (more input processed | 488 inflate() returns Z_OK if some progress has been made (more input processed |
498 or more output produced), Z_STREAM_END if the end of the compressed data has | 489 or more output produced), Z_STREAM_END if the end of the compressed data has |
499 been reached and all uncompressed output has been produced, Z_NEED_DICT if a | 490 been reached and all uncompressed output has been produced, Z_NEED_DICT if a |
500 preset dictionary is needed at this point, Z_DATA_ERROR if the input data was | 491 preset dictionary is needed at this point, Z_DATA_ERROR if the input data was |
501 corrupted (input stream not conforming to the zlib format or incorrect check | 492 corrupted (input stream not conforming to the zlib format or incorrect check |
502 value), Z_STREAM_ERROR if the stream structure was inconsistent (for example | 493 value), Z_STREAM_ERROR if the stream structure was inconsistent (for example |
503 next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, | 494 next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, |
504 Z_BUF_ERROR if no progress is possible or if there was not enough room in the | 495 Z_BUF_ERROR if no progress is possible or if there was not enough room in the |
505 output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and | 496 output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 incompatible with the version assumed by the caller (ZLIB_VERSION). msg is | 578 incompatible with the version assumed by the caller (ZLIB_VERSION). msg is |
588 set to null if there is no error message. deflateInit2 does not perform any | 579 set to null if there is no error message. deflateInit2 does not perform any |
589 compression: this will be done by deflate(). | 580 compression: this will be done by deflate(). |
590 */ | 581 */ |
591 | 582 |
592 ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, | 583 ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, |
593 const Bytef *dictionary, | 584 const Bytef *dictionary, |
594 uInt dictLength)); | 585 uInt dictLength)); |
595 /* | 586 /* |
596 Initializes the compression dictionary from the given byte sequence | 587 Initializes the compression dictionary from the given byte sequence |
597 without producing any compressed output. When using the zlib format, this | 588 without producing any compressed output. This function must be called |
598 function must be called immediately after deflateInit, deflateInit2 or | 589 immediately after deflateInit, deflateInit2 or deflateReset, before any call |
599 deflateReset, and before any call of deflate. When doing raw deflate, this | 590 of deflate. The compressor and decompressor must use exactly the same |
600 function must be called either before any call of deflate, or immediately | 591 dictionary (see inflateSetDictionary). |
601 after the completion of a deflate block, i.e. after all input has been | |
602 consumed and all output has been delivered when using any of the flush | |
603 options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The | |
604 compressor and decompressor must use exactly the same dictionary (see | |
605 inflateSetDictionary). | |
606 | 592 |
607 The dictionary should consist of strings (byte sequences) that are likely | 593 The dictionary should consist of strings (byte sequences) that are likely |
608 to be encountered later in the data to be compressed, with the most commonly | 594 to be encountered later in the data to be compressed, with the most commonly |
609 used strings preferably put towards the end of the dictionary. Using a | 595 used strings preferably put towards the end of the dictionary. Using a |
610 dictionary is most useful when the data to be compressed is short and can be | 596 dictionary is most useful when the data to be compressed is short and can be |
611 predicted with good accuracy; the data can then be compressed better than | 597 predicted with good accuracy; the data can then be compressed better than |
612 with the default empty dictionary. | 598 with the default empty dictionary. |
613 | 599 |
614 Depending on the size of the compression data structures selected by | 600 Depending on the size of the compression data structures selected by |
615 deflateInit or deflateInit2, a part of the dictionary may in effect be | 601 deflateInit or deflateInit2, a part of the dictionary may in effect be |
616 discarded, for example if the dictionary is larger than the window size | 602 discarded, for example if the dictionary is larger than the window size |
617 provided in deflateInit or deflateInit2. Thus the strings most likely to be | 603 provided in deflateInit or deflateInit2. Thus the strings most likely to be |
618 useful should be put at the end of the dictionary, not at the front. In | 604 useful should be put at the end of the dictionary, not at the front. In |
619 addition, the current implementation of deflate will use at most the window | 605 addition, the current implementation of deflate will use at most the window |
620 size minus 262 bytes of the provided dictionary. | 606 size minus 262 bytes of the provided dictionary. |
621 | 607 |
622 Upon return of this function, strm->adler is set to the adler32 value | 608 Upon return of this function, strm->adler is set to the adler32 value |
623 of the dictionary; the decompressor may later use this value to determine | 609 of the dictionary; the decompressor may later use this value to determine |
624 which dictionary has been used by the compressor. (The adler32 value | 610 which dictionary has been used by the compressor. (The adler32 value |
625 applies to the whole dictionary even if only a subset of the dictionary is | 611 applies to the whole dictionary even if only a subset of the dictionary is |
626 actually used by the compressor.) If a raw deflate was requested, then the | 612 actually used by the compressor.) If a raw deflate was requested, then the |
627 adler32 value is not computed and strm->adler is not set. | 613 adler32 value is not computed and strm->adler is not set. |
628 | 614 |
629 deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a | 615 deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a |
630 parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is | 616 parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is |
631 inconsistent (for example if deflate has already been called for this stream | 617 inconsistent (for example if deflate has already been called for this stream |
632 or if not at a block boundary for raw deflate). deflateSetDictionary does | 618 or if the compression method is bsort). deflateSetDictionary does not |
633 not perform any compression: this will be done by deflate(). | 619 perform any compression: this will be done by deflate(). |
634 */ | 620 */ |
635 | 621 |
636 ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, | 622 ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, |
637 z_streamp source)); | 623 z_streamp source)); |
638 /* | 624 /* |
639 Sets the destination stream as a complete copy of the source stream. | 625 Sets the destination stream as a complete copy of the source stream. |
640 | 626 |
641 This function can be useful when several compression strategies will be | 627 This function can be useful when several compression strategies will be |
642 tried, for example when there are several ways of pre-processing the input | 628 tried, for example when there are several ways of pre-processing the input |
643 data with a filter. The streams that will be discarded should then be freed | 629 data with a filter. The streams that will be discarded should then be freed |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. | 686 returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. |
701 */ | 687 */ |
702 | 688 |
703 ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, | 689 ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, |
704 uLong sourceLen)); | 690 uLong sourceLen)); |
705 /* | 691 /* |
706 deflateBound() returns an upper bound on the compressed size after | 692 deflateBound() returns an upper bound on the compressed size after |
707 deflation of sourceLen bytes. It must be called after deflateInit() or | 693 deflation of sourceLen bytes. It must be called after deflateInit() or |
708 deflateInit2(), and after deflateSetHeader(), if used. This would be used | 694 deflateInit2(), and after deflateSetHeader(), if used. This would be used |
709 to allocate an output buffer for deflation in a single pass, and so would be | 695 to allocate an output buffer for deflation in a single pass, and so would be |
710 called before deflate(). If that first deflate() call is provided the | 696 called before deflate(). |
711 sourceLen input bytes, an output buffer allocated to the size returned by | |
712 deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed | |
713 to return Z_STREAM_END. Note that it is possible for the compressed size to | |
714 be larger than the value returned by deflateBound() if flush options other | |
715 than Z_FINISH or Z_NO_FLUSH are used. | |
716 */ | 697 */ |
717 | 698 |
718 ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, | |
719 unsigned *pending, | |
720 int *bits)); | |
721 /* | |
722 deflatePending() returns the number of bytes and bits of output that have | |
723 been generated, but not yet provided in the available output. The bytes not | |
724 provided would be due to the available output space having being consumed. | |
725 The number of bits of output not provided are between 0 and 7, where they | |
726 await more bits to join them in order to fill out a full byte. If pending | |
727 or bits are Z_NULL, then those values are not set. | |
728 | |
729 deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source | |
730 stream state was inconsistent. | |
731 */ | |
732 | |
733 ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, | 699 ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, |
734 int bits, | 700 int bits, |
735 int value)); | 701 int value)); |
736 /* | 702 /* |
737 deflatePrime() inserts bits in the deflate output stream. The intent | 703 deflatePrime() inserts bits in the deflate output stream. The intent |
738 is that this function is used to start off the deflate output with the bits | 704 is that this function is used to start off the deflate output with the bits |
739 leftover from a previous deflate stream when appending to it. As such, this | 705 leftover from a previous deflate stream when appending to it. As such, this |
740 function can only be used for raw deflate, and must be used before the first | 706 function can only be used for raw deflate, and must be used before the first |
741 deflate() call after a deflateInit2() or deflateReset(). bits must be less | 707 deflate() call after a deflateInit2() or deflateReset(). bits must be less |
742 than or equal to 16, and that many of the least significant bits of value | 708 than or equal to 16, and that many of the least significant bits of value |
743 will be inserted in the output. | 709 will be inserted in the output. |
744 | 710 |
745 deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough | 711 deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source |
746 room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the | 712 stream state was inconsistent. |
747 source stream state was inconsistent. | |
748 */ | 713 */ |
749 | 714 |
750 ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, | 715 ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, |
751 gz_headerp head)); | 716 gz_headerp head)); |
752 /* | 717 /* |
753 deflateSetHeader() provides gzip header information for when a gzip | 718 deflateSetHeader() provides gzip header information for when a gzip |
754 stream is requested by deflateInit2(). deflateSetHeader() may be called | 719 stream is requested by deflateInit2(). deflateSetHeader() may be called |
755 after deflateInit2() or deflateReset() and before the first call of | 720 after deflateInit2() or deflateReset() and before the first call of |
756 deflate(). The text, time, os, extra field, name, and comment information | 721 deflate(). The text, time, os, extra field, name, and comment information |
757 in the provided gz_header structure are written to the gzip header (xflag is | 722 in the provided gz_header structure are written to the gzip header (xflag is |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 | 788 |
824 ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, | 789 ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, |
825 const Bytef *dictionary, | 790 const Bytef *dictionary, |
826 uInt dictLength)); | 791 uInt dictLength)); |
827 /* | 792 /* |
828 Initializes the decompression dictionary from the given uncompressed byte | 793 Initializes the decompression dictionary from the given uncompressed byte |
829 sequence. This function must be called immediately after a call of inflate, | 794 sequence. This function must be called immediately after a call of inflate, |
830 if that call returned Z_NEED_DICT. The dictionary chosen by the compressor | 795 if that call returned Z_NEED_DICT. The dictionary chosen by the compressor |
831 can be determined from the adler32 value returned by that call of inflate. | 796 can be determined from the adler32 value returned by that call of inflate. |
832 The compressor and decompressor must use exactly the same dictionary (see | 797 The compressor and decompressor must use exactly the same dictionary (see |
833 deflateSetDictionary). For raw inflate, this function can be called at any | 798 deflateSetDictionary). For raw inflate, this function can be called |
834 time to set the dictionary. If the provided dictionary is smaller than the | 799 immediately after inflateInit2() or inflateReset() and before any call of |
835 window and there is already data in the window, then the provided dictionary | 800 inflate() to set the dictionary. The application must insure that the |
836 will amend what's there. The application must insure that the dictionary | 801 dictionary that was used for compression is provided. |
837 that was used for compression is provided. | |
838 | 802 |
839 inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a | 803 inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a |
840 parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is | 804 parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is |
841 inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the | 805 inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the |
842 expected one (incorrect adler32 value). inflateSetDictionary does not | 806 expected one (incorrect adler32 value). inflateSetDictionary does not |
843 perform any decompression: this will be done by subsequent calls of | 807 perform any decompression: this will be done by subsequent calls of |
844 inflate(). | 808 inflate(). |
845 */ | 809 */ |
846 | 810 |
847 ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, | |
848 Bytef *dictionary, | |
849 uInt *dictLength)); | |
850 /* | |
851 Returns the sliding dictionary being maintained by inflate. dictLength is | |
852 set to the number of bytes in the dictionary, and that many bytes are copied | |
853 to dictionary. dictionary must have enough space, where 32768 bytes is | |
854 always enough. If inflateGetDictionary() is called with dictionary equal to | |
855 Z_NULL, then only the dictionary length is returned, and nothing is copied. | |
856 Similary, if dictLength is Z_NULL, then it is not set. | |
857 | |
858 inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the | |
859 stream state is inconsistent. | |
860 */ | |
861 | |
862 ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); | 811 ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); |
863 /* | 812 /* |
864 Skips invalid compressed data until a possible full flush point (see above | 813 Skips invalid compressed data until a full flush point (see above the |
865 for the description of deflate with Z_FULL_FLUSH) can be found, or until all | 814 description of deflate with Z_FULL_FLUSH) can be found, or until all |
866 available input is skipped. No output is provided. | 815 available input is skipped. No output is provided. |
867 | 816 |
868 inflateSync searches for a 00 00 FF FF pattern in the compressed data. | 817 inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR |
869 All full flush points have this pattern, but not all occurrences of this | 818 if no more input was provided, Z_DATA_ERROR if no flush point has been |
870 pattern are full flush points. | 819 found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the |
871 | 820 success case, the application may save the current current value of total_in |
872 inflateSync returns Z_OK if a possible full flush point has been found, | 821 which indicates where valid compressed data was found. In the error case, |
873 Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point | 822 the application may repeatedly call inflateSync, providing more input each |
874 has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. | 823 time, until success or end of the input data. |
875 In the success case, the application may save the current current value of | |
876 total_in which indicates where valid compressed data was found. In the | |
877 error case, the application may repeatedly call inflateSync, providing more | |
878 input each time, until success or end of the input data. | |
879 */ | 824 */ |
880 | 825 |
881 ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, | 826 ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, |
882 z_streamp source)); | 827 z_streamp source)); |
883 /* | 828 /* |
884 Sets the destination stream as a complete copy of the source stream. | 829 Sets the destination stream as a complete copy of the source stream. |
885 | 830 |
886 This function can be useful when randomly accessing a large stream. The | 831 This function can be useful when randomly accessing a large stream. The |
887 first pass through the stream can periodically record the inflate state, | 832 first pass through the stream can periodically record the inflate state, |
888 allowing restarting inflate at those points when randomly accessing the | 833 allowing restarting inflate at those points when randomly accessing the |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 derived memory allocation routines are used. windowBits is the base two | 960 derived memory allocation routines are used. windowBits is the base two |
1016 logarithm of the window size, in the range 8..15. window is a caller | 961 logarithm of the window size, in the range 8..15. window is a caller |
1017 supplied buffer of that size. Except for special applications where it is | 962 supplied buffer of that size. Except for special applications where it is |
1018 assured that deflate was used with small window sizes, windowBits must be 15 | 963 assured that deflate was used with small window sizes, windowBits must be 15 |
1019 and a 32K byte window must be supplied to be able to decompress general | 964 and a 32K byte window must be supplied to be able to decompress general |
1020 deflate streams. | 965 deflate streams. |
1021 | 966 |
1022 See inflateBack() for the usage of these routines. | 967 See inflateBack() for the usage of these routines. |
1023 | 968 |
1024 inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of | 969 inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of |
1025 the parameters are invalid, Z_MEM_ERROR if the internal state could not be | 970 the paramaters are invalid, Z_MEM_ERROR if the internal state could not be |
1026 allocated, or Z_VERSION_ERROR if the version of the library does not match | 971 allocated, or Z_VERSION_ERROR if the version of the library does not match |
1027 the version of the header file. | 972 the version of the header file. |
1028 */ | 973 */ |
1029 | 974 |
1030 typedef unsigned (*in_func) OF((void FAR *, | 975 typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); |
1031 z_const unsigned char FAR * FAR *)); | |
1032 typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); | 976 typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); |
1033 | 977 |
1034 ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, | 978 ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, |
1035 in_func in, void FAR *in_desc, | 979 in_func in, void FAR *in_desc, |
1036 out_func out, void FAR *out_desc)); | 980 out_func out, void FAR *out_desc)); |
1037 /* | 981 /* |
1038 inflateBack() does a raw inflate with a single call using a call-back | 982 inflateBack() does a raw inflate with a single call using a call-back |
1039 interface for input and output. This is potentially more efficient than | 983 interface for input and output. This is more efficient than inflate() for |
1040 inflate() for file i/o applications, in that it avoids copying between the | 984 file i/o applications in that it avoids copying between the output and the |
1041 output and the sliding window by simply making the window itself the output | 985 sliding window by simply making the window itself the output buffer. This |
1042 buffer. inflate() can be faster on modern CPUs when used with large | 986 function trusts the application to not change the output buffer passed by |
1043 buffers. inflateBack() trusts the application to not change the output | 987 the output function, at least until inflateBack() returns. |
1044 buffer passed by the output function, at least until inflateBack() returns. | |
1045 | 988 |
1046 inflateBackInit() must be called first to allocate the internal state | 989 inflateBackInit() must be called first to allocate the internal state |
1047 and to initialize the state with the user-provided window buffer. | 990 and to initialize the state with the user-provided window buffer. |
1048 inflateBack() may then be used multiple times to inflate a complete, raw | 991 inflateBack() may then be used multiple times to inflate a complete, raw |
1049 deflate stream with each call. inflateBackEnd() is then called to free the | 992 deflate stream with each call. inflateBackEnd() is then called to free the |
1050 allocated state. | 993 allocated state. |
1051 | 994 |
1052 A raw deflate stream is one with no zlib or gzip header or trailer. | 995 A raw deflate stream is one with no zlib or gzip header or trailer. |
1053 This routine would normally be used in a utility that reads zip or gzip | 996 This routine would normally be used in a utility that reads zip or gzip |
1054 files and writes out uncompressed files. The utility would decode the | 997 files and writes out uncompressed files. The utility would decode the |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 | 1086 |
1144 The sprintf variant used by gzprintf (zero is best): | 1087 The sprintf variant used by gzprintf (zero is best): |
1145 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format | 1088 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format |
1146 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! | 1089 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! |
1147 26: 0 = returns value, 1 = void -- 1 means inferred string length returned | 1090 26: 0 = returns value, 1 = void -- 1 means inferred string length returned |
1148 | 1091 |
1149 Remainder: | 1092 Remainder: |
1150 27-31: 0 (reserved) | 1093 27-31: 0 (reserved) |
1151 */ | 1094 */ |
1152 | 1095 |
1153 #ifndef Z_SOLO | |
1154 | 1096 |
1155 /* utility functions */ | 1097 /* utility functions */ |
1156 | 1098 |
1157 /* | 1099 /* |
1158 The following utility functions are implemented on top of the basic | 1100 The following utility functions are implemented on top of the basic |
1159 stream-oriented functions. To simplify the interface, some default options | 1101 stream-oriented functions. To simplify the interface, some default options |
1160 are assumed (compression level and memory usage, standard memory allocation | 1102 are assumed (compression level and memory usage, standard memory allocation |
1161 functions). The source code of these utility functions can be modified if | 1103 functions). The source code of these utility functions can be modified if |
1162 you need special options. | 1104 you need special options. |
1163 */ | 1105 */ |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 Decompresses the source buffer into the destination buffer. sourceLen is | 1147 Decompresses the source buffer into the destination buffer. sourceLen is |
1206 the byte length of the source buffer. Upon entry, destLen is the total size | 1148 the byte length of the source buffer. Upon entry, destLen is the total size |
1207 of the destination buffer, which must be large enough to hold the entire | 1149 of the destination buffer, which must be large enough to hold the entire |
1208 uncompressed data. (The size of the uncompressed data must have been saved | 1150 uncompressed data. (The size of the uncompressed data must have been saved |
1209 previously by the compressor and transmitted to the decompressor by some | 1151 previously by the compressor and transmitted to the decompressor by some |
1210 mechanism outside the scope of this compression library.) Upon exit, destLen | 1152 mechanism outside the scope of this compression library.) Upon exit, destLen |
1211 is the actual size of the uncompressed buffer. | 1153 is the actual size of the uncompressed buffer. |
1212 | 1154 |
1213 uncompress returns Z_OK if success, Z_MEM_ERROR if there was not | 1155 uncompress returns Z_OK if success, Z_MEM_ERROR if there was not |
1214 enough memory, Z_BUF_ERROR if there was not enough room in the output | 1156 enough memory, Z_BUF_ERROR if there was not enough room in the output |
1215 buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In | 1157 buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. |
1216 the case where there is not enough room, uncompress() will fill the output | |
1217 buffer with the uncompressed data up to that point. | |
1218 */ | 1158 */ |
1219 | 1159 |
| 1160 |
1220 /* gzip file access functions */ | 1161 /* gzip file access functions */ |
1221 | 1162 |
1222 /* | 1163 /* |
1223 This library supports reading and writing files in gzip (.gz) format with | 1164 This library supports reading and writing files in gzip (.gz) format with |
1224 an interface similar to that of stdio, using the functions that start with | 1165 an interface similar to that of stdio, using the functions that start with |
1225 "gz". The gzip format is different from the zlib format. gzip is a gzip | 1166 "gz". The gzip format is different from the zlib format. gzip is a gzip |
1226 wrapper, documented in RFC 1952, wrapped around a deflate stream. | 1167 wrapper, documented in RFC 1952, wrapped around a deflate stream. |
1227 */ | 1168 */ |
1228 | 1169 |
1229 typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ | 1170 typedef voidp gzFile; /* opaque gzip file descriptor */ |
1230 | 1171 |
1231 /* | 1172 /* |
1232 ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | 1173 ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); |
1233 | 1174 |
1234 Opens a gzip (.gz) file for reading or writing. The mode parameter is as | 1175 Opens a gzip (.gz) file for reading or writing. The mode parameter is as |
1235 in fopen ("rb" or "wb") but can also include a compression level ("wb9") or | 1176 in fopen ("rb" or "wb") but can also include a compression level ("wb9") or |
1236 a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only | 1177 a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only |
1237 compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' | 1178 compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' |
1238 for fixed code compression as in "wb9F". (See the description of | 1179 for fixed code compression as in "wb9F". (See the description of |
1239 deflateInit2 for more information about the strategy parameter.) 'T' will | 1180 deflateInit2 for more information about the strategy parameter.) Also "a" |
1240 request transparent writing or appending with no compression and not using | 1181 can be used instead of "w" to request that the gzip stream that will be |
1241 the gzip format. | 1182 written be appended to the file. "+" will result in an error, since reading |
1242 | 1183 and writing to the same gzip file is not supported. |
1243 "a" can be used instead of "w" to request that the gzip stream that will | |
1244 be written be appended to the file. "+" will result in an error, since | |
1245 reading and writing to the same gzip file is not supported. The addition of | |
1246 "x" when writing will create the file exclusively, which fails if the file | |
1247 already exists. On systems that support it, the addition of "e" when | |
1248 reading or writing will set the flag to close the file on an execve() call. | |
1249 | |
1250 These functions, as well as gzip, will read and decode a sequence of gzip | |
1251 streams in a file. The append function of gzopen() can be used to create | |
1252 such a file. (Also see gzflush() for another way to do this.) When | |
1253 appending, gzopen does not test whether the file begins with a gzip stream, | |
1254 nor does it look for the end of the gzip streams to begin appending. gzopen | |
1255 will simply append a gzip stream to the existing file. | |
1256 | 1184 |
1257 gzopen can be used to read a file which is not in gzip format; in this | 1185 gzopen can be used to read a file which is not in gzip format; in this |
1258 case gzread will directly read from the file without decompression. When | 1186 case gzread will directly read from the file without decompression. |
1259 reading, this will be detected automatically by looking for the magic two- | |
1260 byte gzip header. | |
1261 | 1187 |
1262 gzopen returns NULL if the file could not be opened, if there was | 1188 gzopen returns NULL if the file could not be opened, if there was |
1263 insufficient memory to allocate the gzFile state, or if an invalid mode was | 1189 insufficient memory to allocate the gzFile state, or if an invalid mode was |
1264 specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). | 1190 specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). |
1265 errno can be checked to determine if the reason gzopen failed was that the | 1191 errno can be checked to determine if the reason gzopen failed was that the |
1266 file could not be opened. | 1192 file could not be opened. |
1267 */ | 1193 */ |
1268 | 1194 |
1269 ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); | 1195 ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); |
1270 /* | 1196 /* |
1271 gzdopen associates a gzFile with the file descriptor fd. File descriptors | 1197 gzdopen associates a gzFile with the file descriptor fd. File descriptors |
1272 are obtained from calls like open, dup, creat, pipe or fileno (if the file | 1198 are obtained from calls like open, dup, creat, pipe or fileno (if the file |
1273 has been previously opened with fopen). The mode parameter is as in gzopen. | 1199 has been previously opened with fopen). The mode parameter is as in gzopen. |
1274 | 1200 |
1275 The next call of gzclose on the returned gzFile will also close the file | 1201 The next call of gzclose on the returned gzFile will also close the file |
1276 descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor | 1202 descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor |
1277 fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, | 1203 fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, |
1278 mode);. The duplicated descriptor should be saved to avoid a leak, since | 1204 mode);. The duplicated descriptor should be saved to avoid a leak, since |
1279 gzdopen does not close fd if it fails. If you are using fileno() to get the | 1205 gzdopen does not close fd if it fails. |
1280 file descriptor from a FILE *, then you will have to use dup() to avoid | |
1281 double-close()ing the file descriptor. Both gzclose() and fclose() will | |
1282 close the associated file descriptor, so they need to have different file | |
1283 descriptors. | |
1284 | 1206 |
1285 gzdopen returns NULL if there was insufficient memory to allocate the | 1207 gzdopen returns NULL if there was insufficient memory to allocate the |
1286 gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not | 1208 gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not |
1287 provided, or '+' was provided), or if fd is -1. The file descriptor is not | 1209 provided, or '+' was provided), or if fd is -1. The file descriptor is not |
1288 used until the next gz* read, write, seek, or close operation, so gzdopen | 1210 used until the next gz* read, write, seek, or close operation, so gzdopen |
1289 will not detect if fd is invalid (unless fd is -1). | 1211 will not detect if fd is invalid (unless fd is -1). |
1290 */ | 1212 */ |
1291 | 1213 |
1292 ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); | 1214 ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); |
1293 /* | 1215 /* |
(...skipping 17 matching lines...) Expand all Loading... |
1311 Dynamically update the compression level or strategy. See the description | 1233 Dynamically update the compression level or strategy. See the description |
1312 of deflateInit2 for the meaning of these parameters. | 1234 of deflateInit2 for the meaning of these parameters. |
1313 | 1235 |
1314 gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not | 1236 gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not |
1315 opened for writing. | 1237 opened for writing. |
1316 */ | 1238 */ |
1317 | 1239 |
1318 ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); | 1240 ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); |
1319 /* | 1241 /* |
1320 Reads the given number of uncompressed bytes from the compressed file. If | 1242 Reads the given number of uncompressed bytes from the compressed file. If |
1321 the input file is not in gzip format, gzread copies the given number of | 1243 the input file was not in gzip format, gzread copies the given number of |
1322 bytes into the buffer directly from the file. | 1244 bytes into the buffer. |
1323 | 1245 |
1324 After reaching the end of a gzip stream in the input, gzread will continue | 1246 After reaching the end of a gzip stream in the input, gzread will continue |
1325 to read, looking for another gzip stream. Any number of gzip streams may be | 1247 to read, looking for another gzip stream, or failing that, reading the rest |
1326 concatenated in the input file, and will all be decompressed by gzread(). | 1248 of the input file directly without decompression. The entire input file |
1327 If something other than a gzip stream is encountered after a gzip stream, | 1249 will be read if gzread is called until it returns less than the requested |
1328 that remaining trailing garbage is ignored (and no error is returned). | 1250 len. |
1329 | |
1330 gzread can be used to read a gzip file that is being concurrently written. | |
1331 Upon reaching the end of the input, gzread will return with the available | |
1332 data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then | |
1333 gzclearerr can be used to clear the end of file indicator in order to permit | |
1334 gzread to be tried again. Z_OK indicates that a gzip stream was completed | |
1335 on the last gzread. Z_BUF_ERROR indicates that the input file ended in the | |
1336 middle of a gzip stream. Note that gzread does not return -1 in the event | |
1337 of an incomplete gzip stream. This error is deferred until gzclose(), which | |
1338 will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip | |
1339 stream. Alternatively, gzerror can be used before gzclose to detect this | |
1340 case. | |
1341 | 1251 |
1342 gzread returns the number of uncompressed bytes actually read, less than | 1252 gzread returns the number of uncompressed bytes actually read, less than |
1343 len for end of file, or -1 for error. | 1253 len for end of file, or -1 for error. |
1344 */ | 1254 */ |
1345 | 1255 |
1346 ZEXTERN int ZEXPORT gzwrite OF((gzFile file, | 1256 ZEXTERN int ZEXPORT gzwrite OF((gzFile file, |
1347 voidpc buf, unsigned len)); | 1257 voidpc buf, unsigned len)); |
1348 /* | 1258 /* |
1349 Writes the given number of uncompressed bytes into the compressed file. | 1259 Writes the given number of uncompressed bytes into the compressed file. |
1350 gzwrite returns the number of uncompressed bytes written or 0 in case of | 1260 gzwrite returns the number of uncompressed bytes written or 0 in case of |
1351 error. | 1261 error. |
1352 */ | 1262 */ |
1353 | 1263 |
1354 ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); | 1264 ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); |
1355 /* | 1265 /* |
1356 Converts, formats, and writes the arguments to the compressed file under | 1266 Converts, formats, and writes the arguments to the compressed file under |
1357 control of the format string, as in fprintf. gzprintf returns the number of | 1267 control of the format string, as in fprintf. gzprintf returns the number of |
1358 uncompressed bytes actually written, or 0 in case of error. The number of | 1268 uncompressed bytes actually written, or 0 in case of error. The number of |
1359 uncompressed bytes written is limited to 8191, or one less than the buffer | 1269 uncompressed bytes written is limited to 8191, or one less than the buffer |
1360 size given to gzbuffer(). The caller should assure that this limit is not | 1270 size given to gzbuffer(). The caller should assure that this limit is not |
1361 exceeded. If it is exceeded, then gzprintf() will return an error (0) with | 1271 exceeded. If it is exceeded, then gzprintf() will return an error (0) with |
1362 nothing written. In this case, there may also be a buffer overflow with | 1272 nothing written. In this case, there may also be a buffer overflow with |
1363 unpredictable consequences, which is possible only if zlib was compiled with | 1273 unpredictable consequences, which is possible only if zlib was compiled with |
1364 the insecure functions sprintf() or vsprintf() because the secure snprintf() | 1274 the insecure functions sprintf() or vsprintf() because the secure snprintf() |
(...skipping 24 matching lines...) Expand all Loading... |
1389 | 1299 |
1390 ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); | 1300 ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); |
1391 /* | 1301 /* |
1392 Writes c, converted to an unsigned char, into the compressed file. gzputc | 1302 Writes c, converted to an unsigned char, into the compressed file. gzputc |
1393 returns the value that was written, or -1 in case of error. | 1303 returns the value that was written, or -1 in case of error. |
1394 */ | 1304 */ |
1395 | 1305 |
1396 ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); | 1306 ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); |
1397 /* | 1307 /* |
1398 Reads one byte from the compressed file. gzgetc returns this byte or -1 | 1308 Reads one byte from the compressed file. gzgetc returns this byte or -1 |
1399 in case of end of file or error. This is implemented as a macro for speed. | 1309 in case of end of file or error. |
1400 As such, it does not do all of the checking the other functions do. I.e. | |
1401 it does not check to see if file is NULL, nor whether the structure file | |
1402 points to has been clobbered or not. | |
1403 */ | 1310 */ |
1404 | 1311 |
1405 ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); | 1312 ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); |
1406 /* | 1313 /* |
1407 Push one character back onto the stream to be read as the first character | 1314 Push one character back onto the stream to be read as the first character |
1408 on the next read. At least one character of push-back is allowed. | 1315 on the next read. At least one character of push-back is allowed. |
1409 gzungetc() returns the character pushed, or -1 on failure. gzungetc() will | 1316 gzungetc() returns the character pushed, or -1 on failure. gzungetc() will |
1410 fail if c is -1, and may fail if a character has been pushed but not read | 1317 fail if c is -1, and may fail if a character has been pushed but not read |
1411 yet. If gzungetc is used immediately after gzopen or gzdopen, at least the | 1318 yet. If gzungetc is used immediately after gzopen or gzdopen, at least the |
1412 output buffer size of pushed characters is allowed. (See gzbuffer above.) | 1319 output buffer size of pushed characters is allowed. (See gzbuffer above.) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 is an exact multiple of the buffer size. | 1395 is an exact multiple of the buffer size. |
1489 | 1396 |
1490 If gzeof() returns true, then the read functions will return no more data, | 1397 If gzeof() returns true, then the read functions will return no more data, |
1491 unless the end-of-file indicator is reset by gzclearerr() and the input file | 1398 unless the end-of-file indicator is reset by gzclearerr() and the input file |
1492 has grown since the previous end of file was detected. | 1399 has grown since the previous end of file was detected. |
1493 */ | 1400 */ |
1494 | 1401 |
1495 ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); | 1402 ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); |
1496 /* | 1403 /* |
1497 Returns true (1) if file is being copied directly while reading, or false | 1404 Returns true (1) if file is being copied directly while reading, or false |
1498 (0) if file is a gzip stream being decompressed. | 1405 (0) if file is a gzip stream being decompressed. This state can change from |
| 1406 false to true while reading the input file if the end of a gzip stream is |
| 1407 reached, but is followed by data that is not another gzip stream. |
1499 | 1408 |
1500 If the input file is empty, gzdirect() will return true, since the input | 1409 If the input file is empty, gzdirect() will return true, since the input |
1501 does not contain a gzip stream. | 1410 does not contain a gzip stream. |
1502 | 1411 |
1503 If gzdirect() is used immediately after gzopen() or gzdopen() it will | 1412 If gzdirect() is used immediately after gzopen() or gzdopen() it will |
1504 cause buffers to be allocated to allow reading the file to determine if it | 1413 cause buffers to be allocated to allow reading the file to determine if it |
1505 is a gzip file. Therefore if gzbuffer() is used, it should be called before | 1414 is a gzip file. Therefore if gzbuffer() is used, it should be called before |
1506 gzdirect(). | 1415 gzdirect(). |
1507 | |
1508 When writing, gzdirect() returns true (1) if transparent writing was | |
1509 requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: | |
1510 gzdirect() is not needed when writing. Transparent writing must be | |
1511 explicitly requested, so the application already knows the answer. When | |
1512 linking statically, using gzdirect() will include all of the zlib code for | |
1513 gzip file reading and decompression, which may not be desired.) | |
1514 */ | 1416 */ |
1515 | 1417 |
1516 ZEXTERN int ZEXPORT gzclose OF((gzFile file)); | 1418 ZEXTERN int ZEXPORT gzclose OF((gzFile file)); |
1517 /* | 1419 /* |
1518 Flushes all pending output if necessary, closes the compressed file and | 1420 Flushes all pending output if necessary, closes the compressed file and |
1519 deallocates the (de)compression state. Note that once file is closed, you | 1421 deallocates the (de)compression state. Note that once file is closed, you |
1520 cannot call gzerror with file, since its structures have been deallocated. | 1422 cannot call gzerror with file, since its structures have been deallocated. |
1521 gzclose must not be called more than once on the same file, just as free | 1423 gzclose must not be called more than once on the same file, just as free |
1522 must not be called more than once on the same allocation. | 1424 must not be called more than once on the same allocation. |
1523 | 1425 |
1524 gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a | 1426 gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a |
1525 file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the | 1427 file operation error, or Z_OK on success. |
1526 last read ended in the middle of a gzip stream, or Z_OK on success. | |
1527 */ | 1428 */ |
1528 | 1429 |
1529 ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); | 1430 ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); |
1530 ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); | 1431 ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); |
1531 /* | 1432 /* |
1532 Same as gzclose(), but gzclose_r() is only for use when reading, and | 1433 Same as gzclose(), but gzclose_r() is only for use when reading, and |
1533 gzclose_w() is only for use when writing or appending. The advantage to | 1434 gzclose_w() is only for use when writing or appending. The advantage to |
1534 using these instead of gzclose() is that they avoid linking in zlib | 1435 using these instead of gzclose() is that they avoid linking in zlib |
1535 compression or decompression code that is not used when only reading or only | 1436 compression or decompression code that is not used when only reading or only |
1536 writing respectively. If gzclose() is used, then both compression and | 1437 writing respectively. If gzclose() is used, then both compression and |
(...skipping 17 matching lines...) Expand all Loading... |
1554 functions above that do not distinguish those cases in their return values. | 1455 functions above that do not distinguish those cases in their return values. |
1555 */ | 1456 */ |
1556 | 1457 |
1557 ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); | 1458 ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); |
1558 /* | 1459 /* |
1559 Clears the error and end-of-file flags for file. This is analogous to the | 1460 Clears the error and end-of-file flags for file. This is analogous to the |
1560 clearerr() function in stdio. This is useful for continuing to read a gzip | 1461 clearerr() function in stdio. This is useful for continuing to read a gzip |
1561 file that is being written concurrently. | 1462 file that is being written concurrently. |
1562 */ | 1463 */ |
1563 | 1464 |
1564 #endif /* !Z_SOLO */ | |
1565 | 1465 |
1566 /* checksum functions */ | 1466 /* checksum functions */ |
1567 | 1467 |
1568 /* | 1468 /* |
1569 These functions are not related to compression but are exported | 1469 These functions are not related to compression but are exported |
1570 anyway because they might be useful in applications using the compression | 1470 anyway because they might be useful in applications using the compression |
1571 library. | 1471 library. |
1572 */ | 1472 */ |
1573 | 1473 |
1574 ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); | 1474 ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); |
(...skipping 15 matching lines...) Expand all Loading... |
1590 if (adler != original_adler) error(); | 1490 if (adler != original_adler) error(); |
1591 */ | 1491 */ |
1592 | 1492 |
1593 /* | 1493 /* |
1594 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, | 1494 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, |
1595 z_off_t len2)); | 1495 z_off_t len2)); |
1596 | 1496 |
1597 Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 | 1497 Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 |
1598 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for | 1498 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for |
1599 each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of | 1499 each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of |
1600 seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note | 1500 seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. |
1601 that the z_off_t type (like off_t) is a signed integer. If len2 is | |
1602 negative, the result has no meaning or utility. | |
1603 */ | 1501 */ |
1604 | 1502 |
1605 ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); | 1503 ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); |
1606 /* | 1504 /* |
1607 Update a running CRC-32 with the bytes buf[0..len-1] and return the | 1505 Update a running CRC-32 with the bytes buf[0..len-1] and return the |
1608 updated CRC-32. If buf is Z_NULL, this function returns the required | 1506 updated CRC-32. If buf is Z_NULL, this function returns the required |
1609 initial value for the crc. Pre- and post-conditioning (one's complement) is | 1507 initial value for the for the crc. Pre- and post-conditioning (one's |
1610 performed within this function so it shouldn't be done by the application. | 1508 complement) is performed within this function so it shouldn't be done by the |
| 1509 application. |
1611 | 1510 |
1612 Usage example: | 1511 Usage example: |
1613 | 1512 |
1614 uLong crc = crc32(0L, Z_NULL, 0); | 1513 uLong crc = crc32(0L, Z_NULL, 0); |
1615 | 1514 |
1616 while (read_buffer(buffer, length) != EOF) { | 1515 while (read_buffer(buffer, length) != EOF) { |
1617 crc = crc32(crc, buffer, length); | 1516 crc = crc32(crc, buffer, length); |
1618 } | 1517 } |
1619 if (crc != original_crc) error(); | 1518 if (crc != original_crc) error(); |
1620 */ | 1519 */ |
(...skipping 22 matching lines...) Expand all Loading... |
1643 int windowBits, int memLevel, | 1542 int windowBits, int memLevel, |
1644 int strategy, const char *version, | 1543 int strategy, const char *version, |
1645 int stream_size)); | 1544 int stream_size)); |
1646 ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, | 1545 ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, |
1647 const char *version, int stream_size)); | 1546 const char *version, int stream_size)); |
1648 ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, | 1547 ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, |
1649 unsigned char FAR *window, | 1548 unsigned char FAR *window, |
1650 const char *version, | 1549 const char *version, |
1651 int stream_size)); | 1550 int stream_size)); |
1652 #define deflateInit(strm, level) \ | 1551 #define deflateInit(strm, level) \ |
1653 deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) | 1552 deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) |
1654 #define inflateInit(strm) \ | 1553 #define inflateInit(strm) \ |
1655 inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) | 1554 inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) |
1656 #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ | 1555 #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ |
1657 deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ | 1556 deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ |
1658 (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) | 1557 (strategy), ZLIB_VERSION, sizeof(z_stream)) |
1659 #define inflateInit2(strm, windowBits) \ | 1558 #define inflateInit2(strm, windowBits) \ |
1660 inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ | 1559 inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) |
1661 (int)sizeof(z_stream)) | |
1662 #define inflateBackInit(strm, windowBits, window) \ | 1560 #define inflateBackInit(strm, windowBits, window) \ |
1663 inflateBackInit_((strm), (windowBits), (window), \ | 1561 inflateBackInit_((strm), (windowBits), (window), \ |
1664 ZLIB_VERSION, (int)sizeof(z_stream)) | 1562 ZLIB_VERSION, sizeof(z_stream)) |
1665 | |
1666 #ifndef Z_SOLO | |
1667 | |
1668 /* gzgetc() macro and its supporting function and exposed data structure. Note | |
1669 * that the real internal state is much larger than the exposed structure. | |
1670 * This abbreviated structure exposes just enough for the gzgetc() macro. The | |
1671 * user should not mess with these exposed elements, since their names or | |
1672 * behavior could change in the future, perhaps even capriciously. They can | |
1673 * only be used by the gzgetc() macro. You have been warned. | |
1674 */ | |
1675 struct gzFile_s { | |
1676 unsigned have; | |
1677 unsigned char *next; | |
1678 z_off64_t pos; | |
1679 }; | |
1680 ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ | |
1681 #ifdef Z_PREFIX_SET | |
1682 # undef z_gzgetc | |
1683 # define z_gzgetc(g) \ | |
1684 ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) | |
1685 #else | |
1686 # ifdef MOZZCONF_H | |
1687 # undef gzgetc | |
1688 # define gzgetc(g) \ | |
1689 ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : MOZ_Z_gzgetc(
g)) | |
1690 # else | |
1691 # define gzgetc(g) \ | |
1692 ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) | |
1693 # endif | |
1694 #endif | |
1695 | 1563 |
1696 /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or | 1564 /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or |
1697 * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if | 1565 * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if |
1698 * both are true, the application gets the *64 functions, and the regular | 1566 * both are true, the application gets the *64 functions, and the regular |
1699 * functions are changed to 64 bits) -- in case these are set on systems | 1567 * functions are changed to 64 bits) -- in case these are set on systems |
1700 * without large file support, _LFS64_LARGEFILE must also be true | 1568 * without large file support, _LFS64_LARGEFILE must also be true |
1701 */ | 1569 */ |
1702 #ifdef Z_LARGE64 | 1570 #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 |
1703 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); | 1571 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); |
1704 ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); | 1572 ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); |
1705 ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); | 1573 ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); |
1706 ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); | 1574 ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); |
1707 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); | 1575 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); |
1708 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); | 1576 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); |
1709 #endif | 1577 #endif |
1710 | 1578 |
1711 #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) | 1579 #if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 |
1712 # ifdef Z_PREFIX_SET | 1580 # ifdef gzopen |
1713 # define z_gzopen z_gzopen64 | 1581 # undef gzopen |
1714 # define z_gzseek z_gzseek64 | |
1715 # define z_gztell z_gztell64 | |
1716 # define z_gzoffset z_gzoffset64 | |
1717 # define z_adler32_combine z_adler32_combine64 | |
1718 # define z_crc32_combine z_crc32_combine64 | |
1719 # else | |
1720 # ifdef gzopen | |
1721 # undef gzopen | |
1722 # endif | |
1723 # define gzopen gzopen64 | |
1724 # ifdef gzseek | |
1725 # undef gzseek | |
1726 # endif | |
1727 # define gzseek gzseek64 | |
1728 # ifdef gztell | |
1729 # undef gztell | |
1730 # endif | |
1731 # define gztell gztell64 | |
1732 # ifdef gzoffset | |
1733 # undef gzoffset | |
1734 # endif | |
1735 # define gzoffset gzoffset64 | |
1736 # ifdef adler32_combine | |
1737 # undef adler32_combine | |
1738 # endif | |
1739 # define adler32_combine adler32_combine64 | |
1740 # ifdef crc32_combine | |
1741 # undef crc32_combine | |
1742 # endif | |
1743 # define crc32_combine crc32_combine64 | |
1744 # endif | 1582 # endif |
1745 # ifndef Z_LARGE64 | 1583 # define gzopen gzopen64 |
| 1584 # ifdef gzseek |
| 1585 # undef gzseek |
| 1586 # endif |
| 1587 # define gzseek gzseek64 |
| 1588 # ifdef gztell |
| 1589 # undef gztell |
| 1590 # endif |
| 1591 # define gztell gztell64 |
| 1592 # ifdef gzoffset |
| 1593 # undef gzoffset |
| 1594 # endif |
| 1595 # define gzoffset gzoffset64 |
| 1596 # ifdef adler32_combine |
| 1597 # undef adler32_combine |
| 1598 # endif |
| 1599 # define adler32_combine adler32_combine64 |
| 1600 # ifdef crc32_combine |
| 1601 # undef crc32_combine |
| 1602 # endif |
| 1603 # define crc32_combine crc32_combine64 |
| 1604 # ifdef _LARGEFILE64_SOURCE |
1746 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); | 1605 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); |
1747 ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); | 1606 ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); |
1748 ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); | 1607 ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); |
1749 ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); | 1608 ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); |
1750 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); | 1609 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); |
1751 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); | 1610 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); |
1752 # else | 1611 # else |
1753 ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); | 1612 ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); |
1754 ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); | 1613 ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); |
1755 ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); | 1614 ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); |
1756 ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); | 1615 ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); |
1757 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); | 1616 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); |
1758 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); | 1617 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); |
1759 # endif | 1618 # endif |
1760 #else | 1619 #else |
1761 ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); | 1620 ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); |
1762 ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); | 1621 ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); |
1763 ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); | 1622 ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); |
1764 ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); | 1623 ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); |
1765 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); | 1624 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); |
1766 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); | 1625 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); |
1767 #endif | 1626 #endif |
1768 | 1627 |
1769 #else /* Z_SOLO */ | |
1770 | |
1771 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); | |
1772 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); | |
1773 | |
1774 #endif /* !Z_SOLO */ | |
1775 | |
1776 /* hack for buggy compilers */ | 1628 /* hack for buggy compilers */ |
1777 #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) | 1629 #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) |
1778 struct internal_state {int dummy;}; | 1630 struct internal_state {int dummy;}; |
1779 #endif | 1631 #endif |
1780 | 1632 |
1781 /* undocumented functions */ | 1633 /* undocumented functions */ |
1782 ZEXTERN const char * ZEXPORT zError OF((int)); | 1634 ZEXTERN const char * ZEXPORT zError OF((int)); |
1783 ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); | 1635 ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); |
1784 ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); | 1636 ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); |
1785 ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); | 1637 ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); |
1786 ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); | |
1787 ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); | |
1788 #if defined(_WIN32) && !defined(Z_SOLO) | |
1789 ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, | |
1790 const char *mode)); | |
1791 #endif | |
1792 #if defined(STDC) || defined(Z_HAVE_STDARG_H) | |
1793 # ifndef Z_SOLO | |
1794 ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, | |
1795 const char *format, | |
1796 va_list va)); | |
1797 # endif | |
1798 #endif | |
1799 | 1638 |
1800 #ifdef __cplusplus | 1639 #ifdef __cplusplus |
1801 } | 1640 } |
1802 #endif | 1641 #endif |
1803 | 1642 |
1804 #endif /* ZLIB_H */ | 1643 #endif /* ZLIB_H */ |
OLD | NEW |