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-2016 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 /* for _LP64 */ 36 #include <sys/types.h> 37 38 /* 39 * If you *really* need a unique prefix for all types and library functions, 40 * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. 41 * Even better than compiling with -DZ_PREFIX would be to use configure to set 42 * this permanently in zconf.h using "./configure --zprefix". 43 */ 44 #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ 45 # define Z_PREFIX_SET 46 47 /* all linked symbols and init macros */ 48 # define _dist_code z__dist_code 49 # define _length_code z__length_code 50 # define _tr_align z__tr_align 51 # define _tr_flush_bits z__tr_flush_bits 52 # define _tr_flush_block z__tr_flush_block 53 # define _tr_init z__tr_init 54 # define _tr_stored_block z__tr_stored_block 55 # define _tr_tally z__tr_tally 56 # define adler32 z_adler32 57 # define adler32_combine z_adler32_combine 58 # define adler32_combine64 z_adler32_combine64 59 # define adler32_z z_adler32_z 60 # ifndef Z_SOLO 61 # define compress z_compress 62 # define compress2 z_compress2 63 # define compressBound z_compressBound 64 # endif 65 # define crc32 z_crc32 66 # define crc32_combine z_crc32_combine 67 # define crc32_combine64 z_crc32_combine64 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 typedef unsigned long z_size_t; 269 #else 270 # define z_longlong long long 271 # if defined(NO_SIZE_T) 272 typedef unsigned NO_SIZE_T z_size_t; 273 # elif defined(STDC) 274 # include <stddef.h> 275 typedef size_t z_size_t; 276 # else 277 typedef unsigned long z_size_t; 278 # endif 279 # undef z_longlong 280 #endif 281 282 /* Maximum value for memLevel in deflateInit2 */ 283 #ifndef MAX_MEM_LEVEL 284 # ifdef MAXSEG_64K 285 # define MAX_MEM_LEVEL 8 286 # else 287 # define MAX_MEM_LEVEL 9 288 # endif 289 #endif 290 291 /* Maximum value for windowBits in deflateInit2 and inflateInit2. 292 * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files 293 * created by gzip. (Files created by minigzip can still be extracted by 294 * gzip.) 295 */ 296 #ifndef MAX_WBITS 297 # define MAX_WBITS 15 /* 32K LZ77 window */ 298 #endif 299 300 /* The memory requirements for deflate are (in bytes): 301 (1 << (windowBits+2)) + (1 << (memLevel+9)) 302 that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) 303 plus a few kilobytes for small objects. For example, if you want to reduce 304 the default memory requirements from 256K to 128K, compile with 305 make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" 306 Of course this will generally degrade compression (there's no free lunch). 307 308 The memory requirements for inflate are (in bytes) 1 << windowBits 309 that is, 32K for windowBits=15 (default value) plus about 7 kilobytes 310 for small objects. 311 */ 312 313 /* Type declarations */ 314 315 #ifndef OF /* function prototypes */ 316 # ifdef STDC 317 # define OF(args) args 318 # else 319 # define OF(args) () 320 # endif 321 #endif 322 323 #ifndef Z_ARG /* function prototypes for stdarg */ 324 # if defined(STDC) || defined(Z_HAVE_STDARG_H) 325 # define Z_ARG(args) args 326 # else 327 # define Z_ARG(args) () 328 # endif 329 #endif 330 331 /* The following definitions for FAR are needed only for MSDOS mixed 332 * model programming (small or medium model with some far allocations). 333 * This was tested only with MSC; for other MSDOS compilers you may have 334 * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, 335 * just define FAR to be empty. 336 */ 337 #ifdef SYS16BIT 338 # if defined(M_I86SM) || defined(M_I86MM) 339 /* MSC small or medium model */ 340 # define SMALL_MEDIUM 341 # ifdef _MSC_VER 342 # define FAR _far 343 # else 344 # define FAR far 345 # endif 346 # endif 347 # if (defined(__SMALL__) || defined(__MEDIUM__)) 348 /* Turbo C small or medium model */ 349 # define SMALL_MEDIUM 350 # ifdef __BORLANDC__ 351 # define FAR _far 352 # else 353 # define FAR far 354 # endif 355 # endif 356 #endif 357 358 #if defined(WINDOWS) || defined(WIN32) 359 /* If building or using zlib as a DLL, define ZLIB_DLL. 360 * This is not mandatory, but it offers a little performance increase. 361 */ 362 # ifdef ZLIB_DLL 363 # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) 364 # ifdef ZLIB_INTERNAL 365 # define ZEXTERN extern __declspec(dllexport) 366 # else 367 # define ZEXTERN extern __declspec(dllimport) 368 # endif 369 # endif 370 # endif /* ZLIB_DLL */ 371 /* If building or using zlib with the WINAPI/WINAPIV calling convention, 372 * define ZLIB_WINAPI. 373 * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. 374 */ 375 # ifdef ZLIB_WINAPI 376 # ifdef FAR 377 # undef FAR 378 # endif 379 # include <windows.h> 380 /* No need for _export, use ZLIB.DEF instead. */ 381 /* For complete Windows compatibility, use WINAPI, not __stdcall. */ 382 # define ZEXPORT WINAPI 383 # ifdef WIN32 384 # define ZEXPORTVA WINAPIV 385 # else 386 # define ZEXPORTVA FAR CDECL 387 # endif 388 # endif 389 #endif 390 391 #if defined (__BEOS__) 392 # ifdef ZLIB_DLL 393 # ifdef ZLIB_INTERNAL 394 # define ZEXPORT __declspec(dllexport) 395 # define ZEXPORTVA __declspec(dllexport) 396 # else 397 # define ZEXPORT __declspec(dllimport) 398 # define ZEXPORTVA __declspec(dllimport) 399 # endif 400 # endif 401 #endif 402 403 #ifndef ZEXTERN 404 # define ZEXTERN extern 405 #endif 406 #ifndef ZEXPORT 407 # define ZEXPORT 408 #endif 409 #ifndef ZEXPORTVA 410 # define ZEXPORTVA 411 #endif 412 413 #ifndef FAR 414 # define FAR 415 #endif 416 417 #if !defined(__MACTYPES__) 418 typedef unsigned char Byte; /* 8 bits */ 419 #endif 420 typedef unsigned int uInt; /* 16 bits or more */ 421 422 #ifdef _LP64 423 typedef unsigned int uLong; /* 32 bits or more */ 424 #else 425 typedef unsigned long uLong; /* 32 bits or more */ 426 #endif 427 428 #ifdef SMALL_MEDIUM 429 /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ 430 # define Bytef Byte FAR 431 #else 432 typedef Byte FAR Bytef; 433 #endif 434 typedef char FAR charf; 435 typedef int FAR intf; 436 typedef uInt FAR uIntf; 437 typedef uLong FAR uLongf; 438 439 #ifdef STDC 440 typedef void const *voidpc; 441 typedef void FAR *voidpf; 442 typedef void *voidp; 443 #else 444 typedef Byte const *voidpc; 445 typedef Byte FAR *voidpf; 446 typedef Byte *voidp; 447 #endif 448 449 #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) 450 # include <limits.h> 451 # if (UINT_MAX == 0xffffffffUL) 452 # define Z_U4 unsigned 453 # elif (ULONG_MAX == 0xffffffffUL) 454 # define Z_U4 unsigned long 455 # elif (USHRT_MAX == 0xffffffffUL) 456 # define Z_U4 unsigned short 457 # endif 458 #endif 459 460 #ifdef Z_U4 461 typedef Z_U4 z_crc_t; 462 #else 463 typedef unsigned long z_crc_t; 464 #endif 465 466 #ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ 467 # define Z_HAVE_UNISTD_H 468 #endif 469 470 #ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ 471 # define Z_HAVE_STDARG_H 472 #endif 473 474 #ifdef STDC 475 # ifndef Z_SOLO 476 # include <sys/types.h> /* for off_t */ 477 # endif 478 #endif 479 480 #if defined(STDC) || defined(Z_HAVE_STDARG_H) 481 # ifndef Z_SOLO 482 # include <stdarg.h> /* for va_list */ 483 # endif 484 #endif 485 486 #ifdef _WIN32 487 # ifndef Z_SOLO 488 # include <stddef.h> /* for wchar_t */ 489 # endif 490 #endif 491 492 /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and 493 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even 494 * though the former does not conform to the LFS document), but considering 495 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as 496 * equivalently requesting no 64-bit operations 497 */ 498 #if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 499 # undef _LARGEFILE64_SOURCE 500 #endif 501 502 #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) 503 # define Z_HAVE_UNISTD_H 504 #endif 505 #ifndef Z_SOLO 506 # if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) 507 # include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ 508 # ifdef VMS 509 # include <unixio.h> /* for off_t */ 510 # endif 511 # ifndef z_off_t 512 # define z_off_t off_t 513 # endif 514 # endif 515 #endif 516 517 #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 518 # define Z_LFS64 519 #endif 520 521 #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) 522 # define Z_LARGE64 523 #endif 524 525 #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) 526 # define Z_WANT64 527 #endif 528 529 #if !defined(SEEK_SET) && !defined(Z_SOLO) 530 # define SEEK_SET 0 /* Seek from beginning of file. */ 531 # define SEEK_CUR 1 /* Seek from current position. */ 532 # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ 533 #endif 534 535 #ifndef z_off_t 536 # define z_off_t long 537 #endif 538 539 #if !defined(_WIN32) && defined(Z_LARGE64) 540 # define z_off64_t off64_t 541 #else 542 # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) 543 # define z_off64_t __int64 544 # else 545 # define z_off64_t z_off_t 546 # endif 547 #endif 548 549 /* MVS linker does not support external names larger than 8 bytes */ 550 #if defined(__MVS__) 551 #pragma map(deflateInit_,"DEIN") 552 #pragma map(deflateInit2_,"DEIN2") 553 #pragma map(deflateEnd,"DEEND") 554 #pragma map(deflateBound,"DEBND") 555 #pragma map(inflateInit_,"ININ") 556 #pragma map(inflateInit2_,"ININ2") 557 #pragma map(inflateEnd,"INEND") 558 #pragma map(inflateSync,"INSY") 559 #pragma map(inflateSetDictionary,"INSEDI") 560 #pragma map(compressBound,"CMBND") 561 #pragma map(inflate_table,"INTABL") 562 #pragma map(inflate_fast,"INFA") 563 #pragma map(inflate_copyright,"INCOPY") 564 #endif 565 566 #endif /* ZCONF_H */