Cppcheck warnings.

This commit is contained in:
Roman Telezhynskyi 2022-08-08 15:25:14 +03:00
parent df68bfefc8
commit 4e07172a6f
134 changed files with 292 additions and 286 deletions

View File

@ -3,24 +3,19 @@
# Please, run this script from folder <root_folder>/scripts. # Please, run this script from folder <root_folder>/scripts.
# Because we use the last available cppcheck version usually we build it manually. # Because we use the last available cppcheck version usually we build it manually.
CPPCHECK="../../../../cppcheck/cppcheck" CPPCHECK="../../../../cppcheck-2.8/cppcheck"
$CPPCHECK \ $CPPCHECK \
-j4 -f -q \ -j4 -f -q \
-UDRW_DBG \ -UDRW_DBG \
-U__INTEL_COMPILER_UPDATE \ -U__INTEL_COMPILER_UPDATE \
-UqApp \
--template '{file}:{line}:{message}:{id}' \ --template '{file}:{line}:{message}:{id}' \
--inline-suppr \ --inline-suppr \
--platform=unix64 \ --platform=unix64 \
--std=c++11 \ --std=c++17 \
--std=posix \
--enable=all \ --enable=all \
--library=qt.cfg \ --library=qt \
--library=std.cfg \ --library=std \
--library=posix.cfg \ --library=posix \
--inconclusive \ --inconclusive \
--suppress=leakReturnValNotUsed:../src/app/valentina/core/vapplication.cpp \ --suppress=*:*/vdxf/libdxfrw/intern/make_unique.h \
--suppress=unmatchedSuppression:../src/libs/ifc/xml/vdomdocument.cpp \
--suppress=redundantCondition:../src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp \
--suppress=unmatchedSuppression:../src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp \
../src ../src

View File

@ -132,6 +132,7 @@ public:
void SetZValue(qreal newZValue); void SetZValue(qreal newZValue);
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VPPiece) // NOLINT Q_DISABLE_COPY_MOVE(VPPiece) // NOLINT
VPLayoutWeakPtr m_layout{}; VPLayoutWeakPtr m_layout{};

View File

@ -51,7 +51,6 @@ class VPGraphicsTileGrid;
class VPGraphicsSheet; class VPGraphicsSheet;
class VLayoutPiece; class VLayoutPiece;
// cppcheck-suppress noCopyConstructor
class VPSheetSceneData class VPSheetSceneData
{ {
public: public:
@ -95,6 +94,7 @@ public:
void RefreshSheetSize(); void RefreshSheetSize();
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VPSheetSceneData) // NOLINT Q_DISABLE_COPY_MOVE(VPSheetSceneData) // NOLINT
VPLayoutWeakPtr m_layout{}; VPLayoutWeakPtr m_layout{};

View File

@ -86,6 +86,7 @@ protected:
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override; void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VPGraphicsPiece) // NOLINT Q_DISABLE_COPY_MOVE(VPGraphicsPiece) // NOLINT
VPPieceWeakPtr m_piece; VPPieceWeakPtr m_piece;

View File

@ -45,7 +45,6 @@
#include "qgraphicsscene.h" #include "qgraphicsscene.h"
#include "qgraphicsview.h" #include "qgraphicsview.h"
#include "qnamespace.h" #include "qnamespace.h"
#include "vpgraphicspiece.h"
namespace namespace
{ {
@ -73,6 +72,7 @@ auto TransformationOrigin(const VPLayoutPtr &layout, const QRectF &boundingRect)
origin.origin = boundingRect.center(); origin.origin = boundingRect.center();
origin.custom = false; origin.custom = false;
// cppcheck-suppress unknownMacro
QT_WARNING_POP QT_WARNING_POP
return origin; return origin;

View File

@ -54,6 +54,7 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VPGraphicsTileGrid) // NOLINT Q_DISABLE_COPY_MOVE(VPGraphicsTileGrid) // NOLINT
VPLayoutWeakPtr m_layout; VPLayoutWeakPtr m_layout;

View File

@ -66,6 +66,7 @@ public:
auto AllowMerge() const -> bool; auto AllowMerge() const -> bool;
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VPUndoCommand) // NOLINT Q_DISABLE_COPY_MOVE(VPUndoCommand) // NOLINT
bool m_allowMerge{false}; bool m_allowMerge{false};

View File

@ -86,6 +86,7 @@ private slots:
void NewLocalSocketConnection(); void NewLocalSocketConnection();
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VPApplication) //NOLINT Q_DISABLE_COPY_MOVE(VPApplication) //NOLINT
QList<QPointer<VPMainWindow> > m_mainWindows{}; QList<QPointer<VPMainWindow> > m_mainWindows{};
QLocalServer *m_localServer{nullptr}; QLocalServer *m_localServer{nullptr};

View File

@ -105,6 +105,7 @@ public:
const QString &watermarkPath, qreal xScale = 1.0, qreal yScale = 1.0); const QString &watermarkPath, qreal xScale = 1.0, qreal yScale = 1.0);
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VPTileFactory) // NOLINT Q_DISABLE_COPY_MOVE(VPTileFactory) // NOLINT
VPLayoutWeakPtr m_layout; VPLayoutWeakPtr m_layout;

View File

@ -713,6 +713,7 @@ auto VPLayoutFileReader::ReadMarker() -> VLayoutPlaceLabel
marker.shape = shape; marker.shape = shape;
// cppcheck-suppress unknownMacro
QT_WARNING_POP QT_WARNING_POP
return marker; return marker;

View File

@ -53,6 +53,7 @@ public:
auto CustomNames() const -> QMap<MeasurementDimension, QString>; auto CustomNames() const -> QMap<MeasurementDimension, QString>;
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogDimensionCustomNames) // NOLINT Q_DISABLE_COPY_MOVE(DialogDimensionCustomNames) // NOLINT
Ui::DialogDimensionCustomNames *ui; Ui::DialogDimensionCustomNames *ui;

View File

@ -196,8 +196,6 @@ void DialogDimensionLabels::InitTable()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto DialogDimensionLabels::DimensionValue(const MeasurementDimension_p &dimension, qreal value) const -> QString auto DialogDimensionLabels::DimensionValue(const MeasurementDimension_p &dimension, qreal value) const -> QString
{ {
QStringList labels;
if (dimension->Type() == MeasurementDimension::X) if (dimension->Type() == MeasurementDimension::X)
{ {
return QString::number(value); return QString::number(value);

View File

@ -807,6 +807,7 @@ void DialogMeasurementsCSVColumns::CheckStatus()
auto SetStatus = [this](bool status) auto SetStatus = [this](bool status)
{ {
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
// cppcheck-suppress unknownMacro
SCASSERT(bOk != nullptr) SCASSERT(bOk != nullptr)
bOk->setEnabled(status); bOk->setEnabled(status);
}; };

View File

@ -128,6 +128,7 @@ void DialogRestrictDimension::changeEvent(QEvent *event)
auto RetranslateControls = [this](int index, QLabel *name, QComboBox *control) auto RetranslateControls = [this](int index, QLabel *name, QComboBox *control)
{ {
// cppcheck-suppress unknownMacro
SCASSERT(name != nullptr) SCASSERT(name != nullptr)
SCASSERT(control != nullptr) SCASSERT(control != nullptr)

View File

@ -70,6 +70,7 @@ private slots:
void ZDimensionBodyMeasurementChanged(); void ZDimensionBodyMeasurementChanged();
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogSetupMultisize) // NOLINT Q_DISABLE_COPY_MOVE(DialogSetupMultisize) // NOLINT
Ui::DialogSetupMultisize *ui; Ui::DialogSetupMultisize *ui;
bool m_isInitialized{false}; bool m_isInitialized{false};

View File

@ -88,6 +88,7 @@ private slots:
void NewLocalSocketConnection(); void NewLocalSocketConnection();
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(MApplication) // NOLINT Q_DISABLE_COPY_MOVE(MApplication) // NOLINT
QList<QPointer<TMainWindow> > m_mainWindows{}; QList<QPointer<TMainWindow> > m_mainWindows{};
QLocalServer *m_localServer{nullptr}; QLocalServer *m_localServer{nullptr};

View File

@ -80,6 +80,7 @@ protected slots:
void AboutToQuit() override; void AboutToQuit() override;
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VApplication) // NOLINT Q_DISABLE_COPY_MOVE(VApplication) // NOLINT
VTranslateVars *m_trVars{nullptr}; VTranslateVars *m_trVars{nullptr};
QTimer *m_autoSaveTimer{nullptr}; QTimer *m_autoSaveTimer{nullptr};

View File

@ -253,6 +253,7 @@ void PreferencesPatternPage::InitLabelDateTimeFormats()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void PreferencesPatternPage::InitComboBoxFormats(QComboBox *box, const QStringList &items, const QString &currentFormat) void PreferencesPatternPage::InitComboBoxFormats(QComboBox *box, const QStringList &items, const QString &currentFormat)
{ {
// cppcheck-suppress unknownMacro
SCASSERT(box != nullptr) SCASSERT(box != nullptr)
box->addItems(items); box->addItems(items);

View File

@ -51,6 +51,7 @@ public:
auto BuiltIn() const -> bool; auto BuiltIn() const -> bool;
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogAddBackgroundImage) Q_DISABLE_COPY_MOVE(DialogAddBackgroundImage)
Ui::DialogAddBackgroundImage *ui; Ui::DialogAddBackgroundImage *ui;
}; };

View File

@ -34,12 +34,10 @@
#include "../vgeometry/vsplinepath.h" #include "../vgeometry/vsplinepath.h"
#include "../vgeometry/vcubicbezierpath.h" #include "../vgeometry/vcubicbezierpath.h"
#include "../vgeometry/vpointf.h" #include "../vgeometry/vpointf.h"
#include "../vtools/tools/vabstracttool.h"
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h" #include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h"
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h" #include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h"
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h" #include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h"
#include "../xml/vpattern.h" #include "../xml/vpattern.h"
#include "../vmisc/diagnostic.h"
#include "../vmisc/vtablesearch.h" #include "../vmisc/vtablesearch.h"
#include "../vmisc/vvalentinasettings.h" #include "../vmisc/vvalentinasettings.h"
@ -214,6 +212,7 @@ void DialogHistory::FillTable()
{ {
cursorRow = CursorRow(); cursorRow = CursorRow();
QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0); QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
// cppcheck-suppress unknownMacro
SCASSERT(item != nullptr) SCASSERT(item != nullptr)
item->setIcon(QIcon("://icon/32x32/put_after.png")); item->setIcon(QIcon("://icon/32x32/put_after.png"));
} }

View File

@ -83,6 +83,7 @@ private slots:
void RefreshPattern(); void RefreshPattern();
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogIncrements) // NOLINT Q_DISABLE_COPY_MOVE(DialogIncrements) // NOLINT
/** @brief ui keeps information about user interface */ /** @brief ui keeps information about user interface */

View File

@ -82,6 +82,7 @@ private slots:
void ImagePositionChanged(const QUuid &id); void ImagePositionChanged(const QUuid &id);
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VWidgetBackgroundImages) Q_DISABLE_COPY_MOVE(VWidgetBackgroundImages)
Ui::VWidgetBackgroundImages *ui; Ui::VWidgetBackgroundImages *ui;
VAbstractPattern *m_doc; VAbstractPattern *m_doc;

