Fix SVACE and CppTest issues 61/157861/6
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Thu, 26 Oct 2017 13:30:30 +0000 (15:30 +0200)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Fri, 27 Oct 2017 11:19:59 +0000 (13:19 +0200)
Change-Id: I5b8b1ea0b00d8abe6b451a01bf0d35909334900d

inc/indicator.h
src/icon.c
src/main.c
src/modules/information/fm_radio.c
src/modules/information/mp3_playing.c
src/modules/processing/transfer.c
src/util.c

index 1c39941..e5e7868 100644 (file)
@@ -195,7 +195,6 @@ typedef struct Indicator_Icon {
        enum ud_indicator_icon_ani_state animation_state;
        Eina_Bool animation_in_progress;
        Ecore_Timer *p_animation_timer;
-       char signal_to_emit_prefix [32];
        double last_animation_timestamp;
 
        /* Func */
index c2fbb22..9b0be27 100644 (file)
@@ -30,7 +30,7 @@
 #define PRIVATE_DATA_KEY_ICON_B_ANI "p_i_ba"
 
 #define ON_TIMER_ICON_ANIMATION_FRAME_TIME 0.3
-#define UPLOAD_ICON_ANIMATION_SIGNAL   "indicator.ani.uploading.%d"
+#define UPLOAD_ICON_ANIMATION_SIGNAL "indicator.ani.uploading.%d"
 #define DOWNLOAD_ICON_ANIMATION_SIGNAL "indicator.ani.downloading.%d"
 
 #define PORT_MORE_NOTI_ICON 1
@@ -47,11 +47,22 @@ static void _reset_on_timer_icon_animation(icon_s *icon)
        }
        icon->animation_in_progress = EINA_FALSE;
        icon->last_animation_timestamp = ecore_time_unix_get();
-       icon->signal_to_emit_prefix[0] = '\0';
        icon->animation_state = UD_ICON_ANI_STATE_0;
 }
 
 
