mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
Return a default-constructed QString instead of implicitly converting an empty string literal.
This commit is contained in:
@@ -72,7 +72,7 @@ namespace BlackMisc
|
||||
|
||||
QString CRemoteFile::getFormattedCreatedYmdhms() const
|
||||
{
|
||||
if (m_created < 1) { return ""; }
|
||||
if (m_created < 1) { return {}; }
|
||||
const QDateTime dt = QDateTime::fromMSecsSinceEpoch(m_created);
|
||||
return dt.toString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace BlackMisc
|
||||
QString CTextMessage::getRecipientCallsignOrFrequency() const
|
||||
{
|
||||
if (!m_recipientCallsign.isEmpty()) { return m_recipientCallsign.asString(); }
|
||||
if (m_frequency.isNull()) { return ""; }
|
||||
if (m_frequency.isNull()) { return {}; }
|
||||
return m_frequency.valueRoundedWithUnit(CFrequencyUnit::MHz(), 3);
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace BlackMisc
|
||||
|
||||
QString CUrl::getFullUrl(bool withQuery) const
|
||||
{
|
||||
if (m_host.isEmpty()) { return ""; }
|
||||
if (m_host.isEmpty()) { return {}; }
|
||||
|
||||
QString qn(m_host);
|
||||
if (!hasDefaultPort() && hasPort()) { qn = qn.append(":").append(QString::number(m_port)); }
|
||||
@@ -198,8 +198,8 @@ namespace BlackMisc
|
||||
{
|
||||
const QString f(this->getFileName());
|
||||
const int i = f.lastIndexOf('.');
|
||||
if (i < 0) return "";
|
||||
if (f.length() <= i + 1) return ""; // ends with "."
|
||||
if (i < 0) return {};
|
||||
if (f.length() <= i + 1) return {}; // ends with "."
|
||||
return f.mid(i + 1); // suffix without dot
|
||||
}
|
||||
|
||||
@@ -207,8 +207,8 @@ namespace BlackMisc
|
||||
{
|
||||
const QString f(this->getFileName());
|
||||
const int i = f.lastIndexOf('.');
|
||||
if (i < 0) return "";
|
||||
if (f.length() <= i + 1) return ""; // ends with "."
|
||||
if (i < 0) return {};
|
||||
if (f.length() <= i + 1) return {}; // ends with "."
|
||||
return f.mid(i); // suffix with dot
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user