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 /plugins/Scriver | |
parent | bf8ad124d03b4fd059318d9ba8889b11faaf5b53 (diff) |
code optimization
Diffstat (limited to 'plugins/Scriver')
-rw-r--r-- | plugins/Scriver/src/globals.cpp | 22 | ||||
-rw-r--r-- | plugins/Scriver/src/msglog.cpp | 4 |
2 files changed, 13 insertions, 13 deletions
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 97ac6a7adf..9d5f880dc3 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -209,17 +209,15 @@ void ReleaseIcons() HICON GetCachedIcon(const char *name)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (!mir_strcmp(iconList[i].szName, name))
- return IcoLib_GetIconByHandle(iconList[i].hIcolib);
+ for (auto &it : iconList)
+ if (!mir_strcmp(it.szName, name))
+ return IcoLib_GetIconByHandle(it.hIcolib);
return nullptr;
}
void LoadGlobalIcons()
{
- int i;
-
g_dat.hMsgIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
g_dat.hMsgIconBig = Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true);
g_dat.hIconChatBig = IcoLib_GetIcon("chat_window", true);
@@ -228,19 +226,21 @@ void LoadGlobalIcons() ImageList_RemoveAll(g_dat.hChatButtonIconList);
ImageList_RemoveAll(g_dat.hHelperIconList);
ImageList_RemoveAll(g_dat.hSearchEngineIconList);
- for (i = 0; i < _countof(buttonIcons); i++) {
- if (buttonIcons[i] == nullptr)
+
+ for (auto &it : buttonIcons) {
+ if (it == nullptr)
ImageList_AddIcon_ProtoEx(g_dat.hButtonIconList, nullptr, ID_STATUS_OFFLINE);
else
- ImageList_AddIcon(g_dat.hButtonIconList, GetCachedIcon(buttonIcons[i]));
+ ImageList_AddIcon(g_dat.hButtonIconList, GetCachedIcon(it));
}
- for (i = 0; i < _countof(chatButtonIcons); i++)
- ImageList_AddIcon(g_dat.hChatButtonIconList, GetCachedIcon(chatButtonIcons[i]));
+
+ for (auto &it : chatButtonIcons)
+ ImageList_AddIcon(g_dat.hChatButtonIconList, GetCachedIcon(it));
ImageList_AddIcon(g_dat.hHelperIconList, GetCachedIcon("scriver_OVERLAY"));
int overlayIcon = ImageList_AddIcon(g_dat.hHelperIconList, GetCachedIcon("scriver_OVERLAY"));
ImageList_SetOverlayImage(g_dat.hHelperIconList, overlayIcon, 1);
- for (i = IDI_GOOGLE; i < IDI_LASTICON; i++) {
+ for (int i = IDI_GOOGLE; i < IDI_LASTICON; i++) {
HICON hIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(i), IMAGE_ICON, 0, 0, 0);
ImageList_AddIcon(g_dat.hSearchEngineIconList, hIcon);
DestroyIcon(hIcon);
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index f2beec5ee5..912b5a4741 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -910,8 +910,8 @@ void LoadMsgLogIcons(void) void FreeMsgLogIcons(void)
{
- for (int i = 0; i < _countof(pLogIconBmpBits); i++)
- mir_free(pLogIconBmpBits[i]);
+ for (auto &it : pLogIconBmpBits)
+ mir_free(it);
ImageList_RemoveAll(g_hImageList);
ImageList_Destroy(g_hImageList);
|