From: Minje Ahn Date: Mon, 10 Jun 2024 01:24:34 +0000 (+0900) Subject: Fix unreachable code X-Git-Tag: accepted/tizen/unified/20240611.162825^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11cd79c9a79373be92ea16529fed5a3788dae1c1;p=platform%2Fcore%2Fmultimedia%2Flibmedia-service.git Fix unreachable code Change-Id: I96a79ffd9d18ba0b9cdc644b4495bba54da8a29b Signed-off-by: Minje Ahn --- diff --git a/packaging/libmedia-service.spec b/packaging/libmedia-service.spec index 6c97f51..017955b 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.6.7 +Version: 0.6.8 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/media-svc-media-folder.c b/src/media-svc-media-folder.c index 31cc5e7..687758d 100755 --- a/src/media-svc-media-folder.c +++ b/src/media-svc-media-folder.c @@ -54,9 +54,8 @@ static int __media_svc_append_folder(bool is_direct, const char *storage_id, con return _media_svc_sql_query(q, uid); } -static int __media_svc_append_parent_folder(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid) +static void __media_svc_append_parent_folder(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid) { - int ret = MS_MEDIA_ERR_NONE; size_t next_pos = ms_user_get_root_length(path, uid); char *next = NULL; char *dir_path = NULL; @@ -71,10 +70,8 @@ static int __media_svc_append_parent_folder(sqlite3 *handle, bool is_direct, con dir_path = g_strdup(path); } - ret = _media_svc_check_folder_by_path(handle, dir_path); - if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { - ret = __media_svc_append_folder(is_direct, storage_id, dir_path, uid); - if (ret != MS_MEDIA_ERR_NONE) + if (_media_svc_check_folder_by_path(handle, dir_path) == MS_MEDIA_ERR_DB_NO_RECORD) { + if (__media_svc_append_folder(is_direct, storage_id, dir_path, uid) != MS_MEDIA_ERR_NONE) media_svc_error("__media_svc_append_folder is failed"); else media_svc_sec_debug("Append new folder path[%s]", dir_path); @@ -82,8 +79,6 @@ static int __media_svc_append_parent_folder(sqlite3 *handle, bool is_direct, con g_free(dir_path); } while (next); - - return MS_MEDIA_ERR_NONE; } int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, long long int *folder_id, uid_t uid) @@ -93,9 +88,7 @@ int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, ret = __media_svc_get_folder_id(handle, dir_path, folder_id); if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { - ret = __media_svc_append_parent_folder(handle, is_direct, storage_id, dir_path, uid); - media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "failed to append parent folder"); - + __media_svc_append_parent_folder(handle, is_direct, storage_id, dir_path, uid); return __media_svc_get_folder_id(handle, dir_path, folder_id); } @@ -104,8 +97,10 @@ int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, int _media_svc_append_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid) { - if (_media_svc_check_folder_by_path(handle, path) == MS_MEDIA_ERR_DB_NO_RECORD) - return __media_svc_append_parent_folder(handle, true, storage_id, path, uid); + if (_media_svc_check_folder_by_path(handle, path) == MS_MEDIA_ERR_DB_NO_RECORD) { + __media_svc_append_parent_folder(handle, true, storage_id, path, uid); + return MS_MEDIA_ERR_NONE; + } return _media_svc_set_folder_validity(true, path, 1, false, uid); }