diff --git a/lib/library.cpp b/lib/library.cpp index d637d85f0..9cb0bec72 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -1200,7 +1200,7 @@ int Library::returnValueContainer(const Token *ftok) const return it != mReturnValueContainer.end() ? it->second : -1; } -bool Library::returnValueSafeValues(const Token *ftok, int64_t *v1, int64_t *v2) const +bool Library::returnValueSafeValues(const Token *ftok, MathLib::bigint *v1, MathLib::bigint *v2) const { if (isNotLibraryFunction(ftok)) return false; diff --git a/lib/library.h b/lib/library.h index 019871d8c..d1e094be9 100644 --- a/lib/library.h +++ b/lib/library.h @@ -181,7 +181,7 @@ public: const std::string& returnValue(const Token *ftok) const; const std::string& returnValueType(const Token *ftok) const; int returnValueContainer(const Token *ftok) const; - bool returnValueSafeValues(const Token *ftok, int64_t *v1, int64_t *v2) const; + bool returnValueSafeValues(const Token *ftok, MathLib::bigint *v1, MathLib::bigint *v2) const; bool isnoreturn(const Token *ftok) const; bool isnotnoreturn(const Token *ftok) const; @@ -543,8 +543,8 @@ private: std::map mReturnValueType; std::map mReturnValueContainer; struct SafeValues { - int64_t minValue; - int64_t maxValue; + MathLib::bigint minValue; + MathLib::bigint maxValue; }; std::map mReturnSafeValues; std::map mReportErrors; diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 0ad3411da..d8f3c5ca0 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -5338,7 +5338,7 @@ static void valueFlowDynamicBufferSize(TokenList *tokenlist, SymbolDatabase *sym } } -static bool getMinMaxValues(const ValueType *vt, const cppcheck::Platform &platform, int64_t *minValue, int64_t *maxValue) +static bool getMinMaxValues(const ValueType *vt, const cppcheck::Platform &platform, MathLib::bigint *minValue, MathLib::bigint *maxValue) { if (!vt || !vt->isIntegral() || vt->pointer) return false; @@ -5393,7 +5393,7 @@ static bool getMinMaxValues(const ValueType *vt, const cppcheck::Platform &platf return true; } -static bool getMinMaxValues(const std::string &typestr, const Settings *settings, int64_t *minvalue, int64_t *maxvalue) +static bool getMinMaxValues(const std::string &typestr, const Settings *settings, MathLib::bigint *minvalue, MathLib::bigint *maxvalue) { TokenList typeTokens(settings); std::istringstream istr(typestr+";"); @@ -5420,7 +5420,7 @@ static void valueFlowSafeFunctions(TokenList *tokenlist, SymbolDatabase *symbold continue; for (const Variable &arg : function->argumentList) { - int64_t minValue, maxValue; + MathLib::bigint minValue, maxValue; if (!getMinMaxValues(arg.valueType(), *settings, &minValue, &maxValue)) continue; @@ -5451,13 +5451,13 @@ static void valueFlowSafeFunctionReturn(TokenList *tokenlist, const Settings *se continue; if (!Token::Match(tok->previous(), "%name%")) continue; - int64_t v1,v2; + MathLib::bigint v1,v2; if (!settings->library.returnValueSafeValues(tok->previous(), &v1, &v2)) continue; // Get min/max values for return type const std::string typestr = settings->library.returnValueType(tok->previous()); - int64_t minvalue, maxvalue; + MathLib::bigint minvalue, maxvalue; if (!getMinMaxValues(typestr, settings, &minvalue, &maxvalue)) continue;