summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Utilities/IWYU/mapping.imp1
-rw-r--r--Utilities/cmzlib/cm_zlib_mangle.h132
-rw-r--r--Utilities/cmzlib/gzread.c2
-rw-r--r--Utilities/cmzlib/zconf.h2
-rw-r--r--Utilities/cmzlib/zlib.h18
5 files changed, 155 insertions, 0 deletions
diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp
index 64e901e..b80fc22 100644
--- a/Utilities/IWYU/mapping.imp
+++ b/Utilities/IWYU/mapping.imp
@@ -106,6 +106,7 @@
{ include: [ "@<.*uv/.+\\.h>", private, "<cm3p/uv.h>", public ] },
{ include: [ "@<.*expat_external.h>", private, "<cm3p/expat.h>", public ] },
{ include: [ "@<.*zconf.h>", private, "<cm3p/zlib.h>", public ] },
+ { include: [ "@<.*cm_zlib_mangle.h>", private, "<cm3p/zlib.h>", public ] },
# # System symbols used by libuv
{ symbol: [ "ssize_t", private, "<cm3p/uv.h>", public ] },
diff --git a/Utilities/cmzlib/cm_zlib_mangle.h b/Utilities/cmzlib/cm_zlib_mangle.h
new file mode 100644
index 0000000..1461e2f
--- /dev/null
+++ b/Utilities/cmzlib/cm_zlib_mangle.h
@@ -0,0 +1,132 @@
+#ifndef cm_zlib_mangle_h
+#define cm_zlib_mangle_h
+
+/* Mangle symbols like Z_PREFIX, but with a different prefix. */
+#define _dist_code cm_zlib__dist_code
+#define _length_code cm_zlib__length_code
+#define _tr_align cm_zlib__tr_align
+#define _tr_flush_bits cm_zlib__tr_flush_bits
+#define _tr_flush_block cm_zlib__tr_flush_block
+#define _tr_init cm_zlib__tr_init
+#define _tr_stored_block cm_zlib__tr_stored_block
+#define _tr_tally cm_zlib__tr_tally
+#define adler32 cm_zlib_adler32
+#define adler32_combine cm_zlib_adler32_combine
+#define adler32_combine64 cm_zlib_adler32_combine64
+#define adler32_z cm_zlib_adler32_z
+#ifndef Z_SOLO
+# define compress cm_zlib_compress
+# define compress2 cm_zlib_compress2
+# define compressBound cm_zlib_compressBound
+#endif
+#define crc32 z_crc32
+#define crc32_combine cm_zlib_crc32_combine
+#define crc32_combine64 cm_zlib_crc32_combine64
+#define crc32_z cm_zlib_crc32_z
+#define deflate cm_zlib_deflate
+#define deflateBound cm_zlib_deflateBound
+#define deflateCopy cm_zlib_deflateCopy
+#define deflateEnd cm_zlib_deflateEnd
+#define deflateGetDictionary cm_zlib_deflateGetDictionary
+#define deflateInit cm_zlib_deflateInit
+#define deflateInit2 cm_zlib_deflateInit2
+#define deflateInit2_ cm_zlib_deflateInit2_
+#define deflateInit_ cm_zlib_deflateInit_
+#define deflateParams cm_zlib_deflateParams
+#define deflatePending cm_zlib_deflatePending
+#define deflatePrime cm_zlib_deflatePrime
+#define deflateReset cm_zlib_deflateReset
+#define deflateResetKeep cm_zlib_deflateResetKeep
+#define deflateSetDictionary cm_zlib_deflateSetDictionary
+#define deflateSetHeader cm_zlib_deflateSetHeader
+#define deflateTune cm_zlib_deflateTune
+#define deflate_copyright cm_zlib_deflate_copyright
+#define get_crc_table cm_zlib_get_crc_table
+#ifndef Z_SOLO
+# define gcm_zlib_error cm_zlib_gcm_zlib_error
+# define gcm_zlib_intmax cm_zlib_gcm_zlib_intmax
+# define gcm_zlib_strwinerror cm_zlib_gcm_zlib_strwinerror
+# define gzbuffer cm_zlib_gzbuffer
+# define gzclearerr cm_zlib_gzclearerr
+# define gzclose cm_zlib_gzclose
+# define gzclose_r cm_zlib_gzclose_r
+# define gzclose_w cm_zlib_gzclose_w
+# define gzdirect cm_zlib_gzdirect
+# define gzdopen cm_zlib_gzdopen
+# define gzeof cm_zlib_gzeof
+# define gzerror cm_zlib_gzerror
+# define gzflush cm_zlib_gzflush
+# define gzfread cm_zlib_gzfread
+# define gzfwrite cm_zlib_gzfwrite
+# define gzgetc cm_zlib_gzgetc
+# define gzgetc_ cm_zlib_gzgetc_
+# define gzgets cm_zlib_gzgets
+# define gzoffset cm_zlib_gzoffset
+# define gzoffset64 cm_zlib_gzoffset64
+# define gzopen cm_zlib_gzopen
+# define gzopen64 cm_zlib_gzopen64
+# ifdef _WIN32
+# define gzopen_w cm_zlib_gzopen_w
+# endif
+# define gzprintf cm_zlib_gzprintf
+# define gzputc cm_zlib_gzputc
+# define gzputs cm_zlib_gzputs
+# define gzread cm_zlib_gzread
+# define gzrewind cm_zlib_gzrewind
+# define gzseek cm_zlib_gzseek
+# define gzseek64 cm_zlib_gzseek64
+# define gzsetparams cm_zlib_gzsetparams
+# define gztell cm_zlib_gztell
+# define gztell64 cm_zlib_gztell64
+# define gzungetc cm_zlib_gzungetc
+# define gzvprintf cm_zlib_gzvprintf
+# define gzwrite cm_zlib_gzwrite
+#endif
+#define inflate cm_zlib_inflate
+#define inflateBack cm_zlib_inflateBack
+#define inflateBackEnd cm_zlib_inflateBackEnd
+#define inflateBackInit cm_zlib_inflateBackInit
+#define inflateBackInit_ cm_zlib_inflateBackInit_
+#define inflateCodesUsed cm_zlib_inflateCodesUsed
+#define inflateCopy cm_zlib_inflateCopy
+#define inflateEnd cm_zlib_inflateEnd
+#define inflateGetDictionary cm_zlib_inflateGetDictionary
+#define inflateGetHeader cm_zlib_inflateGetHeader
+#define inflateInit cm_zlib_inflateInit
+#define inflateInit2 cm_zlib_inflateInit2
+#define inflateInit2_ cm_zlib_inflateInit2_
+#define inflateInit_ cm_zlib_inflateInit_
+#define inflateMark cm_zlib_inflateMark
+#define inflatePrime cm_zlib_inflatePrime
+#define inflateReset cm_zlib_inflateReset
+#define inflateReset2 cm_zlib_inflateReset2
+#define inflateResetKeep cm_zlib_inflateResetKeep
+#define inflateSetDictionary cm_zlib_inflateSetDictionary
+#define inflateSync cm_zlib_inflateSync
+#define inflateSyncPoint cm_zlib_inflateSyncPoint
+#define inflateUndermine cm_zlib_inflateUndermine
+#define inflateValidate cm_zlib_inflateValidate
+#define inflate_copyright cm_zlib_inflate_copyright
+#define inflate_fast cm_zlib_inflate_fast
+#define inflate_table cm_zlib_inflate_table
+#ifndef Z_SOLO
+# define uncompress cm_zlib_uncompress
+# define uncompress2 cm_zlib_uncompress2
+#endif
+#define zError cm_zlib_zError
+#ifndef Z_SOLO
+# define zcalloc cm_zlib_zcalloc
+# define zcfree cm_zlib_zcfree
+#endif
+#define zlibCompileFlags cm_zlib_zlibCompileFlags
+#define zlibVersion cm_zlib_zlibVersion
+
+/* Mangle symbols not covered by Z_PREFIX. */
+#define crc32_combine_gen64 cm_zlib_crc32_combine_gen64
+#define crc32_combine_gen cm_zlib_crc32_combine_gen
+#define crc32_combine_op cm_zlib_crc32_combine_op
+#define gz_error cm_zlib_gz_error
+#define z_crc32 cm_zlib_z_crc32
+#define z_errmsg cm_zlib_z_errmsg
+
+#endif
diff --git a/Utilities/cmzlib/gzread.c b/Utilities/cmzlib/gzread.c
index 884c9bf..22052dd 100644
--- a/Utilities/cmzlib/gzread.c
+++ b/Utilities/cmzlib/gzread.c
@@ -441,6 +441,8 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file)
/* -- see zlib.h -- */
#ifdef Z_PREFIX_SET
# undef z_gzgetc
+#elif 1 /* Hook for mangling inside CMake. */
+# undef cm_zlib_gzgetc
#else
# undef gzgetc
#endif
diff --git a/Utilities/cmzlib/zconf.h b/Utilities/cmzlib/zconf.h
index 2424b2c..1790072 100644
--- a/Utilities/cmzlib/zconf.h
+++ b/Utilities/cmzlib/zconf.h
@@ -8,6 +8,8 @@
#ifndef ZCONF_H
#define ZCONF_H
+#include "cm_zlib_mangle.h" /* Hook for mangling inside CMake. */
+
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
diff --git a/Utilities/cmzlib/zlib.h b/Utilities/cmzlib/zlib.h
index 4a98e38..3764e85 100644
--- a/Utilities/cmzlib/zlib.h
+++ b/Utilities/cmzlib/zlib.h
@@ -1806,6 +1806,20 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
# define z_inflateBackInit(strm, windowBits, window) \
inflateBackInit_((strm), (windowBits), (window), \
ZLIB_VERSION, (int)sizeof(z_stream))
+#elif 1 /* Hook for mangling inside CMake. */
+# define cm_zlib_deflateInit(strm, level) \
+ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
+# define cm_zlib_inflateInit(strm) \
+ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
+# define cm_zlib_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+ (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
+# define cm_zlib_inflateInit2(strm, windowBits) \
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
+ (int)sizeof(z_stream))
+# define cm_zlib_inflateBackInit(strm, windowBits, window) \
+ inflateBackInit_((strm), (windowBits), (window), \
+ ZLIB_VERSION, (int)sizeof(z_stream))
#else
# define deflateInit(strm, level) \
deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
@@ -1841,6 +1855,10 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
# undef z_gzgetc
# define z_gzgetc(g) \
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
+#elif 1 /* Hook for mangling inside CMake. */
+# undef cm_zlib_gzgetc
+# define cm_zlib_gzgetc(g) \
+ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
#else
# define gzgetc(g) \
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))