diff options
author | George Hazan <ghazan@miranda.im> | 2018-02-21 18:40:03 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-02-21 18:40:14 +0300 |
commit | 477a6ea70d0bb1b1dfe9cbd9a15b6dad0284ddeb (patch) | |
tree | 247eed13a5231c3983e343f0b7fc2a95012353c2 /plugins/TopToolBar | |
parent | 9d0174ebe2bd005418855b18f737c36d5c20ab4a (diff) |
all another C++'11 iterators
Diffstat (limited to 'plugins/TopToolBar')
-rw-r--r-- | plugins/TopToolBar/src/toolbar.cpp | 19 | ||||
-rw-r--r-- | plugins/TopToolBar/src/ttbopt.cpp | 12 |
2 files changed, 14 insertions, 17 deletions
diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index 2bf222f327..413ac69fb5 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -115,8 +115,8 @@ int SaveAllButtonsOptions() int LaunchCnt = 0;
{
mir_cslock lck(csButtonsHook);
- for (int i = 0; i < Buttons.getCount(); i++)
- Buttons[i]->SaveSettings(&SeparatorCnt, &LaunchCnt);
+ for (auto &it : Buttons)
+ it->SaveSettings(&SeparatorCnt, &LaunchCnt);
}
db_set_b(0, TTB_OPTDIR, "SepCnt", SeparatorCnt);
db_set_b(0, TTB_OPTDIR, "LaunchCnt", LaunchCnt);
@@ -128,8 +128,8 @@ static bool nameexists(const char *name) if (name == nullptr)
return false;
- for (int i = 0; i < Buttons.getCount(); i++)
- if (!mir_strcmp(Buttons[i]->pszName, name))
+ for (auto &it : Buttons)
+ if (!mir_strcmp(it->pszName, name))
return true;
return false;
@@ -210,8 +210,8 @@ int ArrangeButtons() int i, nextX = 0, y = 0;
int nButtonCount = 0;
- for (i = 0; i < Buttons.getCount(); i++)
- if (Buttons[i]->hwnd)
+ for (auto &it : Buttons)
+ if (it->hwnd)
nButtonCount++;
if (nButtonCount == 0)
@@ -492,8 +492,7 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) int OnIconChange(WPARAM, LPARAM)
{
mir_cslock lck(csButtonsHook);
- for (int i = 0; i < Buttons.getCount(); i++) {
- TopButtonInt *b = Buttons[i];
+ for (auto &b : Buttons) {
if (!b->hIconHandleUp && !b->hIconHandleDn)
continue;
@@ -678,8 +677,8 @@ int UnloadToolbarModule() {
DestroyHookableEvent(hTTBModuleLoaded);
- for (int i = 0; i < Buttons.getCount(); i++)
- delete Buttons[i];
+ for (auto &it : Buttons)
+ delete it;
mir_free(g_ctrl);
return 0;
diff --git a/plugins/TopToolBar/src/ttbopt.cpp b/plugins/TopToolBar/src/ttbopt.cpp index 843db24ac6..27d1b36b2a 100644 --- a/plugins/TopToolBar/src/ttbopt.cpp +++ b/plugins/TopToolBar/src/ttbopt.cpp @@ -61,8 +61,8 @@ static int BuildTree(HWND hwndDlg) if (Buttons.getCount() == 0)
return FALSE;
- for (int i = 0; i < Buttons.getCount(); i++)
- AddLine(hTree, Buttons[i], TVI_LAST, dat->himlButtonIcons);
+ for (auto &it : Buttons)
+ AddLine(hTree, it, TVI_LAST, dat->himlButtonIcons);
return TRUE;
}
@@ -95,9 +95,8 @@ static void SaveTree(HWND hwndDlg) }
{
mir_cslock lck(csButtonsHook);
- for (int i=0; i < Buttons.getCount(); i++)
- delete Buttons[i];
-
+ for (auto &it : Buttons)
+ delete it;
Buttons = tmpList;
}
SaveAllButtonsOptions();
@@ -128,8 +127,7 @@ static void RecreateWindows() {
{
mir_cslock lck(csButtonsHook);
- for (int i = 0; i < Buttons.getCount(); i++) {
- TopButtonInt *b = Buttons[i];
+ for (auto &b : Buttons) {
if (b->hwnd) {
if (g_ctrl->bHardUpdate) {
DestroyWindow(b->hwnd);
|