From 7f92f75e88b66ba73db5a676c35c704e213dcd70 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 22 Jun 2022 11:16:18 -0700 Subject: client/advertising: Fixes errors found by scan-build This fixes the following errors: client/advertising.c:129:4: warning: Value stored to 'n' is never read [deadcode.DeadStores] n = sizeof(str) - 1; ^ ~~~~~~~~~~~~~~~ client/advertising.c:1012:25: warning: Dereference of null pointer (loaded from variable 'min') [core.NullDereference] if (ad.min_interval != *min) { ^~~~ --- client/advertising.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'client') diff --git a/client/advertising.c b/client/advertising.c index f4678e978..5c9e3eeb3 100644 --- a/client/advertising.c +++ b/client/advertising.c @@ -125,8 +125,6 @@ static void print_uuid(const char *uuid) str[sizeof(str) - 3] = '.'; if (str[sizeof(str) - 4] == ' ') str[sizeof(str) - 4] = '.'; - - n = sizeof(str) - 1; } bt_shell_printf("UUID: %s(%s)\n", str, uuid); @@ -1009,13 +1007,13 @@ void ad_advertise_interval(DBusConnection *conn, uint32_t *min, uint32_t *max) return bt_shell_noninteractive_quit(EXIT_SUCCESS); } - if (ad.min_interval != *min) { + if (min && ad.min_interval != *min) { ad.min_interval = *min; g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, "MinInterval"); } - if (ad.max_interval != *max) { + if (max && ad.max_interval != *max) { ad.max_interval = *max; g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, "MaxInterval"); -- cgit v1.2.1