diff options
author | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2018-01-31 10:24:35 +0100 |
---|---|---|
committer | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2018-01-31 10:45:29 +0100 |
commit | f5e888a6a6763da6570c95eac78f1436b6d78494 (patch) | |
tree | e109b39712572ed03f9a3f8484df1d73931ef86a /crc32.c | |
parent | dfdb082b2fd190b7d3a1cec966cf8c82d0e98458 (diff) |
Add function prefix (zng_) to all exported functions to allow zlib-ng
to co-exist in an application that has been linked to something that
depends on stock zlib. Previously, that would cause random problems
since there is no way to guarantee what zlib version is being used
for each dynamically linked function.
Add the corresponding zlib-ng.h.
Tests, example and minigzip will not compile before they have been
adapted to use the correct functions as well.
Either duplicate them, so we have minigzip-ng.c for example, or add
compile-time detection in the source code.
Diffstat (limited to 'crc32.c')
-rw-r--r-- | crc32.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -205,7 +205,7 @@ static void write_table(FILE *out, const uint32_t *table) { /* ========================================================================= * This function can be used by asm versions of crc32() */ -const uint32_t * ZEXPORT get_crc_table(void) { +const uint32_t * ZEXPORT PREFIX(get_crc_table)(void) { #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); @@ -213,7 +213,7 @@ const uint32_t * ZEXPORT get_crc_table(void) { return (const uint32_t *)crc_table; } -uint32_t ZEXPORT crc32_z(uint32_t crc, const unsigned char *buf, size_t len) { +uint32_t ZEXPORT PREFIX(crc32_z)(uint32_t crc, const unsigned char *buf, size_t len) { if (buf == NULL) return 0; #ifdef DYNAMIC_CRC_TABLE @@ -264,8 +264,8 @@ ZLIB_INTERNAL uint32_t crc32_generic(uint32_t crc, const unsigned char *buf, z_o return crc ^ 0xffffffff; } -uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, uint32_t len) { - return crc32_z(crc, buf, len); +uint32_t ZEXPORT PREFIX(crc32)(uint32_t crc, const unsigned char *buf, uint32_t len) { + return PREFIX(crc32_z)(crc, buf, len); } /* @@ -442,11 +442,11 @@ static uint32_t crc32_combine_(uint32_t crc1, uint32_t crc2, z_off64_t len2) { } /* ========================================================================= */ -uint32_t ZEXPORT crc32_combine(uint32_t crc1, uint32_t crc2, z_off_t len2) { +uint32_t ZEXPORT PREFIX(crc32_combine)(uint32_t crc1, uint32_t crc2, z_off_t len2) { return crc32_combine_(crc1, crc2, len2); } -uint32_t ZEXPORT crc32_combine64(uint32_t crc1, uint32_t crc2, z_off64_t len2) { +uint32_t ZEXPORT PREFIX(crc32_combine64)(uint32_t crc1, uint32_t crc2, z_off64_t len2) { return crc32_combine_(crc1, crc2, len2); } |