Mercurial > hg > svcore
diff base/RecentFiles.cpp @ 928:6a94bb528e9d warnfix_no_size_t
Remove size_t's, fix compiler warnings
author | Chris Cannam |
---|---|
date | Tue, 17 Jun 2014 13:52:07 +0100 |
parents | 3b8008d09541 |
children | 452b48b29c2d |
line wrap: on
line diff
--- a/base/RecentFiles.cpp Tue Jun 03 11:05:49 2014 +0100 +++ b/base/RecentFiles.cpp Tue Jun 17 13:52:07 2014 +0100 @@ -21,7 +21,7 @@ #include <QSettings> #include <QRegExp> -RecentFiles::RecentFiles(QString settingsGroup, size_t maxCount) : +RecentFiles::RecentFiles(QString settingsGroup, int maxCount) : m_settingsGroup(settingsGroup), m_maxCount(maxCount) { @@ -40,7 +40,7 @@ QSettings settings; settings.beginGroup(m_settingsGroup); - for (size_t i = 0; i < 100; ++i) { + for (int i = 0; i < 100; ++i) { QString key = QString("recent-%1").arg(i); QString name = settings.value(key, "").toString(); if (name == "") break; @@ -57,10 +57,10 @@ QSettings settings; settings.beginGroup(m_settingsGroup); - for (size_t i = 0; i < m_maxCount; ++i) { + for (int i = 0; i < m_maxCount; ++i) { QString key = QString("recent-%1").arg(i); QString name = ""; - if (i < m_names.size()) name = m_names[i]; + if (i < (int)m_names.size()) name = m_names[i]; settings.setValue(key, name); } @@ -70,7 +70,7 @@ void RecentFiles::truncateAndWrite() { - while (m_names.size() > m_maxCount) { + while (int(m_names.size()) > m_maxCount) { m_names.pop_back(); } write(); @@ -80,8 +80,8 @@ RecentFiles::getRecent() const { std::vector<QString> names; - for (size_t i = 0; i < m_maxCount; ++i) { - if (i < m_names.size()) { + for (int i = 0; i < m_maxCount; ++i) { + if (i < (int)m_names.size()) { names.push_back(m_names[i]); } } @@ -92,7 +92,7 @@ RecentFiles::add(QString name) { bool have = false; - for (size_t i = 0; i < m_names.size(); ++i) { + for (int i = 0; i < int(m_names.size()); ++i) { if (m_names[i] == name) { have = true; break; @@ -104,7 +104,7 @@ } else { std::deque<QString> newnames; newnames.push_back(name); - for (size_t i = 0; i < m_names.size(); ++i) { + for (int i = 0; i < int(m_names.size()); ++i) { if (m_names[i] == name) continue; newnames.push_back(m_names[i]); }