From f15f4d589ab7e2ad7f4112c42f83edcee8924482 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Fri, 6 Feb 2015 17:43:31 +0000 Subject: PluginUpdater: -performance improvements git-svn-id: http://svn.miranda-ng.org/main/trunk@12024 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PluginUpdater/src/Utils.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'plugins') diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 897950ecc5..18e0033ea8 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -240,20 +240,15 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes) return false; } + bool bDoNotSwitchToStable = false; char str[200]; while(fgets(str, SIZEOF(str), fp) != NULL) { rtrim(str); - if (str[0] == ';') { - db_unset(NULL, MODNAME, DB_SETTING_DONT_SWITCH_TO_STABLE); + // Do not allow the user to switch back to stable + if (!strcmp(str, "DoNotSwitchToStable")) { + bDoNotSwitchToStable = true; } - else if (!strcmp(str, "DoNotSwitchToStable")) { - db_set_b(NULL, MODNAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 1); - // Reset setting if needed - int UpdateMode = db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE); - if (UpdateMode == UPDATE_MODE_STABLE) - db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK); - } - else { + else if (str[0] != ';') { // ';' marks a comment Netlib_Logf(hNetlibUser, "Update: %s", str); char *p = strchr(str, ' '); if (p != NULL) { @@ -274,6 +269,17 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes) } fclose(fp); DeleteFile(tszTmpIni); + + if (bDoNotSwitchToStable) { + db_set_b(NULL, MODNAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 1); + // Reset setting if needed + int UpdateMode = db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE); + if (UpdateMode == UPDATE_MODE_STABLE) + db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK); + } + else + db_set_b(NULL, MODNAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 0); + return true; } -- cgit v1.2.3