Skip to content

Commit 481d310

Browse files
committed
utils.h: adjusted checks of isdigit() result in strToInt()
1 parent 2effcb1 commit 481d310

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ bool strToInt(const std::string& str, T &num, std::string* err = nullptr)
237237
*err = "needs to be positive";
238238
return false;
239239
}
240-
if (str.front() != '+' && str.front() != '-' && !isdigit(str.front())) {
240+
if (str.front() != '+' && str.front() != '-' && isdigit(str.front()) == 0) {
241241
if (err)
242242
*err = "not an integer";
243243
return false;
@@ -282,7 +282,7 @@ bool strToInt(const std::string& str, T &num, std::string* err = nullptr)
282282
*err = "needs to be positive";
283283
return false;
284284
}
285-
if (str.front() != '+' && !isdigit(str.front())) {
285+
if (str.front() != '+' && isdigit(str.front()) == 0) {
286286
if (err)
287287
*err = "not an integer";
288288
return false;

0 commit comments

Comments
 (0)