summaryrefslogtreecommitdiff
path: root/protocols/Tox
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-26 22:31:20 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-26 22:31:27 +0300
commit391980ce1e890445542441eeb5d9f9cc18ae1baf (patch)
treeee1b165175dcdaeeaabd2ddb822542e648663a90 /protocols/Tox
parentbf8ad124d03b4fd059318d9ba8889b11faaf5b53 (diff)
code optimization
Diffstat (limited to 'protocols/Tox')
-rw-r--r--protocols/Tox/src/tox_icons.cpp12
-rw-r--r--protocols/Tox/src/tox_menus.cpp4
2 files changed, 8 insertions, 8 deletions
diff --git a/protocols/Tox/src/tox_icons.cpp b/protocols/Tox/src/tox_icons.cpp
index 5e95d49c24..a94405982e 100644
--- a/protocols/Tox/src/tox_icons.cpp
+++ b/protocols/Tox/src/tox_icons.cpp
@@ -14,16 +14,16 @@ void CToxProto::InitIcons()
HANDLE CToxProto::GetIconHandle(int iconId)
{
- for (size_t i = 0; i < _countof(Icons); i++)
- if (Icons[i].defIconID == iconId)
- return Icons[i].hIcolib;
+ for (auto &it : Icons)
+ if (it.defIconID == iconId)
+ return it.hIcolib;
return nullptr;
}
HICON CToxProto::GetIcon(int iconId)
{
- for (size_t i = 0; i < _countof(Icons); i++)
- if (Icons[i].defIconID == iconId)
- return IcoLib_GetIconByHandle(Icons[i].hIcolib);
+ for (auto &it : Icons)
+ if (it.defIconID == iconId)
+ return IcoLib_GetIconByHandle(it.hIcolib);
return nullptr;
}
diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp
index 88d7129713..5694689e1a 100644
--- a/protocols/Tox/src/tox_menus.cpp
+++ b/protocols/Tox/src/tox_menus.cpp
@@ -26,8 +26,8 @@ int CToxProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
int CToxProto::PrebuildContactMenu(WPARAM hContact, LPARAM lParam)
{
- for (int i = 0; i < _countof(ContactMenuItems); i++)
- Menu_ShowItem(ContactMenuItems[i], FALSE);
+ for (auto &it : ContactMenuItems)
+ Menu_ShowItem(it, FALSE);
CToxProto *proto = CToxProto::GetContactAccount(hContact);
return proto ? proto->OnPrebuildContactMenu(hContact, lParam) : 0;
}