From 10a0207a172c14b899317e05e1be6e3949e763d1 Mon Sep 17 00:00:00 2001 From: Abhishek Chandra Date: Wed, 21 Mar 2018 14:47:52 +0530 Subject: [PATCH] [Bluetooth-agent]SVACE issue fixed for WGID : - 306030 - 306033 Change-Id: I8d9d81a720f6f15c5456c7fbcc3b1971a585bd72 Signed-off-by: Abhishek Chandra --- bt-ipsp/bt-ipsp.c | 12 +++-- hid-agent/bluetooth-hid-agent.c | 6 +-- include/bluetooth-agent-profile.h | 107 +++++++++++++++++++------------------- 3 files changed, 64 insertions(+), 61 deletions(-) diff --git a/bt-ipsp/bt-ipsp.c b/bt-ipsp/bt-ipsp.c index 246e36d..ed37cc6 100644 --- a/bt-ipsp/bt-ipsp.c +++ b/bt-ipsp/bt-ipsp.c @@ -253,8 +253,12 @@ int __bt_ipsp_create_ipv6_address(char *ifname, char **ipv6_address) __bt_ipsp_get_network_interface_name(&network_if_name); __bt_ipsp_get_network_ipv6_address(ifname, MOBILE_AP_IPV6_SCOPE_LINK, &link_addr); - __bt_ipsp_get_network_ipv6_address(network_if_name, MOBILE_AP_IPV6_SCOPE_GLOBAL, &network_addr); - g_free(network_if_name); + + if (network_if_name) { + __bt_ipsp_get_network_ipv6_address(network_if_name, MOBILE_AP_IPV6_SCOPE_GLOBAL, &network_addr); + g_free(network_if_name); + } + if (link_addr == NULL || network_addr == NULL) { BT_DBG("address is NULL"); g_free(link_addr); @@ -729,7 +733,9 @@ static void __bt_ipsp_dbus_method(GDBusConnection *connection, BT_DBG("failed to create remote device ipv6 address"); __bt_ipsp_get_network_interface_name(&network_interface); - __bt_ipsp_get_network_ipv6_address(network_interface, MOBILE_AP_IPV6_SCOPE_GLOBAL, &network_ipv6_address); + + if (network_interface) + __bt_ipsp_get_network_ipv6_address(network_interface, MOBILE_AP_IPV6_SCOPE_GLOBAL, &network_ipv6_address); /* Add the Routing Rule */ __bt_ipsp_add_ipv6_neigh_proxy(network_interface, remote_ipv6_address); diff --git a/hid-agent/bluetooth-hid-agent.c b/hid-agent/bluetooth-hid-agent.c index 542d895..422a8d0 100644 --- a/hid-agent/bluetooth-hid-agent.c +++ b/hid-agent/bluetooth-hid-agent.c @@ -622,9 +622,8 @@ void _bt_convert_device_path_to_address(const char *device_path, dev_addr += 4; g_strlcpy(address, dev_addr, sizeof(address)); - while ((pos = strchr(address, '_')) != NULL) { + while ((pos = strchr(address, '_')) != NULL) *pos = ':'; - } g_strlcpy(device_address, address, BT_ADDRESS_STRING_SIZE); } @@ -744,9 +743,8 @@ static void __bt_hid_agent_dbus_init(void) return; } - if (!__bt_hid_agent_get_adapter_path(conn, NULL)) { + if (!__bt_hid_agent_get_adapter_path(conn, NULL)) __bt_hid_agent_register(); - } interface_added_sig_id = g_dbus_connection_signal_subscribe(conn, NULL, BT_MANAGER_INTERFACE, BT_INTERFACES_ADDED, NULL, NULL, 0, diff --git a/include/bluetooth-agent-profile.h b/include/bluetooth-agent-profile.h index 56c35dc..fa3097d 100644 --- a/include/bluetooth-agent-profile.h +++ b/include/bluetooth-agent-profile.h @@ -47,40 +47,40 @@ int system_info_get_platform_string(const char *key, char **value); static inline tizen_profile_t get_tizen_profile() { - char *profileName = NULL; - - if (__builtin_expect(profile != _PROFILE_UNKNOWN, 1)) - return profile; - - system_info_get_platform_string("http://tizen.org/feature/profile", &profileName); - - /* To pass the checking of g_ir */ - if (!profileName) - return _PROFILE_UNKNOWN; - - switch (*profileName) { - case 'm': - case 'M': - profile = _PROFILE_MOBILE; - break; - case 'w': - case 'W': - profile = _PROFILE_WEARABLE; - break; - case 't': - case 'T': - profile = _PROFILE_TV; - break; - case 'i': - case 'I': - profile = _PROFILE_IVI; - break; - default: // common or unknown ==> ALL ARE COMMON. - profile = _PROFILE_COMMON; - } - free(profileName); - - return profile; + char *profileName = NULL; + + if (__builtin_expect(profile != _PROFILE_UNKNOWN, 1)) + return profile; + + system_info_get_platform_string("http://tizen.org/feature/profile", &profileName); + + /* To pass the checking of g_ir */ + if (!profileName) + return _PROFILE_UNKNOWN; + + switch (*profileName) { + case 'm': + case 'M': + profile = _PROFILE_MOBILE; + break; + case 'w': + case 'W': + profile = _PROFILE_WEARABLE; + break; + case 't': + case 'T': + profile = _PROFILE_TV; + break; + case 'i': + case 'I': + profile = _PROFILE_IVI; + break; + default: // common or unknown ==> ALL ARE COMMON. + profile = _PROFILE_COMMON; + } + free(profileName); + + return profile; } typedef enum { @@ -95,32 +95,31 @@ extern tizen_model_name_t model_name; static inline tizen_model_name_t get_tizen_model_name() { - char *modelName = NULL; + char *modelName = NULL; - if (__builtin_expect(model_name != _MODEL_UNKNOWN, 1)) - return profile; + if (__builtin_expect(model_name != _MODEL_UNKNOWN, 1)) + return profile; - system_info_get_platform_string("http://tizen.org/system/model_name", &modelName); + system_info_get_platform_string("http://tizen.org/system/model_name", &modelName); - /* To pass the checking of g_ir */ - if (!modelName) - return _MODEL_UNKNOWN; + /* To pass the checking of g_ir */ + if (!modelName) + return _MODEL_UNKNOWN; - if (g_strcmp0(modelName, "TM1") == 0) { - model_name = _MODEL_TM1; - } else if (g_strcmp0(modelName, "TM2") == 0) { - model_name = _MODEL_TM2; - } else if (g_strcmp0(modelName, "TW1") == 0) { - model_name = _MODEL_TW1; - } else if (g_strcmp0(modelName, "TW2") == 0) { - model_name = _MODEL_TW2; - } else { - model_name = _MODEL_UNKNOWN; - } + if (g_strcmp0(modelName, "TM1") == 0) + model_name = _MODEL_TM1; + else if (g_strcmp0(modelName, "TM2") == 0) + model_name = _MODEL_TM2; + else if (g_strcmp0(modelName, "TW1") == 0) + model_name = _MODEL_TW1; + else if (g_strcmp0(modelName, "TW2") == 0) + model_name = _MODEL_TW2; + else + model_name = _MODEL_UNKNOWN; - free(modelName); + free(modelName); - return model_name; + return model_name; } #define TIZEN_PROFILE_WEARABLE (get_tizen_profile() == _PROFILE_WEARABLE) -- 2.7.4