From bb583302ec9f478eebd3b57d06a476a5d82730c6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 10 Mar 2018 22:02:54 +0300 Subject: this nasty clutch isn't needed for a long time --- src/mir_app/src/database.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3