Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/checkbufferoverrun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ ValueFlow::Value CheckBufferOverrun::getBufferSize(const Token *bufTok) const
if (!var || var->isPointer())
return ValueFlow::Value(-1);

const MathLib::bigint dim = std::accumulate(var->dimensions().cbegin(), var->dimensions().cend(), 1LL, [](MathLib::bigint i1, const Dimension &dim) {
const MathLib::bigint dim = std::accumulate(var->dimensions().cbegin(), var->dimensions().cend(), MathLib::bigint(1), [](MathLib::bigint i1, const Dimension &dim) {
return i1 * dim.num;
});

Expand Down
2 changes: 1 addition & 1 deletion lib/checktype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ void CheckType::checkFloatToIntegerOverflow(const Token *tok, const ValueType *v
bits = mSettings->platform.long_long_bit;
else
continue;
if (bits < MathLib::bigint_bits && f.floatValue >= (static_cast<MathLib::biguint>(1) << bits))
if (bits < MathLib::bigint_bits && f.floatValue >= (1ULL << bits))
floatToIntegerOverflowError(tok, f);
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/clangimport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@
if (nodeType == BreakStmt)
return addtoken(tokenList, "break");
if (nodeType == CharacterLiteral) {
const int c = MathLib::toBigNumber(mExtTokens.back());
const int c = static_cast<int>(MathLib::toBigNumber(mExtTokens.back()));
if (c == 0)
return addtoken(tokenList, "\'\\0\'");
if (c == '\r')
Expand Down Expand Up @@ -1582,7 +1582,7 @@

MathLib::bigint typeSize = 0;
for (const Variable &var: scope.varlist) {
const int mul = std::accumulate(var.dimensions().cbegin(), var.dimensions().cend(), 1, [](int v, const Dimension& dim) {
const MathLib::bigint mul = std::accumulate(var.dimensions().cbegin(), var.dimensions().cend(), MathLib::bigint(1), [](MathLib::bigint v, const Dimension& dim) {
return v * dim.num;
});
if (var.valueType())
Expand Down
4 changes: 2 additions & 2 deletions lib/token.h
Original file line number Diff line number Diff line change
Expand Up @@ -778,10 +778,10 @@
bool setBits(const MathLib::bigint b) {
const MathLib::bigint max = std::numeric_limits<short>::max();
if (b > max) {
mImpl->mBits = max;
mImpl->mBits = static_cast<short>(max);
return false;
}
mImpl->mBits = b < 0 ? -1 : b;
mImpl->mBits = b < 0 ? -1 : static_cast<short>(b);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10025,7 +10025,7 @@ void Tokenizer::simplifyBitfields()
}

const auto tooLargeError = [this](const Token *tok) {
const MathLib::bigint max = std::numeric_limits<short>::max();
const auto max = std::numeric_limits<short>::max();
reportError(tok,
Severity::warning,
"tooLargeBitField",
Expand Down
2 changes: 1 addition & 1 deletion lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ static Result accumulateStructMembers(const Scope* scope, F f, ValueFlow::Accura
if (const ValueType* vt = var.valueType()) {
if (vt->type == ValueType::Type::RECORD && vt->typeScope == scope)
return {0, false};
const MathLib::bigint dim = std::accumulate(var.dimensions().cbegin(), var.dimensions().cend(), 1LL, [](MathLib::bigint i1, const Dimension& dim) {
const MathLib::bigint dim = std::accumulate(var.dimensions().cbegin(), var.dimensions().cend(), MathLib::bigint(1), [](MathLib::bigint i1, const Dimension& dim) {
return i1 * dim.num;
});
if (var.nameToken()->scope() != scope && var.nameToken()->scope()->definedType) { // anonymous union
Expand Down
2 changes: 1 addition & 1 deletion test/testclangimport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ class TestClangImport : public TestFixture {
ASSERT(!!tok);
tok = tok->next();
ASSERT(tok->hasKnownIntValue());
ASSERT_EQUALS(44, tok->getKnownIntValue());
ASSERT_EQUALS(MathLib::bigint(44), tok->getKnownIntValue());
}

void valueFlow2() {
Expand Down