Annotation of XNU/bsd/net/zlib.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * The contents of this file constitute Original Code as defined in and
        !             7:  * are subject to the Apple Public Source License Version 1.1 (the
        !             8:  * "License").  You may not use this file except in compliance with the
        !             9:  * License.  Please obtain a copy of the License at
        !            10:  * http://www.apple.com/publicsource and read it before using this file.
        !            11:  * 
        !            12:  * This Original Code and all software distributed under the License are
        !            13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            17:  * License for the specific language governing rights and limitations
        !            18:  * under the License.
        !            19:  * 
        !            20:  * @APPLE_LICENSE_HEADER_END@
        !            21:  */
        !            22: /*
        !            23:  * This file is derived from zlib.h and zconf.h from the zlib-1.0.4
        !            24:  * distribution by Jean-loup Gailly and Mark Adler, with some additions
        !            25:  * by Paul Mackerras to aid in implementing Deflate compression and
        !            26:  * decompression for PPP packets.
        !            27:  */
        !            28: 
        !            29: /*
        !            30:  *  ==FILEVERSION 971127==
        !            31:  *
        !            32:  * This marker is used by the Linux installation script to determine
        !            33:  * whether an up-to-date version of this file is already installed.
        !            34:  */
        !            35: 
        !            36: 
        !            37: /* +++ zlib.h */
        !            38: /* zlib.h -- interface of the 'zlib' general purpose compression library
        !            39:   version 1.0.4, Jul 24th, 1996.
        !            40: 
        !            41:   Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler
        !            42: 
        !            43:   This software is provided 'as-is', without any express or implied
        !            44:   warranty.  In no event will the authors be held liable for any damages
        !            45:   arising from the use of this software.
        !            46: 
        !            47:   Permission is granted to anyone to use this software for any purpose,
        !            48:   including commercial applications, and to alter it and redistribute it
        !            49:   freely, subject to the following restrictions:
        !            50: 
        !            51:   1. The origin of this software must not be misrepresented; you must not
        !            52:      claim that you wrote the original software. If you use this software
        !            53:      in a product, an acknowledgment in the product documentation would be
        !            54:      appreciated but is not required.
        !            55:   2. Altered source versions must be plainly marked as such, and must not be
        !            56:      misrepresented as being the original software.
        !            57:   3. This notice may not be removed or altered from any source distribution.
        !            58: 
        !            59:   Jean-loup Gailly        Mark Adler
        !            60:   [email protected]    [email protected]
        !            61: 
        !            62: 
        !            63:   The data format used by the zlib library is described by RFCs (Request for
        !            64:   Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
        !            65:   (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
        !            66: */
        !            67: 
        !            68: #ifndef _ZLIB_H
        !            69: #define _ZLIB_H
        !            70: 
        !            71: #ifdef __cplusplus
        !            72: extern "C" {
        !            73: #endif
        !            74: 
        !            75: 
        !            76: /* +++ zconf.h */
        !            77: /* zconf.h -- configuration of the zlib compression library
        !            78:  * Copyright (C) 1995-1996 Jean-loup Gailly.
        !            79:  * For conditions of distribution and use, see copyright notice in zlib.h 
        !            80:  */
        !            81: 
        !            82: /* From: zconf.h,v 1.20 1996/07/02 15:09:28 me Exp $ */
        !            83: 
        !            84: #ifndef _ZCONF_H
        !            85: #define _ZCONF_H
        !            86: 
        !            87: /*
        !            88:  * If you *really* need a unique prefix for all types and library functions,
        !            89:  * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
        !            90:  */
        !            91: #ifdef Z_PREFIX
        !            92: #  define deflateInit_ z_deflateInit_
        !            93: #  define deflate      z_deflate
        !            94: #  define deflateEnd   z_deflateEnd
        !            95: #  define inflateInit_         z_inflateInit_
        !            96: #  define inflate      z_inflate
        !            97: #  define inflateEnd   z_inflateEnd
        !            98: #  define deflateInit2_        z_deflateInit2_
        !            99: #  define deflateSetDictionary z_deflateSetDictionary
        !           100: #  define deflateCopy  z_deflateCopy
        !           101: #  define deflateReset z_deflateReset
        !           102: #  define deflateParams        z_deflateParams
        !           103: #  define inflateInit2_        z_inflateInit2_
        !           104: #  define inflateSetDictionary z_inflateSetDictionary
        !           105: #  define inflateSync  z_inflateSync
        !           106: #  define inflateReset z_inflateReset
        !           107: #  define compress     z_compress
        !           108: #  define uncompress   z_uncompress
        !           109: #  define adler32      z_adler32
        !           110: #  define crc32                z_crc32
        !           111: #  define get_crc_table z_get_crc_table
        !           112: 
        !           113: #  define Byte         z_Byte
        !           114: #  define uInt         z_uInt
        !           115: #  define uLong                z_uLong
        !           116: #  define Bytef                z_Bytef
        !           117: #  define charf                z_charf
        !           118: #  define intf         z_intf
        !           119: #  define uIntf                z_uIntf
        !           120: #  define uLongf       z_uLongf
        !           121: #  define voidpf       z_voidpf
        !           122: #  define voidp                z_voidp
        !           123: #endif
        !           124: 
        !           125: #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
        !           126: #  define WIN32
        !           127: #endif
        !           128: #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
        !           129: #  ifndef __32BIT__
        !           130: #    define __32BIT__
        !           131: #  endif
        !           132: #endif
        !           133: #if defined(__MSDOS__) && !defined(MSDOS)
        !           134: #  define MSDOS
        !           135: #endif
        !           136: 
        !           137: /*
        !           138:  * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
        !           139:  * than 64k bytes at a time (needed on systems with 16-bit int).
        !           140:  */
        !           141: #if defined(MSDOS) && !defined(__32BIT__)
        !           142: #  define MAXSEG_64K
        !           143: #endif
        !           144: #ifdef MSDOS
        !           145: #  define UNALIGNED_OK
        !           146: #endif
        !           147: 
        !           148: #if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32))  && !defined(STDC)
        !           149: #  define STDC
        !           150: #endif
        !           151: #if (defined(__STDC__) || defined(__cplusplus)) && !defined(STDC)
        !           152: #  define STDC
        !           153: #endif
        !           154: 
        !           155: #ifndef STDC
        !           156: #  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
        !           157: #    define const
        !           158: #  endif
        !           159: #endif
        !           160: 
        !           161: /* Some Mac compilers merge all .h files incorrectly: */
        !           162: #if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
        !           163: #  define NO_DUMMY_DECL
        !           164: #endif
        !           165: 
        !           166: /* Maximum value for memLevel in deflateInit2 */
        !           167: #ifndef MAX_MEM_LEVEL
        !           168: #  ifdef MAXSEG_64K
        !           169: #    define MAX_MEM_LEVEL 8
        !           170: #  else
        !           171: #    define MAX_MEM_LEVEL 9
        !           172: #  endif
        !           173: #endif
        !           174: 
        !           175: /* Maximum value for windowBits in deflateInit2 and inflateInit2 */
        !           176: #ifndef MAX_WBITS
        !           177: #  define MAX_WBITS   15 /* 32K LZ77 window */
        !           178: #endif
        !           179: 
        !           180: /* The memory requirements for deflate are (in bytes):
        !           181:             1 << (windowBits+2)   +  1 << (memLevel+9)
        !           182:  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
        !           183:  plus a few kilobytes for small objects. For example, if you want to reduce
        !           184:  the default memory requirements from 256K to 128K, compile with
        !           185:      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
        !           186:  Of course this will generally degrade compression (there's no free lunch).
        !           187: 
        !           188:    The memory requirements for inflate are (in bytes) 1 << windowBits
        !           189:  that is, 32K for windowBits=15 (default value) plus a few kilobytes
        !           190:  for small objects.
        !           191: */
        !           192: 
        !           193:                         /* Type declarations */
        !           194: 
        !           195: #ifndef OF /* function prototypes */
        !           196: #  ifdef STDC
        !           197: #    define OF(args)  args
        !           198: #  else
        !           199: #    define OF(args)  ()
        !           200: #  endif
        !           201: #endif
        !           202: 
        !           203: /* The following definitions for FAR are needed only for MSDOS mixed
        !           204:  * model programming (small or medium model with some far allocations).
        !           205:  * This was tested only with MSC; for other MSDOS compilers you may have
        !           206:  * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
        !           207:  * just define FAR to be empty.
        !           208:  */
        !           209: #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
        !           210:    /* MSC small or medium model */
        !           211: #  define SMALL_MEDIUM
        !           212: #  ifdef _MSC_VER
        !           213: #    define FAR __far
        !           214: #  else
        !           215: #    define FAR far
        !           216: #  endif
        !           217: #endif
        !           218: #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
        !           219: #  ifndef __32BIT__
        !           220: #    define SMALL_MEDIUM
        !           221: #    define FAR __far
        !           222: #  endif
        !           223: #endif
        !           224: #ifndef FAR
        !           225: #   define FAR
        !           226: #endif
        !           227: 
        !           228: typedef unsigned char  Byte;  /* 8 bits */
        !           229: typedef unsigned int   uInt;  /* 16 bits or more */
        !           230: typedef unsigned long  uLong; /* 32 bits or more */
        !           231: 
        !           232: #if defined(__BORLANDC__) && defined(SMALL_MEDIUM)
        !           233:    /* Borland C/C++ ignores FAR inside typedef */
        !           234: #  define Bytef Byte FAR
        !           235: #else
        !           236:    typedef Byte  FAR Bytef;
        !           237: #endif
        !           238: typedef char  FAR charf;
        !           239: typedef int   FAR intf;
        !           240: typedef uInt  FAR uIntf;
        !           241: typedef uLong FAR uLongf;
        !           242: 
        !           243: #if STDC
        !           244:    typedef void FAR *voidpf;
        !           245:    typedef void     *voidp;
        !           246: #else
        !           247:    typedef Byte FAR *voidpf;
        !           248:    typedef Byte     *voidp;
        !           249: #endif
        !           250: 
        !           251: 
        !           252: /* Compile with -DZLIB_DLL for Windows DLL support */
        !           253: #if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL)
        !           254: #  include <windows.h>
        !           255: #  define EXPORT  WINAPI
        !           256: #else
        !           257: #  define EXPORT
        !           258: #endif
        !           259: 
        !           260: #endif /* _ZCONF_H */
        !           261: /* --- zconf.h */
        !           262: 
        !           263: #define ZLIB_VERSION "1.0.4P"
        !           264: 
        !           265: /* 
        !           266:      The 'zlib' compression library provides in-memory compression and
        !           267:   decompression functions, including integrity checks of the uncompressed
        !           268:   data.  This version of the library supports only one compression method
        !           269:   (deflation) but other algorithms may be added later and will have the same
        !           270:   stream interface.
        !           271: 
        !           272:      For compression the application must provide the output buffer and
        !           273:   may optionally provide the input buffer for optimization. For decompression,
        !           274:   the application must provide the input buffer and may optionally provide
        !           275:   the output buffer for optimization.
        !           276: 
        !           277:      Compression can be done in a single step if the buffers are large
        !           278:   enough (for example if an input file is mmap'ed), or can be done by
        !           279:   repeated calls of the compression function.  In the latter case, the
        !           280:   application must provide more input and/or consume the output
        !           281:   (providing more output space) before each call.
        !           282: 
        !           283:      The library does not install any signal handler. It is recommended to
        !           284:   add at least a handler for SIGSEGV when decompressing; the library checks
        !           285:   the consistency of the input data whenever possible but may go nuts
        !           286:   for some forms of corrupted input.
        !           287: */
        !           288: 
        !           289: typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
        !           290: typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
        !           291: 
        !           292: struct internal_state;
        !           293: 
        !           294: typedef struct z_stream_s {
        !           295:     Bytef    *next_in;  /* next input byte */
        !           296:     uInt     avail_in;  /* number of bytes available at next_in */
        !           297:     uLong    total_in;  /* total nb of input bytes read so far */
        !           298: 
        !           299:     Bytef    *next_out; /* next output byte should be put there */
        !           300:     uInt     avail_out; /* remaining free space at next_out */
        !           301:     uLong    total_out; /* total nb of bytes output so far */
        !           302: 
        !           303:     char     *msg;      /* last error message, NULL if no error */
        !           304:     struct internal_state FAR *state; /* not visible by applications */
        !           305: 
        !           306:     alloc_func zalloc;  /* used to allocate the internal state */
        !           307:     free_func  zfree;   /* used to free the internal state */
        !           308:     voidpf     opaque;  /* private data object passed to zalloc and zfree */
        !           309: 
        !           310:     int     data_type;  /* best guess about the data type: ascii or binary */
        !           311:     uLong   adler;      /* adler32 value of the uncompressed data */
        !           312:     uLong   reserved;   /* reserved for future use */
        !           313: } z_stream;
        !           314: 
        !           315: typedef z_stream FAR *z_streamp;
        !           316: 
        !           317: /*
        !           318:    The application must update next_in and avail_in when avail_in has
        !           319:    dropped to zero. It must update next_out and avail_out when avail_out
        !           320:    has dropped to zero. The application must initialize zalloc, zfree and
        !           321:    opaque before calling the init function. All other fields are set by the
        !           322:    compression library and must not be updated by the application.
        !           323: 
        !           324:    The opaque value provided by the application will be passed as the first
        !           325:    parameter for calls of zalloc and zfree. This can be useful for custom
        !           326:    memory management. The compression library attaches no meaning to the
        !           327:    opaque value.
        !           328: 
        !           329:    zalloc must return Z_NULL if there is not enough memory for the object.
        !           330:    On 16-bit systems, the functions zalloc and zfree must be able to allocate
        !           331:    exactly 65536 bytes, but will not be required to allocate more than this
        !           332:    if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
        !           333:    pointers returned by zalloc for objects of exactly 65536 bytes *must*
        !           334:    have their offset normalized to zero. The default allocation function
        !           335:    provided by this library ensures this (see zutil.c). To reduce memory
        !           336:    requirements and avoid any allocation of 64K objects, at the expense of
        !           337:    compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
        !           338: 
        !           339:    The fields total_in and total_out can be used for statistics or
        !           340:    progress reports. After compression, total_in holds the total size of
        !           341:    the uncompressed data and may be saved for use in the decompressor
        !           342:    (particularly if the decompressor wants to decompress everything in
        !           343:    a single step).
        !           344: */
        !           345: 
        !           346:                         /* constants */
        !           347: 
        !           348: #define Z_NO_FLUSH      0
        !           349: #define Z_PARTIAL_FLUSH 1
        !           350: #define Z_PACKET_FLUSH 2
        !           351: #define Z_SYNC_FLUSH    3
        !           352: #define Z_FULL_FLUSH    4
        !           353: #define Z_FINISH        5
        !           354: /* Allowed flush values; see deflate() below for details */
        !           355: 
        !           356: #define Z_OK            0
        !           357: #define Z_STREAM_END    1
        !           358: #define Z_NEED_DICT     2
        !           359: #define Z_ERRNO        (-1)
        !           360: #define Z_STREAM_ERROR (-2)
        !           361: #define Z_DATA_ERROR   (-3)
        !           362: #define Z_MEM_ERROR    (-4)
        !           363: #define Z_BUF_ERROR    (-5)
        !           364: #define Z_VERSION_ERROR (-6)
        !           365: /* Return codes for the compression/decompression functions. Negative
        !           366:  * values are errors, positive values are used for special but normal events.
        !           367:  */
        !           368: 
        !           369: #define Z_NO_COMPRESSION         0
        !           370: #define Z_BEST_SPEED             1
        !           371: #define Z_BEST_COMPRESSION       9
        !           372: #define Z_DEFAULT_COMPRESSION  (-1)
        !           373: /* compression levels */
        !           374: 
        !           375: #define Z_FILTERED            1
        !           376: #define Z_HUFFMAN_ONLY        2
        !           377: #define Z_DEFAULT_STRATEGY    0
        !           378: /* compression strategy; see deflateInit2() below for details */
        !           379: 
        !           380: #define Z_BINARY   0
        !           381: #define Z_ASCII    1
        !           382: #define Z_UNKNOWN  2
        !           383: /* Possible values of the data_type field */
        !           384: 
        !           385: #define Z_DEFLATED   8
        !           386: /* The deflate compression method (the only one supported in this version) */
        !           387: 
        !           388: #define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
        !           389: 
        !           390: #define zlib_version zlibVersion()
        !           391: /* for compatibility with versions < 1.0.2 */
        !           392: 
        !           393:                         /* basic functions */
        !           394: 
        !           395: extern const char * EXPORT zlibVersion OF((void));
        !           396: /* The application can compare zlibVersion and ZLIB_VERSION for consistency.
        !           397:    If the first character differs, the library code actually used is
        !           398:    not compatible with the zlib.h header file used by the application.
        !           399:    This check is automatically made by deflateInit and inflateInit.
        !           400:  */
        !           401: 
        !           402: /* 
        !           403: extern int EXPORT deflateInit OF((z_streamp strm, int level));
        !           404: 
        !           405:      Initializes the internal stream state for compression. The fields
        !           406:    zalloc, zfree and opaque must be initialized before by the caller.
        !           407:    If zalloc and zfree are set to Z_NULL, deflateInit updates them to
        !           408:    use default allocation functions.
        !           409: 
        !           410:      The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
        !           411:    1 gives best speed, 9 gives best compression, 0 gives no compression at
        !           412:    all (the input data is simply copied a block at a time).
        !           413:    Z_DEFAULT_COMPRESSION requests a default compromise between speed and
        !           414:    compression (currently equivalent to level 6).
        !           415: 
        !           416:      deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
        !           417:    enough memory, Z_STREAM_ERROR if level is not a valid compression level,
        !           418:    Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
        !           419:    with the version assumed by the caller (ZLIB_VERSION).
        !           420:    msg is set to null if there is no error message.  deflateInit does not
        !           421:    perform any compression: this will be done by deflate().
        !           422: */
        !           423: 
        !           424: 
        !           425: extern int EXPORT deflate OF((z_streamp strm, int flush));
        !           426: /*
        !           427:   Performs one or both of the following actions:
        !           428: 
        !           429:   - Compress more input starting at next_in and update next_in and avail_in
        !           430:     accordingly. If not all input can be processed (because there is not
        !           431:     enough room in the output buffer), next_in and avail_in are updated and
        !           432:     processing will resume at this point for the next call of deflate().
        !           433: 
        !           434:   - Provide more output starting at next_out and update next_out and avail_out
        !           435:     accordingly. This action is forced if the parameter flush is non zero.
        !           436:     Forcing flush frequently degrades the compression ratio, so this parameter
        !           437:     should be set only when necessary (in interactive applications).
        !           438:     Some output may be provided even if flush is not set.
        !           439: 
        !           440:   Before the call of deflate(), the application should ensure that at least
        !           441:   one of the actions is possible, by providing more input and/or consuming
        !           442:   more output, and updating avail_in or avail_out accordingly; avail_out
        !           443:   should never be zero before the call. The application can consume the
        !           444:   compressed output when it wants, for example when the output buffer is full
        !           445:   (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
        !           446:   and with zero avail_out, it must be called again after making room in the
        !           447:   output buffer because there might be more output pending.
        !           448: 
        !           449:     If the parameter flush is set to Z_PARTIAL_FLUSH, the current compression
        !           450:   block is terminated and flushed to the output buffer so that the
        !           451:   decompressor can get all input data available so far. For method 9, a future
        !           452:   variant on method 8, the current block will be flushed but not terminated.
        !           453:   Z_SYNC_FLUSH has the same effect as partial flush except that the compressed
        !           454:   output is byte aligned (the compressor can clear its internal bit buffer)
        !           455:   and the current block is always terminated; this can be useful if the
        !           456:   compressor has to be restarted from scratch after an interruption (in which
        !           457:   case the internal state of the compressor may be lost).
        !           458:     If flush is set to Z_FULL_FLUSH, the compression block is terminated, a
        !           459:   special marker is output and the compression dictionary is discarded; this
        !           460:   is useful to allow the decompressor to synchronize if one compressed block
        !           461:   has been damaged (see inflateSync below).  Flushing degrades compression and
        !           462:   so should be used only when necessary.  Using Z_FULL_FLUSH too often can
        !           463:   seriously degrade the compression. If deflate returns with avail_out == 0,
        !           464:   this function must be called again with the same value of the flush
        !           465:   parameter and more output space (updated avail_out), until the flush is
        !           466:   complete (deflate returns with non-zero avail_out).
        !           467: 
        !           468:     If the parameter flush is set to Z_PACKET_FLUSH, the compression
        !           469:   block is terminated, and a zero-length stored block is output,
        !           470:   omitting the length bytes (the effect of this is that the 3-bit type
        !           471:   code 000 for a stored block is output, and the output is then
        !           472:   byte-aligned).  This is designed for use at the end of a PPP packet.
        !           473: 
        !           474:     If the parameter flush is set to Z_FINISH, pending input is processed,
        !           475:   pending output is flushed and deflate returns with Z_STREAM_END if there
        !           476:   was enough output space; if deflate returns with Z_OK, this function must be
        !           477:   called again with Z_FINISH and more output space (updated avail_out) but no
        !           478:   more input data, until it returns with Z_STREAM_END or an error. After
        !           479:   deflate has returned Z_STREAM_END, the only possible operations on the
        !           480:   stream are deflateReset or deflateEnd.
        !           481:   
        !           482:     Z_FINISH can be used immediately after deflateInit if all the compression
        !           483:   is to be done in a single step. In this case, avail_out must be at least
        !           484:   0.1% larger than avail_in plus 12 bytes.  If deflate does not return
        !           485:   Z_STREAM_END, then it must be called again as described above.
        !           486: 
        !           487:     deflate() may update data_type if it can make a good guess about
        !           488:   the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
        !           489:   binary. This field is only for information purposes and does not affect
        !           490:   the compression algorithm in any manner.
        !           491: 
        !           492:     deflate() returns Z_OK if some progress has been made (more input
        !           493:   processed or more output produced), Z_STREAM_END if all input has been
        !           494:   consumed and all output has been produced (only when flush is set to
        !           495:   Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
        !           496:   if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible.
        !           497: */
        !           498: 
        !           499: 
        !           500: extern int EXPORT deflateEnd OF((z_streamp strm));
        !           501: /*
        !           502:      All dynamically allocated data structures for this stream are freed.
        !           503:    This function discards any unprocessed input and does not flush any
        !           504:    pending output.
        !           505: 
        !           506:      deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
        !           507:    stream state was inconsistent, Z_DATA_ERROR if the stream was freed
        !           508:    prematurely (some input or output was discarded). In the error case,
        !           509:    msg may be set but then points to a static string (which must not be
        !           510:    deallocated).
        !           511: */
        !           512: 
        !           513: 
        !           514: /* 
        !           515: extern int EXPORT inflateInit OF((z_streamp strm));
        !           516: 
        !           517:      Initializes the internal stream state for decompression. The fields
        !           518:    zalloc, zfree and opaque must be initialized before by the caller.  If
        !           519:    zalloc and zfree are set to Z_NULL, inflateInit updates them to use default
        !           520:    allocation functions.
        !           521: 
        !           522:      inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
        !           523:    enough memory, Z_VERSION_ERROR if the zlib library version is incompatible
        !           524:    with the version assumed by the caller.  msg is set to null if there is no
        !           525:    error message. inflateInit does not perform any decompression: this will be
        !           526:    done by inflate().
        !           527: */
        !           528: 
        !           529: #if defined(__FreeBSD__) && (defined(KERNEL) || defined(_KERNEL))
        !           530: #define inflate       inflate_ppp     /* FreeBSD already has an inflate :-( */
        !           531: #endif
        !           532: 
        !           533: extern int EXPORT inflate OF((z_streamp strm, int flush));
        !           534: /*
        !           535:   Performs one or both of the following actions:
        !           536: 
        !           537:   - Decompress more input starting at next_in and update next_in and avail_in
        !           538:     accordingly. If not all input can be processed (because there is not
        !           539:     enough room in the output buffer), next_in is updated and processing
        !           540:     will resume at this point for the next call of inflate().
        !           541: 
        !           542:   - Provide more output starting at next_out and update next_out and avail_out
        !           543:     accordingly.  inflate() provides as much output as possible, until there
        !           544:     is no more input data or no more space in the output buffer (see below
        !           545:     about the flush parameter).
        !           546: 
        !           547:   Before the call of inflate(), the application should ensure that at least
        !           548:   one of the actions is possible, by providing more input and/or consuming
        !           549:   more output, and updating the next_* and avail_* values accordingly.
        !           550:   The application can consume the uncompressed output when it wants, for
        !           551:   example when the output buffer is full (avail_out == 0), or after each
        !           552:   call of inflate(). If inflate returns Z_OK and with zero avail_out, it
        !           553:   must be called again after making room in the output buffer because there
        !           554:   might be more output pending.
        !           555: 
        !           556:     If the parameter flush is set to Z_PARTIAL_FLUSH or Z_PACKET_FLUSH,
        !           557:   inflate flushes as much output as possible to the output buffer. The
        !           558:   flushing behavior of inflate is not specified for values of the flush
        !           559:   parameter other than Z_PARTIAL_FLUSH, Z_PACKET_FLUSH or Z_FINISH, but the
        !           560:   current implementation actually flushes as much output as possible
        !           561:   anyway.  For Z_PACKET_FLUSH, inflate checks that once all the input data
        !           562:   has been consumed, it is expecting to see the length field of a stored
        !           563:   block; if not, it returns Z_DATA_ERROR.
        !           564: 
        !           565:     inflate() should normally be called until it returns Z_STREAM_END or an
        !           566:   error. However if all decompression is to be performed in a single step
        !           567:   (a single call of inflate), the parameter flush should be set to
        !           568:   Z_FINISH. In this case all pending input is processed and all pending
        !           569:   output is flushed; avail_out must be large enough to hold all the
        !           570:   uncompressed data. (The size of the uncompressed data may have been saved
        !           571:   by the compressor for this purpose.) The next operation on this stream must
        !           572:   be inflateEnd to deallocate the decompression state. The use of Z_FINISH
        !           573:   is never required, but can be used to inform inflate that a faster routine
        !           574:   may be used for the single inflate() call.
        !           575: 
        !           576:     inflate() returns Z_OK if some progress has been made (more input
        !           577:   processed or more output produced), Z_STREAM_END if the end of the
        !           578:   compressed data has been reached and all uncompressed output has been
        !           579:   produced, Z_NEED_DICT if a preset dictionary is needed at this point (see
        !           580:   inflateSetDictionary below), Z_DATA_ERROR if the input data was corrupted,
        !           581:   Z_STREAM_ERROR if the stream structure was inconsistent (for example if
        !           582:   next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
        !           583:   Z_BUF_ERROR if no progress is possible or if there was not enough room in
        !           584:   the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the
        !           585:   application may then call inflateSync to look for a good compression block.
        !           586:   In the Z_NEED_DICT case, strm->adler is set to the Adler32 value of the
        !           587:   dictionary chosen by the compressor.
        !           588: */
        !           589: 
        !           590: 
        !           591: extern int EXPORT inflateEnd OF((z_streamp strm));
        !           592: /*
        !           593:      All dynamically allocated data structures for this stream are freed.
        !           594:    This function discards any unprocessed input and does not flush any
        !           595:    pending output.
        !           596: 
        !           597:      inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
        !           598:    was inconsistent. In the error case, msg may be set but then points to a
        !           599:    static string (which must not be deallocated).
        !           600: */
        !           601: 
        !           602:                         /* Advanced functions */
        !           603: 
        !           604: /*
        !           605:     The following functions are needed only in some special applications.
        !           606: */
        !           607: 
        !           608: /*   
        !           609: extern int EXPORT deflateInit2 OF((z_streamp strm,
        !           610:                                    int  level,
        !           611:                                    int  method,
        !           612:                                    int  windowBits,
        !           613:                                    int  memLevel,
        !           614:                                    int  strategy));
        !           615: 
        !           616:      This is another version of deflateInit with more compression options. The
        !           617:    fields next_in, zalloc, zfree and opaque must be initialized before by
        !           618:    the caller.
        !           619: 
        !           620:      The method parameter is the compression method. It must be Z_DEFLATED in
        !           621:    this version of the library. (Method 9 will allow a 64K history buffer and
        !           622:    partial block flushes.)
        !           623: 
        !           624:      The windowBits parameter is the base two logarithm of the window size
        !           625:    (the size of the history buffer).  It should be in the range 8..15 for this
        !           626:    version of the library (the value 16 will be allowed for method 9). Larger
        !           627:    values of this parameter result in better compression at the expense of
        !           628:    memory usage. The default value is 15 if deflateInit is used instead.
        !           629: 
        !           630:      The memLevel parameter specifies how much memory should be allocated
        !           631:    for the internal compression state. memLevel=1 uses minimum memory but
        !           632:    is slow and reduces compression ratio; memLevel=9 uses maximum memory
        !           633:    for optimal speed. The default value is 8. See zconf.h for total memory
        !           634:    usage as a function of windowBits and memLevel.
        !           635: 
        !           636:      The strategy parameter is used to tune the compression algorithm. Use the
        !           637:    value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
        !           638:    filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
        !           639:    string match).  Filtered data consists mostly of small values with a
        !           640:    somewhat random distribution. In this case, the compression algorithm is
        !           641:    tuned to compress them better. The effect of Z_FILTERED is to force more
        !           642:    Huffman coding and less string matching; it is somewhat intermediate
        !           643:    between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
        !           644:    the compression ratio but not the correctness of the compressed output even
        !           645:    if it is not set appropriately.
        !           646: 
        !           647:      If next_in is not null, the library will use this buffer to hold also
        !           648:    some history information; the buffer must either hold the entire input
        !           649:    data, or have at least 1<<(windowBits+1) bytes and be writable. If next_in
        !           650:    is null, the library will allocate its own history buffer (and leave next_in
        !           651:    null). next_out need not be provided here but must be provided by the
        !           652:    application for the next call of deflate().
        !           653: 
        !           654:      If the history buffer is provided by the application, next_in must
        !           655:    must never be changed by the application since the compressor maintains
        !           656:    information inside this buffer from call to call; the application
        !           657:    must provide more input only by increasing avail_in. next_in is always
        !           658:    reset by the library in this case.
        !           659: 
        !           660:       deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was
        !           661:    not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as
        !           662:    an invalid method). msg is set to null if there is no error message.
        !           663:    deflateInit2 does not perform any compression: this will be done by
        !           664:    deflate(). 
        !           665: */
        !           666:                             
        !           667: extern int EXPORT deflateSetDictionary OF((z_streamp strm,
        !           668:                                            const Bytef *dictionary,
        !           669:                                           uInt  dictLength));
        !           670: /*
        !           671:      Initializes the compression dictionary (history buffer) from the given
        !           672:    byte sequence without producing any compressed output. This function must
        !           673:    be called immediately after deflateInit or deflateInit2, before any call
        !           674:    of deflate. The compressor and decompressor must use exactly the same
        !           675:    dictionary (see inflateSetDictionary).
        !           676:      The dictionary should consist of strings (byte sequences) that are likely
        !           677:    to be encountered later in the data to be compressed, with the most commonly
        !           678:    used strings preferably put towards the end of the dictionary. Using a
        !           679:    dictionary is most useful when the data to be compressed is short and
        !           680:    can be predicted with good accuracy; the data can then be compressed better
        !           681:    than with the default empty dictionary. In this version of the library,
        !           682:    only the last 32K bytes of the dictionary are used.
        !           683:      Upon return of this function, strm->adler is set to the Adler32 value
        !           684:    of the dictionary; the decompressor may later use this value to determine
        !           685:    which dictionary has been used by the compressor. (The Adler32 value
        !           686:    applies to the whole dictionary even if only a subset of the dictionary is
        !           687:    actually used by the compressor.)
        !           688: 
        !           689:      deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
        !           690:    parameter is invalid (such as NULL dictionary) or the stream state
        !           691:    is inconsistent (for example if deflate has already been called for this
        !           692:    stream). deflateSetDictionary does not perform any compression: this will
        !           693:    be done by deflate(). 
        !           694: */
        !           695: 
        !           696: extern int EXPORT deflateCopy OF((z_streamp dest,
        !           697:                                   z_streamp source));
        !           698: /*
        !           699:      Sets the destination stream as a complete copy of the source stream.  If
        !           700:    the source stream is using an application-supplied history buffer, a new
        !           701:    buffer is allocated for the destination stream.  The compressed output
        !           702:    buffer is always application-supplied. It's the responsibility of the
        !           703:    application to provide the correct values of next_out and avail_out for the
        !           704:    next call of deflate.
        !           705: 
        !           706:      This function can be useful when several compression strategies will be
        !           707:    tried, for example when there are several ways of pre-processing the input
        !           708:    data with a filter. The streams that will be discarded should then be freed
        !           709:    by calling deflateEnd.  Note that deflateCopy duplicates the internal
        !           710:    compression state which can be quite large, so this strategy is slow and
        !           711:    can consume lots of memory.
        !           712: 
        !           713:      deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
        !           714:    enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
        !           715:    (such as zalloc being NULL). msg is left unchanged in both source and
        !           716:    destination.
        !           717: */
        !           718: 
        !           719: extern int EXPORT deflateReset OF((z_streamp strm));
        !           720: /*
        !           721:      This function is equivalent to deflateEnd followed by deflateInit,
        !           722:    but does not free and reallocate all the internal compression state.
        !           723:    The stream will keep the same compression level and any other attributes
        !           724:    that may have been set by deflateInit2.
        !           725: 
        !           726:       deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
        !           727:    stream state was inconsistent (such as zalloc or state being NULL).
        !           728: */
        !           729: 
        !           730: extern int EXPORT deflateParams OF((z_streamp strm, int level, int strategy));
        !           731: /*
        !           732:      Dynamically update the compression level and compression strategy.
        !           733:    This can be used to switch between compression and straight copy of
        !           734:    the input data, or to switch to a different kind of input data requiring
        !           735:    a different strategy. If the compression level is changed, the input
        !           736:    available so far is compressed with the old level (and may be flushed);
        !           737:    the new level will take effect only at the next call of deflate().
        !           738: 
        !           739:      Before the call of deflateParams, the stream state must be set as for
        !           740:    a call of deflate(), since the currently available input may have to
        !           741:    be compressed and flushed. In particular, strm->avail_out must be non-zero.
        !           742: 
        !           743:      deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
        !           744:    stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
        !           745:    if strm->avail_out was zero.
        !           746: */
        !           747: 
        !           748: extern int EXPORT deflateOutputPending OF((z_streamp strm));
        !           749: /*
        !           750:      Returns the number of bytes of output which are immediately
        !           751:    available from the compressor (i.e. without any further input
        !           752:    or flush).
        !           753: */
        !           754: 
        !           755: /*   
        !           756: extern int EXPORT inflateInit2 OF((z_streamp strm,
        !           757:                                    int  windowBits));
        !           758: 
        !           759:      This is another version of inflateInit with more compression options. The
        !           760:    fields next_out, zalloc, zfree and opaque must be initialized before by
        !           761:    the caller.
        !           762: 
        !           763:      The windowBits parameter is the base two logarithm of the maximum window
        !           764:    size (the size of the history buffer).  It should be in the range 8..15 for
        !           765:    this version of the library (the value 16 will be allowed soon). The
        !           766:    default value is 15 if inflateInit is used instead. If a compressed stream
        !           767:    with a larger window size is given as input, inflate() will return with
        !           768:    the error code Z_DATA_ERROR instead of trying to allocate a larger window.
        !           769: 
        !           770:      If next_out is not null, the library will use this buffer for the history
        !           771:    buffer; the buffer must either be large enough to hold the entire output
        !           772:    data, or have at least 1<<windowBits bytes.  If next_out is null, the
        !           773:    library will allocate its own buffer (and leave next_out null). next_in
        !           774:    need not be provided here but must be provided by the application for the
        !           775:    next call of inflate().
        !           776: 
        !           777:      If the history buffer is provided by the application, next_out must
        !           778:    never be changed by the application since the decompressor maintains
        !           779:    history information inside this buffer from call to call; the application
        !           780:    can only reset next_out to the beginning of the history buffer when
        !           781:    avail_out is zero and all output has been consumed.
        !           782: 
        !           783:       inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was
        !           784:    not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as
        !           785:    windowBits < 8). msg is set to null if there is no error message.
        !           786:    inflateInit2 does not perform any decompression: this will be done by
        !           787:    inflate().
        !           788: */
        !           789: 
        !           790: extern int EXPORT inflateSetDictionary OF((z_streamp strm,
        !           791:                                           const Bytef *dictionary,
        !           792:                                           uInt  dictLength));
        !           793: /*
        !           794:      Initializes the decompression dictionary (history buffer) from the given
        !           795:    uncompressed byte sequence. This function must be called immediately after
        !           796:    a call of inflate if this call returned Z_NEED_DICT. The dictionary chosen
        !           797:    by the compressor can be determined from the Adler32 value returned by this
        !           798:    call of inflate. The compressor and decompressor must use exactly the same
        !           799:    dictionary (see deflateSetDictionary).
        !           800: 
        !           801:      inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
        !           802:    parameter is invalid (such as NULL dictionary) or the stream state is
        !           803:    inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
        !           804:    expected one (incorrect Adler32 value). inflateSetDictionary does not
        !           805:    perform any decompression: this will be done by subsequent calls of
        !           806:    inflate().
        !           807: */
        !           808: 
        !           809: extern int EXPORT inflateSync OF((z_streamp strm));
        !           810: /* 
        !           811:     Skips invalid compressed data until the special marker (see deflate()
        !           812:   above) can be found, or until all available input is skipped. No output
        !           813:   is provided.
        !           814: 
        !           815:     inflateSync returns Z_OK if the special marker has been found, Z_BUF_ERROR
        !           816:   if no more input was provided, Z_DATA_ERROR if no marker has been found,
        !           817:   or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
        !           818:   case, the application may save the current current value of total_in which
        !           819:   indicates where valid compressed data was found. In the error case, the
        !           820:   application may repeatedly call inflateSync, providing more input each time,
        !           821:   until success or end of the input data.
        !           822: */
        !           823: 
        !           824: extern int EXPORT inflateReset OF((z_streamp strm));
        !           825: /*
        !           826:      This function is equivalent to inflateEnd followed by inflateInit,
        !           827:    but does not free and reallocate all the internal decompression state.
        !           828:    The stream will keep attributes that may have been set by inflateInit2.
        !           829: 
        !           830:       inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
        !           831:    stream state was inconsistent (such as zalloc or state being NULL).
        !           832: */
        !           833: 
        !           834: extern int inflateIncomp OF((z_stream *strm));
        !           835: /*
        !           836:      This function adds the data at next_in (avail_in bytes) to the output
        !           837:    history without performing any output.  There must be no pending output,
        !           838:    and the decompressor must be expecting to see the start of a block.
        !           839:    Calling this function is equivalent to decompressing a stored block
        !           840:    containing the data at next_in (except that the data is not output).
        !           841: */
        !           842: 
        !           843:                         /* utility functions */
        !           844: 
        !           845: /*
        !           846:      The following utility functions are implemented on top of the
        !           847:    basic stream-oriented functions. To simplify the interface, some
        !           848:    default options are assumed (compression level, window size,
        !           849:    standard memory allocation functions). The source code of these
        !           850:    utility functions can easily be modified if you need special options.
        !           851: */
        !           852: 
        !           853: extern int EXPORT compress OF((Bytef *dest,   uLongf *destLen,
        !           854:                               const Bytef *source, uLong sourceLen));
        !           855: /*
        !           856:      Compresses the source buffer into the destination buffer.  sourceLen is
        !           857:    the byte length of the source buffer. Upon entry, destLen is the total
        !           858:    size of the destination buffer, which must be at least 0.1% larger than
        !           859:    sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
        !           860:    compressed buffer.
        !           861:      This function can be used to compress a whole file at once if the
        !           862:    input file is mmap'ed.
        !           863:      compress returns Z_OK if success, Z_MEM_ERROR if there was not
        !           864:    enough memory, Z_BUF_ERROR if there was not enough room in the output
        !           865:    buffer.
        !           866: */
        !           867: 
        !           868: extern int EXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
        !           869:                                 const Bytef *source, uLong sourceLen));
        !           870: /*
        !           871:      Decompresses the source buffer into the destination buffer.  sourceLen is
        !           872:    the byte length of the source buffer. Upon entry, destLen is the total
        !           873:    size of the destination buffer, which must be large enough to hold the
        !           874:    entire uncompressed data. (The size of the uncompressed data must have
        !           875:    been saved previously by the compressor and transmitted to the decompressor
        !           876:    by some mechanism outside the scope of this compression library.)
        !           877:    Upon exit, destLen is the actual size of the compressed buffer.
        !           878:      This function can be used to decompress a whole file at once if the
        !           879:    input file is mmap'ed.
        !           880: 
        !           881:      uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
        !           882:    enough memory, Z_BUF_ERROR if there was not enough room in the output
        !           883:    buffer, or Z_DATA_ERROR if the input data was corrupted.
        !           884: */
        !           885: 
        !           886: 
        !           887: typedef voidp gzFile;
        !           888: 
        !           889: extern gzFile EXPORT gzopen  OF((const char *path, const char *mode));
        !           890: /*
        !           891:      Opens a gzip (.gz) file for reading or writing. The mode parameter
        !           892:    is as in fopen ("rb" or "wb") but can also include a compression level
        !           893:    ("wb9").  gzopen can be used to read a file which is not in gzip format;
        !           894:    in this case gzread will directly read from the file without decompression.
        !           895:      gzopen returns NULL if the file could not be opened or if there was
        !           896:    insufficient memory to allocate the (de)compression state; errno
        !           897:    can be checked to distinguish the two cases (if errno is zero, the
        !           898:    zlib error is Z_MEM_ERROR).
        !           899: */
        !           900: 
        !           901: extern gzFile EXPORT gzdopen  OF((int fd, const char *mode));
        !           902: /*
        !           903:      gzdopen() associates a gzFile with the file descriptor fd.  File
        !           904:    descriptors are obtained from calls like open, dup, creat, pipe or
        !           905:    fileno (in the file has been previously opened with fopen).
        !           906:    The mode parameter is as in gzopen.
        !           907:      The next call of gzclose on the returned gzFile will also close the
        !           908:    file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
        !           909:    descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
        !           910:      gzdopen returns NULL if there was insufficient memory to allocate
        !           911:    the (de)compression state.
        !           912: */
        !           913: 
        !           914: extern int EXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
        !           915: /*
        !           916:      Reads the given number of uncompressed bytes from the compressed file.
        !           917:    If the input file was not in gzip format, gzread copies the given number
        !           918:    of bytes into the buffer.
        !           919:      gzread returns the number of uncompressed bytes actually read (0 for
        !           920:    end of file, -1 for error). */
        !           921: 
        !           922: extern int EXPORT    gzwrite OF((gzFile file, const voidp buf, unsigned len));
        !           923: /*
        !           924:      Writes the given number of uncompressed bytes into the compressed file.
        !           925:    gzwrite returns the number of uncompressed bytes actually written
        !           926:    (0 in case of error).
        !           927: */
        !           928: 
        !           929: extern int EXPORT    gzflush OF((gzFile file, int flush));
        !           930: /*
        !           931:      Flushes all pending output into the compressed file. The parameter
        !           932:    flush is as in the deflate() function. The return value is the zlib
        !           933:    error number (see function gzerror below). gzflush returns Z_OK if
        !           934:    the flush parameter is Z_FINISH and all output could be flushed.
        !           935:      gzflush should be called only when strictly necessary because it can
        !           936:    degrade compression.
        !           937: */
        !           938: 
        !           939: extern int EXPORT    gzclose OF((gzFile file));
        !           940: /*
        !           941:      Flushes all pending output if necessary, closes the compressed file
        !           942:    and deallocates all the (de)compression state. The return value is the zlib
        !           943:    error number (see function gzerror below).
        !           944: */
        !           945: 
        !           946: extern const char * EXPORT gzerror OF((gzFile file, int *errnum));
        !           947: /*
        !           948:      Returns the error message for the last error which occurred on the
        !           949:    given compressed file. errnum is set to zlib error number. If an
        !           950:    error occurred in the file system and not in the compression library,
        !           951:    errnum is set to Z_ERRNO and the application may consult errno
        !           952:    to get the exact error code.
        !           953: */
        !           954: 
        !           955:                         /* checksum functions */
        !           956: 
        !           957: /*
        !           958:      These functions are not related to compression but are exported
        !           959:    anyway because they might be useful in applications using the
        !           960:    compression library.
        !           961: */
        !           962: 
        !           963: extern uLong EXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
        !           964: 
        !           965: /*
        !           966:      Update a running Adler-32 checksum with the bytes buf[0..len-1] and
        !           967:    return the updated checksum. If buf is NULL, this function returns
        !           968:    the required initial value for the checksum.
        !           969:    An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
        !           970:    much faster. Usage example:
        !           971: 
        !           972:      uLong adler = adler32(0L, Z_NULL, 0);
        !           973: 
        !           974:      while (read_buffer(buffer, length) != EOF) {
        !           975:        adler = adler32(adler, buffer, length);
        !           976:      }
        !           977:      if (adler != original_adler) error();
        !           978: */
        !           979: 
        !           980: extern uLong EXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
        !           981: /*
        !           982:      Update a running crc with the bytes buf[0..len-1] and return the updated
        !           983:    crc. If buf is NULL, this function returns the required initial value
        !           984:    for the crc. Pre- and post-conditioning (one's complement) is performed
        !           985:    within this function so it shouldn't be done by the application.
        !           986:    Usage example:
        !           987: 
        !           988:      uLong crc = crc32(0L, Z_NULL, 0);
        !           989: 
        !           990:      while (read_buffer(buffer, length) != EOF) {
        !           991:        crc = crc32(crc, buffer, length);
        !           992:      }
        !           993:      if (crc != original_crc) error();
        !           994: */
        !           995: 
        !           996: 
        !           997:                         /* various hacks, don't look :) */
        !           998: 
        !           999: /* deflateInit and inflateInit are macros to allow checking the zlib version
        !          1000:  * and the compiler's view of z_stream:
        !          1001:  */
        !          1002: extern int EXPORT deflateInit_ OF((z_streamp strm, int level,
        !          1003:                                   const char *version, int stream_size));
        !          1004: extern int EXPORT inflateInit_ OF((z_streamp strm,
        !          1005:                                   const char *version, int stream_size));
        !          1006: extern int EXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
        !          1007:                                    int windowBits, int memLevel, int strategy,
        !          1008:                                    const char *version, int stream_size));
        !          1009: extern int EXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
        !          1010:                                    const char *version, int stream_size));
        !          1011: #define deflateInit(strm, level) \
        !          1012:         deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
        !          1013: #define inflateInit(strm) \
        !          1014:         inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
        !          1015: #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
        !          1016:         deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
        !          1017:                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
        !          1018: #define inflateInit2(strm, windowBits) \
        !          1019:         inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
        !          1020: 
        !          1021: #if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
        !          1022:     struct internal_state {int dummy;}; /* hack for buggy compilers */
        !          1023: #endif
        !          1024: 
        !          1025: uLongf *get_crc_table OF((void)); /* can be used by asm versions of crc32() */
        !          1026: 
        !          1027: #ifdef __cplusplus
        !          1028: }
        !          1029: #endif
        !          1030: 
        !          1031: #endif /* _ZLIB_H */
        !          1032: /* --- zlib.h */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.