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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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