summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2014-03-25 08:38:30 -0300
committerJohan Hedberg <johan.hedberg@intel.com>2014-03-25 13:47:19 +0200
commitee51e8a5a5cccae126fddceca9d5797e33991a9d (patch)
tree41bc16635628d1b862ee0e8f42e039dfbd045cfa
parent350107b3c4b53bf9459eb7e353595fe878c08f2b (diff)
downloadbluez-ee51e8a5a5cccae126fddceca9d5797e33991a9d.tar.gz
tools: Use unaligned access macros from util.h
-rw-r--r--tools/parser/hci.c1
-rw-r--r--tools/parser/l2cap.c1
-rw-r--r--tools/parser/parser.h7
-rw-r--r--tools/parser/ppp.c2
4 files changed, 5 insertions, 6 deletions
diff --git a/tools/parser/hci.c b/tools/parser/hci.c
index b018e93b3..351f843cc 100644
--- a/tools/parser/hci.c
+++ b/tools/parser/hci.c
@@ -37,7 +37,6 @@
#include "lib/hci.h"
#include "lib/hci_lib.h"
#include "lib/amp.h"
-#include "src/shared/util.h"
static uint16_t manufacturer = DEFAULT_COMPID;
diff --git a/tools/parser/l2cap.c b/tools/parser/l2cap.c
index 53dd72645..a05796482 100644
--- a/tools/parser/l2cap.c
+++ b/tools/parser/l2cap.c
@@ -39,7 +39,6 @@
#include "lib/hci.h"
#include "lib/a2mp.h"
#include "lib/amp.h"
-#include "src/shared/util.h"
typedef struct {
uint16_t handle;
diff --git a/tools/parser/parser.h b/tools/parser/parser.h
index c65b4b5f4..62b8ac514 100644
--- a/tools/parser/parser.h
+++ b/tools/parser/parser.h
@@ -30,6 +30,7 @@
#include <netinet/in.h>
#include "lib/bluetooth.h"
+#include "src/shared/util.h"
struct frame {
void *data;
@@ -173,7 +174,7 @@ static inline uint16_t get_u16(struct frame *frm)
uint16_t *u16_ptr = frm->ptr;
frm->ptr += 2;
frm->len -= 2;
- return ntohs(bt_get_unaligned(u16_ptr));
+ return get_be16(u16_ptr);
}
static inline uint32_t get_u32(struct frame *frm)
@@ -181,13 +182,13 @@ static inline uint32_t get_u32(struct frame *frm)
uint32_t *u32_ptr = frm->ptr;
frm->ptr += 4;
frm->len -= 4;
- return ntohl(bt_get_unaligned(u32_ptr));
+ return get_be32(u32_ptr);
}
static inline uint64_t get_u64(struct frame *frm)
{
uint64_t *u64_ptr = frm->ptr;
- uint64_t u64 = bt_get_unaligned(u64_ptr), tmp;
+ uint64_t u64 = get_unaligned(u64_ptr), tmp;
frm->ptr += 8;
frm->len -= 8;
tmp = ntohl(u64 & 0xffffffff);
diff --git a/tools/parser/ppp.c b/tools/parser/ppp.c
index 947ca564c..256e1723f 100644
--- a/tools/parser/ppp.c
+++ b/tools/parser/ppp.c
@@ -103,7 +103,7 @@ static void hdlc_dump(int level, struct frame *frm)
uint8_t ctrl = get_u8(frm);
uint16_t fcs, proto;
- fcs = bt_get_unaligned((uint16_t *) (frm->ptr + frm->len - 2));
+ fcs = get_unaligned((uint16_t *) (frm->ptr + frm->len - 2));
frm->len -= 2;
p_indent(level, frm);