File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -397,13 +397,8 @@ bool MathLib::isBin(const std::string& s)
397397 return state == DIGITS;
398398}
399399
400- bool MathLib::isInt (const std::string & s)
400+ bool MathLib::isDec (const std::string & s)
401401{
402- // check for two known types: hexadecimal and octal
403- if (isHex (s) || isOct (s)) {
404- return true ;
405- }
406-
407402 enum {START, PLUSMINUS, DIGIT, SUFFIX} state = START;
408403 for (std::string::const_iterator it = s.begin (); it != s.end (); ++it) {
409404 switch (state) {
@@ -434,6 +429,11 @@ bool MathLib::isInt(const std::string & s)
434429 return state == DIGIT;
435430}
436431
432+ bool MathLib::isInt (const std::string & s)
433+ {
434+ return isDec (s) || isHex (s) || isOct (s);
435+ }
436+
437437std::string MathLib::add (const std::string & first, const std::string & second)
438438{
439439 if (MathLib::isInt (first) && MathLib::isInt (second)) {
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ class CPPCHECKLIB MathLib {
4747 static bool isFloat (const std::string &str);
4848 static bool isNegative (const std::string &str);
4949 static bool isPositive (const std::string &str);
50+ static bool isDec (const std::string & str);
5051 static bool isHex (const std::string& str);
5152 static bool isOct (const std::string& str);
5253 static bool isBin (const std::string& str);
You can’t perform that action at this time.
0 commit comments