diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:21:47 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:21:47 -0700 |
commit | 7c2a874e50b871d04fbd19501f7b42cff55e5abc (patch) | |
tree | 1879cd29182ababb17cde77cee5ce74505db4006 /zutil.c | |
parent | a383133c4e7b93113cee912f213cf9502d785fa7 (diff) | |
download | zlib-7c2a874e50b871d04fbd19501f7b42cff55e5abc.tar.gz zlib-7c2a874e50b871d04fbd19501f7b42cff55e5abc.tar.bz2 zlib-7c2a874e50b871d04fbd19501f7b42cff55e5abc.zip |
zlib 1.2.0v1.2.0
Diffstat (limited to 'zutil.c')
-rw-r--r-- | zutil.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
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-2002 Jean-loup Gailly. | 2 | * Copyright (C) 1995-2003 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 | ||
@@ -13,7 +13,7 @@ struct internal_state {int dummy;}; /* for buggy compilers */ | |||
13 | extern void exit OF((int)); | 13 | extern void exit OF((int)); |
14 | #endif | 14 | #endif |
15 | 15 | ||
16 | const char *z_errmsg[10] = { | 16 | const char * const z_errmsg[10] = { |
17 | "need dictionary", /* Z_NEED_DICT 2 */ | 17 | "need dictionary", /* Z_NEED_DICT 2 */ |
18 | "stream end", /* Z_STREAM_END 1 */ | 18 | "stream end", /* Z_STREAM_END 1 */ |
19 | "", /* Z_OK 0 */ | 19 | "", /* Z_OK 0 */ |
@@ -95,6 +95,7 @@ void zmemzero(dest, len) | |||
95 | 95 | ||
96 | #ifdef __TURBOC__ | 96 | #ifdef __TURBOC__ |
97 | #if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__) | 97 | #if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__) |
98 | #if !defined(__linux) | ||
98 | /* Small and medium model in Turbo C are for now limited to near allocation | 99 | /* Small and medium model in Turbo C are for now limited to near allocation |
99 | * with reduced MAX_WBITS and MAX_MEM_LEVEL | 100 | * with reduced MAX_WBITS and MAX_MEM_LEVEL |
100 | */ | 101 | */ |
@@ -170,6 +171,7 @@ void zcfree (voidpf opaque, voidpf ptr) | |||
170 | Assert(0, "zcfree: ptr not found"); | 171 | Assert(0, "zcfree: ptr not found"); |
171 | } | 172 | } |
172 | #endif | 173 | #endif |
174 | #endif | ||
173 | #endif /* __TURBOC__ */ | 175 | #endif /* __TURBOC__ */ |
174 | 176 | ||
175 | 177 | ||
@@ -201,6 +203,7 @@ void zcfree (voidpf opaque, voidpf ptr) | |||
201 | #ifndef MY_ZCALLOC /* Any system without a special alloc function */ | 203 | #ifndef MY_ZCALLOC /* Any system without a special alloc function */ |
202 | 204 | ||
203 | #ifndef STDC | 205 | #ifndef STDC |
206 | extern voidp malloc OF((uInt size)); | ||
204 | extern voidp calloc OF((uInt items, uInt size)); | 207 | extern voidp calloc OF((uInt items, uInt size)); |
205 | extern void free OF((voidpf ptr)); | 208 | extern void free OF((voidpf ptr)); |
206 | #endif | 209 | #endif |
@@ -211,7 +214,8 @@ voidpf zcalloc (opaque, items, size) | |||
211 | unsigned size; | 214 | unsigned size; |
212 | { | 215 | { |
213 | if (opaque) items += size - size; /* make compiler happy */ | 216 | if (opaque) items += size - size; /* make compiler happy */ |
214 | return (voidpf)calloc(items, size); | 217 | return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : |
218 | (voidpf)calloc(items, size); | ||
215 | } | 219 | } |
216 | 220 | ||
217 | void zcfree (opaque, ptr) | 221 | void zcfree (opaque, ptr) |