From c4791a24e66f7810ea9b7815017d69ec5a6bb200 Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Tue, 31 May 2022 14:20:07 +0900 Subject: [PATCH] Remove unused internal API This APIs were deprecated in 4.0 and removed in 5.5. It has been maintained because of the webapi-plugin. Change-Id: Ia2f75c0e647c8f1aa266982837482bc29f0c9db3 Signed-off-by: Minje Ahn --- include/media_content_internal.h | 14 ----- include/media_info_private.h | 4 +- include_product/media_content_internal.h | 14 ----- include_product/media_info_private.h | 4 +- src/media_image.c | 38 ------------ src/media_info.c | 102 ++++--------------------------- 6 files changed, 14 insertions(+), 162 deletions(-) diff --git a/include/media_content_internal.h b/include/media_content_internal.h index 011ae19..85068e0 100755 --- a/include/media_content_internal.h +++ b/include/media_content_internal.h @@ -58,20 +58,6 @@ int media_filter_get_order_v2(filter_h filter, char **order); /* Only for system session process */ int media_content_connect_with_uid(uid_t uid); -/* For web API */ - -int image_meta_set_orientation(image_meta_h image, media_content_orientation_e orientation) TIZEN_DEPRECATED_API; - -int image_meta_update_to_db(image_meta_h image) TIZEN_DEPRECATED_API; - -int media_info_set_description(media_info_h media, const char *description) TIZEN_DEPRECATED_API; - -int media_info_set_longitude(media_info_h media, double longitude) TIZEN_DEPRECATED_API; - -int media_info_set_latitude(media_info_h media, double latitude) TIZEN_DEPRECATED_API; - -int media_info_set_rating(media_info_h media, int rating) TIZEN_DEPRECATED_API; - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include/media_info_private.h b/include/media_info_private.h index eedab3c..a8efb4e 100644 --- a/include/media_info_private.h +++ b/include/media_info_private.h @@ -71,6 +71,7 @@ extern "C" { #define DEFAULT_QUERY_SIZE 1024 #define MEDIA_CONTENT_UUID_SIZE 36 #define BATCH_REQUEST_MAX 300 +#define BATCH_REQUEST_FILE_LEN 255 typedef enum { MEDIA_INFO_UUID = 0, @@ -472,9 +473,6 @@ typedef struct _media_content_cb_data { #define UPDATE_BOOKMARK_FROM_BOOKMARK "UPDATE "DB_TABLE_BOOKMARK" SET bookmark_name=%Q WHERE bookmark_id=%d;" -/* Update Meta*/ -#define UPDATE_IMAGE_META_FROM_MEDIA "UPDATE "DB_TABLE_MEDIA" SET media_orientation=%d WHERE media_id='%q'" - #define SELECT_MEDIA_ITEM "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity IN (1, 2) " #define SELECT_MEDIA_ITEM_BY_STORAGE_ID SELECT_MEDIA_ITEM"AND storage_uuid='%s' " #define SELECT_MEDIA_FROM_MEDIA "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity IN (1, 2) AND media_id='%s'" diff --git a/include_product/media_content_internal.h b/include_product/media_content_internal.h index 011ae19..85068e0 100755 --- a/include_product/media_content_internal.h +++ b/include_product/media_content_internal.h @@ -58,20 +58,6 @@ int media_filter_get_order_v2(filter_h filter, char **order); /* Only for system session process */ int media_content_connect_with_uid(uid_t uid); -/* For web API */ - -int image_meta_set_orientation(image_meta_h image, media_content_orientation_e orientation) TIZEN_DEPRECATED_API; - -int image_meta_update_to_db(image_meta_h image) TIZEN_DEPRECATED_API; - -int media_info_set_description(media_info_h media, const char *description) TIZEN_DEPRECATED_API; - -int media_info_set_longitude(media_info_h media, double longitude) TIZEN_DEPRECATED_API; - -int media_info_set_latitude(media_info_h media, double latitude) TIZEN_DEPRECATED_API; - -int media_info_set_rating(media_info_h media, int rating) TIZEN_DEPRECATED_API; - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include_product/media_info_private.h b/include_product/media_info_private.h index 290e334..b1a8485 100644 --- a/include_product/media_info_private.h +++ b/include_product/media_info_private.h @@ -74,6 +74,7 @@ extern "C" { #define DEFAULT_QUERY_SIZE 1024 #define MEDIA_CONTENT_UUID_SIZE 36 #define BATCH_REQUEST_MAX 300 +#define BATCH_REQUEST_FILE_LEN 255 typedef enum { MEDIA_INFO_UUID = 0, @@ -612,9 +613,6 @@ typedef struct _media_content_scan_cb_data_v2 { #define UPDATE_BOOKMARK_FROM_BOOKMARK "UPDATE "DB_TABLE_BOOKMARK" SET bookmark_name=%Q WHERE bookmark_id=%d;" -/* Update Meta*/ -#define UPDATE_IMAGE_META_FROM_MEDIA "UPDATE '%s' SET media_orientation=%d WHERE media_id='%q'" - #define SELECT_MEDIA_ITEM "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1" #define SELECT_MEDIA_FROM_MEDIA "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND media_id='%s'" #define SELECT_MEDIA_BY_PATH "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND media_path='%q'" diff --git a/src/media_image.c b/src/media_image.c index b114c12..44cc210 100755 --- a/src/media_image.c +++ b/src/media_image.c @@ -162,41 +162,3 @@ int image_meta_get_model(image_meta_h image, char **model) return MEDIA_CONTENT_ERROR_NONE; } - -int image_meta_set_orientation(image_meta_h image, media_content_orientation_e orientation) -{ - content_warn("DEPRECATION WARNING: image_meta_set_orientation() is deprecated and will be removed from next release."); - image_meta_s *_image = (image_meta_s*)image; - - content_retip_if_fail(image); - content_retvm_if(orientation < MEDIA_CONTENT_ORIENTATION_NOT_AVAILABLE || orientation > MEDIA_CONTENT_ORIENTATION_ROT_270, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid orientation"); - - _image->orientation = orientation; - - return MEDIA_CONTENT_ERROR_NONE; -} - -int image_meta_update_to_db(image_meta_h image) -{ - int ret = MEDIA_CONTENT_ERROR_NONE; - content_warn("DEPRECATION WARNING: image_meta_update_to_db() is deprecated and will be removed from next release."); - image_meta_s *_image = (image_meta_s*)image; - char *sql = NULL; - - content_retip_if_fail(image); - content_retip_if_fail(STRING_VALID(_image->media_id)); - -#ifdef _USE_TVPD_MODE - char *storage_id = NULL; - ret = _media_db_get_storage_id_by_media_id(_image->media_id, &storage_id); - content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret); - sql = sqlite3_mprintf(UPDATE_IMAGE_META_FROM_MEDIA, storage_id, _image->orientation, _image->media_id); - g_free(storage_id); -#else - sql = sqlite3_mprintf(UPDATE_IMAGE_META_FROM_MEDIA, _image->orientation, _image->media_id); -#endif - ret = _content_query_sql(sql); - SQLITE3_SAFE_FREE(sql); - - return ret; -} diff --git a/src/media_info.c b/src/media_info.c index 69c80d6..1d4b48f 100644 --- a/src/media_info.c +++ b/src/media_info.c @@ -149,15 +149,15 @@ static int __media_info_insert_batch(const char **path_array, { int ret = MEDIA_CONTENT_ERROR_NONE; FILE *fp = NULL; - char list_path[255] = {0, }; + char list_path[BATCH_REQUEST_FILE_LEN] = {0, }; unsigned int idx = 0; int nwrites = 0; for (idx = 0; idx < BATCH_REQUEST_MAX; idx++) { - snprintf(list_path, sizeof(list_path), "%s/request-%ld-%d", MEDIA_CONTENT_INSERT_FILES_PATH, media_content_gettid(), idx); + snprintf(list_path, BATCH_REQUEST_FILE_LEN, "%s/request-%ld-%d", MEDIA_CONTENT_INSERT_FILES_PATH, media_content_gettid(), idx); - if (g_file_test(list_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) { - memset(list_path, 0x00, sizeof(list_path)); + if (g_file_test(list_path, G_FILE_TEST_EXISTS)) { + memset(list_path, 0x00, BATCH_REQUEST_FILE_LEN); continue; } else { content_sec_debug("The request file list path : %s", list_path); @@ -1299,10 +1299,10 @@ int media_info_get_media_from_db(const char *media_id, media_info_h *media) ret = _media_db_get_storage_id_by_media_id(media_id, &storage_id); content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret); - snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_MEDIA, storage_id, media_id); + snprintf(select_query, DEFAULT_QUERY_SIZE, SELECT_MEDIA_FROM_MEDIA, storage_id, media_id); g_free(storage_id); #else - snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_MEDIA, media_id); + snprintf(select_query, DEFAULT_QUERY_SIZE, SELECT_MEDIA_FROM_MEDIA, media_id); #endif ret = _content_get_result(select_query, &stmt); content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret); @@ -1379,48 +1379,19 @@ int media_info_update_to_db(media_info_h media) { int ret = MEDIA_CONTENT_ERROR_NONE; media_info_s *_media = (media_info_s*)media; - char *set_sql = NULL; char *sql = NULL; content_retip_if_fail(media); content_retip_if_fail(STRING_VALID(_media->media_id)); - /* This sql is due to sqlite3_mprintf's wrong operation when using floating point in the text format */ - /* This code will be removed when sqlite3_mprintf works clearly */ - char *test_sql = sqlite3_mprintf("%f, %f, %f", _media->longitude, _media->latitude, _media->altitude); - SQLITE3_SAFE_FREE(test_sql); - - /*Update Pinyin If Support Pinyin*/ - char *file_name_pinyin = NULL; - char *description_pinyin = NULL; - bool pinyin_support = FALSE; - - /*Update Pinyin If Support Pinyin*/ - media_svc_check_pinyin_support(&pinyin_support); - if (pinyin_support) { - if (STRING_VALID(_media->display_name)) - media_svc_get_pinyin(_media->display_name, &file_name_pinyin); - if (STRING_VALID(_media->description)) - media_svc_get_pinyin(_media->description, &description_pinyin); - } -#ifdef _USE_TVPD_MODE - set_sql = sqlite3_mprintf("media_display_name=%Q, media_description=%Q, media_longitude=%f, media_latitude=%f, media_file_name_pinyin=%Q, media_description_pinyin=%Q, played_count=%d, last_played_time=%d, last_played_position=%d, media_rating=%d, media_favourite=%d", - _media->display_name, _media->description, _media->longitude, _media->latitude, file_name_pinyin, description_pinyin, _media->played_count, _media->played_time, _media->played_position, _media->rating, _media->favourite); -#else - set_sql = sqlite3_mprintf("media_display_name=%Q, media_description=%Q, media_longitude=%f, media_latitude=%f, media_file_name_pinyin=%Q, media_description_pinyin=%Q, media_rating=%d, media_favourite=%d", _media->display_name, _media->description, _media->longitude, _media->latitude, file_name_pinyin, description_pinyin, _media->rating, _media->favourite); -#endif #ifdef _USE_TVPD_MODE - sql = sqlite3_mprintf("UPDATE %Q SET %s WHERE media_id=%Q", _media->storage_uuid, set_sql, _media->media_id); + sql = sqlite3_mprintf("UPDATE %Q SET played_count=%d, last_played_time=%d, last_played_position=%d, media_favourite=%d WHERE media_id=%Q", _media->storage_uuid, _media->played_count, _media->played_time, _media->played_position, _media->favourite, _media->media_id); #else - sql = sqlite3_mprintf("UPDATE %q SET %s WHERE media_id=%Q", DB_TABLE_MEDIA, set_sql, _media->media_id); + sql = sqlite3_mprintf("UPDATE %q SET media_favourite=%d WHERE media_id=%Q", DB_TABLE_MEDIA, _media->favourite, _media->media_id); #endif ret = _content_query_sql(sql); - SQLITE3_SAFE_FREE(set_sql); SQLITE3_SAFE_FREE(sql); - SAFE_FREE(file_name_pinyin); - SAFE_FREE(description_pinyin); - if (ret == MEDIA_CONTENT_ERROR_NONE) { /* Send notification for this update */ content_debug("Update is successful. Send notification for this"); @@ -1448,13 +1419,13 @@ int media_info_move_to_db(media_info_h media, const char* dst_path) media_info_s *_media = (media_info_s*)media; /* If dst_path is folder, append file_name */ - SAFE_STRLCPY(repl_path, dst_path, sizeof(repl_path)); + SAFE_STRLCPY(repl_path, dst_path, MAX_PATH_LEN); if (g_file_test(repl_path, G_FILE_TEST_IS_DIR)) { if (repl_path[strlen(repl_path) - 1] != '/') - SAFE_STRLCAT(repl_path, "/", sizeof(repl_path)); + SAFE_STRLCAT(repl_path, "/", MAX_PATH_LEN); - SAFE_STRLCAT(repl_path, _media->display_name, sizeof(repl_path)); + SAFE_STRLCAT(repl_path, _media->display_name, MAX_PATH_LEN); } /* If the two paths are the same, do nothing */ @@ -1614,53 +1585,4 @@ int media_info_cancel_face_detection(media_info_h media) ret = dcm_request_cancel_face(_media->face_request_id); return _content_error_capi(ret); -} - -int media_info_set_description(media_info_h media, const char *description) -{ - content_warn("DEPRECATION WARNING: media_info_set_description() is deprecated and will be removed from next release."); - media_info_s *_media = (media_info_s*)media; - - content_retip_if_fail(media); - - g_free(_media->description); - _media->description = g_strdup(description); - - return MEDIA_CONTENT_ERROR_NONE; -} - -int media_info_set_longitude(media_info_h media, double longitude) -{ - content_warn("DEPRECATION WARNING: media_info_set_longitude() is deprecated and will be removed from next release."); - media_info_s *_media = (media_info_s*)media; - - content_retip_if_fail(media); - - _media->longitude = longitude; - - return MEDIA_CONTENT_ERROR_NONE; -} - -int media_info_set_latitude(media_info_h media, double latitude) -{ - content_warn("DEPRECATION WARNING: media_info_set_latitude() is deprecated and will be removed from next release."); - media_info_s *_media = (media_info_s*)media; - - content_retip_if_fail(media); - - _media->latitude = latitude; - - return MEDIA_CONTENT_ERROR_NONE; -} - -int media_info_set_rating(media_info_h media, int rating) -{ - content_warn("DEPRECATION WARNING: media_info_set_rating() is deprecated and will be removed from next release."); - media_info_s *_media = (media_info_s*)media; - - content_retip_if_fail(media); - - _media->rating = rating; - - return MEDIA_CONTENT_ERROR_NONE; -} +} \ No newline at end of file -- 2.7.4