From e9916445dbf92679c6d08b91e29a04b3280819a4 Mon Sep 17 00:00:00 2001 From: Gwangbok Kim Date: Mon, 1 Jul 2013 23:31:55 +0900 Subject: [PATCH] fix TC failure Change-Id: I3499ed89a5abbdcb93375ee2eb0465c28497baba Signed-off-by: Gwangbok Kim --- src/FSclReminder.cpp | 27 +++++++++++++++++---------- src/FScl_ContactImpl.cpp | 26 +++++++++++++++----------- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/src/FSclReminder.cpp b/src/FSclReminder.cpp index d4d001f..65da1e1 100644 --- a/src/FSclReminder.cpp +++ b/src/FSclReminder.cpp @@ -166,23 +166,30 @@ Reminder::SetMinutesBefore(int minutes) result Reminder::SetSoundFile(const String& filePath) { - String tmpFilePath; - if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat()) + if (filePath.IsEmpty()) { - _FileImpl::ConvertVirtualToPhysicalPath(filePath, tmpFilePath); + __soundFilePath.Clear(); } else { - tmpFilePath = filePath; - } + result r = E_SUCCESS; + String tmpFilePath; + + if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat()) + { + r = _FileImpl::ConvertVirtualToPhysicalPath(filePath, tmpFilePath); + SysTryReturn(NID_SCL, r == E_SUCCESS, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used.", GetErrorMessage(E_INVALID_ARG)); + } + else + { + tmpFilePath = filePath; + } - if (!tmpFilePath.IsEmpty()) - { SysTryReturnResult(NID_SCL, File::IsFileExist(tmpFilePath), E_INVALID_ARG - , "Invalid argument is used. The length of the filePath exceeds the maximum length or the file path is invalid or the file does not exist."); - } + , "Invalid argument is used. The length of the filePath exceeds the maximum length or the file path is invalid or the file does not exist."); - __soundFilePath = tmpFilePath; + __soundFilePath = tmpFilePath; + } return E_SUCCESS; } diff --git a/src/FScl_ContactImpl.cpp b/src/FScl_ContactImpl.cpp index f780275..331f331 100644 --- a/src/FScl_ContactImpl.cpp +++ b/src/FScl_ContactImpl.cpp @@ -304,14 +304,18 @@ _ContactImpl::GetThumbnailN(void) const } String thumbnailPath(pCharValue); + if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat()) + { + _FileImpl::ConvertPhysicalToVirtualPath(pCharValue, thumbnailPath); + } Image image; - result r = image.Construct(); - SysTryReturn(NID_SCL, r != E_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Failed to construct Image.", GetErrorMessage(E_SYSTEM)); + result r = image.Construct(); + SysTryReturn(NID_SCL, r != E_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Failed to construct Image.", GetErrorMessage(E_SYSTEM)); ImageFormat imageFormat = image.GetImageFormat(thumbnailPath); - SysTryReturn(NID_SCL, GetLastResult() != E_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + SysTryReturn(NID_SCL, GetLastResult() != E_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); SysTryReturn(NID_SCL, GetLastResult() == E_SUCCESS, null, E_SYSTEM, "[%s] Failed to get the format of the thumbnail image.", GetErrorMessage(E_SYSTEM)); BitmapPixelFormat bitmapPixelFormat = BITMAP_PIXEL_FORMAT_RGB565; @@ -1144,22 +1148,22 @@ _ContactImpl::SetValue(ContactPropertyId id, const String& value) case CONTACT_PROPERTY_ID_RINGTONE: { + SysTryReturn(NID_SCL, value.IsEmpty() || File::IsFileExist(value), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used.", GetErrorMessage(E_INVALID_ARG)); + String ringtonePath; if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat()) { - _FileImpl::ConvertVirtualToPhysicalPath(value, ringtonePath); + if (!value.IsEmpty()) + { + result r = _FileImpl::ConvertVirtualToPhysicalPath(value, ringtonePath); + SysTryReturn(NID_SCL, r != E_INVALID_ARG, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used.", GetErrorMessage(E_INVALID_ARG)); + } } else { ringtonePath = value; } - if (!ringtonePath.IsEmpty() && !File::IsFileExist(ringtonePath)) - { - SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. The specified ringtone file does not exist.", GetErrorMessage(E_INVALID_ARG)); - return E_INVALID_ARG; - } - std::unique_ptr pCharArray(_StringConverter::CopyToCharArrayN(ringtonePath)); contacts_record_set_str(__contactHandle, _contacts_contact.ringtone_path, pCharArray.get()); -- 2.7.4