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