1/* $NetBSD: zlib.h,v 1.15 2020/03/05 07:46:49 riastradh Exp $ */ 2 3/* zlib.h -- interface of the 'zlib' general purpose compression library 4 version 1.1.4, March 11th, 2002 5 6 Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler 7 8 This software is provided 'as-is', without any express or implied 9 warranty. In no event will the authors be held liable for any damages 10 arising from the use of this software. 11 12 Permission is granted to anyone to use this software for any purpose, 13 including commercial applications, and to alter it and redistribute it 14 freely, subject to the following restrictions: 15 16 1. The origin of this software must not be misrepresented; you must not 17 claim that you wrote the original software. If you use this software 18 in a product, an acknowledgment in the product documentation would be 19 appreciated but is not required. 20 2. Altered source versions must be plainly marked as such, and must not be 21 misrepresented as being the original software. 22 3. This notice may not be removed or altered from any source distribution. 23 24 Jean-loup Gailly Mark Adler 25 jloup@gzip.org madler@alumni.caltech.edu 26 27 28 The data format used by the zlib library is described by RFCs (Request for 29 Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt 30 (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). 31*/ 32 33#ifndef _NET_ZLIB_H_ 34#define _NET_ZLIB_H_ 35 36#ifdef __NetBSD__ 37#include <sys/cdefs.h> 38#endif 39 40/* +++ zconf.h */ 41/* zconf.h -- configuration of the zlib compression library 42 * Copyright (C) 1995-2002 Jean-loup Gailly. 43 * For conditions of distribution and use, see copyright notice in zlib.h 44 */ 45 46/* @(#) $Id: zlib.h,v 1.15 2020/03/05 07:46:49 riastradh Exp $ */ 47 48#ifndef ZCONF_H 49#define ZCONF_H 50 51/* 52 * Warning: This file pollutes the user's namespace with: 53 * Byte Bytef EXPORT FAR OF STDC 54 * charf intf uInt uIntf uLong uLonf 55 * Programs using this library appear to expect those... 56 */ 57 58#include <sys/types.h> 59 60/* 61 * If you *really* need a unique prefix for all types and library functions, 62 * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. 63 */ 64#ifdef Z_PREFIX 65# define deflateInit_ z_deflateInit_ 66# define deflate z_deflate 67# define deflateEnd z_deflateEnd 68# define inflateInit_ z_inflateInit_ 69# define inflate z_inflate 70# define inflateEnd z_inflateEnd 71# define deflateInit2_ z_deflateInit2_ 72# define deflateSetDictionary z_deflateSetDictionary 73# define deflateCopy z_deflateCopy 74# define deflateReset z_deflateReset 75# define deflateParams z_deflateParams 76# define inflateInit2_ z_inflateInit2_ 77# define inflateSetDictionary z_inflateSetDictionary 78# define inflateSync z_inflateSync 79# define inflateSyncPoint z_inflateSyncPoint 80# define inflateReset z_inflateReset 81# define compress z_compress 82# define compress2 z_compress2 83# define uncompress z_uncompress 84# define adler32 z_adler32 85# define crc32 z_crc32 86# define get_crc_table z_get_crc_table 87 88# define Byte z_Byte 89# define uInt z_uInt 90# define uLong z_uLong 91# define Bytef z_Bytef 92# define charf z_charf 93# define intf z_intf 94# define uIntf z_uIntf 95# define uLongf z_uLongf 96# define voidpf z_voidpf 97# define voidp z_voidp 98#endif 99 100#ifndef __32BIT__ 101/* Don't be alarmed; this just means we have at least 32-bits */ 102# define __32BIT__ 103#endif 104 105/* 106 * Compile with -DMAXSEG_64K if the alloc function cannot allocate more 107 * than 64k bytes at a time (needed on systems with 16-bit int). 108 */ 109#if defined(MSDOS) && !defined(__32BIT__) 110# define MAXSEG_64K 111#endif 112 113#if 0 114/* XXX: Are there machines where we should define this? m68k? */ 115# define UNALIGNED_OK 116#endif 117 118#if (defined(__STDC__) || defined(__cplusplus)) && !defined(STDC) 119/* XXX: Look out - this is used in zutil.h and elsewhere... */ 120# define STDC 121#endif 122#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) 123# ifndef STDC 124# define STDC 125# endif 126#endif 127 128#ifndef STDC 129# ifndef const 130# define const 131# endif 132#endif 133 134/* Some Mac compilers merge all .h files incorrectly: */ 135#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) 136# define NO_DUMMY_DECL 137#endif 138#define NO_DUMMY_DECL 139 140/* Old Borland C incorrectly complains about missing returns: */ 141#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) 142# define NEED_DUMMY_RETURN 143#endif 144 145 146/* Maximum value for memLevel in deflateInit2 */ 147#ifndef MAX_MEM_LEVEL 148# ifdef MAXSEG_64K 149# define MAX_MEM_LEVEL 8 150# else 151# define MAX_MEM_LEVEL 9 152# endif 153#endif 154 155/* Maximum value for windowBits in deflateInit2 and inflateInit2. 156 * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files 157 * created by gzip. (Files created by minigzip can still be extracted by 158 * gzip.) 159 */ 160#ifndef MAX_WBITS 161# define MAX_WBITS 15 /* 32K LZ77 window */ 162#endif 163 164/* The memory requirements for deflate are (in bytes): 165 (1 << (windowBits+2)) + (1 << (memLevel+9)) 166 that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) 167 plus a few kilobytes for small objects. For example, if you want to reduce 168 the default memory requirements from 256K to 128K, compile with 169 make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" 170 Of course this will generally degrade compression (there's no free lunch). 171 172 The memory requirements for inflate are (in bytes) 1 << windowBits 173 that is, 32K for windowBits=15 (default value) plus a few kilobytes 174 for small objects. 175*/ 176 177 /* Type declarations */ 178 179#ifndef __P /* function prototypes */ 180# ifdef STDC 181# define __P(args) args 182# else 183# define __P(args) () 184# endif 185#endif 186 187/* The following definitions for FAR are needed only for MSDOS mixed 188 * model programming (small or medium model with some far allocations). 189 * This was tested only with MSC; for other MSDOS compilers you may have 190 * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, 191 * just define FAR to be empty. 192 */ 193#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) 194 /* MSC small or medium model */ 195# define SMALL_MEDIUM 196# ifdef _MSC_VER 197# define FAR _far 198# else 199# define FAR far 200# endif 201#endif 202#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) 203# ifndef __32BIT__ 204# define SMALL_MEDIUM 205# define FAR _far 206# endif 207#endif 208 209/* Compile with -DZLIB_DLL for Windows DLL support */ 210#if defined(ZLIB_DLL) 211# if defined(_WINDOWS) || defined(WINDOWS) 212# ifdef FAR 213# undef FAR 214# endif 215# include <windows.h> 216# define ZEXPORT WINAPI 217# ifdef WIN32 218# define ZEXPORTVA WINAPIV 219# else 220# define ZEXPORTVA FAR _cdecl _export 221# endif 222# endif 223# if defined (__BORLANDC__) 224# if (__BORLANDC__ >= 0x0500) && defined (WIN32) 225# include <windows.h> 226# define ZEXPORT __declspec(dllexport) WINAPI 227# define ZEXPORTRVA __declspec(dllexport) WINAPIV 228# else 229# if defined (_Windows) && defined (__DLL__) 230# define ZEXPORT _export 231# define ZEXPORTVA _export 232# endif 233# endif 234# endif 235#endif 236 237#if defined (__BEOS__) 238# if defined (ZLIB_DLL) 239# define ZEXTERN extern __declspec(dllexport) 240# else 241# define ZEXTERN extern __declspec(dllimport) 242# endif 243#endif 244 245#ifndef ZEXPORT 246# define ZEXPORT 247#endif 248#ifndef ZEXPORTVA 249# define ZEXPORTVA 250#endif 251#ifndef ZEXTERN 252# define ZEXTERN extern 253#endif 254 255#ifndef FAR 256# define FAR 257#endif 258 259#if !defined(MACOS) && !defined(TARGET_OS_MAC) 260typedef unsigned char Byte; /* 8 bits */ 261#endif 262typedef unsigned int uInt; /* 16 bits or more */ 263typedef unsigned long uLong; /* 32 bits or more */ 264 265#ifdef SMALL_MEDIUM 266 /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ 267# define Bytef Byte FAR 268#else 269 typedef Byte FAR Bytef; 270#endif 271typedef char FAR charf; 272typedef int FAR intf; 273typedef uInt FAR uIntf; 274typedef uLong FAR uLongf; 275 276#ifdef STDC 277 typedef void FAR *voidpf; 278 typedef void *voidp; 279#else 280 typedef Byte FAR *voidpf; 281 typedef Byte *voidp; 282#endif 283 284#if (defined(HAVE_UNISTD_H) || defined(__NetBSD__)) && !defined(_KERNEL) 285# include <sys/types.h> /* for off_t */ 286# include <unistd.h> /* for SEEK_* and off_t */ 287# define z_off_t off_t 288#endif 289#ifndef SEEK_SET 290# define SEEK_SET 0 /* Seek from beginning of file. */ 291# define SEEK_CUR 1 /* Seek from current position. */ 292# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ 293#endif 294#ifndef z_off_t 295# define z_off_t long 296#endif 297 298/* MVS linker does not support external names larger than 8 bytes */ 299#if defined(__MVS__) 300# pragma map(deflateInit_,"DEIN") 301# pragma map(deflateInit2_,"DEIN2") 302# pragma map(deflateEnd,"DEEND") 303# pragma map(inflateInit_,"ININ") 304# pragma map(inflateInit2_,"ININ2") 305# pragma map(inflateEnd,"INEND") 306# pragma map(inflateSync,"INSY") 307# pragma map(inflateSetDictionary,"INSEDI") 308# pragma map(inflate_blocks,"INBL") 309# pragma map(inflate_blocks_new,"INBLNE") 310# pragma map(inflate_blocks_free,"INBLFR") 311# pragma map(inflate_blocks_reset,"INBLRE") 312# pragma map(inflate_codes_free,"INCOFR") 313# pragma map(inflate_codes,"INCO") 314# pragma map(inflate_fast,"INFA") 315# pragma map(inflate_flush,"INFLU") 316# pragma map(inflate_mask,"INMA") 317# pragma map(inflate_set_dictionary,"INSEDI2") 318# pragma map(inflate_copyright,"INCOPY") 319# pragma map(inflate_trees_bits,"INTRBI") 320# pragma map(inflate_trees_dynamic,"INTRDY") 321# pragma map(inflate_trees_fixed,"INTRFI") 322# pragma map(inflate_trees_free,"INTRFR") 323#endif 324 325#endif /* !ZCONF_H */ 326/* --- zconf.h */ 327 328#ifndef ZLIB_H 329#define ZLIB_H 330#ifdef __cplusplus 331extern "C" { 332#endif 333 334#define ZLIB_VERSION "1.1.4" 335 336/* 337 The 'zlib' compression library provides in-memory compression and 338 decompression functions, including integrity checks of the uncompressed 339 data. This version of the library supports only one compression method 340 (deflation) but other algorithms will be added later and will have the same 341 stream interface. 342 343 Compression can be done in a single step if the buffers are large 344 enough (for example if an input file is mmap'ed), or can be done by 345 repeated calls of the compression function. In the latter case, the 346 application must provide more input and/or consume the output 347 (providing more output space) before each call. 348 349 The library also supports reading and writing files in gzip (.gz) format 350 with an interface similar to that of stdio. 351 352 The library does not install any signal handler. The decoder checks 353 the consistency of the compressed data, so the library should never 354 crash even in case of corrupted input. 355*/ 356 357typedef voidpf (*alloc_func)(voidpf, uInt, uInt); 358typedef void (*free_func)(voidpf, voidpf); 359 360struct internal_state; 361 362typedef struct z_stream_s { 363 Bytef *next_in; /* next input byte */ 364 uInt avail_in; /* number of bytes available at next_in */ 365 uLong total_in; /* total nb of input bytes read so far */ 366 367 Bytef *next_out; /* next output byte should be put there */ 368 uInt avail_out; /* remaining free space at next_out */ 369 uLong total_out; /* total nb of bytes output so far */ 370 371 const char *msg; /* last error message, NULL if no error */ 372 struct internal_state FAR *state; /* not visible by applications */ 373 374 alloc_func zalloc; /* used to allocate the internal state */ 375 free_func zfree; /* used to free the internal state */ 376 voidpf opaque; /* private data object passed to zalloc and zfree */ 377 378 int data_type; /* best guess about the data type: ascii or binary */ 379 uLong adler; /* adler32 value of the uncompressed data */ 380 uLong reserved; /* reserved for future use */ 381} z_stream; 382 383typedef z_stream FAR *z_streamp; 384 385/* 386 The application must update next_in and avail_in when avail_in has 387 dropped to zero. It must update next_out and avail_out when avail_out 388 has dropped to zero. The application must initialize zalloc, zfree and 389 opaque before calling the init function. All other fields are set by the 390 compression library and must not be updated by the application. 391 392 The opaque value provided by the application will be passed as the first 393 parameter for calls of zalloc and zfree. This can be useful for custom 394 memory management. The compression library attaches no meaning to the 395 opaque value. 396 397 zalloc must return Z_NULL if there is not enough memory for the object. 398 If zlib is used in a multi-threaded application, zalloc and zfree must be 399 thread safe. 400 401 On 16-bit systems, the functions zalloc and zfree must be able to allocate 402 exactly 65536 bytes, but will not be required to allocate more than this 403 if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, 404 pointers returned by zalloc for objects of exactly 65536 bytes *must* 405 have their offset normalized to zero. The default allocation function 406 provided by this library ensures this (see zutil.c). To reduce memory 407 requirements and avoid any allocation of 64K objects, at the expense of 408 compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). 409 410 The fields total_in and total_out can be used for statistics or 411 progress reports. After compression, total_in holds the total size of 412 the uncompressed data and may be saved for use in the decompressor 413 (particularly if the decompressor wants to decompress everything in 414 a single step). 415*/ 416 417 /* constants */ 418 419#define Z_NO_FLUSH 0 420#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ 421#define Z_PACKET_FLUSH 2 422#define Z_SYNC_FLUSH 3 423#define Z_FULL_FLUSH 4 424#define Z_FINISH 5 425/* Allowed flush values; see deflate() below for details */ 426 427#define Z_OK 0 428#define Z_STREAM_END 1 429#define Z_NEED_DICT 2 430#define Z_ERRNO (-1) 431#define Z_STREAM_ERROR (-2) 432#define Z_DATA_ERROR (-3) 433#define Z_MEM_ERROR (-4) 434#define Z_BUF_ERROR (-5) 435#define Z_VERSION_ERROR (-6) 436/* Return codes for the compression/decompression functions. Negative 437 * values are errors, positive values are used for special but normal events. 438 */ 439 440#define Z_NO_COMPRESSION 0 441#define Z_BEST_SPEED 1 442#define Z_BEST_COMPRESSION 9 443#define Z_DEFAULT_COMPRESSION (-1) 444/* compression levels */ 445 446#define Z_FILTERED 1 447#define Z_HUFFMAN_ONLY 2 448#define Z_DEFAULT_STRATEGY 0 449/* compression strategy; see deflateInit2() below for details */ 450 451#define Z_BINARY 0 452#define Z_ASCII 1 453#define Z_UNKNOWN 2 454/* Possible values of the data_type field */ 455 456#define Z_DEFLATED 8 457/* The deflate compression method (the only one supported in this version) */ 458 459#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ 460 461#define zlib_version zlibVersion() 462/* for compatibility with versions < 1.0.2 */ 463 464 /* basic functions */ 465 466ZEXTERN const char * ZEXPORT zlibVersion(void); 467/* The application can compare zlibVersion and ZLIB_VERSION for consistency. 468 If the first character differs, the library code actually used is 469 not compatible with the zlib.h header file used by the application. 470 This check is automatically made by deflateInit and inflateInit. 471 */ 472 473/* 474ZEXTERN int ZEXPORT deflateInit(z_streamp, int); 475 476 Initializes the internal stream state for compression. The fields 477 zalloc, zfree and opaque must be initialized before by the caller. 478 If zalloc and zfree are set to Z_NULL, deflateInit updates them to 479 use default allocation functions. 480 481 The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 482 1 gives best speed, 9 gives best compression, 0 gives no compression at 483 all (the input data is simply copied a block at a time). 484 Z_DEFAULT_COMPRESSION requests a default compromise between speed and 485 compression (currently equivalent to level 6). 486 487 deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not 488 enough memory, Z_STREAM_ERROR if level is not a valid compression level, 489 Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible 490 with the version assumed by the caller (ZLIB_VERSION). 491 msg is set to null if there is no error message. deflateInit does not 492 perform any compression: this will be done by deflate(). 493*/ 494 495 496ZEXTERN int ZEXPORT deflate(z_streamp, int); 497/* 498 deflate compresses as much data as possible, and stops when the input 499 buffer becomes empty or the output buffer becomes full. It may introduce some 500 output latency (reading input without producing any output) except when 501 forced to flush. 502 503 The detailed semantics are as follows. deflate performs one or both of the 504 following actions: 505 506 - Compress more input starting at next_in and update next_in and avail_in 507 accordingly. If not all input can be processed (because there is not 508 enough room in the output buffer), next_in and avail_in are updated and 509 processing will resume at this point for the next call of deflate(). 510 511 - Provide more output starting at next_out and update next_out and avail_out 512 accordingly. This action is forced if the parameter flush is non zero. 513 Forcing flush frequently degrades the compression ratio, so this parameter 514 should be set only when necessary (in interactive applications). 515 Some output may be provided even if flush is not set. 516 517 Before the call of deflate(), the application should ensure that at least 518 one of the actions is possible, by providing more input and/or consuming 519 more output, and updating avail_in or avail_out accordingly; avail_out 520 should never be zero before the call. The application can consume the 521 compressed output when it wants, for example when the output buffer is full 522 (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK 523 and with zero avail_out, it must be called again after making room in the 524 output buffer because there might be more output pending. 525 526 If the parameter flush is set to Z_SYNC_FLUSH, all pending output is 527 flushed to the output buffer and the output is aligned on a byte boundary, so 528 that the decompressor can get all input data available so far. (In particular 529 avail_in is zero after the call if enough output space has been provided 530 before the call.) Flushing may degrade compression for some compression 531 algorithms and so it should be used only when necessary. 532 533 If flush is set to Z_FULL_FLUSH, all output is flushed as with 534 Z_SYNC_FLUSH, and the compression state is reset so that decompression can 535 restart from this point if previous compressed data has been damaged or if 536 random access is desired. Using Z_FULL_FLUSH too often can seriously degrade 537 the compression. 538 539 If deflate returns with avail_out == 0, this function must be called again 540 with the same value of the flush parameter and more output space (updated 541 avail_out), until the flush is complete (deflate returns with non-zero 542 avail_out). 543 544 If the parameter flush is set to Z_PACKET_FLUSH, the compression 545 block is terminated, and a zero-length stored block is output, 546 omitting the length bytes (the effect of this is that the 3-bit type 547 code 000 for a stored block is output, and the output is then 548 byte-aligned). This is designed for use at the end of a PPP packet. 549 550 551 If the parameter flush is set to Z_FINISH, pending input is processed, 552 pending output is flushed and deflate returns with Z_STREAM_END if there 553 was enough output space; if deflate returns with Z_OK, this function must be 554 called again with Z_FINISH and more output space (updated avail_out) but no 555 more input data, until it returns with Z_STREAM_END or an error. After 556 deflate has returned Z_STREAM_END, the only possible operations on the 557 stream are deflateReset or deflateEnd. 558 559 Z_FINISH can be used immediately after deflateInit if all the compression 560 is to be done in a single step. In this case, avail_out must be at least 561 0.1% larger than avail_in plus 12 bytes. If deflate does not return 562 Z_STREAM_END, then it must be called again as described above. 563 564 deflate() sets strm->adler to the adler32 checksum of all input read 565 so far (that is, total_in bytes). 566 567 deflate() may update data_type if it can make a good guess about 568 the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered 569 binary. This field is only for information purposes and does not affect 570 the compression algorithm in any manner. 571 572 deflate() returns Z_OK if some progress has been made (more input 573 processed or more output produced), Z_STREAM_END if all input has been 574 consumed and all output has been produced (only when flush is set to 575 Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example 576 if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible 577 (for example avail_in or avail_out was zero). 578*/ 579 580 581ZEXTERN int ZEXPORT deflateEnd(z_streamp); 582/* 583 All dynamically allocated data structures for this stream are freed. 584 This function discards any unprocessed input and does not flush any 585 pending output. 586 587 deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the 588 stream state was inconsistent, Z_DATA_ERROR if the stream was freed 589 prematurely (some input or output was discarded). In the error case, 590 msg may be set but then points to a static string (which must not be 591 deallocated). 592*/ 593 594 595/* 596ZEXTERN int ZEXPORT inflateInit(z_streamp); 597 598 Initializes the internal stream state for decompression. The fields 599 next_in, avail_in, zalloc, zfree and opaque must be initialized before by 600 the caller. If next_in is not Z_NULL and avail_in is large enough (the exact 601 value depends on the compression method), inflateInit determines the 602 compression method from the zlib header and allocates all data structures 603 accordingly; otherwise the allocation will be deferred to the first call of 604 inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to 605 use default allocation functions. 606 607 inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough 608 memory, Z_VERSION_ERROR if the zlib library version is incompatible with the 609 version assumed by the caller. msg is set to null if there is no error 610 message. inflateInit does not perform any decompression apart from reading 611 the zlib header if present: this will be done by inflate(). (So next_in and 612 avail_in may be modified, but next_out and avail_out are unchanged.) 613*/ 614 615 616ZEXTERN int ZEXPORT inflate(z_streamp, int); 617/* 618 inflate decompresses as much data as possible, and stops when the input 619 buffer becomes empty or the output buffer becomes full. It may some 620 introduce some output latency (reading input without producing any output) 621 except when forced to flush. 622 623 The detailed semantics are as follows. inflate performs one or both of the 624 following actions: 625 626 - Decompress more input starting at next_in and update next_in and avail_in 627 accordingly. If not all input can be processed (because there is not 628 enough room in the output buffer), next_in is updated and processing 629 will resume at this point for the next call of inflate(). 630 631 - Provide more output starting at next_out and update next_out and avail_out 632 accordingly. inflate() provides as much output as possible, until there 633 is no more input data or no more space in the output buffer (see below 634 about the flush parameter). 635 636 Before the call of inflate(), the application should ensure that at least 637 one of the actions is possible, by providing more input and/or consuming 638 more output, and updating the next_* and avail_* values accordingly. 639 The application can consume the uncompressed output when it wants, for 640 example when the output buffer is full (avail_out == 0), or after each 641 call of inflate(). If inflate returns Z_OK and with zero avail_out, it 642 must be called again after making room in the output buffer because there 643 might be more output pending. 644 645 If the parameter flush is set to Z_SYNC_FLUSH or Z_PACKET_FLUSH, 646 inflate flushes as much output as possible to the output buffer. The 647 flushing behavior of inflate is not specified for values of the flush 648 parameter other than Z_SYNC_FLUSH, Z_PACKET_FLUSH or Z_FINISH, but the 649 current implementation actually flushes as much output as possible 650 anyway. For Z_PACKET_FLUSH, inflate checks that once all the input data 651 has been consumed, it is expecting to see the length field of a stored 652 block; if not, it returns Z_DATA_ERROR. 653 654 inflate() should normally be called until it returns Z_STREAM_END or an 655 error. However if all decompression is to be performed in a single step 656 (a single call of inflate), the parameter flush should be set to 657 Z_FINISH. In this case all pending input is processed and all pending 658 output is flushed; avail_out must be large enough to hold all the 659 uncompressed data. (The size of the uncompressed data may have been saved 660 by the compressor for this purpose.) The next operation on this stream must 661 be inflateEnd to deallocate the decompression state. The use of Z_FINISH 662 is never required, but can be used to inform inflate that a faster routine 663 may be used for the single inflate() call. 664 665 If a preset dictionary is needed at this point (see inflateSetDictionary 666 below), inflate sets strm-adler to the adler32 checksum of the 667 dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise 668 it sets strm->adler to the adler32 checksum of all output produced 669 so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or 670 an error code as described below. At the end of the stream, inflate() 671 checks that its computed adler32 checksum is equal to that saved by the 672 compressor and returns Z_STREAM_END only if the checksum is correct. 673 674 inflate() returns Z_OK if some progress has been made (more input processed 675 or more output produced), Z_STREAM_END if the end of the compressed data has 676 been reached and all uncompressed output has been produced, Z_NEED_DICT if a 677 preset dictionary is needed at this point, Z_DATA_ERROR if the input data was 678 corrupted (input stream not conforming to the zlib format or incorrect 679 adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent 680 (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not 681 enough memory, Z_BUF_ERROR if no progress is possible or if there was not 682 enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR 683 case, the application may then call inflateSync to look for a good 684 compression block. 685*/ 686 687 688ZEXTERN int ZEXPORT inflateEnd(z_streamp); 689/* 690 All dynamically allocated data structures for this stream are freed. 691 This function discards any unprocessed input and does not flush any 692 pending output. 693 694 inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state 695 was inconsistent. In the error case, msg may be set but then points to a 696 static string (which must not be deallocated). 697*/ 698 699 /* Advanced functions */ 700 701/* 702 The following functions are needed only in some special applications. 703*/ 704 705/* 706ZEXTERN int ZEXPORT deflateInit2(z_streamp, int, int, int, int, int); 707 708 This is another version of deflateInit with more compression options. The 709 fields next_in, zalloc, zfree and opaque must be initialized before by 710 the caller. 711 712 The method parameter is the compression method. It must be Z_DEFLATED in 713 this version of the library. 714 715 The windowBits parameter is the base two logarithm of the window size 716 (the size of the history buffer). It should be in the range 8..15 for this 717 version of the library. Larger values of this parameter result in better 718 compression at the expense of memory usage. The default value is 15 if 719 deflateInit is used instead. 720 721 The memLevel parameter specifies how much memory should be allocated 722 for the internal compression state. memLevel=1 uses minimum memory but 723 is slow and reduces compression ratio; memLevel=9 uses maximum memory 724 for optimal speed. The default value is 8. See zconf.h for total memory 725 usage as a function of windowBits and memLevel. 726 727 The strategy parameter is used to tune the compression algorithm. Use the 728 value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a 729 filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no 730 string match). Filtered data consists mostly of small values with a 731 somewhat random distribution. In this case, the compression algorithm is 732 tuned to compress them better. The effect of Z_FILTERED is to force more 733 Huffman coding and less string matching; it is somewhat intermediate 734 between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects 735 the compression ratio but not the correctness of the compressed output even 736 if it is not set appropriately. 737 738 deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 739 memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid 740 method). msg is set to null if there is no error message. deflateInit2 does 741 not perform any compression: this will be done by deflate(). 742*/ 743 744ZEXTERN int ZEXPORT deflateSetDictionary(z_streamp, const Bytef *, uInt); 745/* 746 Initializes the compression dictionary from the given byte sequence 747 without producing any compressed output. This function must be called 748 immediately after deflateInit, deflateInit2 or deflateReset, before any 749 call of deflate. The compressor and decompressor must use exactly the same 750 dictionary (see inflateSetDictionary). 751 752 The dictionary should consist of strings (byte sequences) that are likely 753 to be encountered later in the data to be compressed, with the most commonly 754 used strings preferably put towards the end of the dictionary. Using a 755 dictionary is most useful when the data to be compressed is short and can be 756 predicted with good accuracy; the data can then be compressed better than 757 with the default empty dictionary. 758 759 Depending on the size of the compression data structures selected by 760 deflateInit or deflateInit2, a part of the dictionary may in effect be 761 discarded, for example if the dictionary is larger than the window size in 762 deflate or deflate2. Thus the strings most likely to be useful should be 763 put at the end of the dictionary, not at the front. 764 765 Upon return of this function, strm->adler is set to the Adler32 value 766 of the dictionary; the decompressor may later use this value to determine 767 which dictionary has been used by the compressor. (The Adler32 value 768 applies to the whole dictionary even if only a subset of the dictionary is 769 actually used by the compressor.) 770 771 deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a 772 parameter is invalid (such as NULL dictionary) or the stream state is 773 inconsistent (for example if deflate has already been called for this stream 774 or if the compression method is bsort). deflateSetDictionary does not 775 perform any compression: this will be done by deflate(). 776*/ 777 778ZEXTERN int ZEXPORT deflateCopy(z_streamp, z_streamp); 779/* 780 Sets the destination stream as a complete copy of the source stream. 781 782 This function can be useful when several compression strategies will be 783 tried, for example when there are several ways of pre-processing the input 784 data with a filter. The streams that will be discarded should then be freed 785 by calling deflateEnd. Note that deflateCopy duplicates the internal 786 compression state which can be quite large, so this strategy is slow and 787 can consume lots of memory. 788 789 deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not 790 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent 791 (such as zalloc being NULL). msg is left unchanged in both source and 792 destination. 793*/ 794 795extern int inflateIncomp(z_stream *); 796/* 797 This function adds the data at next_in (avail_in bytes) to the output 798 history without performing any output. There must be no pending output, 799 and the decompressor must be expecting to see the start of a block. 800 Calling this function is equivalent to decompressing a stored block 801 containing the data at next_in (except that the data is not output). 802*/ 803 804ZEXTERN int ZEXPORT deflateReset(z_streamp); 805/* 806 This function is equivalent to deflateEnd followed by deflateInit, 807 but does not free and reallocate all the internal compression state. 808 The stream will keep the same compression level and any other attributes 809 that may have been set by deflateInit2. 810 811 deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source 812 stream state was inconsistent (such as zalloc or state being NULL). 813*/ 814 815ZEXTERN int ZEXPORT deflateParams(z_streamp, int, int); 816/* 817 Dynamically update the compression level and compression strategy. The 818 interpretation of level and strategy is as in deflateInit2. This can be 819 used to switch between compression and straight copy of the input data, or 820 to switch to a different kind of input data requiring a different 821 strategy. If the compression level is changed, the input available so far 822 is compressed with the old level (and may be flushed); the new level will 823 take effect only at the next call of deflate(). 824 825 Before the call of deflateParams, the stream state must be set as for 826 a call of deflate(), since the currently available input may have to 827 be compressed and flushed. In particular, strm->avail_out must be non-zero. 828 829 deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source 830 stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR 831 if strm->avail_out was zero. 832*/ 833 834ZEXTERN int ZEXPORT deflateOutputPending(z_streamp); 835/* 836 Returns the number of bytes of output which are immediately 837 available from the compressor (i.e. without any further input 838 or flush). 839*/ 840 841/* 842ZEXTERN int ZEXPORT inflateInit2(z_streamp, int); 843 844 This is another version of inflateInit with an extra parameter. The 845 fields next_in, avail_in, zalloc, zfree and opaque must be initialized 846 before by the caller. 847 848 The windowBits parameter is the base two logarithm of the maximum window 849 size (the size of the history buffer). It should be in the range 8..15 for 850 this version of the library. The default value is 15 if inflateInit is used 851 instead. If a compressed stream with a larger window size is given as 852 input, inflate() will return with the error code Z_DATA_ERROR instead of 853 trying to allocate a larger window. 854 855 inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 856 memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative 857 memLevel). msg is set to null if there is no error message. inflateInit2 858 does not perform any decompression apart from reading the zlib header if 859 present: this will be done by inflate(). (So next_in and avail_in may be 860 modified, but next_out and avail_out are unchanged.) 861*/ 862 863ZEXTERN int ZEXPORT inflateSetDictionary(z_streamp, const Bytef *, uInt); 864/* 865 Initializes the decompression dictionary from the given uncompressed byte 866 sequence. This function must be called immediately after a call of inflate 867 if this call returned Z_NEED_DICT. The dictionary chosen by the compressor 868 can be determined from the Adler32 value returned by this call of 869 inflate. The compressor and decompressor must use exactly the same 870 dictionary (see deflateSetDictionary). 871 872 inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a 873 parameter is invalid (such as NULL dictionary) or the stream state is 874 inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the 875 expected one (incorrect Adler32 value). inflateSetDictionary does not 876 perform any decompression: this will be done by subsequent calls of 877 inflate(). 878*/ 879 880ZEXTERN int ZEXPORT inflateSync(z_streamp); 881/* 882 Skips invalid compressed data until a full flush point (see above the 883 description of deflate with Z_FULL_FLUSH) can be found, or until all 884 available input is skipped. No output is provided. 885 886 inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR 887 if no more input was provided, Z_DATA_ERROR if no flush point has been found, 888 or Z_STREAM_ERROR if the stream structure was inconsistent. In the success 889 case, the application may save the current current value of total_in which 890 indicates where valid compressed data was found. In the error case, the 891 application may repeatedly call inflateSync, providing more input each time, 892 until success or end of the input data. 893*/ 894 895ZEXTERN int ZEXPORT inflateReset(z_streamp); 896/* 897 This function is equivalent to inflateEnd followed by inflateInit, 898 but does not free and reallocate all the internal decompression state. 899 The stream will keep attributes that may have been set by inflateInit2. 900 901 inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source 902 stream state was inconsistent (such as zalloc or state being NULL). 903*/ 904 905 906 /* utility functions */ 907 908/* 909 The following utility functions are implemented on top of the 910 basic stream-oriented functions. To simplify the interface, some 911 default options are assumed (compression level and memory usage, 912 standard memory allocation functions). The source code of these 913 utility functions can easily be modified if you need special options. 914*/ 915 916ZEXTERN int ZEXPORT compress(Bytef *, uLongf *, const Bytef *, uLong); 917/* 918 Compresses the source buffer into the destination buffer. sourceLen is 919 the byte length of the source buffer. Upon entry, destLen is the total 920 size of the destination buffer, which must be at least 0.1% larger than 921 sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the 922 compressed buffer. 923 This function can be used to compress a whole file at once if the 924 input file is mmap'ed. 925 compress returns Z_OK if success, Z_MEM_ERROR if there was not 926 enough memory, Z_BUF_ERROR if there was not enough room in the output 927 buffer. 928*/ 929 930ZEXTERN int ZEXPORT compress2(Bytef *, uLongf *, const Bytef *, 931 uLong, int); 932/* 933 Compresses the source buffer into the destination buffer. The level 934 parameter has the same meaning as in deflateInit. sourceLen is the byte 935 length of the source buffer. Upon entry, destLen is the total size of the 936 destination buffer, which must be at least 0.1% larger than sourceLen plus 937 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. 938 939 compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 940 memory, Z_BUF_ERROR if there was not enough room in the output buffer, 941 Z_STREAM_ERROR if the level parameter is invalid. 942*/ 943 944ZEXTERN int ZEXPORT uncompress(Bytef *, uLongf *, const Bytef *, uLong); 945/* 946 Decompresses the source buffer into the destination buffer. sourceLen is 947 the byte length of the source buffer. Upon entry, destLen is the total 948 size of the destination buffer, which must be large enough to hold the 949 entire uncompressed data. (The size of the uncompressed data must have 950 been saved previously by the compressor and transmitted to the decompressor 951 by some mechanism outside the scope of this compression library.) 952 Upon exit, destLen is the actual size of the compressed buffer. 953 This function can be used to decompress a whole file at once if the 954 input file is mmap'ed. 955 956 uncompress returns Z_OK if success, Z_MEM_ERROR if there was not 957 enough memory, Z_BUF_ERROR if there was not enough room in the output 958 buffer, or Z_DATA_ERROR if the input data was corrupted. 959*/ 960 961 962typedef voidp gzFile; 963 964ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *); 965/* 966 Opens a gzip (.gz) file for reading or writing. The mode parameter 967 is as in fopen ("rb" or "wb") but can also include a compression level 968 ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for 969 Huffman only compression as in "wb1h". (See the description 970 of deflateInit2 for more information about the strategy parameter.) 971 972 gzopen can be used to read a file which is not in gzip format; in this 973 case gzread will directly read from the file without decompression. 974 975 gzopen returns NULL if the file could not be opened or if there was 976 insufficient memory to allocate the (de)compression state; errno 977 can be checked to distinguish the two cases (if errno is zero, the 978 zlib error is Z_MEM_ERROR). */ 979 980ZEXTERN gzFile ZEXPORT gzdopen(int, const char *); 981/* 982 gzdopen() associates a gzFile with the file descriptor fd. File 983 descriptors are obtained from calls like open, dup, creat, pipe or 984 fileno (in the file has been previously opened with fopen). 985 The mode parameter is as in gzopen. 986 The next call of gzclose on the returned gzFile will also close the 987 file descriptor fd, just like fclose(fdopen(fd), mode) closes the file 988 descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). 989 gzdopen returns NULL if there was insufficient memory to allocate 990 the (de)compression state. 991*/ 992 993ZEXTERN int ZEXPORT gzsetparams(gzFile, int, int); 994/* 995 Dynamically update the compression level or strategy. See the description 996 of deflateInit2 for the meaning of these parameters. 997 gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not 998 opened for writing. 999*/ 1000 1001ZEXTERN int ZEXPORT gzread(gzFile, voidp, unsigned); 1002/* 1003 Reads the given number of uncompressed bytes from the compressed file. 1004 If the input file was not in gzip format, gzread copies the given number 1005 of bytes into the buffer. 1006 gzread returns the number of uncompressed bytes actually read (0 for 1007 end of file, -1 for error). */ 1008 1009ZEXTERN int ZEXPORT gzwrite(gzFile, const voidp, unsigned); 1010/* 1011 Writes the given number of uncompressed bytes into the compressed file. 1012 gzwrite returns the number of uncompressed bytes actually written 1013 (0 in case of error). 1014*/ 1015 1016ZEXTERN int ZEXPORTVA gzprintf(gzFile, const char *, ...) 1017 __attribute__((__format__(__printf__, 2, 3))); 1018/* 1019 Converts, formats, and writes the args to the compressed file under 1020 control of the format string, as in fprintf. gzprintf returns the number of 1021 uncompressed bytes actually written (0 in case of error). 1022*/ 1023 1024ZEXTERN int ZEXPORT gzputs(gzFile, const char *); 1025/* 1026 Writes the given null-terminated string to the compressed file, excluding 1027 the terminating null character. 1028 gzputs returns the number of characters written, or -1 in case of error. 1029*/ 1030 1031ZEXTERN char * ZEXPORT gzgets(gzFile, char *, int); 1032/* 1033 Reads bytes from the compressed file until len-1 characters are read, or 1034 a newline character is read and transferred to buf, or an end-of-file 1035 condition is encountered. The string is then terminated with a null 1036 character. 1037 gzgets returns buf, or Z_NULL in case of error. 1038*/ 1039 1040ZEXTERN int ZEXPORT gzputc(gzFile, int); 1041/* 1042 Writes c, converted to an unsigned char, into the compressed file. 1043 gzputc returns the value that was written, or -1 in case of error. 1044*/ 1045 1046ZEXTERN int ZEXPORT gzgetc(gzFile); 1047/* 1048 Reads one byte from the compressed file. gzgetc returns this byte 1049 or -1 in case of end of file or error. 1050*/ 1051 1052ZEXTERN int ZEXPORT gzflush(gzFile, int); 1053/* 1054 Flushes all pending output into the compressed file. The parameter 1055 flush is as in the deflate() function. The return value is the zlib 1056 error number (see function gzerror below). gzflush returns Z_OK if 1057 the flush parameter is Z_FINISH and all output could be flushed. 1058 gzflush should be called only when strictly necessary because it can 1059 degrade compression. 1060 1061*/ 1062 1063/* 1064 * NetBSD note: 1065 * "long" gzseek has been there till Oct 1999 (1.4L), which was wrong. 1066 */ 1067ZEXTERN z_off_t ZEXPORT gzseek(gzFile, z_off_t, int); 1068/* 1069 Sets the starting position for the next gzread or gzwrite on the 1070 given compressed file. The offset represents a number of bytes in the 1071 uncompressed data stream. The whence parameter is defined as in lseek(2); 1072 the value SEEK_END is not supported. 1073 If the file is opened for reading, this function is emulated but can be 1074 extremely slow. If the file is opened for writing, only forward seeks are 1075 supported; gzseek then compresses a sequence of zeroes up to the new 1076 starting position. 1077 1078 gzseek returns the resulting offset location as measured in bytes from 1079 the beginning of the uncompressed stream, or -1 in case of error, in 1080 particular if the file is opened for writing and the new starting position 1081 would be before the current position. 1082*/ 1083 1084ZEXTERN int ZEXPORT gzrewind(gzFile); 1085/* 1086 Rewinds the given file. This function is supported only for reading. 1087 1088 gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) 1089*/ 1090 1091/* 1092 * NetBSD note: 1093 * "long" gztell has been there till Oct 1999 (1.4L), which was wrong. 1094 */ 1095ZEXTERN z_off_t ZEXPORT gztell(gzFile); 1096/* 1097 Returns the starting position for the next gzread or gzwrite on the 1098 given compressed file. This position represents a number of bytes in the 1099 uncompressed data stream. 1100 1101 gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) 1102*/ 1103 1104ZEXTERN int ZEXPORT gzeof(gzFile); 1105/* 1106 Returns 1 when EOF has previously been detected reading the given 1107 input stream, otherwise zero. 1108*/ 1109 1110ZEXTERN int ZEXPORT gzclose(gzFile); 1111/* 1112 Flushes all pending output if necessary, closes the compressed file 1113 and deallocates all the (de)compression state. The return value is the zlib 1114 error number (see function gzerror below). 1115*/ 1116 1117ZEXTERN const char * ZEXPORT gzerror(gzFile, int *); 1118/* 1119 Returns the error message for the last error which occurred on the 1120 given compressed file. errnum is set to zlib error number. If an 1121 error occurred in the file system and not in the compression library, 1122 errnum is set to Z_ERRNO and the application may consult errno 1123 to get the exact error code. 1124*/ 1125 1126 /* checksum functions */ 1127 1128/* 1129 These functions are not related to compression but are exported 1130 anyway because they might be useful in applications using the 1131 compression library. 1132*/ 1133 1134ZEXTERN uLong ZEXPORT adler32(uLong, const Bytef *, uInt); 1135 1136/* 1137 Update a running Adler-32 checksum with the bytes buf[0..len-1] and 1138 return the updated checksum. If buf is NULL, this function returns 1139 the required initial value for the checksum. 1140 An Adler-32 checksum is almost as reliable as a CRC32 but can be computed 1141 much faster. Usage example: 1142 1143 uLong adler = adler32(0L, Z_NULL, 0); 1144 1145 while (read_buffer(buffer, length) != EOF) { 1146 adler = adler32(adler, buffer, length); 1147 } 1148 if (adler != original_adler) error(); 1149*/ 1150 1151#ifdef STANDALONE 1152ZEXTERN uLong ZEXPORT crc32(uLong, const Bytef *, uInt); 1153#endif 1154/* 1155 Update a running crc with the bytes buf[0..len-1] and return the updated 1156 crc. If buf is NULL, this function returns the required initial value 1157 for the crc. Pre- and post-conditioning (one's complement) is performed 1158 within this function so it shouldn't be done by the application. 1159 Usage example: 1160 1161 uLong crc = crc32(0L, Z_NULL, 0); 1162 1163 while (read_buffer(buffer, length) != EOF) { 1164 crc = crc32(crc, buffer, length); 1165 } 1166 if (crc != original_crc) error(); 1167*/ 1168 1169 1170 /* various hacks, don't look :) */ 1171 1172/* deflateInit and inflateInit are macros to allow checking the zlib version 1173 * and the compiler's view of z_stream: 1174 */ 1175ZEXTERN int ZEXPORT deflateInit_(z_streamp, int, const char *, int); 1176ZEXTERN int ZEXPORT inflateInit_(z_streamp, const char *, int); 1177ZEXTERN int ZEXPORT deflateInit2_(z_streamp, int, int, int, int, 1178 int, const char *, int); 1179ZEXTERN int ZEXPORT inflateInit2_(z_streamp, int, const char *, int); 1180#define deflateInit(strm, level) \ 1181 deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) 1182#define inflateInit(strm) \ 1183 inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) 1184#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ 1185 deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ 1186 (strategy), ZLIB_VERSION, sizeof(z_stream)) 1187#define inflateInit2(strm, windowBits) \ 1188 inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) 1189 1190 1191#if !defined(Z_UTIL_H) && !defined(NO_DUMMY_DECL) 1192 struct internal_state {int dummy;}; /* hack for buggy compilers */ 1193#endif 1194 1195ZEXTERN const char * ZEXPORT zError(int); 1196ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp); 1197ZEXTERN const uLongf * ZEXPORT get_crc_table(void); 1198 1199#ifdef __cplusplus 1200} 1201#endif 1202#endif /* !ZLIB_H */ 1203 1204#endif /* !_NET_ZLIB_H_ */ 1205/* -- zlib.h */ 1206