[Tizen 6.0] adjust to new compilation flags 29/222229/1
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Fri, 10 Jan 2020 15:41:11 +0000 (16:41 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Fri, 10 Jan 2020 15:57:04 +0000 (16:57 +0100)
* fix '-Wformat-truncation'
* fix '-Wstringop-overflow='
* fix '-Wformat-overflow='

Change-Id: Ib7a320ae838dd04a99b4f7179ab82b39ab2fbc1e

src/modules/clock/clock.c
src/modules/information/toast_popup.c
src/util.c

index 7e26d68..6d3124e 100644 (file)
@@ -157,13 +157,13 @@ static void set_app_state(void* data)
 static Eina_Bool indicator_clock_changed_cb(void *data)
 {
 
-       char time_str[CLOCK_STR_LEN] = {0,};
-       char time_buf[CLOCK_STR_LEN] = {0,};
-       char ampm_buf[CLOCK_STR_LEN] = {0,};
-       char ampm_str[CLOCK_STR_LEN] = {0,};
-       char buf[CLOCK_STR_LEN] = {0,};
-       char result[CLOCK_STR_LEN] = {0,};
-       char icu_apm[CLOCK_STR_LEN] = {0,};
+       char time_str[128] = {0,};
+       char time_buf[64] = {0,};
+       char ampm_buf[64] = {0,};
+       char ampm_str[128] = {0,};
+       char buf[256] = {0,};
+       char result[512] = {0,};
+       char icu_apm[64] = {0,};
 
        struct tm ts;
        time_t ctime;
@@ -198,8 +198,8 @@ static Eina_Bool indicator_clock_changed_cb(void *data)
                _E("Fail to add timer !");
        }
 
-       indicator_get_apm_by_region(icu_apm, CLOCK_STR_LEN);
-       indicator_get_time_by_region(time_buf, CLOCK_STR_LEN);
+       indicator_get_apm_by_region(icu_apm, sizeof(icu_apm));
+       indicator_get_time_by_region(time_buf, sizeof(time_buf));
 
 
        if (clock_mode == INDICATOR_CLOCK_MODE_12H) {
@@ -554,12 +554,12 @@ void indicator_get_time_by_region(char* output, size_t output_size)
 
        ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, &locale);
        retm_if(ret != SYSTEM_SETTINGS_ERROR_NONE, "Cannot get LOCALE_COUNTRY string");
-       _D("Locale: %s", locale);
 
        if (locale == NULL) {
                _E("[Error] get value of fail.");
                return;
        }
+       _D("Locale: %s", locale);
 
        i18n_ustring_copy_ua_n(u_custom_skeleton, s_time_skeleton, ARRAY_SIZE(u_custom_skeleton));
 
@@ -634,12 +634,12 @@ void indicator_get_time_by_region(char* output, size_t output_size)
 
        _D("24H :: Before change %s", s_formatted);
        s_convert_formatted = _string_replacer(s_formatted, colon, ratio);
-       _D("24H :: After change %s", s_convert_formatted);
 
        if (!s_convert_formatted) {
                _D("_string_replacer return NULL");
                return;
        }
+       _D("24H :: After change %s", s_convert_formatted);
 
        util_strlcpy(output, s_convert_formatted, output_size);
 
index f4badcf..5cb965d 100644 (file)
@@ -116,11 +116,9 @@ static void _post_toast_message_callback(const char *message, void *data)
        char *temp_msg = NULL;
        int count = 0;
 
-       msg = (char *)calloc(strlen(message) + 1, sizeof(char));
+       msg = message ? strdup(message) : strdup("");
        ret_if(!msg);
 
-       strncpy(msg, message, strlen(message) + 1);
-
        count = eina_list_count(s_info.toast_list);
        if (count == 0) {
                s_info.toast_list = eina_list_append(s_info.toast_list, msg);
index b7d39cb..8c1b814 100644 (file)
@@ -445,7 +445,7 @@ int util_check_noti_ani(const char *path)
 
 char *util_get_real_path(char *special_path)
 {
-       retvm_if(!special_path, 0, "path:%s", special_path);
+       retvm_if(special_path == NULL, NULL, "path is null");
 
        char *real_path = NULL;
        int size;
@@ -472,7 +472,7 @@ char *util_get_real_path(char *special_path)
 
 bool util_reserved_path_check(char *path)
 {
-       retvm_if(!path, 0, "path:%s", path);
+       retvm_if(path == NULL, false, "path is null");
 
        int i;
        for (i = 0; i < ARRAY_SIZE(reserved_paths); ++i)