Skip to content

Commit

Permalink
improve logic on variants of ZLIB_H
Browse files Browse the repository at this point in the history
  • Loading branch information
Coeur committed Nov 1, 2024
1 parent bcf2c77 commit 42bf357
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions compat/crypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@
Encryption is not supported.
*/

#ifndef _ZLIB_H
# ifndef ZLIB_VERNUM
/* No zlib */
typedef uint32_t z_crc_t;
# elif (ZLIB_VERNUM & 0xf != 0xf) && (ZLIB_VERNUM < 0x1270)
/* Define z_crc_t in zlib 1.2.6 and less */
typedef unsigned long 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
#ifndef ZLIB_VERNUM
/* No zlib */
typedef uint32_t z_crc_t;
#elif (ZLIB_VERNUM & 0xf != 0xf) && (ZLIB_VERNUM < 0x1270)
/* Define z_crc_t in zlib 1.2.6 and less */
typedef unsigned long 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

#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
Expand Down
2 changes: 1 addition & 1 deletion compat/ioapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <stdint.h>

#ifndef _ZLIB_H
#if !defined(_ZLIB_H) && !defined(ZLIB_H) && !defined(ZLIB_H_)
# if __has_include(<zlib.h>)
# include <zlib.h>
# elif __has_include(<zlib-ng.h>)
Expand Down

0 comments on commit 42bf357

Please sign in to comment.