Sonar warnings.

This commit is contained in:
Roman Telezhynskyi 2024-02-14 11:54:24 +02:00
parent c8edf84def
commit 3b6aae076f
12 changed files with 32 additions and 41 deletions

View File

@ -77,6 +77,10 @@
#include "xml/vplayoutfilereader.h" #include "xml/vplayoutfilereader.h"
#include "xml/vplayoutfilewriter.h" #include "xml/vplayoutfilewriter.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes") QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
QT_WARNING_DISABLE_INTEL(1418) QT_WARNING_DISABLE_INTEL(1418)
@ -86,11 +90,6 @@ Q_LOGGING_CATEGORY(pWindow, "p.window") // NOLINT
QT_WARNING_POP QT_WARNING_POP
using namespace std::chrono_literals; using namespace std::chrono_literals;
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals; using namespace Qt::Literals::StringLiterals;
namespace namespace

View File

@ -217,12 +217,11 @@
#include <QMimeData> #include <QMimeData>
#endif // defined(Q_OS_MAC) #endif // defined(Q_OS_MAC)
using namespace std::chrono_literals;
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"
#endif #endif
using namespace std::chrono_literals;
using namespace Qt::Literals::StringLiterals; using namespace Qt::Literals::StringLiterals;
QT_WARNING_PUSH QT_WARNING_PUSH
@ -4349,9 +4348,9 @@ void MainWindow::on_actionUpdateManualLayout_triggered()
rldFile.setAutoRemove(false); rldFile.setAutoRemove(false);
const QString path = VApplication::PuzzleFilePath(); const QString puzzlePath = VApplication::PuzzleFilePath();
qDebug("Opening Puzzle: path = %s.", qUtf8Printable(path)); qDebug("Opening Puzzle: path = %s.", qUtf8Printable(puzzlePath));
VApplication::StartDetachedProcess(path, arguments); VApplication::StartDetachedProcess(puzzlePath, arguments);
} }
else else
{ {

View File

@ -580,19 +580,19 @@ auto DRW_LWPolyline::parseCode(int code, const std::unique_ptr<dxfReader> &reade
break; break;
} }
case 20: case 20:
if (vertex != NULL) if (vertex != nullptr)
vertex->y = reader->getDouble(); vertex->y = reader->getDouble();
break; break;
case 40: case 40:
if (vertex != NULL) if (vertex != nullptr)
vertex->stawidth = reader->getDouble(); vertex->stawidth = reader->getDouble();
break; break;
case 41: case 41:
if (vertex != NULL) if (vertex != nullptr)
vertex->endwidth = reader->getDouble(); vertex->endwidth = reader->getDouble();
break; break;
case 42: case 42:
if (vertex != NULL) if (vertex != nullptr)
vertex->bulge = reader->getDouble(); vertex->bulge = reader->getDouble();
break; break;
case 38: case 38:
@ -1038,11 +1038,11 @@ auto DRW_Spline::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -
break; break;
} }
case 20: case 20:
if (controlpoint != NULL) if (controlpoint != nullptr)
controlpoint->y = reader->getDouble(); controlpoint->y = reader->getDouble();
break; break;
case 30: case 30:
if (controlpoint != NULL) if (controlpoint != nullptr)
controlpoint->z = reader->getDouble(); controlpoint->z = reader->getDouble();
break; break;
case 11: case 11:
@ -1053,11 +1053,11 @@ auto DRW_Spline::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -
break; break;
} }
case 21: case 21:
if (fitpoint != NULL) if (fitpoint != nullptr)
fitpoint->y = reader->getDouble(); fitpoint->y = reader->getDouble();
break; break;
case 31: case 31:
if (fitpoint != NULL) if (fitpoint != nullptr)
fitpoint->z = reader->getDouble(); fitpoint->z = reader->getDouble();
break; break;
case 40: case 40:
@ -1279,11 +1279,11 @@ auto DRW_Leader::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -
break; break;
} }
case 20: case 20:
if (vertexpoint != NULL) if (vertexpoint != nullptr)
vertexpoint->y = reader->getDouble(); vertexpoint->y = reader->getDouble();
break; break;
case 30: case 30:
if (vertexpoint != NULL) if (vertexpoint != nullptr)
vertexpoint->z = reader->getDouble(); vertexpoint->z = reader->getDouble();
break; break;
case 340: case 340:

View File

