common.h \
compat.h \
compress.h \
- compress_zlib.h \
compress_lz4.h \
compress_lzo2.h \
compress_lzma.h \
compress_bzip2.h \
+ compress_zlib.h \
+ compress_zlib_remap.h \
crypto.h \
crypto_nss.h \
crypto_openssl.h \
logging.h \
netutils.h \
onwire.h \
+ remap.h \
threads_common.h \
threads_dsthandler.h \
threads_heartbeat.h \
#include "config.h"
+#define CANARY
+
char BZ2_bzBuffToBuffCompress(void);
char LZ4_compress_HC(void);
char lzma_easy_buffer_encode(void);
char lzo1x_1_compress(void);
-char compress2(void);
+#include "compress_zlib_remap.h"
+
+#define CANARY_CALL
int main (void)
{
lzo1x_1_compress() +
#endif
#ifdef BUILDCOMPZLIB
- compress2() +
+#include "compress_zlib_remap.h"
#endif
0;
}
*/
static void *zlib_lib;
-/*
- * symbols remapping
- */
-int (*_int_uncompress)(Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen);
-int (*_int_compress2)(Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen,
- int level);
+#include "compress_zlib_remap.h"
static int zlib_remap_symbols(knet_handle_t knet_h)
{
--- /dev/null
+#include "remap.h"
+
+REMAP_PROTO(int,uncompress,
+ (Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen))
+REMAP_PROTO(int,compress2,
+ (Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen,
+ int level))
--- /dev/null
+/* Repeated inclusions define this differently */
+#undef REMAP_PROTO
+
+#ifdef CANARY
+
+/* Canary uses fake prototype to make "calls" uniform */
+#ifdef CANARY_CALL
+#define REMAP_PROTO(ret,name,args) name() +
+#else
+#define REMAP_PROTO(ret,name,args) char name(void);
+#endif /* CANARY_CALL */
+
+#else
+#define REMAP_PROTO(ret,name,args) ret (*_int_ ## name)args;
+
+#endif /* CANARY */