From be13b2549bc10a7dbd7e468f7d057e96cf7b6893 Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Wed, 28 Nov 2018 15:25:08 +0900 Subject: [PATCH] Delete err_msg This is old code. No more error msgs are required. Use return value instead. Change-Id: I6920c44e02f8f07eca404444c0ee948e0322401b Signed-off-by: Minje Ahn --- plugin/media-content-plugin.c | 716 ++++++------------------------------------ 1 file changed, 101 insertions(+), 615 deletions(-) diff --git a/plugin/media-content-plugin.c b/plugin/media-content-plugin.c index cd7f412..c0952da 100755 --- a/plugin/media-content-plugin.c +++ b/plugin/media-content-plugin.c @@ -26,126 +26,26 @@ #include "media-svc.h" #include "media-svc-util.h" -#define MEDIA_SVC_PLUGIN_ERROR_NONE 0 -#define MEDIA_SVC_PLUGIN_ERROR -1 - -typedef enum { - ERR_HANDLE = 1, - ERR_FILE_PATH, - ERR_FOLDER_PATH, - ERR_MIME_TYPE, - ERR_NOT_MEDIAFILE, - ERR_STORAGE_TYPE, - ERR_CHECK_ITEM, - ERR_MAX, -} media_svc_error_type_e; - -static void __set_error_message(int err_type, char **err_msg); - -static void __set_error_message(int err_type, char **err_msg) -{ - if (err_msg) - *err_msg = NULL; - else - return; - - if (err_type == ERR_HANDLE) - *err_msg = strdup("invalid handle"); - else if (err_type == ERR_FILE_PATH) - *err_msg = strdup("invalid file path"); - else if (err_type == ERR_FOLDER_PATH) - *err_msg = strdup("invalid folder path"); - else if (err_type == ERR_MIME_TYPE) - *err_msg = strdup("invalid mime type"); - else if (err_type == ERR_NOT_MEDIAFILE) - *err_msg = strdup("not media content"); - else if (err_type == ERR_STORAGE_TYPE) - *err_msg = strdup("invalid storage type"); - else if (err_type == ERR_CHECK_ITEM) - *err_msg = strdup("item does not exist"); - else if (err_type == MS_MEDIA_ERR_DB_CONNECT_FAIL) - *err_msg = strdup("DB connect error"); - else if (err_type == MS_MEDIA_ERR_DB_DISCONNECT_FAIL) - *err_msg = strdup("DB disconnect error"); - else if (err_type == MS_MEDIA_ERR_INVALID_PARAMETER) - *err_msg = strdup("invalid parameter"); - else if (err_type == MS_MEDIA_ERR_DB_INTERNAL) - *err_msg = strdup("DB internal error"); - else if (err_type == MS_MEDIA_ERR_DB_NO_RECORD) - *err_msg = strdup("not found in DB"); - else if (err_type == MS_MEDIA_ERR_INTERNAL) - *err_msg = strdup("media service internal error"); - else if (err_type == MS_MEDIA_ERR_DB_CORRUPT) - *err_msg = strdup("DB corrupt error"); - else - *err_msg = strdup("error unknown"); - - return; -} - -int connect_db(void **handle, uid_t uid, char **err_msg) +int connect_db(void **handle, uid_t uid) { - int ret = media_svc_connect(handle, uid, FALSE); - - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_connect(handle, uid, FALSE); } -int disconnect_db(void *handle, char **err_msg) +int disconnect_db(void *handle) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_disconnect(handle); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_disconnect(handle); } -int cleanup_db(void *handle, uid_t uid, char **err_msg) +int cleanup_db(void *handle, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_cleanup_db(handle, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_cleanup_db(handle, uid); } -int check_item_exist(void *handle, const char *storage_id, const char *file_path, bool *modified, char **err_msg) +int check_item_exist(void *handle, const char *storage_id, const char *file_path, bool *modified) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; + int ret = MS_MEDIA_ERR_NONE; *modified = TRUE; - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (!STRING_VALID(file_path)) { - __set_error_message(ERR_FILE_PATH, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - time_t modified_time = 0; unsigned long long file_size = 0; struct stat st; @@ -160,667 +60,253 @@ int check_item_exist(void *handle, const char *storage_id, const char *file_path *modified = FALSE; } - return MEDIA_SVC_PLUGIN_ERROR_NONE; /*exist */ + return ret; } - __set_error_message(ERR_CHECK_ITEM, err_msg); - - return MEDIA_SVC_PLUGIN_ERROR; /*not exist */ + return ret; } -int insert_item_begin(void *handle, int item_cnt, int with_noti, int from_pid, char **err_msg) +int insert_item_begin(void *handle, int item_cnt, int with_noti, int from_pid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - ret = media_svc_insert_item_begin(item_cnt, with_noti, from_pid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_insert_item_begin(item_cnt, with_noti, from_pid); } -int insert_item_end(void *handle, uid_t uid, char **err_msg) +int insert_item_end(void *handle, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - ret = media_svc_insert_item_end(uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_insert_item_end(uid); } -int insert_item(void *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid, char **err_msg) +int insert_item(void *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (!STRING_VALID(file_path)) { - __set_error_message(ERR_FILE_PATH, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (!STORAGE_VALID(storage_type)) { - __set_error_message(ERR_STORAGE_TYPE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, uid); } -int set_all_storage_items_validity(void *handle, const char *storage_id, int storage_type, int validity, uid_t uid, char **err_msg) +int set_all_storage_items_validity(void *handle, const char *storage_id, int storage_type, int validity, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (!STORAGE_VALID(storage_type)) { - __set_error_message(ERR_STORAGE_TYPE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_set_all_storage_items_validity(storage_id, storage_type, validity, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_set_all_storage_items_validity(storage_id, storage_type, validity, uid); } -int set_folder_item_validity(void *handle, const char *storage_id, const char *folder_path, int validity, int recursive, uid_t uid, char **err_msg) +int set_folder_item_validity(void *handle, const char *storage_id, const char *folder_path, int validity, int recursive, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (!STRING_VALID(folder_path)) { - __set_error_message(ERR_FOLDER_PATH, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_set_folder_items_validity(handle, storage_id, folder_path, validity, recursive, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_set_folder_items_validity(handle, storage_id, folder_path, validity, recursive, uid); } -int set_item_validity_begin(void *handle, int item_cnt, char **err_msg) +int set_item_validity_begin(void *handle, int item_cnt) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - ret = media_svc_set_item_validity_begin(item_cnt); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_set_item_validity_begin(item_cnt); } -int set_item_validity_end(void *handle, uid_t uid, char **err_msg) +int set_item_validity_end(void *handle, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - ret = media_svc_set_item_validity_end(uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_set_item_validity_end(uid); } -int set_item_validity(void *handle, const char *storage_id, const char *file_path, int storage_type, int validity, uid_t uid, char **err_msg) +int set_item_validity(void *handle, const char *storage_id, const char *file_path, int storage_type, int validity, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (!STRING_VALID(file_path)) { - __set_error_message(ERR_FILE_PATH, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_set_item_validity(storage_id, file_path, validity, uid); - - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_set_item_validity(storage_id, file_path, validity, uid); } -int delete_item(void *handle, const char *storage_id, const char *file_path, uid_t uid, char **err_msg) +int delete_item(void *handle, const char *storage_id, const char *file_path, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (!STRING_VALID(file_path)) { - __set_error_message(ERR_FILE_PATH, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_check_item_exist_by_path(handle, storage_id, file_path); - if (ret == 0) { - ret = media_svc_delete_item_by_path(handle, storage_id, file_path, uid); - - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } else - return MEDIA_SVC_PLUGIN_ERROR_NONE; - } - - __set_error_message(ERR_CHECK_ITEM, err_msg); /*not exist in DB so can't delete item. */ - return MEDIA_SVC_PLUGIN_ERROR; + return media_svc_delete_item_by_path(handle, storage_id, file_path, uid); } -int delete_all_invalid_items_in_storage(void *handle, const char *storage_id, int storage_type, uid_t uid, char **err_msg) +int delete_all_invalid_items_in_storage(void *handle, const char *storage_id, int storage_type, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (!STORAGE_VALID(storage_type)) { - __set_error_message(ERR_STORAGE_TYPE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_delete_invalid_items_in_storage(handle, storage_id, storage_type, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_delete_invalid_items_in_storage(handle, storage_id, storage_type, uid); } -int send_dir_update_noti(void *handle, const char *storage_id, const char *dir_path, const char *folder_id, int update_type, int pid, char **err_msg) +int send_dir_update_noti(void *handle, const char *storage_id, const char *dir_path, const char *folder_id, int update_type, int pid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (!STRING_VALID(dir_path)) { - __set_error_message(ERR_FOLDER_PATH, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_send_dir_update_noti(handle, storage_id, dir_path, folder_id, (media_item_update_type_e)update_type, pid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_send_dir_update_noti(handle, storage_id, dir_path, folder_id, (media_item_update_type_e)update_type, pid); } -int check_db(void *handle, uid_t uid, char **err_msg) +int check_db(void *handle, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; + int ret = MS_MEDIA_ERR_NONE; int user_version = -1; ret = media_svc_get_user_version(handle, &user_version); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } + if (ret != MS_MEDIA_ERR_NONE) + return ret; - if (user_version == 0) { - /*check db schema*/ + if (user_version == 0) ret = media_svc_create_table(uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - } else { - /*check db version*/ + else ret = media_svc_check_db_upgrade(handle, user_version, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - } - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return ret; } -int update_folder_time(void *handle, const char *storage_id, char *folder_path, uid_t uid, char **err_msg) +int update_folder_time(void *handle, const char *storage_id, char *folder_path, uid_t uid) { /* For scanner V2 */ - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return MS_MEDIA_ERR_NONE; } -int get_uuid(void * handle, char **uuid, char **err_msg) +int get_uuid(void * handle, char **uuid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - ret = media_svc_generate_uuid(uuid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_generate_uuid(uuid); } -int check_storage(void * handle, const char *storage_id, char **storage_path, int *validity, uid_t uid, char **err_msg) +int check_storage(void * handle, const char *storage_id, char **storage_path, int *validity, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_check_storage(handle, storage_id, storage_path, validity, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_check_storage(handle, storage_id, storage_path, validity, uid); } -int insert_storage(void *handle, const char *storage_id, int storage_type, const char *storage_path, uid_t uid, char **err_msg) +int insert_storage(void *handle, const char *storage_id, int storage_type, const char *storage_path, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_insert_storage(handle, storage_id, storage_path, storage_type, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_insert_storage(handle, storage_id, storage_path, storage_type, uid); } -int update_storage(void *handle, const char *storage_id, const char *storage_path, uid_t uid, char **err_msg) +int update_storage(void *handle, const char *storage_id, const char *storage_path, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_update_storage(handle, storage_id, storage_path, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_update_storage(handle, storage_id, storage_path, uid); } -int set_storage_validity(void * handle, const char *storage_id, int validity, uid_t uid, char **err_msg) +int set_storage_validity(void * handle, const char *storage_id, int validity, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_set_storage_validity(handle, storage_id, validity, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_set_storage_validity(handle, storage_id, validity, uid); } -int set_all_storage_validity(void * handle, int validity, uid_t uid, char **err_msg) +int set_all_storage_validity(void * handle, int validity, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_set_storage_validity(handle, NULL, validity, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_set_storage_validity(handle, NULL, validity, uid); } -int get_storage_id(void * handle, const char *path, char *storage_id, uid_t uid, char **err_msg) +int get_storage_id(void * handle, const char *path, char *storage_id, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_get_storage_id(handle, path, storage_id, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_get_storage_id(handle, path, storage_id, uid); } -int set_storage_scan_status(void *handle, const char *storage_id, int status, uid_t uid, char **err_msg) +int set_storage_scan_status(void *handle, const char *storage_id, int status, uid_t uid) { /* For scanner V2 */ - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return MS_MEDIA_ERR_NONE; } -int get_storage_list(void *handle, char ***storage_list, char ***storage_id_list, int *count, char **err_msg) +int get_storage_list(void *handle, char ***storage_list, char ***storage_id_list, int *count) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (count == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_get_storage_list(handle, storage_list, storage_id_list, count); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_get_storage_list(handle, storage_list, storage_id_list, count); } -int update_item_begin(void *handle, int item_cnt, char **err_msg) +int update_item_begin(void *handle, int item_cnt) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - ret = media_svc_update_item_begin(item_cnt); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_update_item_begin(item_cnt); } -int update_item_end(void *handle, uid_t uid, char **err_msg) +int update_item_end(void *handle, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - ret = media_svc_update_item_end(uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_update_item_end(uid); } -int update_item_meta(void *handle, const char *file_path, const char *storage_id, int storage_type, uid_t uid, char **err_msg) +int update_item_meta(void *handle, const char *file_path, const char *storage_id, int storage_type, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (file_path == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (storage_id == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_update_item_meta(handle, file_path, storage_id, storage_type, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_update_item_meta(handle, file_path, storage_id, storage_type, uid); } -int insert_item_scan(void * handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid, char **err_msg) +int insert_item_scan(void * handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid) { /* For scanner V2 */ - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return MS_MEDIA_ERR_NONE; } -int get_extract_list(void* handle, const char* storage_id, int storage_type, int scan_type, const char* path, uid_t uid, void* array, char** err_msg) +int get_extract_list(void* handle, const char* storage_id, int storage_type, int scan_type, const char* path, uid_t uid, void* array) { /* For scanner V2 */ - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return MS_MEDIA_ERR_NONE; } -int update_one_extract_item(void* handle, const char* storage_id, int storage_type, void* data, char** err_msg) +int update_one_extract_item(void* handle, const char* storage_id, int storage_type, void* data) { /* For scanner V2 */ - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return MS_MEDIA_ERR_NONE; } -int query_do_update_list(void* handle, char** err_msg) +int query_do_update_list(void* handle) { /* For scanner V2 */ - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return MS_MEDIA_ERR_NONE; } int delete_all_invalid_items_in_folder(void **handle, const char* storage_id, const char*path, bool is_recursive, uid_t uid) { /* For scanner V2 */ - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return MS_MEDIA_ERR_NONE; } int delete_invalid_folder_by_path(void **handle, const char *storage_id, const char *folder_path, uid_t uid) { /* For scanner V2 */ - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return MS_MEDIA_ERR_NONE; } -int insert_folder_begin(void * handle, int item_cnt, char **err_msg) +int insert_folder_begin(void * handle, int item_cnt) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - ret = media_svc_insert_folder_begin(item_cnt); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_insert_folder_begin(item_cnt); } -int insert_folder_end(void *handle, uid_t uid, char **err_msg) +int insert_folder_end(void *handle, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - ret = media_svc_insert_folder_end(uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_insert_folder_end(uid); } -int insert_folder(void * handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid, char **err_msg) +int insert_folder(void * handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (!STRING_VALID(file_path)) { - __set_error_message(ERR_FILE_PATH, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (!STORAGE_VALID(storage_type)) { - __set_error_message(ERR_STORAGE_TYPE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_insert_folder(handle, storage_id, storage_type, file_path, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_insert_folder(handle, storage_id, storage_type, file_path, uid); } -int delete_invalid_folder(void * handle, const char *storage_id, int storage_type, uid_t uid, char **err_msg) +int delete_invalid_folder(void * handle, const char *storage_id, int storage_type, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - ret = media_svc_delete_invalid_folder(storage_id, storage_type, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_delete_invalid_folder(storage_id, storage_type, uid); } -int set_folder_validity(void * handle, const char *storage_id, const char* start_path, int validity, bool is_recursive, uid_t uid, char **err_msg) +int set_folder_validity(void * handle, const char *storage_id, const char* start_path, int validity, bool is_recursive, uid_t uid) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_set_folder_validity(handle, storage_id, start_path, validity, is_recursive, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_set_folder_validity(handle, storage_id, start_path, validity, is_recursive, uid); } -int get_folder_scan_status(void *handle, const char *storage_id, const char *path, int *status, char **err_msg) +int get_folder_scan_status(void *handle, const char *storage_id, const char *path, int *status) { /* For scanner V2 */ - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return MS_MEDIA_ERR_NONE; } -int set_folder_scan_status(void *handle, const char *storage_id, const char *path, int status, uid_t uid, char **err_msg) +int set_folder_scan_status(void *handle, const char *storage_id, const char *path, int status, uid_t uid) { /* For scanner V2 */ - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return MS_MEDIA_ERR_NONE; } -int check_folder_modified(void *handle, const char *path, const char *storage_id, bool *modified, char **err_msg) +int check_folder_modified(void *handle, const char *path, const char *storage_id, bool *modified) { /* For scanner V2 */ - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return MS_MEDIA_ERR_NONE; } -int get_null_scan_folder_list(void *handle, const char *storage_id, const char *folder_path, char ***folder_list, int *count, char **err_msg) +int get_null_scan_folder_list(void *handle, const char *storage_id, const char *folder_path, char ***folder_list, int *count) { /* For scanner V2 */ - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return MS_MEDIA_ERR_NONE; } -int change_validity_item_batch(void **handle, const char *storage_id, const char *path, int des_validity, int src_validity, uid_t uid, char **err_msg) +int change_validity_item_batch(void **handle, const char *storage_id, const char *path, int des_validity, int src_validity, uid_t uid) { /* For scanner V2 */ - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return MS_MEDIA_ERR_NONE; } -int check_folder_exist(void * handle, const char *storage_id, const char *folder_path, char **err_msg) +int check_folder_exist(void * handle, const char *storage_id, const char *folder_path) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_check_folder_exist_by_path(handle, storage_id, folder_path); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_check_folder_exist_by_path(handle, storage_id, folder_path); } -int get_folder_id(void * handle, const char *storage_id, const char *path, char *folder_id, char **err_msg) +int get_folder_id(void * handle, const char *storage_id, const char *path, char *folder_id) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_get_folder_id(handle, storage_id, path, folder_id); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_get_folder_id(handle, storage_id, path, folder_id); } -int get_media_type(void *handle, const char *path, int *mediatype, char **err_msg) +int get_media_type(void *handle, const char *path, int *mediatype) { - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_get_media_type(path, mediatype); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; + return media_svc_get_media_type(path, mediatype); } - - -- 2.7.4