diff options
author | George Hazan <ghazan@miranda.im> | 2018-01-26 22:31:20 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-01-26 22:31:27 +0300 |
commit | 391980ce1e890445542441eeb5d9f9cc18ae1baf (patch) | |
tree | ee1b165175dcdaeeaabd2ddb822542e648663a90 /protocols/SkypeWeb | |
parent | bf8ad124d03b4fd059318d9ba8889b11faaf5b53 (diff) |
code optimization
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r-- | protocols/SkypeWeb/src/skype_db.cpp | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_icons.cpp | 12 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_menus.cpp | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_utils.cpp | 6 |
4 files changed, 12 insertions, 14 deletions
diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp index 62210653cc..95cba6049c 100644 --- a/protocols/SkypeWeb/src/skype_db.cpp +++ b/protocols/SkypeWeb/src/skype_db.cpp @@ -150,9 +150,7 @@ void CSkypeProto::InitDBEvents() dbEventType.iconService = MODULE "/GetEventIcon"; dbEventType.textService = MODULE "/GetEventText"; - for (size_t i = 0; i < _countof(g_SkypeDBTypes); i++) { - SkypeDBType &cur = g_SkypeDBTypes[i]; - + for (auto &cur : g_SkypeDBTypes) { dbEventType.eventType = cur.type; dbEventType.descr = Translate(cur.name); dbEventType.flags |= cur.flags; diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp index 13427fa894..412d0c0043 100644 --- a/protocols/SkypeWeb/src/skype_icons.cpp +++ b/protocols/SkypeWeb/src/skype_icons.cpp @@ -37,16 +37,16 @@ void CSkypeProto::InitIcons() HICON CSkypeProto::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;
}
HANDLE CSkypeProto::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;
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp index 305b35ab1d..bcf3f98315 100644 --- a/protocols/SkypeWeb/src/skype_menus.cpp +++ b/protocols/SkypeWeb/src/skype_menus.cpp @@ -45,8 +45,8 @@ int CSkypeProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) int CSkypeProto::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);
CSkypeProto *proto = CSkypeProto::GetContactAccount(hContact);
return proto ? proto->OnPrebuildContactMenu(hContact, lParam) : 0;
}
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index fdb3a97b3c..cd85c2db04 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -405,9 +405,9 @@ char *CSkypeProto::RemoveHtml(const char *text) } else { // Keyword replacement - for (int j = 0; j < _countof(htmlEntities); j++) { - if (!mir_strcmpi(entity.c_str(), htmlEntities[j].entity)) { - new_string += htmlEntities[j].symbol; + for (auto &it : htmlEntities) { + if (!mir_strcmpi(entity.c_str(), it.entity)) { + new_string += it.symbol; found = true; break; } |