View File

@ -45,6 +45,7 @@ VWidgetGroups::VWidgetGroups(VAbstractPattern *doc, QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
// cppcheck-suppress unknownMacro
SCASSERT(doc != nullptr) SCASSERT(doc != nullptr)
FillTable(doc->GetGroups()); FillTable(doc->GetGroups());

View File

@ -4519,6 +4519,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const
return rec; return rec;
} }
// cppcheck-suppress unknownMacro
QT_WARNING_POP QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -217,6 +217,7 @@ QString PenStyleToLineStyle(Qt::PenStyle penStyle)
break; break;
} }
// cppcheck-suppress unknownMacro
QT_WARNING_POP QT_WARNING_POP
return TypeLineLine; return TypeLineLine;

View File

@ -711,7 +711,6 @@ void VDomDocument::CacheRefreshed()
void VDomDocument::setXMLContent(const QString &fileName) void VDomDocument::setXMLContent(const QString &fileName)
{ {
QFile file(fileName); QFile file(fileName);
// cppcheck-suppress ConfigurationNotChecked
if (file.open(QIODevice::ReadOnly) == false) if (file.open(QIODevice::ReadOnly) == false)
{ {
const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName, file.errorString())); const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName, file.errorString()));
@ -766,7 +765,6 @@ bool VDomDocument::SaveDocument(const QString &fileName, QString &error)
} }
bool success = false; bool success = false;
QSaveFile file(fileName); QSaveFile file(fileName);
// cppcheck-suppress ConfigurationNotChecked
if (file.open(QIODevice::WriteOnly)) if (file.open(QIODevice::WriteOnly))
{ {
// See issue #666. QDomDocument produces random attribute order. // See issue #666. QDomDocument produces random attribute order.
@ -1000,7 +998,6 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
QTemporaryFile destFile(destination + QLatin1String(".XXXXXX")); QTemporaryFile destFile(destination + QLatin1String(".XXXXXX"));
destFile.setAutoRemove(false);// Will be renamed to be destination file destFile.setAutoRemove(false);// Will be renamed to be destination file
// cppcheck-suppress ConfigurationNotChecked
if (not destFile.open()) if (not destFile.open())
{ {
error = destFile.errorString(); error = destFile.errorString();
@ -1008,7 +1005,6 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
else else
{ {
QFile sourceFile(source); QFile sourceFile(source);
// cppcheck-suppress ConfigurationNotChecked
if (sourceFile.open(QIODevice::ReadOnly)) if (sourceFile.open(QIODevice::ReadOnly))
{ {
result = true; result = true;

View File

@ -1937,7 +1937,6 @@ void QmuParserBase::Eval(qreal *results, int nBulkSize) const
#endif #endif
int nMaxThreads = qMin(omp_get_max_threads(), s_MaxNumOpenMPThreads); int nMaxThreads = qMin(omp_get_max_threads(), s_MaxNumOpenMPThreads);
// cppcheck-suppress unreadVariable
int ct=0; int ct=0;
omp_set_num_threads(nMaxThreads); omp_set_num_threads(nMaxThreads);

View File

@ -283,6 +283,7 @@ private:
void StackDump(const QStack<token_type > &a_stVal, const QStack<token_type > &a_stOprt) const; void StackDump(const QStack<token_type > &a_stVal, const QStack<token_type > &a_stOprt) const;
}; };
// cppcheck-suppress unknownMacro
QT_WARNING_POP QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -102,7 +102,7 @@ void QmuParserByteCode::AddVar(qreal *a_pVar)
m_iMaxStackSize = qMax(m_iMaxStackSize, m_iStackPos); m_iMaxStackSize = qMax(m_iMaxStackSize, m_iStackPos);
// optimization does not apply // optimization does not apply
SToken tok; SToken tok{};
tok.Cmd = cmVAR; tok.Cmd = cmVAR;
tok.Val.ptr = a_pVar; tok.Val.ptr = a_pVar;
tok.Val.data = 1; tok.Val.data = 1;
@ -130,7 +130,7 @@ void QmuParserByteCode::AddVal(qreal a_fVal)
m_iMaxStackSize = qMax(m_iMaxStackSize, m_iStackPos); m_iMaxStackSize = qMax(m_iMaxStackSize, m_iStackPos);
// If optimization does not apply // If optimization does not apply
SToken tok; SToken tok{};
tok.Cmd = cmVAL; tok.Cmd = cmVAL;
tok.Val.ptr = nullptr; tok.Val.ptr = nullptr;
tok.Val.data = 0; tok.Val.data = 0;
@ -147,34 +147,42 @@ void QmuParserByteCode::ConstantFolding(ECmdCode a_Oprt)
switch (a_Oprt) switch (a_Oprt)
{ {
case cmLAND: case cmLAND:
// cppcheck-suppress assignBoolToFloat
x = static_cast<int>(x) && static_cast<int>(y); x = static_cast<int>(x) && static_cast<int>(y);
m_vRPN.pop_back(); m_vRPN.pop_back();
break; break;
case cmLOR: case cmLOR:
// cppcheck-suppress assignBoolToFloat
x = static_cast<int>(x) || static_cast<int>(y); x = static_cast<int>(x) || static_cast<int>(y);
m_vRPN.pop_back(); m_vRPN.pop_back();
break; break;
case cmLT: case cmLT:
// cppcheck-suppress assignBoolToFloat
x = x < y; x = x < y;
m_vRPN.pop_back(); m_vRPN.pop_back();
break; break;
case cmGT: case cmGT:
// cppcheck-suppress assignBoolToFloat
x = x > y; x = x > y;
m_vRPN.pop_back(); m_vRPN.pop_back();
break; break;
case cmLE: case cmLE:
// cppcheck-suppress assignBoolToFloat
x = x <= y; x = x <= y;
m_vRPN.pop_back(); m_vRPN.pop_back();
break; break;
case cmGE: case cmGE:
// cppcheck-suppress assignBoolToFloat
x = x >= y; x = x >= y;
m_vRPN.pop_back(); m_vRPN.pop_back();
break; break;
case cmNEQ: case cmNEQ:
// cppcheck-suppress assignBoolToFloat
x = not QmuFuzzyComparePossibleNulls(x, y); x = not QmuFuzzyComparePossibleNulls(x, y);
m_vRPN.pop_back(); m_vRPN.pop_back();
break; break;
case cmEQ: case cmEQ:
// cppcheck-suppress assignBoolToFloat
x = QmuFuzzyComparePossibleNulls(x, y); x = QmuFuzzyComparePossibleNulls(x, y);
m_vRPN.pop_back(); m_vRPN.pop_back();
break; break;
@ -367,7 +375,7 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
if (bOptimized == false) if (bOptimized == false)
{ {
--m_iStackPos; --m_iStackPos;
SToken tok; SToken tok{};
tok.Cmd = a_Oprt; tok.Cmd = a_Oprt;
m_vRPN.push_back(tok); m_vRPN.push_back(tok);
} }
@ -378,7 +386,7 @@ QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void QmuParserByteCode::AddIfElse(ECmdCode a_Oprt) void QmuParserByteCode::AddIfElse(ECmdCode a_Oprt)
{ {
SToken tok; SToken tok{};
tok.Cmd = a_Oprt; tok.Cmd = a_Oprt;
m_vRPN.push_back(tok); m_vRPN.push_back(tok);
} }
@ -399,7 +407,7 @@ void QmuParserByteCode::AddAssignOp(qreal *a_pVar)
{ {
--m_iStackPos; --m_iStackPos;
SToken tok; SToken tok{};
tok.Cmd = cmASSIGN; tok.Cmd = cmASSIGN;
tok.Oprt.ptr = a_pVar; tok.Oprt.ptr = a_pVar;
m_vRPN.push_back(tok); m_vRPN.push_back(tok);
@ -425,7 +433,7 @@ void QmuParserByteCode::AddFun(generic_fun_type a_pFun, int a_iArgc)
} }
m_iMaxStackSize = qMax(m_iMaxStackSize, m_iStackPos); m_iMaxStackSize = qMax(m_iMaxStackSize, m_iStackPos);
SToken tok; SToken tok{};
tok.Cmd = cmFUNC; tok.Cmd = cmFUNC;
tok.Fun.argc = a_iArgc; tok.Fun.argc = a_iArgc;
tok.Fun.ptr = a_pFun; tok.Fun.ptr = a_pFun;
@ -444,7 +452,7 @@ void QmuParserByteCode::AddBulkFun(generic_fun_type a_pFun, int a_iArgc)
m_iStackPos = static_cast<quint32>(static_cast<int>(m_iStackPos) - a_iArgc + 1); m_iStackPos = static_cast<quint32>(static_cast<int>(m_iStackPos) - a_iArgc + 1);
m_iMaxStackSize = qMax(m_iMaxStackSize, m_iStackPos); m_iMaxStackSize = qMax(m_iMaxStackSize, m_iStackPos);
SToken tok; SToken tok{};
tok.Cmd = cmFUNC_BULK; tok.Cmd = cmFUNC_BULK;
tok.Fun.argc = a_iArgc; tok.Fun.argc = a_iArgc;
tok.Fun.ptr = a_pFun; tok.Fun.ptr = a_pFun;
@ -463,7 +471,7 @@ void QmuParserByteCode::AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iI
{ {
m_iStackPos = static_cast<quint32>(static_cast<int>(m_iStackPos) - a_iArgc + 1); m_iStackPos = static_cast<quint32>(static_cast<int>(m_iStackPos) - a_iArgc + 1);
SToken tok; SToken tok{};
tok.Cmd = cmFUNC_STR; tok.Cmd = cmFUNC_STR;
tok.Fun.argc = a_iArgc; tok.Fun.argc = a_iArgc;
tok.Fun.idx = a_iIdx; tok.Fun.idx = a_iIdx;
@ -481,7 +489,7 @@ void QmuParserByteCode::AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iI
*/ */
void QmuParserByteCode::Finalize() void QmuParserByteCode::Finalize()
{ {
SToken tok; SToken tok{};
tok.Cmd = cmEND; tok.Cmd = cmEND;
m_vRPN.push_back(tok); m_vRPN.push_back(tok);
rpn_type(m_vRPN).swap(m_vRPN); // shrink bytecode vector to fit rpn_type(m_vRPN).swap(m_vRPN); // shrink bytecode vector to fit

View File

@ -135,6 +135,7 @@ public:
explicit QmuParserWarning ( const QString &sMsg ); explicit QmuParserWarning ( const QString &sMsg );
QmuParserWarning ( const QmuParserWarning &a_Obj ); QmuParserWarning ( const QmuParserWarning &a_Obj );
QmuParserWarning& operator= ( const QmuParserWarning &a_Obj ); QmuParserWarning& operator= ( const QmuParserWarning &a_Obj );
// cppcheck-suppress unknownMacro
virtual ~QmuParserWarning() QMUP_NOEXCEPT_EXPR (true) override {} virtual ~QmuParserWarning() QMUP_NOEXCEPT_EXPR (true) override {}
const QString& GetMsg() const; const QString& GetMsg() const;

View File

@ -1239,7 +1239,6 @@ int QmuParserTester::EqnTestWithVarChange (const QString &a_str, double a_fRes1,
var = a_fRes1; var = a_fRes1;
fVal[0] = p.Eval(); fVal[0] = p.Eval();
// cppcheck-suppress redundantAssignment
var = a_fRes2; //-V519 var = a_fRes2; //-V519
fVal[1] = p.Eval(); fVal[1] = p.Eval();
@ -1281,7 +1280,6 @@ int QmuParserTester::EqnTestWithVarChange (const QString &a_str, double a_fRes1,
int QmuParserTester::EqnTest ( const QString &a_str, double a_fRes, bool a_fPass ) int QmuParserTester::EqnTest ( const QString &a_str, double a_fRes, bool a_fPass )
{ {
QmuParserTester::c_iCount++; QmuParserTester::c_iCount++;
// cppcheck-suppress variableScope
int iRet ( 0 ); int iRet ( 0 );
qreal fVal[5] = { -999, -998, -997, -996, -995}; // initially should be different qreal fVal[5] = { -999, -998, -997, -996, -995}; // initially should be different

View File

@ -242,7 +242,6 @@ private:
return static_cast<qreal>( ( 1 + ( v * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) / return static_cast<qreal>( ( 1 + ( v * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) /
( RAND_MAX + 1.0 ) ) ) ); ( RAND_MAX + 1.0 ) ) ) );
#else #else
// cppcheck-suppress qrandCalled
return static_cast<qreal>( ( 1 + ( v * qrand() / ( RAND_MAX + 1.0 ) ) ) ); return static_cast<qreal>( ( 1 + ( v * qrand() / ( RAND_MAX + 1.0 ) ) ) );
#endif #endif
} }
@ -253,7 +252,6 @@ private:
return static_cast<qreal>( ( 1 + ( 1000.0f * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) / return static_cast<qreal>( ( 1 + ( 1000.0f * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) /
( RAND_MAX + 1.0 ) ) ) ); ( RAND_MAX + 1.0 ) ) ) );
#else #else
// cppcheck-suppress qrandCalled
return static_cast<qreal>( ( 1 + ( 1000.0f * static_cast<qreal>(qrand()) / ( RAND_MAX + 1.0 ) ) ) ); return static_cast<qreal>( ( 1 + ( 1000.0f * static_cast<qreal>(qrand()) / ( RAND_MAX + 1.0 ) ) ) );
#endif #endif
} }
@ -312,31 +310,18 @@ private:
static int IsHexVal (const QString &a_szExpr, int *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers, static int IsHexVal (const QString &a_szExpr, int *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers,
const QChar &decimal, const QChar &thousand); const QChar &decimal, const QChar &thousand);
// cppcheck-suppress functionStatic
int TestNames(); int TestNames();
// cppcheck-suppress functionStatic
int TestSyntax(); int TestSyntax();
// cppcheck-suppress functionStatic
int TestMultiArg(); int TestMultiArg();
// cppcheck-suppress functionStatic
int TestPostFix(); int TestPostFix();
// cppcheck-suppress functionStatic
int TestExpression(); int TestExpression();
// cppcheck-suppress functionStatic
int TestInfixOprt(); int TestInfixOprt();
// cppcheck-suppress functionStatic
int TestBinOprt(); int TestBinOprt();
// cppcheck-suppress functionStatic
int TestVarConst(); int TestVarConst();
// cppcheck-suppress functionStatic
int TestInterface(); int TestInterface();
// cppcheck-suppress functionStatic
int TestException(); int TestException();
// cppcheck-suppress functionStatic
int TestStrArg(); int TestStrArg();
// cppcheck-suppress functionStatic
int TestIfThenElse(); int TestIfThenElse();
// cppcheck-suppress functionStatic
int TestBulkMode(); int TestBulkMode();
static void Abort(); static void Abort();

View File

@ -157,38 +157,38 @@ bool DRW_Entity::parseCode(int code, dxfReader *reader){
//parses dxf 102 groups to read entity //parses dxf 102 groups to read entity
bool DRW_Entity::parseDxfGroups(int code, dxfReader *reader){ bool DRW_Entity::parseDxfGroups(int code, dxfReader *reader){
std::list<DRW_Variant> ls; std::list<DRW_Variant> ls;
DRW_Variant curr; DRW_Variant c;
int nc; int nc;
std::string appName= reader->getString(); std::string appName= reader->getString();
if (!appName.empty() && appName.at(0)== '{'){ if (!appName.empty() && appName.at(0)== '{'){
curr.addString(appName.substr(1, static_cast<size_t>(appName.size()-1))); c.addString(appName.substr(1, static_cast<size_t>(appName.size()-1)));
curr.code = code; c.code = code;
ls.push_back(curr); ls.push_back(c);
while (code !=102 && appName.at(0)== '}'){ while (code !=102 && appName.at(0)== '}'){
reader->readRec(&nc); reader->readRec(&nc);
curr.code = code; c.code = code;
if (code == 330 || code == 360) if (code == 330 || code == 360)
curr.addInt(reader->getHandleString()); c.addInt(reader->getHandleString());
else { else {
switch (reader->type) { switch (reader->type) {
case dxfReader::STRING: case dxfReader::STRING:
curr.addString(reader->getString()); c.addString(reader->getString());
break; break;
case dxfReader::INT32: case dxfReader::INT32:
case dxfReader::INT64: case dxfReader::INT64:
curr.addInt(reader->getInt32()); c.addInt(reader->getInt32());
break; break;
case dxfReader::DOUBLE: case dxfReader::DOUBLE:
curr.addDouble(reader->getDouble()); c.addDouble(reader->getDouble());
break; break;
case dxfReader::BOOL: case dxfReader::BOOL:
curr.addInt(reader->getInt32()); c.addInt(reader->getInt32());
break; break;
default: default:
break; break;
} }
} }
ls.push_back(curr); ls.push_back(c);
} }
} }

View File

@ -263,7 +263,7 @@ public:
} }
protected: protected:
bool parseCode(int code, dxfReader *reader); auto parseCode(int code, dxfReader *reader) -> bool override;
public: public:
double angle{0}; /*!< angle, code 50 */ double angle{0}; /*!< angle, code 50 */
@ -947,10 +947,12 @@ public:
{ {
eType = DRW::SPLINE; eType = DRW::SPLINE;
for(double v : p.knotslist) knotslist.push_back(v); std::copy(p.knotslist.begin(), p.knotslist.end(), std::back_inserter(knotslist));
for(double v : p.weightlist) weightlist.push_back(v); std::copy(p.weightlist.begin(), p.weightlist.end(), std::back_inserter(weightlist));
for(DRW_Coord *v : p.controllist) controllist.push_back(new DRW_Coord(*v)); std::transform(p.controllist.cbegin(), p.controllist.cend(), std::back_inserter(controllist),
for(DRW_Coord *v : p.fitlist) fitlist.push_back(new DRW_Coord(*v)); [](DRW_Coord *v) { return new DRW_Coord(*v); });
std::transform(p.fitlist.cbegin(), p.fitlist.cend(), std::back_inserter(fitlist),
[](DRW_Coord *v) { return new DRW_Coord(*v); });
} }
~DRW_Spline() { ~DRW_Spline() {
@ -991,9 +993,7 @@ public:
private: private:
DRW_Spline &operator=(const DRW_Spline &) Q_DECL_EQ_DELETE; DRW_Spline &operator=(const DRW_Spline &) Q_DECL_EQ_DELETE;
// cppcheck-suppress unsafeClassCanLeak
DRW_Coord *controlpoint; /*!< current control point to add data */ DRW_Coord *controlpoint; /*!< current control point to add data */
// cppcheck-suppress unsafeClassCanLeak
DRW_Coord *fitpoint; /*!< current fit point to add data */ DRW_Coord *fitpoint; /*!< current fit point to add data */
}; };
@ -1350,7 +1350,7 @@ public:
} }
DRW_Coord getClonepoint() const {return getPt2();} /*!< Insertion for clones (Baseline & Continue), 12, 22 & 32 */ DRW_Coord getClonepoint() const {return getPt2();} /*!< Insertion for clones (Baseline & Continue), 12, 22 & 32 */
void setClonePoint(DRW_Coord &c){setPt2(c);} void setClonePoint(const DRW_Coord &c){setPt2(c);}
DRW_Coord getDimPoint() const {return getDefPoint();} /*!< dim line location point, code 10, 20 & 30 */ DRW_Coord getDimPoint() const {return getDefPoint();} /*!< dim line location point, code 10, 20 & 30 */
void setDimPoint(const DRW_Coord &p){setDefPoint(p);} void setDimPoint(const DRW_Coord &p){setDefPoint(p);}
@ -1584,7 +1584,6 @@ public:
private: private:
Q_DISABLE_COPY(DRW_Leader) Q_DISABLE_COPY(DRW_Leader)
// cppcheck-suppress unsafeClassCanLeak
DRW_Coord *vertexpoint; /*!< current control point to add data */ DRW_Coord *vertexpoint; /*!< current control point to add data */
}; };

View File

@ -597,9 +597,9 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
writer->writeInt16(70, 3); writer->writeInt16(70, 3);
writer->writeString(9, "$DIMTXSTY"); writer->writeString(9, "$DIMTXSTY");
if (getStr("$DIMTXSTY", &varStr)) if (getStr("$DIMTXSTY", &varStr))
if (ver == DRW::AC1009) // if (ver == DRW::AC1009)
writer->writeUtf8Caps(7, varStr); // writer->writeUtf8Caps(7, varStr);
else // else
writer->writeUtf8String(7, varStr); writer->writeUtf8String(7, varStr);
else else
writer->writeString(7, "STANDARD"); writer->writeString(7, "STANDARD");
@ -640,9 +640,9 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
writer->writeInt16(70, 0); writer->writeInt16(70, 0);
writer->writeString(9, "$DIMLDRBLK"); writer->writeString(9, "$DIMLDRBLK");
if (getStr("$DIMLDRBLK", &varStr)) if (getStr("$DIMLDRBLK", &varStr))
if (ver == DRW::AC1009) // if (ver == DRW::AC1009)
writer->writeUtf8Caps(1, varStr); // writer->writeUtf8Caps(1, varStr);
else // else
writer->writeUtf8String(1, varStr); writer->writeUtf8String(1, varStr);
else else
writer->writeString(1, "STANDARD"); writer->writeString(1, "STANDARD");
@ -710,25 +710,16 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
writer->writeInt16(70, 0); writer->writeInt16(70, 0);
writer->writeString(9, "$DIMLTYPE"); writer->writeString(9, "$DIMLTYPE");
if (getStr("$DIMLTYPE", &varStr)) if (getStr("$DIMLTYPE", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(6, varStr);
else
writer->writeUtf8String(6, varStr); writer->writeUtf8String(6, varStr);
else else
writer->writeString(6, ""); writer->writeString(6, "");
writer->writeString(9, "$DIMLTEX1"); writer->writeString(9, "$DIMLTEX1");
if (getStr("$DIMLTEX1", &varStr)) if (getStr("$DIMLTEX1", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(6, varStr);
else
writer->writeUtf8String(6, varStr); writer->writeUtf8String(6, varStr);
else else
writer->writeString(6, ""); writer->writeString(6, "");
writer->writeString(9, "$DIMLTEX2"); writer->writeString(9, "$DIMLTEX2");
if (getStr("$DIMLTEX2", &varStr)) if (getStr("$DIMLTEX2", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(6, varStr);
else
writer->writeUtf8String(6, varStr); writer->writeUtf8String(6, varStr);
else else
writer->writeString(6, ""); writer->writeString(6, "");
@ -939,9 +930,6 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
if (ver > DRW::AC1009) { if (ver > DRW::AC1009) {
writer->writeString(9, "$UCSBASE"); writer->writeString(9, "$UCSBASE");
if (getStr("$UCSBASE", &varStr)) if (getStr("$UCSBASE", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(2, varStr);
else
writer->writeUtf8String(2, varStr); writer->writeUtf8String(2, varStr);
else else
writer->writeString(2, ""); writer->writeString(2, "");
@ -987,9 +975,9 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
if (ver > DRW::AC1009) { //begin post r12 UCS vars if (ver > DRW::AC1009) { //begin post r12 UCS vars
writer->writeString(9, "$UCSORTHOREF"); writer->writeString(9, "$UCSORTHOREF");
if (getStr("$UCSORTHOREF", &varStr)) if (getStr("$UCSORTHOREF", &varStr))
if (ver == DRW::AC1009) // if (ver == DRW::AC1009)
writer->writeUtf8Caps(2, varStr); // writer->writeUtf8Caps(2, varStr);
else // else
writer->writeUtf8String(2, varStr); writer->writeUtf8String(2, varStr);
else else
writer->writeString(2, ""); writer->writeString(2, "");
@ -1060,9 +1048,9 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
} }
writer->writeString(9, "$PUCSBASE"); writer->writeString(9, "$PUCSBASE");
if (getStr("$PUCSBASE", &varStr)) if (getStr("$PUCSBASE", &varStr))
if (ver == DRW::AC1009) // if (ver == DRW::AC1009)
writer->writeUtf8Caps(2, varStr); // writer->writeUtf8Caps(2, varStr);
else // else
writer->writeUtf8String(2, varStr); writer->writeUtf8String(2, varStr);
else else
writer->writeString(2, ""); writer->writeString(2, "");
@ -1108,9 +1096,9 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
if (ver > DRW::AC1009) { //begin post r12 PUCS vars if (ver > DRW::AC1009) { //begin post r12 PUCS vars
writer->writeString(9, "$PUCSORTHOREF"); writer->writeString(9, "$PUCSORTHOREF");
if (getStr("$PUCSORTHOREF", &varStr)) if (getStr("$PUCSORTHOREF", &varStr))
if (ver == DRW::AC1009) // if (ver == DRW::AC1009)
writer->writeUtf8Caps(2, varStr); // writer->writeUtf8Caps(2, varStr);
else // else
writer->writeUtf8String(2, varStr); writer->writeUtf8String(2, varStr);
else else
writer->writeString(2, ""); writer->writeString(2, "");
@ -1359,9 +1347,9 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
writer->writeInt16(70, 3020); writer->writeInt16(70, 3020);
writer->writeString(9, "$CMLSTYLE"); writer->writeString(9, "$CMLSTYLE");
if (getStr("$CMLSTYLE", &varStr)) if (getStr("$CMLSTYLE", &varStr))
if (ver == DRW::AC1009) // if (ver == DRW::AC1009)
writer->writeUtf8Caps(2, varStr); // writer->writeUtf8Caps(2, varStr);
else // else
writer->writeUtf8String(2, varStr); writer->writeUtf8String(2, varStr);
else else
writer->writeString(2, "Standard"); writer->writeString(2, "Standard");
@ -1414,17 +1402,17 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
} }
writer->writeString(9, "$HYPERLINKBASE"); writer->writeString(9, "$HYPERLINKBASE");
if (getStr("$HYPERLINKBASE", &varStr)) if (getStr("$HYPERLINKBASE", &varStr))
if (ver == DRW::AC1009) // if (ver == DRW::AC1009)
writer->writeUtf8Caps(1, varStr); // writer->writeUtf8Caps(1, varStr);
else // else
writer->writeUtf8String(1, varStr); writer->writeUtf8String(1, varStr);
else else
writer->writeString(1, ""); writer->writeString(1, "");
writer->writeString(9, "$STYLESHEET"); writer->writeString(9, "$STYLESHEET");
if (getStr("$STYLESHEET", &varStr)) if (getStr("$STYLESHEET", &varStr))
if (ver == DRW::AC1009) // if (ver == DRW::AC1009)
writer->writeUtf8Caps(1, varStr); // writer->writeUtf8Caps(1, varStr);
else // else
writer->writeUtf8String(1, varStr); writer->writeUtf8String(1, varStr);
else else
writer->writeString(1, ""); writer->writeString(1, "");
@ -1678,7 +1666,6 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
} }
void DRW_Header::addDouble(std::string key, double value, int code){ void DRW_Header::addDouble(std::string key, double value, int code){
// cppcheck-suppress publicAllocationError
curr = new DRW_Variant(); curr = new DRW_Variant();
curr->addDouble( value ); curr->addDouble( value );
curr->code = code; curr->code = code;
@ -1686,30 +1673,27 @@ void DRW_Header::addDouble(std::string key, double value, int code){
} }
void DRW_Header::addInt(std::string key, int value, int code){ void DRW_Header::addInt(std::string key, int value, int code){
// cppcheck-suppress publicAllocationError
curr = new DRW_Variant(); curr = new DRW_Variant();
curr->addInt( value ); curr->addInt( value );
curr->code = code; curr->code = code;
vars[key] =curr; vars[key] =curr;
} }
void DRW_Header::addStr(std::string key, std::string value, int code){ void DRW_Header::addStr(std::string key, const std::string &value, int code){
// cppcheck-suppress publicAllocationError
curr = new DRW_Variant(); curr = new DRW_Variant();
curr->addString( value ); curr->addString( value );
curr->code = code; curr->code = code;
vars[key] =curr; vars[key] =curr;
} }
void DRW_Header::addCoord(std::string key, DRW_Coord value, int code){ void DRW_Header::addCoord(std::string key, const DRW_Coord &value, int code){
// cppcheck-suppress publicAllocationError
curr = new DRW_Variant(); curr = new DRW_Variant();
curr->addCoord( value ); curr->addCoord( value );
curr->code = code; curr->code = code;
vars[key] =curr; vars[key] =curr;
} }
bool DRW_Header::getDouble(std::string key, double *varDouble){ bool DRW_Header::getDouble(const std::string &key, double *varDouble){
bool result = false; bool result = false;
auto it=vars.find( key); auto it=vars.find( key);
if (it != vars.end()) { if (it != vars.end()) {
@ -1724,7 +1708,7 @@ bool DRW_Header::getDouble(std::string key, double *varDouble){
return result; return result;
} }
bool DRW_Header::getInt(std::string key, int *varInt){ bool DRW_Header::getInt(const std::string &key, int *varInt){
bool result = false; bool result = false;
auto it=vars.find( key); auto it=vars.find( key);
if (it != vars.end()) { if (it != vars.end()) {
@ -1739,7 +1723,7 @@ bool DRW_Header::getInt(std::string key, int *varInt){
return result; return result;
} }
bool DRW_Header::getStr(std::string key, std::string *varStr){ bool DRW_Header::getStr(const std::string &key, std::string *varStr){
bool result = false; bool result = false;
auto it=vars.find( key); auto it=vars.find( key);
if (it != vars.end()) { if (it != vars.end()) {
@ -1754,7 +1738,7 @@ bool DRW_Header::getStr(std::string key, std::string *varStr){
return result; return result;
} }
bool DRW_Header::getCoord(std::string key, DRW_Coord *varCoord){ bool DRW_Header::getCoord(const std::string &key, DRW_Coord *varCoord){
bool result = false; bool result = false;
auto it=vars.find( key); auto it=vars.find( key);
if (it != vars.end()) { if (it != vars.end()) {

View File

@ -78,8 +78,8 @@ public:
void addDouble(std::string key, double value, int code); void addDouble(std::string key, double value, int code);
void addInt(std::string key, int value, int code); void addInt(std::string key, int value, int code);
void addStr(std::string key, std::string value, int code); void addStr(std::string key, const std::string &value, int code);
void addCoord(std::string key, DRW_Coord value, int code); void addCoord(std::string key, const DRW_Coord &value, int code);
std::string getComments() const {return comments;} std::string getComments() const {return comments;}
void write(dxfWriter *writer, DRW::Version ver); void write(dxfWriter *writer, DRW::Version ver);
void addComment(const std::string &c); void addComment(const std::string &c);
@ -87,10 +87,10 @@ public:
protected: protected:
bool parseCode(int code, dxfReader *reader); bool parseCode(int code, dxfReader *reader);
private: private:
bool getDouble(std::string key, double *varDouble); bool getDouble(const std::string &key, double *varDouble);
bool getInt(std::string key, int *varInt); bool getInt(const std::string &key, int *varInt);
bool getStr(std::string key, std::string *varStr); bool getStr(const std::string &key, std::string *varStr);
bool getCoord(std::string key, DRW_Coord *varCoord); bool getCoord(const std::string &key, DRW_Coord *varCoord);
void clearVars() void clearVars()
{ {
for (auto it=vars.begin(); it!=vars.end(); ++it) for (auto it=vars.begin(); it!=vars.end(); ++it)

View File

@ -113,7 +113,6 @@ public:
private: private:
DRW_TableEntry &operator=(const DRW_TableEntry &) Q_DECL_EQ_DELETE; DRW_TableEntry &operator=(const DRW_TableEntry &) Q_DECL_EQ_DELETE;
// cppcheck-suppress unsafeClassCanLeak
DRW_Variant* curr{nullptr}; DRW_Variant* curr{nullptr};
}; };
@ -642,7 +641,7 @@ public:
} }
protected: protected:
bool parseCode(int code, dxfReader *reader){return DRW_TableEntry::parseCode(code, reader);} bool parseCode(int code, dxfReader *reader) override {return DRW_TableEntry::parseCode(code, reader);}
}; };
namespace DRW { namespace DRW {

View File

@ -221,16 +221,16 @@ std::string DRW_TextCodec::fromUtf8(const std::string &s) {
return std::string(encodedString.constData()); return std::string(encodedString.constData());
} }
std::string DRW_TextCodec::correctCodePage(const std::string& s) { auto DRW_TextCodec::correctCodePage(const std::string& s) -> std::string {
//stringstream cause crash in OS/X, bug#3597944 //stringstream cause crash in OS/X, bug#3597944
QString cp = QString::fromStdString(s); QString codePage = QString::fromStdString(s);
cp = cp.toUpper(); codePage = codePage.toUpper();
QMap<QString, QStringList> codeMap = DRW_TextCodec::DXFCodePageMap(); QMap<QString, QStringList> codeMap = DRW_TextCodec::DXFCodePageMap();
auto i = codeMap.constBegin(); auto i = codeMap.constBegin();
while (i != codeMap.constEnd()) while (i != codeMap.constEnd())
{ {
if (i.value().contains(cp)) if (i.value().contains(codePage))
{ {
return i.key().toStdString(); return i.key().toStdString();
} }

View File

@ -25,7 +25,7 @@ public:
static QTextCodec* CodecForName(const QString &name); static QTextCodec* CodecForName(const QString &name);
private: private:
std::string correctCodePage(const std::string& s); static auto correctCodePage(const std::string& s) -> std::string;
private: private:
Q_DISABLE_COPY(DRW_TextCodec) Q_DISABLE_COPY(DRW_TextCodec)

View File

@ -170,6 +170,7 @@ bool dxfReaderBinary::readInt32() {
filestr->read(buffer,4); filestr->read(buffer,4);
int32p = reinterpret_cast<unsigned int *>(buffer); int32p = reinterpret_cast<unsigned int *>(buffer);
intData = static_cast<signed int>(*int32p); intData = static_cast<signed int>(*int32p);
// cppcheck-suppress danglingLifetime
DRW_DBG(intData); DRW_DBG("\n"); DRW_DBG(intData); DRW_DBG("\n");
return (filestr->good()); return (filestr->good());
} }
@ -181,6 +182,7 @@ bool dxfReaderBinary::readInt64() {
filestr->read(buffer,8); filestr->read(buffer,8);
int64p = reinterpret_cast<unsigned long long int *>(buffer); int64p = reinterpret_cast<unsigned long long int *>(buffer);
int64 = *int64p; int64 = *int64p;
// cppcheck-suppress danglingLifetime
DRW_DBG(int64); DRW_DBG(" int64\n"); DRW_DBG(int64); DRW_DBG(" int64\n");
return (filestr->good()); return (filestr->good());
} }
@ -193,6 +195,7 @@ bool dxfReaderBinary::readDouble() {
// cppcheck-suppress invalidPointerCast // cppcheck-suppress invalidPointerCast
result = reinterpret_cast<double *>(buffer); result = reinterpret_cast<double *>(buffer);
doubleData = *result; doubleData = *result;
// cppcheck-suppress danglingLifetime
DRW_DBG(doubleData); DRW_DBG("\n"); DRW_DBG(doubleData); DRW_DBG("\n");
return (filestr->good()); return (filestr->good());
} }

View File

@ -2878,6 +2878,7 @@ bool dxfRW::processDimension() {
break; } break; }
} }
// cppcheck-suppress unknownMacro
QT_WARNING_POP QT_WARNING_POP
return true; //found new entity or ENDSEC, terminate return true; //found new entity or ENDSEC, terminate

View File

@ -80,7 +80,6 @@ public:
auto Error() const -> QString; auto Error() const -> QString;
// cppcheck-suppress functionStatic
auto Units() const -> Unit; auto Units() const -> Unit;
auto IsBodyMeasurement() const -> bool; auto IsBodyMeasurement() const -> bool;
@ -111,7 +110,6 @@ protected:
auto IsRangeValid() -> bool; auto IsRangeValid() -> bool;
auto IsStepValid() -> bool; auto IsStepValid() -> bool;
auto IsBaseValid() -> bool; auto IsBaseValid() -> bool;
// cppcheck-suppress functionStatic
auto IsUnitsValid() const -> bool; auto IsUnitsValid() const -> bool;
private: private:

View File

@ -35,7 +35,6 @@
#include <QVector> #include <QVector>
#include <QtGlobal> #include <QtGlobal>
#include "../ifc/ifcdef.h"
#include "vabstractbezier.h" #include "vabstractbezier.h"
#include "vgeometrydef.h" #include "vgeometrydef.h"

View File

@ -409,6 +409,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
case PlaceLabelType::Circle: case PlaceLabelType::Circle:
return CircleShape(); return CircleShape();
} }
// cppcheck-suppress unknownMacro
QT_WARNING_POP QT_WARNING_POP
return PlaceLabelImg(); return PlaceLabelImg();

View File

@ -44,6 +44,7 @@ DialogLayoutScale::DialogLayoutScale(bool printTiled, QWidget *parent)
VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c()); VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
// cppcheck-suppress unknownMacro
SCASSERT(bOk != nullptr) SCASSERT(bOk != nullptr)
connect(bOk, &QPushButton::clicked, this, &DialogLayoutScale::Save); connect(bOk, &QPushButton::clicked, this, &DialogLayoutScale::Save);

View File

@ -87,6 +87,7 @@ void VAbstractLayoutDialog::InitTemplates(QComboBox *comboBoxTemplates)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VAbstractLayoutDialog::InitTileTemplates(QComboBox *comboBoxTemplates, bool keepCustom) void VAbstractLayoutDialog::InitTileTemplates(QComboBox *comboBoxTemplates, bool keepCustom)
{ {
// cppcheck-suppress unknownMacro
SCASSERT(comboBoxTemplates != nullptr) SCASSERT(comboBoxTemplates != nullptr)
InitTemplates(comboBoxTemplates); InitTemplates(comboBoxTemplates);

View File

@ -85,6 +85,7 @@ private:
Q_DISABLE_ASSIGN(VContourData) Q_DISABLE_ASSIGN(VContourData)
}; };
// cppcheck-suppress unknownMacro
QT_WARNING_POP QT_WARNING_POP
#endif // VCONTOUR_P_H #endif // VCONTOUR_P_H

View File

@ -61,7 +61,6 @@ struct PosterData
Q_DECLARE_TYPEINFO(PosterData, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(PosterData, Q_MOVABLE_TYPE);
// cppcheck-suppress noConstructor
class VPoster class VPoster
{ {
Q_DECLARE_TR_FUNCTIONS(VPoster) Q_DECLARE_TR_FUNCTIONS(VPoster)

View File

@ -42,7 +42,6 @@ class VRawSAPoint : public QPointF
public: public:
Q_DECL_CONSTEXPR VRawSAPoint(); Q_DECL_CONSTEXPR VRawSAPoint();
Q_DECL_CONSTEXPR VRawSAPoint(qreal xpos, qreal ypos); Q_DECL_CONSTEXPR VRawSAPoint(qreal xpos, qreal ypos);
// cppcheck-suppress noExplicitConstructor
Q_DECL_CONSTEXPR VRawSAPoint(QPointF p); Q_DECL_CONSTEXPR VRawSAPoint(QPointF p);
Q_DECL_CONSTEXPR VRawSAPoint(QPointF p, bool loopPoint); Q_DECL_CONSTEXPR VRawSAPoint(QPointF p, bool loopPoint);
@ -68,13 +67,11 @@ Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(qreal xpos, qreal ypos)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress passedByValue
Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p) Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p)
: QPointF(p) : QPointF(p)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress passedByValue
Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p, bool loopPoint) Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p, bool loopPoint)
: QPointF(p), : QPointF(p),
m_loopPoint(loopPoint) m_loopPoint(loopPoint)

View File

@ -95,7 +95,6 @@ Q_DECL_CONSTEXPR inline VSAPoint::VSAPoint(qreal xpos, qreal ypos)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress passedByValue
Q_DECL_CONSTEXPR inline VSAPoint::VSAPoint(QPointF p) Q_DECL_CONSTEXPR inline VSAPoint::VSAPoint(QPointF p)
: QPointF(p) : QPointF(p)
{} {}

View File

@ -165,6 +165,7 @@ template <typename T>
inline void Move(T &vector, int from, int to) inline void Move(T &vector, int from, int to)
{ {
QT_WARNING_PUSH QT_WARNING_PUSH
// cppcheck-suppress unknownMacro
QT_WARNING_DISABLE_GCC("-Wstrict-overflow") QT_WARNING_DISABLE_GCC("-Wstrict-overflow")
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)

View File

@ -615,6 +615,7 @@ private:
PUB* qxt_p_ptr; PUB* qxt_p_ptr;
}; };
// cppcheck-suppress unknownMacro
QT_WARNING_POP QT_WARNING_POP
template <typename PUB, typename PVT> template <typename PUB, typename PVT>

View File

@ -76,6 +76,7 @@ QString compilerString()
QLatin1String(" compatibility]"); QLatin1String(" compatibility]");
#endif #endif
#elif defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too #elif defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too
// cppcheck-suppress unassignedVariable
QString isAppleString; QString isAppleString;
#if defined(__apple_build_version__) // Apple clang has other version numbers #if defined(__apple_build_version__) // Apple clang has other version numbers
isAppleString = QLatin1String(" (Apple)"); isAppleString = QLatin1String(" (Apple)");

View File

@ -584,7 +584,6 @@ static QString qxt_addCsvQuotes(QxtCsvModel::QuoteMode mode, QString field)
Fields in the output file will be separated by \a separator. Set \a withHeader to true Fields in the output file will be separated by \a separator. Set \a withHeader to true
to output a row of headers at the top of the file. to output a row of headers at the top of the file.
*/ */
// cppcheck-suppress funcArgNamesDifferent
bool QxtCsvModel::toCSV(QIODevice* dest, QString &error, bool withHeader, QChar separator, QTextCodec* codec) const bool QxtCsvModel::toCSV(QIODevice* dest, QString &error, bool withHeader, QChar separator, QTextCodec* codec) const
{ {
const QxtCsvModelPrivate& d_ptr = qxt_d(); const QxtCsvModelPrivate& d_ptr = qxt_d();
@ -707,7 +706,6 @@ void QxtCsvModel::setQuoteMode(QuoteMode mode)
*/ */
void QxtCsvModel::setText(int row, int column, const QString& value) void QxtCsvModel::setText(int row, int column, const QString& value)
{ {
// cppcheck-suppress indexCalled
setData(index(row, column), value); setData(index(row, column), value);
} }
@ -718,7 +716,6 @@ void QxtCsvModel::setText(int row, int column, const QString& value)
*/ */
QString QxtCsvModel::text(int row, int column) const QString QxtCsvModel::text(int row, int column) const
{ {
// cppcheck-suppress indexCalled
return data(index(row, column)).toString(); return data(index(row, column)).toString();
} }

View File

@ -120,7 +120,6 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
rules += QLatin1String("kf5.kio.core*=false\n"); rules += QLatin1String("kf5.kio.core*=false\n");
#endif #endif
// cppcheck-suppress reademptycontainer
if (not rules.isEmpty()) if (not rules.isEmpty())
{ {
QLoggingCategory::setFilterRules(rules); QLoggingCategory::setFilterRules(rules);
@ -232,9 +231,7 @@ void VAbstractApplication::WinAttachConsole()
auto stdout_type = GetFileType(GetStdHandle(STD_OUTPUT_HANDLE)); auto stdout_type = GetFileType(GetStdHandle(STD_OUTPUT_HANDLE));
if (stdout_type == FILE_TYPE_UNKNOWN && AttachConsole(ATTACH_PARENT_PROCESS)) if (stdout_type == FILE_TYPE_UNKNOWN && AttachConsole(ATTACH_PARENT_PROCESS))
{ {
// cppcheck-suppress ignoredReturnValue
freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stdout);
// cppcheck-suppress ignoredReturnValue
freopen("CONOUT$", "w", stderr); freopen("CONOUT$", "w", stderr);
} }
} }

View File

@ -77,7 +77,6 @@ private:
QString lockFile; QString lockFile;
QSharedPointer<QLockFile> lock; QSharedPointer<QLockFile> lock;
// cppcheck-suppress functionStatic
bool TryLock(const QString &lockName, int stale, int timeout); bool TryLock(const QString &lockName, int stale, int timeout);
}; };

View File

@ -28,6 +28,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wold-style-cast") QT_WARNING_DISABLE_GCC("-Wold-style-cast")
// cppcheck-suppress unknownMacro
QT_WARNING_DISABLE_CLANG("-Wold-style-cast") QT_WARNING_DISABLE_CLANG("-Wold-style-cast")
QT_WARNING_DISABLE_GCC("-Wcast-qual") QT_WARNING_DISABLE_GCC("-Wcast-qual")
QT_WARNING_DISABLE_CLANG("-Wcast-qual") QT_WARNING_DISABLE_CLANG("-Wcast-qual")
@ -792,11 +793,13 @@ static halfedge_t* del_valid_link( halfedge_t *b )
{ {
if( a == INSIDE ) if( a == INSIDE )
{ {
// cppcheck-suppress unreadVariable
g_p = g; g_p = g;
gd = b; gd = b;
} }
else else
{ {
// cppcheck-suppress unreadVariable
d_p = d; d_p = d;
dd = b->pair; dd = b->pair;
} }

View File

@ -111,6 +111,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_MSVC(4701) QT_WARNING_DISABLE_MSVC(4701)
// cppcheck-suppress unknownMacro
QT_WARNING_DISABLE_GCC("-Wold-style-cast") QT_WARNING_DISABLE_GCC("-Wold-style-cast")
QT_WARNING_DISABLE_GCC("-Wfloat-equal") QT_WARNING_DISABLE_GCC("-Wfloat-equal")
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408

View File

@ -60,6 +60,7 @@ static inline QPaintEngine::PaintEngineFeatures svgEngineFeatures()
{ {
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wsign-conversion") QT_WARNING_DISABLE_CLANG("-Wsign-conversion")
// cppcheck-suppress unknownMacro
QT_WARNING_DISABLE_INTEL(68) QT_WARNING_DISABLE_INTEL(68)
QT_WARNING_DISABLE_INTEL(2022) QT_WARNING_DISABLE_INTEL(2022)
@ -194,6 +195,7 @@ void VObjEngine::drawPath(const QPainterPath &path)
delaunay2d_t *res = delaunay2d_from(points, num_points);//Calculate faces delaunay2d_t *res = delaunay2d_from(points, num_points);//Calculate faces
QPointF pf[MAX_POINTS]; QPointF pf[MAX_POINTS];
// cppcheck-suppress unreadVariable
bool skipFace=false;//Need skip first face bool skipFace=false;//Need skip first face
for (quint32 i = 0; i < res->num_faces; i++ ) for (quint32 i = 0; i < res->num_faces; i++ )
@ -216,9 +218,9 @@ void VObjEngine::drawPath(const QPainterPath &path)
if (skipFace == false ) if (skipFace == false )
{ {
QPolygonF face; QPolygonF face;
for ( int i = 0; i < num_verts; i++ ) for ( int ind = 0; ind < num_verts; ind++ )
{ {
face << QPointF(pf[i]); face << QPointF(pf[ind]);
} }
QPolygonF united = polygon.united(face); QPolygonF united = polygon.united(face);
qint64 sqUnited = Square(united); qint64 sqUnited = Square(united);

View File

@ -32,14 +32,12 @@
#include <QPointF> #include <QPointF>
#include <QSharedData> #include <QSharedData>
#include "../vmisc/diagnostic.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor") QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
// cppcheck-suppress copyCtorAndEqOperator
class VAbstractFloatItemDataPrivate : public QSharedData class VAbstractFloatItemDataPrivate : public QSharedData
{ {
public: public:

View File

@ -32,16 +32,14 @@
#include <QPointF> #include <QPointF>
#include <QSharedData> #include <QSharedData>
#include "../vmisc/diagnostic.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
#include "../vmisc/typedef.h"
#include "floatitemdef.h" #include "floatitemdef.h"
#include "../ifc/ifcdef.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor") QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
// cppcheck-suppress copyCtorAndEqOperator
class VGrainlineDataPrivate : public QSharedData class VGrainlineDataPrivate : public QSharedData
{ {
public: public:

View File

@ -32,15 +32,13 @@
#include <QPointF> #include <QPointF>
#include <QSharedData> #include <QSharedData>
#include "../vmisc/diagnostic.h" #include "../vmisc/typedef.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
#include "../ifc/ifcdef.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor") QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
// cppcheck-suppress copyCtorAndEqOperator
class VPatternLabelDataPrivate : public QSharedData class VPatternLabelDataPrivate : public QSharedData
{ {
public: public:

View File

@ -33,16 +33,13 @@
#include <QString> #include <QString>
#include <QVector> #include <QVector>
#include "../vmisc/diagnostic.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
#include "floatitemdef.h"
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor") QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
// cppcheck-suppress copyCtorAndEqOperator
class VPieceLabelDataPrivate : public QSharedData class VPieceLabelDataPrivate : public QSharedData
{ {
public: public:

View File

@ -46,6 +46,7 @@ VArcRadius::VArcRadius()
VArcRadius::VArcRadius(const quint32 &id, const quint32 &parentId, const VArc *arc, Unit patternUnit) VArcRadius::VArcRadius(const quint32 &id, const quint32 &parentId, const VArc *arc, Unit patternUnit)
:VCurveVariable(id, parentId) :VCurveVariable(id, parentId)
{ {
// cppcheck-suppress unknownMacro
SCASSERT(arc != nullptr) SCASSERT(arc != nullptr)
SetType(VarType::ArcRadius); SetType(VarType::ArcRadius);

View File

@ -31,8 +31,8 @@
#include <QSharedData> #include <QSharedData>
#include "../vmisc/diagnostic.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
#include "../vmisc/typedef.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
@ -46,7 +46,7 @@ public:
:arcId(NULL_ID) :arcId(NULL_ID)
{} {}
VArcRadiusData(const quint32 &arcId) explicit VArcRadiusData(const quint32 &arcId)
:arcId(arcId) :arcId(arcId)
{} {}

View File

@ -85,6 +85,7 @@ VCurveAngle::VCurveAngle(const quint32 &id, const quint32 &parentId, const VAbst
const VSpline &spl, CurveAngle angle, qint32 segment) const VSpline &spl, CurveAngle angle, qint32 segment)
:VCurveVariable(id, parentId) :VCurveVariable(id, parentId)
{ {
// cppcheck-suppress unknownMacro
SCASSERT(baseCurve != nullptr) SCASSERT(baseCurve != nullptr)
SetType(VarType::CurveAngle); SetType(VarType::CurveAngle);

View File

@ -78,6 +78,7 @@ VCurveCLength::VCurveCLength(const quint32 &id, const quint32 &parentId, const V
const VSpline &spl, CurveCLength cType, Unit patternUnit, qint32 segment) const VSpline &spl, CurveCLength cType, Unit patternUnit, qint32 segment)
: VCurveVariable(id, parentId) : VCurveVariable(id, parentId)
{ {
// cppcheck-suppress unknownMacro
SCASSERT(baseCurve != nullptr) SCASSERT(baseCurve != nullptr)
SetType(VarType::CurveCLength); SetType(VarType::CurveCLength);

View File

@ -48,6 +48,7 @@ VCurveLength::VCurveLength(const quint32 &id, const quint32 &parentId, const VAb
:VCurveVariable(id, parentId) :VCurveVariable(id, parentId)
{ {
SetType(VarType::CurveLength); SetType(VarType::CurveLength);
// cppcheck-suppress unknownMacro
SCASSERT(curve != nullptr) SCASSERT(curve != nullptr)
SetName(curve->name()); SetName(curve->name());

View File

@ -99,6 +99,7 @@ bool VCurveVariable::Filter(quint32 id)
return d->id == id || d->parentId == id; return d->id == id || d->parentId == id;
} }
// cppcheck-suppress unknownMacro
QT_WARNING_POP QT_WARNING_POP
return d->id == id; return d->id == id;

View File

@ -31,15 +31,12 @@
#include <QSharedData> #include <QSharedData>
#include "../ifc/ifcdef.h"
#include "../vmisc/diagnostic.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor") QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
// cppcheck-suppress copyCtorAndEqOperator
class VCurveVariableData final : public QSharedData class VCurveVariableData final : public QSharedData
{ {
public: public:

View File

@ -31,14 +31,12 @@
#include <QSharedData> #include <QSharedData>
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vmisc/diagnostic.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor") QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
// cppcheck-suppress copyCtorAndEqOperator
class VInternalVariableData final : public QSharedData class VInternalVariableData final : public QSharedData
{ {
public: public:

View File

@ -53,6 +53,7 @@ VLineAngle::VLineAngle(const VPointF *p1, const quint32 &p1Id, const VPointF *p2
{ {
SetType(VarType::LineAngle); SetType(VarType::LineAngle);
// cppcheck-suppress unknownMacro
SCASSERT(p1 != nullptr) SCASSERT(p1 != nullptr)
SCASSERT(p2 != nullptr) SCASSERT(p2 != nullptr)

View File

@ -31,15 +31,13 @@
#include <QSharedData> #include <QSharedData>
#include "../ifc/ifcdef.h"
#include "../vmisc/diagnostic.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
#include "../vmisc/typedef.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor") QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
// cppcheck-suppress copyCtorAndEqOperator
class VLineAngleData final : public QSharedData class VLineAngleData final : public QSharedData
{ {
public: public:

View File

@ -50,6 +50,7 @@ VLengthLine::VLengthLine(const VPointF *p1, const quint32 &p1Id, const VPointF *
Unit patternUnit) Unit patternUnit)
:VInternalVariable(), d(new VLengthLineData(p1Id, p2Id, patternUnit)) :VInternalVariable(), d(new VLengthLineData(p1Id, p2Id, patternUnit))
{ {
// cppcheck-suppress unknownMacro
SCASSERT(p1 != nullptr) SCASSERT(p1 != nullptr)
SCASSERT(p2 != nullptr) SCASSERT(p2 != nullptr)

View File

@ -31,19 +31,17 @@
#include <QSharedData> #include <QSharedData>
#include "../ifc/ifcdef.h"
#include "../vmisc/diagnostic.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
#include "../vmisc/def.h"
#include "../vmisc/typedef.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor") QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
// cppcheck-suppress copyCtorAndEqOperator
class VLengthLineData final : public QSharedData class VLengthLineData final : public QSharedData
{ {
public: public:
VLengthLineData() VLengthLineData()
:p1Id(NULL_ID), p2Id(NULL_ID), patternUnit(Unit::Cm) :p1Id(NULL_ID), p2Id(NULL_ID), patternUnit(Unit::Cm)
{} {}

View File

@ -31,14 +31,12 @@
#include <QSharedData> #include <QSharedData>
#include "../vmisc/diagnostic.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor") QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
// cppcheck-suppress copyCtorAndEqOperator
class VVariableData final : public QSharedData class VVariableData final : public QSharedData
{ {
public: public:

View File

@ -70,6 +70,7 @@ public:
static void BiasTokens(int position, int bias, QMap<int, QString> &tokens); static void BiasTokens(int position, int bias, QMap<int, QString> &tokens);
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VTranslateVars) //NOLINT Q_DISABLE_COPY_MOVE(VTranslateVars) //NOLINT
QMap<QString, qmu::QmuTranslation> PMSystemNames{}; QMap<QString, qmu::QmuTranslation> PMSystemNames{};
QMap<QString, qmu::QmuTranslation> PMSystemAuthors{}; QMap<QString, qmu::QmuTranslation> PMSystemAuthors{};

View File

@ -31,10 +31,10 @@ VPE::QVector3DProperty::QVector3DProperty(const QString& name)
: VProperty(name, QVariant::String) // todo: QVariant::Vector3D?? : VProperty(name, QVariant::String) // todo: QVariant::Vector3D??
{ {
QVariant tmpFloat(0); tmpFloat.convert(QVariant::Double); QVariant tmpFloat(0); tmpFloat.convert(QVariant::Double);
VDoubleProperty* tmpX = new VDoubleProperty("X"); addChild(tmpX); tmpX->setUpdateBehaviour(true, false); auto* tmpX = new VDoubleProperty("X"); addChild(tmpX); tmpX->setUpdateBehaviour(true, false);
VDoubleProperty* tmpY = new VDoubleProperty("Y"); addChild(tmpY); tmpY->setUpdateBehaviour(true, false); auto* tmpY = new VDoubleProperty("Y"); addChild(tmpY); tmpY->setUpdateBehaviour(true, false);
VDoubleProperty* tmpZ = new VDoubleProperty("Z"); addChild(tmpZ); tmpZ->setUpdateBehaviour(true, false); auto* tmpZ = new VDoubleProperty("Z"); addChild(tmpZ); tmpZ->setUpdateBehaviour(true, false);
setVector(Vector3D()); VPE::QVector3DProperty::setVector(Vector3D());
} }

View File

@ -212,20 +212,19 @@ void VPE::VFileEditWidget::dropEvent(QDropEvent* event)
} }
bool VPE::VFileEditWidget::checkMimeData(const QMimeData* data, QString& file) const auto VPE::VFileEditWidget::checkMimeData(const QMimeData* data, QString& file) const -> bool
{ {
if (data->hasUrls()) if (data->hasUrls())
{ {
QList<QUrl> tmpUrlList = data->urls(); QList<QUrl> tmpUrlList = data->urls();
QFileInfo tmpFileInfo; QFileInfo tmpFileInfo;
for(const QUrl &tmpUrl : tmpUrlList) auto tmpUrl = std::find_if(tmpUrlList.cbegin(), tmpUrlList.cend(),
[](const QUrl &tmpUrl){return QFile::exists(tmpUrl.toLocalFile());});
if (tmpUrl != tmpUrlList.cend())
{ {
if (QFile::exists(tmpUrl.toLocalFile())) tmpFileInfo = QFileInfo(tmpUrl->toLocalFile());
{
tmpFileInfo = QFileInfo(tmpUrl.toLocalFile());
break;
}
} }
if (checkFileFilter(tmpFileInfo.fileName())) if (checkFileFilter(tmpFileInfo.fileName()))

View File

@ -47,7 +47,7 @@ VPE::VProperty::VProperty(VPropertyPrivate *d)
VPE::VProperty::~VProperty() VPE::VProperty::~VProperty()
{ {
setParent(nullptr); VPE::VProperty::setParent(nullptr);
while (!d_ptr->Children.isEmpty()) while (!d_ptr->Children.isEmpty())
{ {

View File

@ -40,7 +40,7 @@ VPE::VPropertyFormWidget::VPropertyFormWidget(const QString &title, const QStrin
const QList<VProperty*>& properties, QWidget *parent) const QList<VProperty*>& properties, QWidget *parent)
: QGroupBox(title, parent), d_ptr(new VPropertyFormWidgetPrivate(properties)) : QGroupBox(title, parent), d_ptr(new VPropertyFormWidgetPrivate(properties))
{ {
build(); VPE::VPropertyFormWidget::build();
setToolTip(description); setToolTip(description);
setWhatsThis(description); setWhatsThis(description);
} }
@ -51,7 +51,7 @@ VPE::VPropertyFormWidget::VPropertyFormWidget(VProperty *parent_property, QWidge
if (parent_property) if (parent_property)
{ {
d_ptr->Properties = parent_property->getChildren(); d_ptr->Properties = parent_property->getChildren();
build(); VPE::VPropertyFormWidget::build();
setTitle(parent_property->getName()); setTitle(parent_property->getName());
setToolTip(parent_property->getDescription()); setToolTip(parent_property->getDescription());
setWhatsThis(parent_property->getDescription()); setWhatsThis(parent_property->getDescription());
@ -62,7 +62,7 @@ VPE::VPropertyFormWidget::VPropertyFormWidget(VPropertyFormWidgetPrivate *d_poin
const QString &title, const QString &description) const QString &title, const QString &description)
: QGroupBox(title, parent), d_ptr(d_pointer) : QGroupBox(title, parent), d_ptr(d_pointer)
{ {
build(); VPE::VPropertyFormWidget::build();
setToolTip(description); setToolTip(description);
setWhatsThis(description); setWhatsThis(description);
} }

View File

@ -47,14 +47,12 @@ public:
//! Constructor //! Constructor
VPropertyModelPrivate() VPropertyModelPrivate()
: Properties(nullptr), HeadlineProperty(QString()), HeadlineValue(QString()) : Properties(nullptr),
{
//: The text that appears in the first column header //: The text that appears in the first column header
HeadlineProperty = QObject::tr("Property"); HeadlineProperty(QObject::tr("Property")),
//: The text that appears in the second column header //: The text that appears in the second column header
HeadlineValue = QObject::tr("Value"); HeadlineValue(QObject::tr("Value"))
} {}
private: private:
Q_DISABLE_COPY(VPropertyModelPrivate) Q_DISABLE_COPY(VPropertyModelPrivate)

View File

@ -37,7 +37,7 @@ VPE::VPropertySet::VPropertySet()
VPE::VPropertySet::~VPropertySet() VPE::VPropertySet::~VPropertySet()
{ {
// Delete all the properties // Delete all the properties
clear(true); VPE::VPropertySet::clear(true);
delete d_ptr; delete d_ptr;
} }
@ -221,15 +221,8 @@ bool VPE::VPropertySet::hasProperty(VProperty *property, VProperty *parent) cons
} }
const QList<VProperty*>& tmpChildrenList = (parent != nullptr ? parent->getChildren() : d_ptr->RootProperties); const QList<VProperty*>& tmpChildrenList = (parent != nullptr ? parent->getChildren() : d_ptr->RootProperties);
for(auto tmpProp : tmpChildrenList) return std::any_of(tmpChildrenList.begin(), tmpChildrenList.end(), [this, property](VProperty* tmpProp)
{ {return tmpProp && (tmpProp == property || hasProperty(property, tmpProp));});
if (tmpProp && (tmpProp == property || hasProperty(property, tmpProp)))
{
return true;
}
}
return false;
} }
void VPE::VPropertySet::cloneProperty(VProperty* property_to_clone, VProperty *parent_property, void VPE::VPropertySet::cloneProperty(VProperty* property_to_clone, VProperty *parent_property,

View File

@ -30,13 +30,13 @@
VPE::VPropertyTreeView::VPropertyTreeView(QWidget *parent) VPE::VPropertyTreeView::VPropertyTreeView(QWidget *parent)
: QTreeView(parent), d_ptr(new VPropertyTreeViewPrivate()) : QTreeView(parent), d_ptr(new VPropertyTreeViewPrivate())
{ {
init(); VPE::VPropertyTreeView::init();
} }
VPE::VPropertyTreeView::VPropertyTreeView(VPropertyModel *model, QWidget *parent) VPE::VPropertyTreeView::VPropertyTreeView(VPropertyModel *model, QWidget *parent)
: QTreeView(parent), d_ptr(new VPropertyTreeViewPrivate()) : QTreeView(parent), d_ptr(new VPropertyTreeViewPrivate())
{ {
init(); VPE::VPropertyTreeView::init();
if (model) if (model)
{ {
@ -49,7 +49,7 @@ VPE::VPropertyTreeView::VPropertyTreeView(VPropertyTreeViewPrivate *d, bool init
{ {
if (init_) if (init_)
{ {
init(); VPE::VPropertyTreeView::init();
} }
} }

View File

@ -69,6 +69,6 @@ private:
Q_DISABLE_COPY(VPropertyTreeView) Q_DISABLE_COPY(VPropertyTreeView)
}; };
} } // namespace VPE
#endif // VPROPERTYTREEVIEWEEVIEW_H #endif // VPROPERTYTREEVIEWEEVIEW_H

View File

@ -199,6 +199,7 @@ void MoveCursorToEnd(QPlainTextEdit *plainTextEdit)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DeployFormula(QDialog *dialog, QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight) void DeployFormula(QDialog *dialog, QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight)
{ {
// cppcheck-suppress unknownMacro
SCASSERT(dialog != nullptr) SCASSERT(dialog != nullptr)
SCASSERT(formula != nullptr) SCASSERT(formula != nullptr)
SCASSERT(buttonGrowLength != nullptr) SCASSERT(buttonGrowLength != nullptr)

View File

@ -110,6 +110,7 @@ protected:
private slots: private slots:
void FilterVariablesEdited(const QString &filter); void FilterVariablesEdited(const QString &filter);
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogEditWrongFormula) //NOLINT Q_DISABLE_COPY_MOVE(DialogEditWrongFormula) //NOLINT
Ui::DialogEditWrongFormula *ui; Ui::DialogEditWrongFormula *ui;

View File

@ -128,7 +128,6 @@ public slots:
virtual void PointNameChanged() {} virtual void PointNameChanged() {}
protected: protected:
/** @brief data container with data */ /** @brief data container with data */
// cppcheck-suppress duplInheritedMember
const VContainer *data; const VContainer *data;
/** @brief isInitialized true if window is initialized */ /** @brief isInitialized true if window is initialized */
@ -237,6 +236,7 @@ private:
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const; const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const;
}; };
// cppcheck-suppress unknownMacro
QT_WARNING_POP QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -104,6 +104,7 @@ private slots:
void ScreenChanged(); void ScreenChanged();
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VBackgroundImageControls) // NOLINT Q_DISABLE_COPY_MOVE(VBackgroundImageControls) // NOLINT
QUuid m_id{}; QUuid m_id{};

View File

@ -111,6 +111,7 @@ private slots:
void ZValueChanged(); void ZValueChanged();
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VBackgroundImageItem) Q_DISABLE_COPY_MOVE(VBackgroundImageItem)
VBackgroundPatternImage m_image; VBackgroundPatternImage m_image;

View File

@ -62,7 +62,7 @@ protected:
private: private:
Q_DISABLE_COPY(VNodeArc) Q_DISABLE_COPY(VNodeArc)
VNodeArc(const VAbstractNodeInitData &initData, QObject *qoParent = nullptr); explicit VNodeArc(const VAbstractNodeInitData &initData, QObject *qoParent = nullptr);
}; };
#endif // VNODEARC_H4 #endif // VNODEARC_H4

View File

@ -59,7 +59,7 @@ protected:
private: private:
Q_DISABLE_COPY(VNodeEllipticalArc) Q_DISABLE_COPY(VNodeEllipticalArc)
VNodeEllipticalArc(const VAbstractNodeInitData &initData, QObject *qoParent = nullptr); explicit VNodeEllipticalArc(const VAbstractNodeInitData &initData, QObject *qoParent = nullptr);
}; };
#endif // VNODEELLIPTICALARC_H #endif // VNODEELLIPTICALARC_H

View File

@ -62,7 +62,7 @@ protected:
private: private:
Q_DISABLE_COPY(VNodeSpline) Q_DISABLE_COPY(VNodeSpline)
VNodeSpline(const VAbstractNodeInitData &initData, QObject *qoParent = nullptr); explicit VNodeSpline(const VAbstractNodeInitData &initData, QObject *qoParent = nullptr);
}; };
#endif // VNODESPLINE_H #endif // VNODESPLINE_H

View File

@ -62,7 +62,7 @@ protected:
private: private:
Q_DISABLE_COPY(VNodeSplinePath) Q_DISABLE_COPY(VNodeSplinePath)
VNodeSplinePath(const VAbstractNodeInitData &initData, QObject *qoParent = nullptr); explicit VNodeSplinePath(const VAbstractNodeInitData &initData, QObject *qoParent = nullptr);
}; };
#endif // VNODESPLINEPATH_H #endif // VNODESPLINEPATH_H

View File

@ -209,7 +209,8 @@ template <typename T>
inline void VAbstractTool::AddVisualization() inline void VAbstractTool::AddVisualization()
{ {
T *visual = new T(getData()); T *visual = new T(getData());
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene()); auto *scene = qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
// cppcheck-suppress unknownMacro
SCASSERT(scene != nullptr) SCASSERT(scene != nullptr)
scene->addItem(visual); scene->addItem(visual);

View File

@ -37,6 +37,7 @@ AddPatternPiece::AddPatternPiece(const QDomElement &xml, VAbstractPattern *doc,
QUndoCommand *parent) QUndoCommand *parent)
: VUndoCommand(xml, doc, parent), namePP(namePP) : VUndoCommand(xml, doc, parent), namePP(namePP)
{ {
// cppcheck-suppress unknownMacro
SCASSERT(namePP.isEmpty() == false) SCASSERT(namePP.isEmpty() == false)
setText(tr("add pattern piece %1").arg(namePP)); setText(tr("add pattern piece %1").arg(namePP));
} }

View File

@ -98,7 +98,7 @@ void DeletePatternPiece::redo()
emit doc->SetCurrentPP(namePP);//Without this user will not see this change emit doc->SetCurrentPP(namePP);//Without this user will not see this change
} }
QDomElement rootElement = doc->documentElement(); QDomElement rootElement = doc->documentElement();
const QDomElement patternPiece = doc->GetPPElement(namePP); const QDomElement patternPieceElement = doc->GetPPElement(namePP);
rootElement.removeChild(patternPiece); rootElement.removeChild(patternPieceElement);
emit NeedFullParsing(); emit NeedFullParsing();
} }

View File

@ -47,6 +47,7 @@ signals:
void AddItem(const QUuid &id); void AddItem(const QUuid &id);
void DeleteItem(const QUuid &id); void DeleteItem(const QUuid &id);
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(AddBackgroundImage) Q_DISABLE_COPY_MOVE(AddBackgroundImage)
VBackgroundPatternImage m_image; VBackgroundPatternImage m_image;
}; };

View File

@ -48,6 +48,7 @@ signals:
void AddItem(const QUuid &id); void AddItem(const QUuid &id);
void DeleteItem(const QUuid &id); void DeleteItem(const QUuid &id);
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DeleteBackgroundImage) Q_DISABLE_COPY_MOVE(DeleteBackgroundImage)
VBackgroundPatternImage m_image; VBackgroundPatternImage m_image;
int m_index{-1}; int m_index{-1};

View File

@ -43,6 +43,7 @@ public:
void undo() override; void undo() override;
void redo() override; void redo() override;
private: private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(HideAllBackgroundImages) Q_DISABLE_COPY_MOVE(HideAllBackgroundImages)
bool m_hide; bool m_hide;
QMap<QUuid, bool> m_oldVisibility{}; QMap<QUuid, bool> m_oldVisibility{};

Some files were not shown because too many files have changed in this diff Show More