Skip to content

Commit e70cc89

Browse files
Use IsDigit(...) instead of std::isdigit
1 parent 6af27b8 commit e70cc89

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/qt/rpcconsole.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <netbase.h>
1919
#include <rpc/server.h>
2020
#include <rpc/client.h>
21+
#include <util/strencodings.h>
2122
#include <util/system.h>
2223

2324
#include <openssl/crypto.h>
@@ -226,7 +227,7 @@ bool RPCConsole::RPCParseCommandLine(interfaces::Node* node, std::string &strRes
226227
if (lastResult.isArray())
227228
{
228229
for(char argch: curarg)
229-
if (!std::isdigit(argch))
230+
if (!IsDigit(argch))
230231
throw std::runtime_error("Invalid result query");
231232
subelement = lastResult[atoi(curarg.c_str())];
232233
}

src/util/moneystr.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ std::string FormatMoney(const CAmount& n)
2020

2121
// Right-trim excess zeros before the decimal point:
2222
int nTrim = 0;
23-
for (int i = str.size()-1; (str[i] == '0' && isdigit(str[i-2])); --i)
23+
for (int i = str.size()-1; (str[i] == '0' && IsDigit(str[i-2])); --i)
2424
++nTrim;
2525
if (nTrim)
2626
str.erase(str.size()-nTrim, nTrim);
@@ -49,7 +49,7 @@ bool ParseMoney(const char* pszIn, CAmount& nRet)
4949
{
5050
p++;
5151
int64_t nMult = COIN / 10;
52-
while (isdigit(*p) && (nMult > 0))
52+
while (IsDigit(*p) && (nMult > 0))
5353
{
5454
nUnits += nMult * (*p++ - '0');
5555
nMult /= 10;
@@ -58,7 +58,7 @@ bool ParseMoney(const char* pszIn, CAmount& nRet)
5858
}
5959
if (IsSpace(*p))
6060
break;
61-
if (!isdigit(*p))
61+
if (!IsDigit(*p))
6262
return false;
6363
strWhole.insert(strWhole.end(), *p);
6464
}

test/lint/lint-locale-dependence.sh

-5
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ KNOWN_VIOLATIONS=(
55
"src/bitcoin-tx.cpp.*stoul"
66
"src/bitcoin-tx.cpp.*trim_right"
77
"src/bitcoin-tx.cpp:.*atoi"
8-
"src/core_read.cpp.*is_digit"
98
"src/dbwrapper.cpp.*stoul"
109
"src/dbwrapper.cpp:.*vsnprintf"
1110
"src/httprpc.cpp.*trim"
1211
"src/init.cpp:.*atoi"
1312
"src/qt/rpcconsole.cpp:.*atoi"
14-
"src/qt/rpcconsole.cpp:.*isdigit"
1513
"src/rest.cpp:.*strtol"
1614
"src/test/dbwrapper_tests.cpp:.*snprintf"
1715
"src/test/getarg_tests.cpp.*split"
@@ -21,12 +19,9 @@ KNOWN_VIOLATIONS=(
2119
"src/util/system.cpp:.*atoi"
2220
"src/util/system.cpp:.*fprintf"
2321
"src/util/system.cpp:.*tolower"
24-
"src/util/moneystr.cpp:.*isdigit"
2522
"src/util/strencodings.cpp:.*atoi"
2623
"src/util/strencodings.cpp:.*strtol"
27-
"src/util/strencodings.cpp:.*strtoll"
2824
"src/util/strencodings.cpp:.*strtoul"
29-
"src/util/strencodings.cpp:.*strtoull"
3025
"src/util/strencodings.h:.*atoi"
3126
)
3227

0 commit comments

Comments
 (0)