- SysTryReturnResult(NID_BASE, radix == Character::RADIX_BINARY || radix == Character::RADIX_OCTAL ||
- 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);
-
- 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;
- 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 && (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;
+ long long value;
+ result r = _NumberUtil::Parse(s, radix, value);
+ SysTryReturnResult(NID_BASE, r == E_SUCCESS, r, "Propagating.");
+ ret = value;
+ return r;