summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/UserInfoEx/src/Flags/svc_flags.cpp4
-rw-r--r--plugins/UserInfoEx/src/classPsTree.cpp18
-rw-r--r--plugins/UserInfoEx/src/dlg_propsheet.cpp4
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp13
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp6
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp86
-rw-r--r--plugins/UserInfoEx/src/mir_contactqueue.cpp4
-rw-r--r--plugins/UserInfoEx/src/mir_db.cpp11
-rw-r--r--plugins/UserInfoEx/src/psp_options.cpp4
9 files changed, 48 insertions, 102 deletions
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
index 32f63aea4d..d0ecb3c5a7 100644
--- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp
+++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
@@ -119,8 +119,8 @@ void UpdateStatusIcons()
Srmm_ModifyIcon(NULL, &sid);
/* enum all opened message windows */
- for (int i = 0; i < gMsgWndList.getCount(); i++)
- gMsgWndList[i]->FlagsIconSet();
+ for (auto &it : gMsgWndList)
+ it->FlagsIconSet();
}
//hookProc ME_MSG_WINDOWEVENT
diff --git a/plugins/UserInfoEx/src/classPsTree.cpp b/plugins/UserInfoEx/src/classPsTree.cpp
index 2237cd4eaa..30fef64b68 100644
--- a/plugins/UserInfoEx/src/classPsTree.cpp
+++ b/plugins/UserInfoEx/src/classPsTree.cpp
@@ -572,23 +572,13 @@ void CPsTree::DBResetState()
if (!Settings.EnumSettings(NULL, MODNAME))
{
- int i;
- LPSTR s;
- LPCSTR p;
- INT_PTR c;
-
- p = (_pPs->pszProto[0]) ? _pPs->pszProto : "Owner";
- c = mir_strlen(p);
-
- for (i = 0; i < Settings.getCount(); i++)
- {
- s = Settings[i];
+ LPCSTR p = (_pPs->pszProto[0]) ? _pPs->pszProto : "Owner";
+ size_t c = mir_strlen(p);
+ for (auto &s : Settings)
if (s && *s == '{' && !mir_strncmpi(s + 1, p, c))
- {
db_unset(NULL, MODNAME, s);
- }
- }
+
// keep only these flags
_dwFlags &= PSTVF_SORTTREE|PSTVF_GROUPS;
}
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp
index 3ab88e18a0..618cf63c4f 100644
--- a/plugins/UserInfoEx/src/dlg_propsheet.cpp
+++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp
@@ -80,8 +80,8 @@ CPsHdr::CPsHdr()
CPsHdr::~CPsHdr()
{
// delete data
- for (int i = 0 ; i < _ignore.getCount(); i++)
- mir_free(_ignore[i]);
+ for (auto &it : _ignore)
+ mir_free(it);
}
void CPsHdr::Free_pPages()
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
index 1dec35ecbf..c6fa31e5ff 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
@@ -150,13 +150,8 @@ int CExImContactXML::ExportContact(DB::CEnumList* pModules)
{
if (_pXmlFile->_wExport & EXPORT_DATA) {
if (pModules) {
- int i;
- LPSTR p;
-
- for (i = 0; i < pModules->getCount(); i++) {
- p = (*pModules)[i];
- ExportModule(p);
- }
+ for (auto &it : *pModules)
+ ExportModule(it);
}
else {
ExportModule(USERINFO);
@@ -270,8 +265,8 @@ int CExImContactXML::ExportModule(LPCSTR pszModule)
return ERROR_MEMORY_ALLOC;
xmod->SetAttribute("key", pszModule);
- for (int i = 0; i < Settings.getCount(); i++)
- ExportSetting(xmod, pszModule, Settings[i]);
+ for (auto &it : Settings)
+ ExportSetting(xmod, pszModule, it);
if (!xmod->NoChildren() && _xmlNode->LinkEndChild(xmod))
return ERROR_OK;
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
index 5e72891db6..2be1bf0365 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
@@ -275,12 +275,8 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
if (!Modules.EnumModules()) // init Modul list
{
- int i;
- LPSTR p;
-
- for (i = 0; i < Modules.getCount(); i++)
+ for (auto &p : Modules)
{
- p = Modules[i];
/*Filter/
if (!DB::Module::IsMeta(p))/end Filter*/
{
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
index 62b19ea7c7..8c55ff4aae 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
@@ -47,70 +47,52 @@ static void ExportModule(MCONTACT hContact, LPCSTR pszModule, FILE* file)
LPSTR here;
WORD j;
int i;
- LPSTR pszSetting;
//char tmp[32];
// print the module header..
fprintf(file, "\n[%s]\n", pszModule);
- for (i = 0; i < Settings.getCount(); i++)
- {
- pszSetting = Settings[i];
-
- if (!DB::Setting::GetAsIs(hContact, pszModule, pszSetting, &dbv))
- {
- switch (dbv.type)
- {
+ for (auto &it : Settings) {
+ if (!DB::Setting::GetAsIs(hContact, pszModule, it, &dbv)) {
+ switch (dbv.type) {
case DBVT_BYTE:
- {
- fprintf(file, "%s=b%u\n", pszSetting, dbv.bVal);
- }
+ fprintf(file, "%s=b%u\n", it, dbv.bVal);
break;
case DBVT_WORD:
- {
- fprintf(file, "%s=w%u\n", pszSetting, dbv.wVal);
- }
+ fprintf(file, "%s=w%u\n", it, dbv.wVal);
break;
case DBVT_DWORD:
- {
- fprintf(file, "%s=d%u\n", pszSetting, dbv.dVal);
- }
+ fprintf(file, "%s=d%u\n", it, dbv.dVal);
break;
case DBVT_ASCIIZ:
case DBVT_UTF8:
+ for (here = dbv.pszVal; here && *here; here++)
{
- for (here = dbv.pszVal; here && *here; here++)
- {
- switch (*here) {
- // convert \r to STX
- case '\r':
- *here = 2;
- break;
-
- // convert \n to ETX
- case '\n':
- *here = 3;
- }
+ switch (*here) {
+ // convert \r to STX
+ case '\r':
+ *here = 2;
+ break;
+
+ // convert \n to ETX
+ case '\n':
+ *here = 3;
}
- if (dbv.type == DBVT_UTF8)
- fprintf(file, "%s=u%s\n", pszSetting, dbv.pszVal);
- else
- fprintf(file, "%s=s%s\n", pszSetting, dbv.pszVal);
}
+ if (dbv.type == DBVT_UTF8)
+ fprintf(file, "%s=u%s\n", it, dbv.pszVal);
+ else
+ fprintf(file, "%s=s%s\n", it, dbv.pszVal);
break;
case DBVT_BLOB:
- {
- fprintf(file, "%s=n", pszSetting);
- for (j = 0; j < dbv.cpbVal; j++)
- {
- fprintf(file, "%02X ", (BYTE)dbv.pbVal[j]);
- }
- fputc('\n', file);
- }
+ fprintf(file, "%s=n", it);
+ for (j = 0; j < dbv.cpbVal; j++)
+ fprintf(file, "%02X ", (BYTE)dbv.pbVal[j]);
+ fputc('\n', file);
break;
}
db_free(&dbv);
@@ -130,25 +112,13 @@ static BYTE ExportContact(MCONTACT hContact, DB::CEnumList* pModules, FILE* file
{
CExImContactBase vcc;
- if (pModules)
- {
- if ((vcc = hContact) >= NULL)
- {
- int i;
- LPSTR p;
-
+ if (pModules) {
+ if ((vcc = hContact) >= NULL) {
vcc.toIni(file, pModules->getCount()-1);
- for (i = 0; i < pModules->getCount(); i++)
- {
- p = (*pModules)[i];
+ for (auto &it : *pModules)
+ ExportModule(hContact, it, file);
- /*Filter/
- if (mir_strcmpi(p, "Protocol"))*/
- {
- ExportModule(hContact, p, file);
- }
- }
return TRUE;
}
}
diff --git a/plugins/UserInfoEx/src/mir_contactqueue.cpp b/plugins/UserInfoEx/src/mir_contactqueue.cpp
index c9f22502b3..9a734ba968 100644
--- a/plugins/UserInfoEx/src/mir_contactqueue.cpp
+++ b/plugins/UserInfoEx/src/mir_contactqueue.cpp
@@ -51,8 +51,8 @@ CContactQueue::~CContactQueue()
for (int count = 0; _status != STOPPED && ++count < 50;)
Sleep(10);
- for (int i = 0; i < _queue.getCount(); i++)
- mir_free(_queue[i]);
+ for (auto &it : _queue)
+ mir_free(it);
CloseHandle(_hEvent);
}
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp
index e4eb8bf2d2..f659d37637 100644
--- a/plugins/UserInfoEx/src/mir_db.cpp
+++ b/plugins/UserInfoEx/src/mir_db.cpp
@@ -65,8 +65,8 @@ void Delete(MCONTACT hContact, LPCSTR pszModule)
{
CEnumList Settings;
if (!Settings.EnumSettings(hContact, pszModule))
- for (int i = 0; i < Settings.getCount(); i++)
- db_unset(hContact, pszModule, Settings[i]);
+ for (auto &it : Settings)
+ db_unset(hContact, pszModule, it);
}
/**
@@ -701,11 +701,8 @@ CEnumList::CEnumList() : LIST<CHAR>(50, CEnumList::CompareProc)
CEnumList::~CEnumList()
{
- for (int i = 0, cnt = getCount(); i < cnt; i++) {
- LPSTR p = (*this)[i];
- if (p)
- mir_free(p);
- }
+ for (auto &it : *this)
+ mir_free(it);
}
LPSTR CEnumList::Insert(LPCSTR str)
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp
index f878983d09..e4481391ad 100644
--- a/plugins/UserInfoEx/src/psp_options.cpp
+++ b/plugins/UserInfoEx/src/psp_options.cpp
@@ -457,11 +457,9 @@ static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam
// delete all skin icons
if (!Settings.EnumSettings(NULL, "SkinIcons"))
- for (int i = 0; i < Settings.getCount(); i++) {
- LPSTR s = Settings[i];
+ for (auto &s : Settings)
if (mir_strncmpi(s, "UserInfoEx", 10) == 0)
db_unset(NULL, "SkinIcons", s);
- }
// delete global settings
DB::Module::Delete(NULL, USERINFO"Ex");