Modifying code according to coding idioms
authorManasij Sur Roy <manasij.r@samsung.com>
Wed, 21 Aug 2013 09:33:55 +0000 (18:33 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Fri, 30 Aug 2013 05:10:41 +0000 (05:10 +0000)
Change-Id: I0cbb8d229851a5441a6ba3d4c0b38e0443a9caf1
Signed-off-by: Manasij Sur Roy <manasij.r@samsung.com>
22 files changed:
src/FScl_CalEventImpl.cpp
src/FScl_CalEventInstanceImpl.cpp
src/FScl_CalTodoImpl.cpp
src/FScl_CalendarbookDbChangeEvent.cpp
src/FScl_CalendarbookDbChangeEvent.h
src/FScl_CalendarbookDbChangeEventArg.h
src/FScl_CalendarbookDbConnector.cpp
src/FScl_CalendarbookDbMonitor.cpp
src/FScl_CalendarbookDbMonitor.h
src/FScl_CalendarbookFilterImpl.cpp
src/FScl_CalendarbookFilterImpl.h
src/FScl_CalendarbookRecordRetrivalEvent.cpp
src/FScl_CalendarbookRecordRetrivalEvent.h
src/FScl_CalendarbookRecordRetrivalEventArg.h
src/FScl_CalendarbookRecordRetrivalThread.cpp
src/FScl_CalendarbookRecordRetrivalThread.h
src/FScl_CalendarbookUtil.cpp
src/FScl_RecurrenceImpl.cpp
src/FScl_ReminderImpl.cpp
src/inc/FScl_CalEventImpl.h
src/inc/FScl_CalTodoImpl.h
src/inc/FScl_RecurrenceImpl.h

index d3abb77..cbb2c4b 100644 (file)
 
 #include <new>
 #include <string.h>
+#include <FApp_AppInfo.h>
 #include <FBaseColArrayList.h>
-#include <FSysSystemTime.h>
-#include <FLclTimeZone.h>
-#include <FLclGregorianCalendar.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
 #include <FLclCalendar.h>
+#include <FLclGregorianCalendar.h>
+#include <FLclTimeZone.h>
 #include <FSclAttendee.h>
-#include <FSclRecord.h>
 #include <FSclCalEvent.h>
-#include <FBaseSysLog.h>
-#include <FApp_AppInfo.h>
-#include <FBase_StringConverter.h>
+#include <FSclRecord.h>
+#include <FSysSystemTime.h>
 #include "FScl_RecordImpl.h"
 #include "FScl_CalEventImpl.h"
 #include "FScl_RecurrenceImpl.h"
 #include "FScl_CalendarbookImpl.h"
 #include "FScl_CalendarbookDbConnector.h"
 
+using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Utility;
-using namespace Tizen::App;
-using namespace Tizen::System;
 using namespace Tizen::Locales;
+using namespace Tizen::System;
 
 namespace Tizen { namespace Social
 {
@@ -89,7 +89,6 @@ _CalEventImpl::_CalEventImpl(void)
        , __reminderListUpdated(false)
 {
        // Set default start and end time
-       result r = E_SUCCESS;
        DateTime startTime;
        SystemTime::GetCurrentTime(startTime);
        if (IsFailed(GetLastResult()))
@@ -99,7 +98,7 @@ _CalEventImpl::_CalEventImpl(void)
        }
 
        DateTime endTime(startTime);
-       r = endTime.AddHours(_DEFAULT_ADDED_HOUR);
+       result r = endTime.AddHours(_DEFAULT_ADDED_HOUR);
        SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
        calendar_time_s startCalendarTime;
@@ -109,14 +108,12 @@ _CalEventImpl::_CalEventImpl(void)
        startCalendarTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(startTime);
        endCalendarTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(endTime);
 
-       int errorCode = CALENDAR_ERROR_NONE;
-       calendar_record_h eventHandle = null;
-
        r = _CalendarbookDbConnector::Connect();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 
-       errorCode = calendar_record_create(_calendar_event._uri, &eventHandle);
-       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       calendar_record_h eventHandle = null;
+       int errorCode = calendar_record_create(_calendar_event._uri, &eventHandle);
+       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        __eventRecord.ResetHandle(eventHandle);
 
@@ -131,7 +128,7 @@ _CalEventImpl::_CalEventImpl(void)
        calendar_record_set_int(eventHandle, _calendar_event.calendar_book_id, INVALID_RECORD_ID);
 
        r = __reminderList.Construct();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 }
 
 _CalEventImpl::_CalEventImpl(const _CalEventImpl& rhs)
@@ -139,19 +136,17 @@ _CalEventImpl::_CalEventImpl(const _CalEventImpl& rhs)
        , __isInstance(rhs.__isInstance)
        , __reminderListUpdated(false)
 {
-       int errorCode = CALENDAR_ERROR_NONE;
-       calendar_record_h eventHandle = null;
-
        result r = _CalendarbookDbConnector::Connect();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 
-       errorCode = calendar_record_clone(rhs.__eventRecord.GetHandle(), &eventHandle);
-       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       calendar_record_h eventHandle = null;
+       int errorCode = calendar_record_clone(rhs.__eventRecord.GetHandle(), &eventHandle);
+       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        __eventRecord.ResetHandle(eventHandle);
 
        r = __reminderList.Construct();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 }
 
 _CalEventImpl::~_CalEventImpl(void)
@@ -161,7 +156,7 @@ _CalEventImpl::~_CalEventImpl(void)
        __reminderList.RemoveAll(true);
 
        result r = _CalendarbookDbConnector::Disconnect();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 }
 
 _CalEventImpl&
@@ -181,7 +176,7 @@ _CalEventImpl::operator =(const _CalEventImpl& rhs)
        calendar_record_h eventHandle = null;
 
        errorCode = calendar_record_clone(rhs.__eventRecord.GetHandle(), &eventHandle);
-       SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, *this, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        __eventRecord.ResetHandle(eventHandle);
 
@@ -237,7 +232,6 @@ _CalEventImpl::SetAllDayEvent(bool isAllDayEvent)
                return;
        }
 
-       int errorCode = CALENDAR_ERROR_NONE;
        calendar_time_s startCalendarTime;
        calendar_time_s tmpStartCalendarTime;
        calendar_time_s endCalendarTime;
@@ -325,8 +319,8 @@ _CalEventImpl::SetAllDayEvent(bool isAllDayEvent)
                        }
 
                        std::unique_ptr<char[]> pExDates(_StringConverter::CopyToCharArrayN(ConvertRecurrenceToRRuleExDateString(*__pRecurrence.get(), isAllDayEvent)));
-                       errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.exdate, pExDates.get());
-                       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+                       int errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.exdate, pExDates.get());
+                       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
                }
        }
 }
@@ -345,7 +339,7 @@ _CalEventImpl::GetUIDN(void) const
        }
 
        ByteBuffer* pConvertedUidBuffer = _CalendarbookUtil::ConvertCharArrayToByteBufferN(pStrUid);
