Parse() remains original value when the function returns errror
authordahyeong.kim <dahyeong.kim@samsung.com>
Sat, 30 Mar 2013 05:40:06 +0000 (14:40 +0900)
committerdahyeong.kim <dahyeong.kim@samsung.com>
Sat, 30 Mar 2013 06:46:50 +0000 (15:46 +0900)
Change-Id: If5983d3458440ab4c987984133e0aad15734f3e1
Signed-off-by: dahyeong.kim <dahyeong.kim@samsung.com>
16 files changed:
inc/FBaseDateTime.h
inc/FBaseDouble.h
inc/FBaseFloat.h
inc/FBaseInt8.h
inc/FBaseInteger.h
inc/FBaseLong.h
inc/FBaseLongLong.h
inc/FBaseShort.h
inc/FBaseUuId.h
src/base/FBaseDouble.cpp
src/base/FBaseFloat.cpp
src/base/FBaseInt8.cpp
src/base/FBaseInteger.cpp
src/base/FBaseLong.cpp
src/base/FBaseLongLong.cpp
src/base/FBaseShort.cpp

index 4f7fdf7..25a861e 100644 (file)
@@ -505,7 +505,9 @@ public:
         *                                                                          or is less than the value returned by GetMinValue(). @n
         *                                                                           2) The specified string contains an invalid value.
         *                                                                          For example, day is 31 when the month is 2.
-        * @remarks             The format of the string is "mm/dd/yyyy hh:mm:ss.mmm".
+        * @remarks
+        *                              - The format of the string is "mm/dd/yyyy hh:mm:ss".
+        *                              - This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& str, DateTime& dt);
 
@@ -587,7 +589,7 @@ public:
         *
         *      @since  2.1
         *
-        *      @return         An long long value indicating the tick of the current instance of %DateTime
+        *      @return         A long long value indicating the tick of the current instance of %DateTime
         */
        long long GetTicks(void) const;
 
index 40ebdbf..87f873c 100644 (file)
@@ -206,6 +206,7 @@ public:
         * @param[out]  ret                     The converted numeric value
         * @exception   E_SUCCESS               The method is successful.
         * @exception   E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
+        * @remarks             This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& s, double& ret);
 
index 1415f3b..041f5f4 100644 (file)
@@ -194,6 +194,7 @@ public:
         *      @param[out]     ret                     The numeric representation of the string
         *      @exception      E_SUCCESS        The method is successful.
         *      @exception      E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+        *      @remarks        This method guarantees that the original value of out-parameter is not changed when the method returns error.
         *      @see            Tizen::Base::Double::Parse()
         */
        static result Parse(const String& s, float& ret);
index eb6f65e..7360927 100644 (file)
@@ -211,25 +211,27 @@ public:
         * @param[out]  ret     The result of the operation
         * @exception   E_SUCCESS        The method is successful.
         * @exception   E_NUM_FORMAT The specified string does not contain a byte that can be parsed.
