From 93dbe1cee1ab177db0d891052974fe74f4f5cbcc Mon Sep 17 00:00:00 2001 From: "dahyeong.kim" Date: Sat, 30 Mar 2013 14:40:06 +0900 Subject: [PATCH] Parse() remains original value when the function returns errror Change-Id: If5983d3458440ab4c987984133e0aad15734f3e1 Signed-off-by: dahyeong.kim --- inc/FBaseDateTime.h | 6 ++++-- inc/FBaseDouble.h | 1 + inc/FBaseFloat.h | 1 + inc/FBaseInt8.h | 12 +++++++----- inc/FBaseInteger.h | 10 ++++++---- inc/FBaseLong.h | 20 +++++++++++--------- inc/FBaseLongLong.h | 30 ++++++++++++++++-------------- inc/FBaseShort.h | 16 +++++++++------- inc/FBaseUuId.h | 4 +++- src/base/FBaseDouble.cpp | 8 ++++---- src/base/FBaseFloat.cpp | 9 ++++----- src/base/FBaseInt8.cpp | 17 +++++++---------- src/base/FBaseInteger.cpp | 8 ++++---- src/base/FBaseLong.cpp | 8 ++++---- src/base/FBaseLongLong.cpp | 8 ++++---- src/base/FBaseShort.cpp | 13 +++++-------- 16 files changed, 90 insertions(+), 81 deletions(-) diff --git a/inc/FBaseDateTime.h b/inc/FBaseDateTime.h index 4f7fdf7..25a861e 100644 --- a/inc/FBaseDateTime.h +++ b/inc/FBaseDateTime.h @@ -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; diff --git a/inc/FBaseDouble.h b/inc/FBaseDouble.h index 40ebdbf..87f873c 100644 --- a/inc/FBaseDouble.h +++ b/inc/FBaseDouble.h @@ -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); diff --git a/inc/FBaseFloat.h b/inc/FBaseFloat.h index 1415f3b..041f5f4 100644 --- a/inc/FBaseFloat.h +++ b/inc/FBaseFloat.h @@ -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); diff --git a/inc/FBaseInt8.h b/inc/FBaseInt8.h index eb6f65e..7360927 100644 --- a/inc/FBaseInt8.h +++ b/inc/FBaseInt8.h @@ -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); diff --git a/inc/FBaseInteger.h b/inc/FBaseInteger.h index 249ec8e..0e344ae 100644 --- a/inc/FBaseInteger.h +++ b/inc/FBaseInteger.h @@ -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); diff --git a/inc/FBaseLong.h b/inc/FBaseLong.h index bcc59e5..d3d821b 100644 --- a/inc/FBaseLong.h +++ b/inc/FBaseLong.h @@ -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); diff --git a/inc/FBaseLongLong.h b/inc/FBaseLongLong.h index a403b7b..4c60e0d 100644 --- a/inc/FBaseLongLong.h +++ b/inc/FBaseLongLong.h @@ -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); diff --git a/inc/FBaseShort.h b/inc/FBaseShort.h index d006439..9b921d4 100644 --- a/inc/FBaseShort.h +++ b/inc/FBaseShort.h @@ -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); diff --git a/inc/FBaseUuId.h b/inc/FBaseUuId.h index 445525b..437d848 100644 --- a/inc/FBaseUuId.h +++ b/inc/FBaseUuId.h @@ -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); diff --git a/src/base/FBaseDouble.cpp b/src/base/FBaseDouble.cpp index a8d22d2..5d66b87 100644 --- a/src/base/FBaseDouble.cpp +++ b/src/base/FBaseDouble.cpp @@ -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; } diff --git a/src/base/FBaseFloat.cpp b/src/base/FBaseFloat.cpp index 4225a8f..c6aba7d 100644 --- a/src/base/FBaseFloat.cpp +++ b/src/base/FBaseFloat.cpp @@ -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; } diff --git a/src/base/FBaseInt8.cpp b/src/base/FBaseInt8.cpp index 0d60f01..ecf9bd5 100644 --- a/src/base/FBaseInt8.cpp +++ b/src/base/FBaseInt8.cpp @@ -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; diff --git a/src/base/FBaseInteger.cpp b/src/base/FBaseInteger.cpp index 4db73f0..244374c 100644 --- a/src/base/FBaseInteger.cpp +++ b/src/base/FBaseInteger.cpp @@ -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; } diff --git a/src/base/FBaseLong.cpp b/src/base/FBaseLong.cpp index 748bc81..d349748 100644 --- a/src/base/FBaseLong.cpp +++ b/src/base/FBaseLong.cpp @@ -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; } diff --git a/src/base/FBaseLongLong.cpp b/src/base/FBaseLongLong.cpp index 91a8876..f941ece 100644 --- a/src/base/FBaseLongLong.cpp +++ b/src/base/FBaseLongLong.cpp @@ -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; } diff --git a/src/base/FBaseShort.cpp b/src/base/FBaseShort.cpp index 7632bd3..f40452c 100644 --- a/src/base/FBaseShort.cpp +++ b/src/base/FBaseShort.cpp @@ -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; -- 2.7.4