Rename some macros
[platform/core/api/media-content.git] / src / media_storage.c
index acb72eb..54d2930 100755 (executable)
 int media_storage_get_storage_info_from_db(const char *storage_id, media_storage_h *storage)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_content_warn("DEPRECATION WARNING: media_storage_get_storage_info_from_db() is deprecated and will be removed from next release.");
+       content_warn("DEPRECATION WARNING: media_storage_get_storage_info_from_db() is deprecated and will be removed from next release.");
        char select_query[DEFAULT_QUERY_SIZE] = {0, };
        sqlite3_stmt *stmt = NULL;
        media_storage_s *_storage = NULL;
 
        if (!STRING_VALID(storage_id) || (storage == NULL)) {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
@@ -34,13 +34,13 @@ int media_storage_get_storage_info_from_db(const char *storage_id, media_storage
        snprintf(select_query, sizeof(select_query), SELECT_STORAGE_INFO_FROM_STORAGE, storage_id);
 
        ret = _content_get_result(select_query, &stmt);
-       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+       content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
        if (sqlite3_step(stmt) == SQLITE_ROW) {
                _storage = (media_storage_s*)calloc(1, sizeof(media_storage_s));
 
                if (_storage == NULL) {
-                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                        SQLITE3_FINALIZE(stmt);
                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                }
@@ -51,7 +51,7 @@ int media_storage_get_storage_info_from_db(const char *storage_id, media_storage
 
                *storage = (media_storage_h)_storage;
        } else {
-               media_content_error("Nonexistent storage id[%s]", storage_id);
+               content_error("Nonexistent storage id[%s]", storage_id);
                ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
@@ -63,12 +63,12 @@ int media_storage_get_storage_info_from_db(const char *storage_id, media_storage
 int media_storage_get_storage_count_from_db(filter_h filter, int *storage_count)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_content_warn("DEPRECATION WARNING: media_storage_get_storage_count_from_db() is deprecated and will be removed from next release.");
+       content_warn("DEPRECATION WARNING: media_storage_get_storage_count_from_db() is deprecated and will be removed from next release.");
 
        if (storage_count) {
                ret = _media_db_get_group_count(filter, MEDIA_GROUP_STORAGE, storage_count);
        } else {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
@@ -78,7 +78,7 @@ int media_storage_get_storage_count_from_db(filter_h filter, int *storage_count)
 int media_storage_foreach_storage_from_db(filter_h filter, media_storage_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_content_warn("DEPRECATION WARNING: media_storage_foreach_storage_from_db() is deprecated and will be removed from next release.");
+       content_warn("DEPRECATION WARNING: media_storage_foreach_storage_from_db() is deprecated and will be removed from next release.");
 
        if (callback != NULL) {
 #ifdef _USE_TVPD_MODE
@@ -91,7 +91,7 @@ int media_storage_foreach_storage_from_db(filter_h filter, media_storage_cb call
        g_mutex_unlock(_content_get_db_mutex());
 #endif
        } else {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
@@ -101,12 +101,12 @@ int media_storage_foreach_storage_from_db(filter_h filter, media_storage_cb call
 int media_storage_get_media_count_from_db(const char *storage_id, filter_h filter, int *media_count)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_content_warn("DEPRECATION WARNING: media_storage_get_media_count_from_db() is deprecated and will be removed from next release.");
+       content_warn("DEPRECATION WARNING: media_storage_get_media_count_from_db() is deprecated and will be removed from next release.");
 
        if (STRING_VALID(storage_id) && media_count) {
                ret = _media_db_get_group_item_count(storage_id, filter, MEDIA_GROUP_STORAGE, media_count);
        } else {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
@@ -116,12 +116,12 @@ int media_storage_get_media_count_from_db(const char *storage_id, filter_h filte
 int media_storage_foreach_media_from_db(const char *storage_id, filter_h filter, media_info_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_content_warn("DEPRECATION WARNING: media_storage_foreach_media_from_db() is deprecated and will be removed from next release.");
+       content_warn("DEPRECATION WARNING: media_storage_foreach_media_from_db() is deprecated and will be removed from next release.");
 
        if ((callback != NULL) && STRING_VALID(storage_id)) {
                ret = _media_db_get_group_item(storage_id, filter, callback, user_data, MEDIA_GROUP_STORAGE);
        } else {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
@@ -131,7 +131,7 @@ int media_storage_foreach_media_from_db(const char *storage_id, filter_h filter,
 int media_storage_destroy(media_storage_h storage)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_content_warn("DEPRECATION WARNING: media_storage_destroy() is deprecated and will be removed from next release.");
+       content_warn("DEPRECATION WARNING: media_storage_destroy() is deprecated and will be removed from next release.");
        media_storage_s *_storage = (media_storage_s*)storage;
        if (_storage) {
                SAFE_FREE(_storage->storage_id);
@@ -140,7 +140,7 @@ int media_storage_destroy(media_storage_h storage)
 
                ret = MEDIA_CONTENT_ERROR_NONE;
        } else {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
@@ -150,18 +150,18 @@ int media_storage_destroy(media_storage_h storage)
 int media_storage_clone(media_storage_h *dst, media_storage_h src)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_content_warn("DEPRECATION WARNING: media_storage_clone() is deprecated and will be removed from next release.");
+       content_warn("DEPRECATION WARNING: media_storage_clone() is deprecated and will be removed from next release.");
        media_storage_s *_src = (media_storage_s*)src;
 
        if (_src != NULL) {
                media_storage_s *_dst = (media_storage_s*)calloc(1, sizeof(media_storage_s));
-               media_content_retvm_if(_dst == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+               content_retvm_if(_dst == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
 
                if (STRING_VALID(_src->storage_id)) {
                        _dst->storage_id = strdup(_src->storage_id);
                        if (_dst->storage_id == NULL) {
                                media_storage_destroy((media_storage_h)_dst);
-                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                        }
                }
@@ -169,7 +169,7 @@ int media_storage_clone(media_storage_h *dst, media_storage_h src)
                if (STRING_VALID(_src->storage_path)) {
                        _dst->storage_path = strdup(_src->storage_path);
                        if (_dst->storage_path == NULL) {
-                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                                media_storage_destroy((media_storage_h)_dst);
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                        }
@@ -181,7 +181,7 @@ int media_storage_clone(media_storage_h *dst, media_storage_h src)
 
                ret = MEDIA_CONTENT_ERROR_NONE;
        } else {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
@@ -191,20 +191,20 @@ int media_storage_clone(media_storage_h *dst, media_storage_h src)
 int media_storage_get_id(media_storage_h storage, char **storage_id)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_content_warn("DEPRECATION WARNING: media_storage_get_id() is deprecated and will be removed from next release.");
+       content_warn("DEPRECATION WARNING: media_storage_get_id() is deprecated and will be removed from next release.");
        media_storage_s *_storage = (media_storage_s*)storage;
 
        if (_storage && storage_id) {
                if (STRING_VALID(_storage->storage_id)) {
                        *storage_id = strdup(_storage->storage_id);
-                       media_content_retvm_if(*storage_id == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+                       content_retvm_if(*storage_id == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
                } else {
                        *storage_id = NULL;
                }
 
                ret = MEDIA_CONTENT_ERROR_NONE;
        } else {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
@@ -214,20 +214,20 @@ int media_storage_get_id(media_storage_h storage, char **storage_id)
 int media_storage_get_path(media_storage_h storage, char **storage_path)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_content_warn("DEPRECATION WARNING: media_storage_get_path() is deprecated and will be removed from next release.");
+       content_warn("DEPRECATION WARNING: media_storage_get_path() is deprecated and will be removed from next release.");
        media_storage_s *_storage = (media_storage_s*)storage;
 
        if (_storage && storage_path) {
                if (STRING_VALID(_storage->storage_path)) {
                        *storage_path = strdup(_storage->storage_path);
-                       media_content_retvm_if(*storage_path == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+                       content_retvm_if(*storage_path == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
                } else {
                        *storage_path = NULL;
                }
 
                ret = MEDIA_CONTENT_ERROR_NONE;
        } else {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
@@ -237,14 +237,14 @@ int media_storage_get_path(media_storage_h storage, char **storage_path)
 int media_storage_get_type(media_storage_h storage, media_content_storage_e *storage_type)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_content_warn("DEPRECATION WARNING: media_storage_get_type() is deprecated and will be removed from next release. Use storage_get_type_dev() instead.");
+       content_warn("DEPRECATION WARNING: media_storage_get_type() is deprecated and will be removed from next release. Use storage_get_type_dev() instead.");
        media_storage_s *_storage = (media_storage_s*)storage;
 
        if (_storage && storage_type) {
                *storage_type = _storage->storage_type;
                ret = MEDIA_CONTENT_ERROR_NONE;
        } else {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
@@ -260,13 +260,13 @@ int media_storage_get_scan_status(const char *storage_uuid, media_storage_scan_s
        if (STRING_VALID(storage_uuid)) {
                ret = media_svc_get_storage_scan_status(_content_get_db_handle(), storage_uuid, &status);
                if (ret != MS_MEDIA_ERR_NONE) {
-                       media_content_error("media_svc_get_storage_scan_status failed");
+                       content_error("media_svc_get_storage_scan_status failed");
                        ret = _content_error_capi(ret);
                } else {
                        *scan_status = status;
                }
        } else {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }