From ff0c87d63cb554b0491cd48758649a5404bb0c2f Mon Sep 17 00:00:00 2001 From: grekiki Date: Thu, 21 Jan 2021 12:02:29 +0100 Subject: [PATCH] fix LGTM issues (#19868) Co-authored-by: Comma Device old-commit-hash: efe8c54a2ed507ae1d8bf0f87bfeb4409babe661 --- selfdrive/ui/qt/widgets/QrCode.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/selfdrive/ui/qt/widgets/QrCode.cc b/selfdrive/ui/qt/widgets/QrCode.cc index b9de86215e..d248b2d8e0 100644 --- a/selfdrive/ui/qt/widgets/QrCode.cc +++ b/selfdrive/ui/qt/widgets/QrCode.cc @@ -349,7 +349,7 @@ QrCode::QrCode(int ver, Ecc ecl, const vector &dataCodewords, int msk) applyMask(i); // Undoes the mask due to XOR } } - if (msk < 0 || msk > 7) + if (msk < 0 || msk > 7)//lgtm [cpp/constant-comparison] throw std::logic_error("Assertion error"); this->mask = msk; applyMask(msk); // Apply the final choice of mask @@ -635,12 +635,12 @@ long QrCode::getPenaltyScore() const { } else { finderPenaltyAddHistory(runX, runHistory); if (!runColor) - result += finderPenaltyCountPatterns(runHistory) * PENALTY_N3; + result += finderPenaltyCountPatterns(runHistory) * PENALTY_N3;//lgtm [cpp/integer-multiplication-cast-to-long] runColor = module(x, y); runX = 1; } } - result += finderPenaltyTerminateAndCount(runColor, runX, runHistory) * PENALTY_N3; + result += finderPenaltyTerminateAndCount(runColor, runX, runHistory) * PENALTY_N3;//lgtm [cpp/integer-multiplication-cast-to-long] } // Adjacent modules in column having same color, and finder-like patterns for (int x = 0; x < size; x++) { @@ -657,12 +657,12 @@ long QrCode::getPenaltyScore() const { } else { finderPenaltyAddHistory(runY, runHistory); if (!runColor) - result += finderPenaltyCountPatterns(runHistory) * PENALTY_N3; + result += finderPenaltyCountPatterns(runHistory) * PENALTY_N3;//lgtm [cpp/integer-multiplication-cast-to-long] runColor = module(x, y); runY = 1; } } - result += finderPenaltyTerminateAndCount(runColor, runY, runHistory) * PENALTY_N3; + result += finderPenaltyTerminateAndCount(runColor, runY, runHistory) * PENALTY_N3;//lgtm [cpp/integer-multiplication-cast-to-long] } // 2*2 blocks of modules having same color