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