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