Re: [PATCH v4] gatt: Translate Characteristic names

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

 



Hi Chen,

On Mon, Sep 03, 2012, chen.ganir@xxxxxx wrote:
> +static const struct characteristic_info charInfo[] = {

Only lower-case symbol names please, i.e. char_info[].

> +static const char *get_char_name(const char *uuid)
> +{
> +	const struct characteristic_info *c;
> +
> +	for (c = charInfo; c->uuid; c++) {
> +		if (g_strcmp0(c->uuid, uuid) == 0)

Since these strings are in hexadecimal format you'd need to check both
lower and upper case characters. So probably strcasecmp is best (you
should anyway have a guarantee that both c->uuid and uuid are non-NULL).
You could also use bt_uuid_strcmp from lib/uuid.h which was recently
added to help g_slist_find_custom and similar situations.

> +	if (name != NULL)
> +		dict_append_entry(&dict, "Name", DBUS_TYPE_STRING, &name);

"if (name)" would be more consistent with the rest of the code, such as
the lines coming right after it:

>  	if (chr->desc)
>  		dict_append_entry(&dict, "Description", DBUS_TYPE_STRING,

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