Skip to content

Commit

Permalink
Fix/silence some more clang-tidy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Waqar144 committed Apr 5, 2024
1 parent f00493c commit 0965300
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions 3rdparty/qt/5.5/private/qpaintbuffer_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,10 @@ class QPainterReplayer
void processCommands(const QPaintBuffer &buffer, QPainter *painter, int begin, int end);

protected:
QPaintBufferPrivate *d;
QPaintBufferPrivate *d = nullptr;
QTransform m_world_matrix;

QPainter *painter;
QPainter *painter = nullptr;

private:
Q_DISABLE_COPY(QPainterReplayer)
Expand Down
2 changes: 2 additions & 0 deletions plugins/quickinspector/quickdecorationsdrawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ void QuickDecorationsDrawer::drawGrid()
QVector<QLineF> lines;
lines.reserve((viewRect.width() / gridCellSize.width()) + (viewRect.height() / gridCellSize.height()));

// NOLINTNEXTLINE (clang-analyzer-security.FloatLoopCounter)
for (qreal x = viewRect.left() + gridOffset.x(); x < viewRect.right(); x += gridCellSize.width()) {
if (x < viewRect.left())
continue;
Expand All @@ -363,6 +364,7 @@ void QuickDecorationsDrawer::drawGrid()
QPointF(x, viewRect.bottom()) * m_renderInfo->zoom);
}

// NOLINTNEXTLINE (clang-analyzer-security.FloatLoopCounter)
for (qreal y = viewRect.top() + gridOffset.y(); y < viewRect.bottom(); y += gridCellSize.height()) {
if (y < viewRect.top())
continue;
Expand Down
2 changes: 2 additions & 0 deletions plugins/wlcompositorinspector/logview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ class Timeline : public QScrollArea
int startLine = drawRect.left() / linesSpacing - (rit - it) / m_zoom; // round the starting position so that we have nice numbers'

int s = startLine;
// NOLINTNEXTLINE (clang-analyzer-security.FloatLoopCounter)
for (qreal i = startLine * linesSpacing; i < drawRect.right(); i += linesSpacing, s++) {
bool isStep = s % substeps == 0;
painter.setPen(isStep ? palette.color(QPalette::Highlight) : palette.color(QPalette::Midlight));
Expand All @@ -461,6 +462,7 @@ class Timeline : public QScrollArea
// draw the text after having drawn all the lines, so we're sure they don't go over it
s = startLine;
painter.setPen(palette.color(QPalette::Highlight));
// NOLINTNEXTLINE (clang-analyzer-security.FloatLoopCounter)
for (qreal i = startLine * linesSpacing; i < drawRect.right(); i += step / substeps, s++) { // krazy:exclude=postfixop
bool isStep = s % substeps == 0;
if (isStep) {
Expand Down
3 changes: 3 additions & 0 deletions tests/metaobjecttest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ private slots:
}

QVERIFY(prop);
if (!prop) return; // to silence clang-tidy

QCOMPARE(prop->name(), "priority");
QCOMPARE(prop->typeName(), "QThread::Priority");

Expand All @@ -87,6 +89,7 @@ private slots:
}

QVERIFY(prop);
if (!prop) return; // to silence clang-tidy
QCOMPARE(prop->name(), "libraryPaths");
QCOMPARE(prop->typeName(), "QStringList");
QCOMPARE(prop->isReadOnly(), true);
Expand Down
3 changes: 2 additions & 1 deletion tests/quickinspectorpickingtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ class QuickInspectorPickingTest : public QObject
qputenv("GAMMARAY_ServerAddress", GAMMARAY_DEFAULT_LOCAL_TCP_URL);
Hooks::installHooks();
Probe::startupHookReceived();
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
// NOLINTNEXTLINE (clang-analyzer-cplusplus.NewDeleteLeaks)
new ProbeCreator(ProbeCreator::Create);
// NOLINTNEXTLINE (clang-analyzer-cplusplus.NewDeleteLeaks)
QTest::qWait(1); // event loop re-entry
}

Expand Down

0 comments on commit 0965300

Please sign in to comment.