From ba75602b16e4b9b484c2c05f70c117f612c81e1d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 21 Feb 2018 18:33:08 +0300 Subject: Popup+: C++'11 iterators --- plugins/Popup/src/popup_thread.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'plugins/Popup/src/popup_thread.cpp') diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 1a5b462632..75e306a0b8 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -135,9 +135,9 @@ void RepositionPopups() { PopupWnd2 *prev = nullptr; if (PopupOptions.ReorderPopups) { - for (int i = 0; i < popupList.getCount(); ++i) { - UpdatePopupPosition(prev, popupList[i]); - prev = popupList[i]; + for (auto &it : popupList) { + UpdatePopupPosition(prev, it); + prev = it; } } } @@ -153,8 +153,8 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA case UTM_STOP_THREAD: gTerminating = true; if (db_get_b(NULL, MODULNAME, "FastExit", 0)) - for (int i = 0; i < popupList.getCount(); ++i) - PUDeletePopup(popupList[i]->getHwnd()); + for (auto &it : popupList) + PUDeletePopup(it->getHwnd()); PostQuitMessage(0); break; @@ -198,11 +198,9 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA break; case UTM_AVATAR_CHANGED: - for (int i = 0; i < popupList.getCount(); i++) { - PopupWnd2 *p = popupList[i]; + for (auto &p : popupList) if (p->getContact() == wParam) SendMessage(p->getHwnd(), UM_AVATARCHANGED, 0, 0); - } break; } return DefWindowProc(hwnd, message, wParam, lParam); @@ -277,8 +275,8 @@ void UnloadPopupThread() WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); - for (int i = 0; i < popupList.getCount(); ++i) - delete popupList[i]; + for (auto &it : popupList) + delete it; popupList.destroy(); } -- cgit v1.2.3