Int8::Decode(const String& s, char& ret)
{
SysTryReturn(NID_BASE, s.GetLength() >= 1, E_NUM_FORMAT, E_NUM_FORMAT,
- "[%s] The length of string s MUST be greater than 0.", GetErrorMessage(E_NUM_FORMAT));
+ "[%s] The length of input String MUST be greater than 0.", GetErrorMessage(E_NUM_FORMAT));
long value = 0;
int radix = 0;
result
Int8::Parse(const String& s, char& ret)
{
- int len = s.GetLength();
- SysTryReturn(NID_BASE, (len > 0 && len < 5), E_NUM_FORMAT, E_NUM_FORMAT,
- "[%s] The length of s(%ls) MUST be greater than 0 and less than 5.", GetErrorMessage(E_NUM_FORMAT), s.GetPointer());
-
return Parse(s, Character::RADIX_DECIMAL, ret);
}
"[%s] The radix(%d) MUST be one of 2, 8, 10 and 16.", GetErrorMessage(E_OUT_OF_RANGE), radix);
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.",
+ SysTryReturn(NID_BASE, len > 0, E_NUM_FORMAT, E_NUM_FORMAT, "[%s] The length of input String MUST be greater than 0.",
GetErrorMessage(E_NUM_FORMAT));
- result r = E_SUCCESS;
-
errno = 0;
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).",
+ 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);
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));
ret = static_cast< char >(value);
}
- return r;
+ return E_SUCCESS;
}
char