Fixed SVACE Errors 09/102009/4
authorRahul Dadhich <r.dadhich@samsung.com>
Sat, 3 Dec 2016 07:46:26 +0000 (13:16 +0530)
committerRahul Dadhich <r.dadhich@samsung.com>
Sat, 3 Dec 2016 10:50:56 +0000 (16:20 +0530)
Change-Id: Ie5d69c48da3fb52fcb8f5c81f1d88c33d40e61c5
Signed-off-by: Rahul Dadhich <r.dadhich@samsung.com>
16 files changed:
inc/mp-common-defs.h
src/common/mp-common.c
src/common/mp-edit-callback.c
src/common/mp-file-util.c
src/common/mp-media-info.c
src/common/mp-util.c
src/core/mp-setting-ctrl.c
src/view/include/mp-all-view.h
src/view/mp-detail-view.c
src/view/mp-player-view.c
src/view/mp-setting-view.c
src/widget/mp-edit-playlist.c
src/widget/mp-lyric.c
src/widget/mp-now-playing.c
src/widget/mp-popup.c
src/widget/mp-search-list.c

index b1c2c04..60e7d11 100644 (file)
@@ -20,6 +20,7 @@
 #include <storage/storage.h>
 #include <glib.h>
 #include "mp-player-debug.h"
+#include "mp-define.h"
 
 #define MP_B_PATH "path"
 #define MP_MM_KEY "multimedia_key"
@@ -140,6 +141,12 @@ static void mp_lower_string(char *str) {
 static bool __mp_get_all_supported_storage_cb(int storageId, storage_type_e type, storage_state_e state, const char *path, void *userData)
 {
        char *temp_path = g_strdup(path);
+
+       if (!temp_path) {
+               ERROR_TRACE("Path is NULL");
+               return false;
+       }
+
        mp_lower_string(temp_path);
        if (type == STORAGE_TYPE_EXTERNAL && strstr(temp_path, "sdcard")) {
                mmc_id = storageId;
@@ -147,9 +154,7 @@ static bool __mp_get_all_supported_storage_cb(int storageId, storage_type_e type
        if (type == STORAGE_TYPE_INTERNAL) {
                device_id = storageId;
        }
-       if (temp_path) {
-               g_free(temp_path);
-       }
+       IF_G_FREE(temp_path);
        return true;
 }
 
index 98994bf..05b473a 100644 (file)
@@ -73,9 +73,6 @@ mp_common_view_cancel_cb(void *data, Evas_Object * obj, void *event_info)
 
        MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager();
        elm_naviframe_item_pop(view_mgr->navi);
-       //mp_view_mgr_pop_view(view_mgr, false);
-       //MpView_t *top_view = mp_view_mgr_get_top_view(GET_VIEW_MGR);
-       //mp_view_mgr_pop_a_view(GET_VIEW_MGR, top_view);
 }
 
 void
@@ -88,10 +85,6 @@ mp_common_add_to_playlsit_view(void *list_view)
 #else
        MpEditView_t *edit_view = mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false);
 #endif
-       if (edit_view == NULL) {
-               ERROR_TRACE("Unable to create edit view");
-               return;
-       }
        edit_view->create_playlist = true;
        mp_view_mgr_push_view(GET_VIEW_MGR, (MpView_t *)edit_view, NULL);
        mp_view_update((MpView_t *)edit_view);
@@ -147,8 +140,6 @@ mp_common_show_edit_view(void *list_view, mp_done_operator_type_t type)
        mp_list_view_set_done_btn((MpListView_t*)edit_view, true, type);
 }
 
