Thread (23 messages) 23 messages, 4 authors, 2012-09-03

Re: [RFC 03/15] sdp: Use helper functions instead of bt_get_unaligned macro

flat view

From: Anderson Lizardo <hidden>
Date: 2012-08-31 10:55:08

Hi Szymon,

On Fri, Aug 31, 2012 at 4:36 AM, Szymon Janc [off-list ref] wrote:
This fix number of compilation errors on ARM similar to one below.

lib/sdp.c: In function 'sdp_uuid_extract':
lib/sdp.c:1019:27: error: cast increases required alignment
        of target type [-Werror=cast-align]
lib/sdp.c:1019:27: error: cast increases required alignment
        of target type [-Werror=cast-align]
lib/sdp.c:1026:27: error: cast increases required alignment
        of target type [-Werror=cast-align]
lib/sdp.c:1026:27: error: cast increases required alignment
        of target type [-Werror=cast-align]

Change-Id: I587fb99328d7e5b9053af81597bd48b3a4e610ad
You should remove the "Change-Id" tags from your patches.
quoted hunk ↗ jump to hunk
        case SDP_INT16:
-               d->val.int16 = bt_get_unaligned((int16_t *) value);
+               d->val.int16 = bt_get_16(value);
                d->unitSize += sizeof(int16_t);
                break;
Is this safe? You are assigning a unsigned type (return value from
bt_get_16()) to a signed one. Same applies for SDP_INT32 and SDP_INT64
quoted hunk ↗ jump to hunk
@@ -1427,7 +1427,7 @@ sdp_record_t *sdp_extract_pdu(const uint8_t *buf, int bufsize, int *scanned)
                }

                dtd = *(uint8_t *) p;
-               attr = ntohs(bt_get_unaligned((uint16_t *) (p + n)));
+               attr = bt_get_be16((p + n));
Extra parenthesis can be dropped.

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help