Change return type to bool
[platform/core/api/media-content.git] / src / media_content.c
index a29a02a..1640353 100644 (file)
@@ -249,8 +249,6 @@ int media_content_disconnect(void)
 int media_content_scan_file(const char *path)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       bool ignore_file = FALSE;
-       bool ignore_dir = FALSE;
        char *folder_path = NULL;
        int check_file = MEDIA_CONTENT_ERROR_NONE;
        char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0,};
@@ -264,8 +262,7 @@ int media_content_scan_file(const char *path)
        ret = _media_content_replace_path(path, repl_path);
        content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
 
-       ret = _media_util_check_ignore_file(repl_path, &ignore_file);
-       content_retvm_if(ignore_file == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
+       content_retvm_if(_media_util_is_ignorable_file(repl_path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
 
        memset(storage_id, 0x00, sizeof(storage_id));
        ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, _content_get_uid());
@@ -278,10 +275,12 @@ int media_content_scan_file(const char *path)
        if (check_file == MEDIA_CONTENT_ERROR_NONE) {
                /* This means this path has to be inserted or refreshed */
                folder_path = g_path_get_dirname(repl_path);
-               ret = _media_util_check_ignore_dir(folder_path, &ignore_dir);
-               g_free(folder_path);
 
-               content_retvm_if(ignore_dir == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
+               if (_media_util_is_ignorable_dir(folder_path)) {
+                       g_free(folder_path);
+                       return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+               }
+
                /* check feature */
                content_retvm_if(!_media_util_check_support_media_type(repl_path), MEDIA_CONTENT_ERROR_NOT_SUPPORTED, "Unsupported media type");
 
@@ -406,7 +405,6 @@ void _media_content_scan_cb_v2(media_request_result_s* result, void *user_data)
 int media_content_scan_folder(const char *path, bool is_recursive, media_scan_completed_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       bool ignore_dir = FALSE;
        char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
        char repl_path[MAX_PATH_LEN] = {0, };
        ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
@@ -423,8 +421,7 @@ int media_content_scan_folder(const char *path, bool is_recursive, media_scan_co
 
        if (ret == MEDIA_CONTENT_ERROR_NONE) {
                /* If directory exist check that's ignore directory or not*/
-               ret = _media_util_check_ignore_dir(repl_path, &ignore_dir);
-               content_retvm_if((ignore_dir == TRUE || ret != MEDIA_CONTENT_ERROR_NONE), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
+               content_retvm_if(_media_util_is_ignorable_dir(repl_path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
        } else {
                /* This means this folder has to be deleted */
                /* Or, it is real invalid path.. check storage type */
@@ -463,14 +460,12 @@ int media_content_scan_folder(const char *path, bool is_recursive, media_scan_co
 int media_content_scan_folder_v2(const char *path, bool is_recursive, media_scan_completed_cb_v2 callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       bool ignore_dir = FALSE;
        char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
 
        content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
        memset(storage_id, 0x00, sizeof(storage_id));
 
-       ret = _media_util_check_ignore_dir(path, &ignore_dir);
-       content_retvm_if(ignore_dir, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
+       content_retvm_if(_media_util_is_ignorable_dir(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
 
        ret = _media_content_check_dir(path);
        content_retvm_if(ret == MEDIA_CONTENT_ERROR_PERMISSION_DENIED, ret, "Permission Denied");