summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-14 19:59:06 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-14 19:59:06 +0300
commitdad59528ccd770301b29c7db8148ff8ab8e89c92 (patch)
treeb93aa1b9149ddf20d6317d44cf924be8d0be276a /protocols
parent1a3f9ca88310cb9080a4c0073087bebc4c1e3a0a (diff)
reverse iterators for LIST<>
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/dispatch.cpp10
-rw-r--r--protocols/IcqOscarJ/src/cookies.cpp6
2 files changed, 7 insertions, 9 deletions
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp
index e1aba4e28e..be99ebf054 100644
--- a/protocols/Discord/src/dispatch.cpp
+++ b/protocols/Discord/src/dispatch.cpp
@@ -194,13 +194,11 @@ void CDiscordProto::OnCommandGuildDeleted(const JSONNode &pRoot)
if (pGuild == nullptr)
return;
- for (int i = arUsers.getCount()-1; i >= 0; i--) {
- CDiscordUser &pUser = arUsers[i];
- if (pUser.guildId == pGuild->id) {
- Chat_Terminate(m_szModuleName, pUser.wszUsername, true);
- arUsers.remove(i);
+ for (auto &it : arUsers.rev_iter())
+ if (it->guildId == pGuild->id) {
+ Chat_Terminate(m_szModuleName, it->wszUsername, true);
+ arUsers.remove(it);
}
- }
Chat_Terminate(m_szModuleName, pRoot["name"].as_mstring(), true);
diff --git a/protocols/IcqOscarJ/src/cookies.cpp b/protocols/IcqOscarJ/src/cookies.cpp
index 51004e0915..de73d58e03 100644
--- a/protocols/IcqOscarJ/src/cookies.cpp
+++ b/protocols/IcqOscarJ/src/cookies.cpp
@@ -33,9 +33,9 @@ void CIcqProto::RemoveExpiredCookies()
{
time_t tNow = time(nullptr);
- for (int i = cookies.getCount() - 1; i >= 0; i--)
- if ((cookies[i].dwTime + COOKIE_TIMEOUT) < tNow)
- cookies.remove(i);
+ for (auto &it : cookies.rev_iter())
+ if (it->dwTime + COOKIE_TIMEOUT < tNow)
+ cookies.remove(it);
}
// Generate and allocate cookie