Delete unused parameter 95/206595/4
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 22 May 2019 03:47:20 +0000 (12:47 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Wed, 22 May 2019 06:29:14 +0000 (15:29 +0900)
Change-Id: I6d654025526ac6fd1dbe3f526960af1ed34826f8
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
include/media-svc.h
plugin/media-content-plugin.c
src/common/media-svc-media-folder.c
src/common/media-svc-media.c
src/common/media-svc-util.c
src/common/media-svc.c
src/include/common/media-svc-media.h
src/include/common/media-svc-util.h

index 69f2311..b8d3776 100755 (executable)
@@ -40,7 +40,7 @@ int media_svc_create_table(uid_t uid);
 int media_svc_check_item_exist_by_path(sqlite3 *handle, const char *storage_id, const char *path);
 int media_svc_get_modified_time(sqlite3 *handle, const char *storage_id, const char *path, int *modified_time);
 int media_svc_insert_folder(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
-int media_svc_insert_item_begin(int data_cnt, int with_noti, int from_pid);
+int media_svc_insert_item_begin(int data_cnt, bool with_noti, int from_pid);
 int media_svc_insert_item_end(uid_t uid);
 int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
 int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
index cc258f9..c7a46b2 100755 (executable)
@@ -31,7 +31,7 @@ int cleanup_db(sqlite3 *handle, uid_t uid)
        return MS_MEDIA_ERR_NONE;
 }
 
-int insert_item_begin(int item_cnt, int with_noti, int from_pid)
+int insert_item_begin(int item_cnt, bool with_noti, int from_pid)
 {
        return media_svc_insert_item_begin(item_cnt, with_noti, from_pid);
 }
index 9427eb0..24b3cd4 100755 (executable)
@@ -132,7 +132,7 @@ static int __media_svc_get_and_append_parent_folder(sqlite3 *handle, bool is_dir
        const char *token = "/";
        char *folder_uuid = NULL;
        char tmp_folder_uuid[MEDIA_SVC_UUID_SIZE + 1] = {0, };
-       bool folder_search_end = FALSE;
+       bool folder_search_end = false;
        char *internal_path = NULL;
 
        memset(tmp_folder_uuid, 0, sizeof(tmp_folder_uuid));
@@ -164,7 +164,7 @@ static int __media_svc_get_and_append_parent_folder(sqlite3 *handle, bool is_dir
                        next_pos++;
                } else {
                        dir_path = strndup(path, strlen(path));
-                       folder_search_end = TRUE;
+                       folder_search_end = true;
                        media_svc_sec_debug("End Path[%s]", dir_path);
                }
 
@@ -210,7 +210,7 @@ static int __media_svc_update_parent_folder_validity(sqlite3 *handle, bool is_di
        char *next = NULL;
        char *dir_path = NULL;
        const char *token = "/";
-       bool folder_search_end = FALSE;
+       bool folder_search_end = false;
        char *internal_path = NULL;
 
        ret = ms_user_get_internal_root_path(uid, &internal_path);
@@ -241,7 +241,7 @@ static int __media_svc_update_parent_folder_validity(sqlite3 *handle, bool is_di
                        next_pos++;
                } else {
                        dir_path = strndup(path, strlen(path));
-                       folder_search_end = TRUE;
+                       folder_search_end = true;
                        media_svc_sec_debug("End Path [%s]", dir_path);
                }
 
index 8c462e1..abd27e0 100755 (executable)
@@ -77,7 +77,7 @@ int _media_svc_get_modified_time(sqlite3 *handle, const char *storage_id, const
        return MS_MEDIA_ERR_NONE;
 }
 
-int _media_svc_insert_item_with_data(sqlite3 *handle, bool is_direct, const char *storage_id, media_svc_content_info_s *content_info, bool stack_query, uid_t uid)
+int _media_svc_insert_item_with_data(bool is_direct, const char *storage_id, media_svc_content_info_s *content_info, bool stack_query, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
 
index 2e2a03b..aa60ba5 100755 (executable)
@@ -827,7 +827,7 @@ int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char
        char mime_type[256] = {0, };
        media_svc_media_type_e media_type;
 
-       media_svc_retvm_if(_media_svc_check_storage_type(storage_type) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
+       media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
        media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
 
        content_info->path = g_strdup(path);
@@ -1008,7 +1008,7 @@ int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info)
        int exif_width = 0;
        int exif_height = 0;
        ExifData *ed = NULL;
-       int has_datetaken = FALSE;
+       int has_datetaken = false;
        double fnumber = 0.0;
        int iso = 0;
        char *path = NULL;
@@ -1083,7 +1083,7 @@ int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info)
 
        if (!has_datetaken && __media_svc_get_exif_info(ed, buf, NULL, NULL, EXIF_TAG_DATE_TIME_ORIGINAL) == MS_MEDIA_ERR_NONE) {
                if (strlen(buf) > 0) {
-                       has_datetaken = TRUE;
+                       has_datetaken = true;
                        content_info->media_meta.datetaken = g_strdup(buf);
 
                        /* This is same as recorded_date */
@@ -1095,7 +1095,7 @@ int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info)
 
        if (!has_datetaken && __media_svc_get_exif_info(ed, buf, NULL, NULL, EXIF_TAG_DATE_TIME) == MS_MEDIA_ERR_NONE) {
                if (strlen(buf) > 0) {
-                       has_datetaken = TRUE;
+                       has_datetaken = true;
                        content_info->media_meta.datetaken = g_strdup(buf);
 
                        /* This is same as recorded_date */
@@ -1328,18 +1328,10 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc
                        SAFE_FREE(err_attr_name);
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_GENRE, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
+               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
                        content_info->media_meta.genre = g_strdup(p);
-
-                       /* If genre is Ringtone, it's categorized as sound. But this logic is commented */
-                       /*
-                       if ((strcasecmp("Ringtone", p) == 0) | (strcasecmp("Alert tone", p) == 0)) {
-                               content_info->media_type = MEDIA_SVC_MEDIA_TYPE_SOUND;
-                       }
-                       */
-               } else {
+               else
                        SAFE_FREE(err_attr_name);
-               }
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_TITLE, &p, &size, NULL);
                if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
@@ -1999,14 +1991,14 @@ int _media_svc_get_media_type(const char *path, int *mediatype)
        return ret;
 }
 
-bool _media_svc_check_storage_type(ms_user_storage_type_e storage_type)
+bool _media_svc_is_valid_storage_type(ms_user_storage_type_e storage_type)
 {
        if ((storage_type != MS_USER_STORAGE_INTERNAL)
                && (storage_type != MS_USER_STORAGE_EXTERNAL)
                && (storage_type != MS_USER_STORAGE_EXTERNAL_USB)) {
                media_svc_error("storage type is incorrect[%d]", storage_type);
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
index 4a5078c..483ff26 100755 (executable)
@@ -42,7 +42,7 @@ static __thread int g_media_svc_update_item_data_cnt = 1;
 static __thread int g_media_svc_update_item_cur_data_cnt = 0;
 
 /* Flag for items to be published by notification */
-static __thread int g_insert_with_noti = FALSE;
+static __thread bool g_insert_with_noti = false;
 
 #define BATCH_REQUEST_MAX 300
 
@@ -184,7 +184,7 @@ int media_svc_get_modified_time(sqlite3 *handle, const char *storage_id, const c
        return _media_svc_get_modified_time(handle, storage_id, path, modified_time);
 }
 
-int media_svc_insert_item_begin(int data_cnt, int with_noti, int from_pid)
+int media_svc_insert_item_begin(int data_cnt, bool with_noti, int from_pid)
 {
        media_svc_retvm_if(data_cnt < 1, MS_MEDIA_ERR_INVALID_PARAMETER, "data_cnt shuld be bigger than 1");
 
@@ -198,7 +198,7 @@ int media_svc_insert_item_begin(int data_cnt, int with_noti, int from_pid)
                        return MS_MEDIA_ERR_OUT_OF_MEMORY;
 
                _media_svc_set_noti_from_pid(from_pid);
-               g_insert_with_noti = TRUE;
+               g_insert_with_noti = true;
        }
 
        return MS_MEDIA_ERR_NONE;
@@ -217,7 +217,7 @@ int media_svc_insert_item_end(uid_t uid)
                        media_svc_debug("sending noti list");
                        _media_svc_publish_noti_list(g_media_svc_insert_item_cur_data_cnt);
                        _media_svc_destroy_noti_list(g_media_svc_insert_item_cur_data_cnt);
-                       g_insert_with_noti = FALSE;
+                       g_insert_with_noti = false;
                        _media_svc_set_noti_from_pid(-1);
                }
        }
@@ -236,14 +236,14 @@ int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_
        media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
        media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
        media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
-       media_svc_retvm_if(_media_svc_check_storage_type(storage_type) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
+       media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
 
        media_svc_content_info_s content_info;
        memset(&content_info, 0, sizeof(media_svc_content_info_s));
 
        /*Set media info*/
        /* if drm_contentinfo is not NULL, the file is OMA DRM.*/
-       ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, FALSE);
+       ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, false);
        if (ret != MS_MEDIA_ERR_NONE)
                return ret;
 
@@ -267,7 +267,7 @@ int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_
 
        if (g_media_svc_insert_item_data_cnt == 1) {
 
-               ret = _media_svc_insert_item_with_data(handle, true, storage_id, &content_info, FALSE, uid);
+               ret = _media_svc_insert_item_with_data(true, storage_id, &content_info, false, uid);
                media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
 
                if (g_insert_with_noti)
@@ -275,7 +275,7 @@ int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_
 
        } else if (g_media_svc_insert_item_cur_data_cnt < (g_media_svc_insert_item_data_cnt - 1)) {
 
-               ret = _media_svc_insert_item_with_data(handle, true, storage_id, &content_info, TRUE, uid);
+               ret = _media_svc_insert_item_with_data(true, storage_id, &content_info, true, uid);
                media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
 
                if (g_insert_with_noti)
@@ -285,7 +285,7 @@ int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_
 
        } else if (g_media_svc_insert_item_cur_data_cnt == (g_media_svc_insert_item_data_cnt - 1)) {
 
-               ret = _media_svc_insert_item_with_data(handle, true, storage_id, &content_info, TRUE, uid);
+               ret = _media_svc_insert_item_with_data(true, storage_id, &content_info, true, uid);
                media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
 
                if (g_insert_with_noti)
@@ -324,13 +324,13 @@ int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, m
        media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
        media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
        media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
-       media_svc_retvm_if(_media_svc_check_storage_type(storage_type) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
+       media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
 
        media_svc_content_info_s content_info;
        memset(&content_info, 0, sizeof(media_svc_content_info_s));
 
        /*Set media info*/
-       ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, FALSE);
+       ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, false);
        if (ret != MS_MEDIA_ERR_NONE)
                return ret;
 
@@ -365,7 +365,7 @@ int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, m
                }
        }
 
