#define MEDIA_CONTENT_THUMB_DEFAULT_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/thumb_default.png")
#define MEDIA_CONTENT_INSERT_FILES_PATH "/tmp"
+#define MEDIA_CONTENT_EMPTY_STRING ""
#define MAX_QUERY_SIZE 4096
#define DEFAULT_QUERY_SIZE 1024
#define UPDATE_PLAYLIST_ORDER_FROM_PLAYLIST_MAP "UPDATE "DB_TABLE_PLAYLIST_MAP" SET play_order=%d WHERE playlist_id=%d AND _id=%d;"
/* Bookmark */
-#define INSERT_BOOKMARK_TO_BOOKMARK "INSERT INTO "DB_TABLE_BOOKMARK" (media_uuid, marked_time, thumbnail_path) VALUES ('%q', '%d', %Q)"
+#define INSERT_BOOKMARK_TO_BOOKMARK "INSERT INTO "DB_TABLE_BOOKMARK" (media_uuid, marked_time, thumbnail_path, name) VALUES ('%q', '%d', %Q, %Q)"
#define SELECT_BOOKMARK_COUNT_BY_MEDIA_ID "SELECT COUNT(*) FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'"
#define SELECT_BOOKMARK_LIST_BY_MEDIA_ID "SELECT b.bookmark_id, b.media_uuid, b.marked_time, b.thumbnail_path, b.name FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'"
#define UPDATE_BOOKMARK_FROM_BOOKMARK "UPDATE "DB_TABLE_BOOKMARK" SET name=%Q WHERE bookmark_id=%d;"
char *sql = NULL;
if (STRING_VALID(media_id)) {
- sql = sqlite3_mprintf(INSERT_BOOKMARK_TO_BOOKMARK, media_id, time, thumbnail_path);
+ sql = sqlite3_mprintf(INSERT_BOOKMARK_TO_BOOKMARK, media_id, time, thumbnail_path, MEDIA_CONTENT_EMPTY_STRING);
ret = _content_query_sql(sql);
SQLITE3_SAFE_FREE(sql);
} else {
media_bookmark_s *_bookmark = (media_bookmark_s*)bookmark;
if (_bookmark) {
- if (STRING_VALID(_bookmark->name)) {
- *name = strdup(_bookmark->name);
- media_content_retvm_if(*name == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- } else {
- *name = NULL;
- }
-
- ret = MEDIA_CONTENT_ERROR_NONE;
+ *name = g_strdup(_bookmark->name);
+ media_content_retvm_if(*name == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
} else {
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
media_bookmark_s *_bookmark = (media_bookmark_s*)bookmark;
if (STRING_VALID(name)) {
- _bookmark->name = strdup(name);
+ _bookmark->name = g_strdup(name);
media_content_retvm_if(_bookmark->name == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
} else {
- _bookmark->name = NULL;
+ _bookmark->name = g_strdup(MEDIA_CONTENT_EMPTY_STRING);
}
return ret;