Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* zconf.h -- configuration of the zlib compression library |
michael@0 | 2 | * Copyright (C) 1995-1996 Jean-loup Gailly. |
michael@0 | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
michael@0 | 4 | */ |
michael@0 | 5 | /* This file was modified since it was taken from the zlib distribution */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef _ZCONF_H |
michael@0 | 8 | #define _ZCONF_H |
michael@0 | 9 | |
michael@0 | 10 | /* |
michael@0 | 11 | * If you *really* need a unique prefix for all types and library functions, |
michael@0 | 12 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. |
michael@0 | 13 | */ |
michael@0 | 14 | #ifdef Z_PREFIX |
michael@0 | 15 | # define deflateInit_ z_deflateInit_ |
michael@0 | 16 | # define deflate z_deflate |
michael@0 | 17 | # define deflateEnd z_deflateEnd |
michael@0 | 18 | # define inflateInit_ z_inflateInit_ |
michael@0 | 19 | # define inflate z_inflate |
michael@0 | 20 | # define inflateEnd z_inflateEnd |
michael@0 | 21 | # define deflateInit2_ z_deflateInit2_ |
michael@0 | 22 | # define deflateSetDictionary z_deflateSetDictionary |
michael@0 | 23 | # define deflateCopy z_deflateCopy |
michael@0 | 24 | # define deflateReset z_deflateReset |
michael@0 | 25 | # define deflateParams z_deflateParams |
michael@0 | 26 | # define inflateInit2_ z_inflateInit2_ |
michael@0 | 27 | # define inflateSetDictionary z_inflateSetDictionary |
michael@0 | 28 | # define inflateSync z_inflateSync |
michael@0 | 29 | # define inflateReset z_inflateReset |
michael@0 | 30 | # define compress z_compress |
michael@0 | 31 | # define uncompress z_uncompress |
michael@0 | 32 | # define adler32 z_adler32 |
michael@0 | 33 | # define crc32 z_crc32 |
michael@0 | 34 | # define get_crc_table z_get_crc_table |
michael@0 | 35 | |
michael@0 | 36 | # define Byte z_Byte |
michael@0 | 37 | # define uInt z_uInt |
michael@0 | 38 | # define uLong z_uLong |
michael@0 | 39 | # define Bytef z_Bytef |
michael@0 | 40 | # define charf z_charf |
michael@0 | 41 | # define intf z_intf |
michael@0 | 42 | # define uIntf z_uIntf |
michael@0 | 43 | # define uLongf z_uLongf |
michael@0 | 44 | # define voidpf z_voidpf |
michael@0 | 45 | # define voidp z_voidp |
michael@0 | 46 | #endif |
michael@0 | 47 | |
michael@0 | 48 | #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) |
michael@0 | 49 | # define WIN32 |
michael@0 | 50 | #endif |
michael@0 | 51 | #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) |
michael@0 | 52 | # ifndef __32BIT__ |
michael@0 | 53 | # define __32BIT__ |
michael@0 | 54 | # endif |
michael@0 | 55 | #endif |
michael@0 | 56 | #if defined(__MSDOS__) && !defined(MSDOS) |
michael@0 | 57 | # define MSDOS |
michael@0 | 58 | #endif |
michael@0 | 59 | |
michael@0 | 60 | /* |
michael@0 | 61 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more |
michael@0 | 62 | * than 64k bytes at a time (needed on systems with 16-bit int). |
michael@0 | 63 | */ |
michael@0 | 64 | #if defined(MSDOS) && !defined(__32BIT__) |
michael@0 | 65 | # define MAXSEG_64K |
michael@0 | 66 | #endif |
michael@0 | 67 | #ifdef MSDOS |
michael@0 | 68 | # define UNALIGNED_OK |
michael@0 | 69 | #endif |
michael@0 | 70 | |
michael@0 | 71 | #if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32) || defined(XP_OS2)) && !defined(STDC) |
michael@0 | 72 | # define STDC |
michael@0 | 73 | #endif |
michael@0 | 74 | #if (defined(__STDC__) || defined(__cplusplus)) && !defined(STDC) |
michael@0 | 75 | # define STDC |
michael@0 | 76 | #endif |
michael@0 | 77 | |
michael@0 | 78 | #ifndef STDC |
michael@0 | 79 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ |
michael@0 | 80 | # define const |
michael@0 | 81 | # endif |
michael@0 | 82 | #endif |
michael@0 | 83 | |
michael@0 | 84 | /* Some Mac compilers merge all .h files incorrectly: */ |
michael@0 | 85 | #if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) |
michael@0 | 86 | # define NO_DUMMY_DECL |
michael@0 | 87 | #endif |
michael@0 | 88 | |
michael@0 | 89 | /* Maximum value for memLevel in deflateInit2 */ |
michael@0 | 90 | #ifndef MAX_MEM_LEVEL |
michael@0 | 91 | # ifdef MAXSEG_64K |
michael@0 | 92 | # define MAX_MEM_LEVEL 8 |
michael@0 | 93 | # else |
michael@0 | 94 | # define MAX_MEM_LEVEL 9 |
michael@0 | 95 | # endif |
michael@0 | 96 | #endif |
michael@0 | 97 | |
michael@0 | 98 | /* Maximum value for windowBits in deflateInit2 and inflateInit2 */ |
michael@0 | 99 | #ifndef MAX_WBITS |
michael@0 | 100 | # define MAX_WBITS 15 /* 32K LZ77 window */ |
michael@0 | 101 | #endif |
michael@0 | 102 | |
michael@0 | 103 | /* The memory requirements for deflate are (in bytes): |
michael@0 | 104 | 1 << (windowBits+2) + 1 << (memLevel+9) |
michael@0 | 105 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) |
michael@0 | 106 | plus a few kilobytes for small objects. For example, if you want to reduce |
michael@0 | 107 | the default memory requirements from 256K to 128K, compile with |
michael@0 | 108 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" |
michael@0 | 109 | Of course this will generally degrade compression (there's no free lunch). |
michael@0 | 110 | |
michael@0 | 111 | The memory requirements for inflate are (in bytes) 1 << windowBits |
michael@0 | 112 | that is, 32K for windowBits=15 (default value) plus a few kilobytes |
michael@0 | 113 | for small objects. |
michael@0 | 114 | */ |
michael@0 | 115 | |
michael@0 | 116 | /* Type declarations */ |
michael@0 | 117 | |
michael@0 | 118 | #ifndef OF /* function prototypes */ |
michael@0 | 119 | # ifdef STDC |
michael@0 | 120 | # define OF(args) args |
michael@0 | 121 | # else |
michael@0 | 122 | # define OF(args) () |
michael@0 | 123 | # endif |
michael@0 | 124 | #endif |
michael@0 | 125 | |
michael@0 | 126 | /* The following definitions for FAR are needed only for MSDOS mixed |
michael@0 | 127 | * model programming (small or medium model with some far allocations). |
michael@0 | 128 | * This was tested only with MSC; for other MSDOS compilers you may have |
michael@0 | 129 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, |
michael@0 | 130 | * just define FAR to be empty. |
michael@0 | 131 | */ |
michael@0 | 132 | #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) |
michael@0 | 133 | /* MSC small or medium model */ |
michael@0 | 134 | # define SMALL_MEDIUM |
michael@0 | 135 | # ifdef _MSC_VER |
michael@0 | 136 | # define FAR __far |
michael@0 | 137 | # else |
michael@0 | 138 | # define FAR far |
michael@0 | 139 | # endif |
michael@0 | 140 | #endif |
michael@0 | 141 | #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) |
michael@0 | 142 | # ifndef __32BIT__ |
michael@0 | 143 | # define SMALL_MEDIUM |
michael@0 | 144 | # define FAR __far |
michael@0 | 145 | # endif |
michael@0 | 146 | #endif |
michael@0 | 147 | #ifndef FAR |
michael@0 | 148 | # define FAR |
michael@0 | 149 | #endif |
michael@0 | 150 | |
michael@0 | 151 | typedef unsigned char Byte; /* 8 bits */ |
michael@0 | 152 | typedef unsigned int uInt; /* 16 bits or more */ |
michael@0 | 153 | typedef unsigned long uLong; /* 32 bits or more */ |
michael@0 | 154 | |
michael@0 | 155 | #if defined(__BORLANDC__) && defined(SMALL_MEDIUM) |
michael@0 | 156 | /* Borland C/C++ ignores FAR inside typedef */ |
michael@0 | 157 | # define Bytef Byte FAR |
michael@0 | 158 | #else |
michael@0 | 159 | typedef Byte FAR Bytef; |
michael@0 | 160 | #endif |
michael@0 | 161 | typedef char FAR charf; |
michael@0 | 162 | typedef int FAR intf; |
michael@0 | 163 | typedef uInt FAR uIntf; |
michael@0 | 164 | typedef uLong FAR uLongf; |
michael@0 | 165 | |
michael@0 | 166 | #ifdef STDC |
michael@0 | 167 | typedef void FAR *voidpf; |
michael@0 | 168 | typedef void *voidp; |
michael@0 | 169 | #else |
michael@0 | 170 | typedef Byte FAR *voidpf; |
michael@0 | 171 | typedef Byte *voidp; |
michael@0 | 172 | #endif |
michael@0 | 173 | |
michael@0 | 174 | #ifdef MOZILLA_CLIENT |
michael@0 | 175 | #include "prtypes.h" |
michael@0 | 176 | #else |
michael@0 | 177 | /* Compile with -DZLIB_DLL for Windows DLL support */ |
michael@0 | 178 | #if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL) |
michael@0 | 179 | # include <windows.h> |
michael@0 | 180 | # define EXPORT WINAPI |
michael@0 | 181 | #else |
michael@0 | 182 | # define EXPORT |
michael@0 | 183 | #endif |
michael@0 | 184 | |
michael@0 | 185 | #define PR_PUBLIC_API(type) type |
michael@0 | 186 | |
michael@0 | 187 | #endif /* MOZILLA_CLIENT */ |
michael@0 | 188 | |
michael@0 | 189 | #endif /* _ZCONF_H */ |