prevent fix
authorBINDUCHAITANYA TUMMALA <bc.tummala@samsung.com>
Sat, 13 Apr 2013 10:33:24 +0000 (16:03 +0530)
committerBINDUCHAITANYA TUMMALA <bc.tummala@samsung.com>
Sat, 13 Apr 2013 10:33:24 +0000 (16:03 +0530)
Change-Id: Iee4e8910b0ccc6a15c6cc6b0ee8580a74167317a
Signed-off-by: BINDUCHAITANYA TUMMALA <bc.tummala@samsung.com>
src/controls/FWebCtrl_InputPickerPopup.cpp

index 4877108..502e6e4 100755 (executable)
@@ -513,12 +513,6 @@ _InputPickerPopup::GetColor(void) const
 result
 _InputPickerPopup::Parse(const String& strDateTime, DateTime & dateTime)
 {
-       result r = E_SUCCESS;
-
-       wchar_t* pMchar = (wchar_t*) strDateTime.GetPointer();
-       wchar_t* pTmp = (wchar_t*) malloc(sizeof(wchar_t) * 10);
-       SysTryReturnResult(NID_WEB_CTRL, pTmp, E_OUT_OF_MEMORY, "Memory allocation failed.");
-
        std::unique_ptr<DateTimeFormatter> pDateFormatter(DateTimeFormatter::CreateDateFormatterN(DATE_TIME_STYLE_DEFAULT));
        SysTryReturn(NID_WEB_CTRL, pDateFormatter.get(), GetLastResult(), GetLastResult(),  "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
@@ -529,9 +523,16 @@ _InputPickerPopup::Parse(const String& strDateTime, DateTime & dateTime)
        int hour = 0;
        int minute = 0;
        int week = 0;
+
+       result r = E_SUCCESS;
+
        String formattedString = L"e";
        String dayno;
 
+       const wchar_t* pMchar = static_cast< const wchar_t* >(strDateTime.GetPointer());
+       wchar_t* pTmp = static_cast< wchar_t* >(malloc(sizeof(wchar_t) * 10));
+       SysTryReturnResult(NID_WEB_CTRL, pTmp, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
        switch (__inputType)
        {
        case EWK_INPUT_TYPE_TIME :                       //"HH:mm";
@@ -539,12 +540,12 @@ _InputPickerPopup::Parse(const String& strDateTime, DateTime & dateTime)
                // hour
                wcsncpy(pTmp, pMchar, 2);
                pTmp[2] = L'\0';
-               hour = (int) wcstol(pTmp, null, 10);
+               hour = static_cast< int >(wcstol(pTmp, null, 10));
 
                // minute
                wcsncpy(pTmp, pMchar + 3, 2);
                pTmp[2] = L'\0';
-               minute = (int) wcstol(pTmp, null, 10);
+               minute = static_cast< int >(wcstol(pTmp, null, 10));
                dateTime.SetValue(1, 1, 1, hour,minute);
                break;
 
@@ -555,30 +556,30 @@ _InputPickerPopup::Parse(const String& strDateTime, DateTime & dateTime)
                wcsncpy(pTmp, pMchar, 4);
                pTmp[4] = L'\0';
 
-               year = (int) wcstol(pTmp, null, 10);
+               year = static_cast< int >(wcstol(pTmp, null, 10));
 
                // month
                wcsncpy(pTmp, pMchar + 5, 2);
                pTmp[2] = L'\0';
 
-               month = (int) wcstol(pTmp, null, 10);
+               month = static_cast< int >(wcstol(pTmp, null, 10));
 
                // day
                wcsncpy(pTmp, pMchar + 8, 2);
                pTmp[2] = L'\0';
 
-               day = (int) wcstol(pTmp, null, 10);
+               day = static_cast< int >(wcstol(pTmp, null, 10));
 
                // hour
                wcsncpy(pTmp, pMchar + 11, 2);
                pTmp[2] = L'\0';
 
-               hour = (int) wcstol(pTmp, null, 10);
+               hour = static_cast< int >(wcstol(pTmp, null, 10));
 
                // minute
                wcsncpy(pTmp, pMchar + 14, 2);
                pTmp[2] = L'\0';
-               minute = (int) wcstol(pTmp, null, 10);
+               minute = static_cast< int >(wcstol(pTmp, null, 10));
                dateTime.SetValue(year, month, day, hour, minute);
                break;
 
@@ -588,12 +589,12 @@ _InputPickerPopup::Parse(const String& strDateTime, DateTime & dateTime)
                wcsncpy(pTmp, pMchar, 4);
                pTmp[4] = L'\0';
 
-               year = (int) wcstol(pTmp, null, 10);
+               year = static_cast< int >(wcstol(pTmp, null, 10));
 
                // week
                wcsncpy(pTmp, pMchar + 6, 2);
                pTmp[2] = L'\0';
-               week = (int) wcstol(pTmp, null, 10);
+               week = static_cast< int >(wcstol(pTmp, null, 10));
 
                dateTime.SetValue(year,1,1);
                pDateFormatter->ApplyPattern(formattedString);
@@ -608,17 +609,17 @@ _InputPickerPopup::Parse(const String& strDateTime, DateTime & dateTime)
                // year
                wcsncpy(pTmp, pMchar, 4);
                pTmp[4] = L'\0';
-               year = (int) wcstol(pTmp, null, 10);
+               year = static_cast< int >(wcstol(pTmp, null, 10));
 
                // month
                wcsncpy(pTmp, pMchar + 5, 2);
                pTmp[2] = L'\0';
-               month = (int) wcstol(pTmp, null, 10);
+               month = static_cast< int >(wcstol(pTmp, null, 10));
 
                // day
                wcsncpy(pTmp, pMchar + 8, 2);
                pTmp[2] = L'\0';
-               day = (int) wcstol(pTmp, null, 10);
+               day = static_cast< int >(wcstol(pTmp, null, 10));
 
                dateTime.SetValue(year, month, day);
                break;
@@ -628,12 +629,12 @@ _InputPickerPopup::Parse(const String& strDateTime, DateTime & dateTime)
                // year
                wcsncpy(pTmp, pMchar, 4);
                pTmp[4] = L'\0';
-               year = (int) wcstol(pTmp, null, 10);
+               year = static_cast< int >(wcstol(pTmp, null, 10));
 
                // month
                wcsncpy(pTmp, pMchar + 5, 2);
                pTmp[2] = L'\0';
-               month = (int) wcstol(pTmp, null, 10);
+               month = static_cast< int >(wcstol(pTmp, null, 10));
 
                dateTime.SetValue(year, month, 1);
                break;