diff options
author | Andreas Schwab <schwab@linux-m68k.org> | 2015-02-14 13:22:18 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-02-17 09:02:06 +0000 |
commit | f0bef22496de7d09c1b2ead685ae263dd28f4388 (patch) | |
tree | 92acbc7c0e473f7a66a685443835223d501bb60f | |
parent | aa7ffcce0d24321b96504bc15e80898712617e1b (diff) | |
download | qtconnectivity-f0bef22496de7d09c1b2ead685ae263dd28f4388.tar.gz |
Use proper endian conversion functions
bswap_16 isn't defined anywhere, use qbswap from <QtCore/qendian.h> instead.
Change-Id: I9ee260752ab7bcae3bbd30b4b71d30d52c837a2b
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r-- | src/bluetooth/bluez/bluez_data_p.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/bluetooth/bluez/bluez_data_p.h b/src/bluetooth/bluez/bluez_data_p.h index 9d2d96b3..9d0d9d9c 100644 --- a/src/bluetooth/bluez/bluez_data_p.h +++ b/src/bluetooth/bluez/bluez_data_p.h @@ -46,6 +46,7 @@ // #include <QtCore/qglobal.h> +#include <QtCore/qendian.h> #include <sys/socket.h> #include <QtBluetooth/QBluetoothUuid> @@ -96,12 +97,12 @@ struct bt_security { #define btohl(d) (d) #define btohll(d) (d) #elif __BYTE_ORDER == __BIG_ENDIAN -#define htobs(d) bswap_16(d) -#define htobl(d) bswap_32(d) -#define htobll(d) bswap_64(d) -#define btohs(d) bswap_16(d) -#define btohl(d) bswap_32(d) -#define btohll(d) bswap_64(d) +#define htobs(d) qbswap((quint16)(d)) +#define htobl(d) qbswap((quint32)(d)) +#define htobll(d) qbswap((quint64)(d)) +#define btohs(d) qbswap((quint16)(d)) +#define btohl(d) qbswap((quint32)(d)) +#define btohll(d) qbswap((quint64)(d)) #else #error "Unknown byte order" #endif @@ -169,7 +170,7 @@ static inline quint16 bt_get_le16(const void *ptr) #elif __BYTE_ORDER == __BIG_ENDIAN static inline quint16 bt_get_le16(const void *ptr) { - return bswap_16(bt_get_unaligned((const quint16 *) ptr)); + return qbswap(bt_get_unaligned((const quint16 *) ptr)); } static inline void btoh128(const quint128 *src, quint128 *dst) |