1 /*
  2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  3  *
  4  * This code is free software; you can redistribute it and/or modify it
  5  * under the terms of the GNU General Public License version 2 only, as
  6  * published by the Free Software Foundation.  Oracle designates this
  7  * particular file as subject to the "Classpath" exception as provided
  8  * by Oracle in the LICENSE file that accompanied this code.
  9  *
 10  * This code is distributed in the hope that it will be useful, but WITHOUT
 11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 13  * version 2 for more details (a copy is included in the LICENSE file that
 14  * accompanied this code).
 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.
 23  */
 24 
 25 /* zconf.h -- configuration of the zlib compression library
 26  * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
 27  * For conditions of distribution and use, see copyright notice in zlib.h
 28  */
 29 
 30 /* @(#) $Id$ */
 31 
 32 #ifndef ZCONF_H
 33 #define ZCONF_H
 34 
 35 /*
 36  * If you *really* need a unique prefix for all types and library functions,
 37  * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
 38  * Even better than compiling with -DZ_PREFIX would be to use configure to set
 39  * this permanently in zconf.h using "./configure --zprefix".
 40  */
 41 #ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */
 42 #  define Z_PREFIX_SET
 43 
 44 /* all linked symbols and init macros */
 45 #  define _dist_code            z__dist_code
 46 #  define _length_code          z__length_code
 47 #  define _tr_align             z__tr_align
 48 #  define _tr_flush_bits        z__tr_flush_bits
 49 #  define _tr_flush_block       z__tr_flush_block
 50 #  define _tr_init              z__tr_init
 51 #  define _tr_stored_block      z__tr_stored_block
 52 #  define _tr_tally             z__tr_tally
 53 #  define adler32               z_adler32
 54 #  define adler32_combine       z_adler32_combine
 55 #  define adler32_combine64     z_adler32_combine64
 56 #  define adler32_z             z_adler32_z
 57 #  ifndef Z_SOLO
 58 #    define compress              z_compress
 59 #    define compress2             z_compress2
 60 #    define compressBound         z_compressBound
 61 #  endif
 62 #  define crc32                 z_crc32
 63 #  define crc32_combine         z_crc32_combine
 64 #  define crc32_combine64       z_crc32_combine64
 65 #  define crc32_combine_gen     z_crc32_combine_gen
 66 #  define crc32_combine_gen64   z_crc32_combine_gen64
 67 #  define crc32_combine_op      z_crc32_combine_op
 68 #  define crc32_z               z_crc32_z
 69 #  define deflate               z_deflate
 70 #  define deflateBound          z_deflateBound
 71 #  define deflateCopy           z_deflateCopy
 72 #  define deflateEnd            z_deflateEnd
 73 #  define deflateGetDictionary  z_deflateGetDictionary
 74 #  define deflateInit           z_deflateInit
 75 #  define deflateInit2          z_deflateInit2
 76 #  define deflateInit2_         z_deflateInit2_
 77 #  define deflateInit_          z_deflateInit_
 78 #  define deflateParams         z_deflateParams
 79 #  define deflatePending        z_deflatePending
 80 #  define deflatePrime          z_deflatePrime
 81 #  define deflateReset          z_deflateReset
 82 #  define deflateResetKeep      z_deflateResetKeep
 83 #  define deflateSetDictionary  z_deflateSetDictionary
 84 #  define deflateSetHeader      z_deflateSetHeader
 85 #  define deflateTune           z_deflateTune
 86 #  define deflate_copyright     z_deflate_copyright
 87 #  define get_crc_table         z_get_crc_table
 88 #  ifndef Z_SOLO
 89 #    define gz_error              z_gz_error
 90 #    define gz_intmax             z_gz_intmax
 91 #    define gz_strwinerror        z_gz_strwinerror
 92 #    define gzbuffer              z_gzbuffer
 93 #    define gzclearerr            z_gzclearerr
 94 #    define gzclose               z_gzclose
 95 #    define gzclose_r             z_gzclose_r
 96 #    define gzclose_w             z_gzclose_w
 97 #    define gzdirect              z_gzdirect
 98 #    define gzdopen               z_gzdopen
 99 #    define gzeof                 z_gzeof
