Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

Commit

Permalink
Rename symbols in bundled zlib so it can coexist with dynamically lin…
Browse files Browse the repository at this point in the history
…ked system zlib. Also rename md4/sha1 symbols for good measure, even though they don't seem to conflict with anything.
  • Loading branch information
merlino authored and gianm committed Jan 17, 2012
1 parent 6d8e91f commit e973819
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
11 changes: 11 additions & 0 deletions c/librcksum/md4.h
Expand Up @@ -16,6 +16,17 @@
#ifndef _MD4_H_
#define _MD4_H_

/* Rename MD4 symbols to avoid namespace pollution. */
#define MD4Init zsync__MD4Init
#define MD4Update zsync__MD4Update
#define MD4Pad zsync__MD4Pad
#define MD4Final zsync__MD4Final
#define MD4Transform zsync__MD4Transform
#define MD4End zsync__MD4End
#define MD4File zsync__MD4File
#define MD4FileChunk zsync__MD4FileChunk
#define MD4Data zsync__MD4Data

#include "zsglobal.h"

#ifdef HAVE_INTTYPES_H
Expand Down
11 changes: 11 additions & 0 deletions c/libzsync/sha1.h
Expand Up @@ -9,6 +9,17 @@
#ifndef _SHA1_H
#define _SHA1_H

/* Rename SHA1 symbols to avoid namespace pollution. */
#define SHA1Init zsync__SHA1Init
#define SHA1Pad zsync__SHA1Pad
#define SHA1Transform zsync__SHA1Transform
#define SHA1Update zsync__SHA1Update
#define SHA1Final zsync__SHA1Final
#define SHA1End zsync__SHA1End
#define SHA1File zsync__SHA1File
#define SHA1FileChunk zsync__SHA1FileChunk
#define SHA1Data zsync__SHA1Data

#include "config.h"

#ifdef HAVE_INTTYPES_H
Expand Down
1 change: 1 addition & 0 deletions c/zlib/zlib.h
Expand Up @@ -31,6 +31,7 @@
#ifndef ZLIB_H
#define ZLIB_H

#include "zsync_zlib_rename.h"
#include "zconf.h"

#ifdef __cplusplus
Expand Down
49 changes: 49 additions & 0 deletions c/zlib/zsync_zlib_rename.h
@@ -0,0 +1,49 @@
/* Rename zlib symbols to avoid namespace pollution. */

#define deflateInit_ zsync__deflateInit_
#define deflate zsync__deflate
#define deflateEnd zsync__deflateEnd
#define inflateInit_ zsync__inflateInit_
#define inflate zsync__inflate
#define inflateEnd zsync__inflateEnd
#define deflateInit2_ zsync__deflateInit2_
#define deflateSetDictionary zsync__deflateSetDictionary
#define deflateCopy zsync__deflateCopy
#define deflateReset zsync__deflateReset
#define deflatePrime zsync__deflatePrime
#define deflateParams zsync__deflateParams
#define deflateBound zsync__deflateBound
#define inflateInit2_ zsync__inflateInit2_
#define inflateSetDictionary zsync__inflateSetDictionary
#define inflateSync zsync__inflateSync
#define inflateSyncPoint zsync__inflateSyncPoint
#define inflateCopy zsync__inflateCopy
#define inflateReset zsync__inflateReset
#define compress zsync__compress
#define compress2 zsync__compress2
#define compressBound zsync__compressBound
#define uncompress zsync__uncompress
#define adler32 zsync__adler32
#define crc32 zsync__crc32
#define get_crc_table zsync__get_crc_table

#define Byte zsync__Byte
#define uInt zsync__uInt
#define uLong zsync__uLong
#define Bytef zsync__Bytef
#define charf zsync__charf
#define intf zsync__intf
#define uIntf zsync__uIntf
#define uLongf zsync__uLongf
#define voidpf zsync__voidpf
#define voidp zsync__voidp

#define inflate_advance zsync__inflate_advance
#define inflateSafePoint zsync__inflateSafePoint
#define updatewindow zsync__updatewindow
#define inflate_table zsync__inflate_table
#define zcalloc zsync__zcalloc
#define zcfree zsync__zcfree
#define zError zsync__zError
#define zlibCompileFlags zsync__zlibCompileFlags
#define zlibVersion zsync__zlibVersion

0 comments on commit e973819

Please sign in to comment.