diff options
author | RJ Skerry-Ryan <rryan@mixxx.org> | 2018-10-27 18:35:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-27 18:35:27 -0700 |
commit | 3da63b2c0e077c182c38dcebdfcbad3366a74a37 (patch) | |
tree | a88023e01ed29c0258fb4464feb6d506a91b5b92 /src/util | |
parent | 59798c474649d5d902f166dbc376984dd9c5a1f7 (diff) | |
parent | 46c79af82eb07b0c6d39a54b8d6f63595c3498bf (diff) |
Merge pull request #1869 from rryan/clazy
Fix some issues identified by clazy.
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/logging.cpp | 2 | ||||
-rw-r--r-- | src/util/stat.cpp | 4 | ||||
-rw-r--r-- | src/util/statmodel.cpp | 5 | ||||
-rw-r--r-- | src/util/statsmanager.cpp | 17 |
4 files changed, 13 insertions, 15 deletions
diff --git a/src/util/logging.cpp b/src/util/logging.cpp index 6e66d709ba..f7e04b361e 100644 --- a/src/util/logging.cpp +++ b/src/util/logging.cpp @@ -210,7 +210,7 @@ void Logging::initialize(const QDir& settingsDir, QString olderlogname = settingsDir.filePath(QString("mixxx.log.%1").arg(i + 1)); // This should only happen with number 10 - if (QFileInfo(olderlogname).exists()) { + if (QFileInfo::exists(olderlogname)) { QFile::remove(olderlogname); } if (!QFile::rename(logFileName, olderlogname)) { diff --git a/src/util/stat.cpp b/src/util/stat.cpp index 503398ff1c..4ac2284c47 100644 --- a/src/util/stat.cpp +++ b/src/util/stat.cpp @@ -124,8 +124,8 @@ QDebug operator<<(QDebug dbg, const Stat &stat) { if (stat.m_compute & Stat::HISTOGRAM) { QStringList histogram; - for (QMap<double, double>::const_iterator it = stat.m_histogram.begin(); - it != stat.m_histogram.end(); ++it) { + for (auto it = stat.m_histogram.constBegin(); + it != stat.m_histogram.constEnd(); ++it) { histogram << QString::number(it.key()) + stat.valueUnits() + ":" + QString::number(it.value()); } diff --git a/src/util/statmodel.cpp b/src/util/statmodel.cpp index a25ba153a1..cc1219540e 100644 --- a/src/util/statmodel.cpp +++ b/src/util/statmodel.cpp @@ -22,8 +22,8 @@ StatModel::~StatModel() { } void StatModel::statUpdated(const Stat& stat) { - QHash<QString, int>::const_iterator it = m_statNameToRow.find(stat.m_tag); - if (it != m_statNameToRow.end()) { + auto it = m_statNameToRow.constFind(stat.m_tag); + if (it != m_statNameToRow.constEnd()) { int row = it.value(); m_stats[row] = stat; QModelIndex left = index(row, 0); @@ -67,7 +67,6 @@ QVariant StatModel::data(const QModelIndex& index, } const Stat& stat = m_stats.at(row); - QString value; switch (column) { case STAT_COLUMN_NAME: return stat.m_tag; diff --git a/src/util/statsmanager.cpp b/src/util/statsmanager.cpp index ffabc76b2d..f766a95a78 100644 --- a/src/util/statsmanager.cpp +++ b/src/util/statsmanager.cpp @@ -45,8 +45,8 @@ StatsManager::~StatsManager() { qDebug() << "====================================="; qDebug() << "ALL STATS"; qDebug() << "====================================="; - for (QMap<QString, Stat>::const_iterator it = m_stats.begin(); - it != m_stats.end(); ++it) { + for (auto it = m_stats.constBegin(); + it != m_stats.constEnd(); ++it) { qDebug() << it.value(); } @@ -54,8 +54,8 @@ StatsManager::~StatsManager() { qDebug() << "====================================="; qDebug() << "BASE STATS"; qDebug() << "====================================="; - for (QMap<QString, Stat>::const_iterator it = m_baseStats.begin(); - it != m_baseStats.end(); ++it) { + for (auto it = m_baseStats.constBegin(); + it != m_baseStats.constEnd(); ++it) { qDebug() << it.value(); } } @@ -64,8 +64,8 @@ StatsManager::~StatsManager() { qDebug() << "====================================="; qDebug() << "EXPERIMENT STATS"; qDebug() << "====================================="; - for (QMap<QString, Stat>::const_iterator it = m_experimentStats.begin(); - it != m_experimentStats.end(); ++it) { + for (auto it = m_experimentStats.constBegin(); + it != m_experimentStats.constEnd(); ++it) { qDebug() << it.value(); } } @@ -122,7 +122,6 @@ void StatsManager::writeTimeline(const QString& filename) { QMap<QString, qint64> startTimes; QMap<QString, qint64> endTimes; - QMap<QString, Stat> tagStats; QTextStream out(&timeline); foreach (const Event& event, m_events) { @@ -250,8 +249,8 @@ void StatsManager::run() { m_statsPipeLock.unlock(); if (load_atomic(m_emitAllStats) == 1) { - for (QMap<QString, Stat>::const_iterator it = m_stats.begin(); - it != m_stats.end(); ++it) { + for (auto it = m_stats.constBegin(); + it != m_stats.constEnd(); ++it) { emit(statUpdated(it.value())); } m_emitAllStats = 0; |