summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgen Servetnik <e.servetnik@samsung.com>2017-08-14 11:38:39 +0300
committerEvgen Servetnik <e.servetnik@samsung.com>2017-08-14 15:01:19 +0300
commit2bc84bf00fd9fdc4431ca73c4e066dbe7f2f42ee (patch)
tree25ba67197cae061f83fe153ec3944ff1b20178d6
parent682dc9b740254c58d82152e98a3f244c3484985e (diff)
downloadtimer-2bc84bf00fd9fdc4431ca73c4e066dbe7f2f42ee.tar.gz
timer-2bc84bf00fd9fdc4431ca73c4e066dbe7f2f42ee.tar.bz2
timer-2bc84bf00fd9fdc4431ca73c4e066dbe7f2f42ee.zip
TizenRefApp-9107 Fix sonar issues
Change-Id: I8da5184e8200da78aabc0396fe7d72c956da2703 Signed-off-by: Evgen Servetnik <e.servetnik@samsung.com>
-rwxr-xr-xsrc/main.c43
-rwxr-xr-xsrc/timer_util.c4
-rwxr-xr-xtimer_alert/src/ring.c19
-rwxr-xr-xtimer_alert/src/sound.c6
4 files changed, 23 insertions, 49 deletions
diff --git a/src/main.c b/src/main.c
index cf4fc2e..691708d 100755
--- a/src/main.c
+++ b/src/main.c
@@ -349,10 +349,9 @@ Evas_Object *load_edj(Evas_Object * parent, const char *file, const char *group)
{
_TMR_ENTER_;
Evas_Object *eo = NULL;
- int r;
eo = elm_layout_add(parent);
if (eo) {
- r = elm_layout_file_set(eo, file, group);
+ int r = elm_layout_file_set(eo, file, group);
if (!r) {
evas_object_del(eo);
return NULL;
@@ -647,7 +646,6 @@ static void _panel_timeset_add(void *data)
return;
struct appdata *ad = (struct appdata *)data;
- Evas_Object *circle_spinner;
if (ad->timepicker) {
evas_object_del(ad->timepicker);
@@ -659,7 +657,7 @@ static void _panel_timeset_add(void *data)
ad->hour_spinner = elm_spinner_add(ad->timepicker);
elm_object_style_set(ad->hour_spinner, "circle");
- circle_spinner = eext_circle_object_spinner_add(ad->hour_spinner, ad->circle_surface);
+ eext_circle_object_spinner_add(ad->hour_spinner, ad->circle_surface);
elm_spinner_min_max_set(ad->hour_spinner, 0, 59);
elm_spinner_wrap_set(ad->hour_spinner, EINA_TRUE);
elm_spinner_label_format_set(ad->hour_spinner, "%02d");
@@ -671,7 +669,7 @@ static void _panel_timeset_add(void *data)
ad->min_spinner = elm_spinner_add(ad->timepicker);
elm_object_style_set(ad->min_spinner, "circle");
- circle_spinner = eext_circle_object_spinner_add(ad->min_spinner, ad->circle_surface);
+ eext_circle_object_spinner_add(ad->min_spinner, ad->circle_surface);
elm_spinner_min_max_set(ad->min_spinner, 0, 59);
elm_spinner_wrap_set(ad->min_spinner, EINA_TRUE);
elm_spinner_label_format_set(ad->min_spinner, "%02d");
@@ -683,7 +681,7 @@ static void _panel_timeset_add(void *data)
ad->sec_spinner = elm_spinner_add(ad->timepicker);
elm_object_style_set(ad->sec_spinner, "circle");
- circle_spinner = eext_circle_object_spinner_add(ad->sec_spinner, ad->circle_surface);
+ eext_circle_object_spinner_add(ad->sec_spinner, ad->circle_surface);
elm_spinner_min_max_set(ad->sec_spinner, 0, 59);
elm_spinner_wrap_set(ad->sec_spinner, EINA_TRUE);
elm_spinner_label_format_set(ad->sec_spinner, "%02d");
@@ -853,7 +851,6 @@ static void _tmr_timepicker_time_update(void *data)
static void _tmr_set_time_number(struct appdata *ad, int min, int sec)
{
_TMR_ENTER_;
- double r, g, b, a = 0;
if (min >= 60)
elm_object_signal_emit(ad->progress, "with,hour", "");
else
@@ -864,10 +861,10 @@ static void _tmr_set_time_number(struct appdata *ad, int min, int sec)
elm_object_signal_emit(ad->progress, "alert", "");
//todo:
//edje_color_class_get("AO0181", &r, &g, &b, &a, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- r = 216.75;
- g = 62.86;
- b = 62.86;
- a = 255;
+ double r = 216.75;
+ double g = 62.86;
+ double b = 62.86;
+ double a = 255;
eext_circle_object_item_color_set(ad->progressbar, "default", r, g, b, a);
@@ -1009,9 +1006,8 @@ void _launch_alert(void* data)
{
_TMR_ENTER_;
app_control_h app_control = NULL;
- int ret = -1;
display_state_e state;
- ret = device_display_get_state(&state);
+ int ret = device_display_get_state(&state);
TMR_INFO("display status state: %d and ret:%d", state, ret);
if (state == DISPLAY_STATE_SCREEN_OFF || state == DISPLAY_STATE_SCREEN_DIM) {
ret = device_display_change_state(DISPLAY_STATE_NORMAL);
@@ -1106,7 +1102,6 @@ static void _tmr_start_cb(void *data)
if (ad->restart_flag) {
ad->tmp_usec += ad->due_time.tv_usec;
if (ad->tmp_usec >= 1000000) {
- trigger_time += 1;
ad->tmp_usec -= 1000000;
}
}
@@ -1114,7 +1109,6 @@ static void _tmr_start_cb(void *data)
double t = ((double)(ad->tmp_usec)/1000000);
TMR_INFO("t = %.2f", t);
if (t >= 0.85) {
- trigger_time -= 1;
t -= 0.25;
} else {
t -= 0.25;
@@ -1358,8 +1352,6 @@ static void _tmr_startbtn_cb_ex(void *data, Evas_Object * obj, void *event_info)
if (ad->tr)
return;
- double r, g, b, a = 0;
-
TMR_INFO("cur_state = %d", ad->cur_state);
if (ad->cur_state == TMR_STATE_TYPE_RESET) {
@@ -1396,10 +1388,10 @@ static void _tmr_startbtn_cb_ex(void *data, Evas_Object * obj, void *event_info)
elm_scroller_page_show(ad->scroller, 0, 1);
//todo:
//edje_color_class_get("B065L2", &r, &g, &b, &a, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- r = 15.17;
- g = 152.92;
- b = 216.75;
- a = 255;
+ double r = 15.17;
+ double g = 152.92;
+ double b = 216.75;
+ double a = 0;
eext_circle_object_item_color_set(ad->progressbar, "default", r, g, b, a);
//todo:
@@ -1934,13 +1926,8 @@ static void app_control(app_control_h service, void *data)
ad->min = ad->min%60;
_tmr_set_start_time(ad);
elm_object_signal_emit(ad->ly_main, "timer,cancel", "*");
- if (ad->cur_state == TMR_STATE_TYPE_STOP || ad->cur_state == TMR_STATE_TYPE_START) {
- _tmr_reset_cb(ad);
- _tmr_startbtn_cb_ex(ad, NULL, NULL);
- } else {
- _tmr_reset_cb(ad);
- _tmr_startbtn_cb_ex(ad, NULL, NULL);
- }
+ _tmr_reset_cb(ad);
+ _tmr_startbtn_cb_ex(ad, NULL, NULL);
}
if (ad->cur_state == TMR_STATE_TYPE_START) {
double current_systime = tmr_get_systime();
diff --git a/src/timer_util.c b/src/timer_util.c
index 7f7cb55..793d46f 100755
--- a/src/timer_util.c
+++ b/src/timer_util.c
@@ -26,11 +26,11 @@
double tmr_get_systime()
{
double sys_time = 0;
- char uptime_str[100] = {0,};
char *ret = NULL;
FILE *pFile = fopen(UPTIME_FILE, "r");
if (pFile) {
- ret = fgets(uptime_str, 100, pFile);
+ char uptime_str[100] = {0,};
+ ret = fgets(uptime_str, sizeof(uptime_str), pFile);
sys_time = tmr_clock_atof(uptime_str);
fclose(pFile);
}
diff --git a/timer_alert/src/ring.c b/timer_alert/src/ring.c
index 212b040..a3b6c17 100755
--- a/timer_alert/src/ring.c
+++ b/timer_alert/src/ring.c
@@ -249,25 +249,6 @@ Evas_Object *view_create_layout(Evas_Object *parent, const char *file_path, cons
}
/*
-* @brief: utility function to set the text to text components
-* @param[parent]: in, parent of the layout
-* @param[part_name]: in, text part name
-* @param[text]: in, text to be set
-*/
-void view_set_text(Evas_Object *parent, const char *part_name, const char *text)
-{
- _TMR_ENTER_;
- _E("view_set_text");
- if (parent == NULL) {
- _E("parent is NULL.");
- return;
- }
-
- /* Set text of target part object */
- elm_object_part_text_set(parent, part_name, text);
-}
-
-/*
* @brief: utility function to push layouts to naviframe
* @param[nf]: in, naviframe
* @param[item]: in, object to push to naviframe
diff --git a/timer_alert/src/sound.c b/timer_alert/src/sound.c
index 2799f6c..4392e28 100755
--- a/timer_alert/src/sound.c
+++ b/timer_alert/src/sound.c
@@ -74,7 +74,13 @@ void ring_stop_player(void)
int ret = SUCCESS;
ret = player_stop(*(mm_player));
+ if (ret != PLAYER_ERROR_NONE) {
+ _E("player error Code: %x", ret);
+ }
ret = player_unprepare(*(mm_player));
+ if (ret != PLAYER_ERROR_NONE) {
+ _E("player error Code: %x", ret);
+ }
player_state_e play_state;
player_get_state(*(mm_player), &play_state);
_D("After unprepare play_state: %d", play_state);