-       ret = _media_svc_insert_item_with_data(handle, false, storage_id, &content_info, FALSE, uid);
+       ret = _media_svc_insert_item_with_data(false, storage_id, &content_info, false, uid);
 
        if (ret == MS_MEDIA_ERR_NONE) {
                media_svc_debug("Insertion is successful. Sending noti for this");
@@ -490,18 +490,18 @@ int media_svc_set_item_validity(const char *storage_id, const char *path, int va
 
        if (g_media_svc_item_validity_data_cnt == 1) {
 
-               return _media_svc_update_item_validity(storage_id, path, validity, FALSE, uid);
+               return _media_svc_update_item_validity(storage_id, path, validity, false, uid);
 
        } else if (g_media_svc_item_validity_cur_data_cnt < (g_media_svc_item_validity_data_cnt - 1)) {
 
-               ret = _media_svc_update_item_validity(storage_id, path, validity, TRUE, uid);
+               ret = _media_svc_update_item_validity(storage_id, path, validity, true, uid);
                media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
 
                g_media_svc_item_validity_cur_data_cnt++;
 
        } else if (g_media_svc_item_validity_cur_data_cnt == (g_media_svc_item_validity_data_cnt - 1)) {
 
-               ret = _media_svc_update_item_validity(storage_id, path, validity, TRUE, uid);
+               ret = _media_svc_update_item_validity(storage_id, path, validity, true, uid);
                media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
 
                ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_SET_ITEM_VALIDITY, uid);
@@ -566,13 +566,13 @@ int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_
        media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
        media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
        media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
-       media_svc_retvm_if(_media_svc_check_storage_type(storage_type) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
+       media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
 
        media_svc_content_info_s content_info;
        memset(&content_info, 0, sizeof(media_svc_content_info_s));
 
        /*Set media info*/
-       ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, TRUE);
+       ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, true);
        if (ret != MS_MEDIA_ERR_NONE)
                return ret;
 
@@ -697,7 +697,7 @@ int media_svc_update_item_meta(const char *file_path, const char *storage_id, in
        memset(&content_info, 0, sizeof(media_svc_content_info_s));
 
        /*Set media info*/
-       ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, file_path, FALSE);
+       ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, file_path, false);
        if (ret != MS_MEDIA_ERR_NONE)
                return ret;
 
