From 477a6ea70d0bb1b1dfe9cbd9a15b6dad0284ddeb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 21 Feb 2018 18:40:03 +0300 Subject: all another C++'11 iterators --- protocols/Tox/src/tox_accounts.cpp | 7 ++++--- protocols/Tox/src/tox_utils.cpp | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'protocols/Tox/src') diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp index 866a0dbd3b..ad948974a8 100644 --- a/protocols/Tox/src/tox_accounts.cpp +++ b/protocols/Tox/src/tox_accounts.cpp @@ -23,9 +23,10 @@ int CToxProto::UninitAccount(CToxProto *proto) CToxProto* CToxProto::GetContactAccount(MCONTACT hContact) { - for (int i = 0; i < Accounts.getCount(); i++) - if (mir_strcmpi(GetContactProto(hContact), Accounts[i]->m_szModuleName) == 0) - return Accounts[i]; + for (auto &it : Accounts) + if (mir_strcmpi(GetContactProto(hContact), it->m_szModuleName) == 0) + return it; + return nullptr; } diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index 130e08eaec..d7c2d1408b 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -150,9 +150,9 @@ INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam) return 1; CToxProto *proto = nullptr; - for (int i = 0; i < Accounts.getCount(); i++) { - if (Accounts[i]->IsOnline()) { - proto = Accounts[i]; + for (auto &it : Accounts) { + if (it->IsOnline()) { + proto = it; break; } } -- cgit v1.2.3