summaryrefslogtreecommitdiff
path: root/zlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'zlib.h')
-rw-r--r--zlib.h119
1 files changed, 64 insertions, 55 deletions
diff --git a/zlib.h b/zlib.h
index 47960c2..1e61491 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1,5 +1,5 @@
1/* zlib.h -- interface of the 'zlib' general purpose compression library 1/* zlib.h -- interface of the 'zlib' general purpose compression library
2 version 1.0.1, May 20th, 1996. 2 version 1.0.2, May 23rd, 1996.
3 3
4 Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler 4 Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler
5 5
@@ -21,7 +21,12 @@
21 21
22 Jean-loup Gailly Mark Adler 22 Jean-loup Gailly Mark Adler
23 gzip@prep.ai.mit.edu madler@alumni.caltech.edu 23 gzip@prep.ai.mit.edu madler@alumni.caltech.edu
24 */ 24
25
26 The data format used by the zlib library is described by RFCs (Request for
27 Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
28 (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
29*/
25 30
26#ifndef _ZLIB_H 31#ifndef _ZLIB_H
27#define _ZLIB_H 32#define _ZLIB_H
@@ -32,7 +37,7 @@ extern "C" {
32 37
33#include "zconf.h" 38#include "zconf.h"
34 39
35#define ZLIB_VERSION "1.0.1" 40#define ZLIB_VERSION "1.0.2"
36 41
37/* 42/*
38 The 'zlib' compression library provides in-memory compression and 43 The 'zlib' compression library provides in-memory compression and
@@ -156,16 +161,20 @@ typedef struct z_stream_s {
156 161
157#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ 162#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
158 163
159extern const char *zlib_version; 164#define zlib_version zlibVersion()
160/* The application can compare zlib_version and ZLIB_VERSION for consistency. 165/* for compatibility with versions < 1.0.2 */
166
167 /* basic functions */
168
169extern char EXPORT *zlibVersion OF((void));
170/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
161 If the first character differs, the library code actually used is 171 If the first character differs, the library code actually used is
162 not compatible with the zlib.h header file used by the application. 172 not compatible with the zlib.h header file used by the application.
173 This check is automatically made by deflateInit and inflateInit.
163 */ 174 */
164 175
165 /* basic functions */
166
167/* 176/*
168extern int deflateInit OF((z_stream *strm, int level)); 177extern int EXPORT deflateInit OF((z_stream *strm, int level));
169 178
170 Initializes the internal stream state for compression. The fields 179 Initializes the internal stream state for compression. The fields
171 zalloc, zfree and opaque must be initialized before by the caller. 180 zalloc, zfree and opaque must be initialized before by the caller.
@@ -187,7 +196,7 @@ extern int deflateInit OF((z_stream *strm, int level));
187*/ 196*/
188 197
189 198
190extern int deflate OF((z_stream *strm, int flush)); 199extern int EXPORT deflate OF((z_stream *strm, int flush));
191/* 200/*
192 Performs one or both of the following actions: 201 Performs one or both of the following actions:
193 202
@@ -256,7 +265,7 @@ extern int deflate OF((z_stream *strm, int flush));
256*/ 265*/
257 266
258 267
259extern int deflateEnd OF((z_stream *strm)); 268extern int EXPORT deflateEnd OF((z_stream *strm));
260/* 269/*
261 All dynamically allocated data structures for this stream are freed. 270 All dynamically allocated data structures for this stream are freed.
262 This function discards any unprocessed input and does not flush any 271 This function discards any unprocessed input and does not flush any
@@ -271,7 +280,7 @@ extern int deflateEnd OF((z_stream *strm));
271 280
272 281
273/* 282/*
274extern int inflateInit OF((z_stream *strm)); 283extern int EXPORT inflateInit OF((z_stream *strm));
275 284
276 Initializes the internal stream state for decompression. The fields 285 Initializes the internal stream state for decompression. The fields
277 zalloc, zfree and opaque must be initialized before by the caller. If 286 zalloc, zfree and opaque must be initialized before by the caller. If
@@ -286,7 +295,7 @@ extern int inflateInit OF((z_stream *strm));
286*/ 295*/
287 296
288 297
289extern int inflate OF((z_stream *strm, int flush)); 298extern int EXPORT inflate OF((z_stream *strm, int flush));
290/* 299/*
291 Performs one or both of the following actions: 300 Performs one or both of the following actions:
292 301
@@ -341,7 +350,7 @@ extern int inflate OF((z_stream *strm, int flush));
341*/ 350*/
342 351
343 352
344extern int inflateEnd OF((z_stream *strm)); 353extern int EXPORT inflateEnd OF((z_stream *strm));
345/* 354/*
346 All dynamically allocated data structures for this stream are freed. 355 All dynamically allocated data structures for this stream are freed.
347 This function discards any unprocessed input and does not flush any 356 This function discards any unprocessed input and does not flush any
@@ -359,12 +368,12 @@ extern int inflateEnd OF((z_stream *strm));
359*/ 368*/
360 369
361/* 370/*
362extern int deflateInit2 OF((z_stream *strm, 371extern int EXPORT deflateInit2 OF((z_stream *strm,
363 int level, 372 int level,
364 int method, 373 int method,
365 int windowBits, 374 int windowBits,
366 int memLevel, 375 int memLevel,
367 int strategy)); 376 int strategy));
368 377
369 This is another version of deflateInit with more compression options. The 378 This is another version of deflateInit with more compression options. The
370 fields next_in, zalloc, zfree and opaque must be initialized before by 379 fields next_in, zalloc, zfree and opaque must be initialized before by
@@ -417,9 +426,9 @@ extern int deflateInit2 OF((z_stream *strm,
417 deflate(). 426 deflate().
418*/ 427*/
419 428
420extern int deflateSetDictionary OF((z_stream *strm, 429extern int EXPORT deflateSetDictionary OF((z_stream *strm,
421 const Bytef *dictionary, 430 const Bytef *dictionary,
422 uInt dictLength)); 431 uInt dictLength));
423/* 432/*
424 Initializes the compression dictionary (history buffer) from the given 433 Initializes the compression dictionary (history buffer) from the given
425 byte sequence without producing any compressed output. This function must 434 byte sequence without producing any compressed output. This function must
@@ -446,8 +455,8 @@ extern int deflateSetDictionary OF((z_stream *strm,
446 be done by deflate(). 455 be done by deflate().
447*/ 456*/
448 457
449extern int deflateCopy OF((z_stream *dest, 458extern int EXPORT deflateCopy OF((z_stream *dest,
450 z_stream *source)); 459 z_stream *source));
451/* 460/*
452 Sets the destination stream as a complete copy of the source stream. If 461 Sets the destination stream as a complete copy of the source stream. If
453 the source stream is using an application-supplied history buffer, a new 462 the source stream is using an application-supplied history buffer, a new
@@ -469,7 +478,7 @@ extern int deflateCopy OF((z_stream *dest,
469 destination. 478 destination.
470*/ 479*/
471 480
472extern int deflateReset OF((z_stream *strm)); 481extern int EXPORT deflateReset OF((z_stream *strm));
473/* 482/*
474 This function is equivalent to deflateEnd followed by deflateInit, 483 This function is equivalent to deflateEnd followed by deflateInit,
475 but does not free and reallocate all the internal compression state. 484 but does not free and reallocate all the internal compression state.
@@ -480,7 +489,7 @@ extern int deflateReset OF((z_stream *strm));
480 stream state was inconsistent (such as zalloc or state being NULL). 489 stream state was inconsistent (such as zalloc or state being NULL).
481*/ 490*/
482 491
483extern int deflateParams OF((z_stream *strm, int level, int strategy)); 492extern int EXPORT deflateParams OF((z_stream *strm, int level, int strategy));
484/* 493/*
485 Dynamically update the compression level and compression strategy. 494 Dynamically update the compression level and compression strategy.
486 This can be used to switch between compression and straight copy of 495 This can be used to switch between compression and straight copy of
@@ -499,8 +508,8 @@ extern int deflateParams OF((z_stream *strm, int level, int strategy));
499*/ 508*/
500 509
501/* 510/*
502extern int inflateInit2 OF((z_stream *strm, 511extern int EXPORT inflateInit2 OF((z_stream *strm,
503 int windowBits)); 512 int windowBits));
504 513
505 This is another version of inflateInit with more compression options. The 514 This is another version of inflateInit with more compression options. The
506 fields next_out, zalloc, zfree and opaque must be initialized before by 515 fields next_out, zalloc, zfree and opaque must be initialized before by
@@ -533,9 +542,9 @@ extern int inflateInit2 OF((z_stream *strm,
533 inflate(). 542 inflate().
534*/ 543*/
535 544
536extern int inflateSetDictionary OF((z_stream *strm, 545extern int EXPORT inflateSetDictionary OF((z_stream *strm,
537 const Bytef *dictionary, 546 const Bytef *dictionary,
538 uInt dictLength)); 547 uInt dictLength));
539/* 548/*
540 Initializes the decompression dictionary (history buffer) from the given 549 Initializes the decompression dictionary (history buffer) from the given
541 uncompressed byte sequence. This function must be called immediately after 550 uncompressed byte sequence. This function must be called immediately after
@@ -552,7 +561,7 @@ extern int inflateSetDictionary OF((z_stream *strm,
552 inflate(). 561 inflate().
553*/ 562*/
554 563
555extern int inflateSync OF((z_stream *strm)); 564extern int EXPORT inflateSync OF((z_stream *strm));
556/* 565/*
557 Skips invalid compressed data until the special marker (see deflate() 566 Skips invalid compressed data until the special marker (see deflate()
558 above) can be found, or until all available input is skipped. No output 567 above) can be found, or until all available input is skipped. No output
@@ -567,7 +576,7 @@ extern int inflateSync OF((z_stream *strm));
567 until success or end of the input data. 576 until success or end of the input data.
568*/ 577*/
569 578
570extern int inflateReset OF((z_stream *strm)); 579extern int EXPORT inflateReset OF((z_stream *strm));
571/* 580/*
572 This function is equivalent to inflateEnd followed by inflateInit, 581 This function is equivalent to inflateEnd followed by inflateInit,
573 but does not free and reallocate all the internal decompression state. 582 but does not free and reallocate all the internal decompression state.
@@ -588,8 +597,8 @@ extern int inflateReset OF((z_stream *strm));
588 utility functions can easily be modified if you need special options. 597 utility functions can easily be modified if you need special options.
589*/ 598*/
590 599
591extern int compress OF((Bytef *dest, uLongf *destLen, 600extern int EXPORT compress OF((Bytef *dest, uLongf *destLen,
592 const Bytef *source, uLong sourceLen)); 601 const Bytef *source, uLong sourceLen));
593/* 602/*
594 Compresses the source buffer into the destination buffer. sourceLen is 603 Compresses the source buffer into the destination buffer. sourceLen is
595 the byte length of the source buffer. Upon entry, destLen is the total 604 the byte length of the source buffer. Upon entry, destLen is the total
@@ -603,8 +612,8 @@ extern int compress OF((Bytef *dest, uLongf *destLen,
603 buffer. 612 buffer.
604*/ 613*/
605 614
606extern int uncompress OF((Bytef *dest, uLongf *destLen, 615extern int EXPORT uncompress OF((Bytef *dest, uLongf *destLen,
607 const Bytef *source, uLong sourceLen)); 616 const Bytef *source, uLong sourceLen));
608/* 617/*
609 Decompresses the source buffer into the destination buffer. sourceLen is 618 Decompresses the source buffer into the destination buffer. sourceLen is
610 the byte length of the source buffer. Upon entry, destLen is the total 619 the byte length of the source buffer. Upon entry, destLen is the total
@@ -624,7 +633,7 @@ extern int uncompress OF((Bytef *dest, uLongf *destLen,
624 633
625typedef voidp gzFile; 634typedef voidp gzFile;
626 635
627extern gzFile gzopen OF((const char *path, const char *mode)); 636extern gzFile EXPORT gzopen OF((const char *path, const char *mode));
628/* 637/*
629 Opens a gzip (.gz) file for reading or writing. The mode parameter 638 Opens a gzip (.gz) file for reading or writing. The mode parameter
630 is as in fopen ("rb" or "wb") but can also include a compression level 639 is as in fopen ("rb" or "wb") but can also include a compression level
@@ -636,7 +645,7 @@ extern gzFile gzopen OF((const char *path, const char *mode));
636 zlib error is Z_MEM_ERROR). 645 zlib error is Z_MEM_ERROR).
637*/ 646*/
638 647
639extern gzFile gzdopen OF((int fd, const char *mode)); 648extern gzFile EXPORT gzdopen OF((int fd, const char *mode));
640/* 649/*
641 gzdopen() associates a gzFile with the file descriptor fd. File 650 gzdopen() associates a gzFile with the file descriptor fd. File
642 descriptors are obtained from calls like open, dup, creat, pipe or 651 descriptors are obtained from calls like open, dup, creat, pipe or
@@ -649,7 +658,7 @@ extern gzFile gzdopen OF((int fd, const char *mode));
649 the (de)compression state. 658 the (de)compression state.
650*/ 659*/
651 660
652extern int gzread OF((gzFile file, voidp buf, unsigned len)); 661extern int EXPORT gzread OF((gzFile file, voidp buf, unsigned len));
653/* 662/*
654 Reads the given number of uncompressed bytes from the compressed file. 663 Reads the given number of uncompressed bytes from the compressed file.
655 If the input file was not in gzip format, gzread copies the given number 664 If the input file was not in gzip format, gzread copies the given number
@@ -657,14 +666,14 @@ extern int gzread OF((gzFile file, voidp buf, unsigned len));
657 gzread returns the number of uncompressed bytes actually read (0 for 666 gzread returns the number of uncompressed bytes actually read (0 for
658 end of file, -1 for error). */ 667 end of file, -1 for error). */
659 668
660extern int gzwrite OF((gzFile file, const voidp buf, unsigned len)); 669extern int EXPORT gzwrite OF((gzFile file, const voidp buf, unsigned len));
661/* 670/*
662 Writes the given number of uncompressed bytes into the compressed file. 671 Writes the given number of uncompressed bytes into the compressed file.
663 gzwrite returns the number of uncompressed bytes actually written 672 gzwrite returns the number of uncompressed bytes actually written
664 (0 in case of error). 673 (0 in case of error).
665*/ 674*/
666 675
667extern int gzflush OF((gzFile file, int flush)); 676extern int EXPORT gzflush OF((gzFile file, int flush));
668/* 677/*
669 Flushes all pending output into the compressed file. The parameter 678 Flushes all pending output into the compressed file. The parameter
670 flush is as in the deflate() function. The return value is the zlib 679 flush is as in the deflate() function. The return value is the zlib
@@ -674,14 +683,14 @@ extern int gzflush OF((gzFile file, int flush));
674 degrade compression. 683 degrade compression.
675*/ 684*/
676 685
677extern int gzclose OF((gzFile file)); 686extern int EXPORT gzclose OF((gzFile file));
678/* 687/*
679 Flushes all pending output if necessary, closes the compressed file 688 Flushes all pending output if necessary, closes the compressed file
680 and deallocates all the (de)compression state. The return value is the zlib 689 and deallocates all the (de)compression state. The return value is the zlib
681 error number (see function gzerror below). 690 error number (see function gzerror below).
682*/ 691*/
683 692
684extern char* gzerror OF((gzFile file, int *errnum)); 693extern char EXPORT *gzerror OF((gzFile file, int *errnum));
685/* 694/*
686 Returns the error message for the last error which occurred on the 695 Returns the error message for the last error which occurred on the
687 given compressed file. errnum is set to zlib error number. If an 696 given compressed file. errnum is set to zlib error number. If an
@@ -698,7 +707,7 @@ extern char* gzerror OF((gzFile file, int *errnum));
698 compression library. 707 compression library.
699*/ 708*/
700 709
701extern uLong adler32 OF((uLong adler, const Bytef *buf, uInt len)); 710extern uLong EXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
702 711
703/* 712/*
704 Update a running Adler-32 checksum with the bytes buf[0..len-1] and 713 Update a running Adler-32 checksum with the bytes buf[0..len-1] and
@@ -715,7 +724,7 @@ extern uLong adler32 OF((uLong adler, const Bytef *buf, uInt len));
715 if (adler != original_adler) error(); 724 if (adler != original_adler) error();
716*/ 725*/
717 726
718extern uLong crc32 OF((uLong crc, const Bytef *buf, uInt len)); 727extern uLong EXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
719/* 728/*
720 Update a running crc with the bytes buf[0..len-1] and return the updated 729 Update a running crc with the bytes buf[0..len-1] and return the updated
721 crc. If buf is NULL, this function returns the required initial value 730 crc. If buf is NULL, this function returns the required initial value
@@ -737,15 +746,15 @@ extern uLong crc32 OF((uLong crc, const Bytef *buf, uInt len));
737/* deflateInit and inflateInit are macros to allow checking the zlib version 746/* deflateInit and inflateInit are macros to allow checking the zlib version
738 * and the compiler's view of z_stream: 747 * and the compiler's view of z_stream:
739 */ 748 */
740extern int deflateInit_ OF((z_stream *strm, int level, 749extern int EXPORT deflateInit_ OF((z_stream *strm, int level,
741 const char *version, int stream_size)); 750 const char *version, int stream_size));
742extern int inflateInit_ OF((z_stream *strm, 751extern int EXPORT inflateInit_ OF((z_stream *strm,
743 const char *version, int stream_size)); 752 const char *version, int stream_size));
744extern int deflateInit2_ OF((z_stream *strm, int level, int method, 753extern int EXPORT deflateInit2_ OF((z_stream *strm, int level, int method,
745 int windowBits, int memLevel, int strategy, 754 int windowBits, int memLevel, int strategy,
746 const char *version, int stream_size)); 755 const char *version, int stream_size));
747extern int inflateInit2_ OF((z_stream *strm, int windowBits, 756extern int EXPORT inflateInit2_ OF((z_stream *strm, int windowBits,
748 const char *version, int stream_size)); 757 const char *version, int stream_size));
749#define deflateInit(strm, level) \ 758#define deflateInit(strm, level) \
750 deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) 759 deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
751#define inflateInit(strm) \ 760#define inflateInit(strm) \