From 4ef4361416564595e5e7c4376b5d8c0312cf9655 Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Tue, 19 Mar 2024 09:42:03 +0900 Subject: [PATCH] Modify folder_id type Now the folder_id on TV is the same type as public. Change-Id: I4b27942e2cfb493eb9f688de7ca6681c3580d8d6 Signed-off-by: Minje Ahn --- src/common/media-common-db-svc.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/common/media-common-db-svc.c b/src/common/media-common-db-svc.c index d9470c2..134ba88 100644 --- a/src/common/media-common-db-svc.c +++ b/src/common/media-common-db-svc.c @@ -197,7 +197,7 @@ static int __ms_check_item_exist(sqlite3 *handle, const char *storage_id, const time_t modified_time = 0; unsigned long long file_size = 0; - struct stat st; + struct stat st = { 0, }; sqlite3_stmt *sql_stmt = NULL; char *sql = NULL; @@ -224,23 +224,19 @@ static int __ms_check_item_exist(sqlite3 *handle, const char *storage_id, const modified_time = (int)sqlite3_column_int(sql_stmt, 0); file_size = (unsigned long long)sqlite3_column_int64(sql_stmt, 1); #ifdef _USE_TVPD_MODE - int media_type = (int)sqlite3_column_int(sql_stmt, 2); - if (media_type == MS_MEDIA_TYPE_PVR) + if (sqlite3_column_int(sql_stmt, 2) == MS_MEDIA_TYPE_PVR) modified_time = (int)sqlite3_column_int(sql_stmt, 3); #endif - memset(&st, 0, sizeof(struct stat)); if (stat(path, &st) == 0) { if ((st.st_mtime != modified_time) || (st.st_size != file_size)) { *modified = true; } else { *modified = false; #ifdef _USE_TVPD_MODE - char *folder_id_media = NULL; + char *folder_id_media = g_strdup_printf("%lld", sqlite3_column_int64(sql_stmt, 4)); char *folder_id_folder = NULL; - folder_id_media = (char *)sqlite3_column_text(sql_stmt, 4); - char *folder_path = NULL; - folder_path = g_path_get_dirname(path); + char *folder_path = g_path_get_dirname(path); ret = ms_get_folder_id(handle, storage_id, folder_path, &folder_id_folder); g_free(folder_path); if(ret == MS_MEDIA_ERR_NONE) { @@ -251,6 +247,7 @@ static int __ms_check_item_exist(sqlite3 *handle, const char *storage_id, const } else *modified = true; + g_free(folder_id_media); g_free(folder_id_folder); #endif } @@ -569,11 +566,7 @@ int ms_get_folder_id(sqlite3 *handle, const char *storage_id, const char *path, MS_DBG_RETV_IF(ret != MS_MEDIA_ERR_NONE, ret); if (sqlite3_step(sql_stmt) == SQLITE_ROW) { -#ifdef _USE_TVPD_MODE - *folder_id = g_strdup((const char *)sqlite3_column_text(sql_stmt, 0)); -#else *folder_id = g_strdup_printf("%lld", sqlite3_column_int64(sql_stmt, 0)); -#endif MS_DBG("folder_id [%s]", *folder_id); } else { *folder_id = NULL; -- 2.7.4