@@ -811,7 +811,7 @@ int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char
        media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
        media_svc_retvm_if(storage_id == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
        media_svc_retvm_if(storage_path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "storage_path is NULL");
-       media_svc_retvm_if(_media_svc_check_storage_type(storage_type) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
+       media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
 
        ret = _media_svc_append_storage(storage_id, storage_path, storage_type, uid);
        media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "append storage failed : %d", ret);
@@ -834,7 +834,7 @@ int media_svc_insert_folder(sqlite3 *handle, const char *storage_id, ms_user_sto
        media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
        media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
        media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
-       media_svc_retvm_if(_media_svc_check_storage_type(storage_type) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
+       media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
 
        return _media_svc_get_and_append_folder_id_by_folder_path(handle, storage_id, path, storage_type, uid);
 }
index 8af8487..c36861b 100755 (executable)
@@ -30,7 +30,7 @@
 
 int _media_svc_count_record_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count);
 int _media_svc_get_modified_time(sqlite3 *handle, const char *storage_id, const char *path, int *modified_time);
-int _media_svc_insert_item_with_data(sqlite3 *handle, bool is_direct, const char *storage_id, media_svc_content_info_s *content_info, bool stack_query, uid_t uid);
+int _media_svc_insert_item_with_data(bool is_direct, const char *storage_id, media_svc_content_info_s *content_info, bool stack_query, uid_t uid);
 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);
