/* check the file exits actually */
exist = open(path, O_RDONLY);
if (exist < 0) {
- media_content_sec_debug("path [%s]", path);
- media_content_stderror("open file fail");
- if (errno == EACCES || errno == EPERM)
+ if (errno == EACCES || errno == EPERM) {
+ media_content_stderror("open file fail");
+ media_content_sec_debug("path [%s]", path);
return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
- else
+ } else {
+ media_content_stderror("open file fail");
+ media_content_sec_debug("path [%s]", path);
return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
}
close(exist);
memset(buf, 0, sizeof(buf));
if (!SAFE_STRLCPY(buf, input_path, sizeof(buf)))
- media_content_sec_debug("Truncation occurred[%d]", strlen(input_path));
+ media_content_sec_debug("Truncation occurred[%zu]", strlen(input_path));
while ((pos = strstr(buf, "//")) != NULL) {
memset(tmp, 0, sizeof(tmp));
memset(buf, 0, sizeof(buf));
if (!SAFE_STRLCPY(buf, tmp, sizeof(buf)))
- media_content_sec_debug("Truncation occurred[%d]", strlen(tmp));
+ media_content_sec_debug("Truncation occurred[%zu]", strlen(tmp));
}
if (g_str_has_suffix(buf, "/"))
int _media_util_check_ignore_dir(const char *dir_path, bool *ignore)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- media_svc_storage_type_e storage_type = 0;
+ ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
const char *scan_ignore = ".scan_ignore";
bool find = false;
GDir *dir = NULL;
}
/*2. Check Scan Ignore Directory*/
- ret = media_svc_get_storage_type(dir_path, &storage_type, _content_get_uid());
+ ret = ms_user_get_storage_type(_content_get_uid(), dir_path, &storage_type);
if (ret != MS_MEDIA_ERR_NONE) {
- media_content_error("media_svc_get_storage_type failed : %d", ret);
+ media_content_error("ms_user_get_storage_type failed : %d", ret);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
}
break;
} else {
/*If root path, Stop Scanning*/
- if ((storage_type == MEDIA_SVC_STORAGE_INTERNAL) && (STRING_VALID(MEDIA_ROOT_PATH_INTERNAL) && g_strcmp0(search_path, MEDIA_ROOT_PATH_INTERNAL) == 0)) {
+ if ((storage_type == MS_USER_STORAGE_INTERNAL) && (STRING_VALID(MEDIA_ROOT_PATH_INTERNAL) && g_strcmp0(search_path, MEDIA_ROOT_PATH_INTERNAL) == 0)) {
break;
- } else if ((storage_type == MEDIA_SVC_STORAGE_EXTERNAL) && (STRING_VALID(MEDIA_ROOT_PATH_SDCARD)) && (g_strcmp0(search_path, MEDIA_ROOT_PATH_SDCARD) == 0)) {
+ } else if ((storage_type == MS_USER_STORAGE_EXTERNAL) && (STRING_VALID(MEDIA_ROOT_PATH_SDCARD)) && (g_strcmp0(search_path, MEDIA_ROOT_PATH_SDCARD) == 0)) {
break;
- } else if ((storage_type == MEDIA_SVC_STORAGE_EXTERNAL_USB) && (STRING_VALID(MEDIA_ROOT_PATH_DISC)) && (g_strcmp0(search_path, MEDIA_ROOT_PATH_DISC) == 0)) {
+ } else if ((storage_type == MS_USER_STORAGE_EXTERNAL_USB) && (STRING_VALID(MEDIA_ROOT_PATH_DISC)) && (g_strcmp0(search_path, MEDIA_ROOT_PATH_DISC) == 0)) {
break;
- } else if (storage_type == MEDIA_SVC_STORAGE_EXTERNAL_USB) {
+ } else if (storage_type == MS_USER_STORAGE_EXTERNAL_USB) {
char *parent_folder_path = NULL;
bool is_root = FALSE;
#endif
dp = opendir(path);
if (dp == NULL) {
- media_content_sec_error("path [%s]", path);
- media_content_stderror("open dir fail");
-
- if (errno == EACCES || errno == EPERM)
+ if (errno == EACCES || errno == EPERM) {
+ media_content_stderror("open dir fail");
+ media_content_sec_error("path [%s]", path);
return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
- else
+ } else {
+ media_content_stderror("open dir fail");
+ media_content_sec_error("path [%s]", path);
return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
}
closedir(dp);
return MEDIA_CONTENT_ERROR_NONE;
}
-int _media_content_rollback_path(const char *path, char *replace_path)
-{
-#ifdef _USE_TVPD_MODE
- snprintf(replace_path, MAX_PATH_LEN, "%s", path);
-#else
- 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", MEDIA_ROOT_PATH_INTERNAL_OLD, path + strlen(MEDIA_ROOT_PATH_INTERNAL));
- } else {
- snprintf(replace_path, MAX_PATH_LEN, "%s", path);
- }
-#endif
-
- if (!STRING_VALID(replace_path)) {
- media_content_error("replace failed");
- return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
- }
-
- return MEDIA_CONTENT_ERROR_NONE;
-}
-
#ifdef _USE_SENIOR_MODE
bool _media_content_is_support_senior_mode()
{