summaryrefslogtreecommitdiff
path: root/plugins/QuickContacts
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-16 12:09:30 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-16 12:09:38 +0300
commita7e5e613f86963c8bf82248ab044e0ea36e42fbc (patch)
tree39e0e6b3ab4bcb55255302d3d1e989b31247bf7b /plugins/QuickContacts
parentecbca42677af470d672e66d3f6950af208f8f212 (diff)
LIST<>::indexOf(T**) - fast index calculation for direct iterators
Diffstat (limited to 'plugins/QuickContacts')
-rw-r--r--plugins/QuickContacts/src/quickcontacts.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp
index d0c720b2e7..9f864e2bc7 100644
--- a/plugins/QuickContacts/src/quickcontacts.cpp
+++ b/plugins/QuickContacts/src/quickcontacts.cpp
@@ -404,12 +404,8 @@ void LoadContacts(HWND hwndDlg, BOOL show_all)
SortArray();
SendDlgItemMessage(hwndDlg, IDC_USERNAME, CB_RESETCONTENT, 0, 0);
- for (int loop = 0; loop < contacts.getCount(); loop++) {
- SendDlgItemMessage(hwndDlg, IDC_USERNAME, CB_SETITEMDATA,
- (WPARAM)SendDlgItemMessage(hwndDlg, IDC_USERNAME,
- CB_ADDSTRING, 0, (LPARAM)GetListName(contacts[loop])),
- (LPARAM)loop);
- }
+ for (int loop = 0; loop < contacts.getCount(); loop++)
+ SendDlgItemMessage(hwndDlg, IDC_USERNAME, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_USERNAME, CB_ADDSTRING, 0, (LPARAM)GetListName(contacts[loop])), loop);
}
@@ -511,9 +507,9 @@ MCONTACT GetSelectedContact(HWND hwndDlg)
// get array position from handle
int GetItemPos(MCONTACT hcontact)
{
- for (int loop = 0; loop < contacts.getCount(); loop++)
- if (hcontact == contacts[loop]->hcontact)
- return loop;
+ for (auto &it : contacts)
+ if (hcontact == it->hcontact)
+ return contacts.indexOf(&it);
return -1;
}