Use IsDigit(...) instead of std::isdigit

This commit is contained in:
practicalswift 2018-10-29 09:13:07 +01:00
parent 6af27b8157
commit e70cc8983c
3 changed files with 5 additions and 9 deletions

View file

@ -18,6 +18,7 @@
#include <netbase.h>
#include <rpc/server.h>
#include <rpc/client.h>
#include <util/strencodings.h>
#include <util/system.h>
#include <openssl/crypto.h>
@ -226,7 +227,7 @@ bool RPCConsole::RPCParseCommandLine(interfaces::Node* node, std::string &strRes
if (lastResult.isArray())
{
for(char argch: curarg)
if (!std::isdigit(argch))
if (!IsDigit(argch))
throw std::runtime_error("Invalid result query");
subelement = lastResult[atoi(curarg.c_str())];
}

View file

@ -20,7 +20,7 @@ std::string FormatMoney(const CAmount& n)
// Right-trim excess zeros before the decimal point:
int nTrim = 0;
for (int i = str.size()-1; (str[i] == '0' && isdigit(str[i-2])); --i)
for (int i = str.size()-1; (str[i] == '0' && IsDigit(str[i-2])); --i)
++nTrim;
if (nTrim)
str.erase(str.size()-nTrim, nTrim);
@ -49,7 +49,7 @@ bool ParseMoney(const char* pszIn, CAmount& nRet)
{
p++;
int64_t nMult = COIN / 10;
while (isdigit(*p) && (nMult > 0))
while (IsDigit(*p) && (nMult > 0))
{
nUnits += nMult * (*p++ - '0');
nMult /= 10;
@ -58,7 +58,7 @@ bool ParseMoney(const char* pszIn, CAmount& nRet)
}
if (IsSpace(*p))
break;
if (!isdigit(*p))
if (!IsDigit(*p))
return false;
strWhole.insert(strWhole.end(), *p);
}

View file

@ -5,13 +5,11 @@ KNOWN_VIOLATIONS=(
"src/bitcoin-tx.cpp.*stoul"
"src/bitcoin-tx.cpp.*trim_right"
"src/bitcoin-tx.cpp:.*atoi"
"src/core_read.cpp.*is_digit"
"src/dbwrapper.cpp.*stoul"
"src/dbwrapper.cpp:.*vsnprintf"
"src/httprpc.cpp.*trim"
"src/init.cpp:.*atoi"
"src/qt/rpcconsole.cpp:.*atoi"
"src/qt/rpcconsole.cpp:.*isdigit"
"src/rest.cpp:.*strtol"
"src/test/dbwrapper_tests.cpp:.*snprintf"
"src/test/getarg_tests.cpp.*split"
@ -21,12 +19,9 @@ KNOWN_VIOLATIONS=(
"src/util/system.cpp:.*atoi"
"src/util/system.cpp:.*fprintf"
"src/util/system.cpp:.*tolower"
"src/util/moneystr.cpp:.*isdigit"
"src/util/strencodings.cpp:.*atoi"
"src/util/strencodings.cpp:.*strtol"
"src/util/strencodings.cpp:.*strtoll"
"src/util/strencodings.cpp:.*strtoul"
"src/util/strencodings.cpp:.*strtoull"
"src/util/strencodings.h:.*atoi"
)