From 91925c2618344864abba55f2c9c87edefc6c1a91 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 27 Mar 2019 11:45:25 +0200 Subject: [PATCH] Cppcheck warning. --HG-- branch : develop --- src/libs/vlayout/vbestsquare.cpp | 11 ++++++++++ src/libs/vlayout/vbestsquare.h | 1 + src/libs/vlayout/vcontour.cpp | 35 +++++++++++++++++--------------- src/libs/vlayout/vcontour.h | 1 - 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/libs/vlayout/vbestsquare.cpp b/src/libs/vlayout/vbestsquare.cpp index f102b63d0..cd0306078 100644 --- a/src/libs/vlayout/vbestsquare.cpp +++ b/src/libs/vlayout/vbestsquare.cpp @@ -54,6 +54,17 @@ VBestSquare::VBestSquare(const VBestSquare &res) VBestSquare::~VBestSquare() {} +//--------------------------------------------------------------------------------------------------------------------- +VBestSquare &VBestSquare::operator=(const VBestSquare &res) +{ + if ( &res == this ) + { + return *this; + } + d = res.d; + return *this; +} + //--------------------------------------------------------------------------------------------------------------------- void VBestSquare::NewResult(const VBestSquareResData &data) { diff --git a/src/libs/vlayout/vbestsquare.h b/src/libs/vlayout/vbestsquare.h index 45677efee..53e818da1 100644 --- a/src/libs/vlayout/vbestsquare.h +++ b/src/libs/vlayout/vbestsquare.h @@ -46,6 +46,7 @@ public: VBestSquare(const VBestSquare &res); virtual ~VBestSquare(); + VBestSquare &operator=(const VBestSquare &res); #ifdef Q_COMPILER_RVALUE_REFS VBestSquare &operator=(VBestSquare &&res) Q_DECL_NOTHROW { Swap(res); return *this; } #endif diff --git a/src/libs/vlayout/vcontour.cpp b/src/libs/vlayout/vcontour.cpp index 6c72f2b58..58cfb7c51 100644 --- a/src/libs/vlayout/vcontour.cpp +++ b/src/libs/vlayout/vcontour.cpp @@ -40,6 +40,25 @@ #include "vlayoutpiece.h" #include "../vmisc/vmath.h" +namespace +{ +//--------------------------------------------------------------------------------------------------------------------- +void AppendToContour(QVector &contour, QPointF point) +{ + if (not contour.isEmpty()) + { + if (not VFuzzyComparePoints(contour.last(), point)) + { + contour.append(point); + } + } + else + { + contour.append(point); + } +} +} + //--------------------------------------------------------------------------------------------------------------------- VContour::VContour() :d(new VContourData()) @@ -309,22 +328,6 @@ QPainterPath VContour::ContourPath() const return path; } -//--------------------------------------------------------------------------------------------------------------------- -void VContour::AppendToContour(QVector &contour, QPointF point) const -{ - if (not contour.isEmpty()) - { - if (not VFuzzyComparePoints(contour.last(), point)) - { - contour.append(point); - } - } - else - { - contour.append(point); - } -} - //--------------------------------------------------------------------------------------------------------------------- void VContour::AppendWhole(QVector &contour, const VLayoutPiece &detail, int detJ) const { diff --git a/src/libs/vlayout/vcontour.h b/src/libs/vlayout/vcontour.h index 1933cee8e..d8f0ce02a 100644 --- a/src/libs/vlayout/vcontour.h +++ b/src/libs/vlayout/vcontour.h @@ -96,7 +96,6 @@ public: private: QSharedDataPointer d; - void AppendToContour(QVector &contour, QPointF point) const; void AppendWhole(QVector &contour, const VLayoutPiece &detail, int detJ) const; void InsertDetail(QVector &contour, const VLayoutPiece &detail, int detJ) const; };