From 9854665b61c46ea62b0d4654228327c470be4826 Mon Sep 17 00:00:00 2001 From: Haejeong Kim Date: Thu, 18 May 2017 14:01:48 +0900 Subject: Use Common API in libmedia-util to get storage_type instead of internal API Change-Id: Id2f14227aa97ce28eda8c20c8882b0183dffc9e5 --- src/media-thumb-internal.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/media-thumb-internal.c') diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c index 28914f0..2d0ac3d 100755 --- a/src/media-thumb-internal.c +++ b/src/media-thumb-internal.c @@ -1611,7 +1611,8 @@ int _media_thumb_get_hash_name(const char *file_full_path, char file_ext[255] = { 0 }; char *get_path = NULL; int ret_len = 0; - media_thumb_store_type store_type = -1; + ms_user_storage_type_t store_type = -1; + int ret = 0; if (file_full_path == NULL || thumb_hash_path == NULL || max_thumb_path <= 0) { thumb_err("file_full_path==NULL || thumb_hash_path == NULL || max_thumb_path <= 0"); @@ -1620,14 +1621,11 @@ int _media_thumb_get_hash_name(const char *file_full_path, _media_thumb_get_file_ext(file_full_path, file_ext, sizeof(file_ext)); - store_type = _media_thumb_get_store_type_by_path(file_full_path); - /*if (store_type == THUMB_PHONE) { - thumb_dir = _media_thumb_phone_get_path(uid); - } else if (store_type == THUMB_MMC) { - thumb_dir = _media_thumb_mmc_get_path(uid); - } else { - thumb_dir = _media_thumb_phone_get_path(uid); - }*/ + ret = ms_user_get_storage_type(uid, file_full_path, &store_type); + if((ret != MS_MEDIA_ERR_NONE) || ((store_type != MS_USER_STORAGE_INTERNAL) && (store_type != MS_USER_STORAGE_EXTERNAL))) { + thumb_err("origin path(%s) is invalid. err : [%d] store_type [%d]", file_full_path, ret, store_type); + return MS_MEDIA_ERR_INVALID_PARAMETER; + } hash_name = _media_thumb_generate_hash_name(file_full_path); if (hash_name == NULL) { @@ -1635,11 +1633,11 @@ int _media_thumb_get_hash_name(const char *file_full_path, return MS_MEDIA_ERR_INTERNAL; } - if (store_type == THUMB_PHONE) { + if (store_type == MS_USER_STORAGE_INTERNAL) { get_path = _media_thumb_phone_get_path(uid); if (get_path != NULL) ret_len = snprintf(thumb_hash_path, max_thumb_path - 1, "%s/.%s-%s.jpg", get_path, file_ext, hash_name); - } else if (store_type == THUMB_MMC) { + } else if (store_type == MS_USER_STORAGE_EXTERNAL) { get_path = _media_thumb_mmc_get_path(uid); if (get_path != NULL) ret_len = snprintf(thumb_hash_path, max_thumb_path - 1, "%s/.%s-%s.jpg", get_path, file_ext, hash_name); -- cgit v1.2.3