From af6a7a2e123d43befa1ea22aeb4e0b72d376b792 Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Thu, 2 Aug 2018 13:24:34 +0900 Subject: [PATCH] Update path replacement function Use hardcording instead of storage API (because of storage API changes) Change-Id: I92562dbc6c55bfd3ed86d723c0efd4e34db31f33 Signed-off-by: Minje Ahn --- packaging/capi-content-media-content.spec | 2 +- src/media_util_private.c | 43 +++++++------------------------ 2 files changed, 11 insertions(+), 34 deletions(-) diff --git a/packaging/capi-content-media-content.spec b/packaging/capi-content-media-content.spec index fc9349e..d482003 100755 --- a/packaging/capi-content-media-content.spec +++ b/packaging/capi-content-media-content.spec @@ -1,6 +1,6 @@ Name: capi-content-media-content Summary: A Media content library in Tizen Native API -Version: 0.3.33 +Version: 0.3.34 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/media_util_private.c b/src/media_util_private.c index d3d2556..ba19ed3 100755 --- a/src/media_util_private.c +++ b/src/media_util_private.c @@ -20,6 +20,7 @@ #include #include #include + #ifdef _USE_SENIOR_MODE #include #endif @@ -368,9 +369,9 @@ int _media_content_replace_path_in_condition(const char *condition, char *replac char *to_replace_str = NULL; if (replace == TRUE) { //change User session path to System session path - ret = storage_get_root_directory(STORAGE_TYPE_INTERNAL, &find_str); - if (ret != STORAGE_ERROR_NONE) { - media_content_error("storage_get_root_directory failed"); + find_str = g_strdup(MEDIA_ROOT_PATH_INTERNAL_OLD); + if (!STRING_VALID(find_str)) { + media_content_error("strdup failed"); ret = MEDIA_CONTENT_ERROR_INVALID_OPERATION; goto ERROR; } @@ -389,9 +390,9 @@ int _media_content_replace_path_in_condition(const char *condition, char *replac goto ERROR; } - ret = storage_get_root_directory(STORAGE_TYPE_INTERNAL, &to_replace_str); - if (ret != STORAGE_ERROR_NONE) { - media_content_error("storage_get_root_directory failed"); + to_replace_str = g_strdup(MEDIA_ROOT_PATH_INTERNAL_OLD); + if (!STRING_VALID(to_replace_str)) { + media_content_error("strdup failed"); ret = MEDIA_CONTENT_ERROR_INVALID_OPERATION; goto ERROR; } @@ -457,24 +458,12 @@ int _media_content_replace_path(const char *path, char *replace_path) #ifdef _USE_TVPD_MODE snprintf(replace_path, MAX_PATH_LEN, "%s", path); #else - - int ret = MEDIA_CONTENT_ERROR_NONE; - char *old_internal_path = NULL; - - ret = storage_get_root_directory(STORAGE_TYPE_INTERNAL, &old_internal_path); - if (ret != STORAGE_ERROR_NONE) { - media_content_error("storage_get_root_directory failed"); - return MEDIA_CONTENT_ERROR_INVALID_OPERATION; - } - - if (strncmp(path, old_internal_path, strlen(old_internal_path)) == 0) { + if (strncmp(path, MEDIA_ROOT_PATH_INTERNAL_OLD, strlen(MEDIA_ROOT_PATH_INTERNAL_OLD)) == 0) { media_content_sec_debug("Old path[%s]", path); - snprintf(replace_path, MAX_PATH_LEN, "%s%s", MEDIA_ROOT_PATH_INTERNAL, path + strlen(old_internal_path)); + snprintf(replace_path, MAX_PATH_LEN, "%s%s", MEDIA_ROOT_PATH_INTERNAL, path + strlen(MEDIA_ROOT_PATH_INTERNAL_OLD)); } else { snprintf(replace_path, MAX_PATH_LEN, "%s", path); } - - SAFE_FREE(old_internal_path); #endif if (!STRING_VALID(replace_path)) { @@ -490,24 +479,12 @@ int _media_content_rollback_path(const char *path, char *replace_path) #ifdef _USE_TVPD_MODE snprintf(replace_path, MAX_PATH_LEN, "%s", path); #else - - int ret = MEDIA_CONTENT_ERROR_NONE; - char *old_internal_path = NULL; - - ret = storage_get_root_directory(STORAGE_TYPE_INTERNAL, &old_internal_path); - if (ret != STORAGE_ERROR_NONE) { - media_content_error("storage_get_root_directory failed"); - return MEDIA_CONTENT_ERROR_INVALID_OPERATION; - } - if (strncmp(path, MEDIA_ROOT_PATH_INTERNAL, strlen(MEDIA_ROOT_PATH_INTERNAL)) == 0) { media_content_sec_debug("new path[%s]", path); - snprintf(replace_path, MAX_PATH_LEN, "%s%s", old_internal_path, path + strlen(MEDIA_ROOT_PATH_INTERNAL)); + snprintf(replace_path, MAX_PATH_LEN, "%s%s", MEDIA_ROOT_PATH_INTERNAL_OLD, path + strlen(MEDIA_ROOT_PATH_INTERNAL)); } else { snprintf(replace_path, MAX_PATH_LEN, "%s", path); } - - SAFE_FREE(old_internal_path); #endif if (!STRING_VALID(replace_path)) { -- 2.7.4