aboutsummaryrefslogtreecommitdiff
path: root/src/zlib/zutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/zlib/zutil.c')
-rw-r--r--src/zlib/zutil.c71
1 files changed, 32 insertions, 39 deletions
diff --git a/src/zlib/zutil.c b/src/zlib/zutil.c
index a76c6b0..898ed34 100644
--- a/src/zlib/zutil.c
+++ b/src/zlib/zutil.c
@@ -1,27 +1,27 @@
/* zutil.c -- target dependent utility functions for the compression library
- * Copyright (C) 1995-2017 Jean-loup Gailly
+ * Copyright (C) 1995-2005, 2010 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#include "zutil.h"
-#ifndef Z_SOLO
-# include "gzguts.h"
+
+#ifndef NO_DUMMY_DECL
+struct internal_state {int dummy;}; /* for buggy compilers */
#endif
-z_const char * const z_errmsg[10] = {
- (z_const char *)"need dictionary", /* Z_NEED_DICT 2 */
- (z_const char *)"stream end", /* Z_STREAM_END 1 */
- (z_const char *)"", /* Z_OK 0 */
- (z_const char *)"file error", /* Z_ERRNO (-1) */
- (z_const char *)"stream error", /* Z_STREAM_ERROR (-2) */
- (z_const char *)"data error", /* Z_DATA_ERROR (-3) */
- (z_const char *)"insufficient memory", /* Z_MEM_ERROR (-4) */
- (z_const char *)"buffer error", /* Z_BUF_ERROR (-5) */
- (z_const char *)"incompatible version",/* Z_VERSION_ERROR (-6) */
- (z_const char *)""
-};
+const char * const z_errmsg[10] = {
+"need dictionary", /* Z_NEED_DICT 2 */
+"stream end", /* Z_STREAM_END 1 */
+"", /* Z_OK 0 */
+"file error", /* Z_ERRNO (-1) */
+"stream error", /* Z_STREAM_ERROR (-2) */
+"data error", /* Z_DATA_ERROR (-3) */
+"insufficient memory", /* Z_MEM_ERROR (-4) */
+"buffer error", /* Z_BUF_ERROR (-5) */
+"incompatible version",/* Z_VERSION_ERROR (-6) */
+""};
const char * ZEXPORT zlibVersion()
@@ -58,7 +58,7 @@ uLong ZEXPORT zlibCompileFlags()
case 8: flags += 2 << 6; break;
default: flags += 3 << 6;
}
-#ifdef ZLIB_DEBUG
+#ifdef DEBUG
flags += 1 << 8;
#endif
#if defined(ASMV) || defined(ASMINF)
@@ -85,35 +85,35 @@ uLong ZEXPORT zlibCompileFlags()
#ifdef FASTEST
flags += 1L << 21;
#endif
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
+#ifdef STDC
# ifdef NO_vsnprintf
- flags += 1L << 25;
+ flags += 1L << 25;
# ifdef HAS_vsprintf_void
- flags += 1L << 26;
+ flags += 1L << 26;
# endif
# else
# ifdef HAS_vsnprintf_void
- flags += 1L << 26;
+ flags += 1L << 26;
# endif
# endif
#else
- flags += 1L << 24;
+ flags += 1L << 24;
# ifdef NO_snprintf
- flags += 1L << 25;
+ flags += 1L << 25;
# ifdef HAS_sprintf_void
- flags += 1L << 26;
+ flags += 1L << 26;
# endif
# else
# ifdef HAS_snprintf_void
- flags += 1L << 26;
+ flags += 1L << 26;
# endif
# endif
#endif
return flags;
}
-#ifdef ZLIB_DEBUG
-#include <stdlib.h>
+#ifdef DEBUG
+
# ifndef verbose
# define verbose 0
# endif
@@ -181,7 +181,6 @@ void ZLIB_INTERNAL zmemzero(dest, len)
}
#endif
-#ifndef Z_SOLO
#ifdef SYS16BIT
@@ -216,11 +215,9 @@ local ptr_table table[MAX_PTR];
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
{
- voidpf buf;
+ voidpf buf = opaque; /* just to make some compilers happy */
ulg bsize = (ulg)items*size;
- (void)opaque;
-
/* If we allocate less than 65520 bytes, we assume that farmalloc
* will return a usable pointer which doesn't have to be normalized.
*/
@@ -243,9 +240,6 @@ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
{
int n;
-
- (void)opaque;
-
if (*(ush*)&ptr != 0) { /* object < 64K */
farfree(ptr);
return;
@@ -261,6 +255,7 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
next_ptr--;
return;
}
+ ptr = opaque; /* just to make some compilers happy */
Assert(0, "zcfree: ptr not found");
}
@@ -279,13 +274,13 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
{
- (void)opaque;
+ if (opaque) opaque = 0; /* to make compiler happy */
return _halloc((long)items, size);
}
void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
{
- (void)opaque;
+ if (opaque) opaque = 0; /* to make compiler happy */
_hfree(ptr);
}
@@ -307,7 +302,7 @@ voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
unsigned items;
unsigned size;
{
- (void)opaque;
+ if (opaque) items += size - size; /* make compiler happy */
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
(voidpf)calloc(items, size);
}
@@ -316,10 +311,8 @@ void ZLIB_INTERNAL zcfree (opaque, ptr)
voidpf opaque;
voidpf ptr;
{
- (void)opaque;
free(ptr);
+ if (opaque) return; /* make compiler happy */
}
#endif /* MY_ZCALLOC */
-
-#endif /* !Z_SOLO */