Skip to content

Commit

Permalink
avoid redefining already defined type
Browse files Browse the repository at this point in the history
  • Loading branch information
Coeur committed Nov 1, 2024
1 parent b7c88d4 commit 8cca408
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions compat/crypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
*/

#ifndef _ZLIB_H
# if (ZLIB_VERNUM < 0x1270)
# if (ZLIB_VERNUM & 0xf != 0xf) && (ZLIB_VERNUM < 0x1270)
/* Define z_crc_t in zlib 1.2.6 and less */
typedef unsigned long z_crc_t;
# else
typedef uint32_t z_crc_t;
# elif (ZLIB_VERNUM & 0xf == 0xf) && (ZLIB_VERNUM < 0x12df)
/* Define z_crc_t in zlib-ng 2.0.7 and less */
typedef unsigned int z_crc_t;
# endif
#endif

Expand Down
9 changes: 5 additions & 4 deletions mz_crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ int32_t mz_crypt_rand(uint8_t *buf, int32_t size) {

uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size) {
#if defined(HAVE_ZLIB)
/* Define z_crc_t in zlib 1.2.5 and less or if using zlib-ng */
# if (ZLIB_VERNUM < 0x1270)
# if (ZLIB_VERNUM & 0xf != 0xf) && (ZLIB_VERNUM < 0x1270)
/* Define z_crc_t in zlib 1.2.6 and less */
typedef unsigned long z_crc_t;
# else
typedef uint32_t z_crc_t;
# elif (ZLIB_VERNUM & 0xf == 0xf) && (ZLIB_VERNUM < 0x12df)
/* Define z_crc_t in zlib-ng 2.0.7 and less */
typedef unsigned int z_crc_t;
# endif
return (uint32_t)ZLIB_PREFIX(crc32)((z_crc_t)value, buf, (uInt)size);
#elif defined(HAVE_LZMA)
Expand Down

0 comments on commit 8cca408

Please sign in to comment.