From c370af60855db957c5b200914bf0bde743845528 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 28 Aug 2015 16:22:41 +0000 Subject: mir_sntprintf / mir_snprintf: obsoleted second parameter removed wherever possible git-svn-id: http://svn.miranda-ng.org/main/trunk@15064 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PackUpdater/Src/Notifications.cpp | 42 +++++++++++++++---------------- plugins/PackUpdater/Src/Options.cpp | 4 +-- plugins/PackUpdater/Src/Utils.cpp | 26 +++++++++---------- 3 files changed, 36 insertions(+), 36 deletions(-) (limited to 'plugins/PackUpdater/Src') diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp index 656219ef27..bbd50f4347 100644 --- a/plugins/PackUpdater/Src/Notifications.cpp +++ b/plugins/PackUpdater/Src/Notifications.cpp @@ -349,33 +349,33 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam if (todo[i].enabled) { switch (todo[i].FileType) { case 1: - mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Pack"), tszRoot); + mir_sntprintf(tszFileDest, _T("%s\\Pack"), tszRoot); CreateDirectory(tszFileDest, NULL); break; case 2: - mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Plugins"), tszRoot); + mir_sntprintf(tszFileDest, _T("%s\\Plugins"), tszRoot); CreateDirectory(tszFileDest, NULL); break; case 3: - mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Icons"), tszRoot); + mir_sntprintf(tszFileDest, _T("%s\\Icons"), tszRoot); CreateDirectory(tszFileDest, NULL); break; case 4: - mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Others"), tszRoot); + mir_sntprintf(tszFileDest, _T("%s\\Others"), tszRoot); CreateDirectory(tszFileDest, NULL); break; case 5: - mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Others"), tszRoot); + mir_sntprintf(tszFileDest, _T("%s\\Others"), tszRoot); CreateDirectory(tszFileDest, NULL); break; default: mir_tstrncpy(tszFileDest, tszRoot, _countof(tszFileDest)); break; } - mir_sntprintf(tszBuff, _countof(tszBuff), _T("%s\\Backups"), tszRoot); + mir_sntprintf(tszBuff, _T("%s\\Backups"), tszRoot); CreateDirectory(tszBuff, NULL); mir_tstrncpy(tszFileName, todo[i].File.tszDiskPath, _countof(tszFileName)); - mir_sntprintf(todo[i].File.tszDiskPath, _countof(todo[i].File.tszDiskPath), _T("%s\\%s"), tszFileDest, tszFileName); + mir_sntprintf(todo[i].File.tszDiskPath, _T("%s\\%s"), tszFileDest, tszFileName); UpdatesCount++; tszExt = &todo[i].File.tszDownloadURL[mir_tstrlen(todo[i].File.tszDownloadURL) - 5]; @@ -400,7 +400,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam } } mir_tstrncpy(todo[i].tszCurVer, todo[i].tszNewVer, _countof(todo[i].tszCurVer)); - mir_snprintf(szKey, _countof(szKey), "File_%d_CurrentVersion", todo[i].FileNum); + mir_snprintf(szKey, "File_%d_CurrentVersion", todo[i].FileNum); db_set_ts(NULL, MODNAME, szKey, todo[i].tszCurVer); arFileType.push_back(todo[i].FileType); arFilePath.push_back(todo[i].File.tszDiskPath); @@ -452,10 +452,10 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam case 2: tszUtilRootPlug = Utils_ReplaceVarsT(_T("%miranda_path%\\Plugins")); if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0) - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, arFileName[i].c_str()); + mir_sntprintf(tszFilePathDest, _T("%s\\%s"), tszUtilRootPlug, arFileName[i].c_str()); else - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootPlug, arAdvFolder[i].c_str(), arFileName[i].c_str()); - mir_sntprintf(tszFilePathBack, _countof(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str()); + mir_sntprintf(tszFilePathDest, _T("%s\\%s\\%s"), tszUtilRootPlug, arAdvFolder[i].c_str(), arFileName[i].c_str()); + mir_sntprintf(tszFilePathBack, _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str()); MoveFile(tszFilePathDest, tszFilePathBack); MoveFile(arFilePath[i].c_str(), tszFilePathDest); mir_free(tszUtilRootPlug); @@ -465,10 +465,10 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam case 3: tszUtilRootIco = Utils_ReplaceVarsT(_T("%miranda_path%\\Icons")); if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0) - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, arFileName[i].c_str()); + mir_sntprintf(tszFilePathDest, _T("%s\\%s"), tszUtilRootIco, arFileName[i].c_str()); else - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootIco, arAdvFolder[i].c_str(), arFileName[i].c_str()); - mir_sntprintf(tszFilePathBack, _countof(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str()); + mir_sntprintf(tszFilePathDest, _T("%s\\%s\\%s"), tszUtilRootIco, arAdvFolder[i].c_str(), arFileName[i].c_str()); + mir_sntprintf(tszFilePathBack, _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str()); MoveFile(tszFilePathDest, tszFilePathBack); MoveFile(arFilePath[i].c_str(), tszFilePathDest); mir_free(tszUtilRootIco); @@ -478,10 +478,10 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam case 4: tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%")); if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0) - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str()); + mir_sntprintf(tszFilePathDest, _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str()); else - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str()); - mir_sntprintf(tszFilePathBack, _countof(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str()); + mir_sntprintf(tszFilePathDest, _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str()); + mir_sntprintf(tszFilePathBack, _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str()); MoveFile(tszFilePathDest, tszFilePathBack); MoveFile(arFilePath[i].c_str(), tszFilePathDest); mir_free(tszUtilRoot); @@ -491,10 +491,10 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam case 5: tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%")); if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0) - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str()); + mir_sntprintf(tszFilePathDest, _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str()); else - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str()); - mir_sntprintf(tszFilePathBack, _countof(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str()); + mir_sntprintf(tszFilePathDest, _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str()); + mir_sntprintf(tszFilePathBack, _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str()); MoveFile(tszFilePathDest, tszFilePathBack); MoveFile(arFilePath[i].c_str(), tszFilePathDest); mir_free(tszUtilRoot); @@ -505,7 +505,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam else { //reminder for not installed pack update if (Reminder && (UpdatesCount == 1) && (arFileType[0] == 1)) db_set_b(NULL, MODNAME, "Reminder", 2); - mir_sntprintf(tszBuff, _countof(tszBuff), TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str()); + mir_sntprintf(tszBuff, TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str()); Title = TranslateT("Pack Updater"); Text = tszBuff; if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) { diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp index 53a498be66..c01a16a3e6 100644 --- a/plugins/PackUpdater/Src/Options.cpp +++ b/plugins/PackUpdater/Src/Options.cpp @@ -204,7 +204,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) //Popups nitified for (i = 0; i < POPUPS; i++) { mir_snprintf(str, "Popups%d", i); - mir_snprintf(str2, _countof(str2), "Popups%dM", i); + mir_snprintf(str2, "Popups%dM", i); CheckDlgButton(hdlg, (i + 40071), (db_get_b(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, (i + 1024), (db_get_b(NULL, MODNAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED); if (IsDlgButtonChecked(hdlg, (i + 40071))) @@ -373,7 +373,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) for (i = 0; i < POPUPS; i++) { mir_snprintf(str, "Popups%d", i); db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i + 40071)))); - mir_snprintf(str2, _countof(str2), "Popups%dM", i); + mir_snprintf(str2, "Popups%dM", i); db_set_b(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i + 1024)))); } return TRUE; diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 5c2d660079..5b9351986c 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -206,7 +206,7 @@ static void CheckUpdates(void *) // Download version info pFileUrl = (FILEURL *)mir_alloc(sizeof(*pFileUrl)); mir_tstrncpy(pFileUrl->tszDownloadURL, tszDownloadURL, _countof(pFileUrl->tszDownloadURL)); - mir_sntprintf(tszBuff, _countof(tszBuff), _T("%s\\tmp.ini"), tszRoot); + mir_sntprintf(tszBuff, _T("%s\\tmp.ini"), tszRoot); mir_tstrncpy(pFileUrl->tszDiskPath, tszBuff, _countof(pFileUrl->tszDiskPath)); mir_tstrncpy(tszTmpIni, tszBuff, _countof(tszTmpIni)); Title = TranslateT("Pack Updater"); @@ -221,14 +221,14 @@ static void CheckUpdates(void *) for (CurrentFile = 0; CurrentFile < FileCount; CurrentFile++) { FILEINFO FileInfo = { _T(""), _T(""), _T(""), _T(""), _T(""), _T(""), _T(""), { _T(""), _T("") } }; - mir_snprintf(szKey, _countof(szKey), "File_%d_CurrentVersion", CurrentFile + 1); + mir_snprintf(szKey, "File_%d_CurrentVersion", CurrentFile + 1); ptrT tszCurVer(db_get_tsa(NULL, MODNAME, szKey)); if (tszCurVer) mir_tstrncpy(FileInfo.tszCurVer, tszCurVer, _countof(FileInfo.tszCurVer)); else mir_tstrncpy(FileInfo.tszCurVer, _T(""), _countof(FileInfo.tszCurVer)); - mir_snprintf(szKey, _countof(szKey), "File_%d_LastVersion", CurrentFile + 1); + mir_snprintf(szKey, "File_%d_LastVersion", CurrentFile + 1); ptrT tszLastVer(db_get_tsa(NULL, MODNAME, szKey)); if (tszLastVer) mir_tstrncpy(FileInfo.tszLastVer, tszLastVer, _countof(FileInfo.tszLastVer)); @@ -238,7 +238,7 @@ static void CheckUpdates(void *) Files.push_back(FileInfo); // Read version info - mir_sntprintf(tszFileInfo, _countof(tszFileInfo), _T("FileInfo_%d"), CurrentFile + 1); + mir_sntprintf(tszFileInfo, _T("FileInfo_%d"), CurrentFile + 1); GetPrivateProfileString(tszFileInfo, _T("FileVersion"), _T(""), Files[CurrentFile].tszNewVer, _countof(Files[CurrentFile].tszNewVer), tszTmpIni); GetPrivateProfileString(tszFileInfo, _T("Message"), _T(""), Files[CurrentFile].tszMessage, _countof(Files[CurrentFile].tszMessage), tszTmpIni); GetPrivateProfileString(tszFileInfo, _T("DownloadURL"), _T(""), Files[CurrentFile].File.tszDownloadURL, _countof(Files[CurrentFile].File.tszDownloadURL), tszTmpIni); @@ -265,9 +265,9 @@ static void CheckUpdates(void *) if (Files[CurrentFile].FileType == 2) { if (mir_tstrcmp(Files[CurrentFile].tszAdvFolder, _T("")) == 0) - mir_sntprintf(tszBuff, _countof(tszBuff), _T("Plugins\\%s"), Files[CurrentFile].File.tszDiskPath); + mir_sntprintf(tszBuff, _T("Plugins\\%s"), Files[CurrentFile].File.tszDiskPath); else - mir_sntprintf(tszBuff, _countof(tszBuff), _T("Plugins\\%s\\%s"), Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath); + mir_sntprintf(tszBuff, _T("Plugins\\%s\\%s"), Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath); TCHAR pluginFolderName[MAX_PATH]; PathToAbsoluteT(tszBuff, pluginFolderName); if (!Files[CurrentFile].Force && (IsPluginDisabled(Files[CurrentFile].File.tszDiskPath) || !Exists(pluginFolderName))) //check if plugin disabled or not exists @@ -294,26 +294,26 @@ static void CheckUpdates(void *) case 2: { VARST tszUtilRootPlug(_T("%miranda_path%\\Plugins")); if (mir_tstrcmp(Files[CurrentFile].tszAdvFolder, _T("")) == 0) - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, Files[CurrentFile].File.tszDiskPath); + mir_sntprintf(tszFilePathDest, _T("%s\\%s"), tszUtilRootPlug, Files[CurrentFile].File.tszDiskPath); else - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootPlug, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath); + mir_sntprintf(tszFilePathDest, _T("%s\\%s\\%s"), tszUtilRootPlug, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath); } break; case 3: { VARST tszUtilRootIco(_T("%miranda_path%\\Icons")); if (mir_tstrcmp(Files[CurrentFile].tszAdvFolder, _T("")) == 0) - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, Files[CurrentFile].File.tszDiskPath); + mir_sntprintf(tszFilePathDest, _T("%s\\%s"), tszUtilRootIco, Files[CurrentFile].File.tszDiskPath); else - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootIco, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath); + mir_sntprintf(tszFilePathDest, _T("%s\\%s\\%s"), tszUtilRootIco, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath); } break; case 4: case 5: { VARST tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%")); if (mir_tstrcmp(Files[CurrentFile].tszAdvFolder, _T("")) == 0) - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, Files[CurrentFile].File.tszDiskPath); + mir_sntprintf(tszFilePathDest, _T("%s\\%s"), tszUtilRoot, Files[CurrentFile].File.tszDiskPath); else - mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath); + mir_sntprintf(tszFilePathDest, _T("%s\\%s\\%s"), tszUtilRoot, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath); } break; }//end* switch (Files[CurrentFile].FileType) @@ -322,7 +322,7 @@ static void CheckUpdates(void *) UpdateFiles.push_back(Files[CurrentFile]); // Save last version mir_tstrncpy(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, _countof(Files[CurrentFile].tszLastVer)); - mir_snprintf(szKey, _countof(szKey), "File_%d_LastVersion", CurrentFile + 1); + mir_snprintf(szKey, "File_%d_LastVersion", CurrentFile + 1); db_set_ts(NULL, MODNAME, szKey, Files[CurrentFile].tszLastVer); } // end compare versions } //end checking all files in for () -- cgit v1.2.3