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