Remove unnecessary comments 61/241461/1
authorMinje Ahn <minje.ahn@samsung.com>
Thu, 20 Aug 2020 09:08:44 +0000 (18:08 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Thu, 20 Aug 2020 09:08:44 +0000 (18:08 +0900)
Change-Id: If4a77d81f27fb7835ee8a39fead52e4da91d7f84
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/common/media-common-db-svc.c

index 84522d5..2902520 100644 (file)
@@ -32,7 +32,7 @@
 
 static GMutex db_mutex;
 static void **func_array;
-static void *func_handle = NULL; /*dlopen handle */
+static void *func_handle = NULL;
 static int scan_other_type = -1;
 
 typedef int (*CLEANUP_DB)(sqlite3*, uid_t);
@@ -143,15 +143,13 @@ int ms_load_functions(void)
                "refresh_item",
                };
 
-       /*get handle*/
        func_handle = dlopen(CONFIG_PATH, RTLD_LAZY);
        MS_DBG_RETVM_IF(!func_handle, MS_MEDIA_ERR_INTERNAL, "%s", dlerror());
 
-       dlerror();      /* Clear any existing error */
+       dlerror();
 
        func_array = g_new0(gpointer, eFUNC_MAX);
 
-       /*add functions to array */
        for (func_index = 0; func_index < eFUNC_MAX ; func_index++) {
                func_array[func_index] = dlsym(func_handle, func_list[func_index]);
                if (func_array[func_index] == NULL) {
@@ -194,7 +192,7 @@ int ms_cleanup_db(sqlite3 *handle, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((CLEANUP_DB)func_array[eCLEANUP_DB])(handle, uid); /*dlopen*/
+       ret = ((CLEANUP_DB)func_array[eCLEANUP_DB])(handle, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "CLEANUP_DB failed [%d]", ret);
 
        MS_DBG_INFO("Cleanup Media DB");
@@ -278,18 +276,15 @@ int ms_validate_item(sqlite3 *handle, const char *storage_id, const char *path,
        int ret = MS_MEDIA_ERR_NONE;
        bool modified = false;
 
-       /*check exist in Media DB, If file is not exist, insert data in DB. */
        ret = __ms_check_item_exist(handle, storage_id, path, &modified);
        if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
                ret = ms_insert_item_batch(handle, storage_id, path, uid);
        } else if (ret == MS_MEDIA_ERR_NONE) {
                if (!modified) {
-                       /*if meta data of file exist, change valid field to "1" */
-                       ret = ((SET_ITEM_VALIDITY)func_array[eSET_VALIDITY])(storage_id, path, true, true, uid); /*dlopen*/
+                       ret = ((SET_ITEM_VALIDITY)func_array[eSET_VALIDITY])(storage_id, path, true, true, uid);
                        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_ITEM_VALIDITY failed [%d]", ret);
                } else {
-                       /* the file has same name but it is changed, so we have to update DB */
-                       ret = ((REFRESH_ITEM)func_array[eREFRESH_ITEM])(handle, storage_id, path, uid); /*dlopen*/
+                       ret = ((REFRESH_ITEM)func_array[eREFRESH_ITEM])(handle, storage_id, path, uid);
                        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "REFRESH_ITEM failed [%d]", ret);
                }
        } else {
@@ -305,18 +300,15 @@ int ms_scan_validate_item(sqlite3 *handle, const char *storage_id, const char *p
        int ret = MS_MEDIA_ERR_NONE;
        bool modified = false;
 
-       /*check exist in Media DB, If file is not exist, insert data in DB. */
        ret = __ms_check_item_exist(handle, storage_id, path, &modified);
        if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
                ret = ms_scan_item_batch(handle, storage_id, path, uid);
        } else if (ret == MS_MEDIA_ERR_NONE) {
                if (!modified) {
-                       /*if meta data of file exist, change valid field to "1" */
-                       ret = ((SET_ITEM_VALIDITY)func_array[eSET_VALIDITY])(storage_id, path, true, true, uid); /*dlopen*/
+                       ret = ((SET_ITEM_VALIDITY)func_array[eSET_VALIDITY])(storage_id, path, true, true, uid);
                        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_ITEM_VALIDITY failed [%d]", ret);
                } else {
-                       /* the file has same name but it is changed, so we have to update DB */
-                       ret = ((REFRESH_ITEM)func_array[eREFRESH_ITEM])(handle, storage_id, path, uid); /*dlopen*/
+                       ret = ((REFRESH_ITEM)func_array[eREFRESH_ITEM])(handle, storage_id, path, uid);
                        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "REFRESH_ITEM failed [%d]", ret);
                }
        } else {
@@ -355,7 +347,7 @@ int ms_insert_item_batch(sqlite3 *handle, const char *storage_id, const char *pa
        ret = ms_user_get_storage_type(uid, path, &storage_type);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "Fail to get storage type");
 
-       ret = ((INSERT_ITEM)func_array[eINSERT_BATCH])(handle, storage_id, path, storage_type, uid); /*dlopen*/
+       ret = ((INSERT_ITEM)func_array[eINSERT_BATCH])(handle, storage_id, path, storage_type, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "INSERT_ITEM failed [%d]", ret);
 
        return ret;
@@ -371,7 +363,7 @@ int ms_scan_item_batch(sqlite3 *handle, const char *storage_id, const char *path
        ret = ms_user_get_storage_type(uid, path, &storage_type);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "Fail to get storage type");
 
-       ret = ((INSERT_ITEM_SCAN)func_array[eINSERT_SCAN])(handle, storage_id, path, storage_type, uid); /*dlopen*/
+       ret = ((INSERT_ITEM_SCAN)func_array[eINSERT_SCAN])(handle, storage_id, path, storage_type, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "INSERT_ITEM_SCAN failed [%d]", ret);
 
        return ret;
@@ -381,7 +373,7 @@ int ms_get_and_extract_media(sqlite3 *handle, const char *storage_id, int scan_t
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((GET_AND_EXTRACT_MEDIA)func_array[eGET_AND_EXTRACT_MEDIA])(handle, storage_id, scan_type, path); /*dlopen*/
+       ret = ((GET_AND_EXTRACT_MEDIA)func_array[eGET_AND_EXTRACT_MEDIA])(handle, storage_id, scan_type, path);
        if (ret != MS_MEDIA_ERR_NONE && ret != MS_MEDIA_ERR_DB_NO_RECORD)
                MS_DBG_ERR("GET_AND_EXTRACT_MEDIA failed [%d]", ret);
 
@@ -433,7 +425,6 @@ int ms_delete_invalid_items(sqlite3 *handle, const char *storage_id, uid_t uid)
                return ret;
        }
 
-       /*Delete thumbnails*/
        for (i = 0; i < thumb_list->len; i++) {
                path = g_ptr_array_index(thumb_list, i);
 
@@ -476,7 +467,7 @@ int ms_delete_invalid_items_in_folder(sqlite3 *handle, const char *storage_id, c
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((DELETE_ALL_INVALID_ITEMS_IN_FOLDER)func_array[eDELETE_FOLDER])(handle, storage_id, path, is_recursive, uid); /*dlopen*/
+       ret = ((DELETE_ALL_INVALID_ITEMS_IN_FOLDER)func_array[eDELETE_FOLDER])(handle, storage_id, path, is_recursive, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "DELETE_ALL_INVALID_ITEMS_IN_FOLDER failed [%d]", ret);
 
        return ret;
@@ -486,7 +477,7 @@ int ms_send_dir_update_noti(const char*path, const char*folder_id, ms_noti_type_
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((SEND_DIR_UPDATE_NOTI)func_array[eSEND_DIR_UPDATE_NOTI])(path, folder_id, (int)noti_type, pid); /*dlopen*/
+       ret = ((SEND_DIR_UPDATE_NOTI)func_array[eSEND_DIR_UPDATE_NOTI])(path, folder_id, (int)noti_type, pid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SEND_DIR_UPDATE_NOTI failed [%d]", ret);
 
        return ret;
@@ -496,7 +487,7 @@ int ms_update_folder_time(sqlite3 *handle, const char *storage_id, char *folder_
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((UPDATE_FOLDER_TIME)func_array[eUPDATE_FOLDER_TIME])(handle, storage_id, folder_path, uid); /*dlopen*/
+       ret = ((UPDATE_FOLDER_TIME)func_array[eUPDATE_FOLDER_TIME])(handle, storage_id, folder_path, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "UPDATE_FOLDER_TIME failed [%d]", ret);
 
        return ret;
@@ -508,7 +499,7 @@ int ms_get_storage_id(sqlite3 *handle, const char *path, char *storage_id, uid_t
 
        MS_DBG_FENTER();
 
-       ret = ((GET_STORAGE_ID)func_array[eGET_STORAGE_ID])(handle, path, storage_id, uid); /*dlopen*/
+       ret = ((GET_STORAGE_ID)func_array[eGET_STORAGE_ID])(handle, path, storage_id, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_STORAGE_ID failed [%d]", ret);
 
        MS_DBG("storage_id [%s]", storage_id);
@@ -523,7 +514,7 @@ int ms_set_storage_scan_status(sqlite3 *handle, char *storage_id, media_scan_sta
 
        MS_DBG_FENTER();
 
-       ret = ((SET_STORAGE_SCAN_STATUS)func_array[eSET_STORAGE_SCAN_STATUS])(handle, storage_id, status, uid); /*dlopen*/
+       ret = ((SET_STORAGE_SCAN_STATUS)func_array[eSET_STORAGE_SCAN_STATUS])(handle, storage_id, status, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_STORAGE_SCAN_STATUS failed [%d]", ret);
 
        MS_DBG("storage_id [%s], scan_status [%d]", storage_id, scan_status);
@@ -539,7 +530,7 @@ int ms_insert_folder(sqlite3 *handle, const char *storage_id, const char *path,
        ret = ms_user_get_storage_type(uid, path, &storage_type);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "Fail to get storage type");
 
-       ret = ((INSERT_FOLDER)func_array[eINSERT_FOLDER])(handle, storage_id, path, storage_type, uid); /*dlopen*/
+       ret = ((INSERT_FOLDER)func_array[eINSERT_FOLDER])(handle, storage_id, path, storage_type, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "INSERT_FOLDER failed [%d]", ret);
 
        return ret;
@@ -568,7 +559,7 @@ int ms_set_folder_validity(sqlite3 *handle, const char *storage_id, const char *
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((SET_FOLDER_VALIDITY)func_array[eSET_FOLDER_VALIDITY])(handle, storage_id, path, validity, is_recursive, uid); /*dlopen*/
+       ret = ((SET_FOLDER_VALIDITY)func_array[eSET_FOLDER_VALIDITY])(handle, storage_id, path, validity, is_recursive, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_FOLDER_VALIDITY failed [%d]", ret);
 
        return ret;
@@ -592,7 +583,7 @@ int ms_genarate_uuid(char **uuid)
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((GET_UUID)func_array[eGET_UUID])(uuid); /*dlopen*/
+       ret = ((GET_UUID)func_array[eGET_UUID])(uuid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_UUID failed [%d]", ret);
 
        return ret;
@@ -636,7 +627,7 @@ int ms_update_storage(sqlite3 *handle, const char *storage_id, const char *stora
 
        MS_DBG_FENTER();
 
-       ret = ((UPDATE_STORAGE)func_array[eUPDATE_STORAGE])(handle, storage_id, storage_path, uid); /*dlopen*/
+       ret = ((UPDATE_STORAGE)func_array[eUPDATE_STORAGE])(handle, storage_id, storage_path, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "UPDATE_STORAGE failed [%d]", ret);
 
        MS_DBG_FLEAVE();
@@ -648,7 +639,7 @@ int ms_set_storage_validity(sqlite3 *handle, const char *storage_id, int validit
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((SET_STORAGE_VALIDITY)func_array[eSET_STORAGE_VALIDITY])(handle, storage_id, validity, uid); /*dlopen*/
+       ret = ((SET_STORAGE_VALIDITY)func_array[eSET_STORAGE_VALIDITY])(handle, storage_id, validity, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_STORAGE_VALIDITY failed [%d]", ret);
 
        return ret;
@@ -658,7 +649,7 @@ int ms_set_all_storage_validity(sqlite3 *handle, int validity, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((SET_ALL_STORAGE_VALIDITY)func_array[eSET_ALL_STORAGE_VALIDITY])(handle, validity, uid); /*dlopen*/
+       ret = ((SET_ALL_STORAGE_VALIDITY)func_array[eSET_ALL_STORAGE_VALIDITY])(handle, validity, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_ALL_STORAGE_VALIDITY failed [%d]", ret);
 
        return ret;
@@ -670,7 +661,7 @@ int ms_update_meta_batch(sqlite3 *handle, uid_t uid)
 
        MS_DBG_FENTER();
 
-       ret = ((UPDATE_ITEM_META)func_array[eUPDATE_ITEM_META])(handle, uid); /*dlopen*/
+       ret = ((UPDATE_ITEM_META)func_array[eUPDATE_ITEM_META])(handle, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "UPDATE_ITEM_META failed [%d]", ret);
 
        return ret;
@@ -680,7 +671,7 @@ int ms_delete_invalid_folder_by_path(sqlite3 *handle, const char *storage_id, co
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((DELETE_INVALID_FOLDER_BY_PATH)func_array[eDELETE_INVALID_FOLDER_BY_PATH])(handle, storage_id, folder_path, uid); /*dlopen*/
+       ret = ((DELETE_INVALID_FOLDER_BY_PATH)func_array[eDELETE_INVALID_FOLDER_BY_PATH])(handle, storage_id, folder_path, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "DELETE_INVALID_FOLDER_BY_PATH failed [%d]", ret);
 
        return ret;
@@ -690,7 +681,7 @@ int ms_check_folder_exist(sqlite3 *handle, const char *storage_id, const char *f
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((CHECK_FOLDER_EXIST)func_array[eCHECK_FOLDER_EXIST])(handle, storage_id, folder_path); /*dlopen*/
+       ret = ((CHECK_FOLDER_EXIST)func_array[eCHECK_FOLDER_EXIST])(handle, storage_id, folder_path);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "CHECK_FOLDER_EXIST failed [%d]", ret);
 
        return ret;
@@ -726,12 +717,11 @@ int ms_get_folder_id(sqlite3 *handle, const char *storage_id, const char *path,
        return ret;
 }
 
-/* FOR BULK COMMIT */
 void ms_register_start(bool noti_status, int pid)
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((INSERT_ITEM_BEGIN)func_array[eINSERT_BEGIN])(noti_status, pid);/*dlopen*/
+       ret = ((INSERT_ITEM_BEGIN)func_array[eINSERT_BEGIN])(noti_status, pid);
        if (ret != MS_MEDIA_ERR_NONE)
                MS_DBG_ERR("INSERT_ITEM_BEGIN failed [%d]", ret);
 }
@@ -740,7 +730,7 @@ void ms_register_end(uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((INSERT_ITEM_END)func_array[eINSERT_END])(uid);/*dlopen*/
+       ret = ((INSERT_ITEM_END)func_array[eINSERT_END])(uid);
        if (ret != MS_MEDIA_ERR_NONE)
                MS_DBG_ERR("INSERT_ITEM_END failed [%d]", ret);
 }
@@ -750,7 +740,7 @@ int ms_get_folder_scan_status(sqlite3 *handle, const char *storage_id, const cha
        int ret = MS_MEDIA_ERR_NONE;
        int status = 0;
 
-       ret = ((GET_FOLDER_SCAN_STATUS)func_array[eGET_FOLDER_SCAN_STATUS])(handle, storage_id, path, &status); /*dlopen*/
+       ret = ((GET_FOLDER_SCAN_STATUS)func_array[eGET_FOLDER_SCAN_STATUS])(handle, storage_id, path, &status);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_FOLDER_SCAN_STATUS failed [%d]", ret);
        *scan_status = status;
 
@@ -764,7 +754,7 @@ int ms_set_folder_scan_status(sqlite3 *handle, const char *storage_id, const cha
        int ret = MS_MEDIA_ERR_NONE;
        int status = scan_status;
 
-       ret = ((SET_FOLDER_SCAN_STATUS)func_array[eSET_FOLDER_SCAN_STATUS])(handle, storage_id, path, status, uid); /*dlopen*/
+       ret = ((SET_FOLDER_SCAN_STATUS)func_array[eSET_FOLDER_SCAN_STATUS])(handle, storage_id, path, status, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_FOLDER_SCAN_STATUS failed [%d]", ret);
 
        MS_DBG_SLOG("OK path = [%s], scan_status = [%d]", path, scan_status);
@@ -777,7 +767,7 @@ int ms_check_folder_modified(sqlite3 *handle, const char *path, const char *stor
        int ret = MS_MEDIA_ERR_NONE;
        MS_DBG("path = [%s], storage_id = [%s]", path, storage_id);
 
-       ret = ((CHECK_FOLDER_MODIFIED)func_array[eCHECK_FOLDER_MODIFIED])(handle, path, storage_id, modified); /*dlopen*/
+       ret = ((CHECK_FOLDER_MODIFIED)func_array[eCHECK_FOLDER_MODIFIED])(handle, path, storage_id, modified);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "CHECK_FOLDER_MODIFIED failed [%d]", ret);
 
        return ret;
@@ -787,7 +777,7 @@ int ms_get_null_scan_folder_list(sqlite3 *handle, const char *stroage_id, const
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((GET_NULL_SCAN_FOLDER_LIST)func_array[eGET_NULL_SCAN_FOLDER_LIST])(handle, stroage_id, path, dir_array); /*dlopen*/
+       ret = ((GET_NULL_SCAN_FOLDER_LIST)func_array[eGET_NULL_SCAN_FOLDER_LIST])(handle, stroage_id, path, dir_array);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_NULL_SCAN_FOLDER_LIST failed [%d]", ret);
 
        return ret;
@@ -797,7 +787,7 @@ int ms_change_validity_item_batch(sqlite3 *handle, const char *storage_id, const
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((CHANGE_VALIDITY_ITEM_BATCH)func_array[eCHANGE_VALIDITY_ITEM_BATCH])(handle, storage_id, path, des_validity, src_validity, uid); /*dlopen*/
+       ret = ((CHANGE_VALIDITY_ITEM_BATCH)func_array[eCHANGE_VALIDITY_ITEM_BATCH])(handle, storage_id, path, des_validity, src_validity, uid);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "CHANGE_VALIDITY_ITEM_BATCH failed [%d]", ret);
 
        return ret;
@@ -807,7 +797,7 @@ int ms_get_media_type(const char *path, int *media_type)
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       ret = ((GET_MEDIA_TYPE)func_array[eGET_MEDIA_TYPE])(path, media_type); /*dlopen*/
+       ret = ((GET_MEDIA_TYPE)func_array[eGET_MEDIA_TYPE])(path, media_type);
        MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_MEDIA_TYPE failed [%d]", ret);
 
        return ret;
@@ -831,7 +821,6 @@ bool ms_check_support_media_type(const char *path)
                scan_other_type = is_supported;
        }
 
-       /* If not, check media type */
        if (!scan_other_type) {
                ret = ms_get_media_type(path, &media_type);
                MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, false, "Failed to get media type");
@@ -845,7 +834,6 @@ bool ms_check_support_media_type(const char *path)
 
 void ms_batch_commit_enable(bool noti_enable, int pid)
 {
-       /*call for bundle commit*/
        ms_register_start(noti_enable, pid);
 }