From c83e0f671032ac419980c01089c00d4818952286 Mon Sep 17 00:00:00 2001 From: Youngjae Shin Date: Wed, 29 Jul 2020 10:39:49 +0900 Subject: [PATCH] increase code quality fix build warnings add static to global variables Change-Id: I4bfac0b5359b6c2bf08f76a97da1f9910bc206e8 --- common/common_ip_info.c | 7 +++---- common/wlan_connection.c | 4 ++-- common/wlan_manager.c | 2 +- ui-gadget/view_advanced.c | 2 +- ui-gadget/viewer_manager.c | 6 +++--- wifi-syspopup/wifi-syspopup.c | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/common/common_ip_info.c b/common/common_ip_info.c index 2b1fa56..850ea10 100644 --- a/common/common_ip_info.c +++ b/common/common_ip_info.c @@ -990,15 +990,14 @@ static bool __ap_foreach_ipv6_callback(char *ipv6_address, void *user_data) ERROR_LOG(UG_NAME_ERR, "Failed to allocate memory"); return false; } - *buf[0] = '\0'; - strncpy(*buf, ipv6_address, strlen(ipv6_address) + 1); + snprintf(*buf, strlen(ipv6_address) + 1, "%s", ipv6_address); } else { + int len = strlen(*buf); if (!(*buf = (char *)realloc(*buf, strlen(*buf) + strlen(ipv6_address) + 5))) { ERROR_LOG(UG_NAME_ERR, "Failed to realloc memory"); return false; } - strncat(*buf, "
", 5); - strncat(*buf, ipv6_address, strlen(ipv6_address) + 1); + snprintf(*buf + len, len + strlen(ipv6_address) + 5, "
%s", ipv6_address); } return true; diff --git a/common/wlan_connection.c b/common/wlan_connection.c index 64a5085..a646ef3 100644 --- a/common/wlan_connection.c +++ b/common/wlan_connection.c @@ -30,8 +30,8 @@ struct wlan_connection { static wifi_manager_h *wifi_handle = NULL; -static struct wlan_connection current_item = { NULL, NULL, NULL }; -static struct wlan_connection next_item = { NULL, NULL, NULL }; +static struct wlan_connection current_item; +static struct wlan_connection next_item; static void wlan_connect_debug(wifi_manager_ap_h ap) { diff --git a/common/wlan_manager.c b/common/wlan_manager.c index 9b7ebd5..579006c 100644 --- a/common/wlan_manager.c +++ b/common/wlan_manager.c @@ -48,7 +48,7 @@ typedef struct { wifi_manager_ap_h *ap; } ap_state_info_t; -wlan_mgr_req_data_t scan_req_data; +static wlan_mgr_req_data_t scan_req_data; static void wlan_manager_register_cbs(void); static void wlan_manager_deregister_cbs(void); diff --git a/ui-gadget/view_advanced.c b/ui-gadget/view_advanced.c index 3413e56..d21d3ba 100644 --- a/ui-gadget/view_advanced.c +++ b/ui-gadget/view_advanced.c @@ -54,7 +54,7 @@ struct _private_data { Elm_Object_Item *item_install_cert; }; -struct _private_data g_pd; +static struct _private_data g_pd; extern genlist_info_t g_genlist_info[WIFI_GENLIST_STYLE_MAX]; extern content_size_info_t g_content_size_info; diff --git a/ui-gadget/viewer_manager.c b/ui-gadget/viewer_manager.c index 739720f..61da062 100644 --- a/ui-gadget/viewer_manager.c +++ b/ui-gadget/viewer_manager.c @@ -85,14 +85,14 @@ static Eina_Bool rotate_flag = EINA_FALSE; static bool show_more = TRUE; -wifi_emulator_sample_s wifi_samples[] = { +static wifi_emulator_sample_s wifi_samples[] = { {"datanetwork", WIFI_MANAGER_SECURITY_TYPE_WPA_PSK, 1}, {"ureadyinternet", WIFI_MANAGER_SECURITY_TYPE_EAP, 0}, {"uready", WIFI_MANAGER_SECURITY_TYPE_EAP, 1}, {"setup", WIFI_MANAGER_SECURITY_TYPE_NONE, 0}, {"Tizen", WIFI_MANAGER_SECURITY_TYPE_WPA2_PSK, 1}, }; -int wifi_sample_count = sizeof(wifi_samples) / sizeof(wifi_samples[0]); +static int wifi_sample_count = sizeof(wifi_samples) / sizeof(wifi_samples[0]); static void _hidden_button_callback(void* data, Evas_Object* obj, void* event_info); static void viewer_manager_hidden_confirm_cleanup(void); @@ -709,7 +709,7 @@ static char *_gl_helper_text_get(void *data, Evas_Object *obj, const char *part) return det; } -static char *_gl_helper_content_get(void *data, Evas_Object *obj, const char *part) +static Evas_Object* _gl_helper_content_get(void *data, Evas_Object *obj, const char *part) { retvm_if(NULL == manager_object, NULL); diff --git a/wifi-syspopup/wifi-syspopup.c b/wifi-syspopup/wifi-syspopup.c index 902eaf9..471160b 100644 --- a/wifi-syspopup/wifi-syspopup.c +++ b/wifi-syspopup/wifi-syspopup.c @@ -55,7 +55,7 @@ typedef enum { wifi_object* devpkr_app_state = NULL; -Ecore_Event_Handler* event_handler = NULL; +static Ecore_Event_Handler* event_handler = NULL; static void __idle_lock_state_change_cb(keynode_t *node, void *user_data); -- 2.7.4