1 /* zconf.h -- configuration of the zlib compression library
2 * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
3 * For conditions of distribution and use, see copyright notice in zlib.h
18 * If you *really* need a unique prefix for all types and library functions,
19 * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
20 * Even better than compiling with -DZ_PREFIX would be to use configure to set
21 * this permanently in zconf.h using "./configure --zprefix".
23 #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
26 /* all linked symbols and init macros */
27 # define _dist_code z__dist_code
28 # define _length_code z__length_code
29 # define _tr_align z__tr_align
30 # define _tr_flush_bits z__tr_flush_bits
31 # define _tr_flush_block z__tr_flush_block
32 # define _tr_init z__tr_init
33 # define _tr_stored_block z__tr_stored_block
34 # define _tr_tally z__tr_tally
35 # define adler32 z_adler32
36 # define adler32_combine z_adler32_combine
37 # define adler32_combine64 z_adler32_combine64
38 # define adler32_z z_adler32_z
39 # if !defined(Z_SOLO) && !defined(_KERNEL)
40 # define compress z_compress
41 # define compress2 z_compress2
42 # define compressBound z_compressBound
44 # define crc32 z_crc32
45 # define crc32_combine z_crc32_combine
46 # define crc32_combine64 z_crc32_combine64
47 # define crc32_z z_crc32_z
48 # define deflate z_deflate
49 # define deflateBound z_deflateBound
50 # define deflateCopy z_deflateCopy
51 # define deflateEnd z_deflateEnd
52 # define deflateGetDictionary z_deflateGetDictionary
53 # define deflateInit z_deflateInit
54 # define deflateInit2 z_deflateInit2
55 # define deflateInit2_ z_deflateInit2_
56 # define deflateInit_ z_deflateInit_
57 # define deflateParams z_deflateParams
58 # define deflatePending z_deflatePending
59 # define deflatePrime z_deflatePrime
60 # define deflateReset z_deflateReset
61 # define deflateResetKeep z_deflateResetKeep
62 # define deflateSetDictionary z_deflateSetDictionary
63 # define deflateSetHeader z_deflateSetHeader
64 # define deflateTune z_deflateTune
65 # define deflate_copyright z_deflate_copyright
66 # define get_crc_table z_get_crc_table
68 # define gz_error z_gz_error
69 # define gz_intmax z_gz_intmax
70 # define gz_strwinerror z_gz_strwinerror
71 # define gzbuffer z_gzbuffer
72 # define gzclearerr z_gzclearerr
73 # define gzclose z_gzclose
74 # define gzclose_r z_gzclose_r
75 # define gzclose_w z_gzclose_w
76 # define gzdirect z_gzdirect
77 # define gzdopen z_gzdopen
78 # define gzeof z_gzeof
79 # define gzerror z_gzerror
80 # define gzflush z_gzflush
81 # define gzfread z_gzfread
82 # define gzfwrite z_gzfwrite
83 # define gzgetc z_gzgetc
84 # define gzgetc_ z_gzgetc_
85 # define gzgets z_gzgets
86 # define gzoffset z_gzoffset
87 # define gzoffset64 z_gzoffset64
88 # define gzopen z_gzopen
89 # define gzopen64 z_gzopen64
91 # define gzopen_w z_gzopen_w
93 # define gzprintf z_gzprintf
94 # define gzputc z_gzputc
95 # define gzputs z_gzputs
96 # define gzread z_gzread
97 # define gzrewind z_gzrewind
98 # define gzseek z_gzseek
99 # define gzseek64 z_gzseek64
100 # define gzsetparams z_gzsetparams
101 # define gztell z_gztell
102 # define gztell64 z_gztell64
103 # define gzungetc z_gzungetc
104 # define gzvprintf z_gzvprintf
105 # define gzwrite z_gzwrite
107 # define inflate z_inflate
108 # define inflateBack z_inflateBack
109 # define inflateBackEnd z_inflateBackEnd
110 # define inflateBackInit z_inflateBackInit
111 # define inflateBackInit_ z_inflateBackInit_
112 # define inflateCodesUsed z_inflateCodesUsed
113 # define inflateCopy z_inflateCopy
114 # define inflateEnd z_inflateEnd
115 # define inflateGetDictionary z_inflateGetDictionary
116 # define inflateGetHeader z_inflateGetHeader
117 # define inflateInit z_inflateInit
118 # define inflateInit2 z_inflateInit2
119 # define inflateInit2_ z_inflateInit2_
120 # define inflateInit_ z_inflateInit_
121 # define inflateMark z_inflateMark
122 # define inflatePrime z_inflatePrime
123 # define inflateReset z_inflateReset
124 # define inflateReset2 z_inflateReset2
125 # define inflateResetKeep z_inflateResetKeep
126 # define inflateSetDictionary z_inflateSetDictionary
127 # define inflateSync z_inflateSync
128 # define inflateSyncPoint z_inflateSyncPoint
129 # define inflateUndermine z_inflateUndermine
130 # define inflateValidate z_inflateValidate
131 # define inflate_copyright z_inflate_copyright
132 # define inflate_fast z_inflate_fast
133 # define inflate_table z_inflate_table
134 # if !defined(Z_SOLO) && !defined(_KERNEL)
135 # define uncompress z_uncompress
136 # define uncompress2 z_uncompress2
138 # define zError z_zError
139 # if !defined(Z_SOLO) && !defined(_KERNEL)
140 # define zcalloc z_zcalloc
141 # define zcfree z_zcfree
143 # define zlibCompileFlags z_zlibCompileFlags
144 # define zlibVersion z_zlibVersion
146 /* all zlib typedefs in zlib.h and zconf.h */
148 # define Bytef z_Bytef
149 # define alloc_func z_alloc_func
150 # define charf z_charf
151 # define free_func z_free_func
153 # define gzFile z_gzFile
155 # define gz_header z_gz_header
156 # define gz_headerp z_gz_headerp
157 # define in_func z_in_func
159 # define out_func z_out_func
161 # define uIntf z_uIntf
162 # define uLong z_uLong
163 # define uLongf z_uLongf
164 # define voidp z_voidp
165 # define voidpc z_voidpc
166 # define voidpf z_voidpf
168 /* all zlib structs in zlib.h and zconf.h */
169 # define gz_header_s z_gz_header_s
170 # define internal_state z_internal_state
174 #if defined(__MSDOS__) && !defined(MSDOS)
177 #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
180 #if defined(_WINDOWS) && !defined(WINDOWS)
183 #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
188 #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
189 # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
197 * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
198 * than 64k bytes at a time (needed on systems with 16-bit int).
204 # define UNALIGNED_OK
207 #ifdef __STDC_VERSION__
211 # if __STDC_VERSION__ >= 199901L
217 #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
220 #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
223 #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
226 #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
230 #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
235 # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
236 # define const /* note: need a more gentle solution here */
240 #if defined(ZLIB_CONST) && !defined(z_const)
241 # define z_const const
247 typedef unsigned long z_size_t;
249 # define z_longlong long long
250 # if defined(NO_SIZE_T)
251 typedef unsigned NO_SIZE_T z_size_t;
254 typedef size_t z_size_t;
256 typedef unsigned long z_size_t;
261 /* Maximum value for memLevel in deflateInit2 */
262 #ifndef MAX_MEM_LEVEL
264 # define MAX_MEM_LEVEL 8
266 # define MAX_MEM_LEVEL 9
270 /* Maximum value for windowBits in deflateInit2 and inflateInit2.
271 * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
272 * created by gzip. (Files created by minigzip can still be extracted by
276 # define MAX_WBITS 15 /* 32K LZ77 window */
279 /* The memory requirements for deflate are (in bytes):
280 (1 << (windowBits+2)) + (1 << (memLevel+9))
281 that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
282 plus a few kilobytes for small objects. For example, if you want to reduce
283 the default memory requirements from 256K to 128K, compile with
284 make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
285 Of course this will generally degrade compression (there's no free lunch).
287 The memory requirements for inflate are (in bytes) 1 << windowBits
288 that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
292 /* Type declarations */
294 #ifndef OF /* function prototypes */
296 # define OF(args) args
302 #ifndef Z_ARG /* function prototypes for stdarg */
303 # if defined(STDC) || defined(Z_HAVE_STDARG_H)
304 # define Z_ARG(args) args
306 # define Z_ARG(args) ()
310 /* The following definitions for FAR are needed only for MSDOS mixed
311 * model programming (small or medium model with some far allocations).
312 * This was tested only with MSC; for other MSDOS compilers you may have
313 * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
314 * just define FAR to be empty.
317 # if defined(M_I86SM) || defined(M_I86MM)
318 /* MSC small or medium model */
319 # define SMALL_MEDIUM
326 # if (defined(__SMALL__) || defined(__MEDIUM__))
327 /* Turbo C small or medium model */
328 # define SMALL_MEDIUM
337 #if defined(WINDOWS) || defined(WIN32)
338 /* If building or using zlib as a DLL, define ZLIB_DLL.
339 * This is not mandatory, but it offers a little performance increase.
342 # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
343 # ifdef ZLIB_INTERNAL
344 # define ZEXTERN extern __declspec(dllexport)
346 # define ZEXTERN extern __declspec(dllimport)
349 # endif /* ZLIB_DLL */
350 /* If building or using zlib with the WINAPI/WINAPIV calling convention,
351 * define ZLIB_WINAPI.
352 * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
358 # include <windows.h>
359 /* No need for _export, use ZLIB.DEF instead. */
360 /* For complete Windows compatibility, use WINAPI, not __stdcall. */
361 # define ZEXPORT WINAPI
363 # define ZEXPORTVA WINAPIV
365 # define ZEXPORTVA FAR CDECL
370 #if defined (__BEOS__)
372 # ifdef ZLIB_INTERNAL
373 # define ZEXPORT __declspec(dllexport)
374 # define ZEXPORTVA __declspec(dllexport)
376 # define ZEXPORT __declspec(dllimport)
377 # define ZEXPORTVA __declspec(dllimport)
383 # define ZEXTERN extern
396 #if !defined(__MACTYPES__)
397 typedef unsigned char Byte; /* 8 bits */
399 typedef unsigned int uInt; /* 16 bits or more */
400 typedef unsigned long uLong; /* 32 bits or more */
403 /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
404 # define Bytef Byte FAR
406 typedef Byte FAR Bytef;
408 typedef char FAR charf;
409 typedef int FAR intf;
410 typedef uInt FAR uIntf;
411 typedef uLong FAR uLongf;
414 typedef void const *voidpc;
415 typedef void FAR *voidpf;
418 typedef Byte const *voidpc;
419 typedef Byte FAR *voidpf;
423 #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
425 # if (UINT_MAX == 0xffffffffUL)
426 # define Z_U4 unsigned
427 # elif (ULONG_MAX == 0xffffffffUL)
428 # define Z_U4 unsigned long
429 # elif (USHRT_MAX == 0xffffffffUL)
430 # define Z_U4 unsigned short
435 typedef Z_U4 z_crc_t;
437 typedef unsigned long z_crc_t;
440 #if 0 /* was set to #if 0 by ./configure */
441 # define Z_HAVE_UNISTD_H
444 #ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
445 # define Z_HAVE_STDARG_H
450 # include <sys/types.h> /* for off_t */
454 #if defined(STDC) || defined(Z_HAVE_STDARG_H)
456 # include <stdarg.h> /* for va_list */
462 # include <stddef.h> /* for wchar_t */
466 /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
467 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
468 * though the former does not conform to the LFS document), but considering
469 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
470 * equivalently requesting no 64-bit operations
472 #if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
473 # undef _LARGEFILE64_SOURCE
476 #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
477 # define Z_HAVE_UNISTD_H
480 # if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
481 # include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
483 # include <unixio.h> /* for off_t */
486 # define z_off_t off_t
491 #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
495 #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
499 #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
503 #if !defined(SEEK_SET) && !defined(Z_SOLO)
504 # define SEEK_SET 0 /* Seek from beginning of file. */
505 # define SEEK_CUR 1 /* Seek from current position. */
506 # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
510 * This is hard-configured for FreeBSD.
513 # include <sys/types.h> /* for off_t */
515 #define z_off_t off_t
516 #ifndef _FILE_OFFSET_BITS
517 #define _FILE_OFFSET_BITS 64
521 # define z_off_t long
524 #if !defined(_WIN32) && defined(Z_LARGE64)
525 # define z_off64_t off64_t
527 # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
528 # define z_off64_t __int64
530 # define z_off64_t z_off_t
534 /* MVS linker does not support external names larger than 8 bytes */
536 #pragma map(deflateInit_,"DEIN")
537 #pragma map(deflateInit2_,"DEIN2")
538 #pragma map(deflateEnd,"DEEND")
539 #pragma map(deflateBound,"DEBND")
540 #pragma map(inflateInit_,"ININ")
541 #pragma map(inflateInit2_,"ININ2")
542 #pragma map(inflateEnd,"INEND")
543 #pragma map(inflateSync,"INSY")
544 #pragma map(inflateSetDictionary,"INSEDI")
545 #pragma map(compressBound,"CMBND")
546 #pragma map(inflate_table,"INTABL")
547 #pragma map(inflate_fast,"INFA")
548 #pragma map(inflate_copyright,"INCOPY")