Cppcheck warnings.
--HG-- branch : release
This commit is contained in:
parent
ba36ab3c71
commit
dde8f9638e
|
@ -219,7 +219,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
// cppcheck-suppress uninitMemberVar
|
||||
MApplication::MApplication(int &argc, char **argv)
|
||||
:VAbstractApplication(argc, argv),
|
||||
mainWindows(),
|
||||
|
|
|
@ -587,9 +587,7 @@ QStringList VApplication::LabelLanguages()
|
|||
void VApplication::StartLogging()
|
||||
{
|
||||
CreateLogDir();
|
||||
// cppcheck-suppress leakReturnValNotUsed
|
||||
BeginLogging();
|
||||
// cppcheck-suppress leakReturnValNotUsed
|
||||
ClearOldLogs();
|
||||
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
||||
ClearOldReports();
|
||||
|
@ -847,7 +845,6 @@ void VApplication::CollectReport(const QString &reportName) const
|
|||
reportFile.remove(); // Clear after yourself
|
||||
|
||||
filename = QString("%1/reports/log-%2.log").arg(qApp->applicationDirPath()).arg(timestamp);
|
||||
// cppcheck-suppress leakReturnValNotUsed
|
||||
GatherLogs();
|
||||
QFile logFile(QString("%1/valentina.log").arg(LogDirPath()));
|
||||
logFile.copy(filename); // Collect log
|
||||
|
@ -911,7 +908,6 @@ void VApplication::SendReport(const QString &reportName) const
|
|||
content.append(QString("\r\n-------------------------------\r\n"));
|
||||
content.append(QString("Log:")+"\r\n");
|
||||
|
||||
// cppcheck-suppress leakReturnValNotUsed
|
||||
GatherLogs();
|
||||
QFile logFile(QString("%1/valentina.log").arg(LogDirPath()));
|
||||
if (logFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
|
|
|
@ -379,7 +379,7 @@ quint32 VDomDocument::GetParametrId(const QDomElement &domElement) const
|
|||
try
|
||||
{
|
||||
id = GetParametrUInt(domElement, VDomDocument::AttrId, NULL_ID_STR);
|
||||
if (id <= 0)
|
||||
if (id == 0)
|
||||
{
|
||||
throw VExceptionWrongId(message, domElement);
|
||||
}
|
||||
|
@ -467,6 +467,7 @@ void VDomDocument::ValidateXML(const QString &schema, const QString &fileName)
|
|||
{
|
||||
qCDebug(vXML, "Validation xml file %s.", qUtf8Printable(fileName));
|
||||
QFile pattern(fileName);
|
||||
// cppcheck-suppress ConfigurationNotChecked
|
||||
if (pattern.open(QIODevice::ReadOnly) == false)
|
||||
{
|
||||
const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName).arg(pattern.errorString()));
|
||||
|
@ -474,6 +475,7 @@ void VDomDocument::ValidateXML(const QString &schema, const QString &fileName)
|
|||
}
|
||||
|
||||
QFile fileSchema(schema);
|
||||
// cppcheck-suppress ConfigurationNotChecked
|
||||
if (fileSchema.open(QIODevice::ReadOnly) == false)
|
||||
{
|
||||
pattern.close();
|
||||
|
@ -524,6 +526,7 @@ void VDomDocument::ValidateXML(const QString &schema, const QString &fileName)
|
|||
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).arg(file.errorString()));
|
||||
|
@ -662,6 +665,7 @@ bool VDomDocument::SaveDocument(const QString &fileName, QString &error) const
|
|||
}
|
||||
bool success = false;
|
||||
QSaveFile file(fileName);
|
||||
// cppcheck-suppress ConfigurationNotChecked
|
||||
if (file.open(QIODevice::WriteOnly))
|
||||
{
|
||||
const int indent = 4;
|
||||
|
@ -790,6 +794,7 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
|
|||
|
||||
QTemporaryFile destFile(destination + QLatin1Literal(".XXXXXX"));
|
||||
destFile.setAutoRemove(false);
|
||||
// cppcheck-suppress ConfigurationNotChecked
|
||||
if (not destFile.open())
|
||||
{
|
||||
error = destFile.errorString();
|
||||
|
@ -798,6 +803,7 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
|
|||
else
|
||||
{
|
||||
QFile sourceFile(source);
|
||||
// cppcheck-suppress ConfigurationNotChecked
|
||||
if (sourceFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
result = true;
|
||||
|
|
|
@ -50,7 +50,7 @@ class QMUPARSERSHARED_EXPORT QmuParserTester : public QObject // final
|
|||
public:
|
||||
typedef int ( QmuParserTester::*testfun_type ) ();
|
||||
|
||||
QmuParserTester(QObject *parent = nullptr);
|
||||
explicit QmuParserTester(QObject *parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void Run();
|
||||
|
|
|
@ -172,6 +172,7 @@ bool DL_Dxf::in(std::stringstream& stream,
|
|||
*/
|
||||
bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface)
|
||||
{
|
||||
// cppcheck-suppress variableScope
|
||||
static int line = 1;
|
||||
|
||||
// Read one group of the DXF file and strip the lines:
|
||||
|
@ -196,6 +197,7 @@ bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface)
|
|||
bool DL_Dxf::readDxfGroups(std::stringstream& stream,
|
||||
DL_CreationInterface* creationInterface)
|
||||
{
|
||||
// cppcheck-suppress variableScope
|
||||
static int line = 1;
|
||||
|
||||
// Read one group of the DXF file and chop the lines:
|
||||
|
@ -2272,7 +2274,7 @@ bool DL_Dxf::handleHatchData(DL_CreationInterface* creationInterface)
|
|||
hatchEdge.defined = true;
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2581,7 +2583,7 @@ void DL_Dxf::writeHeader(DL_WriterA& dw) const
|
|||
break;
|
||||
case DL_Codes::AC1015:
|
||||
dw.dxfString(1, "AC1015");
|
||||
break;
|
||||
break;
|
||||
case DL_Codes::AC1009_MIN:
|
||||
// minimalistic DXF version is unidentified in file:
|
||||
break;
|
||||
|
@ -4065,7 +4067,7 @@ void DL_Dxf::writeImageDef(DL_WriterA& dw,
|
|||
dw.dxfString(0, "IMAGEDEF");
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfHex(5, handle);
|
||||
dw.dxfHex(5, handle);
|
||||
}
|
||||
|
||||
if (version==DL_VERSION_2000) //-V581
|
||||
|
|
|
@ -53,8 +53,8 @@ VArc::VArc ()
|
|||
* @param f1 start angle (degree).
|
||||
* @param f2 end angle (degree).
|
||||
*/
|
||||
VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2,
|
||||
QString formulaF2, quint32 idObject, Draw mode)
|
||||
VArc::VArc (const VPointF ¢er, qreal radius, const QString &formulaRadius, qreal f1, const QString &formulaF1,
|
||||
qreal f2, const QString &formulaF2, quint32 idObject, Draw mode)
|
||||
: VAbstractCurve(GOType::Arc, idObject, mode),
|
||||
d (new VArcData(center, radius, formulaRadius, f1, formulaF1, f2, formulaF2))
|
||||
{
|
||||
|
@ -62,15 +62,15 @@ VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QStri
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VArc::VArc(VPointF center, qreal radius, qreal f1, qreal f2)
|
||||
VArc::VArc(const VPointF ¢er, qreal radius, qreal f1, qreal f2)
|
||||
: VAbstractCurve(GOType::Arc, NULL_ID, Draw::Calculation), d (new VArcData(center, radius, f1, f2))
|
||||
{
|
||||
ArcName();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VArc::VArc(qreal length, QString formulaLength, VPointF center, qreal radius, QString formulaRadius, qreal f1,
|
||||
QString formulaF1, quint32 idObject, Draw mode)
|
||||
VArc::VArc(qreal length, const QString &formulaLength, const VPointF ¢er, qreal radius,
|
||||
const QString &formulaRadius, qreal f1, const QString &formulaF1, quint32 idObject, Draw mode)
|
||||
: VAbstractCurve(GOType::Arc, idObject, mode),
|
||||
d (new VArcData(formulaLength, center, radius, formulaRadius, f1, formulaF1))
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ VArc::VArc(qreal length, QString formulaLength, VPointF center, qreal radius, QS
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VArc::VArc(qreal length, VPointF center, qreal radius, qreal f1)
|
||||
VArc::VArc(qreal length, const VPointF ¢er, qreal radius, qreal f1)
|
||||
: VAbstractCurve(GOType::Arc, NULL_ID, Draw::Calculation), d (new VArcData(center, radius, f1))
|
||||
{
|
||||
ArcName();
|
||||
|
|
|
@ -44,12 +44,12 @@ class VArc: public VAbstractCurve
|
|||
Q_DECLARE_TR_FUNCTIONS(VArc)
|
||||
public:
|
||||
VArc ();
|
||||
VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2,
|
||||
QString formulaF2, quint32 idObject = 0, Draw mode = Draw::Calculation);
|
||||
VArc (VPointF center, qreal radius, qreal f1, qreal f2);
|
||||
VArc (qreal length, QString formulaLength, VPointF center, qreal radius, QString formulaRadius, qreal f1,
|
||||
QString formulaF1, quint32 idObject = 0, Draw mode = Draw::Calculation);
|
||||
VArc (qreal length, VPointF center, qreal radius, qreal f1);
|
||||
VArc (const VPointF ¢er, qreal radius, const QString &formulaRadius, qreal f1, const QString &formulaF1,
|
||||
qreal f2, const QString &formulaF2, quint32 idObject = 0, Draw mode = Draw::Calculation);
|
||||
VArc (const VPointF ¢er, qreal radius, qreal f1, qreal f2);
|
||||
VArc (qreal length, const QString &formulaLength, const VPointF ¢er, qreal radius, const QString &formulaRadius,
|
||||
qreal f1, const QString &formulaF1, quint32 idObject = 0, Draw mode = Draw::Calculation);
|
||||
VArc (qreal length, const VPointF ¢er, qreal radius, qreal f1);
|
||||
VArc(const VArc &arc);
|
||||
VArc& operator= (const VArc &arc);
|
||||
virtual ~VArc() Q_DECL_OVERRIDE;
|
||||
|
|
|
@ -47,23 +47,24 @@ public:
|
|||
center(VPointF()), isFlipped(false), formulaLength()
|
||||
{}
|
||||
|
||||
VArcData (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2,
|
||||
QString formulaF2)
|
||||
VArcData (const VPointF ¢er, qreal radius,const QString &formulaRadius, qreal f1, const QString &formulaF1,
|
||||
qreal f2, const QString &formulaF2)
|
||||
: f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius),
|
||||
center(center), isFlipped(false), formulaLength()
|
||||
{}
|
||||
|
||||
VArcData(VPointF center, qreal radius, qreal f1, qreal f2)
|
||||
VArcData(const VPointF ¢er, qreal radius, qreal f1, qreal f2)
|
||||
: f1(f1), formulaF1(QString("%1").arg(f1)), f2(f2), formulaF2(QString("%1").arg(f2)), radius(radius),
|
||||
formulaRadius(QString("%1").arg(radius)), center(center), isFlipped(false), formulaLength()
|
||||
{}
|
||||
|
||||
VArcData (QString formulaLength, VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1 )
|
||||
VArcData (const QString &formulaLength, const VPointF ¢er, qreal radius, const QString &formulaRadius, qreal f1,
|
||||
QString formulaF1 )
|
||||
: f1(f1), formulaF1(formulaF1), f2(0), formulaF2("0"), radius(radius), formulaRadius(formulaRadius),
|
||||
center(center), isFlipped(false), formulaLength(formulaLength)
|
||||
{}
|
||||
|
||||
VArcData(VPointF center, qreal radius, qreal f1)
|
||||
VArcData(const VPointF ¢er, qreal radius, qreal f1)
|
||||
: f1(f1), formulaF1(QString("%1").arg(f1)), f2(0), formulaF2("0"), radius(radius),
|
||||
formulaRadius(QString("%1").arg(radius)), center(center), isFlipped(false), formulaLength()
|
||||
{}
|
||||
|
|
|
@ -60,8 +60,8 @@ VSpline::VSpline ( const VSpline & spline )
|
|||
* @param kAsm1 coefficient of length first control line.
|
||||
* @param kAsm2 coefficient of length second control line.
|
||||
*/
|
||||
VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve,
|
||||
quint32 idObject, Draw mode)
|
||||
VSpline::VSpline (const VPointF &p1, const VPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2,
|
||||
qreal kCurve, quint32 idObject, Draw mode)
|
||||
:VAbstractCurve(GOType::Spline, idObject, mode), d(new VSplineData(p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve))
|
||||
{
|
||||
CreateName();
|
||||
|
@ -75,7 +75,8 @@ VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm
|
|||
* @param p3 second control point.
|
||||
* @param p4 second point spline.
|
||||
*/
|
||||
VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject, Draw mode)
|
||||
VSpline::VSpline (const VPointF &p1, const QPointF &p2, const QPointF &p3, const VPointF &p4, qreal kCurve,
|
||||
quint32 idObject, Draw mode)
|
||||
:VAbstractCurve(GOType::Spline, idObject, mode), d(new VSplineData(p1, p2, p3, p4, kCurve))
|
||||
{
|
||||
CreateName();
|
||||
|
|
|
@ -47,10 +47,10 @@ class VSpline :public VAbstractCurve
|
|||
public:
|
||||
VSpline();
|
||||
VSpline (const VSpline &spline );
|
||||
VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve,
|
||||
VSpline (const VPointF &p1, const VPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve,
|
||||
quint32 idObject = 0, Draw mode = Draw::Calculation);
|
||||
VSpline (const VPointF &p1, const QPointF &p2, const QPointF &p3, const VPointF &p4, qreal kCurve,
|
||||
quint32 idObject = 0, Draw mode = Draw::Calculation);
|
||||
VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject = 0,
|
||||
Draw mode = Draw::Calculation);
|
||||
virtual ~VSpline() Q_DECL_OVERRIDE;
|
||||
VSpline &operator=(const VSpline &spl);
|
||||
VPointF GetP1 () const;
|
||||
|
|
|
@ -51,7 +51,8 @@ public:
|
|||
angle2(spline.angle2), kAsm1(spline.kAsm1), kAsm2(spline.kAsm2), kCurve(spline.kCurve)
|
||||
{}
|
||||
|
||||
VSplineData (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve)
|
||||
VSplineData (const VPointF &p1, const VPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2,
|
||||
qreal kCurve)
|
||||
:p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2),
|
||||
kCurve(kCurve)
|
||||
{
|
||||
|
@ -68,7 +69,7 @@ public:
|
|||
this->p3 = p4p3.p2();
|
||||
}
|
||||
|
||||
VSplineData (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve)
|
||||
VSplineData (const VPointF &p1, const QPointF &p2, const QPointF &p3, const VPointF &p4, qreal kCurve)
|
||||
:p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1)
|
||||
{
|
||||
this->angle1 = QLineF ( this->p1.toQPointF(), this->p2 ).angle();
|
||||
|
|
|
@ -44,13 +44,13 @@ QString compilerString()
|
|||
#if defined(Q_CC_INTEL) // must be before GNU, Clang and MSVC because ICC/ICL claim to be them
|
||||
QString iccCompact;
|
||||
#ifdef __INTEL_CLANG_COMPILER
|
||||
iccCompact = QLatin1Literal("Clang");
|
||||
iccCompact = QLatin1String("Clang");
|
||||
#elif defined(__INTEL_MS_COMPAT_LEVEL)
|
||||
iccCompact = QLatin1Literal("Microsoft");
|
||||
iccCompact = QLatin1String("Microsoft");
|
||||
#elif defined(__GNUC__)
|
||||
iccCompact = QLatin1Literal("GCC");
|
||||
iccCompact = QLatin1String("GCC");
|
||||
#else
|
||||
iccCompact = QLatin1Literal("no");
|
||||
iccCompact = QLatin1String("no");
|
||||
#endif
|
||||
QString iccVersion;
|
||||
if (__INTEL_COMPILER >= 1300)
|
||||
|
@ -88,8 +88,9 @@ QString compilerString()
|
|||
{
|
||||
return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
|
||||
}
|
||||
#else
|
||||
return QStringLiteral("<unknown compiler>");
|
||||
#endif
|
||||
return QLatin1String("<unknown compiler>");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -134,6 +134,7 @@ static point2d_t* point_alloc()
|
|||
|
||||
p = (point2d_t*)malloc(sizeof(point2d_t));
|
||||
assert( p != NULL );
|
||||
// cppcheck-suppress memsetClassFloat
|
||||
memset(p, 0, sizeof(point2d_t));
|
||||
|
||||
return p;
|
||||
|
|
Loading…
Reference in New Issue
Block a user