From 003b6749dc723b57fe5bafb31ce706a1498450da Mon Sep 17 00:00:00 2001 From: Lukasz Stanislawski Date: Thu, 7 Apr 2016 13:04:52 +0200 Subject: [PATCH] Revert "Fixed svace" This reverts commit 6792efb6a25cc3beb70ce7dd3a416d0ab1e19f56. Change-Id: I9dde6055489d5d04d67e82a8c86cc0defa851fc3 --- daemon/icon.c | 2 +- daemon/main.c | 11 +++++------ daemon/ticker.c | 17 +++++------------ modules/clock/clock.c | 25 ++++++++----------------- modules/information/alarm.c | 5 +++++ modules/information/mp3_playing.c | 8 +------- modules/processing/downloading.c | 10 +++------- modules/processing/uploading.c | 11 +++-------- modules/setting/silent.c | 2 +- 9 files changed, 32 insertions(+), 59 deletions(-) diff --git a/daemon/icon.c b/daemon/icon.c index 692d36e..3f4cc11 100644 --- a/daemon/icon.c +++ b/daemon/icon.c @@ -80,7 +80,7 @@ static Eina_Bool _animate_on_timer_cb(void *data) retv_if(!img_edje, ECORE_CALLBACK_CANCEL); char signal_to_emit[32] = {'\0',}; - snprintf(signal_to_emit, sizeof(signal_to_emit), icon->signal_to_emit_prefix,icon->animation_state); + sprintf(signal_to_emit,icon->signal_to_emit_prefix,icon->animation_state); edje_object_signal_emit(img_edje, signal_to_emit,"prog"); diff --git a/daemon/main.c b/daemon/main.c index 4e8712b..4d42129 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -158,7 +158,7 @@ static void _indicator_notify_pm_state_cb(keynode_t * node, void *data) nIndex = 1; { char temp[30] = {0,}; - snprintf(temp,sizeof(temp), "indicator.padding.resize.%d",nMove); + sprintf(temp,"indicator.padding.resize.%d",nMove); util_signal_emit(data,temp,"indicator.prog"); } icon_set_update_flag(0); @@ -617,7 +617,7 @@ static void _create_layout(struct appdata *ad, const char *file, const char *gro if (EINA_FALSE == elm_layout_file_set(ad->win.layout, file, group)) { _E("Failed to set file of layout"); evas_object_del(ad->win.layout); - return; + return NULL; } evas_object_size_hint_min_set(ad->win.layout, ad->win.w, ad->win.h); @@ -1047,7 +1047,6 @@ static bool app_create(void *data) { struct appdata *ad = data; int ret; - char buf[256]; retv_if(!ad, false); @@ -1061,15 +1060,15 @@ static bool app_create(void *data) ret = sigemptyset(&act.sa_mask); if (ret < 0) { - _E("Failed to sigemptyset[%s]", strerror_r(errno, buf, sizeof(buf))); + _E("Failed to sigemptyset[%s]", strerror(errno)); } ret = sigaddset(&act.sa_mask, SIGTERM); if (ret < 0) { - _E("Failed to sigaddset[%s]", strerror_r(errno, buf, sizeof(buf))); + _E("Failed to sigaddset[%s]", strerror(errno)); } ret = sigaction(SIGTERM, &act, NULL); if (ret < 0) { - _E("Failed to sigaction[%s]", strerror_r(errno, buf, sizeof(buf))); + _E("Failed to sigaction[%s]", strerror(errno)); } ret = _start_indicator(ad); diff --git a/daemon/ticker.c b/daemon/ticker.c index 1d9052c..51b84d3 100644 --- a/daemon/ticker.c +++ b/daemon/ticker.c @@ -619,14 +619,11 @@ static char *_ticker_get_label_layout_default(notification_h noti, int is_screen *str_line1 = strdup(tmp); } } - } else { - _E("failed to allocate string buffer"); - } - if (line1 != NULL) { + eina_strbuf_free(line1); - } - if (line2 != NULL) { eina_strbuf_free(line2); + } else { + _E("failed to allocate string buffer"); } } else { if (title_utf8 == NULL @@ -752,14 +749,10 @@ static char *_ticker_get_label_layout_single(notification_h noti, int is_screenr } } - } else { - _E("failed to allocate string buffer"); - } - if (line1 != NULL) { eina_strbuf_free(line1); - } - if (line2 != NULL) { eina_strbuf_free(line2); + } else { + _E("failed to allocate string buffer"); } } else { if (title_utf8 == NULL diff --git a/modules/clock/clock.c b/modules/clock/clock.c index 27c705f..6f4ddd2 100644 --- a/modules/clock/clock.c +++ b/modules/clock/clock.c @@ -170,7 +170,7 @@ static void indicator_clock_changed_cb(void *data) /* Set time */ ctime = time(NULL); - localtime_r(&ctime, ts); + ts = localtime(&ctime); if (ts == NULL) { _E("Fail to get localtime !"); return; @@ -423,7 +423,7 @@ static int register_clock_module(void *data) static int unregister_clock_module(void) { - int ret = 0; + int ret; //ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_TIME_CHANGED); ret = ret | vconf_ignore_key_changed(VCONFKEY_REGIONFORMAT_TIME1224, regionformat_changed); @@ -467,8 +467,6 @@ static char *_string_replacer(const char *src, const char *pattern, const char * int idx = 0; int out_idx = 0; int out_sz = 0; - int replace_len = 0; - enum { STATE_START, STATE_FIND, @@ -486,12 +484,6 @@ static char *_string_replacer(const char *src, const char *pattern, const char * return NULL; } - replace_len = strlen(replace); - if (replace_len) { - ERR("Ratio"); - return NULL; - } - out_idx = 0; for (state = STATE_START, ptr = src; state != STATE_END; ptr++) { switch (state) { @@ -529,7 +521,7 @@ static char *_string_replacer(const char *src, const char *pattern, const char * * If there is no space for copying the replacement, * Extend size of the return buffer. */ - if (out_sz - out_idx < replace_len + 1) { + if (out_sz - out_idx < strlen(replace) + 1) { tmp = _extend_heap(ret, &out_sz, strlen(replace) + 1); if (!tmp) { free(ret); @@ -538,7 +530,7 @@ static char *_string_replacer(const char *src, const char *pattern, const char * ret = tmp; } - strncpy(ret + out_idx, replace, replace_len); + strcpy(ret + out_idx, replace); out_idx += strlen(replace); state = STATE_FIND; @@ -701,11 +693,11 @@ void indicator_get_time_by_region(char* output,void *data) if(clock_mode == INDICATOR_CLOCK_MODE_12H) { - strncpy(time_skeleton,"hm", 2); + strcpy(time_skeleton,"hm"); } else { - strncpy(time_skeleton,"Hm", 2); + strcpy(time_skeleton,"Hm"); } char* timezone_id = NULL; timezone_id = util_get_timezone_str(); @@ -739,10 +731,9 @@ void indicator_get_time_by_region(char* output,void *data) bestPatternCapacity, &status); char a_best_pattern[64] = {0,}; - char *last_pattern = NULL; u_austrcpy(a_best_pattern, bestPattern); - char *a_best_pattern_fixed = strtok_r(a_best_pattern, "a", &last_pattern); - a_best_pattern_fixed = strtok_r(a_best_pattern_fixed, " ", &last_pattern); + char *a_best_pattern_fixed = strtok(a_best_pattern, "a"); + a_best_pattern_fixed = strtok(a_best_pattern_fixed, " "); if(a_best_pattern_fixed) { u_uastrcpy(bestPattern, a_best_pattern_fixed); diff --git a/modules/information/alarm.c b/modules/information/alarm.c index 8df8d0c..286e000 100644 --- a/modules/information/alarm.c +++ b/modules/information/alarm.c @@ -147,6 +147,11 @@ static int register_alarm_module(void *data) retif(data == NULL, FAIL, "Invalid parameter!"); set_app_state(data); + if (ret < 0) + { + ERR("Fail to init alarmdb."); + return FAIL; + } ret = vconf_notify_key_changed(VCONFKEY_ALARM_STATE, indicator_alarm_change_cb, data); diff --git a/modules/information/mp3_playing.c b/modules/information/mp3_playing.c index 89fd543..119ddf9 100644 --- a/modules/information/mp3_playing.c +++ b/modules/information/mp3_playing.c @@ -108,13 +108,7 @@ static void show_mp_icon(void* data) FILE* fp = fopen(MUSIC_STATUS_FILE_PATH, "r"); char line[MAX_NAM_LEN+1]; - if (data == NULL) { - ERR("Invalid parameter"); - if (fp) { - fclose(fp); - } - return; - } + retif(data == NULL, , "Invalid parameter!"); if(fp == NULL) { ERR("Invalid file path !!"); diff --git a/modules/processing/downloading.c b/modules/processing/downloading.c index 9c3a09e..e7bb37a 100644 --- a/modules/processing/downloading.c +++ b/modules/processing/downloading.c @@ -83,12 +83,9 @@ static void hide_image_icon(void) static Eina_Bool show_downloading_icon_cb(void* data) { - int possible_index = 0; show_image_icon(data,icon_index); - possible_index = ++icon_index % ICON_NUM; - - icon_index = possible_index ? icon_index : 0; + icon_index = (++icon_index % ICON_NUM) ? icon_index : 0; return ECORE_CALLBACK_RENEW; } @@ -138,13 +135,12 @@ static void indicator_downloading_change_cb(keynode_t *node, void *data) ERR("Error getting VCONFKEY_WIFI_DIRECT_RECEIVING_STATE value"); }*/ -/* if (result == 1) { + if (result == 1) { show_downloading_icon(data); } else { hide_downloading_icon(); - }*/ - hide_downloading_icon(); + } } static void indicator_downloading_pm_state_change_cb(keynode_t *node, void *data) diff --git a/modules/processing/uploading.c b/modules/processing/uploading.c index 2fc05c1..e31ebb3 100644 --- a/modules/processing/uploading.c +++ b/modules/processing/uploading.c @@ -84,12 +84,8 @@ static void hide_image_icon(void) static Eina_Bool show_uploading_icon_cb(void* data) { - int possible_index = 0; - show_image_icon(data,icon_index); - possible_index = ++icon_index % ICON_NUM; - - icon_index = possible_index ? icon_index : 0; + icon_index = (++icon_index % ICON_NUM) ? icon_index : 0; return ECORE_CALLBACK_RENEW; } @@ -139,13 +135,12 @@ static void indicator_uploading_change_cb(keynode_t *node, void *data) ERR("Failed to get VCONFKEY_WIFI_DIRECT_SENDING_STATE value"); }*/ -/* if (result == 1) { + if (result == 1) { show_uploading_icon(data); } else { hide_uploading_icon(); - }*/ - hide_uploading_icon(); + } } static void indicator_uploading_pm_state_change_cb(keynode_t *node, void *data) diff --git a/modules/setting/silent.c b/modules/setting/silent.c index 9b26b51..88bb7b0 100644 --- a/modules/setting/silent.c +++ b/modules/setting/silent.c @@ -232,7 +232,7 @@ static int register_silent_module(void *data) static int unregister_silent_module(void) { - int ret = 0; + int ret; // ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE); ret = ret | vconf_ignore_key_changed(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, _silent_change_cb); -- 2.7.4