-       SysTryReturn(NID_SCL, pConvertedUidBuffer != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturn(NID_SCL, pConvertedUidBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        return pConvertedUidBuffer;
 }
@@ -358,7 +352,7 @@ _CalEventImpl::SetUID(const ByteBuffer* pUid)
        if (pUid != null)
        {
                std::unique_ptr<char[]> pConvertedUidArray(_CalendarbookUtil::ConvertByteBufferToCharArrayN(*pUid));
-               SysTryReturn(NID_SCL, pConvertedUidArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+               SysTryReturn(NID_SCL, pConvertedUidArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
                errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.uid, pConvertedUidArray.get());
                SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
@@ -372,7 +366,7 @@ _CalEventImpl::SetUID(const ByteBuffer* pUid)
        return E_SUCCESS;
 }
 
-Tizen::Base::String
+String
 _CalEventImpl::GetUid(void) const
 {
        char* pStrUid = null;
@@ -382,15 +376,13 @@ _CalEventImpl::GetUid(void) const
 }
 
 void
-_CalEventImpl::SetUid(const Tizen::Base::String& uid)
+_CalEventImpl::SetUid(const String& uid)
 {
-       int errorCode = CALENDAR_ERROR_NONE;
-
        std::unique_ptr<char[]> pStrUid(_StringConverter::CopyToCharArrayN(uid));
-       SysTryReturnVoidResult(NID_SCL, pStrUid != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturnVoidResult(NID_SCL, pStrUid != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
-       errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.uid, pStrUid.get());
-       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       int errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.uid, pStrUid.get());
+       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 }
 
 EventStatus
@@ -524,8 +516,6 @@ _CalEventImpl::AddAttendee(const Attendee& attendee)
        SysTryReturnResult(NID_SCL, GetAttendeeIndex(pConvertedEmail.get()) == _INVALID_ATTENDEE_INDEX, E_OBJ_ALREADY_EXIST
                                , "The specified attendee already exists as this email is already registered.");
 
-       int errorCode = CALENDAR_ERROR_NONE;
-
        std::unique_ptr<char[]> pConvertedName(_StringConverter::CopyToCharArrayN(attendee.GetName()));
        SysTryReturnResult(NID_SCL, pConvertedName != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
@@ -575,7 +565,7 @@ _CalEventImpl::AddAttendee(const Attendee& attendee)
        }
 
        calendar_record_h attendeeHandle = null;
-       errorCode = calendar_record_create(_calendar_attendee._uri, &attendeeHandle);
+       int errorCode = calendar_record_create(_calendar_attendee._uri, &attendeeHandle);
        SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        errorCode = calendar_record_set_str(attendeeHandle, _calendar_attendee.name, pConvertedName.get());
@@ -597,13 +587,11 @@ _CalEventImpl::AddAttendee(const Attendee& attendee)
 result
 _CalEventImpl::RemoveAttendee(const Attendee& attendee)
 {
-       int index = _INVALID_ATTENDEE_INDEX;
-
        std::unique_ptr<char[]> pConvertedEmail(_StringConverter::CopyToCharArrayN(attendee.GetEmail()));
        SysTryReturnResult(NID_SCL, pConvertedEmail != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       index = GetAttendeeIndex(pConvertedEmail.get());
-       SysTryReturnResult(NID_SCL, index != _INVALID_ATTENDEE_INDEX, E_OBJ_NOT_FOUND, "The specified attendee does not exist.")
+       int index = GetAttendeeIndex(pConvertedEmail.get());
+       SysTryReturnResult(NID_SCL, index != _INVALID_ATTENDEE_INDEX, E_OBJ_NOT_FOUND, "The specified attendee does not exist.");
 
        calendar_record_h tmpAttendeeHandle = null;
        calendar_record_get_child_record_at_p(__eventRecord.GetHandle(), _calendar_event.calendar_attendee, index, &tmpAttendeeHandle);
@@ -618,7 +606,7 @@ _CalEventImpl::GetAllAttendeesN(void) const
        ClearLastResult();
 
        std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
-       SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
        result r = pList->Construct();
        SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
 
@@ -694,8 +682,8 @@ _CalEventImpl::GetAllAttendeesN(void) const
                        break;
                }
 
-               Attendee* pTmpAttendee = new (std::nothrow) Attendee(pTmpEmail);
-               SysTryReturn(NID_SCL, pTmpAttendee != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+               std::unique_ptr<Attendee> pTmpAttendee(new (std::nothrow) Attendee(pTmpEmail));
+               SysTryReturn(NID_SCL, pTmpAttendee != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
                if (pTmpName != null && strlen(pTmpName) > 0)
                {
@@ -711,13 +699,16 @@ _CalEventImpl::GetAllAttendeesN(void) const
                pTmpAttendee->SetRole(attendeeRole);
                pTmpAttendee->SetPersonId(tmpPersonId);
 
-               pList->Add(*pTmpAttendee);
+               r = pList->Add(pTmpAttendee.get());
+               SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               pTmpAttendee.release();
        }
 
        return pList.release();
 }
 
-Tizen::Locales::TimeZone
+TimeZone
 _CalEventImpl::GetTimeZone(void) const
 {
        char* pTimeZoneId = null;
@@ -735,14 +726,12 @@ _CalEventImpl::GetTimeZone(void) const
 }
 
 result
-_CalEventImpl::SetTimeZone(const Tizen::Locales::TimeZone& timeZone)
+_CalEventImpl::SetTimeZone(const TimeZone& timeZone)
 {
-       int errorCode = CALENDAR_ERROR_NONE;
-
        std::unique_ptr<char[]> pConvertedTimeZoneId(_StringConverter::CopyToCharArrayN(timeZone.GetId()));
        SysTryReturnResult(NID_SCL, pConvertedTimeZoneId != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.start_tzid, pConvertedTimeZoneId.get());
+       int errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.start_tzid, pConvertedTimeZoneId.get());
        SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
        errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.end_tzid, pConvertedTimeZoneId.get());
        SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
@@ -755,7 +744,7 @@ _CalEventImpl::GetRecurrenceId(void) const
 {
        ClearLastResult();
        SysTryReturn(NID_SCL, __isInstance, DateTime(), E_INVALID_STATE,
-                               "[E_INVALID_STATE] The instance does not have a recurrence or is not a CalEvent instance which doesn't have a RecurrenceId.");
+                               "[%s] The instance does not have a recurrence or is not a CalEvent instance which doesn't have a RecurrenceId.", GetErrorMessage(E_INVALID_STATE));
 
        return GetStartTime();
 }
@@ -859,7 +848,7 @@ _CalEventImpl::GetSensitivity(void) const
                sensitivity = SENSITIVITY_CONFIDENTIAL;
                break;
        default :
-               SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. sensitivity = %d", srcSensitivity);
+               SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. sensitivity = %d", GetErrorMessage(E_INVALID_ARG), srcSensitivity);
                sensitivity = SENSITIVITY_PUBLIC;
        }
 
@@ -872,7 +861,7 @@ _CalEventImpl::GetReminder(void) const
        if (__reminderListUpdated == false)
        {
                result r = _CalendarbookUtil::ConvertEventAlarmsToReminderList(__eventRecord.GetHandle(), __reminderList);
-               SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+               SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
                __reminderListUpdated = true;
        }
@@ -951,15 +940,16 @@ _CalEventImpl::ConvertEventHandleToRecurrenceN(calendar_record_h eventHandle) co
        case CALENDAR_RECURRENCE_DAILY:
                pRecurrence->SetFrequency(FREQ_DAILY);
                break;
+
        case CALENDAR_RECURRENCE_WEEKLY:
                pRecurrence->SetFrequency(FREQ_WEEKLY);
 
                dayOfWeek = ConvertRRuleByDayStringToDayOfWeek(pByDay);
-               SysTryReturn(NID_SCL, GetLastResult() == E_SUCCESS, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. byday = %s", pByDay);
+               SysTryReturn(NID_SCL, GetLastResult() == E_SUCCESS, null, E_INVALID_ARG, "[%s] Invalid argument is used. byday = %s", GetErrorMessage(E_INVALID_ARG), pByDay);
 
                pRecurrence->SetDayOfWeek(dayOfWeek);
-
                break;
+
        case CALENDAR_RECURRENCE_MONTHLY:
                pRecurrence->SetFrequency(FREQ_MONTHLY);
 
@@ -978,13 +968,14 @@ _CalEventImpl::ConvertEventHandleToRecurrenceN(calendar_record_h eventHandle) co
                else
                {
                        r = ConvertRRuleByDayStringToDayOfWeekAndWeekOfMonth(pByDay, weekOfMonth, dayOfWeek);
-                       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. byday = %s", pByDay);
+                       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_INVALID_ARG, "[%s] Invalid argument is used. byday = %s", GetErrorMessage(E_INVALID_ARG), pByDay);
 
                        pRecurrence->SetWeekOfMonth(weekOfMonth);
                        pRecurrence->SetDayOfWeek(dayOfWeek);
                }
 
                break;
+
        case CALENDAR_RECURRENCE_YEARLY:
                pRecurrence->SetFrequency(FREQ_YEARLY);
 
@@ -1003,7 +994,7 @@ _CalEventImpl::ConvertEventHandleToRecurrenceN(calendar_record_h eventHandle) co
                else
                {
                        r = ConvertRRuleByDayStringToDayOfWeekAndWeekOfMonth(pByDay, weekOfMonth, dayOfWeek);
-                       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. byday = %s", pByDay);
+                       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_INVALID_ARG, "[%s] Invalid argument is used. byday = %s", GetErrorMessage(E_INVALID_ARG), pByDay);
 
                        pRecurrence->SetWeekOfMonth(weekOfMonth);
                        pRecurrence->SetDayOfWeek(dayOfWeek);
@@ -1011,6 +1002,7 @@ _CalEventImpl::ConvertEventHandleToRecurrenceN(calendar_record_h eventHandle) co
                pRecurrence->SetMonthOfYear(monthOfYear);
 
                break;
+
        default :
                SysLogException(NID_SCL, E_INVALID_ARG, "Invalid argument is passed. frequency = %d", srcFrequency);
                return null;
@@ -1046,9 +1038,11 @@ _CalEventImpl::ConvertEventHandleToRecurrenceN(calendar_record_h eventHandle) co
        case CALENDAR_SUNDAY:
                convertedWeekStart = CAL_SUNDAY;
                break;
+
        case CALENDAR_MONDAY:
                convertedWeekStart = CAL_MONDAY;
                break;
+
        default:
                SysLogException(NID_SCL, E_INVALID_ARG, "Invalid argument is passed. week start = %d", weekStart);
                return null;
@@ -1059,7 +1053,7 @@ _CalEventImpl::ConvertEventHandleToRecurrenceN(calendar_record_h eventHandle) co
        if (pExDates != null && strlen(pExDates) != 0)
        {
                r = ConvertRRuleExDateStringToRecurrence(pExDates, *pRecurrence.get());
-               SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. exdate = %s", pExDates);
+               SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_INVALID_ARG, "[%s] Invalid argument is used. exdate = %s", GetErrorMessage(E_INVALID_ARG), pExDates);
        }
 
        return pRecurrence.release();
@@ -1090,8 +1084,7 @@ _CalEventImpl::SetSubject(const String& subject)
        std::unique_ptr<char[]> pConvertedSubject(_StringConverter::CopyToCharArrayN(subject));
        SysTryReturnResult(NID_SCL, pConvertedSubject != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       int errorCode = CALENDAR_ERROR_NONE;
-       errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.summary, pConvertedSubject.get());
+       int errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.summary, pConvertedSubject.get());
        SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        return E_SUCCESS;
@@ -1109,8 +1102,7 @@ _CalEventImpl::SetDescription(const String& description)
        std::unique_ptr<char[]> pConvertedDescription(_StringConverter::CopyToCharArrayN(description));
        SysTryReturnResult(NID_SCL, pConvertedDescription != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       int errorCode = CALENDAR_ERROR_NONE;
-       errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.description, pConvertedDescription.get());
+       int errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.description, pConvertedDescription.get());
        SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        return E_SUCCESS;
@@ -1128,8 +1120,7 @@ _CalEventImpl::SetLocation(const String& location)
        std::unique_ptr<char[]> pConvertedLocation(_StringConverter::CopyToCharArrayN(location));
        SysTryReturnResult(NID_SCL, pConvertedLocation != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       int errorCode = CALENDAR_ERROR_NONE;
-       errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.location, pConvertedLocation.get());
+       int errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.location, pConvertedLocation.get());
        SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        return E_SUCCESS;
