summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vanderson <david.vanderson@gmail.com>2022-12-14 09:58:44 +0100
committerWerner Lemberg <wl@gnu.org>2022-12-14 10:44:03 +0100
commitace97a02a4461bbdae29da4019c105eead95e277 (patch)
tree2bad29b70634ce6e69c07e420026b2af1982510c
parentbc3aa767a7c4399b057c922192fc46948bf8fcf4 (diff)
downloadfreetype2-ace97a02a4461bbdae29da4019c105eead95e277.tar.gz
[gzip] Make static compilation not leak global symbols.
* src/gzip/ftgzip.c (HAVE_HIDDEN): Do not define; it is no longer needed because everything is static. (HAVE_MEMCPY): Define. (zcalloc, zcfree): Remove no longer needed definitions (because `Z_SOLO` is active). * src/gzip/patches/freetype-zlib.diff: Regenerated. Fixes #1146. Co-authored-by: Werner Lemberg <wl@gnu.org>
-rw-r--r--src/gzip/crc32.c10
-rw-r--r--src/gzip/ftgzip.c34
-rw-r--r--src/gzip/inffast.h2
-rw-r--r--src/gzip/inflate.c12
-rw-r--r--src/gzip/inftrees.c2
-rw-r--r--src/gzip/inftrees.h2
-rw-r--r--src/gzip/patches/freetype-zlib.diff293
-rw-r--r--src/gzip/zlib.h7
-rw-r--r--src/gzip/zutil.c7
-rw-r--r--src/gzip/zutil.h2
10 files changed, 227 insertions, 144 deletions
diff --git a/src/gzip/crc32.c b/src/gzip/crc32.c
index 3a52aa89d..6cd1b09d5 100644
--- a/src/gzip/crc32.c
+++ b/src/gzip/crc32.c
@@ -103,9 +103,11 @@
# define ARMCRC32
#endif
+#ifndef Z_FREETYPE
/* Local functions. */
local z_crc_t multmodp OF((z_crc_t a, z_crc_t b));
local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
+#endif /* Z_FREETYPE */
#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
local z_word_t byte_swap OF((z_word_t word));
@@ -544,6 +546,8 @@ local void braid(ltl, big, n, w)
* generation above.
*/
+#ifndef Z_FREETYPE
+
/*
Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
reflected. For speed, this requires that a not be zero.
@@ -600,6 +604,8 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
return (const z_crc_t FAR *)crc_table;
}
+#endif /* Z_FREETYPE */
+
/* =========================================================================
* Use ARM machine instructions if available. This will compute the CRC about
* ten times faster than the braided calculation. This code does not check for
@@ -1077,6 +1083,8 @@ unsigned long ZEXPORT crc32(
return crc32_z(crc, buf, len);
}
+#ifndef Z_FREETYPE
+
/* ========================================================================= */
uLong ZEXPORT crc32_combine64(
uLong crc1,
@@ -1123,3 +1131,5 @@ uLong ZEXPORT crc32_combine_op(
{
return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
}
+
+#endif /* Z_FREETYPE */
diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c
index 915182e1f..b415e9d6c 100644
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -70,20 +70,14 @@
/* so that configuration with `FT_CONFIG_OPTION_SYSTEM_ZLIB' might */
/* include the wrong `zconf.h' file, leading to errors. */
- /* `HAVE_HIDDEN` should be defined if */
- /* */
- /* __attribute__((visibility("hidden"))) */
- /* */
- /* is supported by the compiler, which prevents internal symbols from */
- /* being exported by the library. */
#if defined( __GNUC__ ) || defined( __clang__ )
-#define HAVE_HIDDEN 1
#define ZEXPORT
#define ZEXTERN static
#endif
-#define Z_SOLO 1
-#define Z_FREETYPE 1
+#define HAVE_MEMCPY 1
+#define Z_SOLO 1
+#define Z_FREETYPE 1
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
/* We disable the warning `conversion from XXX to YYY, */
@@ -157,28 +151,6 @@
FT_MEM_FREE( address );
}
-
-#if !defined( FT_CONFIG_OPTION_SYSTEM_ZLIB ) && !defined( USE_ZLIB_ZCALLOC )
-
- voidpf ZLIB_INTERNAL
- zcalloc ( voidpf opaque,
- unsigned items,
- unsigned size )
- {
- return ft_gzip_alloc( opaque, items, size );
- }
-
-
- void ZLIB_INTERNAL
- zcfree( voidpf opaque,
- voidpf ptr )
- {
- ft_gzip_free( opaque, ptr );
- }
-
-#endif /* !SYSTEM_ZLIB && !USE_ZLIB_ZCALLOC */
-
-
/***************************************************************************/
/***************************************************************************/
/***** *****/
diff --git a/src/gzip/inffast.h b/src/gzip/inffast.h
index e5c1aa4ca..684ae878c 100644
--- a/src/gzip/inffast.h
+++ b/src/gzip/inffast.h
@@ -8,4 +8,4 @@
subject to change. Applications should only use zlib.h.
*/
-void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
+static void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
diff --git a/src/gzip/inflate.c b/src/gzip/inflate.c
index 33c7cf2fe..5117e2e26 100644
--- a/src/gzip/inflate.c
+++ b/src/gzip/inflate.c
@@ -241,6 +241,8 @@ int ZEXPORT inflateInit2_(
return ret;
}
+#ifndef Z_FREETYPE
+
int ZEXPORT inflateInit_(
z_streamp strm,
const char *version,
@@ -249,8 +251,6 @@ int ZEXPORT inflateInit_(
return inflateInit2_(strm, DEF_WBITS, version, stream_size);
}
-#ifndef Z_FREETYPE
-
int ZEXPORT inflatePrime(
z_streamp strm,
int bits,
@@ -1482,8 +1482,6 @@ int ZEXPORT inflateSync(
return Z_OK;
}
-#endif /* !Z_FREETYPE */
-
/*
Returns true if inflate is currently at the end of a block generated by
Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
@@ -1502,8 +1500,6 @@ int ZEXPORT inflateSyncPoint(
return state->mode == STORED && state->bits == 0;
}
-#ifndef Z_FREETYPE
-
int ZEXPORT inflateCopy(
z_streamp dest,
z_streamp source)
@@ -1551,8 +1547,6 @@ int ZEXPORT inflateCopy(
return Z_OK;
}
-#endif /* !Z_FREETYPE */
-
int ZEXPORT inflateUndermine(
z_streamp strm,
int subvert)
@@ -1586,8 +1580,6 @@ int ZEXPORT inflateValidate(
return Z_OK;
}
-#ifndef Z_FREETYPE
-
long ZEXPORT inflateMark(
z_streamp strm)
{
diff --git a/src/gzip/inftrees.c b/src/gzip/inftrees.c
index d8405a24c..dd4965e9a 100644
--- a/src/gzip/inftrees.c
+++ b/src/gzip/inftrees.c
@@ -8,7 +8,7 @@
#define MAXBITS 15
-const char inflate_copyright[] =
+static const char inflate_copyright[] =
" inflate 1.2.13 Copyright 1995-2022 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
diff --git a/src/gzip/inftrees.h b/src/gzip/inftrees.h
index 2daa00063..a2207efb1 100644
--- a/src/gzip/inftrees.h
+++ b/src/gzip/inftrees.h
@@ -60,7 +60,7 @@ typedef enum {
DISTS
} codetype;
-int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
+static int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
unsigned codes, code FAR * FAR *table,
unsigned FAR *bits, unsigned short FAR *work));
diff --git a/src/gzip/patches/freetype-zlib.diff b/src/gzip/patches/freetype-zlib.diff
index 42eea1928..6ac76df62 100644
--- a/src/gzip/patches/freetype-zlib.diff
+++ b/src/gzip/patches/freetype-zlib.diff
@@ -3,19 +3,22 @@
We must ensure that they do not issue compiler errors or warnings when they
are compiled as part of `src/gzip/ftgzip.c`.
-* src/gzip/adler32.c: Do not define unused functions when `Z_FREETYPE`
-is set.
-
* src/gzip/gzguts.h (COPY): Rename to...
(COPY__): ... this since `COPY` and `COPY_` conflict with enum values,
which have the same name in `zlib.h`.
-* src/gzip/inflate.c, src/gzip/adler32.c: Omit unused function
-declarations when `Z_FREETYPE` is defined.
+* src/gzip/inflate.c, src/gzip/adler32.c, src/gzip/crc32.c,
+src/gzip/zutil.c: Omit unused function declarations and definitions when
+`Z_FREETYPE` is defined.
+
+* src/gzip/inffast.h (inflate_fast): Declare as static.
+
+* src/gzip/inftrees.c (inflate_copyright): Declare as static.
* src/gzip/zlib.h: Include `ftzconf.h` instead of `zconf.h` to avoid
conflicts with system-installed headers.
Omit unused function declarations when `Z_FREETYPE` is defined.
+(inflateInit2)[Z_FREETYPE]: Provide proper declaration.
* src/gzip/zutil.h: Use `ft_memxxx` functions instead of `memxxx`.
Omit unused function declarations when `Z_FREETYPE` is defined.
@@ -23,10 +26,13 @@ Omit unused function declarations when `Z_FREETYPE` is defined.
* src/gzip/inflate.h, src/gzip/inftrees.h: Add header guard macros to
prevent compiler errors.
-diff --git a/src/gzip/adler32.c b/src/gzip/adler32.c
+* src/gzip/inftrees.h: Add header guard macros to prevent compiler errors.
+(inflate_table): Declare as static.
+
+diff --git b/src/gzip/adler32.c a/src/gzip/adler32.c
index be5e8a247..aa032e1dd 100644
---- a/src/gzip/adler32.c
-+++ b/src/gzip/adler32.c
+--- b/src/gzip/adler32.c
++++ a/src/gzip/adler32.c
@@ -7,7 +7,9 @@
#include "zutil.h"
@@ -52,10 +58,59 @@ index be5e8a247..aa032e1dd 100644
}
+
+#endif /* !Z_FREETYPE */
-diff --git a/src/gzip/gzguts.h b/src/gzip/gzguts.h
+diff --git b/src/gzip/crc32.c a/src/gzip/crc32.c
+index 3a52aa89d..6cd1b09d5 100644
+--- b/src/gzip/crc32.c
++++ a/src/gzip/crc32.c
+@@ -103,9 +103,11 @@
+ # define ARMCRC32
+ #endif
+
++#ifndef Z_FREETYPE
+ /* Local functions. */
+ local z_crc_t multmodp OF((z_crc_t a, z_crc_t b));
+ local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
++#endif /* Z_FREETYPE */
+
+ #if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
+ local z_word_t byte_swap OF((z_word_t word));
+@@ -544,6 +546,8 @@ local void braid(ltl, big, n, w)
+ * generation above.
+ */
+
++#ifndef Z_FREETYPE
++
+ /*
+ Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
+ reflected. For speed, this requires that a not be zero.
+@@ -600,6 +604,8 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
+ return (const z_crc_t FAR *)crc_table;
+ }
+
++#endif /* Z_FREETYPE */
++
+ /* =========================================================================
+ * Use ARM machine instructions if available. This will compute the CRC about
+ * ten times faster than the braided calculation. This code does not check for
+@@ -1077,6 +1083,8 @@ unsigned long ZEXPORT crc32(
+ return crc32_z(crc, buf, len);
+ }
+
++#ifndef Z_FREETYPE
++
+ /* ========================================================================= */
+ uLong ZEXPORT crc32_combine64(
+ uLong crc1,
+@@ -1123,3 +1131,5 @@ uLong ZEXPORT crc32_combine_op(
+ {
+ return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
+ }
++
++#endif /* Z_FREETYPE */
+diff --git b/src/gzip/gzguts.h a/src/gzip/gzguts.h
index 57faf3716..4f09a52a7 100644
---- a/src/gzip/gzguts.h
-+++ b/src/gzip/gzguts.h
+--- b/src/gzip/gzguts.h
++++ a/src/gzip/gzguts.h
@@ -163,7 +163,7 @@
/* values for gz_state how */
@@ -65,10 +120,20 @@ index 57faf3716..4f09a52a7 100644
#define GZIP 2 /* decompress a gzip stream */
/* internal gzip file state data structure */
-diff --git a/src/gzip/inflate.c b/src/gzip/inflate.c
-index c9e566b03..33c7cf2fe 100644
---- a/src/gzip/inflate.c
-+++ b/src/gzip/inflate.c
+diff --git b/src/gzip/inffast.h a/src/gzip/inffast.h
+index e5c1aa4ca..684ae878c 100644
+--- b/src/gzip/inffast.h
++++ a/src/gzip/inffast.h
+@@ -8,4 +8,4 @@
+ subject to change. Applications should only use zlib.h.
+ */
+
+-void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
++static void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
+diff --git b/src/gzip/inflate.c a/src/gzip/inflate.c
+index c9e566b03..5117e2e26 100644
+--- b/src/gzip/inflate.c
++++ a/src/gzip/inflate.c
@@ -99,8 +99,10 @@ local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
#ifdef BUILDFIXED
void makefixed OF((void));
@@ -80,15 +145,15 @@ index c9e566b03..33c7cf2fe 100644
local int inflateStateCheck(
z_streamp strm)
-@@ -247,6 +249,8 @@ int ZEXPORT inflateInit_(
- return inflateInit2_(strm, DEF_WBITS, version, stream_size);
+@@ -239,6 +241,8 @@ int ZEXPORT inflateInit2_(
+ return ret;
}
+#ifndef Z_FREETYPE
+
- int ZEXPORT inflatePrime(
+ int ZEXPORT inflateInit_(
z_streamp strm,
- int bits,
+ const char *version,
@@ -268,6 +272,8 @@ int ZEXPORT inflatePrime(
return Z_OK;
}
@@ -107,52 +172,16 @@ index c9e566b03..33c7cf2fe 100644
int ZEXPORT inflateGetDictionary(
z_streamp strm,
Bytef *dictionary,
-@@ -1474,6 +1482,8 @@ int ZEXPORT inflateSync(
- return Z_OK;
- }
-
-+#endif /* !Z_FREETYPE */
-+
- /*
- Returns true if inflate is currently at the end of a block generated by
- Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
-@@ -1492,6 +1502,8 @@ int ZEXPORT inflateSyncPoint(
- return state->mode == STORED && state->bits == 0;
- }
-
-+#ifndef Z_FREETYPE
-+
- int ZEXPORT inflateCopy(
- z_streamp dest,
- z_streamp source)
-@@ -1539,6 +1551,8 @@ int ZEXPORT inflateCopy(
- return Z_OK;
- }
-
-+#endif /* !Z_FREETYPE */
-+
- int ZEXPORT inflateUndermine(
- z_streamp strm,
- int subvert)
-@@ -1572,6 +1586,8 @@ int ZEXPORT inflateValidate(
- return Z_OK;
- }
-
-+#ifndef Z_FREETYPE
-+
- long ZEXPORT inflateMark(
- z_streamp strm)
- {
-@@ -1593,3 +1609,5 @@ unsigned long ZEXPORT inflateCodesUsed(
+@@ -1593,3 +1601,5 @@ unsigned long ZEXPORT inflateCodesUsed(
state = (struct inflate_state FAR *)strm->state;
return (unsigned long)(state->next - state->codes);
}
+
+#endif /* !Z_FREETYPE */
-diff --git a/src/gzip/inflate.h b/src/gzip/inflate.h
+diff --git b/src/gzip/inflate.h a/src/gzip/inflate.h
index f127b6b1f..c6f5a52e1 100644
---- a/src/gzip/inflate.h
-+++ b/src/gzip/inflate.h
+--- b/src/gzip/inflate.h
++++ a/src/gzip/inflate.h
@@ -3,6 +3,9 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -169,10 +198,23 @@ index f127b6b1f..c6f5a52e1 100644
};
+
+#endif /* INFLATE_H */
-diff --git a/src/gzip/inftrees.h b/src/gzip/inftrees.h
-index f53665311..2daa00063 100644
---- a/src/gzip/inftrees.h
-+++ b/src/gzip/inftrees.h
+diff --git b/src/gzip/inftrees.c a/src/gzip/inftrees.c
+index d8405a24c..dd4965e9a 100644
+--- b/src/gzip/inftrees.c
++++ a/src/gzip/inftrees.c
+@@ -8,7 +8,7 @@
+
+ #define MAXBITS 15
+
+-const char inflate_copyright[] =
++static const char inflate_copyright[] =
+ " inflate 1.2.13 Copyright 1995-2022 Mark Adler ";
+ /*
+ If you use the zlib library in a product, an acknowledgment is welcome
+diff --git b/src/gzip/inftrees.h a/src/gzip/inftrees.h
+index f53665311..a2207efb1 100644
+--- b/src/gzip/inftrees.h
++++ a/src/gzip/inftrees.h
@@ -3,6 +3,9 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -183,16 +225,20 @@ index f53665311..2daa00063 100644
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
-@@ -60,3 +63,5 @@ typedef enum {
- int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
+@@ -57,6 +60,8 @@ typedef enum {
+ DISTS
+ } codetype;
+
+-int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
++static int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
unsigned codes, code FAR * FAR *table,
unsigned FAR *bits, unsigned short FAR *work));
+
+#endif /* INFTREES_H_ */
-diff --git a/src/gzip/zlib.h b/src/gzip/zlib.h
-index 953cb5012..bbbf75151 100644
---- a/src/gzip/zlib.h
-+++ b/src/gzip/zlib.h
+diff --git b/src/gzip/zlib.h a/src/gzip/zlib.h
+index 953cb5012..3f2f76e3c 100644
+--- b/src/gzip/zlib.h
++++ a/src/gzip/zlib.h
@@ -31,7 +31,7 @@
#ifndef ZLIB_H
#define ZLIB_H
@@ -211,15 +257,7 @@ index 953cb5012..bbbf75151 100644
#define zlib_version zlibVersion()
/* for compatibility with versions < 1.0.2 */
-@@ -246,7 +248,6 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
- this will be done by deflate().
- */
-
--
- ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
- /*
- deflate compresses as much data as possible, and stops when the input
-@@ -373,6 +374,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+@@ -373,6 +375,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
deallocated).
*/
@@ -227,7 +265,7 @@ index 953cb5012..bbbf75151 100644
/*
ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
-@@ -534,6 +536,8 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+@@ -534,6 +537,8 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
The following functions are needed only in some special applications.
*/
@@ -236,7 +274,7 @@ index 953cb5012..bbbf75151 100644
/*
ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
int level,
-@@ -956,6 +960,8 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
+@@ -956,6 +961,8 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
destination.
*/
@@ -245,7 +283,7 @@ index 953cb5012..bbbf75151 100644
ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
/*
This function is equivalent to inflateEnd followed by inflateInit,
-@@ -980,6 +986,8 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
+@@ -980,6 +987,8 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
the windowBits parameter is invalid.
*/
@@ -254,7 +292,7 @@ index 953cb5012..bbbf75151 100644
ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
int bits,
int value));
-@@ -1069,6 +1077,8 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
+@@ -1069,6 +1078,8 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
stream state was inconsistent.
*/
@@ -263,7 +301,7 @@ index 953cb5012..bbbf75151 100644
/*
ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
unsigned char FAR *window));
-@@ -1095,6 +1105,8 @@ typedef unsigned (*in_func) OF((void FAR *,
+@@ -1095,6 +1106,8 @@ typedef unsigned (*in_func) OF((void FAR *,
z_const unsigned char FAR * FAR *));
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
@@ -272,7 +310,7 @@ index 953cb5012..bbbf75151 100644
ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
in_func in, void FAR *in_desc,
out_func out, void FAR *out_desc));
-@@ -1214,6 +1226,8 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
+@@ -1214,6 +1227,8 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
27-31: 0 (reserved)
*/
@@ -281,16 +319,16 @@ index 953cb5012..bbbf75151 100644
#ifndef Z_SOLO
/* utility functions */
-@@ -1742,6 +1756,8 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
- if (crc != original_crc) error();
+@@ -1765,6 +1780,8 @@ ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t len2));
+ crc32_combine_op().
*/
+#ifndef Z_FREETYPE
+
- ZEXTERN uLong ZEXPORT crc32_z OF((uLong crc, const Bytef *buf,
- z_size_t len));
+ ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op));
/*
-@@ -1822,6 +1838,19 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
+ Give the same result as crc32_combine(), using op in place of len2. op is
+@@ -1822,6 +1839,19 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
ZLIB_VERSION, (int)sizeof(z_stream))
#endif
@@ -310,7 +348,7 @@ index 953cb5012..bbbf75151 100644
#ifndef Z_SOLO
/* gzgetc() macro and its supporting function and exposed data structure. Note
-@@ -1901,13 +1930,16 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
+@@ -1901,20 +1931,25 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
#else /* Z_SOLO */
@@ -327,7 +365,16 @@ index 953cb5012..bbbf75151 100644
ZEXTERN const char * ZEXPORT zError OF((int));
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
-@@ -1927,6 +1959,7 @@ ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
+ ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
+ ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int));
+ ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF((z_streamp));
++#endif /* !Z_FREETYPE */
+ ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
++#ifndef Z_FREETYPE
+ ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
+ #if defined(_WIN32) && !defined(Z_SOLO)
+ ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
+@@ -1927,6 +1962,7 @@ ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
va_list va));
# endif
#endif
@@ -335,11 +382,61 @@ index 953cb5012..bbbf75151 100644
#ifdef __cplusplus
}
-diff --git a/src/gzip/zutil.h b/src/gzip/zutil.h
-index 0bc7f4ecd..d309bd069 100644
---- a/src/gzip/zutil.h
-+++ b/src/gzip/zutil.h
-@@ -188,6 +188,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+diff --git b/src/gzip/zutil.c a/src/gzip/zutil.c
+index ef174ca64..542706ca0 100644
+--- b/src/gzip/zutil.c
++++ a/src/gzip/zutil.c
+@@ -10,6 +10,8 @@
+ # include "gzguts.h"
+ #endif
+
++#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 */
+@@ -138,6 +140,8 @@ const char * ZEXPORT zError(
+ 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.
+@@ -159,6 +163,8 @@ void ZLIB_INTERNAL zmemcpy(
+ } while (--len != 0);
+ }
+
++#ifndef Z_FREETYPE
++
+ int ZLIB_INTERNAL zmemcmp(
+ const Bytef* s1,
+ const Bytef* s2,
+@@ -181,6 +187,7 @@ void ZLIB_INTERNAL zmemzero(
+ *dest++ = 0; /* ??? to be unrolled */
+ } while (--len != 0);
+ }
++#endif /* !Z_FREETYPE */
+ #endif
+
+ #ifndef Z_SOLO
+diff --git b/src/gzip/zutil.h a/src/gzip/zutil.h
+index 0bc7f4ecd..055ba8b62 100644
+--- b/src/gzip/zutil.h
++++ a/src/gzip/zutil.h
+@@ -53,8 +53,10 @@ typedef unsigned long ulg;
+ # endif
+ #endif
+
++#ifndef Z_FREETYPE
+ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+ /* (size given to avoid silly warnings with Visual C++) */
++#endif /* !Z_FREETYPE */
+
+ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+
+@@ -188,6 +190,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#pragma warn -8066
#endif
@@ -348,7 +445,7 @@ index 0bc7f4ecd..d309bd069 100644
/* provide prototypes for these when building zlib without LFS */
#if !defined(_WIN32) && \
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
-@@ -196,6 +198,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+@@ -196,6 +200,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
#endif
@@ -357,7 +454,7 @@ index 0bc7f4ecd..d309bd069 100644
/* common defaults */
#ifndef OS_CODE
-@@ -227,9 +231,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+@@ -227,9 +233,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define zmemcmp _fmemcmp
# define zmemzero(dest, len) _fmemset(dest, 0, len)
# else
diff --git a/src/gzip/zlib.h b/src/gzip/zlib.h
index bbbf75151..3f2f76e3c 100644
--- a/src/gzip/zlib.h
+++ b/src/gzip/zlib.h
@@ -248,6 +248,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
this will be done by deflate().
*/
+
ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
/*
deflate compresses as much data as possible, and stops when the input
@@ -1756,8 +1757,6 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
if (crc != original_crc) error();
*/
-#ifndef Z_FREETYPE
-
ZEXTERN uLong ZEXPORT crc32_z OF((uLong crc, const Bytef *buf,
z_size_t len));
/*
@@ -1781,6 +1780,8 @@ ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t len2));
crc32_combine_op().
*/
+#ifndef Z_FREETYPE
+
ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op));
/*
Give the same result as crc32_combine(), using op in place of len2. op is
@@ -1946,7 +1947,9 @@ ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int));
ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF((z_streamp));
+#endif /* !Z_FREETYPE */
ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
+#ifndef Z_FREETYPE
ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
#if defined(_WIN32) && !defined(Z_SOLO)
ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
diff --git a/src/gzip/zutil.c b/src/gzip/zutil.c
index ef174ca64..542706ca0 100644
--- a/src/gzip/zutil.c
+++ b/src/gzip/zutil.c
@@ -10,6 +10,8 @@
# include "gzguts.h"
#endif
+#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 */
@@ -138,6 +140,8 @@ const char * ZEXPORT zError(
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.
@@ -159,6 +163,8 @@ void ZLIB_INTERNAL zmemcpy(
} while (--len != 0);
}
+#ifndef Z_FREETYPE
+
int ZLIB_INTERNAL zmemcmp(
const Bytef* s1,
const Bytef* s2,
@@ -181,6 +187,7 @@ void ZLIB_INTERNAL zmemzero(
*dest++ = 0; /* ??? to be unrolled */
} while (--len != 0);
}
+#endif /* !Z_FREETYPE */
#endif
#ifndef Z_SOLO
diff --git a/src/gzip/zutil.h b/src/gzip/zutil.h
index d309bd069..055ba8b62 100644
--- a/src/gzip/zutil.h
+++ b/src/gzip/zutil.h
@@ -53,8 +53,10 @@ typedef unsigned long ulg;
# endif
#endif
+#ifndef Z_FREETYPE
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */
+#endif /* !Z_FREETYPE */
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]