summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorminje.ahn <minje.ahn@samsung.com>2024-02-28 11:47:13 +0900
committerminje.ahn <minje.ahn@samsung.com>2024-02-28 11:47:13 +0900
commit9f74c2e79c2cbad5e115e5d46613372f838d637c (patch)
tree971136d94507dd4adec7b8d9cd1fdc1dd263b04c
parent06debd38c0ef0e94add3a28712318b7027e5caae (diff)
downloadlibmedia-service-9f74c2e79c2cbad5e115e5d46613372f838d637c.tar.gz
libmedia-service-9f74c2e79c2cbad5e115e5d46613372f838d637c.tar.bz2
libmedia-service-9f74c2e79c2cbad5e115e5d46613372f838d637c.zip
1. Used MS_STRING_VALID instead of STRING_VALID. 2. Updated indent 3. Remove unused defines Change-Id: Ib911243059fe04b5bba8b9dcae1d74e017fe3c85 Signed-off-by: minje.ahn <minje.ahn@samsung.com>
-rwxr-xr-xsrc/common/media-svc-db-utils.c18
-rwxr-xr-xsrc/common/media-svc-media-folder.c2
-rwxr-xr-xsrc/common/media-svc-media.c12
-rwxr-xr-xsrc/common/media-svc-noti.c4
-rwxr-xr-xsrc/common/media-svc-storage.c6
-rw-r--r--src/common/media-svc-util.c36
-rwxr-xr-xsrc/common/media-svc.c28
-rwxr-xr-xsrc/include/common/media-svc-util.h30
8 files changed, 65 insertions, 71 deletions
diff --git a/src/common/media-svc-db-utils.c b/src/common/media-svc-db-utils.c
index 9fc87db..ba528ab 100755
--- a/src/common/media-svc-db-utils.c
+++ b/src/common/media-svc-db-utils.c
@@ -55,23 +55,23 @@ static void __add_table_info(const char *name,
{
table_info_s *tbl = NULL;
- if (!STRING_VALID(name))
+ if (!MS_STRING_VALID(name))
return;
- if (STRING_VALID(trigger_name)) {
- if(!STRING_VALID(event_table) || !STRING_VALID(action_table))
+ if (MS_STRING_VALID(trigger_name)) {
+ if(!MS_STRING_VALID(event_table) || !MS_STRING_VALID(action_table))
return;
}
tbl = g_new0(table_info_s, 1);
- if (STRING_VALID(trigger_name)) {
+ if (MS_STRING_VALID(trigger_name)) {
tbl->trigger_name = g_strdup(trigger_name);
tbl->event_table = g_strdup(event_table);
tbl->action_table = g_strdup(action_table);
}
- if (STRING_VALID(view_name))
+ if (MS_STRING_VALID(view_name))
tbl->view_name = g_strdup(view_name);
g_hash_table_insert(table, (gpointer)name, (gpointer)tbl);
@@ -264,7 +264,7 @@ int _media_svc_make_table_query(const char *table_name, media_svc_table_slist_e
/*create trigger */
if (col_ptr->is_trigger) {
- if (STRING_VALID(tb->trigger_name)) {
+ if (MS_STRING_VALID(tb->trigger_name)) {
if (strncmp(table_name, DB_TABLE_ALBUM, strlen(DB_TABLE_ALBUM)) == 0) {
g_string_append_printf(trigger_query, DB_QUERY_TRIGGER_WITH_COUNT,
tb->trigger_name, tb->event_table, tb->action_table, tb->event_table,
@@ -599,7 +599,7 @@ int _media_svc_sql_prepare_to_step_simple(sqlite3 *handle, const char *sql_str,
media_svc_sec_debug("Query[%s]", sql_str);
- if (!STRING_VALID(sql_str)) {
+ if (!MS_STRING_VALID(sql_str)) {
media_svc_error("invalid query");
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
@@ -634,7 +634,7 @@ int _media_svc_sql_query_list(GList **query_list, uid_t uid)
for (idx = 0; idx < length; idx++) {
sql = (char *)g_list_nth_data(*query_list, idx);
- if (STRING_VALID(sql)) {
+ if (MS_STRING_VALID(sql)) {
query_len = strlen(sql);
if (query_len >= (sizeof(query_bundle) - 1)) {
@@ -705,7 +705,7 @@ int _media_svc_sql_query_list_direct(GList **query_list, uid_t uid)
for (idx = 0; idx < length; idx++) {
sql = (char *)g_list_nth_data(*query_list, idx);
- if (STRING_VALID(sql)) {
+ if (MS_STRING_VALID(sql)) {
ret = __media_svc_query_direct(handle, sql, uid);
if (ret != MS_MEDIA_ERR_NONE)
media_svc_debug("_media_svc_query_direct failed[%s]", sql);
diff --git a/src/common/media-svc-media-folder.c b/src/common/media-svc-media-folder.c
index fe934f2..0ec8f51 100755
--- a/src/common/media-svc-media-folder.c
+++ b/src/common/media-svc-media-folder.c
@@ -190,7 +190,7 @@ int _media_svc_check_folder_by_path(sqlite3 *handle, const char *path)
sqlite3_stmt *sql_stmt = NULL;
char *sql = NULL;
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
sql = sqlite3_mprintf("SELECT 1 FROM %q WHERE folder_path=%Q", DB_TABLE_FOLDER, path);
ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
diff --git a/src/common/media-svc-media.c b/src/common/media-svc-media.c
index 8fac748..2c64f20 100755
--- a/src/common/media-svc-media.c
+++ b/src/common/media-svc-media.c
@@ -39,7 +39,7 @@ int _media_svc_check_data_by_path(sqlite3 *handle, const char *path)
sqlite3_stmt *sql_stmt = NULL;
char *sql = NULL;
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "Path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "Path is NULL");
sql = sqlite3_mprintf("SELECT 1 FROM %q WHERE media_path=%Q", DB_TABLE_MEDIA, path);
ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
@@ -55,7 +55,7 @@ int _media_svc_get_modified_time(sqlite3 *handle, const char *path, int *modifie
sqlite3_stmt *sql_stmt = NULL;
char *sql = NULL;
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "Path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "Path is NULL");
sql = sqlite3_mprintf("SELECT media_modified_time FROM %q WHERE media_path=%Q", DB_TABLE_MEDIA, path);
ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
@@ -184,7 +184,7 @@ int _media_svc_get_thumbnail_path_by_path(sqlite3 *handle, const char *path, cha
sqlite3_stmt *sql_stmt = NULL;
char *sql = NULL;
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
sql = sqlite3_mprintf("SELECT media_thumbnail_path FROM %q WHERE media_path='%q'", DB_TABLE_MEDIA, path);
@@ -211,7 +211,7 @@ int _media_svc_delete_item_by_path(const char *path, uid_t uid)
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
sql = sqlite3_mprintf("DELETE FROM %q WHERE media_path=%Q;", DB_TABLE_MEDIA, path);
@@ -227,7 +227,7 @@ int _media_svc_update_item_validity(const char *path, int validity, bool stack_q
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
media_svc_debug("path=[%s], validity=[%d]", path, validity);
@@ -333,7 +333,7 @@ int _media_svc_get_noti_info(sqlite3 *handle, const char *path, media_svc_noti_i
char *sql = NULL;
media_svc_retvm_if(item == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "item is NULL");
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
sql = sqlite3_mprintf("SELECT media_id, media_type, media_mime_type FROM %q WHERE media_path=%Q", DB_TABLE_MEDIA, path);
ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
diff --git a/src/common/media-svc-noti.c b/src/common/media-svc-noti.c
index 69f0916..a13f61d 100755
--- a/src/common/media-svc-noti.c
+++ b/src/common/media-svc-noti.c
@@ -55,7 +55,7 @@ static void __media_svc_destroy_noti_item(gpointer data)
int _media_svc_publish_noti(media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type)
{
int ret = MS_MEDIA_ERR_NONE;
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid path");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid path");
ret = media_db_update_send(getpid(), MS_MEDIA_ITEM_FILE, update_type, path, uuid, media_type, mime_type);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Send noti failed[%d][%s]", ret, path);
@@ -68,7 +68,7 @@ int _media_svc_publish_noti(media_item_update_type_e update_type, const char *pa
int _media_svc_publish_dir_noti(media_item_update_type_e update_type, const char *path, const char *uuid, int pid)
{
int ret = MS_MEDIA_ERR_NONE;
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid path");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid path");
ret = media_db_update_send(pid, MS_MEDIA_ITEM_DIRECTORY, update_type, path, uuid, MS_MEDIA_UNKNOWN, NULL);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Send dir noti failed[%d][%s]", ret, path);
diff --git a/src/common/media-svc-storage.c b/src/common/media-svc-storage.c
index d2e81c4..6ef0b53 100755
--- a/src/common/media-svc-storage.c
+++ b/src/common/media-svc-storage.c
@@ -168,7 +168,7 @@ int _media_svc_get_storage_uuid(sqlite3 *handle, const char *path, char *storage
ret = ms_user_get_internal_root_path(uid, &internal_path);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Fail to get root path");
- if (STRING_VALID(internal_path) && strncmp(path, internal_path, strlen(internal_path)) == 0) {
+ if (MS_STRING_VALID(internal_path) && strncmp(path, internal_path, strlen(internal_path)) == 0) {
SAFE_STRLCPY(storage_id, DB_TABLE_MEDIA, MEDIA_SVC_UUID_SIZE + 1);
g_free(internal_path);
return MS_MEDIA_ERR_NONE;
@@ -181,12 +181,12 @@ int _media_svc_get_storage_uuid(sqlite3 *handle, const char *path, char *storage
ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- if (STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 0)))
+ if (MS_STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 0)))
SAFE_STRLCPY(storage_id, (const char *)sqlite3_column_text(sql_stmt, 0), MEDIA_SVC_UUID_SIZE + 1);
SQLITE3_FINALIZE(sql_stmt);
- if (!STRING_VALID(storage_id)) {
+ if (!MS_STRING_VALID(storage_id)) {
media_svc_error("Not found valid storage id [%s]", path);
ret = MS_MEDIA_ERR_INVALID_PARAMETER;
}
diff --git a/src/common/media-svc-util.c b/src/common/media-svc-util.c
index 8fbb2a8..8e28312 100644
--- a/src/common/media-svc-util.c
+++ b/src/common/media-svc-util.c
@@ -42,18 +42,15 @@
#include <libxml/HTMLparser.h>
#include <dlfcn.h>
-#define MEDIA_SVC_FILE_EXT_LEN_MAX 6 /**< Maximum file ext lenth*/
+#define MEDIA_SVC_FILE_EXT_LEN_MAX 6
#define MUSIC_MIME_NUM 29
#define SOUND_MIME_NUM 2
#define MIME_LENGTH 50
-#define MEDIA_SVC_DEFAULT_FORMAT_LEN 19
#define IMAGE_PREFIX "image/"
-#define IMAGE_PREFIX_LEN 6
#define AUDIO_PREFIX "audio/"
-#define AUDIO_PREFIX_LEN 6
#define VIDEO_PREFIX "video/"
-#define VIDEO_PREFIX_LEN 6
+#define PREFIX_LEN 6
#define MEDIA_SVC_PDF_TAG_TAIL_LEN 12
#define MEDIA_SVC_PDF_BUF_SIZE 256
@@ -100,7 +97,6 @@ static const char music_mime_table[MUSIC_MIME_NUM][MIME_LENGTH] = {
"x-ape",
"x-ms-asx",
"vnd.rn-realaudio",
-
"x-vorbis", /*alias of audio/x-vorbis+ogg*/
"vorbis", /*alias of audio/x-vorbis+ogg*/
"x-oggflac",
@@ -173,36 +169,36 @@ static int __media_svc_get_media_type(const char *path, const char *mime_type, m
media_svc_retvm_if(!media_type, MS_MEDIA_ERR_INVALID_PARAMETER, "media_type is null");
/* Image */
- if (strncmp(mime_type, IMAGE_PREFIX, IMAGE_PREFIX_LEN) == 0) {
+ if (strncmp(mime_type, IMAGE_PREFIX, PREFIX_LEN) == 0) {
*media_type = MEDIA_SVC_MEDIA_TYPE_IMAGE;
return MS_MEDIA_ERR_NONE;
}
/* Audio */
- if (strncmp(mime_type, AUDIO_PREFIX, AUDIO_PREFIX_LEN) == 0) {
+ if (strncmp(mime_type, AUDIO_PREFIX, PREFIX_LEN) == 0) {
*media_type = MEDIA_SVC_MEDIA_TYPE_SOUND;
for (idx = 0; idx < MUSIC_MIME_NUM; idx++) {
- if (strcmp(mime_type + AUDIO_PREFIX_LEN, music_mime_table[idx]) == 0) {
+ if (strcmp(mime_type + PREFIX_LEN, music_mime_table[idx]) == 0) {
*media_type = MEDIA_SVC_MEDIA_TYPE_MUSIC;
break;
}
}
/* audio/x-mpegurl : .m3u file (playlist file) */
- if (strcmp(mime_type + AUDIO_PREFIX_LEN, "x-mpegurl") == 0)
+ if (strcmp(mime_type + PREFIX_LEN, "x-mpegurl") == 0)
*media_type = MEDIA_SVC_MEDIA_TYPE_OTHER;
return MS_MEDIA_ERR_NONE;
}
/* Video */
- if (strncmp(mime_type, VIDEO_PREFIX, VIDEO_PREFIX_LEN) == 0) {
+ if (strncmp(mime_type, VIDEO_PREFIX, PREFIX_LEN) == 0) {
*media_type = MEDIA_SVC_MEDIA_TYPE_VIDEO;
/*some video files don't have video stream. in this case it is categorize as music. */
- if (strcmp(mime_type + VIDEO_PREFIX_LEN, "3gpp") == 0 ||
- strcmp(mime_type + VIDEO_PREFIX_LEN, "mp4") == 0) {
+ if (strcmp(mime_type + PREFIX_LEN, "3gpp") == 0 ||
+ strcmp(mime_type + PREFIX_LEN, "mp4") == 0) {
if (mm_file_get_stream_info(path, &audio, &video) == FILEINFO_ERROR_NONE) {
if (audio > 0 && video == 0)
*media_type = MEDIA_SVC_MEDIA_TYPE_MUSIC;
@@ -322,7 +318,7 @@ static char *__media_svc_get_title_from_filename(const char *filename)
char *title = NULL;
char *last_dot = NULL;
- media_svc_retvm_if(!STRING_VALID(filename), g_strdup(MEDIA_SVC_TAG_UNKNOWN), "Invalid path");
+ media_svc_retvm_if(!MS_STRING_VALID(filename), g_strdup(MEDIA_SVC_TAG_UNKNOWN), "Invalid path");
last_dot = strrchr(filename, '.');
if (last_dot) {
@@ -338,7 +334,7 @@ static char *__media_svc_get_title_from_filename(const char *filename)
void _media_svc_remove_file(const char *path)
{
- if (!STRING_VALID(path))
+ if (!MS_STRING_VALID(path))
return;
if (remove(path) != 0)
@@ -353,7 +349,7 @@ static int __media_svc_get_thumbnail_path(char *thumb_path, const char *pathname
g_autofree gchar *thumb_dir = NULL;
ret = ms_user_get_root_thumb_store_path(uid, &thumb_dir);
- media_svc_retvm_if(!STRING_VALID(thumb_dir), ret, "ms_user_get_root_thumb_store_path failed");
+ media_svc_retvm_if(!MS_STRING_VALID(thumb_dir), ret, "ms_user_get_root_thumb_store_path failed");
media_svc_retvm_if(!g_file_test(thumb_dir, G_FILE_TEST_IS_DIR), MS_MEDIA_ERR_INTERNAL, "Not a directory");
memset(file_ext, 0, sizeof(file_ext));
@@ -365,12 +361,12 @@ static int __media_svc_get_thumbnail_path(char *thumb_path, const char *pathname
if (img_format) {
/* 'img_format' is mime-type */
- if (!g_str_has_prefix(img_format, IMAGE_PREFIX) || strlen(img_format) == IMAGE_PREFIX_LEN) {
+ if (!g_str_has_prefix(img_format, IMAGE_PREFIX) || strlen(img_format) == PREFIX_LEN) {
media_svc_error("Not proper img format");
return MS_MEDIA_ERR_INTERNAL;
}
- snprintf(thumb_path, MEDIA_SVC_PATHNAME_SIZE, "%s/.%s-%s.%s", thumb_dir, file_ext, hash, img_format + IMAGE_PREFIX_LEN);
+ snprintf(thumb_path, MEDIA_SVC_PATHNAME_SIZE, "%s/.%s-%s.%s", thumb_dir, file_ext, hash, img_format + PREFIX_LEN);
} else {
if (strcasecmp(file_ext, "PNG") == 0)
snprintf(thumb_path, MEDIA_SVC_PATHNAME_SIZE, "%s/.%s-%s.png", thumb_dir, file_ext, hash);
@@ -399,7 +395,7 @@ int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char
char mime_type[256] = {0, };
media_svc_media_type_e media_type;
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
content_info->path = g_strdup(path);
media_svc_retv_del_if(content_info->path == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
@@ -487,7 +483,7 @@ int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info)
media_svc_retvm_if(!content_info, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid content_info");
media_svc_retvm_if(content_info->media_type != MEDIA_SVC_MEDIA_TYPE_IMAGE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid media_type [%d]", content_info->media_type);
- media_svc_retvm_if(!STRING_VALID(content_info->path), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid path");
+ media_svc_retvm_if(!MS_STRING_VALID(content_info->path), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid path");
path = content_info->path;
content_info->media_meta.title = __media_svc_get_title_from_filename(content_info->file_name);
diff --git a/src/common/media-svc.c b/src/common/media-svc.c
index a78f53f..e13331f 100755
--- a/src/common/media-svc.c
+++ b/src/common/media-svc.c
@@ -190,8 +190,8 @@ int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, const ch
long long int folder_id = 0;
media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
media_svc_content_info_s content_info;
memset(&content_info, 0, sizeof(media_svc_content_info_s));
@@ -263,8 +263,8 @@ int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, c
long long int folder_id = 0;
media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
media_svc_content_info_s content_info;
memset(&content_info, 0, sizeof(media_svc_content_info_s));
@@ -351,10 +351,10 @@ int media_svc_move_item(sqlite3 *handle,
media_svc_debug_fenter();
media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- media_svc_retvm_if(!STRING_VALID(src_path), MS_MEDIA_ERR_INVALID_PARAMETER, "src_path is NULL");
- media_svc_retvm_if(!STRING_VALID(dest_path), MS_MEDIA_ERR_INVALID_PARAMETER, "dest_path is NULL");
- media_svc_retvm_if(!STRING_VALID(media_id), MS_MEDIA_ERR_INVALID_PARAMETER, "media_id is NULL");
- media_svc_retvm_if(!STRING_VALID(mime_type), MS_MEDIA_ERR_INVALID_PARAMETER, "mime_type is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(src_path), MS_MEDIA_ERR_INVALID_PARAMETER, "src_path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(dest_path), MS_MEDIA_ERR_INVALID_PARAMETER, "dest_path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(media_id), MS_MEDIA_ERR_INVALID_PARAMETER, "media_id is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(mime_type), MS_MEDIA_ERR_INVALID_PARAMETER, "mime_type is NULL");
/* Get storage_id */
ret = _media_svc_get_storage_uuid(handle, dest_path, dst_stg_id, uid);
@@ -459,8 +459,8 @@ int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_
media_svc_noti_item *noti_item = NULL;
media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
/*Set media info*/
ret = _media_svc_set_media_info(&content_info, storage_id, path, true);
@@ -471,7 +471,7 @@ int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_
if (ret != MS_MEDIA_ERR_NONE && ret != MS_MEDIA_ERR_DB_NO_RECORD)
goto REFRESH_FINALIZE;
- if (STRING_VALID(thumb_path)) {
+ if (MS_STRING_VALID(thumb_path)) {
_media_svc_remove_file(thumb_path);
ret = _media_svc_update_thumbnail_path(path, NULL, uid);
@@ -556,7 +556,7 @@ REFRESH_FINALIZE:
int media_svc_send_dir_update_noti(const char *dir_path, const char *folder_id, media_item_update_type_e update_type, int pid)
{
- media_svc_retvm_if(!STRING_VALID(dir_path), MS_MEDIA_ERR_INVALID_PARAMETER, "dir_path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(dir_path), MS_MEDIA_ERR_INVALID_PARAMETER, "dir_path is NULL");
return _media_svc_publish_dir_noti(update_type, dir_path, folder_id, pid);
}
@@ -607,8 +607,8 @@ int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char
int media_svc_insert_folder(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
{
media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
- media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
+ media_svc_retvm_if(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
return _media_svc_append_by_folder_path(handle, storage_id, path, uid);
}
diff --git a/src/include/common/media-svc-util.h b/src/include/common/media-svc-util.h
index 4936e2a..cbfbaf9 100755
--- a/src/include/common/media-svc-util.h
+++ b/src/include/common/media-svc-util.h
@@ -32,8 +32,6 @@
extern "C" {
#endif
-#define STRING_VALID(str) (str != NULL && strlen(str) > 0)
-
/**
* Media meta data information
*/
@@ -57,20 +55,20 @@ typedef struct {
* Media data information
*/
typedef struct {
- char *media_uuid; /**< Unique ID of item */
- char *path; /**< Full path of media file */
- char *file_name; /**< File name of media file. Display name */
- int media_type; /**< Type of media file : internal/external */
- char *mime_type; /**< Full path and file name of media file */
- unsigned long long size; /**< size */
- time_t added_time; /**< added time, time_t */
- time_t modified_time; /**< modified time, time_t */
- time_t timeline; /**< timeline of media, time_t */
- long long int folder_id; /**< Unique ID of folder */
- int album_id; /**< Unique ID of album */
- char *thumbnail_path; /**< Thumbnail image file path */
- char *storage_uuid; /**< Unique ID of storage */
- media_svc_content_meta_s media_meta; /**< meta data structure for audio files */
+ char *media_uuid; /**< Unique ID of item */
+ char *path; /**< Full path of media file */
+ char *file_name; /**< File name of media file. Display name */
+ int media_type; /**< Type of media file : internal/external */
+ char *mime_type; /**< Full path and file name of media file */
+ unsigned long long size; /**< size */
+ time_t added_time; /**< added time, time_t */
+ time_t modified_time; /**< modified time, time_t */
+ time_t timeline; /**< timeline of media, time_t */
+ long long int folder_id; /**< Unique ID of folder */
+ int album_id; /**< Unique ID of album */
+ char *thumbnail_path; /**< Thumbnail image file path */
+ char *storage_uuid; /**< Unique ID of storage */
+ media_svc_content_meta_s media_meta; /**< meta data structure */
} media_svc_content_info_s;
/**