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