Remove unnecessary return value 17/224317/1
authorMinje Ahn <minje.ahn@samsung.com>
Thu, 30 Jan 2020 08:16:25 +0000 (17:16 +0900)
committerMinje ahn <minje.ahn@samsung.com>
Sun, 9 Feb 2020 23:25:14 +0000 (23:25 +0000)
Change-Id: I2d769f6a5d5c74c7bc17ab095ba23de0b098e226
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
(cherry picked from commit 41ab802771b8366b3e43a670557de761c7dea409)

src/common/media-svc-util.c
src/common/media-svc.c
src/include/common/media-svc-util.h

index 1035042..4fc4d83 100644 (file)
@@ -663,20 +663,13 @@ static char *__media_svc_get_title_from_filepath(const char *path)
        return title;
 }
 
-int _media_svc_remove_file(const char *path)
+void _media_svc_remove_file(const char *path)
 {
-       int result = -1;
-
-       media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
+       if (!STRING_VALID(path))
+               return;
 
-       result = remove(path);
-       if (result == 0) {
-               media_svc_debug("success to remove file");
-               return MS_MEDIA_ERR_NONE;
-       } else {
+       if (remove(path) != 0)
                media_svc_stderror("fail to remove file result");
-               return MS_MEDIA_ERR_INTERNAL;
-       }
 }
 
 int _media_svc_get_thumbnail_path(media_svc_media_type_e media_type, char *thumb_path, const char *pathname, const char *img_format, uid_t uid)
@@ -1293,7 +1286,7 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc
                                (content_info->media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO && strcmp(mime_type, "video/3gpp") == 0) ||
                                (content_info->media_type == MEDIA_SVC_MEDIA_TYPE_MUSIC && strcmp(mime_type, "video/3gpp") == 0) ||
                                (content_info->media_type == MEDIA_SVC_MEDIA_TYPE_MUSIC && strcmp(mime_type, "audio/mp4") == 0))) {
-                               /*Creation time format is 2013-01-01 00:00:00. change it to 2013:01:01 00:00:00 like exif time format*/
+                               /*Creation time format is 2013-01-01 00:00:00 +0000. change it to 2013:01:01 00:00:00 like exif time format*/
                                char *time_info = g_strdup_printf("0000:00:00 00:00:00 +0000");
                                char *p_value = p;
                                char *time_value = time_info;
@@ -1319,8 +1312,6 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc
                                content_info->timeline = __media_svc_get_timeline_from_str(content_info->media_meta.recorded_date);
                                if (content_info->timeline == 0)
                                        content_info->timeline = content_info->modified_time;
-                               else
-                                       media_svc_debug("Timeline : %ld", content_info->timeline);
 
                                /* This is same as datetaken */
                                /* Remove compensation string */
@@ -1594,8 +1585,6 @@ void _media_svc_destroy_content_info(media_svc_content_info_s *content_info)
        SAFE_FREE(content_info->media_meta.composer_pinyin);
        SAFE_FREE(content_info->media_meta.copyright_pinyin);
        SAFE_FREE(content_info->media_meta.description_pinyin);
-
-       return;
 }
 
 static void __media_svc_get_proper_thumb_size(unsigned int orig_w, unsigned int orig_h, unsigned int *thumb_w, unsigned int *thumb_h)
index 3e15520..0e2cc72 100755 (executable)
@@ -439,11 +439,7 @@ int media_svc_move_item(sqlite3 *handle,
                return ret;
        }
 
-       if (STRING_VALID(old_thumb_path)) {
-               ret = _media_svc_remove_file(old_thumb_path);
-               if (ret != MS_MEDIA_ERR_NONE)
-                       media_svc_error("_media_svc_remove_file failed : %d", ret);
-       }
+       _media_svc_remove_file(old_thumb_path);
 
        /*move item*/
        ret = _media_svc_update_item_by_path(org_stg_id, src_path, dst_stg_id, dst_stg_type, dest_path, file_name, modified_time, folder_uuid, uid);
@@ -554,11 +550,7 @@ int media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, const
        _media_svc_destroy_noti_item(noti_item);
 
        /*Delete thumbnail*/
-       if (STRING_VALID(thumb_path)) {
-               ret = _media_svc_remove_file(thumb_path);
-               if (ret != MS_MEDIA_ERR_NONE)
-                       media_svc_error("fail to remove thumbnail file.");
-       }
+       _media_svc_remove_file(thumb_path);
 
        return MS_MEDIA_ERR_NONE;
 }
@@ -589,11 +581,7 @@ int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_
        }
 
        if (STRING_VALID(thumb_path)) {
-               if (g_file_test(thumb_path, G_FILE_TEST_EXISTS)) {
-                       ret = _media_svc_remove_file(thumb_path);
-                       if (ret != MS_MEDIA_ERR_NONE)
-                               media_svc_error("_media_svc_remove_file failed : %s", thumb_path);
-               }
+               _media_svc_remove_file(thumb_path);
 
                ret = _media_svc_update_thumbnail_path(storage_id, path, NULL, uid);
                if (ret != MS_MEDIA_ERR_NONE) {
index 2b69c46..70e05be 100755 (executable)
@@ -134,7 +134,7 @@ typedef enum {
 } media_svc_media_type_e;
 
 char *_media_info_generate_uuid(void);
-int _media_svc_remove_file(const char *path);
+void _media_svc_remove_file(const char *path);
 int _media_svc_get_thumbnail_path(media_svc_media_type_e media_type, char *thumb_path, const char *pathname, const char *img_format, uid_t uid);
 int _media_svc_get_file_time(const char *full_path);
 int _media_svc_set_default_value(media_svc_content_info_s *content_info, bool refresh);