summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/FacebookRM/src/theme.cpp6
-rw-r--r--protocols/IRCG/src/options.cpp16
-rw-r--r--protocols/IcqOscarJ/src/capabilities.cpp6
-rw-r--r--protocols/IcqOscarJ/src/dlgproc.cpp3
-rwxr-xr-xprotocols/JabberG/src/jabber_caps.cpp6
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp45
-rw-r--r--protocols/JabberG/src/jabber_console.cpp35
-rw-r--r--protocols/JabberG/src/jabber_disco.cpp71
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp6
-rw-r--r--protocols/JabberG/src/jabber_icolib.cpp30
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp12
-rwxr-xr-xprotocols/JabberG/src/jabber_misc.cpp6
-rwxr-xr-xprotocols/JabberG/src/jabber_opt.cpp8
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp20
-rw-r--r--protocols/MRA/src/MraChat.cpp4
-rw-r--r--protocols/MSN/src/msn_chat.cpp4
-rw-r--r--protocols/MSN/src/msn_menu.cpp4
-rw-r--r--protocols/MSN/src/msn_mime.cpp6
-rw-r--r--protocols/MSN/src/msn_opts.cpp6
-rw-r--r--protocols/SkypeWeb/src/skype_db.cpp4
-rw-r--r--protocols/SkypeWeb/src/skype_icons.cpp12
-rw-r--r--protocols/SkypeWeb/src/skype_menus.cpp4
-rw-r--r--protocols/SkypeWeb/src/skype_utils.cpp6
-rw-r--r--protocols/Tox/src/tox_icons.cpp12
-rw-r--r--protocols/Tox/src/tox_menus.cpp4
-rw-r--r--protocols/Twitter/src/theme.cpp10
-rw-r--r--protocols/Twitter/src/ui.cpp8
-rw-r--r--protocols/VKontakte/src/misc.cpp52
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp6
29 files changed, 205 insertions, 207 deletions
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp
index 6531bf9f32..91466a877f 100644
--- a/protocols/FacebookRM/src/theme.cpp
+++ b/protocols/FacebookRM/src/theme.cpp
@@ -64,9 +64,9 @@ void InitIcons(void)
HANDLE GetIconHandle(const char* name)
{
- for (size_t i = 0; i < _countof(icons); i++)
- if (mir_strcmp(icons[i].szName, name) == 0)
- return icons[i].hIcolib;
+ for (auto &it : icons)
+ if (mir_strcmp(it.szName, name) == 0)
+ return it.hIcolib;
return nullptr;
}
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index 0fedca772e..3378b84e5f 100644
--- a/protocols/IRCG/src/options.cpp
+++ b/protocols/IRCG/src/options.cpp
@@ -209,18 +209,18 @@ void InitIcons(void)
HICON LoadIconEx(int iconId, bool big)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == iconId)
- return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
+ for (auto &it : iconList)
+ if (it.defIconID == iconId)
+ return IcoLib_GetIconByHandle(it.hIcolib, big);
return nullptr;
}
HANDLE GetIconHandle(int iconId)
{
- for (int 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;
}
@@ -352,8 +352,8 @@ struct CServerDlg : public CProtoDlgBase<CIrcProto>
void OnOk(CCtrlButton*)
{
- for (int k = 0; k < _countof(sttRequiredFields); k++)
- if (!GetWindowTextLength(GetDlgItem(m_hwnd, sttRequiredFields[k]))) {
+ for (auto &it : sttRequiredFields)
+ if (!GetWindowTextLength(GetDlgItem(m_hwnd, it))) {
MessageBox(m_hwnd, TranslateT("Please complete all fields"), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
return;
}
diff --git a/protocols/IcqOscarJ/src/capabilities.cpp b/protocols/IcqOscarJ/src/capabilities.cpp
index 9bc780ea4d..4a35b19ea6 100644
--- a/protocols/IcqOscarJ/src/capabilities.cpp
+++ b/protocols/IcqOscarJ/src/capabilities.cpp
@@ -84,12 +84,12 @@ void NetLog_CapabilityChange(CIcqProto *ppro, const char *szChange, DWORD fdwCap
if (!fdwCapabilities) return;
- for (int nIndex = 0; nIndex < _countof(CapabilityNames); nIndex++) {
+ for (auto &it : CapabilityNames) {
// Check if the current capability is present
- if ((fdwCapabilities & CapabilityNames[nIndex].capID) == CapabilityNames[nIndex].capID) {
+ if ((fdwCapabilities & it.capID) == it.capID) {
if (mir_strlen(szBuffer))
mir_strcat(szBuffer, ", ");
- mir_strcat(szBuffer, CapabilityNames[nIndex].capName);
+ mir_strcat(szBuffer, it.capName);
}
}
// Log the change
diff --git a/protocols/IcqOscarJ/src/dlgproc.cpp b/protocols/IcqOscarJ/src/dlgproc.cpp
index d0ddd84eec..b754a2e5ab 100644
--- a/protocols/IcqOscarJ/src/dlgproc.cpp
+++ b/protocols/IcqOscarJ/src/dlgproc.cpp
@@ -458,7 +458,8 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if (ack->type != ACKTYPE_SETINFO) break;
if (ack->result == ACKRESULT_SUCCESS) {
for (i = 0; i < _countof(dat->hUpload); i++)
- if (dat->hUpload[i] && ack->hProcess == dat->hUpload[i]) break;
+ if (dat->hUpload[i] && ack->hProcess == dat->hUpload[i])
+ break;
if (i == _countof(dat->hUpload)) break;
dat->hUpload[i] = nullptr;
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index ae95ee5216..4b99b77219 100755
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -276,9 +276,9 @@ JabberCapsBits CJabberProto::GetResourceCapabilities(const wchar_t *jid, pResour
wchar_t *token = wcstok(caps, L" ");
while (token) {
- for (int i = 0; i < _countof(g_JabberFeatCapPairsExt); i++) {
- if (!mir_wstrcmp(g_JabberFeatCapPairsExt[i].szFeature, token)) {
- jcbCaps |= g_JabberFeatCapPairsExt[i].jcbCap;
+ for (auto &it : g_JabberFeatCapPairsExt) {
+ if (!mir_wstrcmp(it.szFeature, token)) {
+ jcbCaps |= it.jcbCap;
break;
}
}
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index 016a549279..bc0a6b43fb 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -121,10 +121,10 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item)
return 1;
// translate string for menus (this can't be done in initializer)
- for (int i = 0; i < _countof(sttAffiliationItems); i++)
- sttAffiliationItems[i].translate();
- for (int i = 0; i < _countof(sttRoleItems); i++)
- sttRoleItems[i].translate();
+ for (auto &it : sttAffiliationItems)
+ it.translate();
+ for (auto &it : sttRoleItems)
+ it.translate();
ptrW szNick(JabberNickFromJID(item->jid));
GCSessionInfoBase *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, item->jid, szNick);
@@ -568,16 +568,16 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam)
for (; idx <= IDM_LINK9; ++idx)
sttFindGcMenuItem(_countof(sttListItems), sttListItems, idx)->uType = 0;
- for (i = 0; i < _countof(sttAffiliationItems); i++) {
- gc_item *pItem = sttFindGcMenuItem(_countof(sttListItems), sttListItems, sttAffiliationItems[i].id);
- pItem->uType = (him->m_affiliation == sttAffiliationItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
- pItem->bDisabled = !(force || sttAffiliationItems[i].check(me, him));
+ for (auto &it : sttAffiliationItems) {
+ gc_item *pItem = sttFindGcMenuItem(_countof(sttListItems), sttListItems, it.id);
+ pItem->uType = (him->m_affiliation == it.value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
+ pItem->bDisabled = !(force || it.check(me, him));
}
- for (i = 0; i < _countof(sttRoleItems); i++) {
- gc_item *pItem = sttFindGcMenuItem(_countof(sttListItems), sttListItems, sttRoleItems[i].id);
- pItem->uType = (him->m_role == sttRoleItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
- pItem->bDisabled = !(force || sttRoleItems[i].check(me, him));
+ for (auto &it : sttRoleItems) {
+ gc_item *pItem = sttFindGcMenuItem(_countof(sttListItems), sttListItems, it.id);
+ pItem->uType = (him->m_role == it.value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
+ pItem->bDisabled = !(force || it.check(me, him));
}
if (him->m_tszRealJid && *him->m_tszRealJid) {
@@ -847,21 +847,22 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
SetDlgItemText(hwndDlg, IDC_TXT_JID, dat->him->m_tszRealJid ? dat->him->m_tszRealJid : TranslateT("Real JID not available"));
SetDlgItemText(hwndDlg, IDC_TXT_STATUS, dat->him->m_tszStatusMessage);
- for (int i = 0; i < _countof(sttRoleItems); i++) {
- if ((sttRoleItems[i].value == dat->him->m_role) || sttRoleItems[i].check(dat->me, dat->him)) {
+ for (auto &it : sttRoleItems) {
+ if ((it.value == dat->him->m_role) || it.check(dat->me, dat->him)) {
SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETITEMDATA,
- idx = SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_ADDSTRING, 0, (LPARAM)sttRoleItems[i].title),
- sttRoleItems[i].value);
- if (sttRoleItems[i].value == dat->him->m_role)
+ idx = SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_ADDSTRING, 0, (LPARAM)it.title),
+ it.value);
+ if (it.value == dat->him->m_role)
SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETCURSEL, idx, 0);
}
}
- for (int i = 0; i < _countof(sttAffiliationItems); i++) {
- if ((sttAffiliationItems[i].value == dat->him->m_affiliation) || sttAffiliationItems[i].check(dat->me, dat->him)) {
+
+ for (auto &it : sttAffiliationItems) {
+ if ((it.value == dat->him->m_affiliation) || it.check(dat->me, dat->him)) {
SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_SETITEMDATA,
- idx = SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_ADDSTRING, 0, (LPARAM)sttAffiliationItems[i].title),
- sttAffiliationItems[i].value);
- if (sttAffiliationItems[i].value == dat->him->m_affiliation)
+ idx = SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_ADDSTRING, 0, (LPARAM)it.title),
+ it.value);
+ if (it.value == dat->him->m_affiliation)
SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_SETCURSEL, idx, 0);
}
}
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp
index 6dcd528ddd..32ba0492f0 100644
--- a/protocols/JabberG/src/jabber_console.cpp
+++ b/protocols/JabberG/src/jabber_console.cpp
@@ -370,18 +370,20 @@ void CJabberDlgConsole::OnInitDialog()
{ IDC_BTN_FILTER_REFRESH, "Refresh list", "sd_nav_refresh", false, FALSE},
};
- for (int i=0; i < _countof(buttons); i++) {
- SendDlgItemMessage(m_hwnd, buttons[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(buttons[i].icon));
- SendDlgItemMessage(m_hwnd, buttons[i].idc, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(m_hwnd, buttons[i].idc, BUTTONADDTOOLTIP, (WPARAM)buttons[i].title, 0);
- if (buttons[i].push) SendDlgItemMessage(m_hwnd, buttons[i].idc, BUTTONSETASPUSHBTN, TRUE, 0);
- if (buttons[i].pushed) CheckDlgButton(m_hwnd, buttons[i].idc, BST_CHECKED);
+ for (auto &it : buttons) {
+ SendDlgItemMessage(m_hwnd, it.idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(it.icon));
+ SendDlgItemMessage(m_hwnd, it.idc, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(m_hwnd, it.idc, BUTTONADDTOOLTIP, (WPARAM)it.title, 0);
+ if (it.push)
+ SendDlgItemMessage(m_hwnd, it.idc, BUTTONSETASPUSHBTN, TRUE, 0);
+ if (it.pushed)
+ CheckDlgButton(m_hwnd, it.idc, BST_CHECKED);
}
- for (int i=0; i < _countof(filter_modes); i++)
- if (filter_modes[i].type == m_proto->m_filterInfo.type) {
- IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon)));
- SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon));
+ for (auto &it : filter_modes)
+ if (it.type == m_proto->m_filterInfo.type) {
+ IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(it.icon)));
+ SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(it.icon));
break;
}
@@ -563,12 +565,9 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
break;
case IDC_BTN_FILTER:
- int i;
HMENU hMenu = CreatePopupMenu();
- for (i = 0; i < _countof(filter_modes); i++)
- AppendMenu(hMenu,
- MF_STRING | ((filter_modes[i].type == m_proto->m_filterInfo.type) ? MF_CHECKED : 0),
- filter_modes[i].type + 1, TranslateW(filter_modes[i].title));
+ for (auto &it : filter_modes)
+ AppendMenu(hMenu, MF_STRING | ((it.type == m_proto->m_filterInfo.type) ? MF_CHECKED : 0), it.type + 1, TranslateW(it.title));
RECT rc; GetWindowRect(GetDlgItem(m_hwnd, IDC_BTN_FILTER), &rc);
CheckDlgButton(m_hwnd, IDC_BTN_FILTER, BST_CHECKED);
@@ -578,9 +577,9 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
if (res) {
m_proto->m_filterInfo.type = (TFilterInfo::Type)(res - 1);
- for (i = 0; i < _countof(filter_modes); i++) {
- if (filter_modes[i].type == m_proto->m_filterInfo.type) {
- IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon)));
+ for (auto &it : filter_modes) {
+ if (it.type == m_proto->m_filterInfo.type) {
+ IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(it.icon)));
break;
}
}
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp
index 3d22509c35..04dae8fcf2 100644
--- a/protocols/JabberG/src/jabber_disco.cpp
+++ b/protocols/JabberG/src/jabber_disco.cpp
@@ -512,25 +512,26 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode)
iOverlay = SD_OVERLAY_NONE;
}
- for (int i = 0; i < _countof(sttNodeIcons); i++) {
- if (!sttNodeIcons[i].iconIndex && !sttNodeIcons[i].iconName) continue;
+ for (auto &it : sttNodeIcons) {
+ if (!it.iconIndex && !it.iconName)
+ continue;
- if (sttNodeIcons[i].category) {
+ if (it.category) {
CJabberSDIdentity *iIdentity;
for (iIdentity = pNode->GetFirstIdentity(); iIdentity; iIdentity = iIdentity->GetNext())
- if (!mir_wstrcmp(iIdentity->GetCategory(), sttNodeIcons[i].category) &&
- (!sttNodeIcons[i].type || !mir_wstrcmp(iIdentity->GetType(), sttNodeIcons[i].type))) {
- iIcon = sttNodeIcons[i].listIndex;
+ if (!mir_wstrcmp(iIdentity->GetCategory(), it.category) &&
+ (!it.type || !mir_wstrcmp(iIdentity->GetType(), it.type))) {
+ iIcon = it.listIndex;
break;
}
if (iIdentity) break;
}
- if (sttNodeIcons[i].feature) {
+ if (it.feature) {
CJabberSDFeature *iFeature;
for (iFeature = pNode->GetFirstFeature(); iFeature; iFeature = iFeature->GetNext())
- if (!mir_wstrcmp(iFeature->GetVar(), sttNodeIcons[i].feature)) {
- iIcon = sttNodeIcons[i].listIndex;
+ if (!mir_wstrcmp(iFeature->GetVar(), it.feature)) {
+ iIcon = it.listIndex;
break;
}
if (iFeature) break;
@@ -677,19 +678,19 @@ void CJabberDlgDiscovery::OnInitDialog()
TreeList_Create(hwndList);
TreeList_AddIcon(hwndList, m_proto->LoadIconEx("main"), 0);
- for (int i = 0; i < _countof(sttNodeIcons); i++) {
+ for (auto &it : sttNodeIcons) {
bool needDestroy = false;
HICON hIcon;
- if ((sttNodeIcons[i].iconIndex == SKINICON_STATUS_ONLINE) && sttNodeIcons[i].iconName) {
- hIcon = (HICON)CallProtoService(sttNodeIcons[i].iconName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
+ if ((it.iconIndex == SKINICON_STATUS_ONLINE) && it.iconName) {
+ hIcon = (HICON)CallProtoService(it.iconName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
needDestroy = true;
}
- else if (sttNodeIcons[i].iconName)
- hIcon = m_proto->LoadIconEx(sttNodeIcons[i].iconName);
- else if (sttNodeIcons[i].iconIndex)
- hIcon = Skin_LoadIcon(sttNodeIcons[i].iconIndex);
+ else if (it.iconName)
+ hIcon = m_proto->LoadIconEx(it.iconName);
+ else if (it.iconIndex)
+ hIcon = Skin_LoadIcon(it.iconIndex);
else continue;
- sttNodeIcons[i].listIndex = TreeList_AddIcon(hwndList, hIcon, 0);
+ it.listIndex = TreeList_AddIcon(hwndList, hIcon, 0);
if (needDestroy) DestroyIcon(hIcon);
}
TreeList_AddIcon(hwndList, m_proto->LoadIconEx("disco_fail"), SD_OVERLAY_FAIL);
@@ -1207,37 +1208,37 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
HMENU hMenu = CreatePopupMenu();
BOOL lastSeparator = TRUE;
bool bFilterItems = !GetAsyncKeyState(VK_CONTROL);
- for (int i = 0; i < _countof(items); i++) {
+ for (auto &it : items) {
JABBER_LIST_ITEM *rosterItem = nullptr;
if (bFilterItems) {
- if ((items[i].flags & SD_FLG_NONODE) && pNode->GetNode())
+ if ((it.flags & SD_FLG_NONODE) && pNode->GetNode())
continue;
- if ((items[i].flags & SD_FLG_NOTONROSTER) && (rosterItem = ListGetItemPtr(LIST_ROSTER, pNode->GetJid())))
+ if ((it.flags & SD_FLG_NOTONROSTER) && (rosterItem = ListGetItemPtr(LIST_ROSTER, pNode->GetJid())))
continue;
- if ((items[i].flags & SD_FLG_ONROSTER) && !(rosterItem = ListGetItemPtr(LIST_ROSTER, pNode->GetJid())))
+ if ((it.flags & SD_FLG_ONROSTER) && !(rosterItem = ListGetItemPtr(LIST_ROSTER, pNode->GetJid())))
continue;
- if ((items[i].flags & SD_FLG_SUBSCRIBED) && (!rosterItem || (rosterItem->subscription == SUB_NONE)))
+ if ((it.flags & SD_FLG_SUBSCRIBED) && (!rosterItem || (rosterItem->subscription == SUB_NONE)))
continue;
- if ((items[i].flags & SD_FLG_NOTSUBSCRIBED) && (rosterItem && (rosterItem->subscription != SUB_NONE)))
+ if ((it.flags & SD_FLG_NOTSUBSCRIBED) && (rosterItem && (rosterItem->subscription != SUB_NONE)))
continue;
- if ((items[i].flags & SD_FLG_ONLINE) && rosterItem && (rosterItem->getTemp()->m_iStatus != ID_STATUS_OFFLINE))
+ if ((it.flags & SD_FLG_ONLINE) && rosterItem && (rosterItem->getTemp()->m_iStatus != ID_STATUS_OFFLINE))
continue;
- if ((items[i].flags & SD_FLG_NOTONLINE) && rosterItem && (rosterItem->getTemp()->m_iStatus == ID_STATUS_OFFLINE))
+ if ((it.flags & SD_FLG_NOTONLINE) && rosterItem && (rosterItem->getTemp()->m_iStatus == ID_STATUS_OFFLINE))
continue;
- if ((items[i].flags & SD_FLG_NORESOURCE) && wcschr(pNode->GetJid(), '/'))
+ if ((it.flags & SD_FLG_NORESOURCE) && wcschr(pNode->GetJid(), '/'))
continue;
- if ((items[i].flags & SD_FLG_HASUSER) && !wcschr(pNode->GetJid(), '@'))
+ if ((it.flags & SD_FLG_HASUSER) && !wcschr(pNode->GetJid(), '@'))
continue;
}
- if (!items[i].feature) {
- if (items[i].title) {
+ if (!it.feature) {
+ if (it.title) {
MCONTACT hContact;
- if ((items[i].action == SD_ACT_USERMENU) && (hContact = HContactFromJID(pNode->GetJid()))) {
+ if ((it.action == SD_ACT_USERMENU) && (hContact = HContactFromJID(pNode->GetJid()))) {
HMENU hContactMenu = Menu_BuildContactMenu(hContact);
- AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hContactMenu, TranslateW(items[i].title));
+ AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hContactMenu, TranslateW(it.title));
}
- else AppendMenu(hMenu, MF_STRING, items[i].action, TranslateW(items[i].title));
+ else AppendMenu(hMenu, MF_STRING, it.action, TranslateW(it.title));
lastSeparator = FALSE;
}
else if (!lastSeparator) {
@@ -1250,14 +1251,14 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
bool bFeatureOk = !bFilterItems;
if (bFilterItems)
for (CJabberSDFeature *iFeature = pNode->GetFirstFeature(); iFeature; iFeature = iFeature->GetNext())
- if (!mir_wstrcmp(iFeature->GetVar(), items[i].feature)) {
+ if (!mir_wstrcmp(iFeature->GetVar(), it.feature)) {
bFeatureOk = true;
break;
}
if (bFeatureOk) {
- if (items[i].title) {
- AppendMenu(hMenu, MF_STRING, items[i].action, TranslateW(items[i].title));
+ if (it.title) {
+ AppendMenu(hMenu, MF_STRING, it.action, TranslateW(it.title));
lastSeparator = FALSE;
}
else if (!lastSeparator) {
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 378716e219..c93f8397e0 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -369,10 +369,10 @@ static void sttJoinDlgShowRecentItems(HWND hwndDlg, int newCount)
RECT rc;
int ctrls[] = { IDC_BOOKMARKS, IDOK, IDCANCEL };
- for (int i = 0; i < _countof(ctrls); i++) {
- GetWindowRect(GetDlgItem(hwndDlg, ctrls[i]), &rc);
+ for (auto &it : ctrls) {
+ GetWindowRect(GetDlgItem(hwndDlg, it), &rc);
MapWindowPoints(nullptr, hwndDlg, (LPPOINT)&rc, 2);
- SetWindowPos(GetDlgItem(hwndDlg, ctrls[i]), nullptr, rc.left, rc.top + offset, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hwndDlg, it), nullptr, rc.left, rc.top + offset, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
GetWindowRect(hwndDlg, &rc);
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp
index af4f030dd3..5eb0a99b24 100644
--- a/protocols/JabberG/src/jabber_icolib.cpp
+++ b/protocols/JabberG/src/jabber_icolib.cpp
@@ -423,8 +423,8 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const wchar_t *jid, MCONTACT hCon
if (resourcepos != nullptr)
*resourcepos = '\0';
- for (int i = 0; i < _countof(TransportProtoTable); i++)
- if (MatchMask(domain, TransportProtoTable[i].mask)) {
+ for (auto &it : TransportProtoTable)
+ if (MatchMask(domain, it.mask)) {
GetTransportStatusIconIndex(GetTransportProtoID(domain), ID_STATUS_OFFLINE);
isTransported = TRUE;
break;
@@ -530,23 +530,21 @@ void g_IconsInit()
HANDLE g_GetIconHandle(int iconId)
{
- int i;
-
- for (i = 0; i < _countof(sharedIconList1); i++)
- if (sharedIconList1[i].defIconID == iconId)
- return sharedIconList1[i].hIcolib;
+ for (auto &it : sharedIconList1)
+ if (it.defIconID == iconId)
+ return it.hIcolib;
- for (i = 0; i < _countof(sharedIconList2); i++)
- if (sharedIconList2[i].defIconID == iconId)
- return sharedIconList2[i].hIcolib;
+ for (auto &it : sharedIconList2)
+ if (it.defIconID == iconId)
+ return it.hIcolib;
- for (i = 0; i < _countof(sharedIconList3); i++)
- if (sharedIconList3[i].defIconID == iconId)
- return sharedIconList3[i].hIcolib;
+ for (auto &it : sharedIconList3)
+ if (it.defIconID == iconId)
+ return it.hIcolib;
- for (i = 0; i < _countof(sharedIconList4); i++)
- if (sharedIconList4[i].defIconID == iconId)
- return sharedIconList4[i].hIcolib;
+ for (auto &it : sharedIconList4)
+ if (it.defIconID == iconId)
+ return it.hIcolib;
return nullptr;
}
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index 576589110f..7610621e28 100644
--- a/protocols/JabberG/src/jabber_iqid_muc.cpp
+++ b/protocols/JabberG/src/jabber_iqid_muc.cpp
@@ -199,12 +199,12 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
SendMessage(hwndDlg, WM_JABBER_REFRESH, 0, lParam);
dat = (JABBER_MUC_JIDLIST_INFO*)lParam;
- for (int i = 0; i < _countof(buttons); i++) {
- SendDlgItemMessage(hwndDlg, buttons[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)dat->ppro->LoadIconEx(buttons[i].icon));
- SendDlgItemMessage(hwndDlg, buttons[i].idc, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, buttons[i].idc, BUTTONADDTOOLTIP, (WPARAM)buttons[i].title, 0);
- if (buttons[i].push)
- SendDlgItemMessage(hwndDlg, buttons[i].idc, BUTTONSETASPUSHBTN, TRUE, 0);
+ for (auto &it : buttons) {
+ SendDlgItemMessage(hwndDlg, it.idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)dat->ppro->LoadIconEx(it.icon));
+ SendDlgItemMessage(hwndDlg, it.idc, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, it.idc, BUTTONADDTOOLTIP, (WPARAM)it.title, 0);
+ if (it.push)
+ SendDlgItemMessage(hwndDlg, it.idc, BUTTONSETASPUSHBTN, TRUE, 0);
}
Utils_RestoreWindowPosition(hwndDlg, 0, dat->ppro->m_szModuleName, "jidListWnd_");
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index b90a09bc53..7c1c4a0b5b 100755
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -262,9 +262,9 @@ static sttCapsNodeToName_Map[] =
const wchar_t* CJabberProto::GetSoftName(const wchar_t *wszName)
{
// search through known software list
- for (int i = 0; i < _countof(sttCapsNodeToName_Map); i++)
- if (wcsstr(wszName, sttCapsNodeToName_Map[i].node))
- return sttCapsNodeToName_Map[i].name;
+ for (auto &it : sttCapsNodeToName_Map)
+ if (wcsstr(wszName, it.node))
+ return it.name;
return nullptr;
}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index 6387b0ab1c..5b751fc96f 100755
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -435,8 +435,8 @@ protected:
// fill predefined resources
wchar_t *szResources[] = { L"Home", L"Work", L"Office", L"Miranda" };
- for (int i = 0; i < _countof(szResources); i++)
- m_cbResource.AddString(szResources[i]);
+ for (auto &it : szResources)
+ m_cbResource.AddString(it);
// append computer name to the resource list
wchar_t szCompName[MAX_COMPUTERNAME_LENGTH + 1];
@@ -1585,8 +1585,8 @@ protected:
// fill predefined resources
wchar_t *szResources[] = { L"Home", L"Work", L"Office", L"Miranda" };
- for (int i = 0; i < _countof(szResources); i++)
- m_cbResource.AddString(szResources[i]);
+ for (auto &it : szResources)
+ m_cbResource.AddString(it);
// append computer name to the resource list
wchar_t szCompName[MAX_COMPUTERNAME_LENGTH + 1];
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index 6ae2f75dc1..f189e90b17 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -378,9 +378,9 @@ public:
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_RESETCONTENT, 0, 0);
wchar_t *szSubscriptions[] = { L"none", L"from", L"to", L"both" };
- for (i=0; i < _countof(szSubscriptions); i++) {
- LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_ADDSTRING, 0, (LPARAM)TranslateW(szSubscriptions[i]));
- SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_SETITEMDATA, nItem, (LPARAM)szSubscriptions[i]);
+ for (auto &it : szSubscriptions) {
+ LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
+ SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_SETITEMDATA, nItem, (LPARAM)it);
}
PostMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_COMBO_TYPE, CBN_SELCHANGE), 0);
@@ -945,11 +945,11 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam)
else if (lpdis->CtlID == IDC_LB_LISTS)
DrawLists(lpdis);
else if (lpdis->CtlID == IDC_CANVAS) {
- int i, totalWidth = -5; // spacing for last item
- for (i=0; i < _countof(drawItems); i++) {
+ int totalWidth = -5; // spacing for last item
+ for (auto &it : drawItems) {
SIZE sz = {0};
- drawItems[i].text = TranslateW(drawItems[i].textEng);
- GetTextExtentPoint32(lpdis->hDC, drawItems[i].text, (int)mir_wstrlen(drawItems[i].text), &sz);
+ it.text = TranslateW(it.textEng);
+ GetTextExtentPoint32(lpdis->hDC, it.text, (int)mir_wstrlen(it.text), &sz);
totalWidth += sz.cx + 18 + 5; // 18 pixels for icon, 5 pixel spacing
}
@@ -957,11 +957,11 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam)
RECT rc = lpdis->rcItem;
rc.left = (rc.left + rc.right - totalWidth)/2;
- for (i=0; i < _countof(drawItems); i++) {
- DrawIconEx(lpdis->hDC, rc.left, (rc.top+rc.bottom-16)/2, m_proto->LoadIconEx(drawItems[i].icon),
+ for (auto &it : drawItems) {
+ DrawIconEx(lpdis->hDC, rc.left, (rc.top+rc.bottom-16)/2, m_proto->LoadIconEx(it.icon),
16, 16, 0, nullptr, DI_NORMAL);
rc.left += 18;
- DrawNextRulePart(lpdis->hDC, clText, drawItems[i].text, &rc);
+ DrawNextRulePart(lpdis->hDC, clText, it.text, &rc);
rc.left += 5;
}
}
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp
index 237e486312..9d80158bb0 100644
--- a/protocols/MRA/src/MraChat.cpp
+++ b/protocols/MRA/src/MraChat.cpp
@@ -31,8 +31,8 @@ INT_PTR CMraProto::MraChatSessionNew(MCONTACT hContact)
if (Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszEMail, pcli->pfnGetContactDisplayName(hContact, 0), (void*)hContact))
return 1;
- for (int i = 0; i < _countof(lpwszStatuses); i++)
- Chat_AddGroup(m_szModuleName, wszEMail, TranslateW(lpwszStatuses[i]));
+ for (auto &it : lpwszStatuses)
+ Chat_AddGroup(m_szModuleName, wszEMail, TranslateW(it));
Chat_Control(m_szModuleName, wszEMail, SESSION_INITDONE);
Chat_Control(m_szModuleName, wszEMail, SESSION_ONLINE);
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;
}
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;
}
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;
}
diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp
index 2e22f7398e..c7e7c69f55 100644
--- a/protocols/Twitter/src/theme.cpp
+++ b/protocols/Twitter/src/theme.cpp
@@ -46,9 +46,9 @@ void InitIcons(void)
HANDLE GetIconHandle(const char *name)
{
- for (size_t i = 0; i < _countof(icons); i++)
- if (mir_strcmp(icons[i].szName, name) == 0)
- return icons[i].hIcolib;
+ for (auto &it : icons)
+ if (mir_strcmp(it.szName, name) == 0)
+ return it.hIcolib;
return nullptr;
}
@@ -111,6 +111,6 @@ void InitContactMenus()
void ShowContactMenus(bool show)
{
- for (size_t i = 0; i < _countof(g_hMenuItems); i++)
- Menu_ShowItem(g_hMenuItems[i], show);
+ for (auto &it : g_hMenuItems)
+ Menu_ShowItem(it, show);
}
diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp
index a94395829a..d7164be99e 100644
--- a/protocols/Twitter/src/ui.cpp
+++ b/protocols/Twitter/src/ui.cpp
@@ -50,8 +50,8 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
db_free(&dbv);
}
- for (size_t i = 0; i < _countof(sites); i++)
- SendDlgItemMessage(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(sites[i]));
+ for (auto &it : sites)
+ SendDlgItemMessage(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(it));
if (!proto->getString(TWITTER_KEY_BASEURL, &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_SERVER, dbv.pszVal);
@@ -180,8 +180,8 @@ INT_PTR CALLBACK options_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
CheckDlgButton(hwndDlg, IDC_CHATFEED, proto->getByte(TWITTER_KEY_CHATFEED) ? BST_CHECKED : BST_UNCHECKED);
- for (size_t i = 0; i < _countof(sites); i++)
- SendDlgItemMessage(hwndDlg, IDC_BASEURL, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(sites[i]));
+ for (auto &it : sites)
+ SendDlgItemMessage(hwndDlg, IDC_BASEURL, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(it));
if (!proto->getString(TWITTER_KEY_BASEURL, &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_BASEURL, dbv.pszVal);
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 1169de5b01..95510c591d 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -84,9 +84,9 @@ void InitIcons()
HANDLE GetIconHandle(int iCommand)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == iCommand)
- return iconList[i].hIcolib;
+ for (auto &it : iconList)
+ if (it.defIconID == iCommand)
+ return it.hIcolib;
return nullptr;
}
@@ -847,10 +847,10 @@ CMStringA CVkProto::GetAttachmentsFromMessage(const char *Msg)
iOwner = 0,
iId = 0;
- for (int i = 0; i < _countof(szAttachmentMasks); i++) {
- iRes = sscanf(pos, szAttachmentMasks[i], &iOwner, &iId);
+ for (auto &it : szAttachmentMasks) {
+ iRes = sscanf(pos, it, &iOwner, &iId);
if (iRes == 2) {
- CMStringA szAttachment(FORMAT, szAttachmentMasks[i], iOwner, iId);
+ CMStringA szAttachment(FORMAT, it, iOwner, iId);
CMStringA szAttachment2;
if (nextpos)
@@ -934,11 +934,11 @@ CMStringW CVkProto::SpanVKNotificationType(CMStringW& wszType, VKObjType& vkFeed
CMStringW wszRes;
vkFeedback = vkParent = vkNull;
- for (int i = 0; i < _countof(vkNotification); i++)
- if (wszType == vkNotification[i].pwszType) {
- vkFeedback = vkNotification[i].vkFeedback;
- vkParent = vkNotification[i].vkParent;
- wszRes = vkNotification[i].pwszTranslate;
+ for (auto &it : vkNotification)
+ if (wszType == it.pwszType) {
+ vkFeedback = it.vkFeedback;
+ vkParent = it.vkParent;
+ wszRes = it.pwszTranslate;
break;
}
return wszRes;
@@ -952,8 +952,8 @@ CMStringW CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC)
return wszRes;
CMStringW wszLink, wszPreviewLink;
- for (int i = 0; i < _countof(szImageTypes); i++) {
- const JSONNode &n = jnPhoto[szImageTypes[i]];
+ for (auto &it : szImageTypes) {
+ const JSONNode &n = jnPhoto[it];
if (n) {
wszLink = n.as_mstring();
break;
@@ -1022,9 +1022,9 @@ CMStringW CVkProto::SetBBCString(LPCWSTR pwszString, BBCSupport iBBC, VKBBCType
return CMStringW();
wchar_t *pwszFormat = nullptr;
- for (int i = 0; i < _countof(bbcItem); i++)
- if (bbcItem[i].vkBBCType == bbcType && bbcItem[i].vkBBCSettings == iBBC) {
- pwszFormat = bbcItem[i].pwszTempate;
+ for (auto &it : bbcItem)
+ if (it.vkBBCType == bbcType && it.vkBBCSettings == iBBC) {
+ pwszFormat = it.pwszTempate;
break;
}
@@ -1178,8 +1178,8 @@ CMStringW CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport
}
else {
CMStringW wszLink;
- for (int i = 0; i < _countof(szImageTypes); i++) {
- const JSONNode &n = jnSticker[szImageTypes[i]];
+ for (auto &it : szImageTypes) {
+ const JSONNode &n = jnSticker[it];
if (n) {
wszLink = n.as_mstring();
break;
@@ -1251,8 +1251,8 @@ CMStringW CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport
continue;
CMStringW wszLink;
- for (int i = 0; i < _countof(szGiftTypes); i++) {
- const JSONNode &n = jnGift[szGiftTypes[i]];
+ for (auto &it : szGiftTypes) {
+ const JSONNode &n = jnGift[it];
if (n) {
wszLink = n.as_mstring();
break;
@@ -1397,9 +1397,9 @@ CMStringW CVkProto::RemoveBBC(CMStringW& wszSrc)
CMStringW wszLow(wszSrc);
wszLow.MakeLower();
- for (int i = 0; i < _countof(wszSimpleBBCodes); i++) {
- CMStringW wszOpenTag(wszSimpleBBCodes[i][0]);
- CMStringW wszCloseTag(wszSimpleBBCodes[i][1]);
+ for (auto &it : wszSimpleBBCodes) {
+ CMStringW wszOpenTag(it[0]);
+ CMStringW wszCloseTag(it[1]);
int lenOpen = wszOpenTag.GetLength();
int lenClose = wszCloseTag.GetLength();
@@ -1423,9 +1423,9 @@ CMStringW CVkProto::RemoveBBC(CMStringW& wszSrc)
}
}
- for (int i = 0; i < _countof(wszParamBBCodes); i++) {
- CMStringW wszOpenTag(wszParamBBCodes[i][0]);
- CMStringW wszCloseTag(wszParamBBCodes[i][1]);
+ for (auto &it : wszParamBBCodes) {
+ CMStringW wszOpenTag(it[0]);
+ CMStringW wszCloseTag(it[1]);
int lenOpen = wszOpenTag.GetLength();
int lenClose = wszCloseTag.GetLength();
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index 4540783d48..a9016dde16 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -458,15 +458,15 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, VKContactTy
int iInteres = 0;
- for (int i = 0; i < _countof(vkInteres); i++) {
- wszValue = jnItem[vkInteres[i].szField].as_mstring();
+ for (auto &it : vkInteres) {
+ wszValue = jnItem[it.szField].as_mstring();
if (wszValue.IsEmpty())
continue;
CMStringA InteresCat(FORMAT, "Interest%dCat", iInteres);
CMStringA InteresText(FORMAT, "Interest%dText", iInteres);
- setWString(hContact, InteresCat, vkInteres[i].pwszTranslate);
+ setWString(hContact, InteresCat, it.pwszTranslate);
setWString(hContact, InteresText, wszValue);
iInteres++;