zconf.h 17 KB

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