-
-
 void mp_common_genlist_checkbox_sel_cb(void *data, Evas_Object *obj, void *event_info)
 {
        eventfunc;
@@ -165,7 +156,6 @@ void mp_common_genlist_checkbox_sel_cb(void *data, Evas_Object *obj, void *event
        return;
 }
 
-//ctx popup callback (popup should be center) and ctx popup need to be destoryed
 void mp_common_ctxpopup_setting_cb(void *data, Evas_Object *obj, void *event_info)
 {
        eventfunc;
@@ -425,16 +415,12 @@ _mp_timer_delay_cb(void *data)
        }
 
        if (MP_POPUP_PV_SET_AS == list->popup_type) {
-               mp_genlist_popup_create(list->genlist, MP_POPUP_PV_SET_AS, item_data->handle, ad);
+               if (item_data && item_data->handle) {
+                       mp_genlist_popup_create(list->genlist, MP_POPUP_PV_SET_AS, item_data->handle, ad);
+               }
        } else if (MP_POPUP_ADD_TO_PLST == list->popup_type) {
                mp_edit_create_add_to_playlist_popup(data);
        }
-       /*
-       else if (MP_POPUP_LIST_SHARE == list->popup_type)
-       {
-                       mp_genlist_popup_create(list->genlist, MP_POPUP_LIST_SHARE, sel_list, ad);
-       }
-       */
 
        if (list->pop_delay_timer) {
                ecore_timer_del(list->pop_delay_timer);
@@ -452,12 +438,8 @@ static void _mp_common_set_label_for_detail(Evas_Object *pBox, char *szString)
                return;
        }
        pLabel = elm_label_add(pBox);
-       //elm_object_style_set(pLabel, "popup/default");
        elm_object_text_set(pLabel, szString);
-       //mp_util_domain_translatable_text_set(pLabel, szString);
-       //elm_label_ellipsis_set(pLabel, EINA_TRUE);
        elm_label_line_wrap_set(pLabel, ELM_WRAP_MIXED);
-       //elm_label_wrap_width_set(pLabel, 700 * elm_config_scale_get());
        evas_object_size_hint_weight_set(pLabel, EVAS_HINT_FILL, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(pLabel, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_size_hint_min_set(pLabel, 0, MP_POPUP_DETAIL_ITEM_H * elm_config_scale_get());
@@ -511,7 +493,10 @@ static void _mp_common_list_track_more_detail(void *parent, void *data)
        evas_object_size_hint_weight_set(pBox, EVAS_HINT_FILL, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(pBox, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
-       mp_media_info_h svc_item = item_data->handle;
+       mp_media_info_h svc_item = NULL;
+       if (item_data && item_data->handle) {
+               svc_item = item_data->handle;
+       }
 
        char *pathname = NULL, *title = NULL, *album = NULL, *artist = NULL, *thumbname = NULL, *date = NULL;
        char *author = NULL, *copyright = NULL, *format = NULL, *track = NULL;
@@ -684,6 +669,7 @@ void mp_common_list_set_as_cb(void *data, Evas_Object * obj, void *event_info)
                node = g_list_next(node);
        }
        char* path = NULL;
+       MP_CHECK(item_data);
        mp_media_info_get_file_path(item_data->handle, &path);
        MP_CHECK(path);
        mp_common_show_set_as_view(path);
@@ -1342,6 +1328,7 @@ mp_common_playlist_album_update(mp_media_info_h playlist_handle)
 
        mp_media_info_playlist_set_thumbnail_path(playlist_handle, path);
        mp_media_info_list_destroy(svc_handle);
+       IF_FREE(path);
 }
 
 void
@@ -2058,14 +2045,18 @@ void mp_common_playall_cb(void *data, Evas_Object * obj, void *event_info)
        DEBUG_TRACE("group_type: %d", group_type);
        if (group_type == MP_GROUP_BY_PLAYLIST) {
                /* get playlist name */
-               ret = mp_media_info_group_get_playlist_id(item_data->handle, &playlist_id);
-               mp_debug("get playlist name ret = %d", ret);
+               if (item_data) {
+                       ret = mp_media_info_group_get_playlist_id(item_data->handle, &playlist_id);
+                       mp_debug("get playlist name ret = %d", ret);
+               }
                /* create playlist */
                count = mp_playlist_list_set_playlist(ad->playlist_mgr, playlist_id);
                ad->paused_by_user = FALSE;
        } else if (group_type == MP_GROUP_BY_ALBUM) {
                /* get playlist name */
-               ret = mp_media_info_group_get_main_info(item_data->handle, &type_str);
+               if (item_data) {
+                       ret = mp_media_info_group_get_main_info(item_data->handle, &type_str);
+               }
 
                mp_media_info_list_count(MP_TRACK_BY_ALBUM, type_str, NULL, NULL, 0, &count);
                mp_media_info_list_create(&svc_handle,
@@ -2078,7 +2069,9 @@ void mp_common_playall_cb(void *data, Evas_Object * obj, void *event_info)
                }
        } else if (group_type == MP_GROUP_BY_ARTIST) {
                /* get playlist name */
-               ret = mp_media_info_group_get_main_info(item_data->handle, &type_str);
+               if (item_data) {
+                       ret = mp_media_info_group_get_main_info(item_data->handle, &type_str);
+               }
                mp_media_info_list_count(MP_TRACK_BY_ARTIST, type_str, NULL, NULL, 0, &count);
                mp_media_info_list_create(&svc_handle,
                                          MP_TRACK_BY_ARTIST, type_str, NULL, NULL, 0, 0, count);
@@ -2092,7 +2085,9 @@ void mp_common_playall_cb(void *data, Evas_Object * obj, void *event_info)
                }
        } else if (group_type == MP_GROUP_BY_GENRE) {
                /* get playlist name */
-               ret = mp_media_info_group_get_main_info(item_data->handle, &type_str);
+               if (item_data) {
+                       ret = mp_media_info_group_get_main_info(item_data->handle, &type_str);
+               }
 
                mp_media_info_list_count(MP_TRACK_BY_GENRE, type_str, NULL, NULL, 0, &count);
                mp_media_info_list_create(&svc_handle,
@@ -2163,6 +2158,7 @@ void mp_common_playlist_rename_cb(void *data, Evas_Object *obj, void *event_info
        if (group_type == MP_GROUP_BY_PLAYLIST) {
                Mp_Playlist_Data *mp_playlist_data = mp_edit_playlist_create(MP_PLST_RENAME);
                MP_CHECK(mp_playlist_data);
+               MP_CHECK(item_data);
                mp_playlist_data->playlist_handle = item_data->handle;
                mp_edit_playlist_content_create(mp_playlist_data);
        }
index 0a7b374..1e56219 100644 (file)
@@ -246,24 +246,12 @@ _mp_edit_progress_popup_response_cb(void *data, Evas_Object * obj, void *event_i
        DEBUG_TRACE("selected_count, %d, error_count: %d", g_selected_count, g_error_count);
 
        if (g_edit_operation == MP_EDIT_ADD_TO_PLAYLIST) {
-               /*mp_util_post_add_to_playlist_popup_message(g_selected_tracklist_count);*/
-
                mp_view_update(mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYLIST_DETAIL));
-
                mp_view_mgr_post_event(GET_VIEW_MGR, MP_ADD_TO_PLAYLIST_DONE);
        } else if (g_edit_operation == MP_EDIT_DELETE) {
                if ((g_selected_count == 1) && g_error_count) {
                        mp_util_post_status_message(ad, GET_SYS_STR("IDS_COM_POP_FAILED"));
                }
-               /* notification was removed from UX
-               else
-               {
-                       if (g_track_type > MP_TRACK_TYPE_PLAYLIST_MIN && g_track_type < MP_TRACK_TYPE_PLAYLIST_MAX)
-                               mp_util_post_status_message(ad, GET_SYS_STR(STR_MP_REMOVED));
-                       else
-                               mp_util_post_status_message(ad, GET_SYS_STR(STR_MP_DELETED));
-               }
-               */
                if (g_group_type == MP_GROUP_BY_FOLDER) {
                        DEBUG_TRACE("update all view");
                        mp_view_update(mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_ALL));
@@ -279,15 +267,7 @@ _mp_edit_progress_popup_response_cb(void *data, Evas_Object * obj, void *event_i
                        view->selection_info = mp_util_create_selectioninfo_with_count(view, mp_list_get_checked_count(view->content_to_show));
                }
 
-               //if (mp_list_get_edit(view->content_to_show))
-               {
-                       mp_view_mgr_post_event(GET_VIEW_MGR, MP_DELETE_DONE);
-               }
-               /*
-               else
-               {
-                       mp_view_mgr_post_event(GET_VIEW_MGR, MP_POPUP_DELETE_DONE);
-               }*/
+               mp_view_mgr_post_event(GET_VIEW_MGR, MP_DELETE_DONE);
        }
 
        ad->edit_in_progress = false;
index 232646a..be47d02 100644 (file)
@@ -329,7 +329,7 @@ int mp_file_cp(const char *src, const char *dst)
                return 0;
        }
 
-       if (realpath(dst, realpath2) && !strcmp(realpath1, realpath2)) {
+       if (realpath(dst, realpath2) && realpath1 && realpath2 && !strcmp(realpath1, realpath2)) {
                DEBUG_TRACE("realpath check failed");
                return 0;
        }
index 52c9a28..f0ac99c 100644 (file)
@@ -492,7 +492,7 @@ static void __mp_media_info_set_group_filter(mp_filter_h filter, mp_group_type_e
 static int __mp_media_info_get_thumbnail_path(media_info_h media, char **path)
 {
        int res = 0;
-       media_info_get_thumbnail_path(media, path);
+       res = media_info_get_thumbnail_path(media, path);
        if (res != MEDIA_CONTENT_ERROR_NONE) {
                ERROR_TRACE("Error code 0x%x", res);
        }
@@ -1238,8 +1238,9 @@ int mp_media_info_get_year(mp_media_info_h media, char **year)
                }
        }
        if (!g_strcmp0(media->i.minfo->year, "Unknown")) {
-               char *default_year = "2014";
+               char *default_year = g_strdup("2014");
                strncpy(media->i.minfo->year, default_year, strlen(default_year));
+               IF_G_FREE(default_year);
        }
        if (media->i.minfo->year) {
                *year = media->i.minfo->year;
@@ -1442,10 +1443,6 @@ int mp_media_info_set_favorite_media_db_only(mp_media_info_h media, bool favorit
        int res = MEDIA_CONTENT_ERROR_NONE;
        MP_CHECK_VAL(media, -1);
        MP_CHECK_VAL(media->h.media, -1);
-       if (res != MEDIA_CONTENT_ERROR_NONE) {
-               ERROR_TRACE("Error code 0x%x", res);
-               return res;
-       }
 
        res = media_info_set_favorite(media->h.media, favorite);
        if (res != MEDIA_CONTENT_ERROR_NONE) {
index 85883a2..f1057fa 100644 (file)
@@ -397,7 +397,6 @@ mp_util_create_thumb_icon(Evas_Object * obj, const char *path, int w, int h)
        evas_object_size_hint_align_set(thumbnail, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_size_hint_weight_set(thumbnail, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_show(thumbnail);
-       //endfunc;
 
        return thumbnail;
 }
@@ -543,7 +542,7 @@ mp_util_file_is_in_phone_memory(const char *path)
        if (phone_path) {
                phone_len = strlen(phone_path);
        }
-       if (!strncmp(phone_path, path, strlen(phone_path))) {
+       if (!strncmp(phone_path, path, phone_len)) {
                IF_FREE(phone_path);
                return 1;
        } else {
@@ -2421,12 +2420,20 @@ mp_dir_e mp_util_get_file_location(const char *uri)
        len_http = strlen(MP_HTTP_DIR);
 
        if (strncmp(uri, internalPath, len_phone) == 0) {
+               IF_FREE(internalPath);
+               IF_FREE(externalPath);
                return MP_DIR_PHONE;
        } else if (strncmp(uri, externalPath, len_memory) == 0) {
+               IF_FREE(internalPath);
+               IF_FREE(externalPath);
                return MP_DIR_MMC;
        } else if (strncmp(uri, MP_HTTP_DIR, len_http) == 0) {
+               IF_FREE(internalPath);
+               IF_FREE(externalPath);
                return MP_DIR_HTTP;
        } else {
+               IF_FREE(internalPath);
+               IF_FREE(externalPath);
                return MP_DIR_NONE;
        }
 }
index 9a0a438..e86545e 100644 (file)
@@ -848,14 +848,14 @@ mp_setting_save_shortcut(char *shortcut_title, char *artist, char *shortcut_desc
                }
        }
        if (mp_file_exists(shortcut_path_1)) {
-               rename(shortcut_path_1, shortcut_path_2);
+               ret = rename(shortcut_path_1, shortcut_path_2);
                if (ret != 0) {
                        ERROR_TRACE("Failed to rename file:error=%d", ret);
                        return;
                }
        }
        if (mp_file_exists(shortcut_path_0)) {
-               rename(shortcut_path_0, shortcut_path_1);
+               ret = rename(shortcut_path_0, shortcut_path_1);
                if (ret != 0) {
                        ERROR_TRACE("Failed to rename file:error=%d", ret);
                        return;
index ff4de8a..1fef06b 100644 (file)
@@ -44,11 +44,10 @@ typedef struct
        Evas_Object *radio_main;
 
        /* useful flags */
-       //MpAllViewTab_e content_tab;
 #ifdef MP_FEATURE_PERSONAL_PAGE
        bool personal_page_status;
 #endif
-       MpListDisplayMode_e display_mode[MP_TAB_MAX];
+       MpListDisplayMode_e display_mode[MP_TAB_MAX + 1];
 
        Ecore_Idler *show_last_idler;
        Ecore_Timer *bringin_timer;
index b301582..2d8065f 100644 (file)
@@ -102,7 +102,6 @@ _mp_detail_view_append_media_info_item(Evas_Object *genlist, char *header, char
        if (item) {
                elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
        }
-
 }
 
 static void
index fb3cde5..fe8dede 100644 (file)
@@ -1124,12 +1124,9 @@ static void mp_player_view_set_title_and_buttons(void *thiz)
        if (playable) {
                Evas_Object *btn = _mp_player_view_create_toolbar_more_btn(view->layout, _mp_player_view_more_button_clicked_cb, view);
                elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", btn);
-               /*view->toolbar_options[MP_OPTION_MORE] = btn;*/
        }
 
        /* Add back button */
-       /*_mp_player_view_create_back_button(view->layout, view->navi_it, _mp_player_view_back_button_clicked_cb, view);
-       view->toolbar_options[MP_OPTION_BACK] = btn;*/
        elm_naviframe_item_pop_cb_set(view->navi_it, _mp_player_view_back_button_clicked_cb, view);
 
 
index f191034..84fb698 100644 (file)
@@ -773,7 +773,6 @@ void _mp_tabs_sequence_get()
        char *get_str = NULL;
        ms_key_get_tabs_str(&get_str);
        int value = atoi(get_str);
-       /* int index[TAB_COUNT] = {0}; */
        int j = 0;
        for (j = TAB_COUNT - 1; j >= 0 ; j--) {
                tab_index[j] = value % 10;
@@ -864,6 +863,12 @@ _mp_tabs_append_genlist_items(Evas_Object *genlist, MpSettingView_t *view)
 
        for (i = 0; i < TAB_COUNT; i++) {
                int m = tab_index[i];
+
+               if (m <= 0) {
+                       m = 0;
+               } else if (m >= TAB_COUNT) {
+                       m = TAB_COUNT;
+               }
                DEBUG_TRACE("m  %d %s", m, tab_str[m - 1]);
                mp_setting_genlist_item_data_t *item_data = calloc(1,
                        sizeof(mp_setting_genlist_item_data_t));
index c34673e..c6e8a36 100644 (file)
@@ -589,6 +589,7 @@ mp_edit_playlist_rename_done_cb(void *data, Evas_Object * obj, void *event_info)
                        char *message = NULL;
                        message = g_strdup_printf(GET_STR(STR_MP_POP_PLAYLIST_EXISTS), text);
                        mp_widget_text_popup(ad, message);
+                       IF_FREE(message);
                        mp_edit_playlist_content_create(mp_playlist_data);
                        return;
                } else {
index ce59421..25cf5d5 100644 (file)
@@ -198,18 +198,21 @@ _mp_lyric_set_line_color(MpLyricData_t *wd, Evas_Object *obj, int index, const c
 
        char *text_new = (char*)malloc(sizeof(char) * (strlen(text_old) + 50));
        MP_CHECK(text_new);
-       char * text = "<color=";
+       char * text = g_strdup("<color=");
        strncpy(text_new, text, strlen(text));
+       IF_G_FREE(text);
        strncat(text_new, color , strlen(color));
-       text = ">";
+       text = g_strdup(">");
        strncat(text_new, text, strlen(text));
+       IF_G_FREE(text);
        strncat(text_new, text_old , strlen(text_old));
-       text = "</color>";
+       text = g_strdup("</color>");
        strncat(text_new, text, strlen(text));
+       IF_G_FREE(text);
 
        edje_object_part_text_set(_EDJ(obj), "txt", text_new);
 
-       free(text_new);
+       IF_FREE(text_new);
 
 }
 
index c71823b..012f8b5 100644 (file)
@@ -849,12 +849,6 @@ void mp_now_playing_update(Evas_Object *now_playing, const char *title, const ch
        if (ad->player_state == PLAY_STATE_PAUSED && ad->is_Longpress) {
                _progressbar_value_set(wd);
        }
-       /*
-       else if (ad->player_state == PLAY_STATE_PAUSED && !((MpView_t *)(wd->userdata))->rotate_flag)
-       {
-               _progressbar_value_update_to_zero(wd);
-       }
-       */
        else if (((MpView_t *)(wd->userdata))->rotate_flag) {
                _progressbar_value_set(wd);
 #ifdef MP_NOW_PLAYING_MINI_EQ
index b967c59..f6f60fc 100644 (file)
@@ -558,7 +558,6 @@ mp_genlist_popup_item_append(Evas_Object * popup, char *label, char *content, Ev
        }
 
        return item;
-
 }
 
 Evas_Object *
index 8c14d41..48eee7f 100644 (file)
@@ -39,10 +39,7 @@ _mp_search_list_no_content_add(void *data)
        evas_object_size_hint_weight_set(no_contents, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(no_contents, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
-       //elm_layout_file_set(no_contents, EDJ_NAME, "no_result");
        elm_layout_theme_set(no_contents, "layout", "nocontents", "default");
-       //edje_object_part_text_set(_EDJ(no_contents), "elm.text", GET_STR("IDS_MUSIC_BODY_NO_RESULTS_FOUND"));
-       //mp_language_mgr_register_object(no_contents, OBJ_TYPE_EDJE_OBJECT, "elm.text", "IDS_MUSIC_BODY_NO_RESULTS_FOUND");
        mp_util_domain_translatable_part_text_set(no_contents, "elm.text", "IDS_MUSIC_BODY_NO_RESULTS_FOUND");
 
        if (list->genlist) {