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-2013 Jean-loup Gailly. | 2 * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler |
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$ */ | 11 /* @(#) $Id$ */ |
12 | 12 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 # endif | 44 # endif |
45 #endif | 45 #endif |
46 | 46 |
47 #ifdef Z_SOLO | 47 #ifdef Z_SOLO |
48 typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ | 48 typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ |
49 #endif | 49 #endif |
50 | 50 |
51 #ifndef local | 51 #ifndef local |
52 # define local static | 52 # define local static |
53 #endif | 53 #endif |
54 /* compile with -Dlocal if your debugger can't find static symbols */ | 54 /* since "static" is used to mean two completely different things in C, we |
| 55 define "local" for the non-static meaning of "static", for readability |
| 56 (compile with -Dlocal if your debugger can't find static symbols) */ |
55 | 57 |
56 typedef unsigned char uch; | 58 typedef unsigned char uch; |
57 typedef uch FAR uchf; | 59 typedef uch FAR uchf; |
58 typedef unsigned short ush; | 60 typedef unsigned short ush; |
59 typedef ush FAR ushf; | 61 typedef ush FAR ushf; |
60 typedef unsigned long ulg; | 62 typedef unsigned long ulg; |
61 | 63 |
62 extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ | 64 extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ |
63 /* (size given to avoid silly warnings with Visual C++) */ | 65 /* (size given to avoid silly warnings with Visual C++) */ |
64 | 66 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 # else | 108 # else |
107 # include <alloc.h> | 109 # include <alloc.h> |
108 # endif | 110 # endif |
109 # else /* MSC or DJGPP */ | 111 # else /* MSC or DJGPP */ |
110 # include <malloc.h> | 112 # include <malloc.h> |
111 # endif | 113 # endif |
112 # endif | 114 # endif |
113 #endif | 115 #endif |
114 | 116 |
115 #ifdef AMIGA | 117 #ifdef AMIGA |
116 # define OS_CODE 0x01 | 118 # define OS_CODE 1 |
117 #endif | 119 #endif |
118 | 120 |
119 #if defined(VAXC) || defined(VMS) | 121 #if defined(VAXC) || defined(VMS) |
120 # define OS_CODE 0x02 | 122 # define OS_CODE 2 |
121 # define F_OPEN(name, mode) \ | 123 # define F_OPEN(name, mode) \ |
122 fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") | 124 fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") |
123 #endif | 125 #endif |
124 | 126 |
| 127 #ifdef __370__ |
| 128 # if __TARGET_LIB__ < 0x20000000 |
| 129 # define OS_CODE 4 |
| 130 # elif __TARGET_LIB__ < 0x40000000 |
| 131 # define OS_CODE 11 |
| 132 # else |
| 133 # define OS_CODE 8 |
| 134 # endif |
| 135 #endif |
| 136 |
125 #if defined(ATARI) || defined(atarist) | 137 #if defined(ATARI) || defined(atarist) |
126 # define OS_CODE 0x05 | 138 # define OS_CODE 5 |
127 #endif | 139 #endif |
128 | 140 |
129 #ifdef OS2 | 141 #ifdef OS2 |
130 # define OS_CODE 0x06 | 142 # define OS_CODE 6 |
131 # if defined(M_I86) && !defined(Z_SOLO) | 143 # if defined(M_I86) && !defined(Z_SOLO) |
132 # include <malloc.h> | 144 # include <malloc.h> |
133 # endif | 145 # endif |
134 #endif | 146 #endif |
135 | 147 |
136 #if defined(MACOS) || defined(TARGET_OS_MAC) | 148 #if defined(MACOS) || defined(TARGET_OS_MAC) |
137 # define OS_CODE 0x07 | 149 # define OS_CODE 7 |
138 # ifndef Z_SOLO | 150 # ifndef Z_SOLO |
139 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os | 151 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os |
140 # include <unix.h> /* for fdopen */ | 152 # include <unix.h> /* for fdopen */ |
141 # else | 153 # else |
142 # ifndef fdopen | 154 # ifndef fdopen |
143 # define fdopen(fd,mode) NULL /* No fdopen() */ | 155 # define fdopen(fd,mode) NULL /* No fdopen() */ |
144 # endif | 156 # endif |
145 # endif | 157 # endif |
146 # endif | 158 # endif |
147 #endif | 159 #endif |
148 | 160 |
149 #ifdef TOPS20 | 161 #ifdef __acorn |
150 # define OS_CODE 0x0a | 162 # define OS_CODE 13 |
151 #endif | 163 #endif |
152 | 164 |
153 #ifdef _MSC_VER | 165 #if defined(WIN32) && !defined(__CYGWIN__) |
154 #define zalign(x) __declspec(align(x)) | 166 # define OS_CODE 10 |
155 #else | |
156 #define zalign(x) __attribute__((aligned((x)))) | |
157 #endif | 167 #endif |
158 | 168 |
159 #ifdef WIN32 | 169 #ifdef _BEOS_ |
160 # ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ | 170 # define OS_CODE 16 |
161 # define OS_CODE 0x0b | |
162 # endif | |
163 #endif | 171 #endif |
164 | 172 |
165 #ifdef __50SERIES /* Prime/PRIMOS */ | 173 #ifdef __TOS_OS400__ |
166 # define OS_CODE 0x0f | 174 # define OS_CODE 18 |
| 175 #endif |
| 176 |
| 177 #ifdef __APPLE__ |
| 178 # define OS_CODE 19 |
167 #endif | 179 #endif |
168 | 180 |
169 #if defined(_BEOS_) || defined(RISCOS) | 181 #if defined(_BEOS_) || defined(RISCOS) |
170 # define fdopen(fd,mode) NULL /* No fdopen() */ | 182 # define fdopen(fd,mode) NULL /* No fdopen() */ |
171 #endif | 183 #endif |
172 | 184 |
173 #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX | 185 #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX |
174 # if defined(_WIN32_WCE) | 186 # if defined(_WIN32_WCE) |
175 # define fdopen(fd,mode) NULL /* No fdopen() */ | 187 # define fdopen(fd,mode) NULL /* No fdopen() */ |
176 # ifndef _PTRDIFF_T_DEFINED | 188 # ifndef _PTRDIFF_T_DEFINED |
(...skipping 14 matching lines...) Expand all Loading... |
191 /* provide prototypes for these when building zlib without LFS */ | 203 /* provide prototypes for these when building zlib without LFS */ |
192 #if !defined(_WIN32) && \ | 204 #if !defined(_WIN32) && \ |
193 (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) | 205 (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) |
194 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); | 206 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); |
195 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); | 207 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); |
196 #endif | 208 #endif |
197 | 209 |
198 /* common defaults */ | 210 /* common defaults */ |
199 | 211 |
200 #ifndef OS_CODE | 212 #ifndef OS_CODE |
201 # define OS_CODE 0x03 /* assume Unix */ | 213 # define OS_CODE 3 /* assume Unix */ |
202 #endif | 214 #endif |
203 | 215 |
204 #ifndef F_OPEN | 216 #ifndef F_OPEN |
205 # define F_OPEN(name, mode) fopen((name), (mode)) | 217 # define F_OPEN(name, mode) fopen((name), (mode)) |
206 #endif | 218 #endif |
207 | 219 |
208 /* functions */ | 220 /* functions */ |
209 | 221 |
210 #if defined(pyr) || defined(Z_SOLO) | 222 #if defined(pyr) || defined(Z_SOLO) |
211 # define NO_MEMCPY | 223 # define NO_MEMCPY |
(...skipping 18 matching lines...) Expand all Loading... |
230 # define zmemcmp memcmp | 242 # define zmemcmp memcmp |
231 # define zmemzero(dest, len) memset(dest, 0, len) | 243 # define zmemzero(dest, len) memset(dest, 0, len) |
232 # endif | 244 # endif |
233 #else | 245 #else |
234 void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); | 246 void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); |
235 int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); | 247 int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); |
236 void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); | 248 void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); |
237 #endif | 249 #endif |
238 | 250 |
239 /* Diagnostic functions */ | 251 /* Diagnostic functions */ |
240 #ifdef DEBUG | 252 #ifdef ZLIB_DEBUG |
241 # include <stdio.h> | 253 # include <stdio.h> |
242 extern int ZLIB_INTERNAL z_verbose; | 254 extern int ZLIB_INTERNAL z_verbose; |
243 extern void ZLIB_INTERNAL z_error OF((char *m)); | 255 extern void ZLIB_INTERNAL z_error OF((char *m)); |
244 # define Assert(cond,msg) {if(!(cond)) z_error(msg);} | 256 # define Assert(cond,msg) {if(!(cond)) z_error(msg);} |
245 # define Trace(x) {if (z_verbose>=0) fprintf x ;} | 257 # define Trace(x) {if (z_verbose>=0) fprintf x ;} |
246 # define Tracev(x) {if (z_verbose>0) fprintf x ;} | 258 # define Tracev(x) {if (z_verbose>0) fprintf x ;} |
247 # define Tracevv(x) {if (z_verbose>1) fprintf x ;} | 259 # define Tracevv(x) {if (z_verbose>1) fprintf x ;} |
248 # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} | 260 # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} |
249 # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} | 261 # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} |
250 #else | 262 #else |
(...skipping 13 matching lines...) Expand all Loading... |
264 | 276 |
265 #define ZALLOC(strm, items, size) \ | 277 #define ZALLOC(strm, items, size) \ |
266 (*((strm)->zalloc))((strm)->opaque, (items), (size)) | 278 (*((strm)->zalloc))((strm)->opaque, (items), (size)) |
267 #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) | 279 #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) |
268 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} | 280 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} |
269 | 281 |
270 /* Reverse the bytes in a 32-bit value */ | 282 /* Reverse the bytes in a 32-bit value */ |
271 #define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ | 283 #define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ |
272 (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) | 284 (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) |
273 | 285 |
| 286 #ifdef _MSC_VER |
| 287 #define zalign(x) __declspec(align(x)) |
| 288 #else |
| 289 #define zalign(x) __attribute__((aligned((x)))) |
| 290 #endif |
| 291 |
274 #endif /* ZUTIL_H */ | 292 #endif /* ZUTIL_H */ |
OLD | NEW |