[XSwiftBus] Misc. style fixes

This commit is contained in:
Klaus Basan
2020-03-18 23:10:59 +01:00
committed by Mat Sutcliffe
parent db81acf574
commit 80e97f749f
5 changed files with 22 additions and 22 deletions

View File

@@ -27,7 +27,7 @@ namespace XSwiftBus
void CConfig::parse() void CConfig::parse()
{ {
std::ifstream configFile(m_filePath); std::ifstream configFile(m_filePath);
if (! configFile.is_open()) { return; } if (!configFile.is_open()) { return; }
std::string line; std::string line;
for (int lineNo = 1; std::getline(configFile, line); ++lineNo) for (int lineNo = 1; std::getline(configFile, line); ++lineNo)
@@ -135,7 +135,6 @@ namespace XSwiftBus
case DBusSession: return "Session"; case DBusSession: return "Session";
case DBusP2P: return "P2P"; case DBusP2P: return "P2P";
} }
return {}; return {};
} }
} // ns } // ns

View File

@@ -57,11 +57,12 @@ namespace XSwiftBus
bool getTcasEnabled() const { return m_tcas; } bool getTcasEnabled() const { return m_tcas; }
private: private:
bool parseDBusMode(const std::string &value); bool parseDBusMode (const std::string &value);
bool parseDBusAddress(const std::string &value); bool parseDBusAddress(const std::string &value);
bool parseDBusPort(const std::string &value); bool parseDBusPort (const std::string &value);
bool parseDebug(const std::string &value); bool parseDebug (const std::string &value);
bool parseTcas(const std::string &value); bool parseTcas (const std::string &value);
bool writeConfigFile () const;
static std::string dbusModeToString(DBusMode mode); static std::string dbusModeToString(DBusMode mode);

View File

@@ -109,7 +109,7 @@ namespace XSwiftBus
// FIXME: make listen address configurable // FIXME: make listen address configurable
std::string listenAddress = "tcp:host=" + m_pluginConfig.getDBusAddress() + ",port=" + std::to_string(m_pluginConfig.getDBusPort()); std::string listenAddress = "tcp:host=" + m_pluginConfig.getDBusAddress() + ",port=" + std::to_string(m_pluginConfig.getDBusPort());
if (! m_dbusP2PServer->listen(listenAddress)) if (!m_dbusP2PServer->listen(listenAddress))
{ {
m_service->addTextMessage("XSwiftBus startup failed!", 255, 0, 0); m_service->addTextMessage("XSwiftBus startup failed!", 255, 0, 0);
return; return;

View File

@@ -44,7 +44,7 @@ namespace XSwiftBus
std::tuple<float, float, float, float> getFrameStats() std::tuple<float, float, float, float> getFrameStats()
{ {
if (m_total == 0) { return {}; } if (m_total < 0.001f) { return {}; } // no DIV by 0
const float fps = m_samples.size() / m_total; const float fps = m_samples.size() / m_total;
const float ratio = 1 - m_totalOverBudget / m_total; const float ratio = 1 - m_totalOverBudget / m_total;
const float miles = m_totalMetersShort / 1852.0f; const float miles = m_totalMetersShort / 1852.0f;
@@ -64,7 +64,7 @@ namespace XSwiftBus
++m_lastSampleIndex %= c_maxSampleCount; ++m_lastSampleIndex %= c_maxSampleCount;
if (m_samples.size() == c_maxSampleCount) if (m_samples.size() == c_maxSampleCount)
{ {
auto& oldSample = m_samples[m_lastSampleIndex]; auto &oldSample = m_samples[m_lastSampleIndex];
m_total -= oldSample; m_total -= oldSample;
if (oldSample > c_framePeriodBudget) if (oldSample > c_framePeriodBudget)
{ {

View File

@@ -46,7 +46,7 @@ namespace XSwiftBus
m_provider->setSettings(settings); m_provider->setSettings(settings);
} }
const CConfig& CSettingsAware::getConfig() const const CConfig &CSettingsAware::getConfig() const
{ {
return m_provider->getConfig(); return m_provider->getConfig();
} }