+static const char *icon_signal_prefix_get(Icon_Ani_Type type)
+{
+       switch (type) {
+       case ICON_ANI_DOWNLOADING:
+               return DOWNLOAD_ICON_ANIMATION_SIGNAL;
+       case ICON_ANI_UPLOADING:
+               return UPLOAD_ICON_ANIMATION_SIGNAL;
+       default:
+               return "";
+       }
+}
+
 static Eina_Bool _animate_on_timer_cb(void *data)
 {
        icon_s *icon = NULL;
@@ -73,7 +84,7 @@ static Eina_Bool _animate_on_timer_cb(void *data)
 
        char signal_to_emit[SIGNAL_SIZE] = {'\0',};
 
-       snprintf(signal_to_emit, SIGNAL_SIZE, icon->signal_to_emit_prefix, icon->animation_state);
+       snprintf(signal_to_emit, SIGNAL_SIZE, icon_signal_prefix_get(icon->ani), icon->animation_state);
 
        edje_object_signal_emit(img_edje, signal_to_emit, "prog");
 
@@ -114,13 +125,6 @@ static const char *_icon_ani_type_set_send_signal(icon_s *icon, Icon_Ani_Type ty
                if (icon->animation_in_progress == EINA_FALSE) {
                        _reset_on_timer_icon_animation(icon);
                        send_signal = "dummy.signal";
-
-                       if (type == ICON_ANI_DOWNLOADING)
-                               strncpy(icon->signal_to_emit_prefix, DOWNLOAD_ICON_ANIMATION_SIGNAL, sizeof(DOWNLOAD_ICON_ANIMATION_SIGNAL));
-
-                       if (type == ICON_ANI_UPLOADING)
-                               strncpy(icon->signal_to_emit_prefix, UPLOAD_ICON_ANIMATION_SIGNAL, sizeof(UPLOAD_ICON_ANIMATION_SIGNAL));
-
                        icon->animation_in_progress = EINA_TRUE;
                        icon->p_animation_timer = ecore_timer_add(ON_TIMER_ICON_ANIMATION_FRAME_TIME, _animate_on_timer_cb, icon);
                }
index 571addc..0b15062 100644 (file)
@@ -65,7 +65,7 @@
 
 #define ERROR_MESSAGE_LEN 256
 
-Evas_Coord_Point indicator_press_coord = {0,0};
+Evas_Coord_Point indicator_press_coord = {0, 0};
 Ecore_Timer *clock_timer;
 int is_transparent = 0;
 int current_angle = 0;
@@ -171,12 +171,12 @@ static void _indicator_lock_status_cb(system_settings_key_e key, void *data)
 
        switch (val) {
        case SYSTEM_SETTINGS_LOCK_STATE_UNLOCK:
-               if (!clock_mode) util_signal_emit(data,"clock.font.12","indicator.prog");
-               else util_signal_emit(data,"clock.font.24","indicator.prog");
+               if (!clock_mode) util_signal_emit(data, "clock.font.12", "indicator.prog");
+               else util_signal_emit(data, "clock.font.24", "indicator.prog");
                break;
        case SYSTEM_SETTINGS_LOCK_STATE_LAUNCHING_LOCK:
        case SYSTEM_SETTINGS_LOCK_STATE_LOCK:
-               util_signal_emit(data,"clock.invisible","indicator.prog");
+               util_signal_emit(data, "clock.invisible", "indicator.prog");
                break;
        default:
                break;
@@ -189,7 +189,7 @@ static void _indicator_ecore_evas_msg_parent_handle(Ecore_Evas *ee, int msg_doma
 
 #ifdef _SUPPORT_SCREEN_READER
        if (msg_domain == MSG_DOMAIN_CONTROL_ACCESS) {
-               struct appdata *ad = (struct appdata *)ecore_evas_data_get(ee,"indicator_app_data");
+               struct appdata *ad = (struct appdata *)ecore_evas_data_get(ee, "indicator_app_data");
 
                ret_if(!ad);
 
@@ -200,17 +200,17 @@ static void _indicator_ecore_evas_msg_parent_handle(Ecore_Evas *ee, int msg_doma
                win = ad->win.win;
 
                if (msg_id == ELM_ACCESS_ACTION_ACTIVATE) {
-                       elm_access_action(win, action_info->action_type,action_info);
+                       elm_access_action(win, action_info->action_type, action_info);
                } else if (msg_id == ELM_ACCESS_ACTION_HIGHLIGHT_NEXT) {
                        action_info->highlight_cycle = EINA_TRUE;
-                       elm_access_action(win,action_info->action_type,action_info);
+                       elm_access_action(win, action_info->action_type, action_info);
                } else if (msg_id == ELM_ACCESS_ACTION_HIGHLIGHT_PREV) {
                        action_info->highlight_cycle = EINA_TRUE;
-                       elm_access_action(win,action_info->action_type,action_info);
+                       elm_access_action(win, action_info->action_type, action_info);
                } else if (msg_id == ELM_ACCESS_ACTION_UNHIGHLIGHT) {
-                       elm_access_action(win,action_info->action_type,action_info);
+                       elm_access_action(win, action_info->action_type, action_info);
                } else if (msg_id == ELM_ACCESS_ACTION_READ) {
-                       elm_access_action(win,action_info->action_type,action_info);
+                       elm_access_action(win, action_info->action_type, action_info);
                }
        }
 #endif /* _SUPPORT_SCREEN_READER */
@@ -224,9 +224,9 @@ static void _register_event_handler_both(win_info *win, void *data)
 
        ee = ecore_evas_ecore_evas_get(evas_object_evas_get(win->win));
 
-       evas_object_smart_callback_add(win->win,"delete,request", _indicator_window_delete_cb, data);
+       evas_object_smart_callback_add(win->win, "delete,request", _indicator_window_delete_cb, data);
        ecore_evas_callback_msg_parent_handle_set(ee, _indicator_ecore_evas_msg_parent_handle);
-       ecore_evas_data_set(ee,"indicator_app_data",data);
+       ecore_evas_data_set(ee, "indicator_app_data", data);
 }
 
 
@@ -238,7 +238,7 @@ static void register_event_handler(void *data)
 
        ad->active_indi_win = -1;
 
-       _register_event_handler_both(&(ad->win),data);
+       _register_event_handler_both(&(ad->win), data);
 
        int err = device_add_callback(DEVICE_CALLBACK_DISPLAY_STATE, _indicator_notify_pm_state_cb, ad);
        if (err != DEVICE_ERROR_NONE) {
@@ -312,8 +312,6 @@ static void _create_box(win_info *win)
 static Eina_Bool _render_force(void *data)
 {
        elm_win_render(data);
-       // below do not work - why??
-       // evas_render(evas_object_evas_get(data));
        return EINA_FALSE;
 }
 
@@ -323,24 +321,23 @@ static void _indicator_service_cb(void *data, tzsh_indicator_service_h service,
        win_info *info = data;
 
        switch (angle) {
-               case 0:
-               case 180:
-                       _D("Enable indicator portrait mode: %d %d", info->port_w, INDICATOR_HEIGHT);
-                       evas_object_resize(info->win, info->port_w, INDICATOR_HEIGHT);
-                       break;
-               case 90:
-               case 270:
-                       _D("Enable indicator landscape mode: %d %d", info->land_w, INDICATOR_HEIGHT);
-                       evas_object_resize(info->win, info->land_w, INDICATOR_HEIGHT);
-                       break;
-               default:
-                       _E("Unahandled rotation value");
-                       return;
+       case 0:
+       case 180:
+               _D("Enable indicator portrait mode: %d %d", info->port_w, INDICATOR_HEIGHT);
+               evas_object_resize(info->win, info->port_w, INDICATOR_HEIGHT);
+               break;
+       case 90:
+       case 270:
+               _D("Enable indicator landscape mode: %d %d", info->land_w, INDICATOR_HEIGHT);
+               evas_object_resize(info->win, info->land_w, INDICATOR_HEIGHT);
+               break;
+       default:
+               _E("Unahandled rotation value");
+               return;
        }
        info->angle = angle;
-       // this line below is making indicator to appear, however there are some
+       // the evas_win_render is making indicator to appear, however there are some
        // rendering artifcats, so we delay rendering
-       // elm_win_render(info->win);
        ecore_timer_add(0.1, _render_force, info->win);
 }
 
@@ -479,7 +476,7 @@ static void _init_win_info(void * data)
 
        ret_if(!ad);
 
-       memset(&(ad->win),0x00,sizeof(win_info));
+       memset(&(ad->win), 0x00, sizeof(win_info));
 }
 
 static void _init_tel_info(void * data)
@@ -539,7 +536,7 @@ static indicator_error_e _terminate_indicator(void *data)
 
 static void _signal_handler(int signum, siginfo_t *info, void *unused)
 {
-    ui_app_exit();
+       ui_app_exit();
 }
 
 static bool app_create(void *data)
index 2a353ea..8e737cb 100644 (file)
@@ -43,6 +43,8 @@ icon_s fm_radio = {
        .fini = unregister_fm_radio_module
 };
 
+#if 0
+
 static char *icon_path[] = {
        "Background playing/b03_backgroundplaying_fmradio.png",
        NULL
@@ -94,6 +96,8 @@ void hide_fm_radio_icon(void)
        hide_image_icon();
 }
 
+#endif
+
 
 static int register_fm_radio_module(void *data)
 {
@@ -102,10 +106,6 @@ static int register_fm_radio_module(void *data)
        _D("register_fm_radio_module called!");
        retvm_if(data == NULL, FAIL, "Invalid parameter!");
 
-       set_app_state(data);
-
-       indicator_fm_radio_change_cb(data);
-
        return ret;
 }
 
index 1afe4d6..8b81dea 100644 (file)
@@ -29,7 +29,6 @@
 #define MODULE_NAME            "MP3_PLAY"
 #define MINICONTROL_NAME       "[musicplayer-mini]"
 #define MUSIC_STATUS_FILE_PATH "MusicPlayStatus.ini"
-#define MAX_NAM_LEN 640
 #define MP_APP_ID "org.tizen.music-player-lite"
 
 static int register_mp3_play_module(void *data);
@@ -95,7 +94,8 @@ static void hide_image_icon(void)
 static void show_mp_icon(void* data)
 {
        FILE* fp = fopen(util_get_data_file_path(MUSIC_STATUS_FILE_PATH), "r");
-       char line[MAX_NAM_LEN+1];
+       char *line = NULL;
+       size_t line_len = 0;
 
        if (data == NULL) {
                _E("Invalid parameter!");
@@ -108,31 +108,29 @@ static void show_mp_icon(void* data)
                return;
        }
 
-       if(icon_get_update_flag() == 0) {
+       if (icon_get_update_flag() == 0) {
                updated_while_lcd_off = 1;
-               _D("need to update %d",updated_while_lcd_off);
+               _D("need to update %d", updated_while_lcd_off);
                fclose(fp);
                return;
        }
 
        updated_while_lcd_off = 0;
 
-       if(fgets(line, MAX_NAM_LEN, fp)) {
-               if(strstr(line, "play")) {
+       if (getline(&line, &line_len, fp) != -1) {
+               if (strstr(line, "play")) {
                        _D("Music state : PLAY");
                        show_image_icon(data, MUSIC_PLAY);
-               }
-               else if(strstr(line, "pause")) {
+               } else if (strstr(line, "pause")) {
                        _D("Music state : PAUSED");
                        show_image_icon(data, MUSIC_PAUSED);
-               }
-               else if(strstr(line, "stop") || strstr(line, "off")) {
+               } else if (strstr(line, "stop") || strstr(line, "off")) {
                        _D("Music state : STOP or OFF");
                        hide_image_icon();
                }
        }
+       free(line);
        retm_if(fclose(fp), "File close error!");
-
 }
 
 
@@ -155,7 +153,7 @@ static void indicator_mp3_play_change_cb(void *data, Ecore_File_Monitor *em, Eco
 
 static int wake_up_cb(void *data)
 {
-       if(updated_while_lcd_off == 0)
+       if (updated_while_lcd_off == 0)
                return OK;
 
        indicator_mp3_play_change_cb(data, pFileMonitor, (Ecore_File_Event)NULL, util_get_data_file_path(MUSIC_STATUS_FILE_PATH));
index b01489d..7b9de7d 100644 (file)
@@ -17,7 +17,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <vconf.h>
-//#include <Ecore_X.h>
 
 #include "common.h"
 #include "main.h"
@@ -78,40 +77,38 @@ static void hide_image_icon(void)
 
 static void show_image_icon(void *data, int index)
 {
-       if(prevIndex == index)
-       {
+       if (prevIndex == index) {
                return;
        }
 
-       if(index == -1) {
+       if (index == -1) {
                hide_image_icon();
        } else {
                transfer.img_obj.data = icon_path[index];
                icon_show(&transfer);
 
-               util_signal_emit(transfer.ad,"indicator.connection.show","indicator.prog");
+               util_signal_emit(transfer.ad, "indicator.connection.show", "indicator.prog");
        }
 
        prevIndex = index;
 
 }
 
-void show_transfer_icon(void *data,int index,int type)
+void show_transfer_icon(void *data, int index, int type)
 {
        transfer_type = type;
-       show_image_icon(data,index);
+       show_image_icon(data, index);
 
 }
 
 void hide_transfer_icon(int type)
 {
-       if(transfer_type!=-1 && transfer_type!=type)
-       {
+       if (transfer_type != -1 && transfer_type != type) {
                return;
        }
 
        hide_image_icon();
-       util_signal_emit(transfer.ad,"indicator.connection.hide","indicator.prog");
+       util_signal_emit(transfer.ad, "indicator.connection.hide", "indicator.prog");
        transfer_type = -1;
 }
 
@@ -126,20 +123,19 @@ static char *access_info_cb(void *data, Evas_Object *obj)
        wifi_get_connection_state(&status);
 
        if (status == WIFI_CONNECTION_STATE_CONNECTED) {
-               snprintf(buf, sizeof(buf), "%s, %s, %s", _("IDS_IDLE_BODY_WI_FI"),_("Data network"),_("IDS_IDLE_BODY_STATUS_BAR_ITEM"));
+               snprintf(buf, sizeof(buf), "%s, %s, %s", _("IDS_IDLE_BODY_WI_FI"), _("Data network"), _("IDS_IDLE_BODY_STATUS_BAR_ITEM"));
        } else {
                vconf_get_int(VCONFKEY_TELEPHONY_SVCTYPE, &svc_type);
 
-               switch(svc_type)
-               {
-                       case VCONFKEY_TELEPHONY_SVCTYPE_3G:
-                               snprintf(buf, sizeof(buf), "%s, %s, %s", _("IDS_IDLE_BODY_3G"),_("Data network"),_("IDS_IDLE_BODY_STATUS_BAR_ITEM"));
-                               break;
-                       case VCONFKEY_TELEPHONY_SVCTYPE_LTE:
-                               snprintf(buf, sizeof(buf), "%s, %s, %s", _("4G"),_("Data network"),_("IDS_IDLE_BODY_STATUS_BAR_ITEM"));
-                               break;
-                       default:
-                               break;
+               switch (svc_type) {
+               case VCONFKEY_TELEPHONY_SVCTYPE_3G:
+                       snprintf(buf, sizeof(buf), "%s, %s, %s", _("IDS_IDLE_BODY_3G"), _("Data network"), _("IDS_IDLE_BODY_STATUS_BAR_ITEM"));
+                       break;
+               case VCONFKEY_TELEPHONY_SVCTYPE_LTE:
+                       snprintf(buf, sizeof(buf), "%s, %s, %s", _("4G"), _("Data network"), _("IDS_IDLE_BODY_STATUS_BAR_ITEM"));
+                       break;
+               default:
+                       break;
                }
        }
        tmp = strdup(buf);
index d18492b..89c3281 100644 (file)
@@ -128,18 +128,18 @@ void util_bg_call_color_set(Evas_Object *layout, bg_color_e color)
        ret_if(!layout);
 
        switch (color) {
-               case BG_COLOR_CALL_INCOMING:
-                       elm_layout_signal_emit(layout, "bg.color.call.incoming", "indicator.prog");
-                       break;
-               case BG_COLOR_CALL_END:
-                       elm_layout_signal_emit(layout, "bg.color.call.end", "indicator.prog");
-                       break;
-               case BG_COLOR_CALL_ON_HOLD:
-                       elm_layout_signal_emit(layout, "bg.color.call.onhold", "indicator.prog");
-                       break;
-               default:
-                       util_bg_color_default_set(layout);
-                       break;
+       case BG_COLOR_CALL_INCOMING:
+               elm_layout_signal_emit(layout, "bg.color.call.incoming", "indicator.prog");
+               break;
+       case BG_COLOR_CALL_END:
+               elm_layout_signal_emit(layout, "bg.color.call.end", "indicator.prog");
+               break;
+       case BG_COLOR_CALL_ON_HOLD:
+               elm_layout_signal_emit(layout, "bg.color.call.onhold", "indicator.prog");
+               break;
+       default:
+               util_bg_color_default_set(layout);
+               break;
        }
 }
 
@@ -476,7 +476,7 @@ bool util_reserved_path_check(char *path)
 
        int i;
        for (i = 0; i < ARRAY_SIZE(reserved_paths); ++i)
-               if(!strcmp(path, reserved_paths[i].path))
+               if (!strcmp(path, reserved_paths[i].path))
                        return true;
 
        return false;
@@ -549,17 +549,19 @@ char *util_safe_str(const char *str, const char *str_search)
 
 bool util_string_prefix_check(const char *prefix, const char *str)
 {
-    size_t lenpre = strlen(prefix);
-    size_t lenstr = strlen(str);
+       size_t lenpre = strlen(prefix);
+       size_t lenstr = strlen(str);
 
-    return lenstr < lenpre ? false : !strncmp(prefix, str, lenpre);
+       return lenstr < lenpre ? false : !strncmp(prefix, str, lenpre);
 }
 
 
 int util_dynamic_state_get(void)
 {
        int val = 0;
+#if 0
        /*TODO vconf_get_bool(VCONFKEY_SETAPPL_DYNAMIC_STATUS_BAR, &val); */
+#endif
        return val;
 }
 
@@ -748,8 +750,7 @@ int util_strlcpy(char *dest, const char *src, size_t size)
 {
        int dlen = strlen(src);
        dlen = dlen >= size ? size - 1 : dlen;
-       if (dlen >= 0)
-       {
+       if (dlen >= 0) {
                strncpy(dest, src, dlen);
                dest[dlen] = '\0';
        }