index c92e1b2..6884d39 100755 (executable)
 extern "C" {
 #endif
 
-#ifndef FALSE
-#define FALSE  0
-#endif
-#ifndef TRUE
-#define TRUE   1
-#endif
-
 #define SAFE_FREE(src) { if (src) {free(src); src = NULL; } }
 #define G_SAFE_FREE(src)       { if (src) {g_free(src); src = NULL; } }
 #define STRING_VALID(str)      \
-       ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
+       ((str != NULL && strlen(str) > 0) ? true : false)
 
 #define SAFE_STRLCAT(dst, src, n)      g_strlcat(dst, src, n);
 #define SAFE_STRLCPY(dst, src, n)      g_strlcpy(dst, src, n);
@@ -148,7 +141,7 @@ int _media_svc_get_pinyin_str(const char *src_str, char **pinyin_str);
 bool _media_svc_check_pinyin_support(void);
 int _media_svc_extract_music_metadata_for_update(media_svc_content_info_s *content_info, media_svc_media_type_e media_type);
 int _media_svc_get_media_type(const char *path, int *mediatype);
-bool _media_svc_check_storage_type(ms_user_storage_type_e storage_type);
+bool _media_svc_is_valid_storage_type(ms_user_storage_type_e storage_type);
 
 #ifdef __cplusplus
 }