summaryrefslogtreecommitdiff
path: root/plugins/Clist_nicer/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-02-21 18:29:48 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-02-21 18:40:13 +0300
commit9ceaf3659acce44d579c2db5b29d4b48dfe893f2 (patch)
tree5f1dc306e59c567c4d857d3e7519299c85941206 /plugins/Clist_nicer/src
parent877a1c362c0b106b251cf353f77397d1b5b08b42 (diff)
Clist_Nicer: C++'11 iterators
Diffstat (limited to 'plugins/Clist_nicer/src')
-rw-r--r--plugins/Clist_nicer/src/clc.cpp4
-rw-r--r--plugins/Clist_nicer/src/clistevents.cpp9
-rw-r--r--plugins/Clist_nicer/src/cluiframes.cpp4
-rw-r--r--plugins/Clist_nicer/src/config.cpp4
-rw-r--r--plugins/Clist_nicer/src/extBackg.cpp31
-rw-r--r--plugins/Clist_nicer/src/viewmodes.cpp4
6 files changed, 22 insertions, 34 deletions
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp
index 289c3b4ce8..a19b8307cc 100644
--- a/plugins/Clist_nicer/src/clc.cpp
+++ b/plugins/Clist_nicer/src/clc.cpp
@@ -194,8 +194,8 @@ int ClcShutdown(WPARAM, LPARAM)
CSH_Destroy();
IMG_DeleteItems();
- for (int i = 0; i < arStatusItems.getCount(); i++)
- mir_free(arStatusItems[i]);
+ for (auto &it : arStatusItems)
+ mir_free(it);
return 0;
}
diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp
index c73232be64..288d55cdcc 100644
--- a/plugins/Clist_nicer/src/clistevents.cpp
+++ b/plugins/Clist_nicer/src/clistevents.cpp
@@ -66,11 +66,10 @@ void HideShowNotifyFrame()
static CLISTEVENT* MyGetEvent(int iSelection)
{
- for (int i = 0; i < pcli->events->getCount(); i++) {
- CListEvent &p = (*pcli->events)[i];
- if (p.menuId == iSelection)
- return &p;
- }
+ for (auto &p : *pcli->events)
+ if (p->menuId == iSelection)
+ return p;
+
return nullptr;
}
diff --git a/plugins/Clist_nicer/src/cluiframes.cpp b/plugins/Clist_nicer/src/cluiframes.cpp
index d0aa91a8ce..97eae87e5f 100644
--- a/plugins/Clist_nicer/src/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/cluiframes.cpp
@@ -1335,8 +1335,8 @@ static int CLUIFramesLoadMainMenu()
if (FramesSysNotStarted)
return -1;
- for (int i = 0; i < g_frameMenus.getCount(); i++)
- Menu_RemoveItem(g_frameMenus[i]);
+ for (auto &it : g_frameMenus)
+ Menu_RemoveItem(it);
g_frameMenus.destroy();
// create frames menu
diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp
index 9f9413bec6..010a29cdfa 100644
--- a/plugins/Clist_nicer/src/config.cpp
+++ b/plugins/Clist_nicer/src/config.cpp
@@ -66,10 +66,8 @@ TExtraCache* cfg::getCache(const MCONTACT hContact, const char *szProto)
void ReloadSkinItemsToCache()
{
- for (int i = 0; i < cfg::arCache.getCount(); i++) {
- TExtraCache *p = cfg::arCache[i];
+ for (auto &p : cfg::arCache)
LoadSkinItemToCache(p);
- }
}
void CSH_Destroy()
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp
index 182f17b269..913cd0ed4a 100644
--- a/plugins/Clist_nicer/src/extBackg.cpp
+++ b/plugins/Clist_nicer/src/extBackg.cpp
@@ -295,8 +295,7 @@ void LoadExtBkSettingsFromDB()
arStatusItems.insert(p);
}
- for (int n = 0; n < arStatusItems.getCount(); n++) {
- StatusItems_t *p = arStatusItems[n];
+ for (auto &p : arStatusItems) {
if (p->statusID == ID_EXTBKSEPARATOR)
continue;
@@ -333,8 +332,7 @@ void LoadExtBkSettingsFromDB()
// writes whole struct to the database
static void SaveCompleteStructToDB()
{
- for (int n = 0; n < arStatusItems.getCount(); n++) {
- StatusItems_t *p = arStatusItems[n];
+ for (auto &p : arStatusItems) {
if (p->statusID != ID_EXTBKSEPARATOR) {
char buffer[255];
mir_snprintf(buffer, "%s_IGNORE", p->szDBname);
@@ -464,8 +462,7 @@ void extbk_export(char *file)
data = 3;
WritePrivateProfileStructA("Global", "Version", &data, 4, file);
- for (n = 0; n < arStatusItems.getCount(); n++) {
- StatusItems_t *p = arStatusItems[n];
+ for (auto &p : arStatusItems) {
if (p->statusID == ID_EXTBKSEPARATOR)
continue;
@@ -686,8 +683,7 @@ static void ReadItem(StatusItems_t *this_item, char *szItem, char *file)
if (mir_strcmp(buffer, "None")) {
- for (int i = 0; i < arStatusItems.getCount(); i++) {
- StatusItems_t *p = arStatusItems[i];
+ for (auto &p : arStatusItems) {
if (!_stricmp(p->szName[0] == '{' ? p->szName + 3 : p->szName, buffer)) {
defaults = p;
break;
@@ -752,7 +748,7 @@ void IMG_ReadItem(const char *itemname, const char *szFileName)
char buffer[512], szItemNr[30];
char szFinalName[MAX_PATH];
HDC hdc = GetDC(pcli->hwndContactList);
- int i, n;
+ int n;
BOOL alloced = FALSE;
char szDrive[MAX_PATH], szPath[MAX_PATH];
@@ -881,8 +877,8 @@ done_with_glyph:
}
continue;
}
- for (i = 0; i < arStatusItems.getCount(); i++) {
- StatusItems_t *p = arStatusItems[i];
+
+ for (auto &p : arStatusItems) {
if (!_stricmp(p->szName[0] == '{' ? p->szName + 3 : p->szName, buffer)) {
if (!alloced) {
if (!(tmpItem.dwFlags & IMAGE_GLYPH))
@@ -919,8 +915,6 @@ void IMG_DeleteItems()
ImageItem *pItem = g_ImageItems, *pNextItem;
ButtonItem *pbItem = g_ButtonItems, *pbNextItem;
- int i;
-
while (pItem) {
IMG_DeleteItem(pItem);
pNextItem = pItem->nextItem;
@@ -948,8 +942,8 @@ void IMG_DeleteItems()
}
g_glyphItem = nullptr;
- for (i = 0; i < arStatusItems.getCount(); i++)
- arStatusItems[i]->imageItem = nullptr;
+ for (auto &it : arStatusItems)
+ it->imageItem = nullptr;
}
static UINT nextButtonID = IDC_TBFIRSTUID;
@@ -1320,13 +1314,12 @@ void LoadPerContactSkins(wchar_t *tszFileName)
void extbk_import(char *file, HWND hwndDlg)
{
- int n, i;
+ int i;
char buffer[255];
char szKey[255], szSection[255];
DWORD data, version = 0;
- for (n = 0; n < arStatusItems.getCount(); n++) {
- StatusItems_t *p = arStatusItems[n];
+ for (auto &p : arStatusItems) {
if (p->statusID == ID_EXTBKSEPARATOR)
continue;
@@ -1361,7 +1354,7 @@ void extbk_import(char *file, HWND hwndDlg)
data = 0;
GetPrivateProfileStructA("Global", "Version", &version, 4, file);
if (version >= 2) {
- for (n = 0; n <= FONTID_LAST; n++) {
+ for (int n = 0; n <= FONTID_LAST; n++) {
mir_snprintf(szSection, "Font%d", n);
mir_snprintf(szKey, "Font%dName", n);
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp
index eb38ffa2d8..61c058a65d 100644
--- a/plugins/Clist_nicer/src/viewmodes.cpp
+++ b/plugins/Clist_nicer/src/viewmodes.cpp
@@ -1071,10 +1071,8 @@ void ApplyViewMode(const char *name)
BYTE bSaved = cfg::dat.sortOrder[0];
cfg::dat.sortOrder[0] = SORTBY_LASTMSG;
- for (int i = 0; i < cfg::arCache.getCount(); i++) {
- TExtraCache *p = cfg::arCache[i];
+ for (auto &p : cfg::arCache)
p->dwLastMsgTime = INTSORT_GetLastMsgTime(p->hContact);
- }
cfg::dat.sortOrder[0] = bSaved;