Re: [PATCH BlueZ 2/7] shared/gatt-client: Implement bt_gatt_client_register_notify.

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

 



Hi Marcel,


>> +     for (i = 0; i < service->num_chrcs; i++) {
>> +             free((bt_gatt_descriptor_t *) service->chrcs[i].chrc.descs);
>
> I must have overlooked these before, but that casting for free() should not be needed at all.
>

Without the cast the code will generate a compiler warning, since
|descs| is declared as "const bt_descriptor_t *". I'd rather keep it
as const since external code will access it but I need the cast to
avoid the warning. I could cast it to void* if that makes it shorter.


>> +
>> +     be16 = htons(uuid16);
>> +     memcpy(rhs_uuid + 2, &be16, sizeof(be16));
>
> You might away with that the be16 and rhs_uuid are properly aligned here. However that is a dangerous game and I would rather see that you use put_be16() here.
>

Makes sense. FYI, I took this straight from bt_uuid16_to_uuid128 in lib/uuid.c.

-Arman
--
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