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