100 #    define gzerror               z_gzerror
101 #    define gzflush               z_gzflush
102 #    define gzfread               z_gzfread
103 #    define gzfwrite              z_gzfwrite
104 #    define gzgetc                z_gzgetc
105 #    define gzgetc_               z_gzgetc_
106 #    define gzgets                z_gzgets
107 #    define gzoffset              z_gzoffset
108 #    define gzoffset64            z_gzoffset64
109 #    define gzopen                z_gzopen
110 #    define gzopen64              z_gzopen64
111 #    ifdef _WIN32
112 #      define gzopen_w              z_gzopen_w
113 #    endif
114 #    define gzprintf              z_gzprintf
115 #    define gzputc                z_gzputc
116 #    define gzputs                z_gzputs
117 #    define gzread                z_gzread
118 #    define gzrewind              z_gzrewind
119 #    define gzseek                z_gzseek
120 #    define gzseek64              z_gzseek64
121 #    define gzsetparams           z_gzsetparams
122 #    define gztell                z_gztell
123 #    define gztell64              z_gztell64
124 #    define gzungetc              z_gzungetc
125 #    define gzvprintf             z_gzvprintf
126 #    define gzwrite               z_gzwrite
127 #  endif
128 #  define inflate               z_inflate
129 #  define inflateBack           z_inflateBack
130 #  define inflateBackEnd        z_inflateBackEnd
131 #  define inflateBackInit       z_inflateBackInit
132 #  define inflateBackInit_      z_inflateBackInit_
133 #  define inflateCodesUsed      z_inflateCodesUsed
134 #  define inflateCopy           z_inflateCopy
135 #  define inflateEnd            z_inflateEnd
136 #  define inflateGetDictionary  z_inflateGetDictionary
137 #  define inflateGetHeader      z_inflateGetHeader
138 #  define inflateInit           z_inflateInit
139 #  define inflateInit2          z_inflateInit2
140 #  define inflateInit2_         z_inflateInit2_
141 #  define inflateInit_          z_inflateInit_
142 #  define inflateMark           z_inflateMark
143 #  define inflatePrime          z_inflatePrime
144 #  define inflateReset          z_inflateReset
145 #  define inflateReset2         z_inflateReset2
146 #  define inflateResetKeep      z_inflateResetKeep
147 #  define inflateSetDictionary  z_inflateSetDictionary
148 #  define inflateSync           z_inflateSync
149 #  define inflateSyncPoint      z_inflateSyncPoint
150 #  define inflateUndermine      z_inflateUndermine
151 #  define inflateValidate       z_inflateValidate
152 #  define inflate_copyright     z_inflate_copyright
153 #  define inflate_fast          z_inflate_fast
154 #  define inflate_table         z_inflate_table
155 #  ifndef Z_SOLO
156 #    define uncompress            z_uncompress
157 #    define uncompress2           z_uncompress2
158 #  endif
159 #  define zError                z_zError
160 #  ifndef Z_SOLO
161 #    define zcalloc               z_zcalloc
162 #    define zcfree                z_zcfree
163 #  endif
164 #  define zlibCompileFlags      z_zlibCompileFlags
165 #  define zlibVersion           z_zlibVersion
166 
167 /* all zlib typedefs in zlib.h and zconf.h */
168 #  define Byte                  z_Byte
169 #  define Bytef                 z_Bytef
170 #  define alloc_func            z_alloc_func
171 #  define charf                 z_charf
172 #  define free_func             z_free_func
173 #  ifndef Z_SOLO
174 #    define gzFile                z_gzFile
175 #  endif
176 #  define gz_header             z_gz_header
177 #  define gz_headerp            z_gz_headerp
178 #  define in_func               z_in_func
179 #  define intf                  z_intf
180 #  define out_func              z_out_func
181 #  define uInt                  z_uInt
182 #  define uIntf                 z_uIntf
183 #  define uLong                 z_uLong
184 #  define uLongf                z_uLongf
185 #  define voidp                 z_voidp
186 #  define voidpc                z_voidpc
187 #  define voidpf                z_voidpf
188 
189 /* all zlib structs in zlib.h and zconf.h */
190 #  define gz_header_s           z_gz_header_s
191 #  define internal_state        z_internal_state
192 
193 #endif
194 
195 #if defined(__MSDOS__) && !defined(MSDOS)
196 #  define MSDOS
197 #endif
198 #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
199 #  define OS2
200 #endif
201 #if defined(_WINDOWS) && !defined(WINDOWS)
202 #  define WINDOWS
203 #endif
204 #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
205 #  ifndef WIN32
206 #    define WIN32
207 #  endif
208 #endif
209 #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
210 #  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
211 #    ifndef SYS16BIT
212 #      define SYS16BIT
213 #    endif
214 #  endif
215 #endif
216 
217 /*
218  * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
219  * than 64k bytes at a time (needed on systems with 16-bit int).
220  */
221 #ifdef SYS16BIT
222 #  define MAXSEG_64K
223 #endif
224 #ifdef MSDOS
225 #  define UNALIGNED_OK
226 #endif
227 
228 #ifdef __STDC_VERSION__
229 #  ifndef STDC
230 #    define STDC
231 #  endif
232 #  if __STDC_VERSION__ >= 199901L
233 #    ifndef STDC99
234 #      define STDC99
235 #    endif
236 #  endif
237 #endif
238 #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
239 #  define STDC
240 #endif
241 #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
242 #  define STDC
243 #endif
244 #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
245 #  define STDC
246 #endif
247 #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
248 #  define STDC
249 #endif
250 
251 #if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
252 #  define STDC
253 #endif
254 
255 #ifndef STDC
256 #  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
257 #    define const       /* note: need a more gentle solution here */
258 #  endif
259 #endif
260 
261 #if defined(ZLIB_CONST) && !defined(z_const)
262 #  define z_const const
263 #else
264 #  define z_const
265 #endif
266 
267 #ifdef Z_SOLO
268 #  ifdef _WIN64
269      typedef unsigned long long z_size_t;
270 #  else
271      typedef unsigned long z_size_t;
272 #  endif
273 #else
274 #  define z_longlong long long
275 #  if defined(NO_SIZE_T)
276      typedef unsigned NO_SIZE_T z_size_t;
277 #  elif defined(STDC)
278 #    include <stddef.h>
279      typedef size_t z_size_t;
280 #  else
281      typedef unsigned long z_size_t;
282 #  endif
283 #  undef z_longlong
284 #endif
285 
286 /* Maximum value for memLevel in deflateInit2 */
287 #ifndef MAX_MEM_LEVEL
288 #  ifdef MAXSEG_64K
289 #    define MAX_MEM_LEVEL 8
290 #  else
291 #    define MAX_MEM_LEVEL 9
292 #  endif
293 #endif
294 
295 /* Maximum value for windowBits in deflateInit2 and inflateInit2.
296  * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
297  * created by gzip. (Files created by minigzip can still be extracted by
298  * gzip.)
299  */
300 #ifndef MAX_WBITS
301 #  define MAX_WBITS   15 /* 32K LZ77 window */
302 #endif
303 
304 /* The memory requirements for deflate are (in bytes):
305             (1 << (windowBits+2)) +  (1 << (memLevel+9))
306  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
307  plus a few kilobytes for small objects. For example, if you want to reduce
308  the default memory requirements from 256K to 128K, compile with
309      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
310  Of course this will generally degrade compression (there's no free lunch).
311 
312    The memory requirements for inflate are (in bytes) 1 << windowBits
313  that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
314  for small objects.
315 */
316 
317                         /* Type declarations */
318 
319 #ifndef OF /* function prototypes */
320 #  ifdef STDC
321 #    define OF(args)  args
322 #  else
323 #    define OF(args)  ()
324 #  endif
325 #endif
326 
327 /* The following definitions for FAR are needed only for MSDOS mixed
328  * model programming (small or medium model with some far allocations).
329  * This was tested only with MSC; for other MSDOS compilers you may have
330  * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
331  * just define FAR to be empty.
332  */
333 #ifdef SYS16BIT
334 #  if defined(M_I86SM) || defined(M_I86MM)
335      /* MSC small or medium model */
336 #    define SMALL_MEDIUM
337 #    ifdef _MSC_VER
338 #      define FAR _far
339 #    else
340 #      define FAR far
341 #    endif
342 #  endif
343 #  if (defined(__SMALL__) || defined(__MEDIUM__))
344      /* Turbo C small or medium model */
345 #    define SMALL_MEDIUM
346 #    ifdef __BORLANDC__
347 #      define FAR _far
348 #    else
349 #      define FAR far
350 #    endif
351 #  endif
352 #endif
353 
354 #if defined(WINDOWS) || defined(WIN32)
355    /* If building or using zlib as a DLL, define ZLIB_DLL.
356     * This is not mandatory, but it offers a little performance increase.
357     */
358 #  ifdef ZLIB_DLL
359 #    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
360 #      ifdef ZLIB_INTERNAL
361 #        define ZEXTERN extern __declspec(dllexport)
362 #      else
363 #        define ZEXTERN extern __declspec(dllimport)
364 #      endif
365 #    endif
366 #  endif  /* ZLIB_DLL */
367    /* If building or using zlib with the WINAPI/WINAPIV calling convention,
368     * define ZLIB_WINAPI.
369     * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
370     */
371 #  ifdef ZLIB_WINAPI
372 #    ifdef FAR
373 #      undef FAR
374 #    endif
375 #    ifndef WIN32_LEAN_AND_MEAN
376 #      define WIN32_LEAN_AND_MEAN
377 #    endif
378 #    include <windows.h>
379      /* No need for _export, use ZLIB.DEF instead. */
380      /* For complete Windows compatibility, use WINAPI, not __stdcall. */
381 #    define ZEXPORT WINAPI
382 #    ifdef WIN32
383 #      define ZEXPORTVA WINAPIV
384 #    else
385 #      define ZEXPORTVA FAR CDECL
386 #    endif
387 #  endif
388 #endif
389 
390 #if defined (__BEOS__)
391 #  ifdef ZLIB_DLL
392 #    ifdef ZLIB_INTERNAL
393 #      define ZEXPORT   __declspec(dllexport)
394 #      define ZEXPORTVA __declspec(dllexport)
395 #    else
396 #      define ZEXPORT   __declspec(dllimport)
397 #      define ZEXPORTVA __declspec(dllimport)
398 #    endif
399 #  endif
400 #endif
401 
402 #ifndef ZEXTERN
403 #  define ZEXTERN extern
404 #endif
405 #ifndef ZEXPORT
406 #  define ZEXPORT
407 #endif
408 #ifndef ZEXPORTVA
409 #  define ZEXPORTVA
410 #endif
411 
412 #ifndef FAR
413 #  define FAR
414 #endif
415 
416 #if !defined(__MACTYPES__)
417 typedef unsigned char  Byte;  /* 8 bits */
418 #endif
419 typedef unsigned int   uInt;  /* 16 bits or more */
420 typedef unsigned long  uLong; /* 32 bits or more */
421 
422 #ifdef SMALL_MEDIUM
423    /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
424 #  define Bytef Byte FAR
425 #else
426    typedef Byte  FAR Bytef;
427 #endif
428 typedef char  FAR charf;
429 typedef int   FAR intf;
430 typedef uInt  FAR uIntf;
431 typedef uLong FAR uLongf;
432 
433 #ifdef STDC
434    typedef void const *voidpc;
435    typedef void FAR   *voidpf;
436    typedef void       *voidp;
437 #else
438    typedef Byte const *voidpc;
439    typedef Byte FAR   *voidpf;
440    typedef Byte       *voidp;
441 #endif
442 
443 #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
444 #  include <limits.h>
445 #  if (UINT_MAX == 0xffffffffUL)
446 #    define Z_U4 unsigned
447 #  elif (ULONG_MAX == 0xffffffffUL)
448 #    define Z_U4 unsigned long
449 #  elif (USHRT_MAX == 0xffffffffUL)
450 #    define Z_U4 unsigned short
451 #  endif
452 #endif
453 
454 #ifdef Z_U4
455    typedef Z_U4 z_crc_t;
456 #else
457    typedef unsigned long z_crc_t;
458 #endif
459 
460 #ifdef HAVE_UNISTD_H    /* may be set to #if 1 by ./configure */
461 #  define Z_HAVE_UNISTD_H
462 #endif
463 
464 #ifdef HAVE_STDARG_H    /* may be set to #if 1 by ./configure */
465 #  define Z_HAVE_STDARG_H
466 #endif
467 
468 #ifdef STDC
469 #  ifndef Z_SOLO
470 #    include <sys/types.h>      /* for off_t */
471 #  endif
472 #endif
473 
474 #if defined(STDC) || defined(Z_HAVE_STDARG_H)
475 #  ifndef Z_SOLO
476 #    include <stdarg.h>         /* for va_list */
477 #  endif
478 #endif
479 
480 #ifdef _WIN32
481 #  ifndef Z_SOLO
482 #    include <stddef.h>         /* for wchar_t */
483 #  endif
484 #endif
485 
486 /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
487  * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
488  * though the former does not conform to the LFS document), but considering
489  * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
490  * equivalently requesting no 64-bit operations
491  */
492 #if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
493 #  undef _LARGEFILE64_SOURCE
494 #endif
495 
496 #ifndef Z_HAVE_UNISTD_H
497 #  ifdef __WATCOMC__
498 #    define Z_HAVE_UNISTD_H
499 #  endif
500 #endif
501 #ifndef Z_HAVE_UNISTD_H
502 #  if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)
503 #    define Z_HAVE_UNISTD_H
504 #  endif
505 #endif
506 #ifndef Z_SOLO
507 #  if defined(Z_HAVE_UNISTD_H)
508 #    include <unistd.h>         /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
509 #    ifdef VMS
510 #      include <unixio.h>       /* for off_t */
511 #    endif
512 #    ifndef z_off_t
513 #      define z_off_t off_t
514 #    endif
515 #  endif
516 #endif
517 
518 #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
519 #  define Z_LFS64
520 #endif
521 
522 #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
523 #  define Z_LARGE64
524 #endif
525 
526 #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
527 #  define Z_WANT64
528 #endif
529 
530 #if !defined(SEEK_SET) && !defined(Z_SOLO)
531 #  define SEEK_SET        0       /* Seek from beginning of file.  */
532 #  define SEEK_CUR        1       /* Seek from current position.  */
533 #  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
534 #endif
535 
536 #ifndef z_off_t
537 #  define z_off_t long
538 #endif
539 
540 #if !defined(_WIN32) && defined(Z_LARGE64)
541 #  define z_off64_t off64_t
542 #else
543 #  if defined(_WIN32) && !defined(__GNUC__)
544 #    define z_off64_t __int64
545 #  else
546 #    define z_off64_t z_off_t
547 #  endif
548 #endif
549 
550 /* MVS linker does not support external names larger than 8 bytes */
551 #if defined(__MVS__)
552   #pragma map(deflateInit_,"DEIN")
553   #pragma map(deflateInit2_,"DEIN2")
554   #pragma map(deflateEnd,"DEEND")
555   #pragma map(deflateBound,"DEBND")
556   #pragma map(inflateInit_,"ININ")
557   #pragma map(inflateInit2_,"ININ2")
558   #pragma map(inflateEnd,"INEND")
559   #pragma map(inflateSync,"INSY")
560   #pragma map(inflateSetDictionary,"INSEDI")
561   #pragma map(compressBound,"CMBND")
562   #pragma map(inflate_table,"INTABL")
563   #pragma map(inflate_fast,"INFA")
564   #pragma map(inflate_copyright,"INCOPY")
565 #endif
566 
567 #endif /* ZCONF_H */