diff --git a/lrzip.c b/lrzip.c index e7f7176..25f6874 100644 --- a/lrzip.c +++ b/lrzip.c @@ -37,6 +37,11 @@ #include #include #include +#ifdef HAVE_ENDIAN_H +# include +#elif HAVE_SYS_ENDIAN_H +# include +#endif #include "md5.h" #include "rzip.h" diff --git a/lrzip_private.h b/lrzip_private.h index 5107742..f0b31a6 100644 --- a/lrzip_private.h +++ b/lrzip_private.h @@ -113,21 +113,26 @@ typedef struct md5_ctx md5_ctx; | (((x) & 0x000000000000ff00ull) << 40) \ | (((x) & 0x00000000000000ffull) << 56)) +#ifdef leto32h +# define le32toh(x) leto32h(x) +# define le64toh(x) leto64h(x) +#endif + +#ifndef le32toh # if __BYTE_ORDER == __LITTLE_ENDIAN # define htole32(x) (x) # define le32toh(x) (x) - # define htole64(x) (x) # define le64toh(x) (x) # elif __BYTE_ORDER == __BIG_ENDIAN # define htole32(x) bswap_32 (x) # define le32toh(x) bswap_32 (x) - # define htole64(x) bswap_64 (x) # define le64toh(x) bswap_64 (x) #else #error UNKNOWN BYTE ORDER #endif +#endif #define FLAG_SHOW_PROGRESS (1 << 0) #define FLAG_KEEP_FILES (1 << 1) diff --git a/main.c b/main.c index 0427a86..ed89039 100644 --- a/main.c +++ b/main.c @@ -37,6 +37,11 @@ #endif #include #include +#ifdef HAVE_ENDIAN_H +# include +#elif HAVE_SYS_ENDIAN_H +# include +#endif #include "rzip.h" #include "lrzip.h" diff --git a/runzip.c b/runzip.c index 5853b62..1f9b64a 100644 --- a/runzip.c +++ b/runzip.c @@ -31,6 +31,11 @@ #ifdef HAVE_UNISTD_H # include #endif +#ifdef HAVE_ENDIAN_H +# include +#elif HAVE_SYS_ENDIAN_H +# include +#endif #include "md5.h" #include "runzip.h" @@ -40,6 +45,7 @@ #include "liblrzip.h" /* needed for CRC routines */ #include "lzma/C/7zCrc.h" + static inline uchar read_u8(rzip_control *control, void *ss, int stream) { uchar b; diff --git a/rzip.c b/rzip.c index b4ef17d..e671711 100644 --- a/rzip.c +++ b/rzip.c @@ -42,6 +42,11 @@ #ifdef HAVE_ERRNO_H # include #endif +#ifdef HAVE_ENDIAN_H +# include +#elif HAVE_SYS_ENDIAN_H +# include +#endif #include "md5.h" #include "stream.h" diff --git a/stream.c b/stream.c index 4e6790c..2859c9e 100644 --- a/stream.c +++ b/stream.c @@ -39,6 +39,11 @@ #ifdef HAVE_ERRNO_H # include #endif +#ifdef HAVE_ENDIAN_H +# include +#elif HAVE_SYS_ENDIAN_H +# include +#endif /* LZMA C Wrapper */ #include "lzma/C/LzmaLib.h"