@ -1649,7 +1649,7 @@ auto dxfRW::writeImage(DRW_Image *ent, const std::string &name) -> DRW_ImageDef
id = imageDef.at(i); id = imageDef.at(i);
} }
} }
if (id == NULL) if (id == nullptr)
{ {
id = new DRW_ImageDef(); id = new DRW_ImageDef();
imageDef.push_back(id); imageDef.push_back(id);

View File

@ -57,12 +57,11 @@
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
#endif #endif
using namespace std::chrono_literals;
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"
#endif #endif
using namespace std::chrono_literals;
using namespace Qt::Literals::StringLiterals; using namespace Qt::Literals::StringLiterals;
namespace namespace

View File

@ -386,10 +386,8 @@ auto VGObject::LineIntersectRect(const QRectF &rec, const QLineF &line) -> QPoin
QLineF const leftLine(QPointF(x1, y1), QPointF(x1, y2)); QLineF const leftLine(QPointF(x1, y1), QPointF(x1, y2));
QLineF const rightLine(QPointF(x2, y1), QPointF(x2, y2)); QLineF const rightLine(QPointF(x2, y1), QPointF(x2, y2));
QPointF point;
// Check intersections with each side of the rectangle // Check intersections with each side of the rectangle
if (line.intersects(topLine, &point) == QLineF::BoundedIntersection || if (QPointF point; line.intersects(topLine, &point) == QLineF::BoundedIntersection ||
line.intersects(bottomLine, &point) == QLineF::BoundedIntersection || line.intersects(bottomLine, &point) == QLineF::BoundedIntersection ||
line.intersects(leftLine, &point) == QLineF::BoundedIntersection || line.intersects(leftLine, &point) == QLineF::BoundedIntersection ||
line.intersects(rightLine, &point) == QLineF::BoundedIntersection) line.intersects(rightLine, &point) == QLineF::BoundedIntersection)

View File

@ -48,8 +48,6 @@
#include <QStyleHints> #include <QStyleHints>
#endif #endif
using namespace std::chrono_literals;
#include "../vabstractapplication.h" #include "../vabstractapplication.h"
#include "vapplicationstyle.h" #include "vapplicationstyle.h"
#include "vscenestylesheet.h" #include "vscenestylesheet.h"
@ -58,6 +56,7 @@ using namespace std::chrono_literals;
#include "../compatibility.h" #include "../compatibility.h"
#endif #endif
using namespace std::chrono_literals;
using namespace Qt::Literals::StringLiterals; using namespace Qt::Literals::StringLiterals;
namespace namespace
@ -597,8 +596,7 @@ VTheme::VTheme(QObject *parent)
isProcessingColorSchemeChange = true; isProcessingColorSchemeChange = true;
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
bool darkTheme = IsInDarkTheme(); if (bool darkTheme = IsInDarkTheme(); m_darkTheme != darkTheme)
if (m_darkTheme != darkTheme)
{ {
m_darkTheme = darkTheme; m_darkTheme = darkTheme;
ResetThemeSettings(); ResetThemeSettings();

View File

@ -109,7 +109,7 @@ public:
//! \param container If a property is being passed here, no new VProperty is being created but instead it is tried //! \param container If a property is being passed here, no new VProperty is being created but instead it is tried
//! to fill all the data into container. This can also be used when subclassing this function. //! to fill all the data into container. This can also be used when subclassing this function.
//! \return Returns the newly created property (or container, if it was not NULL) //! \return Returns the newly created property (or container, if it was not NULL)
virtual auto clone(bool include_children = true, VProperty *container = NULL) const -> VProperty * override; virtual auto clone(bool include_children = true, VProperty *container = nullptr) const -> VProperty * override;
//! Sets the value of the property //! Sets the value of the property
virtual void setValue(const QVariant &value) override; virtual void setValue(const QVariant &value) override;

View File

@ -80,7 +80,7 @@ public:
//! \param container If a property is being passed here, no new VProperty is being created but instead it is tried //! \param container If a property is being passed here, no new VProperty is being created but instead it is tried
//! to fill all the data into container. This can also be used when subclassing this function. //! to fill all the data into container. This can also be used when subclassing this function.
//! \return Returns the newly created property (or container, if it was not NULL) //! \return Returns the newly created property (or container, if it was not NULL)
auto clone(bool include_children = true, VProperty *container = NULL) const -> VProperty * override; auto clone(bool include_children = true, VProperty *container = nullptr) const -> VProperty * override;
public slots: public slots:
void StateChanged(); void StateChanged();

View File

@ -70,7 +70,7 @@ public:
//! \param container If a property is being passed here, no new VProperty is being created but instead it is tried //! \param container If a property is being passed here, no new VProperty is being created but instead it is tried
//! to fill all the data into container. This can also be used when subclassing this function. //! to fill all the data into container. This can also be used when subclassing this function.
//! \return Returns the newly created property (or container, if it was not NULL) //! \return Returns the newly created property (or container, if it was not NULL)
virtual auto clone(bool include_children = true, VProperty *container = NULL) const -> VProperty * override; virtual auto clone(bool include_children = true, VProperty *container = nullptr) const -> VProperty * override;
private: private:
Q_DISABLE_COPY_MOVE(VColorProperty) // NOLINT Q_DISABLE_COPY_MOVE(VColorProperty) // NOLINT

View File

@ -743,9 +743,8 @@ auto DialogSeamAllowance::GetMirrorLineEndPoint() const -> quint32
nextIndex = 0; nextIndex = 0;
} }
const int next = FindNotExcludedNeighborNodeDown(uiTabPaths->listWidgetMainPath, nextIndex); if (const int next = FindNotExcludedNeighborNodeDown(uiTabPaths->listWidgetMainPath, nextIndex);
next >= 0 && RowNode(uiTabPaths->listWidgetMainPath, next).GetId() == startPoint)
if (next >= 0 && RowNode(uiTabPaths->listWidgetMainPath, next).GetId() == startPoint)
{ {
return startPoint; return startPoint;
} }

View File

@ -37,12 +37,11 @@
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
using namespace std::chrono_literals;
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"
#endif #endif
using namespace std::chrono_literals;
using namespace Qt::Literals::StringLiterals; using namespace Qt::Literals::StringLiterals;
namespace namespace