diff options
author | Olivier Guiter <olivier.guiter@linux.intel.com> | 2013-01-09 13:42:37 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-01-10 13:08:59 +0100 |
commit | c528844e8128fe8eb7da3269a0b5f5142a5690ff (patch) | |
tree | f3a2e0174e2a7ab54560953d308bfeacca968186 /plugins | |
parent | 8fdb45b93475b8e5d37b8f520b206db0fdf8d999 (diff) | |
download | neard-c528844e8128fe8eb7da3269a0b5f5142a5690ff.tar.gz neard-c528844e8128fe8eb7da3269a0b5f5142a5690ff.tar.bz2 neard-c528844e8128fe8eb7da3269a0b5f5142a5690ff.zip |
types: Fix build error due to unaligned memory access
This fix number of build error on architectures that can't handle
unaligned memory access (eg. ARM).
Most of the code was originally written in BlueZ's bluetooth.h.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/nfctype4.c | 4 | ||||
-rw-r--r-- | plugins/snep-core.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/plugins/nfctype4.c b/plugins/nfctype4.c index 538630a..e275a9f 100644 --- a/plugins/nfctype4.c +++ b/plugins/nfctype4.c @@ -74,7 +74,7 @@ #define T4_ALL_ACCESS 0x00 #define T4_READ_ONLY 0xFF -#define APDU_STATUS(a) (g_ntohs(*((uint16_t *)(a)))) +#define APDU_STATUS(a) near_get_be16(a) /* Tag Type 4 version ID */ static uint8_t iso_appname_v1[] = { 0xd2, 0x76, 0x0, 0x0, 0x85, 0x01, 0x0 }; @@ -365,7 +365,7 @@ static int t4_readbin_NDEF_ID(uint8_t *resp, int length, void *data) /* Add data to the tag */ err = near_tag_add_data(cookie->adapter_idx, cookie->target_idx, NULL, - g_ntohs(*((uint16_t *)(resp + NFC_STATUS_BYTE_LEN)))); + near_get_be16(resp + NFC_STATUS_BYTE_LEN)); if (err < 0) return t4_cookie_release(err, cookie); diff --git a/plugins/snep-core.c b/plugins/snep-core.c index 2155a75..ad84296 100644 --- a/plugins/snep-core.c +++ b/plugins/snep-core.c @@ -642,8 +642,8 @@ static int snep_core_response(int fd, struct p2p_snep_put_req_data *req, /* if GET, we add the Acceptable length */ if (header.request == SNEP_REQ_GET) - *(uint32_t *)(fragment->data + SNEP_REQ_PUT_HEADER_LENGTH) = - GUINT32_TO_BE(snep_req_header_length); + near_put_be32(snep_req_header_length, + fragment->data + SNEP_REQ_PUT_HEADER_LENGTH); if (fragmenting == TRUE) { memcpy(fragment->data + snep_req_header_length, ndef->data, |