comparison zlib/zlib.h @ 2690:9ef72ee5c0b0

Update vendored zlib to 1.3.1
author Michael Pavone <pavone@retrodev.com>
date Sun, 15 Jun 2025 15:39:33 -0700
parents 00d788dac91a
children
comparison
equal deleted inserted replaced
2689:bd6e33de0972 2690:9ef72ee5c0b0
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.11, January 15th, 2017 2 version 1.3.1, January 22nd, 2024
3 3
4 Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler 4 Copyright (C) 1995-2024 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
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.11" 40 #define ZLIB_VERSION "1.3.1"
41 #define ZLIB_VERNUM 0x12b0 41 #define ZLIB_VERNUM 0x1310
42 #define ZLIB_VER_MAJOR 1 42 #define ZLIB_VER_MAJOR 1
43 #define ZLIB_VER_MINOR 2 43 #define ZLIB_VER_MINOR 3
44 #define ZLIB_VER_REVISION 11 44 #define ZLIB_VER_REVISION 1
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.
76 The library does not install any signal handler. The decoder checks 76 The library does not install any signal handler. The decoder checks
77 the consistency of the compressed data, so the library should never crash 77 the consistency of the compressed data, so the library should never crash
78 even in the case of corrupted input. 78 even in the case of corrupted input.
79 */ 79 */
80 80
81 typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); 81 typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size);
82 typedef void (*free_func) OF((voidpf opaque, voidpf address)); 82 typedef void (*free_func)(voidpf opaque, voidpf address);
83 83
84 struct internal_state; 84 struct internal_state;
85 85
86 typedef struct z_stream_s { 86 typedef struct z_stream_s {
87 z_const Bytef *next_in; /* next input byte */ 87 z_const Bytef *next_in; /* next input byte */
215 /* for compatibility with versions < 1.0.2 */ 215 /* for compatibility with versions < 1.0.2 */
216 216
217 217
218 /* basic functions */ 218 /* basic functions */
219 219
220 ZEXTERN const char * ZEXPORT zlibVersion OF((void)); 220 ZEXTERN const char * ZEXPORT zlibVersion(void);
221 /* The application can compare zlibVersion and ZLIB_VERSION for consistency. 221 /* The application can compare zlibVersion and ZLIB_VERSION for consistency.
222 If the first character differs, the library code actually used is not 222 If the first character differs, the library code actually used is not
223 compatible with the zlib.h header file used by the application. This check 223 compatible with the zlib.h header file used by the application. This check
224 is automatically made by deflateInit and inflateInit. 224 is automatically made by deflateInit and inflateInit.
225 */ 225 */
226 226
227 /* 227 /*
228 ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); 228 ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level);
229 229
230 Initializes the internal stream state for compression. The fields 230 Initializes the internal stream state for compression. The fields
231 zalloc, zfree and opaque must be initialized before by the caller. If 231 zalloc, zfree and opaque must be initialized before by the caller. If
232 zalloc and zfree are set to Z_NULL, deflateInit updates them to use default 232 zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
233 allocation functions. 233 allocation functions. total_in, total_out, adler, and msg are initialized.
234 234
235 The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 235 The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
236 1 gives best speed, 9 gives best compression, 0 gives no compression at all 236 1 gives best speed, 9 gives best compression, 0 gives no compression at all
237 (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION 237 (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION
238 requests a default compromise between speed and compression (currently 238 requests a default compromise between speed and compression (currently
245 if there is no error message. deflateInit does not perform any compression: 245 if there is no error message. deflateInit does not perform any compression:
246 this will be done by deflate(). 246 this will be done by deflate().
247 */ 247 */
248 248
249 249
250 ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); 250 ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush);
251 /* 251 /*
252 deflate compresses as much data as possible, and stops when the input 252 deflate compresses as much data as possible, and stops when the input
253 buffer becomes empty or the output buffer becomes full. It may introduce 253 buffer becomes empty or the output buffer becomes full. It may introduce
254 some output latency (reading input without producing any output) except when 254 some output latency (reading input without producing any output) except when
255 forced to flush. 255 forced to flush.
274 never be zero before the call. The application can consume the compressed 274 never be zero before the call. The application can consume the compressed
275 output when it wants, for example when the output buffer is full (avail_out 275 output when it wants, for example when the output buffer is full (avail_out
276 == 0), or after each call of deflate(). If deflate returns Z_OK and with 276 == 0), or after each call of deflate(). If deflate returns Z_OK and with
277 zero avail_out, it must be called again after making room in the output 277 zero avail_out, it must be called again after making room in the output
278 buffer because there might be more output pending. See deflatePending(), 278 buffer because there might be more output pending. See deflatePending(),
279 which can be used if desired to determine whether or not there is more ouput 279 which can be used if desired to determine whether or not there is more output
280 in that case. 280 in that case.
281 281
282 Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to 282 Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
283 decide how much data to accumulate before producing output, in order to 283 decide how much data to accumulate before producing output, in order to
284 maximize compression. 284 maximize compression.
318 318
319 If deflate returns with avail_out == 0, this function must be called again 319 If deflate returns with avail_out == 0, this function must be called again
320 with the same value of the flush parameter and more output space (updated 320 with the same value of the flush parameter and more output space (updated
321 avail_out), until the flush is complete (deflate returns with non-zero 321 avail_out), until the flush is complete (deflate returns with non-zero
322 avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that 322 avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
323 avail_out is greater than six to avoid repeated flush markers due to 323 avail_out is greater than six when the flush marker begins, in order to avoid
324 avail_out == 0 on return. 324 repeated flush markers upon calling deflate() again when avail_out == 0.
325 325
326 If the parameter flush is set to Z_FINISH, pending input is processed, 326 If the parameter flush is set to Z_FINISH, pending input is processed,
327 pending output is flushed and deflate returns with Z_STREAM_END if there was 327 pending output is flushed and deflate returns with Z_STREAM_END if there was
328 enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this 328 enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this
329 function must be called again with Z_FINISH and more output space (updated 329 function must be called again with Z_FINISH and more output space (updated
358 deflate() can be called again with more input and more output space to 358 deflate() can be called again with more input and more output space to
359 continue compressing. 359 continue compressing.
360 */ 360 */
361 361
362 362
363 ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); 363 ZEXTERN int ZEXPORT deflateEnd(z_streamp strm);
364 /* 364 /*
365 All dynamically allocated data structures for this stream are freed. 365 All dynamically allocated data structures for this stream are freed.
366 This function discards any unprocessed input and does not flush any pending 366 This function discards any unprocessed input and does not flush any pending
367 output. 367 output.
368 368
373 deallocated). 373 deallocated).
374 */ 374 */
375 375
376 376
377 /* 377 /*
378 ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); 378 ZEXTERN int ZEXPORT inflateInit(z_streamp strm);
379 379
380 Initializes the internal stream state for decompression. The fields 380 Initializes the internal stream state for decompression. The fields
381 next_in, avail_in, zalloc, zfree and opaque must be initialized before by 381 next_in, avail_in, zalloc, zfree and opaque must be initialized before by
382 the caller. In the current version of inflate, the provided input is not 382 the caller. In the current version of inflate, the provided input is not
383 read or consumed. The allocation of a sliding window will be deferred to 383 read or consumed. The allocation of a sliding window will be deferred to
384 the first call of inflate (if the decompression does not complete on the 384 the first call of inflate (if the decompression does not complete on the
385 first call). If zalloc and zfree are set to Z_NULL, inflateInit updates 385 first call). If zalloc and zfree are set to Z_NULL, inflateInit updates
386 them to use default allocation functions. 386 them to use default allocation functions. total_in, total_out, adler, and
387 msg are initialized.
387 388
388 inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough 389 inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
389 memory, Z_VERSION_ERROR if the zlib library version is incompatible with the 390 memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
390 version assumed by the caller, or Z_STREAM_ERROR if the parameters are 391 version assumed by the caller, or Z_STREAM_ERROR if the parameters are
391 invalid, such as a null pointer to the structure. msg is set to null if 392 invalid, such as a null pointer to the structure. msg is set to null if
395 implementation of inflateInit() does not process any header information -- 396 implementation of inflateInit() does not process any header information --
396 that is deferred until inflate() is called. 397 that is deferred until inflate() is called.
397 */ 398 */
398 399
399 400
400 ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); 401 ZEXTERN int ZEXPORT inflate(z_streamp strm, int flush);
401 /* 402 /*
402 inflate decompresses as much data as possible, and stops when the input 403 inflate decompresses as much data as possible, and stops when the input
403 buffer becomes empty or the output buffer becomes full. It may introduce 404 buffer becomes empty or the output buffer becomes full. It may introduce
404 some output latency (reading input without producing any output) except when 405 some output latency (reading input without producing any output) except when
405 forced to flush. 406 forced to flush.
515 then call inflateSync() to look for a good compression block if a partial 516 then call inflateSync() to look for a good compression block if a partial
516 recovery of the data is to be attempted. 517 recovery of the data is to be attempted.
517 */ 518 */
518 519
519 520
520 ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); 521 ZEXTERN int ZEXPORT inflateEnd(z_streamp strm);
521 /* 522 /*
522 All dynamically allocated data structures for this stream are freed. 523 All dynamically allocated data structures for this stream are freed.
523 This function discards any unprocessed input and does not flush any pending 524 This function discards any unprocessed input and does not flush any pending
524 output. 525 output.
525 526
533 /* 534 /*
534 The following functions are needed only in some special applications. 535 The following functions are needed only in some special applications.
535 */ 536 */
536 537
537 /* 538 /*
538 ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, 539 ZEXTERN int ZEXPORT deflateInit2(z_streamp strm,
539 int level, 540 int level,
540 int method, 541 int method,
541 int windowBits, 542 int windowBits,
542 int memLevel, 543 int memLevel,
543 int strategy)); 544 int strategy);
544 545
545 This is another version of deflateInit with more compression options. The 546 This is another version of deflateInit with more compression options. The
546 fields next_in, zalloc, zfree and opaque must be initialized before by the 547 fields zalloc, zfree and opaque must be initialized before by the caller.
547 caller.
548 548
549 The method parameter is the compression method. It must be Z_DEFLATED in 549 The method parameter is the compression method. It must be Z_DEFLATED in
550 this version of the library. 550 this version of the library.
551 551
552 The windowBits parameter is the base two logarithm of the window size 552 The windowBits parameter is the base two logarithm of the window size
606 incompatible with the version assumed by the caller (ZLIB_VERSION). msg is 606 incompatible with the version assumed by the caller (ZLIB_VERSION). msg is
607 set to null if there is no error message. deflateInit2 does not perform any 607 set to null if there is no error message. deflateInit2 does not perform any
608 compression: this will be done by deflate(). 608 compression: this will be done by deflate().
609 */ 609 */
610 610
611 ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, 611 ZEXTERN int ZEXPORT deflateSetDictionary(z_streamp strm,
612 const Bytef *dictionary, 612 const Bytef *dictionary,
613 uInt dictLength)); 613 uInt dictLength);
614 /* 614 /*
615 Initializes the compression dictionary from the given byte sequence 615 Initializes the compression dictionary from the given byte sequence
616 without producing any compressed output. When using the zlib format, this 616 without producing any compressed output. When using the zlib format, this
617 function must be called immediately after deflateInit, deflateInit2 or 617 function must be called immediately after deflateInit, deflateInit2 or
618 deflateReset, and before any call of deflate. When doing raw deflate, this 618 deflateReset, and before any call of deflate. When doing raw deflate, this
650 inconsistent (for example if deflate has already been called for this stream 650 inconsistent (for example if deflate has already been called for this stream
651 or if not at a block boundary for raw deflate). deflateSetDictionary does 651 or if not at a block boundary for raw deflate). deflateSetDictionary does
652 not perform any compression: this will be done by deflate(). 652 not perform any compression: this will be done by deflate().
653 */ 653 */
654 654
655 ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, 655 ZEXTERN int ZEXPORT deflateGetDictionary(z_streamp strm,
656 Bytef *dictionary, 656 Bytef *dictionary,
657 uInt *dictLength)); 657 uInt *dictLength);
658 /* 658 /*
659 Returns the sliding dictionary being maintained by deflate. dictLength is 659 Returns the sliding dictionary being maintained by deflate. dictLength is
660 set to the number of bytes in the dictionary, and that many bytes are copied 660 set to the number of bytes in the dictionary, and that many bytes are copied
661 to dictionary. dictionary must have enough space, where 32768 bytes is 661 to dictionary. dictionary must have enough space, where 32768 bytes is
662 always enough. If deflateGetDictionary() is called with dictionary equal to 662 always enough. If deflateGetDictionary() is called with dictionary equal to
663 Z_NULL, then only the dictionary length is returned, and nothing is copied. 663 Z_NULL, then only the dictionary length is returned, and nothing is copied.
664 Similary, if dictLength is Z_NULL, then it is not set. 664 Similarly, if dictLength is Z_NULL, then it is not set.
665 665
666 deflateGetDictionary() may return a length less than the window size, even 666 deflateGetDictionary() may return a length less than the window size, even
667 when more than the window size in input has been provided. It may return up 667 when more than the window size in input has been provided. It may return up
668 to 258 bytes less in that case, due to how zlib's implementation of deflate 668 to 258 bytes less in that case, due to how zlib's implementation of deflate
669 manages the sliding window and lookahead for matches, where matches can be 669 manages the sliding window and lookahead for matches, where matches can be
672 672
673 deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the 673 deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
674 stream state is inconsistent. 674 stream state is inconsistent.
675 */ 675 */
676 676
677 ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, 677 ZEXTERN int ZEXPORT deflateCopy(z_streamp dest,
678 z_streamp source)); 678 z_streamp source);
679 /* 679 /*
680 Sets the destination stream as a complete copy of the source stream. 680 Sets the destination stream as a complete copy of the source stream.
681 681
682 This function can be useful when several compression strategies will be 682 This function can be useful when several compression strategies will be
683 tried, for example when there are several ways of pre-processing the input 683 tried, for example when there are several ways of pre-processing the input
690 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent 690 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
691 (such as zalloc being Z_NULL). msg is left unchanged in both source and 691 (such as zalloc being Z_NULL). msg is left unchanged in both source and
692 destination. 692 destination.
693 */ 693 */
694 694
695 ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); 695 ZEXTERN int ZEXPORT deflateReset(z_streamp strm);
696 /* 696 /*
697 This function is equivalent to deflateEnd followed by deflateInit, but 697 This function is equivalent to deflateEnd followed by deflateInit, but
698 does not free and reallocate the internal compression state. The stream 698 does not free and reallocate the internal compression state. The stream
699 will leave the compression level and any other attributes that may have been 699 will leave the compression level and any other attributes that may have been
700 set unchanged. 700 set unchanged. total_in, total_out, adler, and msg are initialized.
701 701
702 deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source 702 deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
703 stream state was inconsistent (such as zalloc or state being Z_NULL). 703 stream state was inconsistent (such as zalloc or state being Z_NULL).
704 */ 704 */
705 705
706 ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, 706 ZEXTERN int ZEXPORT deflateParams(z_streamp strm,
707 int level, 707 int level,
708 int strategy)); 708 int strategy);
709 /* 709 /*
710 Dynamically update the compression level and compression strategy. The 710 Dynamically update the compression level and compression strategy. The
711 interpretation of level and strategy is as in deflateInit2(). This can be 711 interpretation of level and strategy is as in deflateInit2(). This can be
712 used to switch between compression and straight copy of the input data, or 712 used to switch between compression and straight copy of the input data, or
713 to switch to a different kind of input data requiring a different strategy. 713 to switch to a different kind of input data requiring a different strategy.
714 If the compression approach (which is a function of the level) or the 714 If the compression approach (which is a function of the level) or the
715 strategy is changed, and if any input has been consumed in a previous 715 strategy is changed, and if there have been any deflate() calls since the
716 deflate() call, then the input available so far is compressed with the old 716 state was initialized or reset, then the input available so far is
717 level and strategy using deflate(strm, Z_BLOCK). There are three approaches 717 compressed with the old level and strategy using deflate(strm, Z_BLOCK).
718 for the compression levels 0, 1..3, and 4..9 respectively. The new level 718 There are three approaches for the compression levels 0, 1..3, and 4..9
719 and strategy will take effect at the next call of deflate(). 719 respectively. The new level and strategy will take effect at the next call
720 of deflate().
720 721
721 If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does 722 If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
722 not have enough output space to complete, then the parameter change will not 723 not have enough output space to complete, then the parameter change will not
723 take effect. In this case, deflateParams() can be called again with the 724 take effect. In this case, deflateParams() can be called again with the
724 same parameters and more output space to try again. 725 same parameters and more output space to try again.
727 deflate stream should be flushed using deflate() with Z_BLOCK or other flush 728 deflate stream should be flushed using deflate() with Z_BLOCK or other flush
728 request until strm.avail_out is not zero, before calling deflateParams(). 729 request until strm.avail_out is not zero, before calling deflateParams().
729 Then no more input data should be provided before the deflateParams() call. 730 Then no more input data should be provided before the deflateParams() call.
730 If this is done, the old level and strategy will be applied to the data 731 If this is done, the old level and strategy will be applied to the data
731 compressed before deflateParams(), and the new level and strategy will be 732 compressed before deflateParams(), and the new level and strategy will be
732 applied to the the data compressed after deflateParams(). 733 applied to the data compressed after deflateParams().
733 734
734 deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream 735 deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream
735 state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if 736 state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if
736 there was not enough output space to complete the compression of the 737 there was not enough output space to complete the compression of the
737 available input data before a change in the strategy or approach. Note that 738 available input data before a change in the strategy or approach. Note that
738 in the case of a Z_BUF_ERROR, the parameters are not changed. A return 739 in the case of a Z_BUF_ERROR, the parameters are not changed. A return
739 value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be 740 value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be
740 retried with more output space. 741 retried with more output space.
741 */ 742 */
742 743
743 ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, 744 ZEXTERN int ZEXPORT deflateTune(z_streamp strm,
744 int good_length, 745 int good_length,
745 int max_lazy, 746 int max_lazy,
746 int nice_length, 747 int nice_length,
747 int max_chain)); 748 int max_chain);
748 /* 749 /*
749 Fine tune deflate's internal compression parameters. This should only be 750 Fine tune deflate's internal compression parameters. This should only be
750 used by someone who understands the algorithm used by zlib's deflate for 751 used by someone who understands the algorithm used by zlib's deflate for
751 searching for the best matching string, and even then only by the most 752 searching for the best matching string, and even then only by the most
752 fanatic optimizer trying to squeeze out the last compressed bit for their 753 fanatic optimizer trying to squeeze out the last compressed bit for their
755 756
756 deflateTune() can be called after deflateInit() or deflateInit2(), and 757 deflateTune() can be called after deflateInit() or deflateInit2(), and
757 returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. 758 returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
758 */ 759 */
759 760
760 ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, 761 ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm,
761 uLong sourceLen)); 762 uLong sourceLen);
762 /* 763 /*
763 deflateBound() returns an upper bound on the compressed size after 764 deflateBound() returns an upper bound on the compressed size after
764 deflation of sourceLen bytes. It must be called after deflateInit() or 765 deflation of sourceLen bytes. It must be called after deflateInit() or
765 deflateInit2(), and after deflateSetHeader(), if used. This would be used 766 deflateInit2(), and after deflateSetHeader(), if used. This would be used
766 to allocate an output buffer for deflation in a single pass, and so would be 767 to allocate an output buffer for deflation in a single pass, and so would be
770 to return Z_STREAM_END. Note that it is possible for the compressed size to 771 to return Z_STREAM_END. Note that it is possible for the compressed size to
771 be larger than the value returned by deflateBound() if flush options other 772 be larger than the value returned by deflateBound() if flush options other
772 than Z_FINISH or Z_NO_FLUSH are used. 773 than Z_FINISH or Z_NO_FLUSH are used.
773 */ 774 */
774 775
775 ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, 776 ZEXTERN int ZEXPORT deflatePending(z_streamp strm,
776 unsigned *pending, 777 unsigned *pending,
777 int *bits)); 778 int *bits);
778 /* 779 /*
779 deflatePending() returns the number of bytes and bits of output that have 780 deflatePending() returns the number of bytes and bits of output that have
780 been generated, but not yet provided in the available output. The bytes not 781 been generated, but not yet provided in the available output. The bytes not
781 provided would be due to the available output space having being consumed. 782 provided would be due to the available output space having being consumed.
782 The number of bits of output not provided are between 0 and 7, where they 783 The number of bits of output not provided are between 0 and 7, where they
785 786
786 deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source 787 deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
787 stream state was inconsistent. 788 stream state was inconsistent.
788 */ 789 */
789 790
790 ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, 791 ZEXTERN int ZEXPORT deflatePrime(z_streamp strm,
791 int bits, 792 int bits,
792 int value)); 793 int value);
793 /* 794 /*
794 deflatePrime() inserts bits in the deflate output stream. The intent 795 deflatePrime() inserts bits in the deflate output stream. The intent
795 is that this function is used to start off the deflate output with the bits 796 is that this function is used to start off the deflate output with the bits
796 leftover from a previous deflate stream when appending to it. As such, this 797 leftover from a previous deflate stream when appending to it. As such, this
797 function can only be used for raw deflate, and must be used before the first 798 function can only be used for raw deflate, and must be used before the first
802 deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough 803 deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough
803 room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the 804 room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the
804 source stream state was inconsistent. 805 source stream state was inconsistent.
805 */ 806 */
806 807
807 ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, 808 ZEXTERN int ZEXPORT deflateSetHeader(z_streamp strm,
808 gz_headerp head)); 809 gz_headerp head);
809 /* 810 /*
810 deflateSetHeader() provides gzip header information for when a gzip 811 deflateSetHeader() provides gzip header information for when a gzip
811 stream is requested by deflateInit2(). deflateSetHeader() may be called 812 stream is requested by deflateInit2(). deflateSetHeader() may be called
812 after deflateInit2() or deflateReset() and before the first call of 813 after deflateInit2() or deflateReset() and before the first call of
813 deflate(). The text, time, os, extra field, name, and comment information 814 deflate(). The text, time, os, extra field, name, and comment information
819 the current versions of the command-line version of gzip (up through version 820 the current versions of the command-line version of gzip (up through version
820 1.3.x) do not support header crc's, and will report that it is a "multi-part 821 1.3.x) do not support header crc's, and will report that it is a "multi-part
821 gzip file" and give up. 822 gzip file" and give up.
822 823
823 If deflateSetHeader is not used, the default gzip header has text false, 824 If deflateSetHeader is not used, the default gzip header has text false,
824 the time set to zero, and os set to 255, with no extra, name, or comment 825 the time set to zero, and os set to the current operating system, with no
825 fields. The gzip header is returned to the default state by deflateReset(). 826 extra, name, or comment fields. The gzip header is returned to the default
827 state by deflateReset().
826 828
827 deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source 829 deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
828 stream state was inconsistent. 830 stream state was inconsistent.
829 */ 831 */
830 832
831 /* 833 /*
832 ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, 834 ZEXTERN int ZEXPORT inflateInit2(z_streamp strm,
833 int windowBits)); 835 int windowBits);
834 836
835 This is another version of inflateInit with an extra parameter. The 837 This is another version of inflateInit with an extra parameter. The
836 fields next_in, avail_in, zalloc, zfree and opaque must be initialized 838 fields next_in, avail_in, zalloc, zfree and opaque must be initialized
837 before by the caller. 839 before by the caller.
838 840
863 windowBits can also be greater than 15 for optional gzip decoding. Add 865 windowBits can also be greater than 15 for optional gzip decoding. Add
864 32 to windowBits to enable zlib and gzip decoding with automatic header 866 32 to windowBits to enable zlib and gzip decoding with automatic header
865 detection, or add 16 to decode only the gzip format (the zlib format will 867 detection, or add 16 to decode only the gzip format (the zlib format will
866 return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a 868 return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a
867 CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see 869 CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see
868 below), inflate() will not automatically decode concatenated gzip streams. 870 below), inflate() will *not* automatically decode concatenated gzip members.
869 inflate() will return Z_STREAM_END at the end of the gzip stream. The state 871 inflate() will return Z_STREAM_END at the end of the gzip member. The state
870 would need to be reset to continue decoding a subsequent gzip stream. 872 would need to be reset to continue decoding a subsequent gzip member. This
873 *must* be done if there is more data after a gzip member, in order for the
874 decompression to be compliant with the gzip standard (RFC 1952).
871 875
872 inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 876 inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
873 memory, Z_VERSION_ERROR if the zlib library version is incompatible with the 877 memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
874 version assumed by the caller, or Z_STREAM_ERROR if the parameters are 878 version assumed by the caller, or Z_STREAM_ERROR if the parameters are
875 invalid, such as a null pointer to the structure. msg is set to null if 879 invalid, such as a null pointer to the structure. msg is set to null if
879 next_out and avail_out are unused and unchanged.) The current implementation 883 next_out and avail_out are unused and unchanged.) The current implementation
880 of inflateInit2() does not process any header information -- that is 884 of inflateInit2() does not process any header information -- that is
881 deferred until inflate() is called. 885 deferred until inflate() is called.
882 */ 886 */
883 887
884 ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, 888 ZEXTERN int ZEXPORT inflateSetDictionary(z_streamp strm,
885 const Bytef *dictionary, 889 const Bytef *dictionary,
886 uInt dictLength)); 890 uInt dictLength);
887 /* 891 /*
888 Initializes the decompression dictionary from the given uncompressed byte 892 Initializes the decompression dictionary from the given uncompressed byte
889 sequence. This function must be called immediately after a call of inflate, 893 sequence. This function must be called immediately after a call of inflate,
890 if that call returned Z_NEED_DICT. The dictionary chosen by the compressor 894 if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
891 can be determined from the Adler-32 value returned by that call of inflate. 895 can be determined from the Adler-32 value returned by that call of inflate.
902 expected one (incorrect Adler-32 value). inflateSetDictionary does not 906 expected one (incorrect Adler-32 value). inflateSetDictionary does not
903 perform any decompression: this will be done by subsequent calls of 907 perform any decompression: this will be done by subsequent calls of
904 inflate(). 908 inflate().
905 */ 909 */
906 910
907 ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, 911 ZEXTERN int ZEXPORT inflateGetDictionary(z_streamp strm,
908 Bytef *dictionary, 912 Bytef *dictionary,
909 uInt *dictLength)); 913 uInt *dictLength);
910 /* 914 /*
911 Returns the sliding dictionary being maintained by inflate. dictLength is 915 Returns the sliding dictionary being maintained by inflate. dictLength is
912 set to the number of bytes in the dictionary, and that many bytes are copied 916 set to the number of bytes in the dictionary, and that many bytes are copied
913 to dictionary. dictionary must have enough space, where 32768 bytes is 917 to dictionary. dictionary must have enough space, where 32768 bytes is
914 always enough. If inflateGetDictionary() is called with dictionary equal to 918 always enough. If inflateGetDictionary() is called with dictionary equal to
915 Z_NULL, then only the dictionary length is returned, and nothing is copied. 919 Z_NULL, then only the dictionary length is returned, and nothing is copied.
916 Similary, if dictLength is Z_NULL, then it is not set. 920 Similarly, if dictLength is Z_NULL, then it is not set.
917 921
918 inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the 922 inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
919 stream state is inconsistent. 923 stream state is inconsistent.
920 */ 924 */
921 925
922 ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); 926 ZEXTERN int ZEXPORT inflateSync(z_streamp strm);
923 /* 927 /*
924 Skips invalid compressed data until a possible full flush point (see above 928 Skips invalid compressed data until a possible full flush point (see above
925 for the description of deflate with Z_FULL_FLUSH) can be found, or until all 929 for the description of deflate with Z_FULL_FLUSH) can be found, or until all
926 available input is skipped. No output is provided. 930 available input is skipped. No output is provided.
927 931
930 pattern are full flush points. 934 pattern are full flush points.
931 935
932 inflateSync returns Z_OK if a possible full flush point has been found, 936 inflateSync returns Z_OK if a possible full flush point has been found,
933 Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point 937 Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
934 has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. 938 has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
935 In the success case, the application may save the current current value of 939 In the success case, the application may save the current value of total_in
936 total_in which indicates where valid compressed data was found. In the 940 which indicates where valid compressed data was found. In the error case,
937 error case, the application may repeatedly call inflateSync, providing more 941 the application may repeatedly call inflateSync, providing more input each
938 input each time, until success or end of the input data. 942 time, until success or end of the input data.
939 */ 943 */
940 944
941 ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, 945 ZEXTERN int ZEXPORT inflateCopy(z_streamp dest,
942 z_streamp source)); 946 z_streamp source);
943 /* 947 /*
944 Sets the destination stream as a complete copy of the source stream. 948 Sets the destination stream as a complete copy of the source stream.
945 949
946 This function can be useful when randomly accessing a large stream. The 950 This function can be useful when randomly accessing a large stream. The
947 first pass through the stream can periodically record the inflate state, 951 first pass through the stream can periodically record the inflate state,
952 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent 956 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
953 (such as zalloc being Z_NULL). msg is left unchanged in both source and 957 (such as zalloc being Z_NULL). msg is left unchanged in both source and
954 destination. 958 destination.
955 */ 959 */
956 960
957 ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); 961 ZEXTERN int ZEXPORT inflateReset(z_streamp strm);
958 /* 962 /*
959 This function is equivalent to inflateEnd followed by inflateInit, 963 This function is equivalent to inflateEnd followed by inflateInit,
960 but does not free and reallocate the internal decompression state. The 964 but does not free and reallocate the internal decompression state. The
961 stream will keep attributes that may have been set by inflateInit2. 965 stream will keep attributes that may have been set by inflateInit2.
966 total_in, total_out, adler, and msg are initialized.
962 967
963 inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source 968 inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
964 stream state was inconsistent (such as zalloc or state being Z_NULL). 969 stream state was inconsistent (such as zalloc or state being Z_NULL).
965 */ 970 */
966 971
967 ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, 972 ZEXTERN int ZEXPORT inflateReset2(z_streamp strm,
968 int windowBits)); 973 int windowBits);
969 /* 974 /*
970 This function is the same as inflateReset, but it also permits changing 975 This function is the same as inflateReset, but it also permits changing
971 the wrap and window size requests. The windowBits parameter is interpreted 976 the wrap and window size requests. The windowBits parameter is interpreted
972 the same as it is for inflateInit2. If the window size is changed, then the 977 the same as it is for inflateInit2. If the window size is changed, then the
973 memory allocated for the window is freed, and the window will be reallocated 978 memory allocated for the window is freed, and the window will be reallocated
976 inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source 981 inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
977 stream state was inconsistent (such as zalloc or state being Z_NULL), or if 982 stream state was inconsistent (such as zalloc or state being Z_NULL), or if
978 the windowBits parameter is invalid. 983 the windowBits parameter is invalid.
979 */ 984 */
980 985
981 ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, 986 ZEXTERN int ZEXPORT inflatePrime(z_streamp strm,
982 int bits, 987 int bits,
983 int value)); 988 int value);
984 /* 989 /*
985 This function inserts bits in the inflate input stream. The intent is 990 This function inserts bits in the inflate input stream. The intent is
986 that this function is used to start inflating at a bit position in the 991 that this function is used to start inflating at a bit position in the
987 middle of a byte. The provided bits will be used before any bytes are used 992 middle of a byte. The provided bits will be used before any bytes are used
988 from next_in. This function should only be used with raw inflate, and 993 from next_in. This function should only be used with raw inflate, and
997 1002
998 inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source 1003 inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
999 stream state was inconsistent. 1004 stream state was inconsistent.
1000 */ 1005 */
1001 1006
1002 ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); 1007 ZEXTERN long ZEXPORT inflateMark(z_streamp strm);
1003 /* 1008 /*
1004 This function returns two values, one in the lower 16 bits of the return 1009 This function returns two values, one in the lower 16 bits of the return
1005 value, and the other in the remaining upper bits, obtained by shifting the 1010 value, and the other in the remaining upper bits, obtained by shifting the
1006 return value down 16 bits. If the upper value is -1 and the lower value is 1011 return value down 16 bits. If the upper value is -1 and the lower value is
1007 zero, then inflate() is currently decoding information outside of a block. 1012 zero, then inflate() is currently decoding information outside of a block.
1025 1030
1026 inflateMark returns the value noted above, or -65536 if the provided 1031 inflateMark returns the value noted above, or -65536 if the provided
1027 source stream state was inconsistent. 1032 source stream state was inconsistent.
1028 */ 1033 */
1029 1034
1030 ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, 1035 ZEXTERN int ZEXPORT inflateGetHeader(z_streamp strm,
1031 gz_headerp head)); 1036 gz_headerp head);
1032 /* 1037 /*
1033 inflateGetHeader() requests that gzip header information be stored in the 1038 inflateGetHeader() requests that gzip header information be stored in the
1034 provided gz_header structure. inflateGetHeader() may be called after 1039 provided gz_header structure. inflateGetHeader() may be called after
1035 inflateInit2() or inflateReset(), and before the first call of inflate(). 1040 inflateInit2() or inflateReset(), and before the first call of inflate().
1036 As inflate() processes the gzip stream, head->done is zero until the header 1041 As inflate() processes the gzip stream, head->done is zero until the header
1066 inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source 1071 inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
1067 stream state was inconsistent. 1072 stream state was inconsistent.
1068 */ 1073 */
1069 1074
1070 /* 1075 /*
1071 ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, 1076 ZEXTERN int ZEXPORT inflateBackInit(z_streamp strm, int windowBits,
1072 unsigned char FAR *window)); 1077 unsigned char FAR *window);
1073 1078
1074 Initialize the internal stream state for decompression using inflateBack() 1079 Initialize the internal stream state for decompression using inflateBack()
1075 calls. The fields zalloc, zfree and opaque in strm must be initialized 1080 calls. The fields zalloc, zfree and opaque in strm must be initialized
1076 before the call. If zalloc and zfree are Z_NULL, then the default library- 1081 before the call. If zalloc and zfree are Z_NULL, then the default library-
1077 derived memory allocation routines are used. windowBits is the base two 1082 derived memory allocation routines are used. windowBits is the base two
1087 the parameters are invalid, Z_MEM_ERROR if the internal state could not be 1092 the parameters are invalid, Z_MEM_ERROR if the internal state could not be
1088 allocated, or Z_VERSION_ERROR if the version of the library does not match 1093 allocated, or Z_VERSION_ERROR if the version of the library does not match
1089 the version of the header file. 1094 the version of the header file.
1090 */ 1095 */
1091 1096
1092 typedef unsigned (*in_func) OF((void FAR *, 1097 typedef unsigned (*in_func)(void FAR *,
1093 z_const unsigned char FAR * FAR *)); 1098 z_const unsigned char FAR * FAR *);
1094 typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); 1099 typedef int (*out_func)(void FAR *, unsigned char FAR *, unsigned);
1095 1100
1096 ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, 1101 ZEXTERN int ZEXPORT inflateBack(z_streamp strm,
1097 in_func in, void FAR *in_desc, 1102 in_func in, void FAR *in_desc,
1098 out_func out, void FAR *out_desc)); 1103 out_func out, void FAR *out_desc);
1099 /* 1104 /*
1100 inflateBack() does a raw inflate with a single call using a call-back 1105 inflateBack() does a raw inflate with a single call using a call-back
1101 interface for input and output. This is potentially more efficient than 1106 interface for input and output. This is potentially more efficient than
1102 inflate() for file i/o applications, in that it avoids copying between the 1107 inflate() for file i/o applications, in that it avoids copying between the
1103 output and the sliding window by simply making the window itself the output 1108 output and the sliding window by simply making the window itself the output
1161 non-zero. (in() will always be called before out(), so strm->next_in is 1166 non-zero. (in() will always be called before out(), so strm->next_in is
1162 assured to be defined if out() returns non-zero.) Note that inflateBack() 1167 assured to be defined if out() returns non-zero.) Note that inflateBack()
1163 cannot return Z_OK. 1168 cannot return Z_OK.
1164 */ 1169 */
1165 1170
1166 ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); 1171 ZEXTERN int ZEXPORT inflateBackEnd(z_streamp strm);
1167 /* 1172 /*
1168 All memory allocated by inflateBackInit() is freed. 1173 All memory allocated by inflateBackInit() is freed.
1169 1174
1170 inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream 1175 inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
1171 state was inconsistent. 1176 state was inconsistent.
1172 */ 1177 */
1173 1178
1174 ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); 1179 ZEXTERN uLong ZEXPORT zlibCompileFlags(void);
1175 /* Return flags indicating compile-time options. 1180 /* Return flags indicating compile-time options.
1176 1181
1177 Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: 1182 Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
1178 1.0: size of uInt 1183 1.0: size of uInt
1179 3.2: size of uLong 1184 3.2: size of uLong
1222 are assumed (compression level and memory usage, standard memory allocation 1227 are assumed (compression level and memory usage, standard memory allocation
1223 functions). The source code of these utility functions can be modified if 1228 functions). The source code of these utility functions can be modified if
1224 you need special options. 1229 you need special options.
1225 */ 1230 */
1226 1231
1227 ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, 1232 ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen,
1228 const Bytef *source, uLong sourceLen)); 1233 const Bytef *source, uLong sourceLen);
1229 /* 1234 /*
1230 Compresses the source buffer into the destination buffer. sourceLen is 1235 Compresses the source buffer into the destination buffer. sourceLen is
1231 the byte length of the source buffer. Upon entry, destLen is the total size 1236 the byte length of the source buffer. Upon entry, destLen is the total size
1232 of the destination buffer, which must be at least the value returned by 1237 of the destination buffer, which must be at least the value returned by
1233 compressBound(sourceLen). Upon exit, destLen is the actual size of the 1238 compressBound(sourceLen). Upon exit, destLen is the actual size of the
1237 compress returns Z_OK if success, Z_MEM_ERROR if there was not 1242 compress returns Z_OK if success, Z_MEM_ERROR if there was not
1238 enough memory, Z_BUF_ERROR if there was not enough room in the output 1243 enough memory, Z_BUF_ERROR if there was not enough room in the output
1239 buffer. 1244 buffer.
1240 */ 1245 */
1241 1246
1242 ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, 1247 ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen,
1243 const Bytef *source, uLong sourceLen, 1248 const Bytef *source, uLong sourceLen,
1244 int level)); 1249 int level);
1245 /* 1250 /*
1246 Compresses the source buffer into the destination buffer. The level 1251 Compresses the source buffer into the destination buffer. The level
1247 parameter has the same meaning as in deflateInit. sourceLen is the byte 1252 parameter has the same meaning as in deflateInit. sourceLen is the byte
1248 length of the source buffer. Upon entry, destLen is the total size of the 1253 length of the source buffer. Upon entry, destLen is the total size of the
1249 destination buffer, which must be at least the value returned by 1254 destination buffer, which must be at least the value returned by
1253 compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 1258 compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
1254 memory, Z_BUF_ERROR if there was not enough room in the output buffer, 1259 memory, Z_BUF_ERROR if there was not enough room in the output buffer,
1255 Z_STREAM_ERROR if the level parameter is invalid. 1260 Z_STREAM_ERROR if the level parameter is invalid.
1256 */ 1261 */
1257 1262
1258 ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); 1263 ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen);
1259 /* 1264 /*
1260 compressBound() returns an upper bound on the compressed size after 1265 compressBound() returns an upper bound on the compressed size after
1261 compress() or compress2() on sourceLen bytes. It would be used before a 1266 compress() or compress2() on sourceLen bytes. It would be used before a
1262 compress() or compress2() call to allocate the destination buffer. 1267 compress() or compress2() call to allocate the destination buffer.
1263 */ 1268 */
1264 1269
1265 ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, 1270 ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen,
1266 const Bytef *source, uLong sourceLen)); 1271 const Bytef *source, uLong sourceLen);
1267 /* 1272 /*
1268 Decompresses the source buffer into the destination buffer. sourceLen is 1273 Decompresses the source buffer into the destination buffer. sourceLen is
1269 the byte length of the source buffer. Upon entry, destLen is the total size 1274 the byte length of the source buffer. Upon entry, destLen is the total size
1270 of the destination buffer, which must be large enough to hold the entire 1275 of the destination buffer, which must be large enough to hold the entire
1271 uncompressed data. (The size of the uncompressed data must have been saved 1276 uncompressed data. (The size of the uncompressed data must have been saved
1278 buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In 1283 buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In
1279 the case where there is not enough room, uncompress() will fill the output 1284 the case where there is not enough room, uncompress() will fill the output
1280 buffer with the uncompressed data up to that point. 1285 buffer with the uncompressed data up to that point.
1281 */ 1286 */
1282 1287
1283 ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen, 1288 ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen,
1284 const Bytef *source, uLong *sourceLen)); 1289 const Bytef *source, uLong *sourceLen);
1285 /* 1290 /*
1286 Same as uncompress, except that sourceLen is a pointer, where the 1291 Same as uncompress, except that sourceLen is a pointer, where the
1287 length of the source is *sourceLen. On return, *sourceLen is the number of 1292 length of the source is *sourceLen. On return, *sourceLen is the number of
1288 source bytes consumed. 1293 source bytes consumed.
1289 */ 1294 */
1298 */ 1303 */
1299 1304
1300 typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ 1305 typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
1301 1306
1302 /* 1307 /*
1303 ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); 1308 ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode);
1304 1309
1305 Opens a gzip (.gz) file for reading or writing. The mode parameter is as 1310 Open the gzip (.gz) file at path for reading and decompressing, or
1306 in fopen ("rb" or "wb") but can also include a compression level ("wb9") or 1311 compressing and writing. The mode parameter is as in fopen ("rb" or "wb")
1307 a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only 1312 but can also include a compression level ("wb9") or a strategy: 'f' for
1308 compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' 1313 filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h",
1309 for fixed code compression as in "wb9F". (See the description of 1314 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression
1310 deflateInit2 for more information about the strategy parameter.) 'T' will 1315 as in "wb9F". (See the description of deflateInit2 for more information
1311 request transparent writing or appending with no compression and not using 1316 about the strategy parameter.) 'T' will request transparent writing or
1312 the gzip format. 1317 appending with no compression and not using the gzip format.
1313 1318
1314 "a" can be used instead of "w" to request that the gzip stream that will 1319 "a" can be used instead of "w" to request that the gzip stream that will
1315 be written be appended to the file. "+" will result in an error, since 1320 be written be appended to the file. "+" will result in an error, since
1316 reading and writing to the same gzip file is not supported. The addition of 1321 reading and writing to the same gzip file is not supported. The addition of
1317 "x" when writing will create the file exclusively, which fails if the file 1322 "x" when writing will create the file exclusively, which fails if the file
1335 specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). 1340 specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
1336 errno can be checked to determine if the reason gzopen failed was that the 1341 errno can be checked to determine if the reason gzopen failed was that the
1337 file could not be opened. 1342 file could not be opened.
1338 */ 1343 */
1339 1344
1340 ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); 1345 ZEXTERN gzFile ZEXPORT gzdopen(int fd, const char *mode);
1341 /* 1346 /*
1342 gzdopen associates a gzFile with the file descriptor fd. File descriptors 1347 Associate a gzFile with the file descriptor fd. File descriptors are
1343 are obtained from calls like open, dup, creat, pipe or fileno (if the file 1348 obtained from calls like open, dup, creat, pipe or fileno (if the file has
1344 has been previously opened with fopen). The mode parameter is as in gzopen. 1349 been previously opened with fopen). The mode parameter is as in gzopen.
1345 1350
1346 The next call of gzclose on the returned gzFile will also close the file 1351 The next call of gzclose on the returned gzFile will also close the file
1347 descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor 1352 descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
1348 fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, 1353 fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
1349 mode);. The duplicated descriptor should be saved to avoid a leak, since 1354 mode);. The duplicated descriptor should be saved to avoid a leak, since
1358 provided, or '+' was provided), or if fd is -1. The file descriptor is not 1363 provided, or '+' was provided), or if fd is -1. The file descriptor is not
1359 used until the next gz* read, write, seek, or close operation, so gzdopen 1364 used until the next gz* read, write, seek, or close operation, so gzdopen
1360 will not detect if fd is invalid (unless fd is -1). 1365 will not detect if fd is invalid (unless fd is -1).
1361 */ 1366 */
1362 1367
1363 ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); 1368 ZEXTERN int ZEXPORT gzbuffer(gzFile file, unsigned size);
1364 /* 1369 /*
1365 Set the internal buffer size used by this library's functions. The 1370 Set the internal buffer size used by this library's functions for file to
1366 default buffer size is 8192 bytes. This function must be called after 1371 size. The default buffer size is 8192 bytes. This function must be called
1367 gzopen() or gzdopen(), and before any other calls that read or write the 1372 after gzopen() or gzdopen(), and before any other calls that read or write
1368 file. The buffer memory allocation is always deferred to the first read or 1373 the file. The buffer memory allocation is always deferred to the first read
1369 write. Three times that size in buffer space is allocated. A larger buffer 1374 or write. Three times that size in buffer space is allocated. A larger
1370 size of, for example, 64K or 128K bytes will noticeably increase the speed 1375 buffer size of, for example, 64K or 128K bytes will noticeably increase the
1371 of decompression (reading). 1376 speed of decompression (reading).
1372 1377
1373 The new buffer size also affects the maximum length for gzprintf(). 1378 The new buffer size also affects the maximum length for gzprintf().
1374 1379
1375 gzbuffer() returns 0 on success, or -1 on failure, such as being called 1380 gzbuffer() returns 0 on success, or -1 on failure, such as being called
1376 too late. 1381 too late.
1377 */ 1382 */
1378 1383
1379 ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); 1384 ZEXTERN int ZEXPORT gzsetparams(gzFile file, int level, int strategy);
1380 /* 1385 /*
1381 Dynamically update the compression level or strategy. See the description 1386 Dynamically update the compression level and strategy for file. See the
1382 of deflateInit2 for the meaning of these parameters. Previously provided 1387 description of deflateInit2 for the meaning of these parameters. Previously
1383 data is flushed before the parameter change. 1388 provided data is flushed before applying the parameter changes.
1384 1389
1385 gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not 1390 gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not
1386 opened for writing, Z_ERRNO if there is an error writing the flushed data, 1391 opened for writing, Z_ERRNO if there is an error writing the flushed data,
1387 or Z_MEM_ERROR if there is a memory allocation error. 1392 or Z_MEM_ERROR if there is a memory allocation error.
1388 */ 1393 */
1389 1394
1390 ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); 1395 ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len);
1391 /* 1396 /*
1392 Reads the given number of uncompressed bytes from the compressed file. If 1397 Read and decompress up to len uncompressed bytes from file into buf. If
1393 the input file is not in gzip format, gzread copies the given number of 1398 the input file is not in gzip format, gzread copies the given number of
1394 bytes into the buffer directly from the file. 1399 bytes into the buffer directly from the file.
1395 1400
1396 After reaching the end of a gzip stream in the input, gzread will continue 1401 After reaching the end of a gzip stream in the input, gzread will continue
1397 to read, looking for another gzip stream. Any number of gzip streams may be 1402 to read, looking for another gzip stream. Any number of gzip streams may be
1415 len for end of file, or -1 for error. If len is too large to fit in an int, 1420 len for end of file, or -1 for error. If len is too large to fit in an int,
1416 then nothing is read, -1 is returned, and the error state is set to 1421 then nothing is read, -1 is returned, and the error state is set to
1417 Z_STREAM_ERROR. 1422 Z_STREAM_ERROR.
1418 */ 1423 */
1419 1424
1420 ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, 1425 ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems,
1421 gzFile file)); 1426 gzFile file);
1422 /* 1427 /*
1423 Read up to nitems items of size size from file to buf, otherwise operating 1428 Read and decompress up to nitems items of size size from file into buf,
1424 as gzread() does. This duplicates the interface of stdio's fread(), with 1429 otherwise operating as gzread() does. This duplicates the interface of
1425 size_t request and return types. If the library defines size_t, then 1430 stdio's fread(), with size_t request and return types. If the library
1426 z_size_t is identical to size_t. If not, then z_size_t is an unsigned 1431 defines size_t, then z_size_t is identical to size_t. If not, then z_size_t
1427 integer type that can contain a pointer. 1432 is an unsigned integer type that can contain a pointer.
1428 1433
1429 gzfread() returns the number of full items read of size size, or zero if 1434 gzfread() returns the number of full items read of size size, or zero if
1430 the end of the file was reached and a full item could not be read, or if 1435 the end of the file was reached and a full item could not be read, or if
1431 there was an error. gzerror() must be consulted if zero is returned in 1436 there was an error. gzerror() must be consulted if zero is returned in
1432 order to determine if there was an error. If the multiplication of size and 1437 order to determine if there was an error. If the multiplication of size and
1433 nitems overflows, i.e. the product does not fit in a z_size_t, then nothing 1438 nitems overflows, i.e. the product does not fit in a z_size_t, then nothing
1434 is read, zero is returned, and the error state is set to Z_STREAM_ERROR. 1439 is read, zero is returned, and the error state is set to Z_STREAM_ERROR.
1435 1440
1436 In the event that the end of file is reached and only a partial item is 1441 In the event that the end of file is reached and only a partial item is
1437 available at the end, i.e. the remaining uncompressed data length is not a 1442 available at the end, i.e. the remaining uncompressed data length is not a
1438 multiple of size, then the final partial item is nevetheless read into buf 1443 multiple of size, then the final partial item is nevertheless read into buf
1439 and the end-of-file flag is set. The length of the partial item read is not 1444 and the end-of-file flag is set. The length of the partial item read is not
1440 provided, but could be inferred from the result of gztell(). This behavior 1445 provided, but could be inferred from the result of gztell(). This behavior
1441 is the same as the behavior of fread() implementations in common libraries, 1446 is the same as the behavior of fread() implementations in common libraries,
1442 but it prevents the direct use of gzfread() to read a concurrently written 1447 but it prevents the direct use of gzfread() to read a concurrently written
1443 file, reseting and retrying on end-of-file, when size is not 1. 1448 file, resetting and retrying on end-of-file, when size is not 1.
1444 */ 1449 */
1445 1450
1446 ZEXTERN int ZEXPORT gzwrite OF((gzFile file, 1451 ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len);
1447 voidpc buf, unsigned len)); 1452 /*
1448 /* 1453 Compress and write the len uncompressed bytes at buf to file. gzwrite
1449 Writes the given number of uncompressed bytes into the compressed file. 1454 returns the number of uncompressed bytes written or 0 in case of error.
1450 gzwrite returns the number of uncompressed bytes written or 0 in case of 1455 */
1451 error. 1456
1452 */ 1457 ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size,
1453 1458 z_size_t nitems, gzFile file);
1454 ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, 1459 /*
1455 z_size_t nitems, gzFile file)); 1460 Compress and write nitems items of size size from buf to file, duplicating
1456 /*
1457 gzfwrite() writes nitems items of size size from buf to file, duplicating
1458 the interface of stdio's fwrite(), with size_t request and return types. If 1461 the interface of stdio's fwrite(), with size_t request and return types. If
1459 the library defines size_t, then z_size_t is identical to size_t. If not, 1462 the library defines size_t, then z_size_t is identical to size_t. If not,
1460 then z_size_t is an unsigned integer type that can contain a pointer. 1463 then z_size_t is an unsigned integer type that can contain a pointer.
1461 1464
1462 gzfwrite() returns the number of full items written of size size, or zero 1465 gzfwrite() returns the number of full items written of size size, or zero
1463 if there was an error. If the multiplication of size and nitems overflows, 1466 if there was an error. If the multiplication of size and nitems overflows,
1464 i.e. the product does not fit in a z_size_t, then nothing is written, zero 1467 i.e. the product does not fit in a z_size_t, then nothing is written, zero
1465 is returned, and the error state is set to Z_STREAM_ERROR. 1468 is returned, and the error state is set to Z_STREAM_ERROR.
1466 */ 1469 */
1467 1470
1468 ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); 1471 ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...);
1469 /* 1472 /*
1470 Converts, formats, and writes the arguments to the compressed file under 1473 Convert, format, compress, and write the arguments (...) to file under
1471 control of the format string, as in fprintf. gzprintf returns the number of 1474 control of the string format, as in fprintf. gzprintf returns the number of
1472 uncompressed bytes actually written, or a negative zlib error code in case 1475 uncompressed bytes actually written, or a negative zlib error code in case
1473 of error. The number of uncompressed bytes written is limited to 8191, or 1476 of error. The number of uncompressed bytes written is limited to 8191, or
1474 one less than the buffer size given to gzbuffer(). The caller should assure 1477 one less than the buffer size given to gzbuffer(). The caller should assure
1475 that this limit is not exceeded. If it is exceeded, then gzprintf() will 1478 that this limit is not exceeded. If it is exceeded, then gzprintf() will
1476 return an error (0) with nothing written. In this case, there may also be a 1479 return an error (0) with nothing written. In this case, there may also be a
1477 buffer overflow with unpredictable consequences, which is possible only if 1480 buffer overflow with unpredictable consequences, which is possible only if
1478 zlib was compiled with the insecure functions sprintf() or vsprintf() 1481 zlib was compiled with the insecure functions sprintf() or vsprintf(),
1479 because the secure snprintf() or vsnprintf() functions were not available. 1482 because the secure snprintf() or vsnprintf() functions were not available.
1480 This can be determined using zlibCompileFlags(). 1483 This can be determined using zlibCompileFlags().
1481 */ 1484 */
1482 1485
1483 ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); 1486 ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s);
1484 /* 1487 /*
1485 Writes the given null-terminated string to the compressed file, excluding 1488 Compress and write the given null-terminated string s to file, excluding
1486 the terminating null character. 1489 the terminating null character.
1487 1490
1488 gzputs returns the number of characters written, or -1 in case of error. 1491 gzputs returns the number of characters written, or -1 in case of error.
1489 */ 1492 */
1490 1493
1491 ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); 1494 ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len);
1492 /* 1495 /*
1493 Reads bytes from the compressed file until len-1 characters are read, or a 1496 Read and decompress bytes from file into buf, until len-1 characters are
1494 newline character is read and transferred to buf, or an end-of-file 1497 read, or until a newline character is read and transferred to buf, or an
1495 condition is encountered. If any characters are read or if len == 1, the 1498 end-of-file condition is encountered. If any characters are read or if len
1496 string is terminated with a null character. If no characters are read due 1499 is one, the string is terminated with a null character. If no characters
1497 to an end-of-file or len < 1, then the buffer is left untouched. 1500 are read due to an end-of-file or len is less than one, then the buffer is
1501 left untouched.
1498 1502
1499 gzgets returns buf which is a null-terminated string, or it returns NULL 1503 gzgets returns buf which is a null-terminated string, or it returns NULL
1500 for end-of-file or in case of error. If there was an error, the contents at 1504 for end-of-file or in case of error. If there was an error, the contents at
1501 buf are indeterminate. 1505 buf are indeterminate.
1502 */ 1506 */
1503 1507
1504 ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); 1508 ZEXTERN int ZEXPORT gzputc(gzFile file, int c);
1505 /* 1509 /*
1506 Writes c, converted to an unsigned char, into the compressed file. gzputc 1510 Compress and write c, converted to an unsigned char, into file. gzputc
1507 returns the value that was written, or -1 in case of error. 1511 returns the value that was written, or -1 in case of error.
1508 */ 1512 */
1509 1513
1510 ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); 1514 ZEXTERN int ZEXPORT gzgetc(gzFile file);
1511 /* 1515 /*
1512 Reads one byte from the compressed file. gzgetc returns this byte or -1 1516 Read and decompress one byte from file. gzgetc returns this byte or -1
1513 in case of end of file or error. This is implemented as a macro for speed. 1517 in case of end of file or error. This is implemented as a macro for speed.
1514 As such, it does not do all of the checking the other functions do. I.e. 1518 As such, it does not do all of the checking the other functions do. I.e.
1515 it does not check to see if file is NULL, nor whether the structure file 1519 it does not check to see if file is NULL, nor whether the structure file
1516 points to has been clobbered or not. 1520 points to has been clobbered or not.
1517 */ 1521 */
1518 1522
1519 ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); 1523 ZEXTERN int ZEXPORT gzungetc(int c, gzFile file);
1520 /* 1524 /*
1521 Push one character back onto the stream to be read as the first character 1525 Push c back onto the stream for file to be read as the first character on
1522 on the next read. At least one character of push-back is allowed. 1526 the next read. At least one character of push-back is always allowed.
1523 gzungetc() returns the character pushed, or -1 on failure. gzungetc() will 1527 gzungetc() returns the character pushed, or -1 on failure. gzungetc() will
1524 fail if c is -1, and may fail if a character has been pushed but not read 1528 fail if c is -1, and may fail if a character has been pushed but not read
1525 yet. If gzungetc is used immediately after gzopen or gzdopen, at least the 1529 yet. If gzungetc is used immediately after gzopen or gzdopen, at least the
1526 output buffer size of pushed characters is allowed. (See gzbuffer above.) 1530 output buffer size of pushed characters is allowed. (See gzbuffer above.)
1527 The pushed character will be discarded if the stream is repositioned with 1531 The pushed character will be discarded if the stream is repositioned with
1528 gzseek() or gzrewind(). 1532 gzseek() or gzrewind().
1529 */ 1533 */
1530 1534
1531 ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); 1535 ZEXTERN int ZEXPORT gzflush(gzFile file, int flush);
1532 /* 1536 /*
1533 Flushes all pending output into the compressed file. The parameter flush 1537 Flush all pending output to file. The parameter flush is as in the
1534 is as in the deflate() function. The return value is the zlib error number 1538 deflate() function. The return value is the zlib error number (see function
1535 (see function gzerror below). gzflush is only permitted when writing. 1539 gzerror below). gzflush is only permitted when writing.
1536 1540
1537 If the flush parameter is Z_FINISH, the remaining data is written and the 1541 If the flush parameter is Z_FINISH, the remaining data is written and the
1538 gzip stream is completed in the output. If gzwrite() is called again, a new 1542 gzip stream is completed in the output. If gzwrite() is called again, a new
1539 gzip stream will be started in the output. gzread() is able to read such 1543 gzip stream will be started in the output. gzread() is able to read such
1540 concatenated gzip streams. 1544 concatenated gzip streams.
1542 gzflush should be called only when strictly necessary because it will 1546 gzflush should be called only when strictly necessary because it will
1543 degrade compression if called too often. 1547 degrade compression if called too often.
1544 */ 1548 */
1545 1549
1546 /* 1550 /*
1547 ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, 1551 ZEXTERN z_off_t ZEXPORT gzseek(gzFile file,
1548 z_off_t offset, int whence)); 1552 z_off_t offset, int whence);
1549 1553
1550 Sets the starting position for the next gzread or gzwrite on the given 1554 Set the starting position to offset relative to whence for the next gzread
1551 compressed file. The offset represents a number of bytes in the 1555 or gzwrite on file. The offset represents a number of bytes in the
1552 uncompressed data stream. The whence parameter is defined as in lseek(2); 1556 uncompressed data stream. The whence parameter is defined as in lseek(2);
1553 the value SEEK_END is not supported. 1557 the value SEEK_END is not supported.
1554 1558
1555 If the file is opened for reading, this function is emulated but can be 1559 If the file is opened for reading, this function is emulated but can be
1556 extremely slow. If the file is opened for writing, only forward seeks are 1560 extremely slow. If the file is opened for writing, only forward seeks are
1561 the beginning of the uncompressed stream, or -1 in case of error, in 1565 the beginning of the uncompressed stream, or -1 in case of error, in
1562 particular if the file is opened for writing and the new starting position 1566 particular if the file is opened for writing and the new starting position
1563 would be before the current position. 1567 would be before the current position.
1564 */ 1568 */
1565 1569
1566 ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); 1570 ZEXTERN int ZEXPORT gzrewind(gzFile file);
1567 /* 1571 /*
1568 Rewinds the given file. This function is supported only for reading. 1572 Rewind file. This function is supported only for reading.
1569 1573
1570 gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) 1574 gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET).
1571 */ 1575 */
1572 1576
1573 /* 1577 /*
1574 ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); 1578 ZEXTERN z_off_t ZEXPORT gztell(gzFile file);
1575 1579
1576 Returns the starting position for the next gzread or gzwrite on the given 1580 Return the starting position for the next gzread or gzwrite on file.
1577 compressed file. This position represents a number of bytes in the 1581 This position represents a number of bytes in the uncompressed data stream,
1578 uncompressed data stream, and is zero when starting, even if appending or 1582 and is zero when starting, even if appending or reading a gzip stream from
1579 reading a gzip stream from the middle of a file using gzdopen(). 1583 the middle of a file using gzdopen().
1580 1584
1581 gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) 1585 gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
1582 */ 1586 */
1583 1587
1584 /* 1588 /*
1585 ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); 1589 ZEXTERN z_off_t ZEXPORT gzoffset(gzFile file);
1586 1590
1587 Returns the current offset in the file being read or written. This offset 1591 Return the current compressed (actual) read or write offset of file. This
1588 includes the count of bytes that precede the gzip stream, for example when 1592 offset includes the count of bytes that precede the gzip stream, for example
1589 appending or when using gzdopen() for reading. When reading, the offset 1593 when appending or when using gzdopen() for reading. When reading, the
1590 does not include as yet unused buffered input. This information can be used 1594 offset does not include as yet unused buffered input. This information can
1591 for a progress indicator. On error, gzoffset() returns -1. 1595 be used for a progress indicator. On error, gzoffset() returns -1.
1592 */ 1596 */
1593 1597
1594 ZEXTERN int ZEXPORT gzeof OF((gzFile file)); 1598 ZEXTERN int ZEXPORT gzeof(gzFile file);
1595 /* 1599 /*
1596 Returns true (1) if the end-of-file indicator has been set while reading, 1600 Return true (1) if the end-of-file indicator for file has been set while
1597 false (0) otherwise. Note that the end-of-file indicator is set only if the 1601 reading, false (0) otherwise. Note that the end-of-file indicator is set
1598 read tried to go past the end of the input, but came up short. Therefore, 1602 only if the read tried to go past the end of the input, but came up short.
1599 just like feof(), gzeof() may return false even if there is no more data to 1603 Therefore, just like feof(), gzeof() may return false even if there is no
1600 read, in the event that the last read request was for the exact number of 1604 more data to read, in the event that the last read request was for the exact
1601 bytes remaining in the input file. This will happen if the input file size 1605 number of bytes remaining in the input file. This will happen if the input
1602 is an exact multiple of the buffer size. 1606 file size is an exact multiple of the buffer size.
1603 1607
1604 If gzeof() returns true, then the read functions will return no more data, 1608 If gzeof() returns true, then the read functions will return no more data,
1605 unless the end-of-file indicator is reset by gzclearerr() and the input file 1609 unless the end-of-file indicator is reset by gzclearerr() and the input file
1606 has grown since the previous end of file was detected. 1610 has grown since the previous end of file was detected.
1607 */ 1611 */
1608 1612
1609 ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); 1613 ZEXTERN int ZEXPORT gzdirect(gzFile file);
1610 /* 1614 /*
1611 Returns true (1) if file is being copied directly while reading, or false 1615 Return true (1) if file is being copied directly while reading, or false
1612 (0) if file is a gzip stream being decompressed. 1616 (0) if file is a gzip stream being decompressed.
1613 1617
1614 If the input file is empty, gzdirect() will return true, since the input 1618 If the input file is empty, gzdirect() will return true, since the input
1615 does not contain a gzip stream. 1619 does not contain a gzip stream.
1616 1620
1625 explicitly requested, so the application already knows the answer. When 1629 explicitly requested, so the application already knows the answer. When
1626 linking statically, using gzdirect() will include all of the zlib code for 1630 linking statically, using gzdirect() will include all of the zlib code for
1627 gzip file reading and decompression, which may not be desired.) 1631 gzip file reading and decompression, which may not be desired.)
1628 */ 1632 */
1629 1633
1630 ZEXTERN int ZEXPORT gzclose OF((gzFile file)); 1634 ZEXTERN int ZEXPORT gzclose(gzFile file);
1631 /* 1635 /*
1632 Flushes all pending output if necessary, closes the compressed file and 1636 Flush all pending output for file, if necessary, close file and
1633 deallocates the (de)compression state. Note that once file is closed, you 1637 deallocate the (de)compression state. Note that once file is closed, you
1634 cannot call gzerror with file, since its structures have been deallocated. 1638 cannot call gzerror with file, since its structures have been deallocated.
1635 gzclose must not be called more than once on the same file, just as free 1639 gzclose must not be called more than once on the same file, just as free
1636 must not be called more than once on the same allocation. 1640 must not be called more than once on the same allocation.
1637 1641
1638 gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a 1642 gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
1639 file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the 1643 file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the
1640 last read ended in the middle of a gzip stream, or Z_OK on success. 1644 last read ended in the middle of a gzip stream, or Z_OK on success.
1641 */ 1645 */
1642 1646
1643 ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); 1647 ZEXTERN int ZEXPORT gzclose_r(gzFile file);
1644 ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); 1648 ZEXTERN int ZEXPORT gzclose_w(gzFile file);
1645 /* 1649 /*
1646 Same as gzclose(), but gzclose_r() is only for use when reading, and 1650 Same as gzclose(), but gzclose_r() is only for use when reading, and
1647 gzclose_w() is only for use when writing or appending. The advantage to 1651 gzclose_w() is only for use when writing or appending. The advantage to
1648 using these instead of gzclose() is that they avoid linking in zlib 1652 using these instead of gzclose() is that they avoid linking in zlib
1649 compression or decompression code that is not used when only reading or only 1653 compression or decompression code that is not used when only reading or only
1650 writing respectively. If gzclose() is used, then both compression and 1654 writing respectively. If gzclose() is used, then both compression and
1651 decompression code will be included the application when linking to a static 1655 decompression code will be included the application when linking to a static
1652 zlib library. 1656 zlib library.
1653 */ 1657 */
1654 1658
1655 ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); 1659 ZEXTERN const char * ZEXPORT gzerror(gzFile file, int *errnum);
1656 /* 1660 /*
1657 Returns the error message for the last error which occurred on the given 1661 Return the error message for the last error which occurred on file.
1658 compressed file. errnum is set to zlib error number. If an error occurred 1662 errnum is set to zlib error number. If an error occurred in the file system
1659 in the file system and not in the compression library, errnum is set to 1663 and not in the compression library, errnum is set to Z_ERRNO and the
1660 Z_ERRNO and the application may consult errno to get the exact error code. 1664 application may consult errno to get the exact error code.
1661 1665
1662 The application must not modify the returned string. Future calls to 1666 The application must not modify the returned string. Future calls to
1663 this function may invalidate the previously returned string. If file is 1667 this function may invalidate the previously returned string. If file is
1664 closed, then the string previously returned by gzerror will no longer be 1668 closed, then the string previously returned by gzerror will no longer be
1665 available. 1669 available.
1666 1670
1667 gzerror() should be used to distinguish errors from end-of-file for those 1671 gzerror() should be used to distinguish errors from end-of-file for those
1668 functions above that do not distinguish those cases in their return values. 1672 functions above that do not distinguish those cases in their return values.
1669 */ 1673 */
1670 1674
1671 ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); 1675 ZEXTERN void ZEXPORT gzclearerr(gzFile file);
1672 /* 1676 /*
1673 Clears the error and end-of-file flags for file. This is analogous to the 1677 Clear the error and end-of-file flags for file. This is analogous to the
1674 clearerr() function in stdio. This is useful for continuing to read a gzip 1678 clearerr() function in stdio. This is useful for continuing to read a gzip
1675 file that is being written concurrently. 1679 file that is being written concurrently.
1676 */ 1680 */
1677 1681
1678 #endif /* !Z_SOLO */ 1682 #endif /* !Z_SOLO */
1683 These functions are not related to compression but are exported 1687 These functions are not related to compression but are exported
1684 anyway because they might be useful in applications using the compression 1688 anyway because they might be useful in applications using the compression
1685 library. 1689 library.
1686 */ 1690 */
1687 1691
1688 ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); 1692 ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len);
1689 /* 1693 /*
1690 Update a running Adler-32 checksum with the bytes buf[0..len-1] and 1694 Update a running Adler-32 checksum with the bytes buf[0..len-1] and
1691 return the updated checksum. If buf is Z_NULL, this function returns the 1695 return the updated checksum. An Adler-32 value is in the range of a 32-bit
1692 required initial value for the checksum. 1696 unsigned integer. If buf is Z_NULL, this function returns the required
1697 initial value for the checksum.
1693 1698
1694 An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed 1699 An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed
1695 much faster. 1700 much faster.
1696 1701
1697 Usage example: 1702 Usage example:
1702 adler = adler32(adler, buffer, length); 1707 adler = adler32(adler, buffer, length);
1703 } 1708 }
1704 if (adler != original_adler) error(); 1709 if (adler != original_adler) error();
1705 */ 1710 */
1706 1711
1707 ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf, 1712 ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf,
1708 z_size_t len)); 1713 z_size_t len);
1709 /* 1714 /*
1710 Same as adler32(), but with a size_t length. 1715 Same as adler32(), but with a size_t length.
1711 */ 1716 */
1712 1717
1713 /* 1718 /*
1714 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, 1719 ZEXTERN uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2,
1715 z_off_t len2)); 1720 z_off_t len2);
1716 1721
1717 Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 1722 Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
1718 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for 1723 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
1719 each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of 1724 each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
1720 seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note 1725 seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note
1721 that the z_off_t type (like off_t) is a signed integer. If len2 is 1726 that the z_off_t type (like off_t) is a signed integer. If len2 is
1722 negative, the result has no meaning or utility. 1727 negative, the result has no meaning or utility.
1723 */ 1728 */
1724 1729
1725 ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); 1730 ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len);
1726 /* 1731 /*
1727 Update a running CRC-32 with the bytes buf[0..len-1] and return the 1732 Update a running CRC-32 with the bytes buf[0..len-1] and return the
1728 updated CRC-32. If buf is Z_NULL, this function returns the required 1733 updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer.
1729 initial value for the crc. Pre- and post-conditioning (one's complement) is 1734 If buf is Z_NULL, this function returns the required initial value for the
1730 performed within this function so it shouldn't be done by the application. 1735 crc. Pre- and post-conditioning (one's complement) is performed within this
1736 function so it shouldn't be done by the application.
1731 1737
1732 Usage example: 1738 Usage example:
1733 1739
1734 uLong crc = crc32(0L, Z_NULL, 0); 1740 uLong crc = crc32(0L, Z_NULL, 0);
1735 1741
1737 crc = crc32(crc, buffer, length); 1743 crc = crc32(crc, buffer, length);
1738 } 1744 }
1739 if (crc != original_crc) error(); 1745 if (crc != original_crc) error();
1740 */ 1746 */
1741 1747
1742 ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf, 1748 ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf,
1743 z_size_t len)); 1749 z_size_t len);
1744 /* 1750 /*
1745 Same as crc32(), but with a size_t length. 1751 Same as crc32(), but with a size_t length.
1746 */ 1752 */
1747 1753
1748 /* 1754 /*
1749 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); 1755 ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2);
1750 1756
1751 Combine two CRC-32 check values into one. For two sequences of bytes, 1757 Combine two CRC-32 check values into one. For two sequences of bytes,
1752 seq1 and seq2 with lengths len1 and len2, CRC-32 check values were 1758 seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
1753 calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 1759 calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
1754 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and 1760 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
1755 len2. 1761 len2. len2 must be non-negative.
1762 */
1763
1764 /*
1765 ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2);
1766
1767 Return the operator corresponding to length len2, to be used with
1768 crc32_combine_op(). len2 must be non-negative.
1769 */
1770
1771 ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op);
1772 /*
1773 Give the same result as crc32_combine(), using op in place of len2. op is
1774 is generated from len2 by crc32_combine_gen(). This will be faster than
1775 crc32_combine() if the generated op is used more than once.
1756 */ 1776 */
1757 1777
1758 1778
1759 /* various hacks, don't look :) */ 1779 /* various hacks, don't look :) */
1760 1780
1761 /* deflateInit and inflateInit are macros to allow checking the zlib version 1781 /* deflateInit and inflateInit are macros to allow checking the zlib version
1762 * and the compiler's view of z_stream: 1782 * and the compiler's view of z_stream:
1763 */ 1783 */
1764 ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, 1784 ZEXTERN int ZEXPORT deflateInit_(z_streamp strm, int level,
1765 const char *version, int stream_size)); 1785 const char *version, int stream_size);
1766 ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, 1786 ZEXTERN int ZEXPORT inflateInit_(z_streamp strm,
1767 const char *version, int stream_size)); 1787 const char *version, int stream_size);
1768 ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, 1788 ZEXTERN int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
1769 int windowBits, int memLevel, 1789 int windowBits, int memLevel,
1770 int strategy, const char *version, 1790 int strategy, const char *version,
1771 int stream_size)); 1791 int stream_size);
1772 ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, 1792 ZEXTERN int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
1773 const char *version, int stream_size)); 1793 const char *version, int stream_size);
1774 ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, 1794 ZEXTERN int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits,
1775 unsigned char FAR *window, 1795 unsigned char FAR *window,
1776 const char *version, 1796 const char *version,
1777 int stream_size)); 1797 int stream_size);
1778 #ifdef Z_PREFIX_SET 1798 #ifdef Z_PREFIX_SET
1779 # define z_deflateInit(strm, level) \ 1799 # define z_deflateInit(strm, level) \
1780 deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) 1800 deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
1781 # define z_inflateInit(strm) \ 1801 # define z_inflateInit(strm) \
1782 inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) 1802 inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
1817 struct gzFile_s { 1837 struct gzFile_s {
1818 unsigned have; 1838 unsigned have;
1819 unsigned char *next; 1839 unsigned char *next;
1820 z_off64_t pos; 1840 z_off64_t pos;
1821 }; 1841 };
1822 ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ 1842 ZEXTERN int ZEXPORT gzgetc_(gzFile file); /* backward compatibility */
1823 #ifdef Z_PREFIX_SET 1843 #ifdef Z_PREFIX_SET
1824 # undef z_gzgetc 1844 # undef z_gzgetc
1825 # define z_gzgetc(g) \ 1845 # define z_gzgetc(g) \
1826 ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) 1846 ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
1827 #else 1847 #else
1834 * both are true, the application gets the *64 functions, and the regular 1854 * both are true, the application gets the *64 functions, and the regular
1835 * functions are changed to 64 bits) -- in case these are set on systems 1855 * functions are changed to 64 bits) -- in case these are set on systems
1836 * without large file support, _LFS64_LARGEFILE must also be true 1856 * without large file support, _LFS64_LARGEFILE must also be true
1837 */ 1857 */
1838 #ifdef Z_LARGE64 1858 #ifdef Z_LARGE64
1839 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); 1859 ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
1840 ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); 1860 ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
1841 ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); 1861 ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
1842 ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); 1862 ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile);
1843 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); 1863 ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t);
1844 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); 1864 ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t);
1865 ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t);
1845 #endif 1866 #endif
1846 1867
1847 #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) 1868 #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
1848 # ifdef Z_PREFIX_SET 1869 # ifdef Z_PREFIX_SET
1849 # define z_gzopen z_gzopen64 1870 # define z_gzopen z_gzopen64
1850 # define z_gzseek z_gzseek64 1871 # define z_gzseek z_gzseek64
1851 # define z_gztell z_gztell64 1872 # define z_gztell z_gztell64
1852 # define z_gzoffset z_gzoffset64 1873 # define z_gzoffset z_gzoffset64
1853 # define z_adler32_combine z_adler32_combine64 1874 # define z_adler32_combine z_adler32_combine64
1854 # define z_crc32_combine z_crc32_combine64 1875 # define z_crc32_combine z_crc32_combine64
1876 # define z_crc32_combine_gen z_crc32_combine_gen64
1855 # else 1877 # else
1856 # define gzopen gzopen64 1878 # define gzopen gzopen64
1857 # define gzseek gzseek64 1879 # define gzseek gzseek64
1858 # define gztell gztell64 1880 # define gztell gztell64
1859 # define gzoffset gzoffset64 1881 # define gzoffset gzoffset64
1860 # define adler32_combine adler32_combine64 1882 # define adler32_combine adler32_combine64
1861 # define crc32_combine crc32_combine64 1883 # define crc32_combine crc32_combine64
1884 # define crc32_combine_gen crc32_combine_gen64
1862 # endif 1885 # endif
1863 # ifndef Z_LARGE64 1886 # ifndef Z_LARGE64
1864 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); 1887 ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
1865 ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); 1888 ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int);
1866 ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); 1889 ZEXTERN z_off_t ZEXPORT gztell64(gzFile);
1867 ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); 1890 ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile);
1868 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); 1891 ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
1869 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); 1892 ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
1893 ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
1870 # endif 1894 # endif
1871 #else 1895 #else
1872 ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); 1896 ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *);
1873 ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); 1897 ZEXTERN z_off_t ZEXPORT gzseek(gzFile, z_off_t, int);
1874 ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); 1898 ZEXTERN z_off_t ZEXPORT gztell(gzFile);
1875 ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); 1899 ZEXTERN z_off_t ZEXPORT gzoffset(gzFile);
1876 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); 1900 ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t);
1877 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); 1901 ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t);
1902 ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t);
1878 #endif 1903 #endif
1879 1904
1880 #else /* Z_SOLO */ 1905 #else /* Z_SOLO */
1881 1906
1882 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); 1907 ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t);
1883 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); 1908 ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t);
1909 ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t);
1884 1910
1885 #endif /* !Z_SOLO */ 1911 #endif /* !Z_SOLO */
1886 1912
1887 /* undocumented functions */ 1913 /* undocumented functions */
1888 ZEXTERN const char * ZEXPORT zError OF((int)); 1914 ZEXTERN const char * ZEXPORT zError(int);
1889 ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); 1915 ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp);
1890 ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); 1916 ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void);
1891 ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); 1917 ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int);
1892 ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); 1918 ZEXTERN int ZEXPORT inflateValidate(z_streamp, int);
1893 ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp)); 1919 ZEXTERN unsigned long ZEXPORT inflateCodesUsed(z_streamp);
1894 ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); 1920 ZEXTERN int ZEXPORT inflateResetKeep(z_streamp);
1895 ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); 1921 ZEXTERN int ZEXPORT deflateResetKeep(z_streamp);
1896 #if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO) 1922 #if defined(_WIN32) && !defined(Z_SOLO)
1897 ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, 1923 ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path,
1898 const char *mode)); 1924 const char *mode);
1899 #endif 1925 #endif
1900 #if defined(STDC) || defined(Z_HAVE_STDARG_H) 1926 #if defined(STDC) || defined(Z_HAVE_STDARG_H)
1901 # ifndef Z_SOLO 1927 # ifndef Z_SOLO
1902 ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, 1928 ZEXTERN int ZEXPORTVA gzvprintf(gzFile file,
1903 const char *format, 1929 const char *format,
1904 va_list va)); 1930 va_list va);
1905 # endif 1931 # endif
1906 #endif 1932 #endif
1907 1933
1908 #ifdef __cplusplus 1934 #ifdef __cplusplus
1909 } 1935 }