aboutsummaryrefslogtreecommitdiff
path: root/zlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'zlib.h')
-rw-r--r--zlib.h36
1 files changed, 21 insertions, 15 deletions
diff --git a/zlib.h b/zlib.h
index f72fff8..e64ab91 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 0.8 April 29th, 1995. 2 version 0.9 April 30th, 1995.
3 3
4 Copyright (C) 1995 Jean-loup Gailly and Mark Adler 4 Copyright (C) 1995 Jean-loup Gailly and Mark Adler
5 5
@@ -28,7 +28,7 @@
28 28
29#include "zconf.h" 29#include "zconf.h"
30 30
31#define ZLIB_VERSION "0.8" 31#define ZLIB_VERSION "0.9"
32 32
33/* 33/*
34 The 'zlib' compression library provides in-memory compression and 34 The 'zlib' compression library provides in-memory compression and
@@ -81,7 +81,7 @@ typedef struct z_stream_s {
81 opaque before calling the init function. All other fields are set by the 81 opaque before calling the init function. All other fields are set by the
82 compression library and must not be updated by the application. 82 compression library and must not be updated by the application.
83 83
84 The opaque value provided by the application will be passed as first 84 The opaque value provided by the application will be passed as the first
85 parameter for calls of zalloc and zfree. This can be useful for custom 85 parameter for calls of zalloc and zfree. This can be useful for custom
86 memory management. The compression library attaches no meaning to the 86 memory management. The compression library attaches no meaning to the
87 opaque value. 87 opaque value.
@@ -89,7 +89,12 @@ typedef struct z_stream_s {
89 zalloc must return Z_NULL if there is not enough memory for the object. 89 zalloc must return Z_NULL if there is not enough memory for the object.
90 On 16-bit systems, the functions zalloc and zfree must be able to allocate 90 On 16-bit systems, the functions zalloc and zfree must be able to allocate
91 exactly 65536 bytes, but will not be required to allocate more than this 91 exactly 65536 bytes, but will not be required to allocate more than this
92 if the symbol MAXSEG_64K is defined (see zconf.h). 92 if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
93 pointers returned by zalloc for objects of exactly 65536 bytes *must*
94 have their offset normalized to zero. The default allocation function
95 provided by this library ensures this (see zutil.c). To reduce memory
96 requirements and avoid any allocation of 64K objects, at the expense of
97 compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
93 98
94 The fields total_in and total_out can be used for statistics or 99 The fields total_in and total_out can be used for statistics or
95 progress reports. After compression, total_in holds the total size of 100 progress reports. After compression, total_in holds the total size of
@@ -265,7 +270,7 @@ extern int inflate __P((z_stream *strm, int flush));
265 270
266 If the parameter flush is set to Z_PARTIAL_FLUSH, inflate flushes as much 271 If the parameter flush is set to Z_PARTIAL_FLUSH, inflate flushes as much
267 output as possible to the output buffer. The flushing behavior of inflate is 272 output as possible to the output buffer. The flushing behavior of inflate is
268 not specified for values of the flush paramater other than Z_PARTIAL_FLUSH 273 not specified for values of the flush parameter other than Z_PARTIAL_FLUSH
269 and Z_FINISH, but the current implementation actually flushes as much output 274 and Z_FINISH, but the current implementation actually flushes as much output
270 as possible anyway. 275 as possible anyway.
271 276
@@ -367,7 +372,7 @@ extern int deflateCopy __P((z_stream *dest,
367 Sets the destination stream as a complete copy of the source stream. If 372 Sets the destination stream as a complete copy of the source stream. If
368 the source stream is using an application-supplied history buffer, a new 373 the source stream is using an application-supplied history buffer, a new
369 buffer is allocated for the destination stream. The compressed output 374 buffer is allocated for the destination stream. The compressed output
370 buffer is always application-supplied. It's the responsability of the 375 buffer is always application-supplied. It's the responsibility of the
371 application to provide the correct values of next_out and avail_out for the 376 application to provide the correct values of next_out and avail_out for the
372 next call of deflate. 377 next call of deflate.
373 378
@@ -430,12 +435,13 @@ extern int inflateInit2 __P((z_stream *strm,
430 435
431extern int inflateSync __P((z_stream *strm)); 436extern int inflateSync __P((z_stream *strm));
432/* 437/*
433 Skips invalid compressed data until the special marker and a valid block 438 Skips invalid compressed data until the special marker (see deflate()
434 can be found, or until all available input is skipped. No output is provided. 439 above) can be found, or until all available input is skipped. No output
440 is provided.
435 441
436 inflateSync returns Z_OK if a valid block has been found, Z_BUF_ERROR if 442 inflateSync returns Z_OK if the special marker has been found, Z_BUF_ERROR
437 no more input was provided, Z_DATA_ERROR if not valid block has been found, 443 if no more input was provided, Z_DATA_ERROR if no marker has been found,
438 Z_STREAM_ERROR if the stream structure was inconsistent. In the success 444 or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
439 case, the application may save the current current value of total_in which 445 case, the application may save the current current value of total_in which
440 indicates where valid compressed data was found. In the error case, the 446 indicates where valid compressed data was found. In the error case, the
441 application may repeatedly call inflateSync, providing more input each time, 447 application may repeatedly call inflateSync, providing more input each time,
@@ -469,7 +475,7 @@ extern int compress __P((Byte *dest, uLong *destLen,
469 Compresses the source buffer into the destination buffer. sourceLen is 475 Compresses the source buffer into the destination buffer. sourceLen is
470 the byte length of the source buffer. Upon entry, destLen is the total 476 the byte length of the source buffer. Upon entry, destLen is the total
471 size of the destination buffer, which must be at least 0.1% larger than 477 size of the destination buffer, which must be at least 0.1% larger than
472 sourceLen plus 8 bytes. Upon exit, destLen is the actual size of the 478 sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
473 compressed buffer. 479 compressed buffer.
474 This function can be used to compress a whole file at once if the 480 This function can be used to compress a whole file at once if the
475 input file is mmap'ed. 481 input file is mmap'ed.
@@ -505,7 +511,7 @@ extern gzFile gzopen __P((char *path, char *mode));
505 is as in fopen ("rb" or "wb"). gzopen can also be used to read a file 511 is as in fopen ("rb" or "wb"). gzopen can also be used to read a file
506 which is not in gzip format; in this case gzread will directly read from 512 which is not in gzip format; in this case gzread will directly read from
507 the file without decompression. 513 the file without decompression.
508 gzopen return NULL if the file could not be opened or if there was 514 gzopen returns NULL if the file could not be opened or if there was
509 insufficient memory to allocate the (de)compression state; errno 515 insufficient memory to allocate the (de)compression state; errno
510 can be checked to distinguish the two cases (if errno is zero, the 516 can be checked to distinguish the two cases (if errno is zero, the
511 zlib error is Z_MEM_ERROR). 517 zlib error is Z_MEM_ERROR).
@@ -516,7 +522,7 @@ extern gzFile gzdopen __P((int fd, char *mode));
516 gzdopen() associates a gzFile with the file descriptor fd. File 522 gzdopen() associates a gzFile with the file descriptor fd. File
517 descriptors are obtained from calls like open, dup, creat, or pipe. 523 descriptors are obtained from calls like open, dup, creat, or pipe.
518 The mode parameter is as in fopen ("rb" or "wb"). 524 The mode parameter is as in fopen ("rb" or "wb").
519 gzdopen return NULL if there was insufficient memory to allocate 525 gzdopen returns NULL if there was insufficient memory to allocate
520 the (de)compression state. 526 the (de)compression state.
521*/ 527*/
522 528
@@ -574,7 +580,7 @@ extern uLong adler32 __P((uLong adler, Byte *buf, uInt len));
574 Update a running Adler-32 checksum with the bytes buf[0..len-1] and 580 Update a running Adler-32 checksum with the bytes buf[0..len-1] and
575 return the updated checksum. If buf is NULL, this function returns 581 return the updated checksum. If buf is NULL, this function returns
576 the required initial value for the checksum. 582 the required initial value for the checksum.
577 An Adler-32 cheksum is almost as reliable as a CRC32 but can be computed 583 An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
578 much faster. Usage example: 584 much faster. Usage example:
579 585
580 uLong adler = adler32(0L, Z_NULL, 0); 586 uLong adler = adler32(0L, Z_NULL, 0);