mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
Fix some clang 10 -Wsign-compare warnings (#2960)
In file included from /data/mwrep/res/osp/Poco/JSON/20-0-0-0/include/Poco/JSON/Object.h:22:
In file included from /data/mwrep/res/osp/Poco/JSON/20-0-0-0/include/Poco/JSON/Array.h:23:
In file included from /data/mwrep/res/osp/Poco/Foundation/20-0-0-0/include/Poco/Dynamic/Var.h:26:
In file included from /data/mwrep/res/osp/Poco/Foundation/20-0-0-0/include/Poco/Dynamic/VarHolder.h:22:
In file included from /data/mwrep/res/osp/Poco/Foundation/20-0-0-0/include/Poco/NumberFormatter.h:22:
/data/mwrep/res/osp/Poco/Foundation/20-0-0-0/include/Poco/NumericString.h:220:31: error: comparison of integers of different signs: 'unsigned long' and 'char' [-Werror,-Wsign-compare]
if ((limitCheck - result) < add) return false;
~~~~~~~~~~~~~~~~~~~ ^ ~~~
/data/mwrep/res/osp/Poco/Foundation/20-0-0-0/include/Poco/NumericString.h:229:31: error: comparison of integers of different signs: 'unsigned long' and 'char' [-Werror,-Wsign-compare]
if ((limitCheck - result) < add) return false;
~~~~~~~~~~~~~~~~~~~ ^ ~~~
/data/mwrep/res/osp/Poco/Foundation/20-0-0-0/include/Poco/NumericString.h:240:31: error: comparison of integers of different signs: 'unsigned long' and 'char' [-Werror,-Wsign-compare]
if ((limitCheck - result) < add) return false;
~~~~~~~~~~~~~~~~~~~ ^ ~~~
/data/mwrep/res/osp/Poco/Foundation/20-0-0-0/include/Poco/NumericString.h:249:31: error: comparison of integers of different signs: 'unsigned long' and 'char' [-Werror,-Wsign-compare]
if ((limitCheck - result) < add) return false;
~~~~~~~~~~~~~~~~~~~ ^ ~~~
4 errors generated.
This commit is contained in:
committed by
GitHub
parent
15e242b4bc
commit
3e563492ef
@@ -216,7 +216,7 @@ bool strToInt(const char* pStr, I& outResult, short base, char thSep = ',')
|
|||||||
case '0': case '1': case '2': case '3':
|
case '0': case '1': case '2': case '3':
|
||||||
case '4': case '5': case '6': case '7':
|
case '4': case '5': case '6': case '7':
|
||||||
{
|
{
|
||||||
char add = (*pStr - '0');
|
unsigned char add = (*pStr - '0');
|
||||||
if ((limitCheck - result) < add) return false;
|
if ((limitCheck - result) < add) return false;
|
||||||
result = result * base + add;
|
result = result * base + add;
|
||||||
}
|
}
|
||||||
@@ -225,7 +225,7 @@ bool strToInt(const char* pStr, I& outResult, short base, char thSep = ',')
|
|||||||
case '8': case '9':
|
case '8': case '9':
|
||||||
if ((base == 10) || (base == 0x10))
|
if ((base == 10) || (base == 0x10))
|
||||||
{
|
{
|
||||||
char add = (*pStr - '0');
|
unsigned char add = (*pStr - '0');
|
||||||
if ((limitCheck - result) < add) return false;
|
if ((limitCheck - result) < add) return false;
|
||||||
result = result * base + add;
|
result = result * base + add;
|
||||||
}
|
}
|
||||||
@@ -236,7 +236,7 @@ bool strToInt(const char* pStr, I& outResult, short base, char thSep = ',')
|
|||||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||||
{
|
{
|
||||||
if (base != 0x10) return false;
|
if (base != 0x10) return false;
|
||||||
char add = (*pStr - 'a');
|
unsigned char add = (*pStr - 'a');
|
||||||
if ((limitCheck - result) < add) return false;
|
if ((limitCheck - result) < add) return false;
|
||||||
result = result * base + (10 + add);
|
result = result * base + (10 + add);
|
||||||
}
|
}
|
||||||
@@ -245,7 +245,7 @@ bool strToInt(const char* pStr, I& outResult, short base, char thSep = ',')
|
|||||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||||
{
|
{
|
||||||
if (base != 0x10) return false;
|
if (base != 0x10) return false;
|
||||||
char add = (*pStr - 'A');
|
unsigned char add = (*pStr - 'A');
|
||||||
if ((limitCheck - result) < add) return false;
|
if ((limitCheck - result) < add) return false;
|
||||||
result = result * base + (10 + add);
|
result = result * base + (10 + add);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user