diff options
Diffstat (limited to 'zutil.h')
-rw-r--r-- | zutil.h | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
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 Jean-loup Gailly. | 2 | * Copyright (C) 1995-1996 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 | ||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #include "zlib.h" | 16 | #include "zlib.h" |
17 | 17 | ||
18 | #if defined(MSDOS) || defined(VMS) | 18 | #if defined(MSDOS) || defined(VMS) || defined(CRAY) || defined(WIN32) |
19 | # include <stddef.h> | 19 | # include <stddef.h> |
20 | # include <errno.h> | 20 | # include <errno.h> |
21 | #else | 21 | #else |
@@ -23,6 +23,7 @@ | |||
23 | #endif | 23 | #endif |
24 | #ifdef STDC | 24 | #ifdef STDC |
25 | # include <string.h> | 25 | # include <string.h> |
26 | # include <stdlib.h> | ||
26 | #endif | 27 | #endif |
27 | 28 | ||
28 | #ifndef local | 29 | #ifndef local |
@@ -36,15 +37,17 @@ typedef unsigned short ush; | |||
36 | typedef ush FAR ushf; | 37 | typedef ush FAR ushf; |
37 | typedef unsigned long ulg; | 38 | typedef unsigned long ulg; |
38 | 39 | ||
39 | extern char *z_errmsg[]; /* indexed by 1-zlib_error */ | 40 | extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ |
41 | /* (size given to avoid silly warnings with Visual C++) */ | ||
40 | 42 | ||
41 | #define ERR_RETURN(strm,err) return (strm->msg=z_errmsg[1-err], err) | 43 | #define ERR_MSG(err) (char*)z_errmsg[Z_NEED_DICT-(err)] |
44 | |||
45 | #define ERR_RETURN(strm,err) \ | ||
46 | return (strm->msg = ERR_MSG(err), (err)) | ||
42 | /* To be used only when the state is known to be valid */ | 47 | /* To be used only when the state is known to be valid */ |
43 | 48 | ||
44 | /* common constants */ | 49 | /* common constants */ |
45 | 50 | ||
46 | #define DEFLATED 8 | ||
47 | |||
48 | #ifndef DEF_WBITS | 51 | #ifndef DEF_WBITS |
49 | # define DEF_WBITS MAX_WBITS | 52 | # define DEF_WBITS MAX_WBITS |
50 | #endif | 53 | #endif |
@@ -66,6 +69,8 @@ extern char *z_errmsg[]; /* indexed by 1-zlib_error */ | |||
66 | #define MAX_MATCH 258 | 69 | #define MAX_MATCH 258 |
67 | /* The minimum and maximum match lengths */ | 70 | /* The minimum and maximum match lengths */ |
68 | 71 | ||
72 | #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ | ||
73 | |||
69 | /* target dependencies */ | 74 | /* target dependencies */ |
70 | 75 | ||
71 | #ifdef MSDOS | 76 | #ifdef MSDOS |
@@ -81,7 +86,7 @@ extern char *z_errmsg[]; /* indexed by 1-zlib_error */ | |||
81 | # define OS_CODE 0x06 | 86 | # define OS_CODE 0x06 |
82 | #endif | 87 | #endif |
83 | 88 | ||
84 | #ifdef WIN32 /* Windows NT */ | 89 | #ifdef WIN32 /* Window 95 & Windows NT */ |
85 | # define OS_CODE 0x0b | 90 | # define OS_CODE 0x0b |
86 | #endif | 91 | #endif |
87 | 92 | ||
@@ -143,11 +148,13 @@ extern char *z_errmsg[]; /* indexed by 1-zlib_error */ | |||
143 | # define HAVE_MEMCPY | 148 | # define HAVE_MEMCPY |
144 | #endif | 149 | #endif |
145 | #ifdef HAVE_MEMCPY | 150 | #ifdef HAVE_MEMCPY |
146 | # if defined(M_I86SM) || defined(M_I86MM) /* MSC small or medium model */ | 151 | # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ |
147 | # define zmemcpy _fmemcpy | 152 | # define zmemcpy _fmemcpy |
153 | # define zmemcmp _fmemcmp | ||
148 | # define zmemzero(dest, len) _fmemset(dest, 0, len) | 154 | # define zmemzero(dest, len) _fmemset(dest, 0, len) |
149 | # else | 155 | # else |
150 | # define zmemcpy memcpy | 156 | # define zmemcpy memcpy |
157 | # define zmemcmp memcmp | ||
151 | # define zmemzero(dest, len) memset(dest, 0, len) | 158 | # define zmemzero(dest, len) memset(dest, 0, len) |
152 | # endif | 159 | # endif |
153 | #else | 160 | #else |
@@ -177,7 +184,7 @@ extern char *z_errmsg[]; /* indexed by 1-zlib_error */ | |||
177 | #endif | 184 | #endif |
178 | 185 | ||
179 | 186 | ||
180 | typedef uLong (*check_func) OF((uLong check, Bytef *buf, uInt len)); | 187 | typedef uLong (*check_func) OF((uLong check, const Bytef *buf, uInt len)); |
181 | 188 | ||
182 | extern void z_error OF((char *m)); | 189 | extern void z_error OF((char *m)); |
183 | 190 | ||