diff options
Diffstat (limited to 'zutil.h')
-rw-r--r-- | zutil.h | 26 |
1 files changed, 19 insertions, 7 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 | ||
@@ -8,14 +8,14 @@ | |||
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 1.9 1995/05/03 17:27:12 jloup Exp $ */ | 11 | /* $Id: zutil.h,v 1.13 1996/01/30 21:59:29 me Exp $ */ |
12 | 12 | ||
13 | #ifndef _Z_UTIL_H | 13 | #ifndef _Z_UTIL_H |
14 | #define _Z_UTIL_H | 14 | #define _Z_UTIL_H |
15 | 15 | ||
16 | #include "zlib.h" | 16 | #include "zlib.h" |
17 | 17 | ||
18 | #if defined(MSDOS) || defined(VMS) || defined(CRAY) | 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 |
@@ -37,9 +37,13 @@ typedef unsigned short ush; | |||
37 | typedef ush FAR ushf; | 37 | typedef ush FAR ushf; |
38 | typedef unsigned long ulg; | 38 | typedef unsigned long ulg; |
39 | 39 | ||
40 | 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++) */ | ||
41 | 42 | ||
42 | #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)) | ||
43 | /* 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 */ |
44 | 48 | ||
45 | /* common constants */ | 49 | /* common constants */ |
@@ -65,6 +69,8 @@ extern char *z_errmsg[]; /* indexed by 1-zlib_error */ | |||
65 | #define MAX_MATCH 258 | 69 | #define MAX_MATCH 258 |
66 | /* The minimum and maximum match lengths */ | 70 | /* The minimum and maximum match lengths */ |
67 | 71 | ||
72 | #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ | ||
73 | |||
68 | /* target dependencies */ | 74 | /* target dependencies */ |
69 | 75 | ||
70 | #ifdef MSDOS | 76 | #ifdef MSDOS |
@@ -110,6 +116,10 @@ extern char *z_errmsg[]; /* indexed by 1-zlib_error */ | |||
110 | # define OS_CODE 0x0a | 116 | # define OS_CODE 0x0a |
111 | #endif | 117 | #endif |
112 | 118 | ||
119 | #ifdef _BEOS_ | ||
120 | # define fdopen(fd,mode) NULL /* No fdopen() */ | ||
121 | #endif | ||
122 | |||
113 | /* Common defaults */ | 123 | /* Common defaults */ |
114 | 124 | ||
115 | #ifndef OS_CODE | 125 | #ifndef OS_CODE |
@@ -142,11 +152,13 @@ extern char *z_errmsg[]; /* indexed by 1-zlib_error */ | |||
142 | # define HAVE_MEMCPY | 152 | # define HAVE_MEMCPY |
143 | #endif | 153 | #endif |
144 | #ifdef HAVE_MEMCPY | 154 | #ifdef HAVE_MEMCPY |
145 | # if defined(M_I86SM) || defined(M_I86MM) /* MSC small or medium model */ | 155 | # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ |
146 | # define zmemcpy _fmemcpy | 156 | # define zmemcpy _fmemcpy |
157 | # define zmemcmp _fmemcmp | ||
147 | # define zmemzero(dest, len) _fmemset(dest, 0, len) | 158 | # define zmemzero(dest, len) _fmemset(dest, 0, len) |
148 | # else | 159 | # else |
149 | # define zmemcpy memcpy | 160 | # define zmemcpy memcpy |
161 | # define zmemcmp memcmp | ||
150 | # define zmemzero(dest, len) memset(dest, 0, len) | 162 | # define zmemzero(dest, len) memset(dest, 0, len) |
151 | # endif | 163 | # endif |
152 | #else | 164 | #else |
@@ -176,7 +188,7 @@ extern char *z_errmsg[]; /* indexed by 1-zlib_error */ | |||
176 | #endif | 188 | #endif |
177 | 189 | ||
178 | 190 | ||
179 | typedef uLong (*check_func) OF((uLong check, Bytef *buf, uInt len)); | 191 | typedef uLong (*check_func) OF((uLong check, const Bytef *buf, uInt len)); |
180 | 192 | ||
181 | extern void z_error OF((char *m)); | 193 | extern void z_error OF((char *m)); |
182 | 194 | ||