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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Szymon,

On Fri, Aug 31, 2012 at 4:36 AM, Szymon Janc <szymon.janc@xxxxxxxxx> 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.

>         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

> @@ -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
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux