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.
# Because we use the last available cppcheck version usually we build it manually.
CPPCHECK="../../../../cppcheck/cppcheck"
CPPCHECK="../../../../cppcheck-2.8/cppcheck"
$CPPCHECK \
-j4 -f -q \
-UDRW_DBG \
-U__INTEL_COMPILER_UPDATE \
-UqApp \
--template '{file}:{line}:{message}:{id}' \
--inline-suppr \
--platform=unix64 \
--std=c++11 \
--std=posix \
--std=c++17 \
--enable=all \
--library=qt.cfg \
--library=std.cfg \
--library=posix.cfg \
--library=qt \
--library=std \
--library=posix \
--inconclusive \
--suppress=leakReturnValNotUsed:../src/app/valentina/core/vapplication.cpp \
--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 \
--suppress=*:*/vdxf/libdxfrw/intern/make_unique.h \
../src

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -80,6 +80,7 @@ protected slots:
void AboutToQuit() override;
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VApplication) // NOLINT
VTranslateVars *m_trVars{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)
{
// cppcheck-suppress unknownMacro
SCASSERT(box != nullptr)
box->addItems(items);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -711,7 +711,6 @@ void VDomDocument::CacheRefreshed()
void VDomDocument::setXMLContent(const QString &fileName)
{
QFile file(fileName);
// cppcheck-suppress ConfigurationNotChecked
if (file.open(QIODevice::ReadOnly) == false)
{
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;
QSaveFile file(fileName);
// cppcheck-suppress ConfigurationNotChecked
if (file.open(QIODevice::WriteOnly))
{
// 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"));
destFile.setAutoRemove(false);// Will be renamed to be destination file
// cppcheck-suppress ConfigurationNotChecked
if (not destFile.open())
{
error = destFile.errorString();
@ -1008,7 +1005,6 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
else
{
QFile sourceFile(source);
// cppcheck-suppress ConfigurationNotChecked
if (sourceFile.open(QIODevice::ReadOnly))
{
result = true;

View File

@ -1937,7 +1937,6 @@ void QmuParserBase::Eval(qreal *results, int nBulkSize) const
#endif
int nMaxThreads = qMin(omp_get_max_threads(), s_MaxNumOpenMPThreads);
// cppcheck-suppress unreadVariable
int ct=0;
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;
};
// cppcheck-suppress unknownMacro
QT_WARNING_POP
//---------------------------------------------------------------------------------------------------------------------

View File

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

View File

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

View File

@ -1239,7 +1239,6 @@ int QmuParserTester::EqnTestWithVarChange (const QString &a_str, double a_fRes1,
var = a_fRes1;
fVal[0] = p.Eval();
// cppcheck-suppress redundantAssignment
var = a_fRes2; //-V519
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 )
{
QmuParserTester::c_iCount++;
// cppcheck-suppress variableScope
int iRet ( 0 );
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)) /
( RAND_MAX + 1.0 ) ) ) );
#else
// cppcheck-suppress qrandCalled
return static_cast<qreal>( ( 1 + ( v * qrand() / ( RAND_MAX + 1.0 ) ) ) );
#endif
}
@ -253,7 +252,6 @@ private:
return static_cast<qreal>( ( 1 + ( 1000.0f * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) /
( RAND_MAX + 1.0 ) ) ) );
#else
// cppcheck-suppress qrandCalled
return static_cast<qreal>( ( 1 + ( 1000.0f * static_cast<qreal>(qrand()) / ( RAND_MAX + 1.0 ) ) ) );
#endif
}
@ -312,31 +310,18 @@ private:
static int IsHexVal (const QString &a_szExpr, int *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers,
const QChar &decimal, const QChar &thousand);
// cppcheck-suppress functionStatic
int TestNames();
// cppcheck-suppress functionStatic
int TestSyntax();
// cppcheck-suppress functionStatic
int TestMultiArg();
// cppcheck-suppress functionStatic
int TestPostFix();
// cppcheck-suppress functionStatic
int TestExpression();
// cppcheck-suppress functionStatic
int TestInfixOprt();
// cppcheck-suppress functionStatic
int TestBinOprt();
// cppcheck-suppress functionStatic
int TestVarConst();
// cppcheck-suppress functionStatic
int TestInterface();
// cppcheck-suppress functionStatic
int TestException();
// cppcheck-suppress functionStatic
int TestStrArg();
// cppcheck-suppress functionStatic
int TestIfThenElse();
// cppcheck-suppress functionStatic
int TestBulkMode();
static void Abort();

View File

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

View File

@ -263,7 +263,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader);
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
double angle{0}; /*!< angle, code 50 */
@ -946,11 +946,13 @@ public:
fitpoint()
{
eType = DRW::SPLINE;
for(double v : p.knotslist) knotslist.push_back(v);
for(double v : p.weightlist) weightlist.push_back(v);
for(DRW_Coord *v : p.controllist) controllist.push_back(new DRW_Coord(*v));
for(DRW_Coord *v : p.fitlist) fitlist.push_back(new DRW_Coord(*v));
std::copy(p.knotslist.begin(), p.knotslist.end(), std::back_inserter(knotslist));
std::copy(p.weightlist.begin(), p.weightlist.end(), std::back_inserter(weightlist));
std::transform(p.controllist.cbegin(), p.controllist.cend(), std::back_inserter(controllist),
[](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() {
@ -991,9 +993,7 @@ public:
private:
DRW_Spline &operator=(const DRW_Spline &) Q_DECL_EQ_DELETE;
// cppcheck-suppress unsafeClassCanLeak
DRW_Coord *controlpoint; /*!< current control point to add data */
// cppcheck-suppress unsafeClassCanLeak
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 */
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 */
void setDimPoint(const DRW_Coord &p){setDefPoint(p);}
@ -1584,7 +1584,6 @@ public:
private:
Q_DISABLE_COPY(DRW_Leader)
// cppcheck-suppress unsafeClassCanLeak
DRW_Coord *vertexpoint; /*!< current control point to add data */
};

View File

@ -597,10 +597,10 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
writer->writeInt16(70, 3);
writer->writeString(9, "$DIMTXSTY");
if (getStr("$DIMTXSTY", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(7, varStr);
else
writer->writeUtf8String(7, varStr);
// if (ver == DRW::AC1009)
// writer->writeUtf8Caps(7, varStr);
// else
writer->writeUtf8String(7, varStr);
else
writer->writeString(7, "STANDARD");
writer->writeString(9, "$DIMAUNIT");
@ -640,10 +640,10 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
writer->writeInt16(70, 0);
writer->writeString(9, "$DIMLDRBLK");
if (getStr("$DIMLDRBLK", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(1, varStr);
else
writer->writeUtf8String(1, varStr);
// if (ver == DRW::AC1009)
// writer->writeUtf8Caps(1, varStr);
// else
writer->writeUtf8String(1, varStr);
else
writer->writeString(1, "STANDARD");
//verify if exist "$DIMLUNIT" or obsolete "$DIMUNIT" (pre v2000)
@ -710,26 +710,17 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
writer->writeInt16(70, 0);
writer->writeString(9, "$DIMLTYPE");
if (getStr("$DIMLTYPE", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(6, varStr);
else
writer->writeUtf8String(6, varStr);
writer->writeUtf8String(6, varStr);
else
writer->writeString(6, "");
writer->writeString(9, "$DIMLTEX1");
if (getStr("$DIMLTEX1", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(6, varStr);
else
writer->writeUtf8String(6, varStr);
writer->writeUtf8String(6, varStr);
else
writer->writeString(6, "");
writer->writeString(9, "$DIMLTEX2");
if (getStr("$DIMLTEX2", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(6, varStr);
else
writer->writeUtf8String(6, varStr);
writer->writeUtf8String(6, varStr);
else
writer->writeString(6, "");
if (ver > DRW::AC1021) {// and post v2007 dim vars
@ -939,10 +930,7 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
if (ver > DRW::AC1009) {
writer->writeString(9, "$UCSBASE");
if (getStr("$UCSBASE", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(2, varStr);
else
writer->writeUtf8String(2, varStr);
writer->writeUtf8String(2, varStr);
else
writer->writeString(2, "");
}
@ -987,10 +975,10 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
if (ver > DRW::AC1009) { //begin post r12 UCS vars
writer->writeString(9, "$UCSORTHOREF");
if (getStr("$UCSORTHOREF", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(2, varStr);
else
writer->writeUtf8String(2, varStr);
// if (ver == DRW::AC1009)
// writer->writeUtf8Caps(2, varStr);
// else
writer->writeUtf8String(2, varStr);
else
writer->writeString(2, "");
writer->writeString(9, "$UCSORTHOVIEW");
@ -1060,10 +1048,10 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
}
writer->writeString(9, "$PUCSBASE");
if (getStr("$PUCSBASE", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(2, varStr);
else
writer->writeUtf8String(2, varStr);
// if (ver == DRW::AC1009)
// writer->writeUtf8Caps(2, varStr);
// else
writer->writeUtf8String(2, varStr);
else
writer->writeString(2, "");
} //end post r12 UCS vars
@ -1108,10 +1096,10 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
if (ver > DRW::AC1009) { //begin post r12 PUCS vars
writer->writeString(9, "$PUCSORTHOREF");
if (getStr("$PUCSORTHOREF", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(2, varStr);
else
writer->writeUtf8String(2, varStr);
// if (ver == DRW::AC1009)
// writer->writeUtf8Caps(2, varStr);
// else
writer->writeUtf8String(2, varStr);
else
writer->writeString(2, "");
writer->writeString(9, "$PUCSORTHOVIEW");
@ -1359,10 +1347,10 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
writer->writeInt16(70, 3020);
writer->writeString(9, "$CMLSTYLE");
if (getStr("$CMLSTYLE", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(2, varStr);
else
writer->writeUtf8String(2, varStr);
// if (ver == DRW::AC1009)
// writer->writeUtf8Caps(2, varStr);
// else
writer->writeUtf8String(2, varStr);
else
writer->writeString(2, "Standard");
writer->writeString(9, "$CMLJUST");
@ -1414,18 +1402,18 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
}
writer->writeString(9, "$HYPERLINKBASE");
if (getStr("$HYPERLINKBASE", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(1, varStr);
else
writer->writeUtf8String(1, varStr);
// if (ver == DRW::AC1009)
// writer->writeUtf8Caps(1, varStr);
// else
writer->writeUtf8String(1, varStr);
else
writer->writeString(1, "");
writer->writeString(9, "$STYLESHEET");
if (getStr("$STYLESHEET", &varStr))
if (ver == DRW::AC1009)
writer->writeUtf8Caps(1, varStr);
else
writer->writeUtf8String(1, varStr);
// if (ver == DRW::AC1009)
// writer->writeUtf8Caps(1, varStr);
// else
writer->writeUtf8String(1, varStr);
else
writer->writeString(1, "");
writer->writeString(9, "$XEDIT"); //RLZ bool flag, verify in bin version
@ -1678,7 +1666,6 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
}
void DRW_Header::addDouble(std::string key, double value, int code){
// cppcheck-suppress publicAllocationError
curr = new DRW_Variant();
curr->addDouble( value );
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){
// cppcheck-suppress publicAllocationError
curr = new DRW_Variant();
curr->addInt( value );
curr->code = code;
vars[key] =curr;
}
void DRW_Header::addStr(std::string key, std::string value, int code){
// cppcheck-suppress publicAllocationError
void DRW_Header::addStr(std::string key, const std::string &value, int code){
curr = new DRW_Variant();
curr->addString( value );
curr->code = code;
vars[key] =curr;
}
void DRW_Header::addCoord(std::string key, DRW_Coord value, int code){
// cppcheck-suppress publicAllocationError
void DRW_Header::addCoord(std::string key, const DRW_Coord &value, int code){
curr = new DRW_Variant();
curr->addCoord( value );
curr->code = code;
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;
auto it=vars.find( key);
if (it != vars.end()) {
@ -1724,7 +1708,7 @@ bool DRW_Header::getDouble(std::string key, double *varDouble){
return result;
}
bool DRW_Header::getInt(std::string key, int *varInt){
bool DRW_Header::getInt(const std::string &key, int *varInt){
bool result = false;
auto it=vars.find( key);
if (it != vars.end()) {
@ -1739,7 +1723,7 @@ bool DRW_Header::getInt(std::string key, int *varInt){
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;
auto it=vars.find( key);
if (it != vars.end()) {
@ -1754,7 +1738,7 @@ bool DRW_Header::getStr(std::string key, std::string *varStr){
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;
auto it=vars.find( key);
if (it != vars.end()) {

View File

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

View File

@ -113,7 +113,6 @@ public:
private:
DRW_TableEntry &operator=(const DRW_TableEntry &) Q_DECL_EQ_DELETE;
// cppcheck-suppress unsafeClassCanLeak
DRW_Variant* curr{nullptr};
};
@ -642,7 +641,7 @@ public:
}
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 {

View File

@ -221,16 +221,16 @@ std::string DRW_TextCodec::fromUtf8(const std::string &s) {
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
QString cp = QString::fromStdString(s);
cp = cp.toUpper();
QString codePage = QString::fromStdString(s);
codePage = codePage.toUpper();
QMap<QString, QStringList> codeMap = DRW_TextCodec::DXFCodePageMap();
auto i = codeMap.constBegin();
while (i != codeMap.constEnd())
{
if (i.value().contains(cp))
if (i.value().contains(codePage))
{
return i.key().toStdString();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,6 +44,7 @@ DialogLayoutScale::DialogLayoutScale(bool printTiled, QWidget *parent)
VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
// cppcheck-suppress unknownMacro
SCASSERT(bOk != nullptr)
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)
{
// cppcheck-suppress unknownMacro
SCASSERT(comboBoxTemplates != nullptr)
InitTemplates(comboBoxTemplates);

View File

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

View File

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

View File

@ -42,7 +42,6 @@ class VRawSAPoint : public QPointF
public:
Q_DECL_CONSTEXPR VRawSAPoint();
Q_DECL_CONSTEXPR VRawSAPoint(qreal xpos, qreal ypos);
// cppcheck-suppress noExplicitConstructor
Q_DECL_CONSTEXPR VRawSAPoint(QPointF p);
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)
: QPointF(p)
{}
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress passedByValue
Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p, bool loopPoint)
: QPointF(p),
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)
: QPointF(p)
{}

View File

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

View File

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

View File

@ -76,6 +76,7 @@ QString compilerString()
QLatin1String(" compatibility]");
#endif
#elif defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too
// cppcheck-suppress unassignedVariable
QString isAppleString;
#if defined(__apple_build_version__) // Apple clang has other version numbers
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
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
{
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)
{
// cppcheck-suppress indexCalled
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
{
// cppcheck-suppress indexCalled
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");
#endif
// cppcheck-suppress reademptycontainer
if (not rules.isEmpty())
{
QLoggingCategory::setFilterRules(rules);
@ -232,9 +231,7 @@ void VAbstractApplication::WinAttachConsole()
auto stdout_type = GetFileType(GetStdHandle(STD_OUTPUT_HANDLE));
if (stdout_type == FILE_TYPE_UNKNOWN && AttachConsole(ATTACH_PARENT_PROCESS))
{
// cppcheck-suppress ignoredReturnValue
freopen("CONOUT$", "w", stdout);
// cppcheck-suppress ignoredReturnValue
freopen("CONOUT$", "w", stderr);
}
}

View File

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

View File

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

View File

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

View File

@ -60,6 +60,7 @@ static inline QPaintEngine::PaintEngineFeatures svgEngineFeatures()
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wsign-conversion")
// cppcheck-suppress unknownMacro
QT_WARNING_DISABLE_INTEL(68)
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
QPointF pf[MAX_POINTS];
// cppcheck-suppress unreadVariable
bool skipFace=false;//Need skip first face
for (quint32 i = 0; i < res->num_faces; i++ )
@ -216,9 +218,9 @@ void VObjEngine::drawPath(const QPainterPath &path)
if (skipFace == false )
{
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);
qint64 sqUnited = Square(united);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,8 +31,8 @@
#include <QSharedData>
#include "../vmisc/diagnostic.h"
#include "../vmisc/defglobal.h"
#include "../vmisc/typedef.h"
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")
@ -46,7 +46,7 @@ public:
:arcId(NULL_ID)
{}
VArcRadiusData(const quint32 &arcId)
explicit VArcRadiusData(const quint32 &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)
:VCurveVariable(id, parentId)
{
// cppcheck-suppress unknownMacro
SCASSERT(baseCurve != nullptr)
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)
: VCurveVariable(id, parentId)
{
// cppcheck-suppress unknownMacro
SCASSERT(baseCurve != nullptr)
SetType(VarType::CurveCLength);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,10 +31,10 @@ VPE::QVector3DProperty::QVector3DProperty(const QString& name)
: VProperty(name, QVariant::String) // todo: QVariant::Vector3D??
{
QVariant tmpFloat(0); tmpFloat.convert(QVariant::Double);
VDoubleProperty* tmpX = new VDoubleProperty("X"); addChild(tmpX); tmpX->setUpdateBehaviour(true, false);
VDoubleProperty* tmpY = new VDoubleProperty("Y"); addChild(tmpY); tmpY->setUpdateBehaviour(true, false);
VDoubleProperty* tmpZ = new VDoubleProperty("Z"); addChild(tmpZ); tmpZ->setUpdateBehaviour(true, false);
setVector(Vector3D());
auto* tmpX = new VDoubleProperty("X"); addChild(tmpX); tmpX->setUpdateBehaviour(true, false);
auto* tmpY = new VDoubleProperty("Y"); addChild(tmpY); tmpY->setUpdateBehaviour(true, false);
auto* tmpZ = new VDoubleProperty("Z"); addChild(tmpZ); tmpZ->setUpdateBehaviour(true, false);
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())
{
QList<QUrl> tmpUrlList = data->urls();
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());
break;
}
tmpFileInfo = QFileInfo(tmpUrl->toLocalFile());
}
if (checkFileFilter(tmpFileInfo.fileName()))

View File

@ -47,7 +47,7 @@ VPE::VProperty::VProperty(VPropertyPrivate *d)
VPE::VProperty::~VProperty()
{
setParent(nullptr);
VPE::VProperty::setParent(nullptr);
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)
: QGroupBox(title, parent), d_ptr(new VPropertyFormWidgetPrivate(properties))
{
build();
VPE::VPropertyFormWidget::build();
setToolTip(description);
setWhatsThis(description);
}
@ -51,7 +51,7 @@ VPE::VPropertyFormWidget::VPropertyFormWidget(VProperty *parent_property, QWidge
if (parent_property)
{
d_ptr->Properties = parent_property->getChildren();
build();
VPE::VPropertyFormWidget::build();
setTitle(parent_property->getName());
setToolTip(parent_property->getDescription());
setWhatsThis(parent_property->getDescription());
@ -62,7 +62,7 @@ VPE::VPropertyFormWidget::VPropertyFormWidget(VPropertyFormWidgetPrivate *d_poin
const QString &title, const QString &description)
: QGroupBox(title, parent), d_ptr(d_pointer)
{
build();
VPE::VPropertyFormWidget::build();
setToolTip(description);
setWhatsThis(description);
}

View File

@ -47,14 +47,12 @@ public:
//! Constructor
VPropertyModelPrivate()
: Properties(nullptr), HeadlineProperty(QString()), HeadlineValue(QString())
{
: Properties(nullptr),
//: 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
HeadlineValue = QObject::tr("Value");
}
HeadlineValue(QObject::tr("Value"))
{}
private:
Q_DISABLE_COPY(VPropertyModelPrivate)

View File

@ -37,7 +37,7 @@ VPE::VPropertySet::VPropertySet()
VPE::VPropertySet::~VPropertySet()
{
// Delete all the properties
clear(true);
VPE::VPropertySet::clear(true);
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);
for(auto tmpProp : tmpChildrenList)
{
if (tmpProp && (tmpProp == property || hasProperty(property, tmpProp)))
{
return true;
}
}
return false;
return std::any_of(tmpChildrenList.begin(), tmpChildrenList.end(), [this, property](VProperty* tmpProp)
{return tmpProp && (tmpProp == property || hasProperty(property, tmpProp));});
}
void VPE::VPropertySet::cloneProperty(VProperty* property_to_clone, VProperty *parent_property,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -209,7 +209,8 @@ template <typename T>
inline void VAbstractTool::AddVisualization()
{
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)
scene->addItem(visual);

View File

@ -37,6 +37,7 @@ AddPatternPiece::AddPatternPiece(const QDomElement &xml, VAbstractPattern *doc,
QUndoCommand *parent)
: VUndoCommand(xml, doc, parent), namePP(namePP)
{
// cppcheck-suppress unknownMacro
SCASSERT(namePP.isEmpty() == false)
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
}
QDomElement rootElement = doc->documentElement();
const QDomElement patternPiece = doc->GetPPElement(namePP);
rootElement.removeChild(patternPiece);
const QDomElement patternPieceElement = doc->GetPPElement(namePP);
rootElement.removeChild(patternPieceElement);
emit NeedFullParsing();
}

View File

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

View File

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

View File

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

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