Fix unreachable code 02/312402/1 accepted/tizen/unified/20240611.162825 accepted/tizen/unified/x/20240612.025933
authorMinje Ahn <minje.ahn@samsung.com>
Mon, 10 Jun 2024 01:24:34 +0000 (10:24 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Mon, 10 Jun 2024 01:24:34 +0000 (10:24 +0900)
Change-Id: I96a79ffd9d18ba0b9cdc644b4495bba54da8a29b
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
packaging/libmedia-service.spec
src/media-svc-media-folder.c

index 6c97f51..017955b 100644 (file)
@@ -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
index 31cc5e7..687758d 100755 (executable)
@@ -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);
 }