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:
Romain Geissler @ Amadeus 2022-06-21 18:01:05 +02:00 committed by GitHub
parent 15e242b4bc
commit 3e563492ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -216,7 +216,7 @@ bool strToInt(const char* pStr, I& outResult, short base, char thSep = ',')
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
{
char add = (*pStr - '0');
unsigned char add = (*pStr - '0');
if ((limitCheck - result) < add) return false;
result = result * base + add;
}
@ -225,7 +225,7 @@ bool strToInt(const char* pStr, I& outResult, short base, char thSep = ',')
case '8': case '9':
if ((base == 10) || (base == 0x10))
{
char add = (*pStr - '0');
unsigned char add = (*pStr - '0');
if ((limitCheck - result) < add) return false;
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':
{
if (base != 0x10) return false;
char add = (*pStr - 'a');
unsigned char add = (*pStr - 'a');
if ((limitCheck - result) < add) return false;
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':
{
if (base != 0x10) return false;
char add = (*pStr - 'A');
unsigned char add = (*pStr - 'A');
if ((limitCheck - result) < add) return false;
result = result * base + (10 + add);
}