mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-01 01:16:55 +02:00
use signed char for sign; silence clang warnings
This commit is contained in:
parent
e19eb5b704
commit
0b6c8aa1e0
@ -91,7 +91,7 @@ bool strToInt(const char* pStr, I& result, short base, char thSep = ',')
|
||||
if (!pStr) return false;
|
||||
while (isspace(*pStr)) ++pStr;
|
||||
if (*pStr == '\0') return false;
|
||||
I sign = 1;
|
||||
char sign = 1;
|
||||
if ((base == 10) && (*pStr == '-'))
|
||||
{
|
||||
sign = -1;
|
||||
|
@ -82,42 +82,42 @@ private:
|
||||
{
|
||||
T result = 0;
|
||||
if (123 <= std::numeric_limits<T>::max())
|
||||
assert(strToInt("123", result, 10)); assert(result == 123);
|
||||
assert(Poco::strToInt("123", result, 10)); assert(result == 123);
|
||||
|
||||
assert(strToInt("0", result, 10)); assert(result == 0);
|
||||
assert(strToInt("000", result, 10)); assert(result == 0);
|
||||
assert(Poco::strToInt("0", result, 10)); assert(result == 0);
|
||||
assert(Poco::strToInt("000", result, 10)); assert(result == 0);
|
||||
|
||||
if (123 < std::numeric_limits<T>::max())
|
||||
{ assert(strToInt(" 123 ", result, 10)); assert(result == 123); }
|
||||
{ assert(Poco::strToInt(" 123 ", result, 10)); assert(result == 123); }
|
||||
if (123 < std::numeric_limits<T>::max())
|
||||
{ assert(strToInt(" 123", result, 10)); assert(result == 123); }
|
||||
{ assert(Poco::strToInt(" 123", result, 10)); assert(result == 123); }
|
||||
if (123 < std::numeric_limits<T>::max())
|
||||
{ assert(strToInt("123 ", result, 10)); assert(result == 123); }
|
||||
{ assert(Poco::strToInt("123 ", result, 10)); assert(result == 123); }
|
||||
if (std::numeric_limits<T>::is_signed && (-123 > std::numeric_limits<T>::min()))
|
||||
{ assert(strToInt("-123", result, 10)); assert(result == -123); }
|
||||
{ assert(Poco::strToInt("-123", result, 10)); assert(result == -123); }
|
||||
if (0x123 < std::numeric_limits<T>::max())
|
||||
{ assert(strToInt("123", result, 0x10)); assert(result == 0x123); }
|
||||
{ assert(Poco::strToInt("123", result, 0x10)); assert(result == 0x123); }
|
||||
if (0x12ab < std::numeric_limits<T>::max())
|
||||
{ assert(strToInt("12AB", result, 0x10)); assert(result == 0x12ab); }
|
||||
{ assert(Poco::strToInt("12AB", result, 0x10)); assert(result == 0x12ab); }
|
||||
if (0x12ab < std::numeric_limits<T>::max())
|
||||
{ assert(strToInt("0X12AB", result, 0x10)); assert(result == 0x12ab); }
|
||||
{ assert(Poco::strToInt("0X12AB", result, 0x10)); assert(result == 0x12ab); }
|
||||
if (0x12ab < std::numeric_limits<T>::max())
|
||||
{ assert(strToInt("0x12AB", result, 0x10)); assert(result == 0x12ab); }
|
||||
{ assert(Poco::strToInt("0x12AB", result, 0x10)); assert(result == 0x12ab); }
|
||||
if (0x12ab < std::numeric_limits<T>::max())
|
||||
{ assert(strToInt("0x12aB", result, 0x10)); assert(result == 0x12ab); }
|
||||
{ assert(Poco::strToInt("0x12aB", result, 0x10)); assert(result == 0x12ab); }
|
||||
if (0x98fe < std::numeric_limits<T>::max())
|
||||
{ assert(strToInt("0X98Fe", result, 0x10)); assert(result == 0x98fe); }
|
||||
{ assert(Poco::strToInt("0X98Fe", result, 0x10)); assert(result == 0x98fe); }
|
||||
if (123 < std::numeric_limits<T>::max())
|
||||
{ assert(strToInt("0x0", result, 0x10)); assert(result == 0); }
|
||||
{ assert(Poco::strToInt("0x0", result, 0x10)); assert(result == 0); }
|
||||
if (123 < std::numeric_limits<T>::max())
|
||||
{ assert(strToInt("00", result, 0x10)); assert(result == 0); }
|
||||
{ assert(Poco::strToInt("00", result, 0x10)); assert(result == 0); }
|
||||
if (0123 < std::numeric_limits<T>::max())
|
||||
{ assert(strToInt("123", result, 010)); assert(result == 0123); }
|
||||
{ assert(Poco::strToInt("123", result, 010)); assert(result == 0123); }
|
||||
if (0123 < std::numeric_limits<T>::max())
|
||||
{ assert(strToInt("0123", result, 010)); assert(result == 0123); }
|
||||
{ assert(Poco::strToInt("0123", result, 010)); assert(result == 0123); }
|
||||
|
||||
assert(strToInt("0", result, 010)); assert(result == 0);
|
||||
assert(strToInt("000", result, 010)); assert(result == 0);
|
||||
assert(Poco::strToInt("0", result, 010)); assert(result == 0);
|
||||
assert(Poco::strToInt("000", result, 010)); assert(result == 0);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
Loading…
x
Reference in New Issue
Block a user