refs #937 Resolved clazy warnings: miscellaneous.

This commit is contained in:
Mathew Sutcliffe
2017-04-17 00:16:12 +01:00
parent 2134b4e874
commit e3fe8ec39f
24 changed files with 89 additions and 65 deletions

View File

@@ -30,6 +30,7 @@ namespace BlackMisc
QStringList CApplicationInfoList::processNames() const
{
QStringList names;
names.reserve(size());
for (const CApplicationInfo &info : *this)
{
names.append(info.processInfo().processName());

View File

@@ -97,7 +97,7 @@ namespace BlackMisc
//! Elevation
//! \sa setGeodeticHeight
void setElevation(const BlackMisc::Aviation::CAltitude &elevation) { return this->m_position.setGeodeticHeight(elevation); }
void setElevation(const BlackMisc::Aviation::CAltitude &elevation) { this->m_position.setGeodeticHeight(elevation); }
//! Is the airport still active?
bool isOperating() const { return m_operating; }

View File

@@ -181,7 +181,7 @@ namespace BlackMisc
this->m_telephonyDesignator = variant.toQString();
break;
default:
return CValueObject::setPropertyByIndex(index, variant);
CValueObject::setPropertyByIndex(index, variant);
}
}

View File

@@ -40,6 +40,7 @@ namespace BlackMisc
{
QList<CFrequency> f;
if (!CSelcal::isValidCode(this->m_code)) return f;
f.reserve(this->m_code.length());
for (int pos = 0; pos < this->m_code.length(); pos++)
{
f.append(CSelcal::audioFrequencyEquivalent(this->m_code.at(pos)));

View File

@@ -107,9 +107,14 @@ namespace BlackMisc
this->setEntity(static_cast<CEntityFlags::Entity>(variant.toInt()));
break;
default:
return (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) ?
IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant) :
CValueObject::setPropertyByIndex(index, variant);
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index))
{
IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant);
}
else
{
CValueObject::setPropertyByIndex(index, variant);
}
break;
}
}

View File

@@ -39,7 +39,7 @@ namespace BlackMisc
QStringList list;
for (const auto scope : BlackMisc::as_const(jsonStack()))
{
list.push_back(scope->m_string ? *scope->m_string : scope->m_latin1);
list.push_back(scope->m_string ? *scope->m_string : scope->m_latin1); // clazy:exclude=reserve-candidates
if (scope->m_index >= 0) { list.back() += "[" % QString::number(scope->m_index) % "]"; }
}
return list.isEmpty() ? QStringLiteral("<document root>") : list.join('.');

View File

@@ -46,6 +46,7 @@ namespace BlackMisc
QString CRoleList::namesAsString(const QString &separator) const
{
QStringList rolesString;
rolesString.reserve(size());
for (const CRole &role : (*this))
{
rolesString.append(role.getName());

View File

@@ -605,6 +605,7 @@ namespace BlackMisc
QStringList CAircraftModelList::toCompleterStrings(bool sorted) const
{
QStringList c;
c.reserve(size());
for (const CAircraftModel &model : *this)
{
c.append(model.getModelString());

View File

@@ -51,6 +51,7 @@ namespace BlackMisc
QStringList CVPilotModelRuleSet::toUpper(const QStringList &stringList)
{
QStringList upper;
upper.reserve(stringList.size());
for (const QString &s : stringList)
{
upper.append(s.toUpper());
@@ -61,6 +62,7 @@ namespace BlackMisc
QStringList CVPilotModelRuleSet::getSortedModelNames() const
{
QStringList ms;
ms.reserve(size());
for (const CVPilotModelRule &rule : (*this))
{
ms.append(rule.getModelName());

View File

@@ -103,7 +103,7 @@ namespace BlackMisc
void CRemoteAircraftAware::updateMarkAllAsNotRendered()
{
Q_ASSERT_X(this->m_remoteAircraftProvider, Q_FUNC_INFO, "No object available");
return this->m_remoteAircraftProvider->updateMarkAllAsNotRendered();
this->m_remoteAircraftProvider->updateMarkAllAsNotRendered();
}
bool CRemoteAircraftAware::isRemoteAircraftSupportingParts(const CCallsign &callsign) const

View File

@@ -44,7 +44,7 @@ namespace BlackMisc
while (!ts.atEnd())
{
QString pathToCheck = ts.readLine();
if (QFileInfo(pathToCheck).exists()) { lastLine = pathToCheck; }
if (QFileInfo::exists(pathToCheck)) { lastLine = pathToCheck; }
}
return lastLine;
}

View File

@@ -15,6 +15,7 @@ namespace BlackMisc
{
CTestBase::CTestBase(int argc, const char *const *argv)
{
m_arguments.reserve(argc);
for (int i = 0; i < argc; ++i)
{
m_arguments.append(argv[i]);

View File

@@ -344,6 +344,7 @@ namespace BlackMisc
{
if (m_verbose) out() << "Pid: " << CTestService::getPid() << " getObjectPaths" << endl;
QList<QDBusObjectPath> paths;
paths.reserve(n);
for (int i = 0; i < n; i++)
{
paths.append(QDBusObjectPath(ObjectPath()));

View File

@@ -20,7 +20,7 @@ namespace BlackMisc
const BlackMisc::CSlot<void(const BlackMisc::Weather::CWeatherGrid &)> &callback)
{
Q_ASSERT_X(this->m_weatherGridProvider, Q_FUNC_INFO, "No object available");
return this->m_weatherGridProvider->requestWeatherGrid(weatherGrid, callback);
this->m_weatherGridProvider->requestWeatherGrid(weatherGrid, callback);
}
} // namespace