summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/gzip/zutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/freetype/src/gzip/zutil.c')
-rw-r--r--src/3rdparty/freetype/src/gzip/zutil.c241
1 files changed, 197 insertions, 44 deletions
diff --git a/src/3rdparty/freetype/src/gzip/zutil.c b/src/3rdparty/freetype/src/gzip/zutil.c
index 7ad0c1f81b..542706ca0c 100644
--- a/src/3rdparty/freetype/src/gzip/zutil.c
+++ b/src/3rdparty/freetype/src/gzip/zutil.c
@@ -1,23 +1,161 @@
/* zutil.c -- target dependent utility functions for the compression library
- * Copyright (C) 1995-2002 Jean-loup Gailly.
+ * Copyright (C) 1995-2017 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"
+#endif
-#ifndef STDC
-extern void exit OF((int));
+#ifndef Z_FREETYPE
+
+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 * ZEXPORT zlibVersion()
+{
+ return ZLIB_VERSION;
+}
+
+uLong ZEXPORT zlibCompileFlags()
+{
+ uLong flags;
+
+ flags = 0;
+ switch ((int)(sizeof(uInt))) {
+ case 2: break;
+ case 4: flags += 1; break;
+ case 8: flags += 2; break;
+ default: flags += 3;
+ }
+ switch ((int)(sizeof(uLong))) {
+ case 2: break;
+ case 4: flags += 1 << 2; break;
+ case 8: flags += 2 << 2; break;
+ default: flags += 3 << 2;
+ }
+ switch ((int)(sizeof(voidpf))) {
+ case 2: break;
+ case 4: flags += 1 << 4; break;
+ case 8: flags += 2 << 4; break;
+ default: flags += 3 << 4;
+ }
+ switch ((int)(sizeof(z_off_t))) {
+ case 2: break;
+ case 4: flags += 1 << 6; break;
+ case 8: flags += 2 << 6; break;
+ default: flags += 3 << 6;
+ }
+#ifdef ZLIB_DEBUG
+ flags += 1 << 8;
+#endif
+ /*
+#if defined(ASMV) || defined(ASMINF)
+ flags += 1 << 9;
+#endif
+ */
+#ifdef ZLIB_WINAPI
+ flags += 1 << 10;
+#endif
+#ifdef BUILDFIXED
+ flags += 1 << 12;
+#endif
+#ifdef DYNAMIC_CRC_TABLE
+ flags += 1 << 13;
+#endif
+#ifdef NO_GZCOMPRESS
+ flags += 1L << 16;
+#endif
+#ifdef NO_GZIP
+ flags += 1L << 17;
+#endif
+#ifdef PKZIP_BUG_WORKAROUND
+ flags += 1L << 20;
+#endif
+#ifdef FASTEST
+ flags += 1L << 21;
+#endif
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
+# ifdef NO_vsnprintf
+ flags += 1L << 25;
+# ifdef HAS_vsprintf_void
+ flags += 1L << 26;
+# endif
+# else
+# ifdef HAS_vsnprintf_void
+ flags += 1L << 26;
+# endif
+# endif
+#else
+ flags += 1L << 24;
+# ifdef NO_snprintf
+ flags += 1L << 25;
+# ifdef HAS_sprintf_void
+ flags += 1L << 26;
+# endif
+# else
+# ifdef HAS_snprintf_void
+ flags += 1L << 26;
+# endif
+# endif
+#endif
+ return flags;
+}
+
+#ifdef ZLIB_DEBUG
+#include <stdlib.h>
+# ifndef verbose
+# define verbose 0
+# endif
+int ZLIB_INTERNAL z_verbose = verbose;
+
+void ZLIB_INTERNAL z_error(
+ char *m)
+{
+ fprintf(stderr, "%s\n", m);
+ exit(1);
+}
#endif
+/* exported to allow conversion of error code to string for compress() and
+ * uncompress()
+ */
+const char * ZEXPORT zError(
+ int err)
+{
+ return ERR_MSG(err);
+}
+
+#endif /* !Z_FREETYPE */
+
+#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
+ /* The older Microsoft C Run-Time Library for Windows CE doesn't have
+ * errno. We define it as a global variable to simplify porting.
+ * Its value is always 0 and should not be used.
+ */
+ int errno = 0;
+#endif
#ifndef HAVE_MEMCPY
-void zmemcpy(dest, source, len)
- Bytef* dest;
- const Bytef* source;
- uInt len;
+void ZLIB_INTERNAL zmemcpy(
+ Bytef* dest,
+ const Bytef* source,
+ uInt len)
{
if (len == 0) return;
do {
@@ -25,10 +163,12 @@ void zmemcpy(dest, source, len)
} while (--len != 0);
}
-int zmemcmp(s1, s2, len)
- const Bytef* s1;
- const Bytef* s2;
- uInt len;
+#ifndef Z_FREETYPE
+
+int ZLIB_INTERNAL zmemcmp(
+ const Bytef* s1,
+ const Bytef* s2,
+ uInt len)
{
uInt j;
@@ -38,22 +178,25 @@ int zmemcmp(s1, s2, len)
return 0;
}
-void zmemzero(dest, len)
- Bytef* dest;
- uInt len;
+void ZLIB_INTERNAL zmemzero(
+ Bytef* dest,
+ uInt len)
{
if (len == 0) return;
do {
*dest++ = 0; /* ??? to be unrolled */
} while (--len != 0);
}
+#endif /* !Z_FREETYPE */
#endif
-#if defined( MSDOS ) && defined( __TURBOC__ ) && !defined( MY_ZCALLOC )
-#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
-/* Small and medium model in Turbo C are for now limited to near allocation
- * with reduced MAX_WBITS and MAX_MEM_LEVEL
- */
+#ifndef Z_SOLO
+
+#ifdef SYS16BIT
+
+#ifdef __TURBOC__
+/* Turbo C in 16-bit mode */
+
# define MY_ZCALLOC
/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
@@ -80,11 +223,13 @@ 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 */
+ voidpf buf;
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.
*/
@@ -104,9 +249,12 @@ 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;
+
+ (void)opaque;
+
if (*(ush*)&ptr != 0) { /* object < 64K */
farfree(ptr);
return;
@@ -122,14 +270,13 @@ void zcfree (voidpf opaque, voidpf ptr)
next_ptr--;
return;
}
- ptr = opaque; /* just to make some compilers happy */
Assert(0, "zcfree: ptr not found");
}
-#endif
-#endif /* MSDOS && __TURBOC__ */
+#endif /* __TURBOC__ */
-#if defined(M_I86) && !defined(__32BIT__) && !defined( MY_ZCALLOC )
+
+#ifdef M_I86
/* Microsoft C in 16-bit mode */
# define MY_ZCALLOC
@@ -139,43 +286,49 @@ 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 */
+ (void)opaque;
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 */
+ (void)opaque;
_hfree(ptr);
}
-#endif /* MSC */
+#endif /* M_I86 */
+
+#endif /* SYS16BIT */
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
#ifndef STDC
-extern voidp ft_scalloc OF((uInt items, uInt size));
-extern void ft_sfree OF((voidpf ptr));
+extern voidp malloc OF((uInt size));
+extern voidp calloc OF((uInt items, uInt size));
+extern void free OF((voidpf ptr));
#endif
-voidpf zcalloc (opaque, items, size)
- voidpf opaque;
- unsigned items;
- unsigned size;
+voidpf ZLIB_INTERNAL zcalloc(
+ voidpf opaque,
+ unsigned items,
+ unsigned size)
{
- if (opaque) items += size - size; /* make compiler happy */
- return (voidpf)ft_scalloc(items, size);
+ (void)opaque;
+ return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
+ (voidpf)calloc(items, size);
}
-void zcfree (opaque, ptr)
- voidpf opaque;
- voidpf ptr;
+void ZLIB_INTERNAL zcfree(
+ voidpf opaque,
+ voidpf ptr)
{
- ft_sfree(ptr);
- if (opaque) return; /* make compiler happy */
+ (void)opaque;
+ free(ptr);
}
#endif /* MY_ZCALLOC */
+
+#endif /* !Z_SOLO */