mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-28 01:53:11 +08:00
Fix 2 issues in proxendian.h, see details:
Only some OSes include endian.h from sys/types.h, not Termux, so let's include endian.h directly. Moreover the past logic defined BYTE_ORDER to an undef macro, so BYTE_ORDER was not undef but def to 0 and BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN was always false as (0!=0 && 0!=0)
This commit is contained in:
parent
de47514aec
commit
2c4eda6ab9
2 changed files with 16 additions and 13 deletions
|
@ -51,8 +51,6 @@ DEFCFLAGS += -Wbad-function-cast -Wredundant-decls -Wmissing-prototypes -Wchar-s
|
||||||
# Some more warnings we need first to eliminate, so temporarely tolerated:
|
# Some more warnings we need first to eliminate, so temporarely tolerated:
|
||||||
DEFCFLAGS += -Wcast-align -Wno-error=cast-align
|
DEFCFLAGS += -Wcast-align -Wno-error=cast-align
|
||||||
DEFCFLAGS += -Wswitch-enum -Wno-error=switch-enum
|
DEFCFLAGS += -Wswitch-enum -Wno-error=switch-enum
|
||||||
# Termux on-device __BYTE_ORDER and __LITTLE_ENDIAN undef in src/proxendian.h, see #730
|
|
||||||
DEFCFLAGS += -Wno-error=undef
|
|
||||||
|
|
||||||
ifeq ($(platform),Darwin)
|
ifeq ($(platform),Darwin)
|
||||||
# their readline has strict-prototype issues
|
# their readline has strict-prototype issues
|
||||||
|
|
|
@ -16,19 +16,24 @@
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define HOST_LITTLE_ENDIAN
|
# define HOST_LITTLE_ENDIAN
|
||||||
#else
|
#else
|
||||||
# include <sys/types.h>
|
// Only some OSes include endian.h from sys/types.h, not Termux, so let's include endian.h directly
|
||||||
# ifndef BYTE_ORDER
|
# include <endian.h>
|
||||||
# define BYTE_ORDER __BYTE_ORDER
|
# if !defined(BYTE_ORDER)
|
||||||
# define LITTLE_ENDIAN __LITTLE_ENDIAN
|
# if !defined(__BYTE_ORDER) || (__BYTE_ORDER != __LITTLE_ENDIAN && __BYTE_ORDER != __BIG_ENDIAN)
|
||||||
# define BIG_ENDIAN __BIG_ENDIAN
|
# error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN
|
||||||
# endif
|
# endif
|
||||||
# if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN)
|
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
|
# define HOST_LITTLE_ENDIAN
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# if BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN
|
||||||
# error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN
|
# error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN
|
||||||
# endif
|
# endif
|
||||||
# if BYTE_ORDER == LITTLE_ENDIAN
|
# if BYTE_ORDER == LITTLE_ENDIAN
|
||||||
# define HOST_LITTLE_ENDIAN
|
# define HOST_LITTLE_ENDIAN
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HOST_LITTLE_ENDIAN
|
#ifdef HOST_LITTLE_ENDIAN
|
||||||
# define le16(x) (x)
|
# define le16(x) (x)
|
||||||
|
|
Loading…
Reference in a new issue