OLD | NEW |
1 /* zutil.h -- internal interface and configuration of the compression library | 1 /* zutil.h -- internal interface and configuration of the compression library |
2 * Copyright (C) 1995-2005 Jean-loup Gailly. | 2 * Copyright (C) 1995-2010 Jean-loup Gailly. |
3 * For conditions of distribution and use, see copyright notice in zlib.h | 3 * For conditions of distribution and use, see copyright notice in zlib.h |
4 */ | 4 */ |
5 | 5 |
6 /* WARNING: this file should *not* be used by applications. It is | 6 /* WARNING: this file should *not* be used by applications. It is |
7 part of the implementation of the compression library and is | 7 part of the implementation of the compression library and is |
8 subject to change. Applications should only use zlib.h. | 8 subject to change. Applications should only use zlib.h. |
9 */ | 9 */ |
10 | 10 |
11 /* @(#) $Id: zutil.h,v 3.10 2005/08/04 19:14:14 tor%cs.brown.edu Exp $ */ | 11 /* @(#) $Id$ */ |
12 | 12 |
13 #ifndef ZUTIL_H | 13 #ifndef ZUTIL_H |
14 #define ZUTIL_H | 14 #define ZUTIL_H |
15 | 15 |
16 #define ZLIB_INTERNAL | 16 #if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) |
| 17 # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) |
| 18 #else |
| 19 # define ZLIB_INTERNAL |
| 20 #endif |
| 21 |
17 #include "zlib.h" | 22 #include "zlib.h" |
18 | 23 |
19 #ifdef STDC | 24 #ifdef STDC |
20 # ifndef _WIN32_WCE | 25 # if !(defined(_WIN32_WCE) && defined(_MSC_VER)) |
21 # include <stddef.h> | 26 # include <stddef.h> |
22 # endif | 27 # endif |
23 # include <string.h> | 28 # include <string.h> |
24 # include <stdlib.h> | 29 # include <stdlib.h> |
25 #endif | 30 #endif |
26 #ifdef NO_ERRNO_H | 31 #ifdef NO_ERRNO_H |
27 # ifdef _WIN32_WCE | 32 # ifdef _WIN32_WCE |
28 /* The Microsoft C Run-Time Library for Windows CE doesn't have | 33 /* The Microsoft C Run-Time Library for Windows CE doesn't have |
29 * errno. We define it as a global variable to simplify porting. | 34 * errno. We define it as a global variable to simplify porting. |
30 * Its value is always 0 and should not be used. We rename it to | 35 * Its value is always 0 and should not be used. We rename it to |
(...skipping 51 matching lines...) Loading... |
82 #define MAX_MATCH 258 | 87 #define MAX_MATCH 258 |
83 /* The minimum and maximum match lengths */ | 88 /* The minimum and maximum match lengths */ |
84 | 89 |
85 #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ | 90 #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ |
86 | 91 |
87 /* target dependencies */ | 92 /* target dependencies */ |
88 | 93 |
89 #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) | 94 #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) |
90 # define OS_CODE 0x00 | 95 # define OS_CODE 0x00 |
91 # if defined(__TURBOC__) || defined(__BORLANDC__) | 96 # if defined(__TURBOC__) || defined(__BORLANDC__) |
92 # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) | 97 # if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) |
93 /* Allow compilation with ANSI keywords only enabled */ | 98 /* Allow compilation with ANSI keywords only enabled */ |
94 void _Cdecl farfree( void *block ); | 99 void _Cdecl farfree( void *block ); |
95 void *_Cdecl farmalloc( unsigned long nbytes ); | 100 void *_Cdecl farmalloc( unsigned long nbytes ); |
96 # else | 101 # else |
97 # include <alloc.h> | 102 # include <alloc.h> |
98 # endif | 103 # endif |
99 # else /* MSC or DJGPP */ | 104 # else /* MSC or DJGPP */ |
100 # include <malloc.h> | 105 # include <malloc.h> |
101 # endif | 106 # endif |
102 #endif | 107 #endif |
103 | 108 |
104 #ifdef AMIGA | 109 #ifdef AMIGA |
105 # define OS_CODE 0x01 | 110 # define OS_CODE 0x01 |
106 #endif | 111 #endif |
107 | 112 |
108 #if defined(VAXC) || defined(VMS) | 113 #if defined(VAXC) || defined(VMS) |
109 # define OS_CODE 0x02 | 114 # define OS_CODE 0x02 |
110 # define F_OPEN(name, mode) \ | 115 # define F_OPEN(name, mode) \ |
111 fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") | 116 fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") |
112 #endif | 117 #endif |
113 | 118 |
114 #if defined(ATARI) || defined(atarist) | 119 #if defined(ATARI) || defined(atarist) |
115 # define OS_CODE 0x05 | 120 # define OS_CODE 0x05 |
116 #endif | 121 #endif |
117 | 122 |
118 #ifdef OS2 | 123 #ifdef OS2 |
119 # define OS_CODE 0x06 | 124 # define OS_CODE 0x06 |
120 # ifdef M_I86 | 125 # ifdef M_I86 |
121 #include <malloc.h> | 126 # include <malloc.h> |
122 # endif | 127 # endif |
123 #endif | 128 #endif |
124 | 129 |
125 #if defined(MACOS) || defined(TARGET_OS_MAC) | 130 #if defined(MACOS) || defined(TARGET_OS_MAC) |
126 # define OS_CODE 0x07 | 131 # define OS_CODE 0x07 |
127 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os | 132 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os |
128 # include <unix.h> /* for fdopen */ | 133 # include <unix.h> /* for fdopen */ |
129 # else | 134 # else |
130 # ifndef fdopen | 135 # ifndef fdopen |
131 # define fdopen(fd,mode) NULL /* No fdopen() */ | 136 # define fdopen(fd,mode) NULL /* No fdopen() */ |
(...skipping 12 matching lines...) Loading... |
144 #endif | 149 #endif |
145 | 150 |
146 #ifdef __50SERIES /* Prime/PRIMOS */ | 151 #ifdef __50SERIES /* Prime/PRIMOS */ |
147 # define OS_CODE 0x0f | 152 # define OS_CODE 0x0f |
148 #endif | 153 #endif |
149 | 154 |
150 #if defined(_BEOS_) || defined(RISCOS) | 155 #if defined(_BEOS_) || defined(RISCOS) |
151 # define fdopen(fd,mode) NULL /* No fdopen() */ | 156 # define fdopen(fd,mode) NULL /* No fdopen() */ |
152 #endif | 157 #endif |
153 | 158 |
154 #if (defined(_MSC_VER) && (_MSC_VER > 600)) | 159 #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX |
155 # if defined(_WIN32_WCE) | 160 # if defined(_WIN32_WCE) |
156 # define fdopen(fd,mode) NULL /* No fdopen() */ | 161 # define fdopen(fd,mode) NULL /* No fdopen() */ |
157 # ifndef _PTRDIFF_T_DEFINED | 162 # ifndef _PTRDIFF_T_DEFINED |
158 typedef int ptrdiff_t; | 163 typedef int ptrdiff_t; |
159 # define _PTRDIFF_T_DEFINED | 164 # define _PTRDIFF_T_DEFINED |
160 # endif | 165 # endif |
161 # else | 166 # else |
162 # define fdopen(fd,type) _fdopen(fd,type) | 167 # define fdopen(fd,type) _fdopen(fd,type) |
163 # endif | 168 # endif |
164 #endif | 169 #endif |
165 | 170 |
| 171 #if defined(__BORLANDC__) |
| 172 #pragma warn -8004 |
| 173 #pragma warn -8008 |
| 174 #pragma warn -8066 |
| 175 #endif |
| 176 |
| 177 /* provide prototypes for these when building zlib without LFS */ |
| 178 #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 |
| 179 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); |
| 180 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); |
| 181 #endif |
| 182 |
166 /* common defaults */ | 183 /* common defaults */ |
167 | 184 |
168 #ifndef OS_CODE | 185 #ifndef OS_CODE |
169 # define OS_CODE 0x03 /* assume Unix */ | 186 # define OS_CODE 0x03 /* assume Unix */ |
170 #endif | 187 #endif |
171 | 188 |
172 #ifndef F_OPEN | 189 #ifndef F_OPEN |
173 # define F_OPEN(name, mode) fopen((name), (mode)) | 190 # define F_OPEN(name, mode) fopen((name), (mode)) |
174 #endif | 191 #endif |
175 | 192 |
(...skipping 14 matching lines...) Loading... |
190 /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), | 207 /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), |
191 but for now we just assume it doesn't. */ | 208 but for now we just assume it doesn't. */ |
192 # define NO_vsnprintf | 209 # define NO_vsnprintf |
193 # endif | 210 # endif |
194 # ifdef __TURBOC__ | 211 # ifdef __TURBOC__ |
195 # define NO_vsnprintf | 212 # define NO_vsnprintf |
196 # endif | 213 # endif |
197 # ifdef WIN32 | 214 # ifdef WIN32 |
198 /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ | 215 /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ |
199 # if !defined(vsnprintf) && !defined(NO_vsnprintf) | 216 # if !defined(vsnprintf) && !defined(NO_vsnprintf) |
200 # define vsnprintf _vsnprintf | 217 # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) |
| 218 # define vsnprintf _vsnprintf |
| 219 # endif |
201 # endif | 220 # endif |
202 # endif | 221 # endif |
203 # ifdef __SASC | 222 # ifdef __SASC |
204 # define NO_vsnprintf | 223 # define NO_vsnprintf |
205 # endif | 224 # endif |
206 #endif | 225 #endif |
207 #ifdef VMS | 226 #ifdef VMS |
208 # define NO_vsnprintf | 227 # define NO_vsnprintf |
209 #endif | 228 #endif |
210 | 229 |
(...skipping 14 matching lines...) Loading... |
225 # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ | 244 # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ |
226 # define zmemcpy _fmemcpy | 245 # define zmemcpy _fmemcpy |
227 # define zmemcmp _fmemcmp | 246 # define zmemcmp _fmemcmp |
228 # define zmemzero(dest, len) _fmemset(dest, 0, len) | 247 # define zmemzero(dest, len) _fmemset(dest, 0, len) |
229 # else | 248 # else |
230 # define zmemcpy memcpy | 249 # define zmemcpy memcpy |
231 # define zmemcmp memcmp | 250 # define zmemcmp memcmp |
232 # define zmemzero(dest, len) memset(dest, 0, len) | 251 # define zmemzero(dest, len) memset(dest, 0, len) |
233 # endif | 252 # endif |
234 #else | 253 #else |
235 extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); | 254 void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); |
236 extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); | 255 int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); |
237 extern void zmemzero OF((Bytef* dest, uInt len)); | 256 void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); |
238 #endif | 257 #endif |
239 | 258 |
240 /* Diagnostic functions */ | 259 /* Diagnostic functions */ |
241 #ifdef DEBUG | 260 #ifdef DEBUG |
242 # include <stdio.h> | 261 # include <stdio.h> |
243 extern int z_verbose; | 262 extern int ZLIB_INTERNAL z_verbose; |
244 extern void z_error OF((char *m)); | 263 extern void ZLIB_INTERNAL z_error OF((char *m)); |
245 # define Assert(cond,msg) {if(!(cond)) z_error(msg);} | 264 # define Assert(cond,msg) {if(!(cond)) z_error(msg);} |
246 # define Trace(x) {if (z_verbose>=0) fprintf x ;} | 265 # define Trace(x) {if (z_verbose>=0) fprintf x ;} |
247 # define Tracev(x) {if (z_verbose>0) fprintf x ;} | 266 # define Tracev(x) {if (z_verbose>0) fprintf x ;} |
248 # define Tracevv(x) {if (z_verbose>1) fprintf x ;} | 267 # define Tracevv(x) {if (z_verbose>1) fprintf x ;} |
249 # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} | 268 # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} |
250 # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} | 269 # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} |
251 #else | 270 #else |
252 # define Assert(cond,msg) | 271 # define Assert(cond,msg) |
253 # define Trace(x) | 272 # define Trace(x) |
254 # define Tracev(x) | 273 # define Tracev(x) |
255 # define Tracevv(x) | 274 # define Tracevv(x) |
256 # define Tracec(c,x) | 275 # define Tracec(c,x) |
257 # define Tracecv(c,x) | 276 # define Tracecv(c,x) |
258 #endif | 277 #endif |
259 | 278 |
260 | 279 |
261 voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); | 280 voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, |
262 void zcfree OF((voidpf opaque, voidpf ptr)); | 281 unsigned size)); |
| 282 void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); |
263 | 283 |
264 #define ZALLOC(strm, items, size) \ | 284 #define ZALLOC(strm, items, size) \ |
265 (*((strm)->zalloc))((strm)->opaque, (items), (size)) | 285 (*((strm)->zalloc))((strm)->opaque, (items), (size)) |
266 #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) | 286 #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) |
267 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} | 287 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} |
268 | 288 |
269 #endif /* ZUTIL_H */ | 289 #endif /* ZUTIL_H */ |
OLD | NEW |