OLD | NEW |
1 /* zutil.c -- target dependent utility functions for the compression library | 1 /* zutil.c -- target dependent utility functions for the compression library |
2 * Copyright (C) 1995-2005, 2010 Jean-loup Gailly. | 2 * Copyright (C) 1995-2005, 2010, 2011, 2012 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 /* @(#) $Id$ */ | 6 /* @(#) $Id$ */ |
7 | 7 |
8 #include "zutil.h" | 8 #include "zutil.h" |
| 9 #ifndef Z_SOLO |
| 10 # include "gzguts.h" |
| 11 #endif |
9 | 12 |
10 #ifndef NO_DUMMY_DECL | 13 #ifndef NO_DUMMY_DECL |
11 struct internal_state {int dummy;}; /* for buggy compilers */ | 14 struct internal_state {int dummy;}; /* for buggy compilers */ |
12 #endif | 15 #endif |
13 | 16 |
14 const char * const z_errmsg[10] = { | 17 z_const char * const z_errmsg[10] = { |
15 "need dictionary", /* Z_NEED_DICT 2 */ | 18 "need dictionary", /* Z_NEED_DICT 2 */ |
16 "stream end", /* Z_STREAM_END 1 */ | 19 "stream end", /* Z_STREAM_END 1 */ |
17 "", /* Z_OK 0 */ | 20 "", /* Z_OK 0 */ |
18 "file error", /* Z_ERRNO (-1) */ | 21 "file error", /* Z_ERRNO (-1) */ |
19 "stream error", /* Z_STREAM_ERROR (-2) */ | 22 "stream error", /* Z_STREAM_ERROR (-2) */ |
20 "data error", /* Z_DATA_ERROR (-3) */ | 23 "data error", /* Z_DATA_ERROR (-3) */ |
21 "insufficient memory", /* Z_MEM_ERROR (-4) */ | 24 "insufficient memory", /* Z_MEM_ERROR (-4) */ |
22 "buffer error", /* Z_BUF_ERROR (-5) */ | 25 "buffer error", /* Z_BUF_ERROR (-5) */ |
23 "incompatible version",/* Z_VERSION_ERROR (-6) */ | 26 "incompatible version",/* Z_VERSION_ERROR (-6) */ |
24 ""}; | 27 ""}; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 #endif | 81 #endif |
79 #ifdef NO_GZIP | 82 #ifdef NO_GZIP |
80 flags += 1L << 17; | 83 flags += 1L << 17; |
81 #endif | 84 #endif |
82 #ifdef PKZIP_BUG_WORKAROUND | 85 #ifdef PKZIP_BUG_WORKAROUND |
83 flags += 1L << 20; | 86 flags += 1L << 20; |
84 #endif | 87 #endif |
85 #ifdef FASTEST | 88 #ifdef FASTEST |
86 flags += 1L << 21; | 89 flags += 1L << 21; |
87 #endif | 90 #endif |
88 #ifdef STDC | 91 #if defined(STDC) || defined(Z_HAVE_STDARG_H) |
89 # ifdef NO_vsnprintf | 92 # ifdef NO_vsnprintf |
90 flags += 1L << 25; | 93 flags += 1L << 25; |
91 # ifdef HAS_vsprintf_void | 94 # ifdef HAS_vsprintf_void |
92 flags += 1L << 26; | 95 flags += 1L << 26; |
93 # endif | 96 # endif |
94 # else | 97 # else |
95 # ifdef HAS_vsnprintf_void | 98 # ifdef HAS_vsnprintf_void |
96 flags += 1L << 26; | 99 flags += 1L << 26; |
97 # endif | 100 # endif |
98 # endif | 101 # endif |
99 #else | 102 #else |
100 flags += 1L << 24; | 103 flags += 1L << 24; |
101 # ifdef NO_snprintf | 104 # ifdef NO_snprintf |
102 flags += 1L << 25; | 105 flags += 1L << 25; |
103 # ifdef HAS_sprintf_void | 106 # ifdef HAS_sprintf_void |
104 flags += 1L << 26; | 107 flags += 1L << 26; |
105 # endif | 108 # endif |
106 # else | 109 # else |
107 # ifdef HAS_snprintf_void | 110 # ifdef HAS_snprintf_void |
108 flags += 1L << 26; | 111 flags += 1L << 26; |
109 # endif | 112 # endif |
110 # endif | 113 # endif |
111 #endif | 114 #endif |
112 return flags; | 115 return flags; |
113 } | 116 } |
114 | 117 |
115 #ifdef DEBUG | 118 #ifdef DEBUG |
116 | 119 |
117 # ifndef verbose | 120 # ifndef verbose |
118 # define verbose 0 | 121 # define verbose 0 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 Bytef* dest; | 177 Bytef* dest; |
175 uInt len; | 178 uInt len; |
176 { | 179 { |
177 if (len == 0) return; | 180 if (len == 0) return; |
178 do { | 181 do { |
179 *dest++ = 0; /* ??? to be unrolled */ | 182 *dest++ = 0; /* ??? to be unrolled */ |
180 } while (--len != 0); | 183 } while (--len != 0); |
181 } | 184 } |
182 #endif | 185 #endif |
183 | 186 |
| 187 #ifndef Z_SOLO |
184 | 188 |
185 #ifdef SYS16BIT | 189 #ifdef SYS16BIT |
186 | 190 |
187 #ifdef __TURBOC__ | 191 #ifdef __TURBOC__ |
188 /* Turbo C in 16-bit mode */ | 192 /* Turbo C in 16-bit mode */ |
189 | 193 |
190 # define MY_ZCALLOC | 194 # define MY_ZCALLOC |
191 | 195 |
192 /* Turbo C malloc() does not allow dynamic allocation of 64K bytes | 196 /* Turbo C malloc() does not allow dynamic allocation of 64K bytes |
193 * and farmalloc(64K) returns a pointer with an offset of 8, so we | 197 * and farmalloc(64K) returns a pointer with an offset of 8, so we |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 313 |
310 void ZLIB_INTERNAL zcfree (opaque, ptr) | 314 void ZLIB_INTERNAL zcfree (opaque, ptr) |
311 voidpf opaque; | 315 voidpf opaque; |
312 voidpf ptr; | 316 voidpf ptr; |
313 { | 317 { |
314 free(ptr); | 318 free(ptr); |
315 if (opaque) return; /* make compiler happy */ | 319 if (opaque) return; /* make compiler happy */ |
316 } | 320 } |
317 | 321 |
318 #endif /* MY_ZCALLOC */ | 322 #endif /* MY_ZCALLOC */ |
| 323 |
| 324 #endif /* !Z_SOLO */ |
OLD | NEW |