From: Minje Ahn Date: Tue, 11 Jun 2024 02:11:19 +0000 (+0900) Subject: Remove meaningless code X-Git-Tag: accepted/tizen/unified/20240612.100030~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F08%2F312508%2F1;p=platform%2Fcore%2Fapi%2Fmedia-controller.git Remove meaningless code This code is meaningless for the following reasons: 1. If there is no db file, media_db_connect() creates one. 2. 'pragma integrity_check' is a command for checking consistency of db. Therefore, it is independent of file size. Change-Id: If906853134116965691bc3998cd8f2262cb5f219 Signed-off-by: Minje Ahn --- diff --git a/svc/media_controller_svc.c b/svc/media_controller_svc.c index 73ed942..b618390 100644 --- a/svc/media_controller_svc.c +++ b/svc/media_controller_svc.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include "media_controller_svc.h" @@ -181,33 +180,6 @@ static int __mc_service_check_db(uid_t uid) { int res = MEDIA_CONTROLLER_ERROR_NONE; sqlite3 *db_handle = NULL; - char *db_path = NULL; - struct stat buf; - - db_path = mc_db_get_db_path(uid); - mc_retvm_if(db_path == NULL, res, "Failed to get the db_path"); - - /* Check the database exists */ - if (!g_file_test(db_path, G_FILE_TEST_EXISTS)) { - mc_error("[NO-ERROR] DB is not created yet, do not need to check DB"); - g_free(db_path); - return MEDIA_CONTROLLER_ERROR_NONE; - } - - /* Check the size of database */ - if (stat(db_path, &buf) == 0) { - if (buf.st_size == 0) { - mc_warning("The size of database is 0, it's ok"); - g_free(db_path); - return MEDIA_CONTROLLER_ERROR_NONE; - } - } else { - mc_stderror("stat failed"); - g_free(db_path); - return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; - } - - g_free(db_path); /* Connect media controller DB*/ res = mc_db_connect(&db_handle, uid, TRUE);