-        * @remarks             This method assumes that the string representing the numeric value
-        *                              uses a radix 10.
+        * @remarks
+        *                              - This method assumes that the string representing the numeric value uses a radix 10.
+        *                              - This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& s, char& ret);
 
        /**
         * Parses the specified string representing a numeric value and
-     * returns the value as @c signed @c char (as out parameter).
-     *
+        * returns the value as @c signed @c char (as out parameter).
+        *
         * @since 2.0
         *
         * @return              The @c signed @c char equivalent of the specified string representing the numeric value using the specified index
         * @param[in]   s       A string representing a numeric value
         * @param[in]   radix   The radix of the string representing a numeric value @n
         *                                              It must either be 2, 8, 10, or 16.
-     * @param[out]     ret             The result of the operation
+        * @param[out]  ret             The result of the operation
         * @exception   E_SUCCESS        The method is successful.
         * @exception   E_NUM_FORMAT The specified string does not contain a number that can be parsed.
         * @exception   E_OUT_OF_RANGE The specified @c radix is invalid.
+        * @remarks             This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& s, int radix, char& ret);
 
index 249ec8e..0e344ae 100644 (file)
@@ -214,8 +214,9 @@ public:
         *      @param[out]     ret                             The result of the operation
         *      @exception      E_SUCCESS               The method is successful.
         *      @exception      E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
-        *      @remarks        This method assumes that the string representing the numeric value
-        *                              uses a radix 10.
+        *      @remarks
+        *                              - This method assumes that the string representing the numeric value uses a radix 10.
+        *                              - This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& s, int& ret);
 
@@ -226,12 +227,13 @@ public:
         *
         *      @return         An error code
         *      @param[in]      s                               A string representing a numeric value
-        *  @param[in]  radix                   The radix of the string representing the numeric value @n
+        *      @param[in]      radix                   The radix of the string representing the numeric value @n
         *                                                              It must either be 2, 8, 10, or 16.
         *      @param[out]     ret                             The result of the operation
         *      @exception      E_SUCCESS               The method is successful.
         *      @exception      E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
-        *  @exception  E_OUT_OF_RANGE The specified @c radix is invalid.
+        *      @exception      E_OUT_OF_RANGE The specified @c radix is invalid.
+        *      @remarks        This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& s, int radix, int& ret);
 
index bcc59e5..d3d821b 100644 (file)
@@ -208,13 +208,14 @@ public:
         *
         *      @since 2.0
         *
-        *  @return             An error code
-        *  @param[in]  s                               A string representing a numeric value
-        *  @param[out] ret                             The result of the operation
-        *  @exception  E_SUCCESS               The method is successful.
-        *  @exception  E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
-        *  @remarks    This method assumes that the string representing the numeric value
-        *                              uses a radix 10.
+        *      @return         An error code
+        *      @param[in]      s                               A string representing a numeric value
+        *      @param[out]     ret                             The result of the operation
+        *      @exception      E_SUCCESS               The method is successful.
+        *      @exception      E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
+        *      @remarks
+        *                              - This method assumes that the string representing the numeric value uses a radix 10.
+        *                              - This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& s, long& ret);
 
@@ -225,12 +226,13 @@ public:
         *
         *      @return         An error code
         *      @param[in]      s                       A string representing a numeric value
-        *  @param[in]  radix           The radix of the string representing a numeric value @n
+        *      @param[in]      radix           The radix of the string representing a numeric value @n
         *                                                      It must be either 2, 8, 10, or 16.
         *      @param[out]     ret                             The result of the operation
         *      @exception      E_SUCCESS               The method is successful.
         *      @exception      E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
-        *  @exception  E_OUT_OF_RANGE The specified @c radix is invalid.
+        *      @exception      E_OUT_OF_RANGE The specified @c radix is invalid.
+        *      @remarks        This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& s, int radix, long& ret);
 
index a403b7b..4c60e0d 100644 (file)
@@ -265,13 +265,14 @@ public:
         *
         *      @since                  2.0
         *
-        *  @return                     An error code
-        *  @param[in]  s                               A string representing a numeric value
-        *  @param[out] ret                             The result of the operation
-        *  @exception  E_SUCCESS               The method is successful.
-        *  @exception  E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
-        *  @remarks    This method assumes that the string representing the numeric value
-        *                              uses a radix 10.
+        *      @return                 An error code
+        *      @param[in]      s                               A string representing a numeric value
+        *      @param[out]     ret                             The result of the operation
+        *      @exception      E_SUCCESS               The method is successful.
+        *      @exception      E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
+        *      @remarks
+        *                              - This method assumes that the string representing the numeric value uses a radix 10.
+        *                              - This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& s, long long& ret);
 
@@ -281,14 +282,15 @@ public:
         *
         *      @since                  2.1
         *
-        *  @return                     An error code
-        *  @param[in]  s                               A string representing a numeric value
-        *  @param[in]  radix                   The radix of the string representing a unmeric value @n
+        *      @return                 An error code
+        *      @param[in]      s                               A string representing a numeric value
+        *      @param[in]      radix                   The radix of the string representing a unmeric value @n
         *                                                              It must be either 2, 8, 10 or 16.
-        *  @param[out] ret                             The result of the operation
-        *  @exception  E_SUCCESS               The method is successful.
-        *  @exception  E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
-        *  @exception  E_OUT_OF_RANGE  The specified @c radix is invalid.
+        *      @param[out]     ret                             The result of the operation
+        *      @exception      E_SUCCESS               The method is successful.
+        *      @exception      E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
+        *      @exception      E_OUT_OF_RANGE  The specified @c radix is invalid.
+        *      @remarks        This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& s, int radix, long long& ret);
 
index d006439..9b921d4 100644 (file)
@@ -231,8 +231,9 @@ public:
         *      @param[out]     ret                             The result of the operation
         *      @exception      E_SUCCESS               The method is successful.
         *      @exception      E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
-        *      @remarks        The method assumes that the string representing the numeric value
-        *                              uses radix 10.
+        *      @remarks
+        *                              - This method assumes that the string representing the numeric value uses a radix 10.
+        *                              - This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& s, short& ret);
 
@@ -242,14 +243,15 @@ public:
         *
         *      @since 2.0
         *
-        *      @return                 An error code
-        *      @param[in]      s                       A string representing a numeric value
-        *  @param[in]  radix           The radix of the string representing a numeric value @n
-        *                                                      It must either be @c 2, @c 8, @c 10, or @c 16.
+        *      @return         An error code
+        *      @param[in]      s               A string representing a numeric value
+        *      @param[in]      radix           The radix of the string representing a numeric value @n
+        *                                              It must either be @c 2, @c 8, @c 10, or @c 16.
         *      @param[out]     ret                             The result of the operation
         *      @exception      E_SUCCESS               The method is successful.
         *      @exception      E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
-        *  @exception  E_OUT_OF_RANGE The specified @c radix is invalid.
+        *      @exception      E_OUT_OF_RANGE The specified @c radix is invalid.
+        *      @remarks        This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& s, int radix, short& ret);
 
index 445525b..437d848 100644 (file)
@@ -246,7 +246,9 @@ public:
         * @param[out]  uuid            An instance of %UuId
         * @exception   E_SUCCESS                               The method is successful.
         * @exception   E_INVALID_ARG                   The string does not contain an %UuId that can be parsed.
-        * @remarks     The format of a string representing a %UuId value is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (For example, 130DF2EC-8233-4975-B03D-F0AD99E3449D).
+        * @remarks
+        *                              - The format of a string representing a %UuId value is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (For example, 130DF2EC-8233-4975-B03D-F0AD99E3449D).
+        *                              - This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& str, UuId& uuid);
 
index a8d22d2..5d66b87 100644 (file)
@@ -151,14 +151,14 @@ result
 Double::Parse(const String& s, double& ret)
 {
        wchar_t* pEnd = null;
-
        errno = 0;
-       ret = wcstod(s.GetPointer(), &pEnd);
-       SysTryReturnResult(NID_BASE, ((!(!Double::Compare(ret, 0)  && errno == EINVAL)) && (pEnd[0] == 0)), E_NUM_FORMAT,
+       double tmpRet = wcstod(s.GetPointer(), &pEnd);
+       SysTryReturnResult(NID_BASE, ((!(!Double::Compare(tmpRet, 0)  && errno == EINVAL)) && (pEnd[0] == 0)), E_NUM_FORMAT,
                "Double parse failed with reason (%s). Scan stopped at (%ls)", __ConvertNativeErrorToMessage(errno), pEnd);
-       SysTryReturnResult(NID_BASE, !(errno != 0 && (!Double::Compare(ret, HUGE_VAL)|| !Double::Compare(ret, -HUGE_VAL))),
+       SysTryReturnResult(NID_BASE, !(errno != 0 && (!Double::Compare(tmpRet, HUGE_VAL)|| !Double::Compare(tmpRet, -HUGE_VAL))),
                E_NUM_FORMAT, "Parsed value cannot fit into a Double.");
 
+       ret = tmpRet;
        return E_SUCCESS;
 }
 
index 4225a8f..c6aba7d 100644 (file)
@@ -143,19 +143,18 @@ Float::GetHashCode(float val)
 result
 Float::Parse(const String& s, float& ret)
 {
-       wchar_t* pEnd = null;
-       ret = 0;
-
        SysTryReturn(NID_BASE, s.GetLength() >= 1, E_NUM_FORMAT, E_NUM_FORMAT,
                "[%s] The length of s MUST be greater than 0.", GetErrorMessage(E_NUM_FORMAT));
 
        errno = 0;
-       ret = wcstof(s.GetPointer(), &pEnd);
+       wchar_t* pEnd = null;
+       float tmpRet = wcstof(s.GetPointer(), &pEnd);
        SysTryReturn(NID_BASE, (!Float::Compare(pEnd[0], 0)), E_NUM_FORMAT, E_NUM_FORMAT,
                "[%s] Float parse failed. Scan stopped at (%ls).", GetErrorMessage(E_NUM_FORMAT), pEnd);
-       SysTryReturn(NID_BASE, !((!Float::Compare(ret, HUGE_VAL) || !Float::Compare(ret, -HUGE_VAL)) && (errno != 0)),
+       SysTryReturn(NID_BASE, !((!Float::Compare(tmpRet, HUGE_VAL) || !Float::Compare(tmpRet, -HUGE_VAL)) && (errno != 0)),
                E_NUM_FORMAT, E_NUM_FORMAT, "[%s] Parsed value cannot fit into a Float.", GetErrorMessage(E_NUM_FORMAT));
 
+       ret = tmpRet;
        return E_SUCCESS;
 }
 
index 0d60f01..ecf9bd5 100644 (file)
@@ -174,9 +174,6 @@ Int8::Parse(const String& s, int radix, char& ret)
                (radix == Character::RADIX_DECIMAL) || (radix == Character::RADIX_HEXADECIMAL)), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
                "[%s] The radix(%d) MUST be one of 2, 8, 10 and 16.", GetErrorMessage(E_OUT_OF_RANGE), radix);
 
-       wchar_t* pEnd = null;
-       long value = 0;
-
        int len = s.GetLength();
        SysTryReturn(NID_BASE, (len > 0), E_NUM_FORMAT, E_NUM_FORMAT, "[%s] The length of s MUST be greater than 0.",
                GetErrorMessage(E_NUM_FORMAT));
@@ -184,24 +181,24 @@ Int8::Parse(const String& s, int radix, char& ret)
        result r = E_SUCCESS;
 
        errno = 0;
-       value = wcstol(s.GetPointer(), &pEnd, radix);
-       SysTryCatch(NID_BASE, (pEnd[0] == 0), r = E_NUM_FORMAT, E_NUM_FORMAT, "[%s] Int8 parse failed. Scan stopped at (%ls).",
+       wchar_t* pEnd = null;
+       long value = wcstol(s.GetPointer(), &pEnd, radix);
+       SysTryReturn(NID_BASE, (pEnd[0] == 0), E_NUM_FORMAT, E_NUM_FORMAT, "[%s] Int8 parse failed. Scan stopped at (%ls).",
                GetErrorMessage(E_NUM_FORMAT), pEnd);
-       SysTryCatch(NID_BASE, !((value == LONG_MAX || value == LONG_MIN) && (errno != 0)), r = E_NUM_FORMAT, E_NUM_FORMAT,
+       SysTryReturn(NID_BASE, !((value == LONG_MAX || value == LONG_MIN) && (errno != 0)), E_NUM_FORMAT, E_NUM_FORMAT,
                "[%s] Parsed value cannot fit into an Int8.", GetErrorMessage(E_NUM_FORMAT));
 
-CATCH:
        if (value > Int8::VALUE_MAX)
        {
                ret = Int8::VALUE_MAX;
        }
-       else if (value < (signed char) Int8::VALUE_MIN)
+       else if (value < static_cast< signed char >(Int8::VALUE_MIN))
        {
-               ret = (signed char) Int8::VALUE_MIN;
+               ret = static_cast< signed char >(Int8::VALUE_MIN);
        }
        else
        {
-               ret = (char) value;
+               ret = static_cast< char >(value);
        }
 
        return r;
index 4db73f0..244374c 100644 (file)
@@ -157,19 +157,19 @@ Integer::Parse(const String& s, int radix, int& ret)
                (radix == Character::RADIX_DECIMAL) || (radix == Character::RADIX_HEXADECIMAL)), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
                "[%s] The radix(%d) MUST be one of 2, 8, 10 and 16.", GetErrorMessage(E_OUT_OF_RANGE), radix);
 
-       wchar_t* pEnd = null;
-
        int len = s.GetLength();
        SysTryReturn(NID_BASE, (len > 0), E_NUM_FORMAT, E_NUM_FORMAT, "[%s] The length of s MUST be greater than 0.",
                GetErrorMessage(E_NUM_FORMAT));
 
        errno = 0;
-       ret = wcstol(s.GetPointer(), &pEnd, radix);
+       wchar_t* pEnd = null;
+       int tmpRet = wcstol(s.GetPointer(), &pEnd, radix);
        SysTryReturn(NID_BASE, (pEnd[0] == 0), E_NUM_FORMAT, E_NUM_FORMAT,
                "[%s] Integer parse failed. Scan stopped at (%ls).", GetErrorMessage(E_NUM_FORMAT), pEnd);
-       SysTryReturn(NID_BASE, !((ret == LONG_MAX || ret == LONG_MIN) && (errno != 0)), E_NUM_FORMAT, E_NUM_FORMAT,
+       SysTryReturn(NID_BASE, !((tmpRet == LONG_MAX || tmpRet == LONG_MIN) && (errno != 0)), E_NUM_FORMAT, E_NUM_FORMAT,
                "[%s] Parsed value cannot fit into an Integer.", GetErrorMessage(E_NUM_FORMAT));
 
+       ret = tmpRet;
        return E_SUCCESS;
 }
 
index 748bc81..d349748 100644 (file)
@@ -155,19 +155,19 @@ Long::Parse(const String& s, int radix, long& ret)
                (radix == Character::RADIX_DECIMAL) || (radix == Character::RADIX_HEXADECIMAL)), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
                "[%s] The radix(%d) MUST be one of 2, 8, 10 and 16.", GetErrorMessage(E_OUT_OF_RANGE), radix);
 
-       wchar_t* pEnd = null;
-
        int len = s.GetLength();
        SysTryReturn(NID_BASE, (len > 0), E_NUM_FORMAT, E_NUM_FORMAT, "[%s] The length of s MUST be greater than 0.",
                GetErrorMessage(E_NUM_FORMAT));
 
        errno = 0;
-       ret = wcstol(s.GetPointer(), &pEnd, radix);
+       wchar_t* pEnd = null;
+       long tmpRet = wcstol(s.GetPointer(), &pEnd, radix);
        SysTryReturn(NID_BASE, (pEnd[0] == 0), E_NUM_FORMAT, E_NUM_FORMAT, "[%s] Long parse failed. Scan stopped at (%ls).",
                GetErrorMessage(E_NUM_FORMAT), pEnd);
-       SysTryReturn(NID_BASE, !((ret == LONG_MAX || ret == LONG_MIN) && (errno != 0)), E_NUM_FORMAT, E_NUM_FORMAT,
+       SysTryReturn(NID_BASE, !((tmpRet == LONG_MAX || tmpRet == LONG_MIN) && (errno != 0)), E_NUM_FORMAT, E_NUM_FORMAT,
                "[%s] Parsed value cannot fit into a Long.", GetErrorMessage(E_NUM_FORMAT));
 
+       ret = tmpRet;
        return E_SUCCESS;
 }
 
index 91a8876..f941ece 100644 (file)
@@ -174,19 +174,19 @@ LongLong::Parse(const String& s, int radix, long long& ret)
                radix == Character::RADIX_DECIMAL || radix == Character::RADIX_HEXADECIMAL, E_OUT_OF_RANGE,
                "[%s] The radix(%d) MUST be one of 2, 8, 10 and 16.", GetErrorMessage(E_OUT_OF_RANGE), radix);
 
-       wchar_t* pEnd = null;
-
        int len = s.GetLength();
        SysTryReturnResult(NID_BASE, (len > 0), E_NUM_FORMAT, "[%s] The length of s MUST be greater than 0.",
                GetErrorMessage(E_NUM_FORMAT));
 
        errno = 0;
-       ret = wcstoll(s.GetPointer(), &pEnd, radix);
+       wchar_t* pEnd = null;
+       long long tmpRet = wcstoll(s.GetPointer(), &pEnd, radix);
        SysTryReturnResult(NID_BASE, (pEnd[0] == 0), E_NUM_FORMAT, "[%s] LongLong parse failed. Scan stopped at (%ls).",
                GetErrorMessage(E_NUM_FORMAT), pEnd);
-       SysTryReturnResult(NID_BASE, !(errno == ERANGE && (ret == LLONG_MAX || ret == LLONG_MIN)), E_NUM_FORMAT,
+       SysTryReturnResult(NID_BASE, !(errno == ERANGE && (tmpRet == LLONG_MAX || tmpRet == LLONG_MIN)), E_NUM_FORMAT,
                "[%s] Parsed value cannot fit into a long long.", GetErrorMessage(E_NUM_FORMAT));
 
+       ret = tmpRet;
        return E_SUCCESS;
 }
 
index 7632bd3..f40452c 100644 (file)
@@ -178,9 +178,6 @@ Short::Parse(const String& s, int radix, short& ret)
                (radix == Character::RADIX_DECIMAL) || (radix == Character::RADIX_HEXADECIMAL)), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
                "[%s] The radix(%d) MUST be one of 2, 8, 10 and 16.", GetErrorMessage(E_OUT_OF_RANGE), radix);
 
-       long value = 0;
-       wchar_t* pEnd = null;
-
        int len = s.GetLength();
        SysTryReturn(NID_BASE, (len > 0), E_NUM_FORMAT, E_NUM_FORMAT, "[%s] The length of s MUST be greater than 0.",
                GetErrorMessage(E_NUM_FORMAT));
@@ -188,13 +185,13 @@ Short::Parse(const String& s, int radix, short& ret)
        result r = E_SUCCESS;
 
        errno = 0;
-       value = wcstol(s.GetPointer(), &pEnd, radix);
-       SysTryCatch(NID_BASE, (pEnd[0] == 0), r = E_NUM_FORMAT, E_NUM_FORMAT,
+       wchar_t* pEnd = null;
+       long value = wcstol(s.GetPointer(), &pEnd, radix);
+       SysTryReturn(NID_BASE, (pEnd[0] == 0), E_NUM_FORMAT, E_NUM_FORMAT,
                "[%s] Short parse failed. Scan stopped at (%ls).", GetErrorMessage(E_NUM_FORMAT), pEnd);
-       SysTryCatch(NID_BASE, !(value > Short::VALUE_MAX || value < Short::VALUE_MIN) || (errno != 0), r = E_NUM_FORMAT,
+       SysTryReturn(NID_BASE, !(value > Short::VALUE_MAX || value < Short::VALUE_MIN) || (errno != 0), E_NUM_FORMAT,
                E_NUM_FORMAT, "[%s] Parsed value cannot fit into Short.", GetErrorMessage(E_NUM_FORMAT));
 
-CATCH:
        if (value > Short::VALUE_MAX)
        {
                ret = Short::VALUE_MAX;
@@ -205,7 +202,7 @@ CATCH:
        }
        else
        {
-               ret = (short) value;
+               ret = static_cast< short >(value);
        }
 
        return r;