@@ -1187,7 +1178,6 @@ _CalEventImpl::SetStartAndEndTimeCommon(const DateTime& start, const DateTime& e
 void
 _CalEventImpl::SetCategory(EventCategory category)
 {
-       int errorCode = CALENDAR_ERROR_NONE;
        std::unique_ptr<char[]> pConvertedCategory;
 
        if (category == EVENT_CATEGORY_ANNIVERSARY)
@@ -1195,16 +1185,16 @@ _CalEventImpl::SetCategory(EventCategory category)
                SetAllDayEvent(true);
 
                pConvertedCategory.reset(_StringConverter::CopyToCharArrayN(_EVENT_CATEGORY_ANNIVERSARY_STRING));
-               SysTryReturnVoidResult(NID_SCL, pConvertedCategory != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+               SysTryReturnVoidResult(NID_SCL, pConvertedCategory != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
        }
        else
        {
                pConvertedCategory.reset(_StringConverter::CopyToCharArrayN(_EVENT_CATEGORY_APPOINTMENT_STRING));
-               SysTryReturnVoidResult(NID_SCL, pConvertedCategory != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+               SysTryReturnVoidResult(NID_SCL, pConvertedCategory != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
        }
 
-       errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.categories, pConvertedCategory.get());
-       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       int errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.categories, pConvertedCategory.get());
+       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 }
 
 void
@@ -1235,8 +1225,6 @@ _CalEventImpl::GetCoordinates(double& latitude, double& longitude) const
 result
 _CalEventImpl::SetReminder(const Reminder* pReminder)
 {
-       int errorCode = CALENDAR_ERROR_NONE;
-
        unsigned int reminderCount = 0;
        calendar_record_h tmpAlarmHandle = null;
 
@@ -1264,6 +1252,7 @@ _CalEventImpl::SetReminder(const Reminder* pReminder)
                }
 
                calendar_record_h tmpAlarmHandle = null;
+               int errorCode = CALENDAR_ERROR_NONE;
 
                if (reminderCount > 0)
                {
@@ -1312,12 +1301,9 @@ _CalEventImpl::SetReminder(const Reminder* pReminder)
 result
 _CalEventImpl::SetRecurrence(const Recurrence* pRecurrence)
 {
-       result r = E_SUCCESS;
-       int errorCode = CALENDAR_ERROR_NONE;
-
        if (pRecurrence != null)
        {
-               r = VerifyRecurrence(*pRecurrence);
+               result r = VerifyRecurrence(*pRecurrence);
                SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
                r = ResetStartAndEndTimeByRecurrence(*pRecurrence);
@@ -1327,7 +1313,7 @@ _CalEventImpl::SetRecurrence(const Recurrence* pRecurrence)
                SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
                std::unique_ptr<char[]> pExDates(_StringConverter::CopyToCharArrayN(ConvertRecurrenceToRRuleExDateString(*pRecurrence, IsAllDayEvent())));
-               errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.exdate, pExDates.get());
+               int errorCode = calendar_record_set_str(__eventRecord.GetHandle(), _calendar_event.exdate, pExDates.get());
                SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
                __pRecurrence.reset(new (std::nothrow) Recurrence(*pRecurrence));
@@ -1346,13 +1332,12 @@ _CalEventImpl::SetRecurrence(const Recurrence* pRecurrence)
 result
 _CalEventImpl::AddReminder(const Reminder& reminder)
 {
-       int errorCode = CALENDAR_ERROR_NONE;
        calendar_record_h tmpAlarmHandle = null;
 
        std::unique_ptr<char[]> pTmpAlarmTone(_StringConverter::CopyToCharArrayN(reminder.GetSoundFile()));
        SysTryReturnResult(NID_SCL, pTmpAlarmTone != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       errorCode = calendar_record_create(_calendar_alarm._uri, &tmpAlarmHandle);
+       int errorCode = calendar_record_create(_calendar_alarm._uri, &tmpAlarmHandle);
        SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        int convertedTimeUnit = 0;
@@ -1363,18 +1348,23 @@ _CalEventImpl::AddReminder(const Reminder& reminder)
        case REMINDER_TIME_UNIT_MINUTE:
                convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_MINUTE;
                break;
+
        case REMINDER_TIME_UNIT_HOUR:
                convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_HOUR;
                break;
+
        case REMINDER_TIME_UNIT_DAY:
                convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_DAY;
                break;
+
        case REMINDER_TIME_UNIT_WEEK:
                convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_WEEK;
                break;
+
        case REMINDER_TIME_UNIT_NONE:
                convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_SPECIFIC;
                break;
+
        default:
                break;
        }
@@ -1401,10 +1391,9 @@ _CalEventImpl::AddReminder(const Reminder& reminder)
 result
 _CalEventImpl::RemoveReminderAt(int index)
 {
-       int errorCode = CALENDAR_ERROR_NONE;
        calendar_record_h tmpAlarmHandle = null;
 
-       errorCode = calendar_record_get_child_record_at_p(__eventRecord.GetHandle(), _calendar_event.calendar_alarm, index, &tmpAlarmHandle);
+       calendar_record_get_child_record_at_p(__eventRecord.GetHandle(), _calendar_event.calendar_alarm, index, &tmpAlarmHandle);
        SysTryReturnResult(NID_SCL, tmpAlarmHandle != null, E_OUT_OF_RANGE, "The index is out of range. index = %d", index);
 
        calendar_record_remove_child_record(__eventRecord.GetHandle(), _calendar_event.calendar_alarm, tmpAlarmHandle);
@@ -1423,7 +1412,7 @@ _CalEventImpl::GetAllReminders(void) const
        if (__reminderListUpdated == false)
        {
                result r = _CalendarbookUtil::ConvertEventAlarmsToReminderList(__eventRecord.GetHandle(), __reminderList);
-               SysTryReturn(NID_SCL, r == E_SUCCESS, __reminderList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+               SysTryReturn(NID_SCL, r == E_SUCCESS, __reminderList, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
                __reminderListUpdated = true;
        }
@@ -1436,7 +1425,6 @@ _CalEventImpl::ConvertRecurrenceToEventHandle(const Recurrence& recurrence, cale
 {
        result r = E_SUCCESS;
 
-       int errorCode = CALENDAR_ERROR_NONE;
        int weekStart = CALENDAR_SUNDAY;
        std::unique_ptr<char[]> pByDay;
        std::unique_ptr<char[]> pByMonth;
@@ -1451,14 +1439,17 @@ _CalEventImpl::ConvertRecurrenceToEventHandle(const Recurrence& recurrence, cale
        case CAL_SUNDAY:
                weekStart = CALENDAR_SUNDAY;
                break;
+
        case CAL_MONDAY:
                weekStart = CALENDAR_MONDAY;
                break;
+
        default:
                SysLogException(NID_SCL, E_INVALID_ARG, "Invalid argument is passed. week start = %d", recurrence.GetWeekStart());
                return E_INVALID_ARG;
        }
-       errorCode = calendar_record_set_int(eventHandle, _calendar_event.wkst, weekStart);
+
+       int errorCode = calendar_record_set_int(eventHandle, _calendar_event.wkst, weekStart);
        SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_INVALID_ARG, "Invalid argument is passed. week start = %d", weekStart);
 
        if (recurrence.GetUntil() != null)
@@ -1503,6 +1494,7 @@ _CalEventImpl::ConvertRecurrenceToEventHandle(const Recurrence& recurrence, cale
        case FREQ_DAILY:
                calendar_record_set_int(eventHandle, _calendar_event.freq, CALENDAR_RECURRENCE_DAILY);
                break;
+
        case FREQ_WEEKLY:
                calendar_record_set_int(eventHandle, _calendar_event.freq, CALENDAR_RECURRENCE_WEEKLY);
 
@@ -1513,6 +1505,7 @@ _CalEventImpl::ConvertRecurrenceToEventHandle(const Recurrence& recurrence, cale
                pByDay.reset(_StringConverter::CopyToCharArrayN(dayOfWeekString));
 
                break;
+
        case FREQ_MONTHLY:
                calendar_record_set_int(eventHandle, _calendar_event.freq, CALENDAR_RECURRENCE_MONTHLY);
 
@@ -1530,6 +1523,7 @@ _CalEventImpl::ConvertRecurrenceToEventHandle(const Recurrence& recurrence, cale
                }
 
                break;
+
        case FREQ_YEARLY:
                calendar_record_set_int(eventHandle, _calendar_event.freq, CALENDAR_RECURRENCE_YEARLY);
 
@@ -1549,8 +1543,9 @@ _CalEventImpl::ConvertRecurrenceToEventHandle(const Recurrence& recurrence, cale
                }
 
                break;
+
        default:
-               SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. frequency = %d", recurrence.GetFrequency());
+               SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. frequency = %d", GetErrorMessage(E_INVALID_ARG), recurrence.GetFrequency());
                return E_INVALID_ARG;
        }
 
@@ -1736,7 +1731,6 @@ _CalEventImpl::VerifyRecurrence(const Recurrence& recurrence)
 result
 _CalEventImpl::ResetStartAndEndTimeByRecurrence(const Recurrence& recurrence)
 {
-       result r = E_SUCCESS;
        DateTime startTime;
        DateTime endTime;
 
@@ -1808,7 +1802,7 @@ _CalEventImpl::ResetStartAndEndTimeByRecurrence(const Recurrence& recurrence)
                        count++;
                }
 
-               r = calculatedStartTime.AddDays(count);
+               result r = calculatedStartTime.AddDays(count);
                SysTryReturnResult(NID_SCL, !IsFailed(r), r, "[%s][Propagating]", GetErrorMessage(r));
                r = calculatedEndTime.AddDays(count);
                SysTryReturnResult(NID_SCL, !IsFailed(r), r, "[%s][Propagating]", GetErrorMessage(r));
@@ -1933,11 +1927,10 @@ _CalEventImpl::ResetStartAndEndTimeByRecurrence(const Recurrence& recurrence)
 int
 _CalEventImpl::ConvertRRuleByDayStringToDayOfWeek(const String& byDay) const
 {
-       result r = E_SUCCESS;
        int dayOfWeek = 0;
        ClearLastResult();
 
-       SysTryReturn(NID_SCL, !byDay.IsEmpty(), 0, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The byDay is empty.");
+       SysTryReturn(NID_SCL, !byDay.IsEmpty(), 0, E_INVALID_ARG, "[%s] Invalid argument is used. The byDay is empty.", GetErrorMessage(E_INVALID_ARG));
 
        String delim(_RECURRENCE_DELIMITER);
        String token;
@@ -1945,8 +1938,8 @@ _CalEventImpl::ConvertRRuleByDayStringToDayOfWeek(const String& byDay) const
        StringTokenizer strTok(byDay, delim);
        while (strTok.HasMoreTokens())
        {
-               r = strTok.GetNextToken(token);
-               SysTryReturn(NID_SCL, r == E_SUCCESS, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+               result r = strTok.GetNextToken(token);
+               SysTryReturn(NID_SCL, r == E_SUCCESS, 0, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
                if (token == String(_RECURRENCE_KEYWORD_SUNDAY))
                {
@@ -1978,7 +1971,7 @@ _CalEventImpl::ConvertRRuleByDayStringToDayOfWeek(const String& byDay) const
                }
                else
                {
-                       SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. byday = %S", byDay.GetPointer());
+                       SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. byday = %S", GetErrorMessage(E_INVALID_ARG), byDay.GetPointer());
                        return 0;
                }
        }
@@ -1989,7 +1982,6 @@ _CalEventImpl::ConvertRRuleByDayStringToDayOfWeek(const String& byDay) const
 result
 _CalEventImpl::ConvertRRuleByDayStringToDayOfWeekAndWeekOfMonth(const String& byDay, int& weekOfMonth, int& dayOfWeek) const
 {
-       result r = E_SUCCESS;
        String delim(_RECURRENCE_DELIMITER);
        String token;
        wchar_t tmpChar = 0;
@@ -2006,7 +1998,7 @@ _CalEventImpl::ConvertRRuleByDayStringToDayOfWeekAndWeekOfMonth(const String& by
 
        while (strTok.HasMoreTokens())
        {
-               r = strTok.GetNextToken(token);
+               result r = strTok.GetNextToken(token);
                SysTryReturnResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
                r = token.GetCharAt(_RECURRENCE_BY_DAY_FIRST_INDEX, tmpChar);
@@ -2097,7 +2089,7 @@ _CalEventImpl::ConvertRRuleByDayStringToDayOfWeekAndWeekOfMonth(const String& by
                }
                else
                {
-                       SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. byday = %S", byDay.GetPointer());
+                       SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. byday = %S", GetErrorMessage(E_INVALID_ARG), byDay.GetPointer());
                }
        }
 
@@ -2107,8 +2099,6 @@ _CalEventImpl::ConvertRRuleByDayStringToDayOfWeekAndWeekOfMonth(const String& by
 result
 _CalEventImpl::ConvertRRuleExDateStringToRecurrence(const String& exdate, Recurrence& recurrence) const
 {
-       result r = E_SUCCESS;
-
        String delim(_RECURRENCE_DELIMITER);
        String token;
        DateTime tmpDateTime;
@@ -2121,7 +2111,7 @@ _CalEventImpl::ConvertRRuleExDateStringToRecurrence(const String& exdate, Recurr
        StringTokenizer strTok(exdate, delim);
        while (strTok.HasMoreTokens())
        {
-               r = strTok.GetNextToken(token);
+               result r = strTok.GetNextToken(token);
                SysTryReturnResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
                r = _CalendarbookUtil::ConvertRRuleDateTimeStringToDateTime(token, tmpDateTime, tmpTimeZone, isDate);
@@ -2147,7 +2137,7 @@ _CalEventImpl::ConvertRecurrenceToRRuleExDateString(const Recurrence& recurrence
 
        std::unique_ptr<IList, AllElementsDeleter> pExDateList(recurrence.GetExceptionDatesN());
 
-       IEnumerator* pEnum = pExDateList->GetEnumeratorN();
+       std::unique_ptr<IEnumerator> pEnum(pExDateList->GetEnumeratorN());
        while (pEnum->MoveNext() == E_SUCCESS)
        {
                DateTime* pDateTime = static_cast<DateTime*>(pEnum->GetCurrent());
@@ -2161,7 +2151,6 @@ _CalEventImpl::ConvertRecurrenceToRRuleExDateString(const Recurrence& recurrence
 
                isNotFirst = true;
        }
-       delete pEnum;
 
        return exdateString;
 }
@@ -2181,8 +2170,10 @@ _CalEventImpl::GetNextDayOfWeek(CalDayOfWeek currentDay)
 }
 
 DateTime
-_CalEventImpl::GetDate(int year, int month, int weekOfMonth, CalDayOfWeek dayOfWeek, const DateTime& time, const Locales::TimeZone& timeZone)
+_CalEventImpl::GetDate(int year, int month, int weekOfMonth, CalDayOfWeek dayOfWeek, const DateTime& time, const TimeZone& timeZone)
 {
+       ClearLastResult();
+
        Tizen::Locales::DayOfWeek dayOfWeekByGregorianCalendar = Tizen::Locales::DAY_OF_WEEK_UNDEFINED;
 
        switch (dayOfWeek)
@@ -2190,29 +2181,37 @@ _CalEventImpl::GetDate(int year, int month, int weekOfMonth, CalDayOfWeek dayOfW
        case CAL_SUNDAY:
                dayOfWeekByGregorianCalendar = Tizen::Locales::SUNDAY;
                break;
+
        case CAL_MONDAY:
                dayOfWeekByGregorianCalendar = Tizen::Locales::MONDAY;
                break;
+
        case CAL_TUESDAY:
                dayOfWeekByGregorianCalendar = Tizen::Locales::TUESDAY;
                break;
+
        case CAL_WEDNESDAY:
                dayOfWeekByGregorianCalendar = Tizen::Locales::WEDNESDAY;
                break;
+
        case CAL_THURSDAY:
                dayOfWeekByGregorianCalendar = Tizen::Locales::THURSDAY;
                break;
+
        case CAL_FRIDAY:
                dayOfWeekByGregorianCalendar = Tizen::Locales::FRIDAY;
                break;
+
        case CAL_SATURDAY:
                dayOfWeekByGregorianCalendar = Tizen::Locales::SATURDAY;
                break;
+
        default:
                break;
        }
 
-       Tizen::Locales::Calendar* pGregorianCalendar = Tizen::Locales::Calendar::CreateInstanceN(timeZone, Tizen::Locales::CALENDAR_GREGORIAN);
+       std::unique_ptr<Tizen::Locales::Calendar> pGregorianCalendar(Tizen::Locales::Calendar::CreateInstanceN(timeZone, Tizen::Locales::CALENDAR_GREGORIAN));
+       SysTryReturn(NID_SCL, pGregorianCalendar != null, DateTime(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
        pGregorianCalendar->SetTimeField(Tizen::Locales::TIME_FIELD_YEAR, year);
        pGregorianCalendar->SetTimeField(Tizen::Locales::TIME_FIELD_MONTH, month);
@@ -2231,17 +2230,18 @@ _CalEventImpl::GetDate(int year, int month, int weekOfMonth, CalDayOfWeek dayOfW
        DateTime resultTime;
        resultTime.SetValue(year, month, tmpDayOfMonth, time.GetHour(), time.GetMinute(), time.GetSecond());
 
-       delete pGregorianCalendar;
-
        return resultTime;
 }
 
 CalDayOfWeek
 _CalEventImpl::GetDayOfWeek(const DateTime& date, const Locales::TimeZone& timeZone)
 {
+       ClearLastResult();
+
        CalDayOfWeek dayOfWeek = CAL_SUNDAY;
 
        std::unique_ptr<Tizen::Locales::Calendar> pGregorianCalendar(Tizen::Locales::Calendar::CreateInstanceN(timeZone, Tizen::Locales::CALENDAR_GREGORIAN));
+       SysTryReturn(NID_SCL, pGregorianCalendar != null, dayOfWeek, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
        pGregorianCalendar->SetTime(date);
        int dayOfWeekByGregorianCalendar = pGregorianCalendar->GetTimeField(Tizen::Locales::TIME_FIELD_DAY_OF_WEEK);
@@ -2251,24 +2251,31 @@ _CalEventImpl::GetDayOfWeek(const DateTime& date, const Locales::TimeZone& timeZ
        case Tizen::Locales::SUNDAY:
                dayOfWeek = CAL_SUNDAY;
                break;
+
        case Tizen::Locales::MONDAY:
                dayOfWeek = CAL_MONDAY;
                break;
+
        case Tizen::Locales::TUESDAY:
                dayOfWeek = CAL_TUESDAY;
                break;
+
        case Tizen::Locales::WEDNESDAY:
                dayOfWeek = CAL_WEDNESDAY;
                break;
+
        case Tizen::Locales::THURSDAY:
                dayOfWeek = CAL_THURSDAY;
                break;
+
        case Tizen::Locales::FRIDAY:
                dayOfWeek = CAL_FRIDAY;
                break;
+
        case Tizen::Locales::SATURDAY:
                dayOfWeek = CAL_SATURDAY;
                break;
+
        default:
                break;
        }
index df732bc..d2eb436 100644 (file)
  * This file contains definitions of @e _CalEventInstanceImpl class.
  */
 
-#include <FBaseString.h>
 #include <FBaseDateTime.h>
+#include <FBaseString.h>
 #include <FSclCalEventInstance.h>
-#include "FScl_RecordImpl.h"
 #include "FScl_CalEventInstanceImpl.h"
+#include "FScl_RecordImpl.h"
 
 using namespace Tizen::Base;
 
index b30998f..903d0ad 100644 (file)
  * This file contains definitions of @e CalTodoImpl class.
  */
 
-#include <FBaseDateTime.h>
+#include <FApp_AppInfo.h>
 #include <FBaseColArrayList.h>
-#include <FSysSystemTime.h>
-#include <FSclTypes.h>
-#include <FSclRecord.h>
+#include <FBaseDateTime.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
 #include <FSclCalTodo.h>
+#include <FSclRecord.h>
 #include <FSclReminder.h>
 #include <FSclRecurrence.h>
-#include <FBaseSysLog.h>
-#include <FApp_AppInfo.h>
-#include <FBase_StringConverter.h>
+#include <FSysSystemTime.h>
+#include <FSclTypes.h>
+#include "FScl_CalendarbookDbConnector.h"
+#include "FScl_CalendarbookImpl.h"
 #include "FScl_CalTodoImpl.h"
 #include "FScl_RecordImpl.h"
-#include "FScl_CalendarbookImpl.h"
-#include "FScl_CalendarbookDbConnector.h"
 
+using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
-using namespace Tizen::App;
 
 namespace Tizen { namespace Social
 {
@@ -53,14 +53,13 @@ static const long long _CALENDAR_TODO_NO_DUE_DATE = 0x7fffffffffffffffLL;
 _CalTodoImpl::_CalTodoImpl(void)
        : __reminderListUpdated(false)
 {
-       int errorCode = CALENDAR_ERROR_NONE;
        calendar_record_h todoHandle = null;
 
        result r = _CalendarbookDbConnector::Connect();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 
-       errorCode = calendar_record_create(_calendar_todo._uri, &todoHandle);
-       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       int errorCode = calendar_record_create(_calendar_todo._uri, &todoHandle);
+       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
        {
@@ -106,25 +105,24 @@ _CalTodoImpl::_CalTodoImpl(void)
        __todoRecord.ResetHandle(todoHandle);
 
        r = __reminderList.Construct();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 }
 
 _CalTodoImpl::_CalTodoImpl(const _CalTodoImpl& rhs)
        : __reminderListUpdated(false)
 {
-       int errorCode = CALENDAR_ERROR_NONE;
        calendar_record_h todoHandle = null;
 
        result r = _CalendarbookDbConnector::Connect();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 
-       errorCode = calendar_record_clone(rhs.__todoRecord.GetHandle(), &todoHandle);
-       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       int errorCode = calendar_record_clone(rhs.__todoRecord.GetHandle(), &todoHandle);
+       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        __todoRecord.ResetHandle(todoHandle);
 
        r = __reminderList.Construct();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 }
 
 _CalTodoImpl::~_CalTodoImpl(void)
@@ -132,7 +130,7 @@ _CalTodoImpl::~_CalTodoImpl(void)
        __reminderList.RemoveAll(true);
 
        result r = _CalendarbookDbConnector::Disconnect();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 }
 
 _CalTodoImpl&
@@ -146,11 +144,10 @@ _CalTodoImpl::operator =(const _CalTodoImpl& rhs)
        __reminderList.RemoveAll(true);
        __reminderListUpdated = false;
 
-       int errorCode = CALENDAR_ERROR_NONE;
        calendar_record_h todoHandle = null;
 
-       errorCode = calendar_record_clone(rhs.__todoRecord.GetHandle(), &todoHandle);
-       SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, *this, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       int errorCode = calendar_record_clone(rhs.__todoRecord.GetHandle(), &todoHandle);
+       SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        __todoRecord.ResetHandle(todoHandle);
 
@@ -231,14 +228,17 @@ _CalTodoImpl::GetPriority(void) const
        case CALENDAR_TODO_PRIORITY_LOW:
                priority = TODO_PRIORITY_LOW;
                break;
+
        case CALENDAR_TODO_PRIORITY_NONE:
                // fall through
        case CALENDAR_TODO_PRIORITY_NORMAL:
                priority = TODO_PRIORITY_NORMAL;
                break;
+
        case CALENDAR_TODO_PRIORITY_HIGH:
                priority = TODO_PRIORITY_HIGH;
                break;
+
        default:
                SysLog(NID_SCL, "The priority value is invalid. priority = %d", srcPriority);
                priority = TODO_PRIORITY_NORMAL;
@@ -262,18 +262,23 @@ _CalTodoImpl::GetStatus(void) const
        case CALENDAR_TODO_STATUS_NONE:
                status = TODO_STATUS_NONE;
                break;
+
        case CALENDAR_TODO_STATUS_NEEDS_ACTION:
                status = TODO_STATUS_NEEDS_ACTION;
                break;
+
        case CALENDAR_TODO_STATUS_COMPLETED:
                status = TODO_STATUS_COMPLETED;
                break;
+
        case CALENDAR_TODO_STATUS_IN_PROCESS:
                status = TODO_STATUS_IN_PROCESS;
                break;
+
        case CALENDAR_TODO_STATUS_CANCELED:
                status = TODO_STATUS_CANCELLED;
                break;
+
        default:
                SysLog(NID_SCL, "The status value is invalid. status = %d", srcStatus);
                status = TODO_STATUS_NONE;
@@ -296,12 +301,15 @@ _CalTodoImpl::GetSensitivity(void) const
        case CALENDAR_SENSITIVITY_PUBLIC:
                sensitivity = SENSITIVITY_PUBLIC;
                break;
+
        case CALENDAR_SENSITIVITY_PRIVATE:
                sensitivity = SENSITIVITY_PRIVATE;
                break;
+
        case CALENDAR_SENSITIVITY_CONFIDENTIAL:
                sensitivity = SENSITIVITY_CONFIDENTIAL;
                break;
+
        default:
                SysLog(NID_SCL, "The sensitivity value is invalid. sensitivity = %d", srcSensitivity);
                sensitivity = SENSITIVITY_PUBLIC;
@@ -315,13 +323,10 @@ DateTime
 _CalTodoImpl::GetLastRevisedTime(void) const
 {
        long long lastModifiedTime = 0;
-       DateTime tmpLastRevisedTime;
 
        calendar_record_get_lli(__todoRecord.GetHandle(), _calendar_todo.last_modified_time, &lastModifiedTime);
 
-       tmpLastRevisedTime = _CalendarbookUtil::ConvertEpochTimeToDateTime(lastModifiedTime);
-
-       return tmpLastRevisedTime;
+       return _CalendarbookUtil::ConvertEpochTimeToDateTime(lastModifiedTime);
 }
 
 result
@@ -336,8 +341,7 @@ _CalTodoImpl::SetSubject(const String& subject)
        std::unique_ptr<char[]> pConvertedSubject(_StringConverter::CopyToCharArrayN(subject));
        SysTryReturnResult(NID_SCL, pConvertedSubject != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       int errorCode = CALENDAR_ERROR_NONE;
-       errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.summary, pConvertedSubject.get());
+       int errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.summary, pConvertedSubject.get());
        SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        return E_SUCCESS;
@@ -355,8 +359,7 @@ _CalTodoImpl::SetDescription(const String& description)
        std::unique_ptr<char[]> pConvertedDescription(_StringConverter::CopyToCharArrayN(description));
        SysTryReturnResult(NID_SCL, pConvertedDescription != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       int errorCode = CALENDAR_ERROR_NONE;
-       errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.description, pConvertedDescription.get());
+       int errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.description, pConvertedDescription.get());
        SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        return E_SUCCESS;
@@ -395,7 +398,7 @@ _CalTodoImpl::SetStartDate(const DateTime& startDate)
        }
        else if (startDate < _CalendarbookImpl::GetMinDateTime() || startDate > _CalendarbookImpl::GetMaxDateTime())
        {
-               SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used.  The startDate is invalid.");
+               SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used.  The startDate is invalid.", GetErrorMessage(E_INVALID_ARG));
                return E_INVALID_ARG;
        }
        else
@@ -429,7 +432,7 @@ _CalTodoImpl::SetDueDate(const DateTime& dueDate)
        }
        else if (dueDate < _CalendarbookImpl::GetMinDateTime() || dueDate > _CalendarbookImpl::GetMaxDateTime())
        {
-               SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used.  The dueDate is invalid.");
+               SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used.  The dueDate is invalid.", GetErrorMessage(E_INVALID_ARG));
                return E_INVALID_ARG;
        }
        else
@@ -473,11 +476,10 @@ void
 _CalTodoImpl::SetLocation(const String& location)
 {
        std::unique_ptr<char[]> pConvertedLocation(_StringConverter::CopyToCharArrayN(location));
-       SysTryReturnVoidResult(NID_SCL, pConvertedLocation != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturnVoidResult(NID_SCL, pConvertedLocation != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
-       int errorCode = CALENDAR_ERROR_NONE;
-       errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.location, pConvertedLocation.get());
-       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       int errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.location, pConvertedLocation.get());
+       SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 }
 
 String
@@ -512,13 +514,12 @@ _CalTodoImpl::GetCoordinates(double& latitude, double& longitude) const
 result
 _CalTodoImpl::AddReminder(const Reminder& reminder)
 {
-       int errorCode = CALENDAR_ERROR_NONE;
        calendar_record_h tmpAlarmHandle = null;
 
        std::unique_ptr<char[]> pTmpAlarmTone(_StringConverter::CopyToCharArrayN(reminder.GetSoundFile()));
        SysTryReturnResult(NID_SCL, pTmpAlarmTone != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       errorCode = calendar_record_create(_calendar_alarm._uri, &tmpAlarmHandle);
+       int errorCode = calendar_record_create(_calendar_alarm._uri, &tmpAlarmHandle);
        SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        int convertedTimeUnit = 0;
@@ -529,18 +530,23 @@ _CalTodoImpl::AddReminder(const Reminder& reminder)
        case REMINDER_TIME_UNIT_MINUTE:
                convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_MINUTE;
                break;
+
        case REMINDER_TIME_UNIT_HOUR:
                convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_HOUR;
                break;
+
        case REMINDER_TIME_UNIT_DAY:
                convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_DAY;
                break;
+
        case REMINDER_TIME_UNIT_WEEK:
                convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_WEEK;
                break;
+
        case REMINDER_TIME_UNIT_NONE:
                convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_SPECIFIC;
                break;
+
        default:
                break;
        }
@@ -567,10 +573,9 @@ _CalTodoImpl::AddReminder(const Reminder& reminder)
 result
 _CalTodoImpl::RemoveReminderAt(int index)
 {
-       int errorCode = CALENDAR_ERROR_NONE;
        calendar_record_h tmpAlarmHandle = null;
 
-       errorCode = calendar_record_get_child_record_at_p(__todoRecord.GetHandle(), _calendar_todo.calendar_alarm, index, &tmpAlarmHandle);
+       calendar_record_get_child_record_at_p(__todoRecord.GetHandle(), _calendar_todo.calendar_alarm, index, &tmpAlarmHandle);
        SysTryReturnResult(NID_SCL, tmpAlarmHandle != null, E_OUT_OF_RANGE, "The index is either equal to or greater than the number of reminders or less than 0.");
 
        calendar_record_remove_child_record(__todoRecord.GetHandle(), _calendar_todo.calendar_alarm, tmpAlarmHandle);
@@ -589,7 +594,7 @@ _CalTodoImpl::GetAllReminders(void) const
        if (__reminderListUpdated == false)
        {
                result r = _CalendarbookUtil::ConvertTodoAlarmsToReminderList(__todoRecord.GetHandle(), __reminderList);
-               SysTryReturn(NID_SCL, r == E_SUCCESS, __reminderList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+               SysTryReturn(NID_SCL, r == E_SUCCESS, __reminderList, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
                __reminderListUpdated = true;
        }
@@ -637,4 +642,4 @@ _CalTodoImpl::GetInstance(const CalTodo& todo)
        return todo.__pCalTodoImpl;
 }
 
-}}     //OSP::Social
+}}     // Tizen::Social
index 1c78013..25fdd42 100644 (file)
  *
  */
 
-#include <FBaseRtIEventListener.h>
 #include <FBaseRtIEventArg.h>
+#include <FBaseRtIEventListener.h>
 #include <FBaseSysLog.h>
-#include "FScl_ICalendarbookDbChangeEventListener.h"
-#include "FScl_CalendarbookDbChangeEventArg.h"
 #include "FScl_CalendarbookDbChangeEvent.h"
+#include "FScl_CalendarbookDbChangeEventArg.h"
+#include "FScl_ICalendarbookDbChangeEventListener.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Runtime;
index bfd827f..0bff62f 100644 (file)
@@ -24,8 +24,8 @@
 #ifndef _FSCL_INTERNAL_CALENDARBOOK_DB_CHANGE_EVENT_H_
 #define _FSCL_INTERNAL_CALENDARBOOK_DB_CHANGE_EVENT_H_
 
-#include <FBaseTypes.h>
 #include <FBaseResult.h>
+#include <FBaseTypes.h>
 #include <FBaseRt_Event.h>
 
 namespace Tizen { namespace Base { namespace Runtime
index cf9f370..08bd664 100644 (file)
@@ -24,8 +24,8 @@
 #define _FSCL_INTERNAL_CALENDARBOOK_DB_CHANGE_EVENT_ARG_H_
 
 #include <FBaseObject.h>
-#include <FSclRecord.h>
 #include <FBaseRtIEventArg.h>
+#include <FSclRecord.h>
 
 namespace Tizen { namespace Social
 {
index 12641f7..18c1f9f 100644 (file)
@@ -53,7 +53,7 @@ _CalendarbookDbConnector::Connect(void)
                if (GetLastResult() != E_SUCCESS)
                {
                        onceBlock = PTHREAD_ONCE_INIT;
-                       SysLogException(NID_SCL, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+                       SysLogException(NID_SCL, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
                        return E_SYSTEM;
                }
 
@@ -74,7 +74,7 @@ _CalendarbookDbConnector::Connect(void)
 
                System::SystemTime::GetTicks(endTicks);
 
-               SysTryCatch(NID_SCL, errorCode == CALENDAR_ERROR_NONE, , E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Elapsed time : %lld (milliseconds)", endTicks - startTicks);
+               SysTryCatch(NID_SCL, errorCode == CALENDAR_ERROR_NONE, , E_SYSTEM, "[%s] A system error has been occurred. Elapsed time : %lld (milliseconds)", GetErrorMessage(E_SYSTEM), endTicks - startTicks);
                __connectingCount = 0;
        }
 
@@ -104,7 +104,7 @@ _CalendarbookDbConnector::Disconnect(void)
        if (__connectingCount == 0)
        {
                int errorCode = calendar_disconnect();
-               SysTryCatch(NID_SCL, errorCode == CALENDAR_ERROR_NONE, , E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+               SysTryCatch(NID_SCL, errorCode == CALENDAR_ERROR_NONE, , E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
        }
 
        r = __mutex.Release();
@@ -130,7 +130,7 @@ void
 _CalendarbookDbConnector::InitCalendarbookDbConnector(void)
 {
        result r = __mutex.Create();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 }
 
 }}  // Tizen::Social
index 5a49986..d41f90c 100644 (file)
@@ -83,7 +83,7 @@ _CalendarbookDbMonitor::_CalendarbookDbMonitor(void)
 _CalendarbookDbMonitor::~_CalendarbookDbMonitor(void)
 {
        result r = _CalendarbookDbConnector::Disconnect();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 }
 
 result
@@ -101,7 +101,7 @@ _CalendarbookDbMonitor::Construct(void)
        SysTryReturnResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "A system error has been occurred.");
 
        std::unique_ptr<_CalendarbookDbChangeEvent> pEvent(new (std::nothrow) _CalendarbookDbChangeEvent());
-       SysTryReturn(NID_SCL, pEvent != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturn(NID_SCL, pEvent != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        r = pEvent->Construct();
        SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -167,12 +167,12 @@ _CalendarbookDbMonitor::GetInstance(void)
                if (GetLastResult() != E_SUCCESS)
                {
                        onceBlock = PTHREAD_ONCE_INIT;
-                       SysLogException(NID_SCL, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+                       SysLogException(NID_SCL, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
                        return null;
                }
 
                pCalendarbookDbMonitor.reset(new (std::nothrow) _CalendarbookDbMonitor());
-               SysTryReturn(NID_SCL, pCalendarbookDbMonitor != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+               SysTryReturn(NID_SCL, pCalendarbookDbMonitor != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
                r = pCalendarbookDbMonitor->Construct();
                SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -181,7 +181,7 @@ _CalendarbookDbMonitor::GetInstance(void)
        }
 
        r = __mutex.Acquire();
-       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 
        if (pCalendarbookDbMonitor != null)
        {
@@ -191,7 +191,7 @@ _CalendarbookDbMonitor::GetInstance(void)
        __refCnt++;
 
        r = __mutex.Release();
-       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 
        return __pCalendarbookDbMonitor;
 }
@@ -200,7 +200,7 @@ void
 _CalendarbookDbMonitor::Release(void)
 {
        result r = __mutex.Acquire();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 
        __refCnt--;
 
@@ -211,7 +211,7 @@ _CalendarbookDbMonitor::Release(void)
        }
 
        r = __mutex.Release();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 }
 
 void
@@ -235,7 +235,7 @@ _CalendarbookDbMonitor::OnCalendarbookDbChanged(const char* pViewUri, void* pUse
        }
 
        std::unique_ptr<_CalendarbookDbChangeEventArg> pArg(new (std::nothrow) _CalendarbookDbChangeEventArg(changeType));
-       SysTryReturnVoidResult(NID_SCL, pArg != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturnVoidResult(NID_SCL, pArg != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        result r = pEvent->Fire(*pArg.get());
        SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -247,7 +247,7 @@ void
 _CalendarbookDbMonitor::InitCalendarbookDbMonitor(void)
 {
        result r = __mutex.Create();
-       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 }
 
 }}  // Tizen::Social
index 960b861..4ab8ad6 100644 (file)
@@ -24,9 +24,9 @@
 #define _FSCL_INTERNAL_CALENDARBOOK_DB_MONITOR_H_
 
 #include <unique_ptr.h>
-#include <FBaseTypes.h>
-#include <FBaseResult.h>
 #include <FBaseObject.h>
+#include <FBaseResult.h>
+#include <FBaseTypes.h>
 
 namespace Tizen { namespace Base { namespace Runtime
 {
index 659f0fc..5f39d40 100644 (file)
@@ -238,21 +238,27 @@ _CalendarbookFilterImpl::GetMatchIntFlag(FilterComparisonOperator comparisonOper
        case FI_CMP_OP_EQUAL:
                match = CALENDAR_MATCH_EQUAL;
                break;
+
        case FI_CMP_OP_LESS_THAN:
                match = CALENDAR_MATCH_LESS_THAN;
                break;
+
        case FI_CMP_OP_LESS_THAN_OR_EQUAL:
                match = CALENDAR_MATCH_LESS_THAN_OR_EQUAL;
                break;
+
        case FI_CMP_OP_GREATER_THAN:
                match = CALENDAR_MATCH_GREATER_THAN;
                break;
+
        case FI_CMP_OP_GREATER_THAN_OR_EQUAL:
                match = CALENDAR_MATCH_GREATER_THAN_OR_EQUAL;
                break;
+
        case FI_CMP_OP_IS_NULL:
                match = CALENDAR_MATCH_NONE;
                break;
+
        default:
                match = CALENDAR_MATCH_NONE;
                break;
@@ -270,21 +276,27 @@ _CalendarbookFilterImpl::GetMatchStrFlag(FilterStringOperator stringOperstor)
        case FI_STR_OP_EQUAL:
                match = CALENDAR_MATCH_EXACTLY;
                break;
+
        case FI_STR_OP_FULL_STRING:
                match = CALENDAR_MATCH_FULLSTRING;
                break;
+
        case FI_STR_OP_START_WITH:
                match = CALENDAR_MATCH_STARTSWITH;
                break;
+
        case FI_STR_OP_END_WITH:
                match = CALENDAR_MATCH_ENDSWITH;
                break;
+
        case FI_STR_OP_CONTAIN:
                match = CALENDAR_MATCH_CONTAINS;
                break;
+
        case FI_STR_OP_IS_NOT_NULL:
                match = CALENDAR_MATCH_EXISTS;
                break;
+
        default:
                match = CALENDAR_MATCH_EXISTS;
                break;
@@ -314,39 +326,51 @@ _CalendarbookFilterImpl::AppendInt(FilterConjunctiveOperator conjunctiveOperator
        case EVENT_FI_PR_BUSY_STATUS:
                convertedValue = _CalendarbookUtil::ConvertBusyStatusToCSEventBusyStatus(value);
                break;
+
        case EVENT_FI_PR_PRIORITY:
                convertedValue = _CalendarbookUtil::ConvertEventPriorityToCSEventPriority(value);
                break;
+
        case EVENT_FI_PR_SENSITIVITY:
                convertedValue = _CalendarbookUtil::ConvertSensitivityToCSSensitivity(value);
                break;
+
        case EVENT_FI_PR_STATUS:
                convertedValue = _CalendarbookUtil::ConvertEventStatusToCSEventStatus(value);
                break;
+
        case TODO_FI_PR_PRIORITY:
                convertedValue = _CalendarbookUtil::ConvertTodoPriorityToCSTodoPriority(value);
                break;
+
        case TODO_FI_PR_SENSITIVITY:
                convertedValue = _CalendarbookUtil::ConvertSensitivityToCSSensitivity(value);
                break;
+
        case TODO_FI_PR_STATUS:
                convertedValue = _CalendarbookUtil::ConvertTodoStatusToCSTodoStatus(value);
                break;
+
        case CALENDAR_FI_PR_ITEM_TYPE:
                convertedValue = _CalendarbookUtil::ConvertCalendarItemTypeToCSCalendarbookType(value);
                break;
+
        case EVENT_INST_FI_PR_BUSY_STATUS:
                convertedValue = _CalendarbookUtil::ConvertBusyStatusToCSEventBusyStatus(value);
                break;
+
        case EVENT_INST_FI_PR_PRIORITY:
                convertedValue = _CalendarbookUtil::ConvertEventPriorityToCSEventPriority(value);
                break;
+
        case EVENT_INST_FI_PR_SENSITIVITY:
                convertedValue = _CalendarbookUtil::ConvertSensitivityToCSSensitivity(value);
                break;
+
        case EVENT_INST_FI_PR_STATUS:
                convertedValue = _CalendarbookUtil::ConvertEventStatusToCSEventStatus(value);
                break;
+
        default:
                convertedValue = value;
                break;
index 2c34452..1e88d44 100644 (file)
@@ -23,9 +23,9 @@
 #define _FSCL_CALENDARBOOK_FILTER_IMPL_H_
 
 #include <calendar2.h>
+#include <FBaseObject.h>
 #include <FBaseTypes.h>
 #include <FSclTypes.h>
-#include <FBaseObject.h>
 
 namespace Tizen { namespace Base
 {
index dba00b0..76d2d54 100644 (file)
  * This file contains definitions of @e _CalendarbookRecordRetrivalEvent class.
  */
 
-#include <FSclIRecordListener.h>
 #include <FBaseSysLog.h>
-#include "FScl_CalendarbookRecordRetrivalEventArg.h"
+#include <FSclIRecordListener.h>
 #include "FScl_CalendarbookRecordRetrivalEvent.h"
+#include "FScl_CalendarbookRecordRetrivalEventArg.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Runtime;
index 579edc2..9e67adf 100644 (file)
@@ -24,8 +24,8 @@
 #ifndef _FSCL_INTERNAL_CALENDARBOOK_RECORD_RETRIVAL_EVENT_H_
 #define _FSCL_INTERNAL_CALENDARBOOK_RECORD_RETRIVAL_EVENT_H_
 
-#include <FBaseTypes.h>
 #include <FBaseResult.h>
+#include <FBaseTypes.h>
 #include <FBaseRt_Event.h>
 
 namespace Tizen { namespace Base { namespace Runtime
index 5dac05f..6af8272 100644 (file)
@@ -23,8 +23,8 @@
 #ifndef _FSCL_INTERNAL_CALENDARBOOK_RECORD_RETRIVAL_EVENT_ARG_H_
 #define _FSCL_INTERNAL_CALENDARBOOK_RECORD_RETRIVAL_EVENT_ARG_H_
 
-#include <FBaseObject.h>
 #include <FBaseDataType.h>
+#include <FBaseObject.h>
 #include <FBaseRtIEventArg.h>
 
 namespace Tizen { namespace Base { namespace Collection
index 7f0e2b8..c9289f6 100644 (file)
@@ -19,9 +19,9 @@
  *
  */
 
+#include <FBaseColAllElementsDeleter.h>
 #include <FBaseColIList.h>
 #include <FBaseSysLog.h>
-#include <FBaseColAllElementsDeleter.h>
 #include "FScl_CalendarbookImpl.h"
 #include "FScl_CalendarbookRecordRetrivalEvent.h"
 #include "FScl_CalendarbookRecordRetrivalEventArg.h"
@@ -83,18 +83,18 @@ _CalendarbookRecordRetrivalThread::Run(void)
        SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = _CalendarbookDbConnector::Connect();
-       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 
        pList.reset(calendarbookImpl.GetEventInstancesCommonN(__start, __end, __timeZone, __pageNo, __countPerPage, __category));
        r = GetLastResult();
        SysTryCatch(NID_SCL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
        pEventArg.reset(new (std::nothrow) _CalendarbookRecordRetrivalEventArg(__requestId, pList.get(), r));
-       SysTryCatch(NID_SCL, pEventArg != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryCatch(NID_SCL, pEventArg != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
        pList.release();
 
        r = _CalendarbookDbConnector::Disconnect();
-       SysTryCatch(NID_SCL, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryCatch(NID_SCL, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 
        r = __pEvent->Fire(*pEventArg.get());
        SysTryCatch(NID_SCL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
index 78ef761..6b86263 100644 (file)
 #define _FSCL_INTERNAL_CALENDARBOOK_RECORD_RETRIVAL_THREAD_H_
 
 #include <unique_ptr.h>
-#include <FBaseTypes.h>
+#include <FBaseDateTime.h>
 #include <FBaseDataType.h>
 #include <FBaseObject.h>
-#include <FBaseDateTime.h>
 #include <FBaseRtThread.h>
+#include <FBaseTypes.h>
 #include <FLclTimeZone.h>
 
 namespace Tizen { namespace Social
index 261a914..feaff0c 100644 (file)
 #include <new>
 #include <string.h>
 #include <unique_ptr.h>
-#include <FBaseResult.h>
-#include <FBaseDateTime.h>
 #include <FBaseColIList.h>
+#include <FBaseDateTime.h>
+#include <FBaseResult.h>
+#include <FBaseSysLog.h>
 #include <FBaseUtilStringUtil.h>
-#include <FLclTimeZone.h>
 #include <FLclGregorianCalendar.h>
+#include <FLclTimeZone.h>
 #include <FSclReminder.h>
-#include <FBaseSysLog.h>
-#include <FBase_StringConverter.h>
 #include <FApp_AppInfo.h>
+#include <FBase_StringConverter.h>
 #include "FScl_CalendarbookImpl.h"
 #include "FScl_CalendarbookUtil.h"
 
 using namespace Tizen::Base;
-using namespace Tizen::Base::Utility;
 using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
 
 namespace Tizen { namespace Social
 {
 
 static const byte _CALENDARBOOK_BYTE_VALUE_9 = 0x09;
-static const int CALENDARBOOK_DEC_ASCII_MASK = 0x30;
-static const int CALENDARBOOK_CHAR_ASCII_DIFF = 55;
+static const int _CALENDARBOOK_DEC_ASCII_MASK = 0x30;
+static const int _CALENDARBOOK_CHAR_ASCII_DIFF = 55;
 
 static const int _CALENDARBOOK_MSEC_UNIT = 1000;
 static const long long _CALENDARBOOK_EPOCH_YEAR_INTERVAL_SECONDS = 62135596800;
@@ -70,6 +70,8 @@ static const int _CALENDARBOOK_TIME_MINUTE_STRING_LENGTH = 2;
 static const int _CALENDARBOOK_TIME_SECOND_STRING_LENGTH = 2;
 static const wchar_t* _CALENDARBOOK_ZERO_STRING = L"0";
 
+static const int _INVALID_MAX_DAYS_OF_MONTH = 0;
+
 long long int
 _CalendarbookUtil::ConvertDateTimeToEpochTime(const DateTime& dateTime)
 {
@@ -89,7 +91,7 @@ _CalendarbookUtil::ConvertByteBufferToCharArrayN(const ByteBuffer& byteBuffer)
 {
        int byteBufferLength = byteBuffer.GetCapacity();
        char* pCharArray = new (std::nothrow) char[byteBufferLength * 2 + 1];
-       SysTryReturn(NID_SCL, pCharArray != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturn(NID_SCL, pCharArray != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        const byte* pByteBufferPtr = byteBuffer.GetPointer();
 
@@ -101,22 +103,22 @@ _CalendarbookUtil::ConvertByteBufferToCharArrayN(const ByteBuffer& byteBuffer)
 
                if (tmpByte <= _CALENDARBOOK_BYTE_VALUE_9)
                {
-                       pCharArray[i * 2] = tmpByte | CALENDARBOOK_DEC_ASCII_MASK;
+                       pCharArray[i * 2] = tmpByte | _CALENDARBOOK_DEC_ASCII_MASK;
                }
                else
                {
-                       pCharArray[i * 2] = tmpByte + CALENDARBOOK_CHAR_ASCII_DIFF;
+                       pCharArray[i * 2] = tmpByte + _CALENDARBOOK_CHAR_ASCII_DIFF;
                }
 
                tmpByte = pByteBufferPtr[i] & 0x0F;
 
                if (tmpByte <= _CALENDARBOOK_BYTE_VALUE_9)
                {
-                       pCharArray[i * 2 + 1] = tmpByte | CALENDARBOOK_DEC_ASCII_MASK;
+                       pCharArray[i * 2 + 1] = tmpByte | _CALENDARBOOK_DEC_ASCII_MASK;
                }
                else
                {
-                       pCharArray[i * 2 + 1] = tmpByte + CALENDARBOOK_CHAR_ASCII_DIFF;
+                       pCharArray[i * 2 + 1] = tmpByte + _CALENDARBOOK_CHAR_ASCII_DIFF;
                }
        }
 
@@ -129,11 +131,11 @@ ByteBuffer*
 _CalendarbookUtil::ConvertCharArrayToByteBufferN(const char* pCharArray)
 {
        int charArrayLength = strlen(pCharArray);
-       SysTryReturn(NID_SCL, charArrayLength > 0, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
+       SysTryReturn(NID_SCL, charArrayLength > 0, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
 
        int byteBufferLength = 0;
        std::unique_ptr<byte[]> pByteArray(new (std::nothrow) byte[charArrayLength/2]);
-       SysTryReturn(NID_SCL, pByteArray != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturn(NID_SCL, pByteArray != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        bool inProgress = false;
        char tmpChar = 0;
@@ -149,7 +151,7 @@ _CalendarbookUtil::ConvertCharArrayToByteBufferN(const char* pCharArray)
                }
                else if (tmpChar >= 'A' && tmpChar <= 'F')
                {
-                       tmpChar -= CALENDARBOOK_CHAR_ASCII_DIFF;
+                       tmpChar -= _CALENDARBOOK_CHAR_ASCII_DIFF;
                }
                else
                {
@@ -172,9 +174,9 @@ _CalendarbookUtil::ConvertCharArrayToByteBufferN(const char* pCharArray)
 
        result r = E_SUCCESS;
        std::unique_ptr<ByteBuffer> pByteBuffer(new (std::nothrow) ByteBuffer());
-       SysTryReturn(NID_SCL, pByteBuffer != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturn(NID_SCL, pByteBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
        r = pByteBuffer->Construct(byteBufferLength);
-       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
        r = pByteBuffer->SetArray(pByteArray.get(), 0, byteBufferLength);
        pByteBuffer->Rewind();
 
@@ -217,15 +219,19 @@ _CalendarbookUtil::ConvertEventAlarmsToReminderList(calendar_record_h calendarRe
                case CALENDAR_ALARM_TIME_UNIT_MINUTE:
                        pReminder->SetTimeOffset(REMINDER_TIME_UNIT_MINUTE, tmpAlarmTick);
                        break;
+
                case CALENDAR_ALARM_TIME_UNIT_HOUR:
                        pReminder->SetTimeOffset(REMINDER_TIME_UNIT_HOUR, tmpAlarmTick);
                        break;
+
                case CALENDAR_ALARM_TIME_UNIT_DAY:
                        pReminder->SetTimeOffset(REMINDER_TIME_UNIT_DAY, tmpAlarmTick);
                        break;
+
                case CALENDAR_ALARM_TIME_UNIT_WEEK:
                        pReminder->SetTimeOffset(REMINDER_TIME_UNIT_WEEK, tmpAlarmTick);
                        break;
+
                case CALENDAR_ALARM_TIME_UNIT_MONTH:
                        {
                                calendar_time_s startCalendarTime;
@@ -247,17 +253,22 @@ _CalendarbookUtil::ConvertEventAlarmsToReminderList(calendar_record_h calendarRe
                                pReminder->SetTimeOffset(REMINDER_TIME_UNIT_DAY, tmpAlarmTick * maxDays);
                        }
                        break;
+
                case CALENDAR_ALARM_TIME_UNIT_SPECIFIC:
                        if (Tizen::App::_AppInfo::GetApiVersion() > _API_VERSION_2_0)
                        {
                                pReminder->SetAbsoluteTime(_CalendarbookUtil::ConvertEpochTimeToDateTime(tmpAlarmTime));
                        }
                        break;
+
                default :
                        break;
                }
 
-               reminderList.Add(*pReminder.release());
+               result r = reminderList.Add(pReminder.get());
+               SysTryReturnResult(NID_SCL, !IsFailed(r), r, "Propagating.");
+
+               pReminder.release();
        }
 
        return E_SUCCESS;
@@ -299,15 +310,19 @@ _CalendarbookUtil::ConvertTodoAlarmsToReminderList(calendar_record_h calendarRec
                case CALENDAR_ALARM_TIME_UNIT_MINUTE:
                        pReminder->SetTimeOffset(REMINDER_TIME_UNIT_MINUTE, tmpAlarmTick);
                        break;
+
                case CALENDAR_ALARM_TIME_UNIT_HOUR:
                        pReminder->SetTimeOffset(REMINDER_TIME_UNIT_HOUR, tmpAlarmTick);
                        break;
+
                case CALENDAR_ALARM_TIME_UNIT_DAY:
                        pReminder->SetTimeOffset(REMINDER_TIME_UNIT_DAY, tmpAlarmTick);
                        break;
+
                case CALENDAR_ALARM_TIME_UNIT_WEEK:
                        pReminder->SetTimeOffset(REMINDER_TIME_UNIT_WEEK, tmpAlarmTick);
                        break;
+
                case CALENDAR_ALARM_TIME_UNIT_MONTH:
                        {
                                calendar_time_s startCalendarTime;
@@ -329,17 +344,22 @@ _CalendarbookUtil::ConvertTodoAlarmsToReminderList(calendar_record_h calendarRec
                                pReminder->SetTimeOffset(REMINDER_TIME_UNIT_DAY, tmpAlarmTick * maxDays);
                        }
                        break;
+
                case CALENDAR_ALARM_TIME_UNIT_SPECIFIC:
                        if (Tizen::App::_AppInfo::GetApiVersion() > _API_VERSION_2_0)
                        {
                                pReminder->SetAbsoluteTime(_CalendarbookUtil::ConvertEpochTimeToDateTime(tmpAlarmTime));
                        }
                        break;
+
                default :
                        break;
                }
 
-               reminderList.Add(*pReminder.release());
+               result r = reminderList.Add(pReminder.get());
+               SysTryReturnResult(NID_SCL, !IsFailed(r), r, "Propagating.");
+
+               pReminder.release();
        }
 
        return E_SUCCESS;
@@ -425,7 +445,7 @@ _CalendarbookUtil::ConvertRRuleDateTimeStringToDateTime(const String& dateTimeSt
        }
        else
        {
-               SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. date time string = %S", dateTimeString.GetPointer());
+               SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. date time string = %S", GetErrorMessage(E_INVALID_ARG), dateTimeString.GetPointer());
                return E_INVALID_ARG;
        }
 
@@ -543,17 +563,21 @@ _CalendarbookUtil::ConvertEventStatusToCSEventStatus(int status)
        case EVENT_STATUS_NONE:
                convertedEventStatus = CALENDAR_EVENT_STATUS_NONE;
                break;
+
        case EVENT_STATUS_TENTATIVE:
                convertedEventStatus = CALENDAR_EVENT_STATUS_TENTATIVE;
                break;
+
        case EVENT_STATUS_CONFIRMED:
                convertedEventStatus = CALENDAR_EVENT_STATUS_CONFIRMED;
                break;
+
        case EVENT_STATUS_CANCELLED:
                convertedEventStatus = CALENDAR_EVENT_STATUS_CANCELLED;
                break;
+
        default :
-               SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. status = %d", status);
+               SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. status = %d", GetErrorMessage(E_INVALID_ARG), status);
                convertedEventStatus = CALENDAR_EVENT_STATUS_NONE;
                break;
        }
@@ -571,17 +595,21 @@ _CalendarbookUtil::ConvertBusyStatusToCSEventBusyStatus(int busyStatus)
        case BUSY_STATUS_FREE:
                convertedBusyStatus = CALENDAR_EVENT_BUSY_STATUS_FREE;
                break;
+
        case BUSY_STATUS_BUSY:
                convertedBusyStatus = CALENDAR_EVENT_BUSY_STATUS_BUSY;
                break;
+
        case BUSY_STATUS_UNAVAILABLE:
                convertedBusyStatus = CALENDAR_EVENT_BUSY_STATUS_UNAVAILABLE;
                break;
+
        case BUSY_STATUS_TENTATIVE:
                convertedBusyStatus = CALENDAR_EVENT_BUSY_STATUS_TENTATIVE;
                break;
+
        default :
-               SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. busyStatus = %d", busyStatus);
+               SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. busyStatus = %d", GetErrorMessage(E_INVALID_ARG), busyStatus);
                convertedBusyStatus = CALENDAR_EVENT_BUSY_STATUS_FREE;
                break;
        }
@@ -599,14 +627,17 @@ _CalendarbookUtil::ConvertEventPriorityToCSEventPriority(int priority)
        case EVENT_PRIORITY_LOW:
                convertedPriority = CALENDAR_EVENT_PRIORITY_LOW;
                break;
+
        case EVENT_PRIORITY_NORMAL:
                convertedPriority = CALENDAR_EVENT_PRIORITY_NORMAL;
                break;
+
        case EVENT_PRIORITY_HIGH:
                convertedPriority = CALENDAR_EVENT_PRIORITY_HIGH;
                break;
+
        default :
-               SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. priority = %d", priority);
+               SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. priority = %d", GetErrorMessage(E_INVALID_ARG), priority);
                convertedPriority = CALENDAR_EVENT_PRIORITY_NORMAL;
                break;
        }
@@ -624,14 +655,17 @@ _CalendarbookUtil::ConvertSensitivityToCSSensitivity(int sensitivity)
        case SENSITIVITY_PUBLIC:
                convertedSensitivity = CALENDAR_SENSITIVITY_PUBLIC;
                break;
+
        case SENSITIVITY_PRIVATE:
                convertedSensitivity = CALENDAR_SENSITIVITY_PRIVATE;
                break;
+
        case SENSITIVITY_CONFIDENTIAL:
                convertedSensitivity = CALENDAR_SENSITIVITY_CONFIDENTIAL;
                break;
+
        default :
-               SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. sensitivity = %d", sensitivity);
+               SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. sensitivity = %d", GetErrorMessage(E_INVALID_ARG), sensitivity);
                convertedSensitivity = CALENDAR_SENSITIVITY_PUBLIC;
                break;
        }
@@ -649,20 +683,25 @@ _CalendarbookUtil::ConvertTodoStatusToCSTodoStatus(int status)
        case TODO_STATUS_NONE:
                convertedTodoStatus = CALENDAR_TODO_STATUS_NONE;
                break;
+
        case TODO_STATUS_NEEDS_ACTION:
                convertedTodoStatus = CALENDAR_TODO_STATUS_NEEDS_ACTION;
                break;
+
        case TODO_STATUS_COMPLETED:
                convertedTodoStatus = CALENDAR_TODO_STATUS_COMPLETED;
                break;
+
        case TODO_STATUS_IN_PROCESS:
                convertedTodoStatus = CALENDAR_TODO_STATUS_IN_PROCESS;
                break;
+
        case TODO_STATUS_CANCELLED:
                convertedTodoStatus = CALENDAR_TODO_STATUS_CANCELED;
                break;
+
        default :
-               SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. status = %d", status);
+               SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. status = %d", GetErrorMessage(E_INVALID_ARG), status);
                convertedTodoStatus = CALENDAR_TODO_STATUS_NONE;
                break;
        }
@@ -680,14 +719,17 @@ _CalendarbookUtil::ConvertTodoPriorityToCSTodoPriority(int priority)
        case TODO_PRIORITY_LOW:
                convertedPriority = CALENDAR_TODO_PRIORITY_LOW;
                break;
+
        case TODO_PRIORITY_NORMAL:
                convertedPriority = CALENDAR_TODO_PRIORITY_NORMAL;
                break;
+
        case TODO_PRIORITY_HIGH:
                convertedPriority = CALENDAR_TODO_PRIORITY_HIGH;
                break;
+
        default :
-               SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. priority = %d", priority);
+               SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. priority = %d", GetErrorMessage(E_INVALID_ARG), priority);
                convertedPriority = CALENDAR_TODO_PRIORITY_NONE;
                break;
        }
@@ -705,12 +747,15 @@ _CalendarbookUtil::ConvertCalendarItemTypeToCSCalendarbookType(int itemType)
        case CALENDAR_ITEM_TYPE_EVENT_ONLY:
                storeType = CALENDAR_BOOK_TYPE_EVENT;
                break;
+
        case CALENDAR_ITEM_TYPE_TODO_ONLY:
                storeType = CALENDAR_BOOK_TYPE_TODO;
                break;
+
        case CALENDAR_ITEM_TYPE_EVENT_AND_TODO:
                storeType = CALENDAR_BOOK_TYPE_EVENT | CALENDAR_BOOK_TYPE_TODO;
                break;
+
        default :
                storeType = CALENDAR_BOOK_TYPE_EVENT | CALENDAR_BOOK_TYPE_TODO;
                break;
@@ -733,7 +778,7 @@ _CalendarbookUtil::ConvertCSCategoriesToEventCategory(const char* pCategories)
        while (strTok.HasMoreTokens())
        {
                r = strTok.GetNextToken(token);
-               SysTryReturn(NID_SCL, r == E_SUCCESS, EVENT_CATEGORY_APPOINTMENT, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+               SysTryReturn(NID_SCL, r == E_SUCCESS, EVENT_CATEGORY_APPOINTMENT, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
                if (token == _EVENT_CATEGORY_APPOINTMENT_STRING)
                {
                        eventCategory = EVENT_CATEGORY_APPOINTMENT;
@@ -752,16 +797,18 @@ _CalendarbookUtil::ConvertCSCategoriesToEventCategory(const char* pCategories)
 int
 _CalendarbookUtil::GetMaxDaysOfMonth(int year, int month)
 {
+       ClearLastResult();
+
        int maxDaysOfMonth = 0;
-       Tizen::Locales::Calendar* pGregorianCalendar = Tizen::Locales::Calendar::CreateInstanceN(Tizen::Locales::CALENDAR_GREGORIAN);
+
+       std::unique_ptr<Tizen::Locales::Calendar> pGregorianCalendar(Tizen::Locales::Calendar::CreateInstanceN(Tizen::Locales::CALENDAR_GREGORIAN));
+       SysTryReturn(NID_SCL, pGregorianCalendar != null, _INVALID_MAX_DAYS_OF_MONTH, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
        pGregorianCalendar->SetTimeField(Tizen::Locales::TIME_FIELD_YEAR, year);
        pGregorianCalendar->SetTimeField(Tizen::Locales::TIME_FIELD_MONTH, month);
 
        maxDaysOfMonth = pGregorianCalendar->GetActualMaxTimeField(Tizen::Locales::TIME_FIELD_DAY_OF_MONTH);
 
-       delete pGregorianCalendar;
-
        return maxDaysOfMonth;
 }
 
index b639ee7..3c8bf2d 100644 (file)
  */
 
 #include <new>
-#include <FBaseColIList.h>
+#include <FApp_AppInfo.h>
 #include <FBaseColArrayList.h>
+#include <FBaseColIList.h>
 #include <FBaseDateTime.h>
-#include <FSclRecurrence.h>
 #include <FBaseSysLog.h>
-#include <FApp_AppInfo.h>
-#include "FScl_RecurrenceImpl.h"
+#include <FSclRecurrence.h>
 #include "FScl_CalendarbookImpl.h"
 #include "FScl_CalendarbookUtil.h"
+#include "FScl_RecurrenceImpl.h"
 
+using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
-using namespace Tizen::App;
 
 namespace Tizen { namespace Social
 {
@@ -63,7 +63,7 @@ _RecurrenceImpl::_RecurrenceImpl(void)
        , __monthOfYear(0)
 {
        std::unique_ptr<ArrayList, AllElementsDeleter> pExceptionDates(new (std::nothrow) ArrayList());
-       SysTryReturnVoidResult(NID_SCL, pExceptionDates, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturnVoidResult(NID_SCL, pExceptionDates, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        result r = pExceptionDates->Construct();
        SysTryReturnVoidResult(NID_SCL, !IsFailed(r), r, "[%s] Propagating.", GetErrorMessage(r));
@@ -83,16 +83,16 @@ _RecurrenceImpl::_RecurrenceImpl(const _RecurrenceImpl& rhs)
        , __monthOfYear(rhs.__monthOfYear)
        , __pExceptionDates(null)
 {
-       std::unique_ptr<Tizen::Base::DateTime> pUntil;
+       std::unique_ptr<DateTime> pUntil;
 
        if (rhs.__pUntil != null)
        {
-               pUntil = std::unique_ptr<Tizen::Base::DateTime>(new (std::nothrow) DateTime(*rhs.__pUntil));
-               SysTryReturnVoidResult(NID_SCL, pUntil != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+               pUntil = std::unique_ptr<DateTime>(new (std::nothrow) DateTime(*rhs.__pUntil));
+               SysTryReturnVoidResult(NID_SCL, pUntil != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
        }
 
        std::unique_ptr<ArrayList, AllElementsDeleter> pExceptionDates(new (std::nothrow) ArrayList());
-       SysTryReturnVoidResult(NID_SCL, pExceptionDates, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturnVoidResult(NID_SCL, pExceptionDates, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        result r = pExceptionDates->Construct();
        SysTryReturnVoidResult(NID_SCL, !IsFailed(r), r, "[%s] Propagating.", GetErrorMessage(r));
@@ -124,7 +124,7 @@ _RecurrenceImpl::operator =(const _RecurrenceImpl& rhs)
                return *this;
        }
 
-       std::unique_ptr<Tizen::Base::DateTime> pUntil;
+       std::unique_ptr<DateTime> pUntil;
 
        __type = rhs.__type;
        __interval = rhs.__interval;
@@ -138,7 +138,7 @@ _RecurrenceImpl::operator =(const _RecurrenceImpl& rhs)
        if (rhs.__pUntil != null)
        {
                pUntil.reset(new (std::nothrow) DateTime(*(rhs.__pUntil)));
-               SysTryReturn(NID_SCL, pUntil != null, *this, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+               SysTryReturn(NID_SCL, pUntil != null, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
        }
 
        if (__pExceptionDates != null && rhs.__pExceptionDates != null)
@@ -150,7 +150,11 @@ _RecurrenceImpl::operator =(const _RecurrenceImpl& rhs)
                while (pEnum->MoveNext() == E_SUCCESS)
                {
                        pTmpExDate = static_cast<DateTime*>(pEnum->GetCurrent());
-                       __pExceptionDates->Add(*(new (std::nothrow) DateTime(*pTmpExDate)));
+
+                       if (pTmpExDate != null)
+                       {
+                               __pExceptionDates->Add(new (std::nothrow) DateTime(*pTmpExDate));
+                       }
                }
        }
 
@@ -455,10 +459,13 @@ _RecurrenceImpl::AddExceptionDate(const DateTime& exceptionDate)
 
        SysTryReturnResult(NID_SCL, !alreadyExist, E_OBJ_ALREADY_EXIST, "The exceptionDate already exists");
 
-       DateTime* pExDate = new (std::nothrow) DateTime(exceptionDate);
+       std::unique_ptr<DateTime> pExDate(new (std::nothrow) DateTime(exceptionDate));
        SysTryReturnResult(NID_SCL, pExDate != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       __pExceptionDates->Add(*pExDate);
+       result r = __pExceptionDates->Add(pExDate.get());
+       SysTryReturnResult(NID_SCL, !IsFailed(r), E_INVALID_ARG, "Propagating.");
+
+       pExDate.release();
 
        return E_SUCCESS;
 }
@@ -469,10 +476,10 @@ _RecurrenceImpl::GetExceptionDatesN(void) const
        ClearLastResult();
        result r = E_SUCCESS;
 
-       std::unique_ptr<Tizen::Base::Collection::ArrayList, Tizen::Base::Collection::AllElementsDeleter> pList(new (std::nothrow) ArrayList());
-       SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       std::unique_ptr<ArrayList, AllElementsDeleter> pList(new (std::nothrow) ArrayList());
+       SysTryReturn(NID_SCL, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
        r = pList->Construct();
-       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
        DateTime* pExDate = null;
        DateTime* pTmpExDate = null;
@@ -483,8 +490,8 @@ _RecurrenceImpl::GetExceptionDatesN(void) const
                if (pExDate)
                {
                        pTmpExDate = new (std::nothrow) DateTime(*pExDate);
-                       SysTryReturn(NID_SCL, pTmpExDate != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
-                       pList->Add(*pTmpExDate);
+                       SysTryReturn(NID_SCL, pTmpExDate != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+                       pList->Add(pTmpExDate);
                }
        }
 
index eb884f2..d764b3c 100644 (file)
 #include <FBaseSysLog.h>
 #include <FBaseDateTime.h>
 #include <FSclReminder.h>
-#include "FScl_ReminderImpl.h"
 #include "FScl_CalendarbookUtil.h"
+#include "FScl_ReminderImpl.h"
 
-using namespace Tizen::Base;
 using namespace Tizen::App;
+using namespace Tizen::Base;
 
 namespace Tizen { namespace Social
 {
 
 _ReminderImpl::_ReminderImpl(void)
 {
-
 }
 
 _ReminderImpl::_ReminderImpl(const _ReminderImpl& rhs)
        : __absoluteTime(rhs.__absoluteTime)
        , __isAbsolute(false)
 {
-
 }
 
 _ReminderImpl::~_ReminderImpl(void)
index 43a3cf3..2b8d520 100644 (file)
@@ -25,8 +25,8 @@
 
 #include <unique_ptr.h>
 #include <calendar2.h>
-#include <FBaseDateTime.h>
 #include <FBaseColAllElementsDeleter.h>
+#include <FBaseDateTime.h>
 #include <FSclTypes.h>
 #include "FScl_CalendarbookUtil.h"
 
index 68efec2..4ec3f5a 100644 (file)
@@ -25,8 +25,8 @@
 
 #include <unique_ptr.h>
 #include <calendar2.h>
-#include <FBaseObject.h>
 #include <FBaseColAllElementsDeleter.h>
+#include <FBaseObject.h>
 #include "FScl_CalendarbookUtil.h"
 
 namespace Tizen { namespace Base
index c56d7d1..dbf6f47 100644 (file)
@@ -23,9 +23,9 @@
 #define _FSCL_INTERNAL_RECURRENCE_IMPL_H_
 
 #include <unique_ptr.h>
+#include <FBaseColAllElementsDeleter.h>
 #include <FBaseObject.h>
 #include <FSclTypes.h>
-#include <FBaseColAllElementsDeleter.h>
 //#include <FScl_CalendarbookUtil.h>
 
 namespace Tizen { namespace Base