forked from qt-creator/qt-creator
Utils: Fix clazy "Mixing iterators with const_iterators" warnings
Change-Id: Iab29d57459713e107d7e74908df347955b9f50a0 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -2255,12 +2255,12 @@ BaseAspect *AspectContainer::aspect(Id id) const
|
||||
|
||||
AspectContainer::const_iterator AspectContainer::begin() const
|
||||
{
|
||||
return d->m_items.begin();
|
||||
return d->m_items.cbegin();
|
||||
}
|
||||
|
||||
AspectContainer::const_iterator AspectContainer::end() const
|
||||
{
|
||||
return d->m_items.end();
|
||||
return d->m_items.cend();
|
||||
}
|
||||
|
||||
const QList<BaseAspect *> &AspectContainer::aspects() const
|
||||
|
@@ -111,7 +111,6 @@ bool WatchEntry::trigger(const QString &fileName)
|
||||
}
|
||||
|
||||
using WatchEntryMap = QHash<QString, WatchEntry>;
|
||||
using WatchEntryMapIterator = WatchEntryMap::iterator;
|
||||
|
||||
class FileSystemWatcherPrivate
|
||||
{
|
||||
@@ -300,8 +299,8 @@ void FileSystemWatcher::removeFiles(const QStringList &files)
|
||||
qDebug() << this << d->m_id << "removeFiles " << files;
|
||||
QStringList toRemove;
|
||||
for (const QString &file : files) {
|
||||
WatchEntryMapIterator it = d->m_files.find(file);
|
||||
if (it == d->m_files.end()) {
|
||||
const auto it = d->m_files.constFind(file);
|
||||
if (it == d->m_files.constEnd()) {
|
||||
qWarning("FileSystemWatcher: File %s is not watched.", qPrintable(file));
|
||||
continue;
|
||||
}
|
||||
@@ -392,8 +391,8 @@ void FileSystemWatcher::removeDirectories(const QStringList &directories)
|
||||
|
||||
QStringList toRemove;
|
||||
for (const QString &directory : directories) {
|
||||
WatchEntryMapIterator it = d->m_directories.find(directory);
|
||||
if (it == d->m_directories.end()) {
|
||||
const auto it = d->m_directories.constFind(directory);
|
||||
if (it == d->m_directories.constEnd()) {
|
||||
qWarning("FileSystemWatcher: Directory %s is not watched.", qPrintable(directory));
|
||||
continue;
|
||||
}
|
||||
@@ -416,7 +415,7 @@ QStringList FileSystemWatcher::directories() const
|
||||
|
||||
void FileSystemWatcher::slotFileChanged(const QString &path)
|
||||
{
|
||||
const WatchEntryMapIterator it = d->m_files.find(path);
|
||||
const auto it = d->m_files.find(path);
|
||||
if (it != d->m_files.end() && it.value().trigger(path)) {
|
||||
if (debug)
|
||||
qDebug() << this << "triggers on file " << path
|
||||
@@ -428,7 +427,7 @@ void FileSystemWatcher::slotFileChanged(const QString &path)
|
||||
|
||||
void FileSystemWatcher::slotDirectoryChanged(const QString &path)
|
||||
{
|
||||
const WatchEntryMapIterator it = d->m_directories.find(path);
|
||||
const auto it = d->m_directories.find(path);
|
||||
if (it != d->m_directories.end() && it.value().trigger(path)) {
|
||||
if (debug)
|
||||
qDebug() << this << "triggers on dir " << path
|
||||
|
@@ -534,8 +534,8 @@ void LauncherSocket::unregisterHandle(quintptr token)
|
||||
{
|
||||
QTC_ASSERT(!isCalledFromLaunchersThread(), return);
|
||||
QMutexLocker locker(&m_mutex);
|
||||
auto it = m_handles.find(token);
|
||||
if (it == m_handles.end())
|
||||
auto it = m_handles.constFind(token);
|
||||
if (it == m_handles.constEnd())
|
||||
return; // TODO: issue a warning
|
||||
|
||||
LauncherHandle *launcherHandle = it.value();
|
||||
|
@@ -388,8 +388,8 @@ QString VersionUpgrader::backupExtension() const
|
||||
QVariantMap VersionUpgrader::renameKeys(const QList<Change> &changes, QVariantMap map) const
|
||||
{
|
||||
for (const Change &change : changes) {
|
||||
QVariantMap::iterator oldSetting = map.find(change.first);
|
||||
if (oldSetting != map.end()) {
|
||||
const auto oldSetting = map.constFind(change.first);
|
||||
if (oldSetting != map.constEnd()) {
|
||||
map.insert(change.second, oldSetting.value());
|
||||
map.erase(oldSetting);
|
||||
}
|
||||
|
@@ -657,11 +657,11 @@ void TreeItem::insertChild(int pos, TreeItem *item)
|
||||
m_model->beginInsertRows(idx, pos, pos);
|
||||
item->m_parent = this;
|
||||
item->propagateModel(m_model);
|
||||
m_children.insert(m_children.begin() + pos, item);
|
||||
m_children.insert(m_children.cbegin() + pos, item);
|
||||
m_model->endInsertRows();
|
||||
} else {
|
||||
item->m_parent = this;
|
||||
m_children.insert(m_children.begin() + pos, item);
|
||||
m_children.insert(m_children.cbegin() + pos, item);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -724,8 +724,8 @@ void WizardProgress::removeItem(WizardProgressItem *item)
|
||||
{
|
||||
Q_D(WizardProgress);
|
||||
|
||||
QMap<WizardProgressItem *, WizardProgressItem *>::iterator it = d->m_itemToItem.find(item);
|
||||
if (it == d->m_itemToItem.end()) {
|
||||
const auto it = d->m_itemToItem.constFind(item);
|
||||
if (it == d->m_itemToItem.constEnd()) {
|
||||
qWarning("WizardProgress::removePage: Item is not a part of the wizard");
|
||||
return;
|
||||
}
|
||||
@@ -765,8 +765,8 @@ void WizardProgress::removePage(int pageId)
|
||||
{
|
||||
Q_D(WizardProgress);
|
||||
|
||||
QMap<int, WizardProgressItem *>::iterator it = d->m_pageToItem.find(pageId);
|
||||
if (it == d->m_pageToItem.end()) {
|
||||
const auto it = d->m_pageToItem.constFind(pageId);
|
||||
if (it == d->m_pageToItem.constEnd()) {
|
||||
qWarning("WizardProgress::removePage: page is not a part of the wizard");
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user