Fix CodeQL warning, Multiplication result converted to larger type
This commit is contained in:
parent
52b88bcee3
commit
88a35d2253
|
@ -216,15 +216,15 @@ void CheckFunctions::checkIgnoredReturnValue()
|
|||
}
|
||||
|
||||
if ((!tok->function() || !Token::Match(tok->function()->retDef, "void %name%")) &&
|
||||
!WRONG_DATA(!tok->next()->astOperand1(), tok)) {
|
||||
!WRONG_DATA(!tok->next()->astOperand1(), tok)) {
|
||||
const Library::UseRetValType retvalTy = mSettings->library.getUseRetValType(tok);
|
||||
if (mSettings->isEnabled(Settings::WARNING) &&
|
||||
((retvalTy == Library::UseRetValType::DEFAULT) ||
|
||||
(tok->function() && tok->function()->isAttributeNodiscard())))
|
||||
ignoredReturnValueError(tok, tok->next()->astOperand1()->expressionString());
|
||||
(tok->function() && tok->function()->isAttributeNodiscard())))
|
||||
ignoredReturnValueError(tok, tok->next()->astOperand1()->expressionString());
|
||||
else if (mSettings->isEnabled(Settings::STYLE) &&
|
||||
retvalTy == Library::UseRetValType::ERROR_CODE)
|
||||
ignoredReturnErrorCode(tok, tok->next()->astOperand1()->expressionString());
|
||||
ignoredReturnErrorCode(tok, tok->next()->astOperand1()->expressionString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,8 +219,8 @@ std::string Suppressions::addSuppressionLine(const std::string &line)
|
|||
std::string Suppressions::addSuppression(const Suppressions::Suppression &suppression)
|
||||
{
|
||||
// Check if suppression is already in list
|
||||
auto foundSuppression = std::find_if(mSuppressions.begin(), mSuppressions.end(),
|
||||
std::bind(&Suppression::isSameParameters, &suppression, std::placeholders::_1));
|
||||
auto foundSuppression = std::find_if(mSuppressions.begin(), mSuppressions.end(),
|
||||
std::bind(&Suppression::isSameParameters, &suppression, std::placeholders::_1));
|
||||
if (foundSuppression != mSuppressions.end()) {
|
||||
// Update matched state of existing global suppression
|
||||
if (!suppression.isLocal() && suppression.matched)
|
||||
|
|
|
@ -102,11 +102,11 @@ public:
|
|||
|
||||
bool isSameParameters(const Suppression &other) const {
|
||||
return errorId == other.errorId &&
|
||||
fileName == other.fileName &&
|
||||
lineNumber == other.lineNumber &&
|
||||
symbolName == other.symbolName &&
|
||||
hash == other.hash &&
|
||||
thisAndNextLine == other.thisAndNextLine;
|
||||
fileName == other.fileName &&
|
||||
lineNumber == other.lineNumber &&
|
||||
symbolName == other.symbolName &&
|
||||
hash == other.hash &&
|
||||
thisAndNextLine == other.thisAndNextLine;
|
||||
}
|
||||
|
||||
std::string errorId;
|
||||
|
|
|
@ -596,8 +596,8 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value, const Setti
|
|||
value2.isIntValue())) {
|
||||
ValueFlow::Value result(0);
|
||||
combineValueProperties(value1, value2, &result);
|
||||
const float floatValue1 = value1.isIntValue() ? value1.intvalue : value1.floatValue;
|
||||
const float floatValue2 = value2.isIntValue() ? value2.intvalue : value2.floatValue;
|
||||
const double floatValue1 = value1.isIntValue() ? value1.intvalue : value1.floatValue;
|
||||
const double floatValue2 = value2.isIntValue() ? value2.intvalue : value2.floatValue;
|
||||
switch (parent->str()[0]) {
|
||||
case '+':
|
||||
if (value1.isTokValue() || value2.isTokValue())
|
||||
|
|
Loading…
Reference in New Issue