From: Minje Ahn Date: Tue, 21 May 2019 00:27:03 +0000 (+0900) Subject: Remove unnecessary parameter X-Git-Tag: accepted/tizen/unified/20190530.043044~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=90626b8365312836b9875522580f9ce01ae27634;p=platform%2Fcore%2Fmultimedia%2Flibmedia-service.git Remove unnecessary parameter Deletes unnecessary parameter due to logic changes Change-Id: Iba04217e47d3329ed6c2121a8568b9b7b26d6f67 Signed-off-by: Minje Ahn --- diff --git a/include/media-svc.h b/include/media-svc.h index e998f3f..c687f24 100755 --- a/include/media-svc.h +++ b/include/media-svc.h @@ -55,7 +55,7 @@ int media_svc_move_item(sqlite3 *handle, int media_svc_set_item_validity_begin(int data_cnt); int media_svc_set_item_validity_end(uid_t uid); int media_svc_set_item_validity(const char *storage_id, const char *path, int validity, uid_t uid); -int media_svc_delete_item_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid); +int media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid); int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid); int media_svc_send_dir_update_noti(const char *dir_path, const char *folder_id, media_item_update_type_e update_type, int pid); int media_svc_check_db_upgrade(sqlite3 *handle, int user_version, uid_t uid); diff --git a/packaging/libmedia-service.spec b/packaging/libmedia-service.spec index d82f8c3..15e130f 100644 --- a/packaging/libmedia-service.spec +++ b/packaging/libmedia-service.spec @@ -1,6 +1,6 @@ Name: libmedia-service Summary: Media information service library for multimedia applications -Version: 0.4.2 +Version: 0.4.3 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 and PD diff --git a/plugin/media-content-plugin.c b/plugin/media-content-plugin.c index 0b93f17..6392fa3 100755 --- a/plugin/media-content-plugin.c +++ b/plugin/media-content-plugin.c @@ -61,11 +61,6 @@ int set_item_validity(const char *storage_id, const char *file_path, int storage return media_svc_set_item_validity(storage_id, file_path, validity, uid); } -int delete_item(sqlite3 *handle, const char *storage_id, const char *file_path, uid_t uid) -{ - return media_svc_delete_item_by_path(handle, true, storage_id, file_path, uid); -} - int send_dir_update_noti(const char *dir_path, const char *folder_id, int update_type, int pid) { return media_svc_send_dir_update_noti(dir_path, folder_id, (media_item_update_type_e)update_type, pid); diff --git a/src/common/media-svc-media.c b/src/common/media-svc-media.c index f5bcde5..365c885 100755 --- a/src/common/media-svc-media.c +++ b/src/common/media-svc-media.c @@ -423,7 +423,7 @@ int _media_svc_get_media_type_by_path(sqlite3 *handle, const char *storage_id, c return MS_MEDIA_ERR_NONE; } -int _media_svc_delete_item_by_path(bool is_direct, const char *storage_id, const char *path, bool stack_query, uid_t uid) +int _media_svc_delete_item_by_path(const char *storage_id, const char *path, uid_t uid) { int ret = MS_MEDIA_ERR_NONE; char *sql = NULL; @@ -433,20 +433,9 @@ int _media_svc_delete_item_by_path(bool is_direct, const char *storage_id, const sql = sqlite3_mprintf("DELETE FROM '%q' WHERE media_path='%q';", storage_id, path); - if (!stack_query) { - if (is_direct) - ret = _media_svc_sql_query_direct(sql, uid); - else - ret = _media_svc_sql_query(sql, uid); - SQLITE3_SAFE_FREE(sql); - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("failed to delete item"); - return ret; - } - } else { - media_svc_debug("query : %s", sql); - _media_svc_sql_query_add(&g_media_svc_insert_item_query_list, &sql); - } + ret = _media_svc_sql_query(sql, uid); + SQLITE3_SAFE_FREE(sql); + media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "failed to delete item"); return ret; } diff --git a/src/common/media-svc.c b/src/common/media-svc.c index e521880..b3f508d 100755 --- a/src/common/media-svc.c +++ b/src/common/media-svc.c @@ -521,10 +521,11 @@ int media_svc_set_item_validity(const char *storage_id, const char *path, int va return MS_MEDIA_ERR_NONE; } -int media_svc_delete_item_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid) +int media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid) { int ret = MS_MEDIA_ERR_NONE; char thumb_path[MEDIA_SVC_PATHNAME_SIZE] = {0, }; + media_svc_noti_item *noti_item = NULL; media_svc_debug_fenter(); @@ -532,35 +533,24 @@ int media_svc_delete_item_by_path(sqlite3 *handle, bool is_direct, const char *s ret = _media_svc_get_thumbnail_path_by_path(handle, path, thumb_path); media_svc_retv_if((ret != MS_MEDIA_ERR_NONE) && (ret != MS_MEDIA_ERR_DB_NO_RECORD), ret); - if (g_media_svc_insert_item_data_cnt == 1) { - - /* Get notification info */ - media_svc_noti_item *noti_item = NULL; - ret = _media_svc_get_noti_info(handle, storage_id, path, ¬i_item); - media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - - /*Delete item*/ - ret = _media_svc_delete_item_by_path(is_direct, storage_id, path, FALSE, uid); - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("_media_svc_delete_item_by_path failed : %d", ret); - _media_svc_destroy_noti_item(noti_item); - - return ret; - } + /* Get notification info */ + ret = _media_svc_get_noti_info(handle, storage_id, path, ¬i_item); + media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - /* Send notification */ - media_svc_debug("Deletion is successful. Sending noti for this"); - _media_svc_publish_noti(MS_MEDIA_ITEM_DELETE, path, noti_item->media_type, noti_item->media_uuid, noti_item->mime_type); + /*Delete item*/ + ret = _media_svc_delete_item_by_path(storage_id, path, uid); + if (ret != MS_MEDIA_ERR_NONE) { + media_svc_error("_media_svc_delete_item_by_path failed : %d", ret); _media_svc_destroy_noti_item(noti_item); - } else { - ret = _media_svc_delete_item_by_path(is_direct, storage_id, path, TRUE, uid); - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("_media_svc_delete_item_by_path failed : %d", ret); - return ret; - } + return ret; } + /* Send notification */ + media_svc_debug("Deletion is successful. Sending noti for this"); + _media_svc_publish_noti(MS_MEDIA_ITEM_DELETE, path, noti_item->media_type, noti_item->media_uuid, noti_item->mime_type); + _media_svc_destroy_noti_item(noti_item); + /*Delete thumbnail*/ if (STRING_VALID(thumb_path)) { ret = _media_svc_remove_file(thumb_path); diff --git a/src/include/common/media-svc-media.h b/src/include/common/media-svc-media.h index e2db8f3..8af8487 100755 --- a/src/include/common/media-svc-media.h +++ b/src/include/common/media-svc-media.h @@ -34,7 +34,7 @@ int _media_svc_insert_item_with_data(sqlite3 *handle, bool is_direct, const char int _media_svc_update_item_with_data(bool is_direct, const char *storage_id, media_svc_content_info_s *content_info, uid_t uid); int _media_svc_get_thumbnail_path_by_path(sqlite3 *handle, const char *path, char *thumbnail_path); int _media_svc_get_media_type_by_path(sqlite3 *handle, const char *storage_id, const char *path, int *media_type); -int _media_svc_delete_item_by_path(bool is_direct, const char *storage_id, const char *path, bool stack_query, uid_t uid); +int _media_svc_delete_item_by_path(const char *storage_id, const char *path, uid_t uid); int _media_svc_update_item_validity(const char *storage_id, const char *path, int validity, bool stack_query, uid_t uid); int _media_svc_update_item_by_path(const char *org_storage_id, const char *src_path, const char *dst_storage_id, ms_user_storage_type_e dest_storage, const char *dest_path, const char *file_name, int modified_time, const char *folder_uuid, uid_t uid); int _media_svc_list_query_do(media_svc_query_type_e query_type, uid_t uid);