aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/zlib/zutil.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-01-09 12:26:18 +0100
committerBjörn Gustavsson <[email protected]>2014-01-14 09:30:34 +0100
commit9205b6671892e7516e8571e4ecf19bfa2ade1130 (patch)
treee2027206adefa16bdd3a323824986ef0719b4806 /erts/emulator/zlib/zutil.c
parent069f9ec3dfd7a4dc17973e22dc271d40ebe11467 (diff)
downloadotp-9205b6671892e7516e8571e4ecf19bfa2ade1130.tar.gz
otp-9205b6671892e7516e8571e4ecf19bfa2ade1130.tar.bz2
otp-9205b6671892e7516e8571e4ecf19bfa2ade1130.zip
Update zlib to 1.2.8
Diffstat (limited to 'erts/emulator/zlib/zutil.c')
-rw-r--r--erts/emulator/zlib/zutil.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/erts/emulator/zlib/zutil.c b/erts/emulator/zlib/zutil.c
index fa5b43126a..27a8af4a2b 100644
--- a/erts/emulator/zlib/zutil.c
+++ b/erts/emulator/zlib/zutil.c
@@ -1,22 +1,23 @@
/* zutil.c -- target dependent utility functions for the compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
+ * Copyright (C) 1995-2005, 2010, 2011, 2012 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-/* %ExternalCopyright% */
-
/* @(#) $Id$ */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "zutil.h"
+#ifndef Z_SOLO
+# include "gzguts.h"
+#endif
#ifndef NO_DUMMY_DECL
struct internal_state {int dummy;}; /* for buggy compilers */
#endif
-const char * const z_errmsg[10] = {
+z_const char * const z_errmsg[10] = {
"need dictionary", /* Z_NEED_DICT 2 */
"stream end", /* Z_STREAM_END 1 */
"", /* Z_OK 0 */
@@ -39,25 +40,25 @@ uLong ZEXPORT zlibCompileFlags()
uLong flags;
flags = 0;
- switch (sizeof(uInt)) {
+ switch ((int)(sizeof(uInt))) {
case 2: break;
case 4: flags += 1; break;
case 8: flags += 2; break;
default: flags += 3;
}
- switch (sizeof(uLong)) {
+ switch ((int)(sizeof(uLong))) {
case 2: break;
case 4: flags += 1 << 2; break;
case 8: flags += 2 << 2; break;
default: flags += 3 << 2;
}
- switch (sizeof(voidpf)) {
+ switch ((int)(sizeof(voidpf))) {
case 2: break;
case 4: flags += 1 << 4; break;
case 8: flags += 2 << 4; break;
default: flags += 3 << 4;
}
- switch (sizeof(z_off_t)) {
+ switch ((int)(sizeof(z_off_t))) {
case 2: break;
case 4: flags += 1 << 6; break;
case 8: flags += 2 << 6; break;
@@ -90,27 +91,27 @@ uLong ZEXPORT zlibCompileFlags()
#ifdef FASTEST
flags += 1L << 21;
#endif
-#ifdef STDC
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# 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
@@ -122,9 +123,9 @@ uLong ZEXPORT zlibCompileFlags()
# ifndef verbose
# define verbose 0
# endif
-int z_verbose = verbose;
+int ZLIB_INTERNAL z_verbose = verbose;
-void z_error (m)
+void ZLIB_INTERNAL z_error (m)
char *m;
{
fprintf(stderr, "%s\n", m);
@@ -151,7 +152,7 @@ const char * ZEXPORT zError(err)
#ifndef HAVE_MEMCPY
-void zmemcpy(dest, source, len)
+void ZLIB_INTERNAL zmemcpy(dest, source, len)
Bytef* dest;
const Bytef* source;
uInt len;
@@ -162,7 +163,7 @@ void zmemcpy(dest, source, len)
} while (--len != 0);
}
-int zmemcmp(s1, s2, len)
+int ZLIB_INTERNAL zmemcmp(s1, s2, len)
const Bytef* s1;
const Bytef* s2;
uInt len;
@@ -175,7 +176,7 @@ int zmemcmp(s1, s2, len)
return 0;
}
-void zmemzero(dest, len)
+void ZLIB_INTERNAL zmemzero(dest, len)
Bytef* dest;
uInt len;
{
@@ -186,6 +187,7 @@ void zmemzero(dest, len)
}
#endif
+#ifndef Z_SOLO
#ifdef SYS16BIT
@@ -218,7 +220,7 @@ local ptr_table table[MAX_PTR];
* a protected system like OS/2. Use Microsoft C instead.
*/
-voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
{
voidpf buf = opaque; /* just to make some compilers happy */
ulg bsize = (ulg)items*size;
@@ -242,7 +244,7 @@ voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
return buf;
}
-void zcfree (voidpf opaque, voidpf ptr)
+void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
{
int n;
if (*(ush*)&ptr != 0) { /* object < 64K */
@@ -277,13 +279,13 @@ void zcfree (voidpf opaque, voidpf ptr)
# define _hfree hfree
#endif
-voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
{
if (opaque) opaque = 0; /* to make compiler happy */
return _halloc((long)items, size);
}
-void zcfree (voidpf opaque, voidpf ptr)
+void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
{
if (opaque) opaque = 0; /* to make compiler happy */
_hfree(ptr);
@@ -302,26 +304,24 @@ extern voidp calloc OF((uInt items, uInt size));
extern void free OF((voidpf ptr));
#endif
-extern void* sys_alloc(unsigned);
-extern void* sys_free(void *);
-
-voidpf zcalloc (opaque, items, size)
+voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
voidpf opaque;
unsigned items;
unsigned size;
{
- unsigned sz = items * size;
- voidpf* ptr = (voidpf) sys_alloc(sz);
if (opaque) items += size - size; /* make compiler happy */
- return ptr;
+ return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
+ (voidpf)calloc(items, size);
}
-void zcfree (opaque, ptr)
+void ZLIB_INTERNAL zcfree (opaque, ptr)
voidpf opaque;
voidpf ptr;
{
- sys_free(ptr);
+ free(ptr);
if (opaque) return; /* make compiler happy */
}
#endif /* MY_ZCALLOC */
+
+#endif /* !Z_SOLO */