summaryrefslogtreecommitdiff
path: root/profiles/sap
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2012-09-04 16:41:26 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-09-05 12:17:19 +0300
commit26f55a403a05a28563f6ff5a24cf70bcfc35f28b (patch)
treeee42890c4a2adae6830dfee4fbd480091615ec79 /profiles/sap
parentf00bdeb27a298e740549d39b26de731f69758513 (diff)
downloadbluez-26f55a403a05a28563f6ff5a24cf70bcfc35f28b.tar.gz
sap: Fix compilation errors due to unaligned memory access
This fix following build errors on ARM. CC profiles/sap/bluetoothd-server.o profiles/sap/server.c: In function connect_req: profiles/sap/server.c:317:8: error: cast increases required alignment of targettype [-Werror=cast-align] profiles/sap/server.c: In function sap_connect_rsp: profiles/sap/server.c:676:16: error: cast increases required alignment of target type [-Werror=cast-align] cc1: all warnings being treated as errors make[1]: *** [profiles/sap/bluetoothd-server.o] Error 1 make: *** [all] Error 2
Diffstat (limited to 'profiles/sap')
-rw-r--r--profiles/sap/server.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/profiles/sap/server.c b/profiles/sap/server.c
index 3adbb1a8e..78a63bf9e 100644
--- a/profiles/sap/server.c
+++ b/profiles/sap/server.c
@@ -302,7 +302,7 @@ static void connect_req(struct sap_server *server,
struct sap_parameter *param)
{
struct sap_connection *conn = server->conn;
- uint16_t maxmsgsize, *val;
+ uint16_t maxmsgsize;
DBG("conn %p state %d", conn, conn->state);
@@ -314,8 +314,7 @@ static void connect_req(struct sap_server *server,
stop_guard_timer(server);
- val = (uint16_t *) &param->val;
- maxmsgsize = ntohs(*val);
+ maxmsgsize = bt_get_be16(&param->val);
DBG("Connect MaxMsgSize: 0x%04x", maxmsgsize);
@@ -638,7 +637,6 @@ int sap_connect_rsp(void *sap_device, uint8_t status)
struct sap_message *msg = (struct sap_message *) buf;
struct sap_parameter *param = (struct sap_parameter *) msg->param;
size_t size = sizeof(struct sap_message);
- uint16_t *maxmsgsize;
if (!conn)
return -EINVAL;
@@ -673,8 +671,7 @@ int sap_connect_rsp(void *sap_device, uint8_t status)
param = (struct sap_parameter *) &buf[size];
param->id = SAP_PARAM_ID_MAX_MSG_SIZE;
param->len = htons(SAP_PARAM_ID_MAX_MSG_SIZE_LEN);
- maxmsgsize = (uint16_t *) &param->val;
- *maxmsgsize = htons(SAP_BUF_SIZE);
+ bt_put_be16(SAP_BUF_SIZE, &param->val);
size += PARAMETER_SIZE(SAP_PARAM_ID_MAX_MSG_SIZE_LEN);
/* fall */