From 6b518194c2508e3118c2bb9866c8fed946da7968 Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Fri, 23 Mar 2012 19:32:32 +0100 Subject: [PATCH] minor, if byteswap.h is there, swap the bytes ourselves Squashed commit of the following: commit 2b9cee2e2b972a74c44e223d292ca9204a94160a Author: Ruediger Meier Date: Fri Mar 23 19:21:19 2012 +0100 fix, unterminated #if (followup e9b87b14) commit e2ffa392167b4be744e64bd49f382507ef0dde42 Merge: 03ee571 6c912e8 Author: Sebastian Freundt Date: Fri Mar 23 17:30:45 2012 +0000 Merge branch 'next' * next: cosmetics, change guard of boobs.h minor, if byteswap.h is there, swap the bytes ourselves commit 6c912e8309347334bbd9b0e29b8e165bb8481ce1 Merge: 03ee571 4a3c9eb Author: Sebastian Freundt Date: Fri Mar 23 17:27:31 2012 +0000 Merge branch 'fix/big-endian' into next * fix/big-endian: cosmetics, change guard of boobs.h minor, if byteswap.h is there, swap the bytes ourselves commit 4a3c9eb8deb113eb920777a8351e2cc22c15b622 Author: Sebastian Freundt Date: Fri Mar 23 17:18:57 2012 +0000 cosmetics, change guard of boobs.h Signed-off-by: Sebastian Freundt commit e9b87b142625340405fbbbcb4219adfba0e89678 Author: Sebastian Freundt Date: Fri Mar 23 17:18:27 2012 +0000 minor, if byteswap.h is there, swap the bytes ourselves Signed-off-by: Sebastian Freundt Signed-off-by: Ruediger Meier --- configure.ac | 2 +- lib/boobs.h | 41 ++++++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index f57fb53..952bb6c 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,7 @@ AC_C_BIGENDIAN SXE_CHECK_CFLAGS ## check for byteorder utils -AC_CHECK_HEADERS([endian.h sys/endian.h byteorder.h arpa/inet.h netinet/in.h]) +AC_CHECK_HEADERS([endian.h sys/endian.h byteorder.h byteswap.h]) ## check for strptime AC_CHECK_FUNCS([strptime]) diff --git a/lib/boobs.h b/lib/boobs.h index 8276503..a1f7349 100644 --- a/lib/boobs.h +++ b/lib/boobs.h @@ -35,8 +35,8 @@ * ***/ -#if !defined INCLUDED_byteorder_h_ -#define INCLUDED_byteorder_h_ +#if !defined INCLUDED_boobs_h_ +#define INCLUDED_boobs_h_ #if defined HAVE_CONFIG_H # include "config.h" @@ -46,51 +46,54 @@ # include #elif defined HAVE_SYS_ENDIAN_H # include -#elif defined HAVE_BYTEORDER_H +#elif defined HAVE_BOOBS_H # include -#elif defined HAVE_ARPA_INET_H -# include -#elif defined NETINET_IN_H -# include -#else -/* FUCK!!! */ -#endif /* HAVE_ENDIAN_H */ +#endif /* ENDIAN_H || SYS/ENDIAN_H || BOOBS_H */ + +/* check for byteswap to do the swapping ourselves if need be */ +#if defined HAVE_BYTESWAP_H +# include +#endif /* BYTESWAP_H */ /* and even now we may be out of luck */ #if !defined be32toh # if defined betoh32 # define be32toh betoh32 -# elif defined ntohl -# define be32toh ntohl # elif defined WORDS_BIGENDIAN || __BYTE_ORDER == __BIG_ENDIAN # define be32toh(x) (x) +# elif __BYTE_ORDER == __LITTLE_ENDIAN +# define be32toh(x) __bswap_32(x) # endif #endif /* !be32toh */ #if !defined le32toh # if defined letoh32 # define le32toh letoh32 -# elif !defined WORDS_BIGENDIAN || __BYTE_ORDER == __LITTLE_ENDIAN +# elif defined WORDS_BIGENDIAN || __BYTE_ORDER == __BIG_ENDIAN +# define le32toh(x) __bswap_32(x) +# elif __BYTE_ORDER == __LITTLE_ENDIAN # define le32toh(x) (x) # endif /* letoh32 */ #endif /* !le32toh */ #if !defined htobe32 -# if defined htonl -# define htobe32 htonl -# elif defined WORDS_BIGENDIAN || __BYTE_ORDER == __BIG_ENDIAN +# if defined WORDS_BIGENDIAN || __BYTE_ORDER == __BIG_ENDIAN # define htobe32(x) (x) +# elif __BYTE_ORDER == __LITTLE_ENDIAN +# define htobe32(x) __bswap_32(x) # endif #endif /* !be32toh */ #if !defined htole32 -# if !defined WORDS_BIGENDIAN || __BYTE_ORDER == __LITTLE_ENDIAN +# if defined WORDS_BIGENDIAN || __BYTE_ORDER == __BIG_ENDIAN +# define htole32(x) __bswap_32(x) +# elif __BYTE_ORDER == __LITTLE_ENDIAN # define htole32(x) (x) # endif -#endif /* !le32toh */ +#endif /* !htole32 */ /* we could technically include byteswap.h and to the swap ourselves * in the missing cases. Instead we'll just leave it as is and wait * for bug reports. */ -#endif /* INCLUDED_byteorder_h_ */ +#endif /* INCLUDED_boobs_h_ */ -- 1.7.6.1 diff -rupN -x boobs.h -x configure.ac dateutils-0.1.10/configure release_obs_openSUSE_12.1/dateutils-0.1.10/configure --- dateutils-0.1.10/configure 2012-03-23 14:58:06.000000000 +0100 +++ release_obs_openSUSE_12.1/dateutils-0.1.10/configure 2012-03-23 19:32:57.000000000 +0100 @@ -9074,7 +9074,7 @@ $as_echo "${LDFLAGS}" >&6; } ## check for byteorder utils -for ac_header in endian.h sys/endian.h byteorder.h arpa/inet.h netinet/in.h +for ac_header in endian.h sys/endian.h byteorder.h byteswap.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff -rupN -x boobs.h -x configure.ac dateutils-0.1.10/src/config.h.in release_obs_openSUSE_12.1/dateutils-0.1.10/src/config.h.in --- dateutils-0.1.10/src/config.h.in 2012-03-23 14:58:07.000000000 +0100 +++ release_obs_openSUSE_12.1/dateutils-0.1.10/src/config.h.in 2012-03-23 19:32:59.000000000 +0100 @@ -6,12 +6,12 @@ /* Whether c1x anon structs work */ #undef HAVE_ANON_STRUCTS -/* Define to 1 if you have the header file. */ -#undef HAVE_ARPA_INET_H - /* Define to 1 if you have the header file. */ #undef HAVE_BYTEORDER_H +/* Define to 1 if you have the header file. */ +#undef HAVE_BYTESWAP_H + /* Define to 1 if you have the header file. */ #undef HAVE_ENDIAN_H @@ -21,9 +21,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_H - /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H