From: Minje Ahn Date: Thu, 9 Aug 2018 05:48:14 +0000 (+0900) Subject: Remove function for rollback path X-Git-Tag: accepted/tizen/unified/20180813.061452^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F47%2F186347%2F2;p=platform%2Fcore%2Fapi%2Fmedia-content.git Remove function for rollback path Code modification according to policy change - return path - path for notification Change-Id: I31f6f84f02f0d43e61f413354f6d42a6e5e13d52 Signed-off-by: Minje Ahn --- diff --git a/include/media_util_private.h b/include/media_util_private.h index c7b131a..0f28d39 100755 --- a/include/media_util_private.h +++ b/include/media_util_private.h @@ -37,7 +37,6 @@ int _media_util_check_ignore_dir(const char *dir_path, bool *ignore); int _media_content_check_dir(const char *path); int _media_content_replace_path_in_condition(const char *condition, char *replace_condition, bool replace); int _media_content_replace_path(const char *path, char *replace_path); -int _media_content_rollback_path(const char *path, char *replace_path); diff --git a/include_product/media_util_private.h b/include_product/media_util_private.h index cc51c27..bf082a7 100755 --- a/include_product/media_util_private.h +++ b/include_product/media_util_private.h @@ -37,7 +37,6 @@ int _media_util_check_ignore_dir(const char *dir_path, bool *ignore); int _media_content_check_dir(const char *path); int _media_content_replace_path_in_condition(const char *condition, char *replace_condition, bool replace); int _media_content_replace_path(const char *path, char *replace_path); -int _media_content_rollback_path(const char *path, char *replace_path); #ifdef _USE_SENIOR_MODE bool _media_content_is_support_senior_mode(); diff --git a/src/media_db.c b/src/media_db.c index 9b8c6c2..5d15b71 100755 --- a/src/media_db.c +++ b/src/media_db.c @@ -594,8 +594,6 @@ int _media_db_get_folder(filter_h filter, media_folder_cb callback, void *user_d sqlite3_stmt *stmt = NULL; attribute_h attr = NULL; filter_s *_filter = (filter_s*)filter; - char *tmp_path = NULL; - char repl_path[MAX_PATH_LEN] = {0, }; attr = _content_get_alias_attirbute_handle(); memset(select_query, 0x00, sizeof(select_query)); @@ -624,12 +622,7 @@ int _media_db_get_folder(filter_h filter, media_folder_cb callback, void *user_d } _folder->folder_id = g_strdup((const char *)sqlite3_column_text(stmt, 0)); - - tmp_path = g_strdup((const char *)sqlite3_column_text(stmt, 1)); - _media_content_rollback_path(tmp_path, repl_path); - _folder->path = g_strdup(repl_path); - SAFE_FREE(tmp_path); - + _folder->path = g_strdup((const char *)sqlite3_column_text(stmt, 1)); _folder->name = g_strdup((const char *)sqlite3_column_text(stmt, 2)); _folder->storage_type = (int)sqlite3_column_int(stmt, 3); _folder->modified_time = (int)sqlite3_column_int(stmt, 4); @@ -657,8 +650,6 @@ int _media_db_get_playlist(filter_h filter, media_playlist_cb callback, void *us char *option_query = NULL; sqlite3_stmt *stmt = NULL; attribute_h attr = NULL; - char *tmp_path = NULL; - char repl_path[MAX_PATH_LEN] = {0, }; attr = _content_get_attirbute_handle(); memset(select_query, 0x00, sizeof(select_query)); @@ -687,17 +678,7 @@ int _media_db_get_playlist(filter_h filter, media_playlist_cb callback, void *us _playlist->playlist_id = (int)sqlite3_column_int(stmt, 0); _playlist->name = g_strdup((const char *)sqlite3_column_text(stmt, 1)); - - memset(repl_path, 0x00, sizeof(repl_path)); - tmp_path = g_strdup((const char *)sqlite3_column_text(stmt, 2)); - if (STRING_VALID(tmp_path)) { - _media_content_rollback_path(tmp_path, repl_path); - _playlist->thumbnail_path = g_strdup(repl_path); - } else { - _playlist->thumbnail_path = NULL; - } - - SAFE_FREE(tmp_path); + _playlist->thumbnail_path = g_strdup((const char *)sqlite3_column_text(stmt, 2)); if (callback((media_playlist_h)_playlist, user_data) == false) { media_playlist_destroy((media_playlist_h)_playlist); diff --git a/src/media_folder.c b/src/media_folder.c index 7c23db6..f431eae 100755 --- a/src/media_folder.c +++ b/src/media_folder.c @@ -393,8 +393,6 @@ int media_folder_get_folder_from_db(const char *folder_id, media_folder_h *folde int ret = MEDIA_CONTENT_ERROR_NONE; sqlite3_stmt *stmt = NULL; char select_query[DEFAULT_QUERY_SIZE]; - char *tmp_path = NULL; - char repl_path[MAX_PATH_LEN] = {0, }; media_folder_s *_folder = NULL; if (!STRING_VALID(folder_id)) { @@ -417,12 +415,7 @@ int media_folder_get_folder_from_db(const char *folder_id, media_folder_h *folde } _folder->folder_id = g_strdup((const char *)sqlite3_column_text(stmt, 0)); - - tmp_path = g_strdup((const char *)sqlite3_column_text(stmt, 1)); - _media_content_rollback_path(tmp_path, repl_path); - _folder->path = g_strdup(repl_path); - SAFE_FREE(tmp_path); - + _folder->path = g_strdup((const char *)sqlite3_column_text(stmt, 1)); _folder->name = g_strdup((const char *)sqlite3_column_text(stmt, 2)); _folder->modified_time = (int)sqlite3_column_int(stmt, 3); _folder->storage_type = (int)sqlite3_column_int(stmt, 5); @@ -498,11 +491,8 @@ int media_folder_set_name(media_folder_h folder, const char *name) SAFE_FREE(_folder->path); SAFE_FREE(_folder->name); SAFE_FREE(folder_path); - memset(repl_path, 0, sizeof(repl_path)); - ret = _media_content_rollback_path(new_folder_path, repl_path); - media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed"); - _folder->path = strdup(repl_path); + _folder->path = strdup(new_folder_path); media_content_retvm_if(_folder->path == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY"); _folder->name = strdup(name); media_content_retvm_if(_folder->name == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY"); diff --git a/src/media_info.c b/src/media_info.c index c78d2ee..e1fb158 100755 --- a/src/media_info.c +++ b/src/media_info.c @@ -342,16 +342,8 @@ void _media_info_item_get_detail(sqlite3_stmt* stmt, media_info_h media) { media_info_s *_media = (media_info_s*)media; - char *tmp_path = NULL; - char repl_path[MAX_PATH_LEN] = {0, }; - _media->media_id = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_UUID)); - - tmp_path = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_PATH)); - _media_content_rollback_path(tmp_path, repl_path); - _media->file_path = g_strdup(repl_path); - SAFE_FREE(tmp_path); - + _media->file_path = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_PATH)); _media->display_name = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_FILE_NAME)); _media->media_type = (int)sqlite3_column_int(stmt, MEDIA_INFO_TYPE); _media->mime_type = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_MIME_TYPE)); diff --git a/src/media_playlist.c b/src/media_playlist.c index cc4db76..b7bc197 100755 --- a/src/media_playlist.c +++ b/src/media_playlist.c @@ -921,7 +921,6 @@ int media_playlist_export_to_file(media_playlist_h playlist, const char* path) GList *item_list = NULL; unsigned int idx = 0; char repl_path[MAX_PATH_LEN] = {0, }; - char repl_item[MAX_QUERY_SIZE] = {0, }; media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path"); media_content_retvm_if(_playlist == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid playlist"); @@ -942,14 +941,13 @@ int media_playlist_export_to_file(media_playlist_h playlist, const char* path) for (idx = 0; idx < g_list_length(item_list); idx++) { char *item = g_list_nth_data(item_list, idx); - memset(repl_item, 0, sizeof(repl_item)); - ret = _media_content_rollback_path(item, repl_item); - - ret = __media_playlist_append_to_file(repl_path, repl_item); - if (ret != MEDIA_CONTENT_ERROR_NONE) { - g_list_free_full(item_list, __media_playlist_destroy_export_item); - media_content_error("Fail to export paths into file"); - return ret; + if (STRING_VALID(item)) { + ret = __media_playlist_append_to_file(repl_path, item); + if (ret != MEDIA_CONTENT_ERROR_NONE) { + g_list_free_full(item_list, __media_playlist_destroy_export_item); + media_content_error("Fail to export paths into file"); + return ret; + } } } diff --git a/src/media_util_private.c b/src/media_util_private.c index ba19ed3..3a63c51 100755 --- a/src/media_util_private.c +++ b/src/media_util_private.c @@ -474,27 +474,6 @@ int _media_content_replace_path(const char *path, char *replace_path) return MEDIA_CONTENT_ERROR_NONE; } -int _media_content_rollback_path(const char *path, char *replace_path) -{ -#ifdef _USE_TVPD_MODE - snprintf(replace_path, MAX_PATH_LEN, "%s", path); -#else - if (strncmp(path, MEDIA_ROOT_PATH_INTERNAL, strlen(MEDIA_ROOT_PATH_INTERNAL)) == 0) { - media_content_sec_debug("new path[%s]", path); - snprintf(replace_path, MAX_PATH_LEN, "%s%s", MEDIA_ROOT_PATH_INTERNAL_OLD, path + strlen(MEDIA_ROOT_PATH_INTERNAL)); - } else { - snprintf(replace_path, MAX_PATH_LEN, "%s", path); - } -#endif - - if (!STRING_VALID(replace_path)) { - media_content_error("replace failed"); - return MEDIA_CONTENT_ERROR_INVALID_OPERATION; - } - - return MEDIA_CONTENT_ERROR_NONE; -} - #ifdef _USE_SENIOR_MODE bool _media_content_is_support_senior_mode() {