From bf52c6896700d435d9623d27d74e595c504dff08 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 5 Oct 2023 12:50:02 +0300 Subject: code cleaning --- plugins/PluginUpdater/src/DlgUpdate.cpp | 9 ++++----- plugins/PluginUpdater/src/Utils.cpp | 10 ---------- plugins/PluginUpdater/src/stdafx.h | 2 -- plugins/PluginUpdater/src/unzipfile.cpp | 2 +- 4 files changed, 5 insertions(+), 18 deletions(-) (limited to 'plugins/PluginUpdater/src') diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index d93f499a7a..492a3fdfdb 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -149,7 +149,7 @@ LBL_Error: m_list.SetCheckState(m_todo->indexOf(&it), bEnable); CMStringA szSetting(it->wszOldName); - db_set_b(0, DB_MODULE_FILES, StrToLower(szSetting.GetBuffer()), it->bEnabled = bEnable); + db_set_b(0, DB_MODULE_FILES, szSetting.MakeLower(), it->bEnabled = bEnable); } } @@ -287,7 +287,7 @@ public: FILEINFO *p = (FILEINFO *)lvI.lParam; CMStringA szSetting(p->wszOldName); - db_set_b(0, DB_MODULE_FILES, StrToLower(szSetting.GetBuffer()), p->bEnabled = m_list.GetCheckState(nmlv->iItem)); + db_set_b(0, DB_MODULE_FILES, szSetting.MakeLower(), p->bEnabled = m_list.GetCheckState(nmlv->iItem)); // Toggle the Download button bool enableOk = false; @@ -716,14 +716,13 @@ static int ScanFolder(const wchar_t *pwszFolder, size_t cbBaseLen, const wchar_t } CMStringA szSetting(wszBuf.c_str() + cbBaseLen); - int bEnabled = db_get_b(0, DB_MODULE_FILES, StrToLower(szSetting.GetBuffer()), 1); + int bEnabled = db_get_b(0, DB_MODULE_FILES, szSetting.MakeLower(), 1); if (bEnabled == 2) // hidden database setting to exclude a plugin from list continue; // Yeah, we've got new version. FILEINFO *FileInfo = new FILEINFO; - // copy the relative old name - wcsncpy_s(FileInfo->wszOldName, wszBuf.c_str() + cbBaseLen, _TRUNCATE); + wcsncpy_s(FileInfo->wszOldName, wszBuf.c_str() + cbBaseLen, _TRUNCATE); // copy the relative old name FileInfo->bDeleteOnly = bDeleteOnly; if (FileInfo->bDeleteOnly) // save the full old name for deletion wcsncpy_s(FileInfo->wszNewName, wszBuf, _TRUNCATE); diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 0ba835a2e0..b4c7afb6f9 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -313,16 +313,6 @@ int BackupFile(wchar_t *pwszSrcFileName, wchar_t *pwszBackFileName) ///////////////////////////////////////////////////////////////////////////////////////// -char* StrToLower(char *str) -{ - for (int i = 0; str[i]; i++) - str[i] = tolower(str[i]); - - return str; -} - -///////////////////////////////////////////////////////////////////////////////////////// - MFilePath InvertMirandaPlatform() { MFilePath wszPath; diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index 1b12ca6606..c321f133f4 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -265,6 +265,4 @@ void CreateWorkFolders(TFileName &wszTempFolder, TFileName &wszBackupFolder); void RemoveBackupFolders(void); void RollbackChanges(TFileName &pwszBackupFolder); -char* StrToLower(char *str); - MFilePath InvertMirandaPlatform(); diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index 2dbe754af6..2f9133c929 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -45,7 +45,7 @@ int extractCurrentFile(unzFile uf, wchar_t *pwszDestPath, wchar_t *pwszBackPath, // This is because there may be more then one file in a single zip // So we need to check each file - if (ch && 1 != db_get_b(0, DB_MODULE_FILES, StrToLower(ptrA(mir_strdup(filename))), 1)) + if (ch && 1 != db_get_b(0, DB_MODULE_FILES, _strlwr(ptrA(mir_strdup(filename))), 1)) return UNZ_OK; TFileName wszDestFile, wszBackFile; -- cgit v1.2.3