summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-10 22:02:54 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-10 22:02:54 +0300
commitbb583302ec9f478eebd3b57d06a476a5d82730c6 (patch)
tree027c302660684340823f0e833cdb49757acdf814 /src
parentd04454be20272e2d9db3a6546a4ad7d373ca4571 (diff)
this nasty clutch isn't needed for a long time
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/database.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/mir_app/src/database.cpp b/src/mir_app/src/database.cpp
index ad96bd3245..939599aafc 100644
--- a/src/mir_app/src/database.cpp
+++ b/src/mir_app/src/database.cpp
@@ -358,17 +358,16 @@ char* makeFileName(const wchar_t* tszOriginalName)
int touchDatabase(const wchar_t *tszProfile, DATABASELINK **dblink)
{
- for (int i = arDbPlugins.getCount() - 1; i >= 0; i--) {
- DATABASELINK *p = arDbPlugins[i];
- int iErrorCode = p->grokHeader(tszProfile);
+ for (auto &it : arDbPlugins) {
+ int iErrorCode = it->grokHeader(tszProfile);
if (iErrorCode == 0) {
if (dblink)
- *dblink = p;
+ *dblink = it;
return 0;
}
if (iErrorCode == EGROKPRF_OBSOLETE) {
if (dblink)
- *dblink = p;
+ *dblink = it;
return EGROKPRF_OBSOLETE;
}
}
@@ -381,11 +380,9 @@ int touchDatabase(const wchar_t *tszProfile, DATABASELINK **dblink)
// enumerate all plugins that had valid DatabasePluginInfo()
int tryOpenDatabase(const wchar_t *tszProfile)
{
- for (int i = arDbPlugins.getCount() - 1; i >= 0; i--) {
- DATABASELINK *p = arDbPlugins[i];
-
+ for (auto &it : arDbPlugins) {
// liked the profile?
- int err = p->grokHeader(tszProfile);
+ int err = it->grokHeader(tszProfile);
if (err != ERROR_SUCCESS) { // smth went wrong
switch (err) {
case EGROKPRF_CANTREAD:
@@ -404,12 +401,12 @@ int tryOpenDatabase(const wchar_t *tszProfile)
}
// try to load database
- MIDatabase *pDb = p->Load(tszProfile, FALSE);
+ MIDatabase *pDb = it->Load(tszProfile, FALSE);
if (pDb == nullptr)
return EGROKPRF_CANTREAD;
fillProfileName(tszProfile);
- currDblink = p;
+ currDblink = it;
db_setCurrent(currDb = pDb);
return 0;
}