author | sherman |
Wed, 04 Jun 2014 11:25:13 -0700 | |
changeset 24710 | c019dc4104b2 |
permissions | -rw-r--r-- |
24710
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
1 |
/* |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
3 |
* |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
4 |
* This code is free software; you can redistribute it and/or modify it |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
5 |
* under the terms of the GNU General Public License version 2 only, as |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
6 |
* published by the Free Software Foundation. Oracle designates this |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
7 |
* particular file as subject to the "Classpath" exception as provided |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
8 |
* by Oracle in the LICENSE file that accompanied this code. |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
9 |
* |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
14 |
* accompanied this code). |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
15 |
* |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
16 |
* You should have received a copy of the GNU General Public License version |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
19 |
* |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
21 |
* or visit www.oracle.com if you need additional information or have any |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
22 |
* questions. |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
23 |
*/ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
24 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
25 |
/* zutil.c -- target dependent utility functions for the compression library |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
26 |
* Copyright (C) 1995-2005, 2010, 2011, 2012 Jean-loup Gailly. |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
27 |
* For conditions of distribution and use, see copyright notice in zlib.h |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
28 |
*/ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
29 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
30 |
/* @(#) $Id$ */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
31 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
32 |
#include "zutil.h" |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
33 |
#ifndef Z_SOLO |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
34 |
# include "gzguts.h" |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
35 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
36 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
37 |
#ifndef NO_DUMMY_DECL |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
38 |
struct internal_state {int dummy;}; /* for buggy compilers */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
39 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
40 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
41 |
z_const char * const z_errmsg[10] = { |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
42 |
"need dictionary", /* Z_NEED_DICT 2 */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
43 |
"stream end", /* Z_STREAM_END 1 */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
44 |
"", /* Z_OK 0 */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
45 |
"file error", /* Z_ERRNO (-1) */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
46 |
"stream error", /* Z_STREAM_ERROR (-2) */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
47 |
"data error", /* Z_DATA_ERROR (-3) */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
48 |
"insufficient memory", /* Z_MEM_ERROR (-4) */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
49 |
"buffer error", /* Z_BUF_ERROR (-5) */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
50 |
"incompatible version",/* Z_VERSION_ERROR (-6) */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
51 |
""}; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
52 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
53 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
54 |
const char * ZEXPORT zlibVersion() |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
55 |
{ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
56 |
return ZLIB_VERSION; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
57 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
58 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
59 |
uLong ZEXPORT zlibCompileFlags() |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
60 |
{ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
61 |
uLong flags; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
62 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
63 |
flags = 0; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
64 |
switch ((int)(sizeof(uInt))) { |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
65 |
case 2: break; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
66 |
case 4: flags += 1; break; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
67 |
case 8: flags += 2; break; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
68 |
default: flags += 3; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
69 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
70 |
switch ((int)(sizeof(uLong))) { |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
71 |
case 2: break; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
72 |
case 4: flags += 1 << 2; break; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
73 |
case 8: flags += 2 << 2; break; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
74 |
default: flags += 3 << 2; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
75 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
76 |
switch ((int)(sizeof(voidpf))) { |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
77 |
case 2: break; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
78 |
case 4: flags += 1 << 4; break; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
79 |
case 8: flags += 2 << 4; break; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
80 |
default: flags += 3 << 4; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
81 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
82 |
switch ((int)(sizeof(z_off_t))) { |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
83 |
case 2: break; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
84 |
case 4: flags += 1 << 6; break; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
85 |
case 8: flags += 2 << 6; break; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
86 |
default: flags += 3 << 6; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
87 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
88 |
#ifdef DEBUG |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
89 |
flags += 1 << 8; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
90 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
91 |
#if defined(ASMV) || defined(ASMINF) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
92 |
flags += 1 << 9; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
93 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
94 |
#ifdef ZLIB_WINAPI |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
95 |
flags += 1 << 10; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
96 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
97 |
#ifdef BUILDFIXED |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
98 |
flags += 1 << 12; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
99 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
100 |
#ifdef DYNAMIC_CRC_TABLE |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
101 |
flags += 1 << 13; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
102 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
103 |
#ifdef NO_GZCOMPRESS |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
104 |
flags += 1L << 16; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
105 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
106 |
#ifdef NO_GZIP |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
107 |
flags += 1L << 17; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
108 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
109 |
#ifdef PKZIP_BUG_WORKAROUND |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
110 |
flags += 1L << 20; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
111 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
112 |
#ifdef FASTEST |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
113 |
flags += 1L << 21; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
114 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
115 |
#if defined(STDC) || defined(Z_HAVE_STDARG_H) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
116 |
# ifdef NO_vsnprintf |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
117 |
flags += 1L << 25; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
118 |
# ifdef HAS_vsprintf_void |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
119 |
flags += 1L << 26; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
120 |
# endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
121 |
# else |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
122 |
# ifdef HAS_vsnprintf_void |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
123 |
flags += 1L << 26; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
124 |
# endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
125 |
# endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
126 |
#else |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
127 |
flags += 1L << 24; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
128 |
# ifdef NO_snprintf |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
129 |
flags += 1L << 25; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
130 |
# ifdef HAS_sprintf_void |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
131 |
flags += 1L << 26; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
132 |
# endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
133 |
# else |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
134 |
# ifdef HAS_snprintf_void |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
135 |
flags += 1L << 26; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
136 |
# endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
137 |
# endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
138 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
139 |
return flags; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
140 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
141 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
142 |
#ifdef DEBUG |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
143 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
144 |
# ifndef verbose |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
145 |
# define verbose 0 |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
146 |
# endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
147 |
int ZLIB_INTERNAL z_verbose = verbose; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
148 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
149 |
void ZLIB_INTERNAL z_error (m) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
150 |
char *m; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
151 |
{ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
152 |
fprintf(stderr, "%s\n", m); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
153 |
exit(1); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
154 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
155 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
156 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
157 |
/* exported to allow conversion of error code to string for compress() and |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
158 |
* uncompress() |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
159 |
*/ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
160 |
const char * ZEXPORT zError(err) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
161 |
int err; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
162 |
{ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
163 |
return ERR_MSG(err); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
164 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
165 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
166 |
#if defined(_WIN32_WCE) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
167 |
/* The Microsoft C Run-Time Library for Windows CE doesn't have |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
168 |
* errno. We define it as a global variable to simplify porting. |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
169 |
* Its value is always 0 and should not be used. |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
170 |
*/ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
171 |
int errno = 0; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
172 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
173 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
174 |
#ifndef HAVE_MEMCPY |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
175 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
176 |
void ZLIB_INTERNAL zmemcpy(dest, source, len) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
177 |
Bytef* dest; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
178 |
const Bytef* source; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
179 |
uInt len; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
180 |
{ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
181 |
if (len == 0) return; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
182 |
do { |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
183 |
*dest++ = *source++; /* ??? to be unrolled */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
184 |
} while (--len != 0); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
185 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
186 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
187 |
int ZLIB_INTERNAL zmemcmp(s1, s2, len) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
188 |
const Bytef* s1; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
189 |
const Bytef* s2; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
190 |
uInt len; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
191 |
{ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
192 |
uInt j; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
193 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
194 |
for (j = 0; j < len; j++) { |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
195 |
if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
196 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
197 |
return 0; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
198 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
199 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
200 |
void ZLIB_INTERNAL zmemzero(dest, len) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
201 |
Bytef* dest; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
202 |
uInt len; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
203 |
{ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
204 |
if (len == 0) return; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
205 |
do { |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
206 |
*dest++ = 0; /* ??? to be unrolled */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
207 |
} while (--len != 0); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
208 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
209 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
210 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
211 |
#ifndef Z_SOLO |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
212 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
213 |
#ifdef SYS16BIT |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
214 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
215 |
#ifdef __TURBOC__ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
216 |
/* Turbo C in 16-bit mode */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
217 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
218 |
# define MY_ZCALLOC |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
219 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
220 |
/* Turbo C malloc() does not allow dynamic allocation of 64K bytes |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
221 |
* and farmalloc(64K) returns a pointer with an offset of 8, so we |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
222 |
* must fix the pointer. Warning: the pointer must be put back to its |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
223 |
* original form in order to free it, use zcfree(). |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
224 |
*/ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
225 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
226 |
#define MAX_PTR 10 |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
227 |
/* 10*64K = 640K */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
228 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
229 |
local int next_ptr = 0; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
230 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
231 |
typedef struct ptr_table_s { |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
232 |
voidpf org_ptr; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
233 |
voidpf new_ptr; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
234 |
} ptr_table; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
235 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
236 |
local ptr_table table[MAX_PTR]; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
237 |
/* This table is used to remember the original form of pointers |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
238 |
* to large buffers (64K). Such pointers are normalized with a zero offset. |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
239 |
* Since MSDOS is not a preemptive multitasking OS, this table is not |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
240 |
* protected from concurrent access. This hack doesn't work anyway on |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
241 |
* a protected system like OS/2. Use Microsoft C instead. |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
242 |
*/ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
243 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
244 |
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
245 |
{ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
246 |
voidpf buf = opaque; /* just to make some compilers happy */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
247 |
ulg bsize = (ulg)items*size; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
248 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
249 |
/* If we allocate less than 65520 bytes, we assume that farmalloc |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
250 |
* will return a usable pointer which doesn't have to be normalized. |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
251 |
*/ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
252 |
if (bsize < 65520L) { |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
253 |
buf = farmalloc(bsize); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
254 |
if (*(ush*)&buf != 0) return buf; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
255 |
} else { |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
256 |
buf = farmalloc(bsize + 16L); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
257 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
258 |
if (buf == NULL || next_ptr >= MAX_PTR) return NULL; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
259 |
table[next_ptr].org_ptr = buf; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
260 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
261 |
/* Normalize the pointer to seg:0 */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
262 |
*((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
263 |
*(ush*)&buf = 0; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
264 |
table[next_ptr++].new_ptr = buf; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
265 |
return buf; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
266 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
267 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
268 |
void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
269 |
{ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
270 |
int n; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
271 |
if (*(ush*)&ptr != 0) { /* object < 64K */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
272 |
farfree(ptr); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
273 |
return; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
274 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
275 |
/* Find the original pointer */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
276 |
for (n = 0; n < next_ptr; n++) { |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
277 |
if (ptr != table[n].new_ptr) continue; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
278 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
279 |
farfree(table[n].org_ptr); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
280 |
while (++n < next_ptr) { |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
281 |
table[n-1] = table[n]; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
282 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
283 |
next_ptr--; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
284 |
return; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
285 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
286 |
ptr = opaque; /* just to make some compilers happy */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
287 |
Assert(0, "zcfree: ptr not found"); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
288 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
289 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
290 |
#endif /* __TURBOC__ */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
291 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
292 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
293 |
#ifdef M_I86 |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
294 |
/* Microsoft C in 16-bit mode */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
295 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
296 |
# define MY_ZCALLOC |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
297 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
298 |
#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
299 |
# define _halloc halloc |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
300 |
# define _hfree hfree |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
301 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
302 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
303 |
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
304 |
{ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
305 |
if (opaque) opaque = 0; /* to make compiler happy */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
306 |
return _halloc((long)items, size); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
307 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
308 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
309 |
void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
310 |
{ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
311 |
if (opaque) opaque = 0; /* to make compiler happy */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
312 |
_hfree(ptr); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
313 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
314 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
315 |
#endif /* M_I86 */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
316 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
317 |
#endif /* SYS16BIT */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
318 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
319 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
320 |
#ifndef MY_ZCALLOC /* Any system without a special alloc function */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
321 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
322 |
#ifndef STDC |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
323 |
extern voidp malloc OF((uInt size)); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
324 |
extern voidp calloc OF((uInt items, uInt size)); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
325 |
extern void free OF((voidpf ptr)); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
326 |
#endif |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
327 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
328 |
voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
329 |
voidpf opaque; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
330 |
unsigned items; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
331 |
unsigned size; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
332 |
{ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
333 |
if (opaque) items += size - size; /* make compiler happy */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
334 |
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
335 |
(voidpf)calloc(items, size); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
336 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
337 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
338 |
void ZLIB_INTERNAL zcfree (opaque, ptr) |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
339 |
voidpf opaque; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
340 |
voidpf ptr; |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
341 |
{ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
342 |
free(ptr); |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
343 |
if (opaque) return; /* make compiler happy */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
344 |
} |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
345 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
346 |
#endif /* MY_ZCALLOC */ |
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
347 |
|
c019dc4104b2
8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff
changeset
|
348 |
#endif /* !Z_SOLO */ |