summaryrefslogtreecommitdiff
path: root/plugins/FavContacts
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-02-21 18:40:03 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-02-21 18:40:14 +0300
commit477a6ea70d0bb1b1dfe9cbd9a15b6dad0284ddeb (patch)
tree247eed13a5231c3983e343f0b7fc2a95012353c2 /plugins/FavContacts
parent9d0174ebe2bd005418855b18f737c36d5c20ab4a (diff)
all another C++'11 iterators
Diffstat (limited to 'plugins/FavContacts')
-rw-r--r--plugins/FavContacts/src/contact_cache.cpp4
-rw-r--r--plugins/FavContacts/src/favlist.h4
-rw-r--r--plugins/FavContacts/src/menu.cpp10
3 files changed, 9 insertions, 9 deletions
diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp
index d6039f3782..d60cd00d84 100644
--- a/plugins/FavContacts/src/contact_cache.cpp
+++ b/plugins/FavContacts/src/contact_cache.cpp
@@ -19,8 +19,8 @@ CContactCache::CContactCache() :
CContactCache::~CContactCache()
{
- for (int i = 0; i < m_cache.getCount(); i++)
- delete m_cache[i];
+ for (auto &it : m_cache)
+ delete it;
}
int __cdecl CContactCache::OnDbEventAdded(WPARAM hContact, LPARAM hEvent)
diff --git a/plugins/FavContacts/src/favlist.h b/plugins/FavContacts/src/favlist.h
index b6ebc70f2e..c9ed5bc2c3 100644
--- a/plugins/FavContacts/src/favlist.h
+++ b/plugins/FavContacts/src/favlist.h
@@ -99,8 +99,8 @@ public:
~TFavContacts()
{
- for (int i = 0; i < this->getCount(); ++i)
- delete (*this)[i];
+ for (auto &it : *this)
+ delete it;
}
__forceinline int groupCount() const { return nGroups; }
diff --git a/plugins/FavContacts/src/menu.cpp b/plugins/FavContacts/src/menu.cpp
index f0c8e1072e..4770696e65 100644
--- a/plugins/FavContacts/src/menu.cpp
+++ b/plugins/FavContacts/src/menu.cpp
@@ -458,21 +458,21 @@ int ShowMenu(bool centered)
g_maxItemWidth /= favList.groupCount();
prevGroup = nullptr;
- for (int i = 0; i < favList.getCount(); ++i) {
- hContact = favList[i]->getHandle();
+ for (auto &it : favList) {
+ hContact = it->getHandle();
MEASUREITEMSTRUCT mis = { 0 };
mis.CtlID = 0;
mis.CtlType = ODT_MENU;
- if (!prevGroup || mir_wstrcmp(prevGroup, favList[i]->getGroup())) {
+ if (!prevGroup || mir_wstrcmp(prevGroup, it->getGroup())) {
if (prevGroup && g_Options.bUseColumns) {
szMenu.cx += szColumn.cx;
szMenu.cy = max(szMenu.cy, szColumn.cy);
szColumn.cx = szColumn.cy = 0;
}
- int groupID = -((INT_PTR)Clist_GroupExists(favList[i]->getGroup()) + 1);
+ int groupID = -((INT_PTR)Clist_GroupExists(it->getGroup()) + 1);
AppendMenu(hMenu,
MF_OWNERDRAW | MF_SEPARATOR | ((prevGroup && g_Options.bUseColumns) ? MF_MENUBREAK : 0),
@@ -493,7 +493,7 @@ int ShowMenu(bool centered)
szColumn.cx = max(szColumn.cx, (int)mis.itemWidth);
szColumn.cy += mis.itemHeight;
- prevGroup = favList[i]->getGroup();
+ prevGroup = it->getGroup();
}
szMenu.cx += szColumn.cx;
szMenu.cy = max(szMenu.cy, szColumn.cy);