Modify folder_id type 49/308149/1
authorMinje Ahn <minje.ahn@samsung.com>
Tue, 19 Mar 2024 00:42:03 +0000 (09:42 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Tue, 19 Mar 2024 00:42:03 +0000 (09:42 +0900)
Now the folder_id on TV is the same type as public.

Change-Id: I4b27942e2cfb493eb9f688de7ca6681c3580d8d6
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/common/media-common-db-svc.c

index d9470c2..134ba88 100644 (file)
@@ -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;