diff options
Diffstat (limited to 'zutil.h')
-rw-r--r-- | zutil.h | 56 |
1 files changed, 33 insertions, 23 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-1996 Jean-loup Gailly. | 2 | * Copyright (C) 1995-1998 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,23 +8,23 @@ | |||
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.16 1996/07/24 13:41:13 me Exp $ */ | 11 | /* @(#) $Id$ */ |
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)||defined(WIN32)||defined(RISCOS) | ||
19 | # include <stddef.h> | ||
20 | # include <errno.h> | ||
21 | #else | ||
22 | extern int errno; | ||
23 | #endif | ||
24 | #ifdef STDC | 18 | #ifdef STDC |
19 | # include <stddef.h> | ||
25 | # include <string.h> | 20 | # include <string.h> |
26 | # include <stdlib.h> | 21 | # include <stdlib.h> |
27 | #endif | 22 | #endif |
23 | #ifdef NO_ERRNO_H | ||
24 | extern int errno; | ||
25 | #else | ||
26 | # include <errno.h> | ||
27 | #endif | ||
28 | 28 | ||
29 | #ifndef local | 29 | #ifndef local |
30 | # define local static | 30 | # define local static |
@@ -76,7 +76,13 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ | |||
76 | #ifdef MSDOS | 76 | #ifdef MSDOS |
77 | # define OS_CODE 0x00 | 77 | # define OS_CODE 0x00 |
78 | # ifdef __TURBOC__ | 78 | # ifdef __TURBOC__ |
79 | # include <alloc.h> | 79 | # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) |
80 | /* Allow compilation with ANSI keywords only enabled */ | ||
81 | void _Cdecl farfree( void *block ); | ||
82 | void *_Cdecl farmalloc( unsigned long nbytes ); | ||
83 | # else | ||
84 | # include <alloc.h> | ||
85 | # endif | ||
80 | # else /* MSC or DJGPP */ | 86 | # else /* MSC or DJGPP */ |
81 | # include <malloc.h> | 87 | # include <malloc.h> |
82 | # endif | 88 | # endif |
@@ -92,7 +98,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ | |||
92 | 98 | ||
93 | #if defined(VAXC) || defined(VMS) | 99 | #if defined(VAXC) || defined(VMS) |
94 | # define OS_CODE 0x02 | 100 | # define OS_CODE 0x02 |
95 | # define FOPEN(name, mode) \ | 101 | # define F_OPEN(name, mode) \ |
96 | fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") | 102 | fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") |
97 | #endif | 103 | #endif |
98 | 104 | ||
@@ -120,14 +126,19 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ | |||
120 | # define fdopen(fd,mode) NULL /* No fdopen() */ | 126 | # define fdopen(fd,mode) NULL /* No fdopen() */ |
121 | #endif | 127 | #endif |
122 | 128 | ||
129 | #if (defined(_MSC_VER) && (_MSC_VER >= 600)) | ||
130 | # define fdopen(fd,type) _fdopen(fd,type) | ||
131 | #endif | ||
132 | |||
133 | |||
123 | /* Common defaults */ | 134 | /* Common defaults */ |
124 | 135 | ||
125 | #ifndef OS_CODE | 136 | #ifndef OS_CODE |
126 | # define OS_CODE 0x03 /* assume Unix */ | 137 | # define OS_CODE 0x03 /* assume Unix */ |
127 | #endif | 138 | #endif |
128 | 139 | ||
129 | #ifndef FOPEN | 140 | #ifndef F_OPEN |
130 | # define FOPEN(name, mode) fopen((name), (mode)) | 141 | # define F_OPEN(name, mode) fopen((name), (mode)) |
131 | #endif | 142 | #endif |
132 | 143 | ||
133 | /* functions */ | 144 | /* functions */ |
@@ -142,9 +153,10 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ | |||
142 | #if defined(pyr) | 153 | #if defined(pyr) |
143 | # define NO_MEMCPY | 154 | # define NO_MEMCPY |
144 | #endif | 155 | #endif |
145 | #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(_MSC_VER) | 156 | #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) |
146 | /* Use our own functions for small and medium model with MSC <= 5.0. | 157 | /* Use our own functions for small and medium model with MSC <= 5.0. |
147 | * You may have to use the same strategy for Borland C (untested). | 158 | * You may have to use the same strategy for Borland C (untested). |
159 | * The __SC__ check is for Symantec. | ||
148 | */ | 160 | */ |
149 | # define NO_MEMCPY | 161 | # define NO_MEMCPY |
150 | #endif | 162 | #endif |
@@ -170,16 +182,14 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ | |||
170 | /* Diagnostic functions */ | 182 | /* Diagnostic functions */ |
171 | #ifdef DEBUG | 183 | #ifdef DEBUG |
172 | # include <stdio.h> | 184 | # include <stdio.h> |
173 | # ifndef verbose | 185 | extern int z_verbose; |
174 | # define verbose 0 | ||
175 | # endif | ||
176 | extern void z_error OF((char *m)); | 186 | extern void z_error OF((char *m)); |
177 | # define Assert(cond,msg) {if(!(cond)) z_error(msg);} | 187 | # define Assert(cond,msg) {if(!(cond)) z_error(msg);} |
178 | # define Trace(x) fprintf x | 188 | # define Trace(x) {if (z_verbose>=0) fprintf x ;} |
179 | # define Tracev(x) {if (verbose) fprintf x ;} | 189 | # define Tracev(x) {if (z_verbose>0) fprintf x ;} |
180 | # define Tracevv(x) {if (verbose>1) fprintf x ;} | 190 | # define Tracevv(x) {if (z_verbose>1) fprintf x ;} |
181 | # define Tracec(c,x) {if (verbose && (c)) fprintf x ;} | 191 | # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} |
182 | # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} | 192 | # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} |
183 | #else | 193 | #else |
184 | # define Assert(cond,msg) | 194 | # define Assert(cond,msg) |
185 | # define Trace(x) | 195 | # define Trace(x) |
@@ -190,8 +200,8 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ | |||
190 | #endif | 200 | #endif |
191 | 201 | ||
192 | 202 | ||
193 | typedef uLong (*check_func) OF((uLong check, const Bytef *buf, uInt len)); | 203 | typedef uLong (EXPORT *check_func) OF((uLong check, const Bytef *buf, |
194 | 204 | uInt len)); | |
195 | voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); | 205 | voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); |
196 | void zcfree OF((voidpf opaque, voidpf ptr)); | 206 | void zcfree OF((voidpf opaque, voidpf ptr)); |
197 | 207 | ||