From 391980ce1e890445542441eeb5d9f9cc18ae1baf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 26 Jan 2018 22:31:20 +0300 Subject: code optimization --- protocols/MSN/src/msn_chat.cpp | 4 ++-- protocols/MSN/src/msn_menu.cpp | 4 ++-- protocols/MSN/src/msn_mime.cpp | 6 +++--- protocols/MSN/src/msn_opts.cpp | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'protocols/MSN') diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 9021cfbbd7..e8f8b87265 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -60,8 +60,8 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p m_tszUserName, TranslateT("Chat #"), m_chatID); Chat_NewSession(GCW_CHATROOM, m_szModuleName, info->mChatID, szName); - for (int j = 0; j < _countof(m_ptszRoles); j++) - Chat_AddGroup(m_szModuleName, info->mChatID, TranslateW(m_ptszRoles[j])); + for (auto &it : m_ptszRoles) + Chat_AddGroup(m_szModuleName, info->mChatID, TranslateW(it)); Chat_Control(m_szModuleName, info->mChatID, SESSION_INITDONE); Chat_Control(m_szModuleName, info->mChatID, SESSION_ONLINE); diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index 18b2bc5231..9112c3fec0 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -177,8 +177,8 @@ void CMsnProto::MsnInitMainMenu(void) void CMsnProto::MSN_EnableMenuItems(bool bEnable) { - for (int i = 0; i < _countof(menuItemsMain); i++) - Menu_ModifyItem(menuItemsMain[i], nullptr, INVALID_HANDLE_VALUE, bEnable ? 0 : CMIF_GRAYED); + for (auto &it : menuItemsMain) + Menu_ModifyItem(it, nullptr, INVALID_HANDLE_VALUE, bEnable ? 0 : CMIF_GRAYED); if (bEnable) Menu_ShowItem(menuItemsMain[1], emailEnabled); diff --git a/protocols/MSN/src/msn_mime.cpp b/protocols/MSN/src/msn_mime.cpp index 8fb9e6149a..0eabb6c3e7 100644 --- a/protocols/MSN/src/msn_mime.cpp +++ b/protocols/MSN/src/msn_mime.cpp @@ -339,9 +339,9 @@ static const struct _tag_cpltbl static unsigned FindCP(const char* mimecp) { unsigned cp = CP_ACP; - for (unsigned i = 0; i < _countof(cptbl); ++i) { - if (_stricmp(mimecp, cptbl[i].mimecp) == 0) { - cp = cptbl[i].cp; + for (auto &it : cptbl) { + if (_stricmp(mimecp, it.mimecp) == 0) { + cp = it.cp; break; } } diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index ac1a002b6c..8549350c1d 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -59,9 +59,9 @@ HICON LoadIconEx(const char* name, bool big) HANDLE GetIconHandle(int iconId) { - for (unsigned i = 0; i < _countof(iconList); i++) - if (iconList[i].defIconID == iconId) - return iconList[i].hIcolib; + for (auto &it : iconList) + if (it.defIconID == iconId) + return it.hIcolib; return nullptr; } -- cgit v1.2.3