From 17501083ca15adc9e3f53757b47a961ed2e77e9c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 27 Aug 2015 21:42:44 +0000 Subject: warning fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@15051 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PluginUpdater/src/DlgListNew.cpp | 6 +++--- plugins/PluginUpdater/src/DlgUpdate.cpp | 12 ++++++------ plugins/PluginUpdater/src/Events.cpp | 13 ++++++------- plugins/PluginUpdater/src/PluginUpdater.cpp | 8 ++++---- plugins/PluginUpdater/src/Utils.cpp | 10 +++++----- plugins/PluginUpdater/src/stdafx.h | 2 +- 6 files changed, 25 insertions(+), 26 deletions(-) (limited to 'plugins/PluginUpdater') diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index d144b5cd35..60f3d2a623 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -53,10 +53,10 @@ static void ApplyDownloads(void *param) //create needed folders after escalating priviledges. Folders creates when we actually install updates TCHAR tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH]; - mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), tszRoot); + mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), g_tszRoot); SafeCreateDirectory(tszFileBack); - mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), tszRoot); + mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), g_tszRoot); SafeCreateDirectory(tszFileTemp); VARST tszMirandaPath(_T("%miranda_path%")); @@ -355,7 +355,7 @@ static FILEINFO* ServerEntryToFileInfo(const ServListEntry &hash, const TCHAR* t tp = _tcschr(tszRelFileName, L'\\'); if (tp) tp++; else tp = tszRelFileName; _tcslwr(tp); - mir_sntprintf(FileInfo->File.tszDiskPath, _countof(FileInfo->File.tszDiskPath), _T("%s\\Temp\\%s.zip"), tszRoot, tszFileName); + mir_sntprintf(FileInfo->File.tszDiskPath, _countof(FileInfo->File.tszDiskPath), _T("%s\\Temp\\%s.zip"), g_tszRoot, tszFileName); mir_sntprintf(FileInfo->File.tszDownloadURL, _countof(FileInfo->File.tszDownloadURL), _T("%s/%s.zip"), tszBaseUrl, tszRelFileName); for (tp = _tcschr(FileInfo->File.tszDownloadURL, '\\'); tp != 0; tp = _tcschr(tp, '\\')) *tp++ = '/'; diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 6030a73d4c..8b77616451 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -59,9 +59,9 @@ static void ApplyUpdates(void *param) HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES); //create needed folders after escalating priviledges. Folders creates when we actually install updates TCHAR tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH]; - mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), tszRoot); + mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), g_tszRoot); SafeCreateDirectory(tszFileBack); - mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), tszRoot); + mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), g_tszRoot); SafeCreateDirectory(tszFileTemp); // 2) Download all plugins @@ -377,10 +377,10 @@ static void DlgUpdateSilent(void *param) //create needed folders after escalating priviledges. Folders creates when we actually install updates TCHAR tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH]; - mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), tszRoot); + mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), g_tszRoot); SafeCreateDirectory(tszFileBack); - mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), tszRoot); + mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), g_tszRoot); SafeCreateDirectory(tszFileTemp); // 2) Download all plugins @@ -589,7 +589,7 @@ static bool isValidExtension(const TCHAR *ptszFileName) static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const TCHAR *tszBaseUrl, SERVLIST& hashes, OBJLIST *UpdateFiles) { // skip updater's own folder - if (!_tcsicmp(tszFolder, tszRoot)) + if (!_tcsicmp(tszFolder, g_tszRoot)) return 0; // skip profile folder @@ -709,7 +709,7 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const p = (p) ? p + 1 : tszBuf; _tcslwr(p); - mir_sntprintf(FileInfo->File.tszDiskPath, _countof(FileInfo->File.tszDiskPath), _T("%s\\Temp\\%s.zip"), tszRoot, p); + mir_sntprintf(FileInfo->File.tszDiskPath, _countof(FileInfo->File.tszDiskPath), _T("%s\\Temp\\%s.zip"), g_tszRoot, p); mir_sntprintf(FileInfo->File.tszDownloadURL, _countof(FileInfo->File.tszDownloadURL), _T("%s/%s.zip"), tszBaseUrl, tszBuf); for (p = _tcschr(FileInfo->File.tszDownloadURL, '\\'); p != 0; p = _tcschr(p, '\\')) *p++ = '/'; diff --git a/plugins/PluginUpdater/src/Events.cpp b/plugins/PluginUpdater/src/Events.cpp index ee9d124113..41e730b449 100644 --- a/plugins/PluginUpdater/src/Events.cpp +++ b/plugins/PluginUpdater/src/Events.cpp @@ -23,10 +23,10 @@ HANDLE hPluginUpdaterFolder; int OnFoldersChanged(WPARAM, LPARAM) { - FoldersGetCustomPathT(hPluginUpdaterFolder, tszRoot, MAX_PATH, _T("")); - size_t len = _tcslen(tszRoot); - if (tszRoot[len-1] == '\\' || tszRoot[len-1] == '/') - tszRoot[len-1] = 0; + FoldersGetCustomPathT(hPluginUpdaterFolder, g_tszRoot, MAX_PATH, _T("")); + size_t len = _tcslen(g_tszRoot); + if (g_tszRoot[len-1] == '\\' || g_tszRoot[len-1] == '/') + g_tszRoot[len-1] = 0; return 0; } @@ -35,7 +35,7 @@ void EmptyFolder() SHFILEOPSTRUCT file_op = { NULL, FO_DELETE, - tszRoot, + g_tszRoot, _T(""), FOF_NOERRORUI | FOF_SILENT | FOF_NOCONFIRMATION, false, @@ -50,8 +50,7 @@ int ModulesLoaded(WPARAM, LPARAM) HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged); OnFoldersChanged(0, 0); } - else - lstrcpyn(tszRoot, VARST( _T("%miranda_path%\\" DEFAULT_UPDATES_FOLDER)), _countof(tszRoot)); + else lstrcpyn(g_tszRoot, VARST( _T("%miranda_path%\\" DEFAULT_UPDATES_FOLDER)), _countof(g_tszRoot)); #if MIRANDA_VER >= 0x0A00 if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index a360721322..b32b7be729 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA. #include "stdafx.h" HINSTANCE hInst = NULL; -TCHAR tszRoot[MAX_PATH] = {0}, tszTempPath[MAX_PATH]; +TCHAR g_tszRoot[MAX_PATH] = {0}, g_tszTempPath[MAX_PATH]; int hLangpack; DWORD g_mirandaVersion; @@ -73,9 +73,9 @@ extern "C" __declspec(dllexport) int Load(void) db_set_b(NULL, MODNAME, DB_SETTING_NEED_RESTART, 0); - DWORD dwLen = GetTempPath( _countof(tszTempPath), tszTempPath); - if (tszTempPath[dwLen-1] == '\\') - tszTempPath[dwLen-1] = 0; + DWORD dwLen = GetTempPath(_countof(g_tszTempPath), g_tszTempPath); + if (g_tszTempPath[dwLen-1] == '\\') + g_tszTempPath[dwLen-1] = 0; LoadOptions(); InitPopupList(); diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 33db2655d8..8b983b49da 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -152,7 +152,7 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes) // Download version info FILEURL pFileUrl; mir_sntprintf(pFileUrl.tszDownloadURL, _countof(pFileUrl.tszDownloadURL), _T("%s/hashes.zip"), baseUrl); - mir_sntprintf(pFileUrl.tszDiskPath, _countof(pFileUrl.tszDiskPath), _T("%s\\hashes.zip"), tszTempPath); + mir_sntprintf(pFileUrl.tszDiskPath, _countof(pFileUrl.tszDiskPath), _T("%s\\hashes.zip"), g_tszTempPath); pFileUrl.CRCsum = 0; HANDLE nlc; @@ -166,7 +166,7 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes) return false; } - if(!unzip(pFileUrl.tszDiskPath, tszTempPath, NULL,true)) { + if(!unzip(pFileUrl.tszDiskPath, g_tszTempPath, NULL,true)) { Netlib_LogfT(hNetlibUser,_T("Unzipping list of available updates from %s failed"),baseUrl); ShowPopup(TranslateT("Plugin Updater"), TranslateT("An error occurred while checking for new updates."), POPUP_TYPE_ERROR); SkinPlaySound("updatefailed"); @@ -176,10 +176,10 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes) DeleteFile(pFileUrl.tszDiskPath); TCHAR tszTmpIni[MAX_PATH] = {0}; - mir_sntprintf(tszTmpIni, _countof(tszTmpIni), _T("%s\\hashes.txt"), tszTempPath); + mir_sntprintf(tszTmpIni, _countof(tszTmpIni), _T("%s\\hashes.txt"), g_tszTempPath); FILE *fp = _tfopen(tszTmpIni, _T("r")); if (!fp) { - Netlib_LogfT(hNetlibUser,_T("Opening %s failed"), tszTempPath); + Netlib_LogfT(hNetlibUser,_T("Opening %s failed"), g_tszTempPath); ShowPopup(TranslateT("Plugin Updater"), TranslateT("An error occurred while checking for new updates."), POPUP_TYPE_ERROR); return false; } @@ -284,7 +284,7 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) else { // try to write it via PU stub TCHAR tszTempFile[MAX_PATH]; - mir_sntprintf(tszTempFile, _countof(tszTempFile), _T("%s\\pulocal.tmp"), tszTempPath); + mir_sntprintf(tszTempFile, _countof(tszTempFile), _T("%s\\pulocal.tmp"), g_tszTempPath); hFile = CreateFile(tszTempFile, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile != INVALID_HANDLE_VALUE) { DWORD dwBytes; diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index 98b4db6c47..146c1ac49c 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -146,7 +146,7 @@ using namespace std; extern HINSTANCE hInst; extern DWORD g_mirandaVersion; -extern TCHAR tszRoot[MAX_PATH], tszTempPath[MAX_PATH]; +extern TCHAR g_tszRoot[MAX_PATH], g_tszTempPath[MAX_PATH]; extern aPopups PopupsList[POPUPS]; extern HANDLE hPipe, hNetlibUser; #if MIRANDA_VER >= 0x0A00 -- cgit v1.2.3