Re: [PATCH 2/2] Add SetProperty method and Debug property

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

 



Hi Gustavo,

On Wed, Jun 16, 2010, Gustavo F. Padovan wrote:
> +static DBusMessage *set_debug(DBusConnection *conn, DBusMessage *msg,
> +					const char *debug_string, void *data)
> +{
> +	char *old_string;
> +
> +	if (!g_utf8_validate(debug_string, -1, NULL)) {
> +		error("DebugString change failed: supplied string "
> +							"isn't valid UTF-8");
> +		return invalid_args(msg);
> +	}
> +
> +	old_string = __btd_get_debug();
> +
> +	if (strcmp((char *)debug_string, old_string) == 0)

At least according to my manpage of strcmp the input is already const so
the case is unnecessary here. You might also want to use g_str_equal in
this case.

> +	if (!__btd_set_debug((char *)debug_string))

Since __btd_set_debug g_strdup's the input the right fix is to declare
its input parameter as const, and then the need to do a cast here goes
away.

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