Return a default-constructed QString instead of implicitly converting an empty string literal.

This commit is contained in:
Mat Sutcliffe
2018-12-20 21:47:58 +00:00
parent 6c05c5249d
commit d6b5dca6b2
49 changed files with 128 additions and 127 deletions

View File

@@ -48,7 +48,7 @@ namespace BlackMisc
QString CAircraftCfgEntries::getFileDirectory() const
{
if (m_fileName.isEmpty()) { return ""; }
if (m_fileName.isEmpty()) { return {}; }
const QFileInfo fileInfo(m_fileName);
return fileInfo.absolutePath();
}
@@ -166,8 +166,8 @@ namespace BlackMisc
QString CAircraftCfgEntries::getThumbnailFileNameGuess() const
{
if (m_texture.isEmpty()) { return ""; }
if (m_fileName.isEmpty()) { return ""; }
if (m_texture.isEmpty()) { return {}; }
if (m_fileName.isEmpty()) { return {}; }
QString fn = QDir::cleanPath(this->getFileDirectory() + QDir::separator() + "texture." + m_texture + QDir::separator() + "thumbnail.jpg");
return fn;
}
@@ -175,9 +175,9 @@ namespace BlackMisc
QString CAircraftCfgEntries::getThumbnailFileNameChecked() const
{
const QString f(getThumbnailFileNameGuess());
if (f.isEmpty()) { return ""; }
if (f.isEmpty()) { return {}; }
if (QFile(f).exists()) { return f; }
return "";
return {};
}
CVariant CAircraftCfgEntries::propertyByIndex(const BlackMisc::CPropertyIndex &index) const

View File

@@ -389,7 +389,7 @@ namespace BlackMisc
{
if (qv.isNull() || !qv.isValid())
{
return ""; // normal when there is no settings value
return {}; // normal when there is no settings value
}
else if (static_cast<QMetaType::Type>(qv.type()) == QMetaType::QStringList)
{
@@ -401,15 +401,15 @@ namespace BlackMisc
return qv.toString().trimmed();
}
Q_ASSERT(false);
return "";
return {};
}
QString CAircraftCfgParser::getFixedIniLineContent(const QString &line)
{
if (line.isEmpty()) { return ""; }
if (line.isEmpty()) { return {}; }
int index = line.indexOf('=');
if (index < 0) { return ""; }
if (line.length() < index + 1) { return ""; }
if (index < 0) { return {}; }
if (line.length() < index + 1) { return {}; }
QString content(line.midRef(index + 1).trimmed().toString());

View File

@@ -93,7 +93,7 @@ namespace BlackMisc
QString fsxSimObjectsDirFromRegistryImpl()
{
const QString fsxPath = CFsCommonUtil::fsxDirFromRegistry();
if (fsxPath.isEmpty()) { return ""; }
if (fsxPath.isEmpty()) { return {}; }
return CFsCommonUtil::fsxSimObjectsDirFromSimDir(fsxPath);
}
@@ -106,7 +106,7 @@ namespace BlackMisc
QString fsxSimObjectsDirImpl()
{
QString dir(CFsCommonUtil::fsxDir());
if (dir.isEmpty()) { return ""; }
if (dir.isEmpty()) { return {}; }
return CFsCommonUtil::fsxSimObjectsDirFromSimDir(dir);
}
@@ -186,7 +186,7 @@ namespace BlackMisc
QString p3dSimObjectsDirFromRegistryImpl()
{
const QString p3dPath = CFsCommonUtil::p3dDirFromRegistry();
if (p3dPath.isEmpty()) { return ""; }
if (p3dPath.isEmpty()) { return {}; }
return CFsCommonUtil::fsxSimObjectsDirFromSimDir(p3dPath);
}
@@ -199,7 +199,7 @@ namespace BlackMisc
QString p3dSimObjectsDirImpl()
{
QString dir(CFsCommonUtil::p3dDir());
if (dir.isEmpty()) { return ""; }
if (dir.isEmpty()) { return {}; }
return CFsCommonUtil::fsxSimObjectsDirFromSimDir(dir);
}