Cppcheck warnings.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-08-09 14:18:49 +03:00
parent 31fa9785b9
commit 9035382238
4 changed files with 6 additions and 6 deletions

View file

@ -593,9 +593,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();
@ -853,7 +851,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
@ -917,7 +914,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))

View file

@ -464,6 +464,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()));
@ -471,6 +472,7 @@ void VDomDocument::ValidateXML(const QString &schema, const QString &fileName)
}
QFile fileSchema(schema);
// cppcheck-suppress ConfigurationNotChecked
if (fileSchema.open(QIODevice::ReadOnly) == false)
{
pattern.close();
@ -521,6 +523,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()));
@ -659,6 +662,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;
@ -792,6 +796,7 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
QTemporaryFile destFile(destination + QLatin1String(".XXXXXX"));
destFile.setAutoRemove(false);
// cppcheck-suppress ConfigurationNotChecked
if (not destFile.open())
{
error = destFile.errorString();
@ -800,6 +805,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;

View file

@ -195,7 +195,6 @@ void QxtCsvModel::setSource(const QString &filename, bool withHeader, QChar sepa
void QxtCsvModel::setSource(QIODevice *file, bool withHeader, QChar separator, QTextCodec* codec)
{
QxtCsvModelPrivate* d_ptr = &qxt_d();
// cppcheck-suppress unreadVariable
bool headerSet = !withHeader;
if (not file->isOpen())
{

View file

@ -645,7 +645,6 @@ bool VToolSplinePath::IsMovable(int index) const
const auto splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
//index == -1 - can delete, but decided to left
// cppcheck-suppress redundantCondition
if (index == -1 || index < 1 || index > splPath->CountSubSpl())
{
return false;