From e8f69d4e566a3e73ff656beebcae9916e9148589 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 21 Feb 2018 18:36:45 +0300 Subject: MSN: C++'11 iterators --- protocols/MSN/src/msn_lists.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'protocols/MSN/src/msn_lists.cpp') diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index f0773df159..0953685dde 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -59,9 +59,9 @@ MsnContact* CMsnProto::Lists_Get(MCONTACT hContact) { mir_cslock lck(m_csLists); - for (int i = 0; i < m_arContacts.getCount(); ++i) - if (m_arContacts[i].hContact == hContact) - return &m_arContacts[i]; + for (auto &it : m_arContacts) + if (it->hContact == hContact) + return it; return nullptr; } @@ -346,17 +346,16 @@ static void AddPrivacyListEntries(HWND hwndList, CMsnProto *proto) } // Add new info - for (int i = 0; i < proto->m_arContacts.getCount(); ++i) { - MsnContact &cont = proto->m_arContacts[i]; - if (!(cont.list & (LIST_FL | LIST_LL))) { - cii.pszText = (wchar_t*)cont.email; + for (auto &cont : proto->m_arContacts) { + if (!(cont->list & (LIST_FL | LIST_LL))) { + cii.pszText = (wchar_t*)cont->email; hItem = (HANDLE)SendMessage(hwndList, CLM_ADDINFOITEMA, 0, (LPARAM)&cii); - SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, (cont.list & LIST_LL) ? 1 : 0)); - SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(1, (cont.list & LIST_FL) ? 2 : 0)); - SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(2, (cont.list & LIST_AL) ? 3 : 0)); - SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(3, (cont.list & LIST_BL) ? 4 : 0)); - SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(4, (cont.list & LIST_RL) ? 5 : 0)); + SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, (cont->list & LIST_LL) ? 1 : 0)); + SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(1, (cont->list & LIST_FL) ? 2 : 0)); + SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(2, (cont->list & LIST_AL) ? 3 : 0)); + SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(3, (cont->list & LIST_BL) ? 4 : 0)); + SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(4, (cont->list & LIST_RL) ? 5 : 0)); } } } -- cgit v1.2.3