Commit b5036ff7 authored by Marco Martin's avatar Marco Martin

Use non-const iterators

Summary:
on some GCC (here 7.5.0) it complains when one tries to reassign an
iterator that was obtained via const_find, using find() using a
mutable iterator makes it build fine

Test Plan: Builds, behavior not changed

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D28497
parent 108d5c5f
......@@ -108,8 +108,8 @@ ExtendedProcesses::ExtendedProcesses(QObject *parent)
auto userNameSensor = new ProcessSensor<QString>(
this, QStringLiteral("username"), i18n("Username"), [this](KSysGuard::Process *p) {
const K_UID uid = p->uid();
auto userIt = d->m_userCache.constFind(uid);
if (userIt == d->m_userCache.constEnd()) {
auto userIt = d->m_userCache.find(uid);
if (userIt == d->m_userCache.end()) {
userIt = d->m_userCache.insert(uid, KUser(uid));
}
return userIt->loginName();
......@@ -123,8 +123,8 @@ ExtendedProcesses::ExtendedProcesses(QObject *parent)
if (uid == 65534) { // special value meaning nobody
return false;
}
auto userIt = d->m_userCache.constFind(uid);
if (userIt == d->m_userCache.constEnd()) {
auto userIt = d->m_userCache.find(uid);
if (userIt == d->m_userCache.end()) {
userIt = d->m_userCache.insert(uid, KUser(uid));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment