diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-19 19:35:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-19 19:35:42 +0000 |
commit | 4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch) | |
tree | 9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /plugins/PackUpdater/Src | |
parent | f0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (diff) |
SIZEOF replaced with more secure analog - _countof
git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PackUpdater/Src')
-rw-r--r-- | plugins/PackUpdater/Src/Notifications.cpp | 62 | ||||
-rw-r--r-- | plugins/PackUpdater/Src/Options.cpp | 6 | ||||
-rw-r--r-- | plugins/PackUpdater/Src/PackUpdater.cpp | 2 | ||||
-rw-r--r-- | plugins/PackUpdater/Src/Utils.cpp | 58 |
4 files changed, 64 insertions, 64 deletions
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp index c0157b32fa..4af9065bf3 100644 --- a/plugins/PackUpdater/Src/Notifications.cpp +++ b/plugins/PackUpdater/Src/Notifications.cpp @@ -96,11 +96,11 @@ static VOID MakePopupAction(POPUPACTION &pa, INT id) switch (id) {
case IDYES:
pa.lchIcon = IcoLib_GetIcon("btn_ok");
- strncpy_s(pa.lpzTitle, MODNAME"/Yes", SIZEOF(pa.lpzTitle));
+ strncpy_s(pa.lpzTitle, MODNAME"/Yes", _countof(pa.lpzTitle));
break;
case IDNO:
pa.lchIcon = IcoLib_GetIcon("btn_cancel");
- strncpy_s(pa.lpzTitle, MODNAME"/No", SIZEOF(pa.lpzTitle));
+ strncpy_s(pa.lpzTitle, MODNAME"/No", _countof(pa.lpzTitle));
break;
}
}
@@ -115,8 +115,8 @@ VOID show_popup(HWND hDlg, LPCTSTR Title, LPCTSTR Text, int Number, int ActType) pd.cbSize = sizeof(pd);
pd.lchContact = NULL; //(HANDLE)wParam;
pd.lchIcon = Skin_LoadIcon(PopupsList[Number].Icon);
- mir_tstrncpy(pd.lptzText, Text, SIZEOF(pd.lptzText));
- mir_tstrncpy(pd.lptzContactName, Title, SIZEOF(pd.lptzContactName));
+ mir_tstrncpy(pd.lptzText, Text, _countof(pd.lptzText));
+ mir_tstrncpy(pd.lptzContactName, Title, _countof(pd.lptzContactName));
switch (MyOptions.DefColors) {
case byCOLOR_WINDOWS:
pd.colorBack = GetSysColor(COLOR_BTNFACE);
@@ -179,7 +179,7 @@ static void __stdcall CreateDownloadDialog(void*) if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups3", DEFAULT_POPUP_ENABLED))
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgDownloadPop);
else if (db_get_b(NULL, MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
- mir_tstrncpy(tszDialogMsg, Text, SIZEOF(tszDialogMsg));
+ mir_tstrncpy(tszDialogMsg, Text, _countof(tszDialogMsg));
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DOWNLOAD), NULL, DlgDownload);
}
}
@@ -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, SIZEOF(tszFileDest), _T("%s\\Pack"), tszRoot);
+ mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Pack"), tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
case 2:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Plugins"), tszRoot);
+ mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Plugins"), tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
case 3:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Icons"), tszRoot);
+ mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Icons"), tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
case 4:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Others"), tszRoot);
+ mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Others"), tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
case 5:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Others"), tszRoot);
+ mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Others"), tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
default:
- mir_tstrncpy(tszFileDest, tszRoot, SIZEOF(tszFileDest));
+ mir_tstrncpy(tszFileDest, tszRoot, _countof(tszFileDest));
break;
}
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%s\\Backups"), tszRoot);
+ mir_sntprintf(tszBuff, _countof(tszBuff), _T("%s\\Backups"), tszRoot);
CreateDirectory(tszBuff, NULL);
- mir_tstrncpy(tszFileName, todo[i].File.tszDiskPath, SIZEOF(tszFileName));
- mir_sntprintf(todo[i].File.tszDiskPath, SIZEOF(todo[i].File.tszDiskPath), _T("%s\\%s"), tszFileDest, tszFileName);
+ 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);
UpdatesCount++;
tszExt = &todo[i].File.tszDownloadURL[mir_tstrlen(todo[i].File.tszDownloadURL) - 5];
@@ -399,8 +399,8 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam continue;
}
}
- mir_tstrncpy(todo[i].tszCurVer, todo[i].tszNewVer, SIZEOF(todo[i].tszCurVer));
- mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", todo[i].FileNum);
+ mir_tstrncpy(todo[i].tszCurVer, todo[i].tszNewVer, _countof(todo[i].tszCurVer));
+ mir_snprintf(szKey, _countof(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);
@@ -413,9 +413,9 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam }
if (UpdatesCount > 1 && mir_tstrcmp(arExt[0].c_str(), _T(".html")) != 0)
- mir_tstrncpy(tszBuff, TranslateT("Downloads complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
+ mir_tstrncpy(tszBuff, TranslateT("Downloads complete. Start updating? All your data will be saved and Miranda NG will be closed."), _countof(tszBuff));
else if (UpdatesCount == 1 && mir_tstrcmp(arExt[0].c_str(), _T(".html")) != 0)
- mir_tstrncpy(tszBuff, TranslateT("Download complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
+ mir_tstrncpy(tszBuff, TranslateT("Download complete. Start updating? All your data will be saved and Miranda NG will be closed."), _countof(tszBuff));
if (UpdatesCount > 0 && mir_tstrcmp(arExt[0].c_str(), _T(".html")) != 0) {
INT rc = -1;
Title = TranslateT("Pack Updater");
@@ -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, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, arFileName[i].c_str());
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, arFileName[i].c_str());
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootPlug, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ 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());
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, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, arFileName[i].c_str());
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, arFileName[i].c_str());
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootIco, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ 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());
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, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ 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());
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, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ 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());
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, SIZEOF(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, _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());
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 56a35e8ecf..6d3a8588da 100644 --- a/plugins/PackUpdater/Src/Options.cpp +++ b/plugins/PackUpdater/Src/Options.cpp @@ -195,7 +195,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, -1, 9999);
SetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, MyOptions.Timeout, TRUE);
//Mouse actions
- for (i = 0; i < SIZEOF(PopupActions); i++) {
+ for (i = 0; i < _countof(PopupActions); i++) {
SendDlgItemMessage(hdlg, IDC_LC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_LC, CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
SendDlgItemMessage(hdlg, IDC_RC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_RC, CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
}
@@ -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, SIZEOF(str2), "Popups%dM", i);
+ mir_snprintf(str2, _countof(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, SIZEOF(str2), "Popups%dM", i);
+ mir_snprintf(str2, _countof(str2), "Popups%dM", i);
db_set_b(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i + 1024))));
}
return TRUE;
diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp index c7987a96e0..4438634c52 100644 --- a/plugins/PackUpdater/Src/PackUpdater.cpp +++ b/plugins/PackUpdater/Src/PackUpdater.cpp @@ -55,7 +55,7 @@ extern "C" __declspec(dllexport) int Load(void) mir_getLP(&pluginInfoEx);
TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\"DEFAULT_UPDATES_FOLDER));
- mir_tstrncpy(tszRoot, tszFolder, SIZEOF(tszRoot));
+ mir_tstrncpy(tszRoot, tszFolder, _countof(tszRoot));
hPackUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, LPGEN("Pack Updater"), MIRANDA_USERDATAT _T("\\")DEFAULT_UPDATES_FOLDER);
if (hPackUpdaterFolder)
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 2b118cc3cf..4706dda99c 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -43,7 +43,7 @@ IconItem iconList[] = VOID IcoLibInit()
{
- Icon_Register(hInst, MODULEA, iconList, SIZEOF(iconList));
+ Icon_Register(hInst, MODULEA, iconList, _countof(iconList));
}
BOOL NetlibInit()
@@ -205,10 +205,10 @@ static void CheckUpdates(void *) }
// Download version info
pFileUrl = (FILEURL *)mir_alloc(sizeof(*pFileUrl));
- mir_tstrncpy(pFileUrl->tszDownloadURL, tszDownloadURL, SIZEOF(pFileUrl->tszDownloadURL));
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%s\\tmp.ini"), tszRoot);
- mir_tstrncpy(pFileUrl->tszDiskPath, tszBuff, SIZEOF(pFileUrl->tszDiskPath));
- mir_tstrncpy(tszTmpIni, tszBuff, SIZEOF(tszTmpIni));
+ mir_tstrncpy(pFileUrl->tszDownloadURL, tszDownloadURL, _countof(pFileUrl->tszDownloadURL));
+ mir_sntprintf(tszBuff, _countof(tszBuff), _T("%s\\tmp.ini"), tszRoot);
+ mir_tstrncpy(pFileUrl->tszDiskPath, tszBuff, _countof(pFileUrl->tszDiskPath));
+ mir_tstrncpy(tszTmpIni, tszBuff, _countof(tszTmpIni));
Title = TranslateT("Pack Updater");
Text = TranslateT("Downloading version info...");
DlgDownloadProc();
@@ -221,29 +221,29 @@ static void CheckUpdates(void *) for (CurrentFile = 0; CurrentFile < FileCount; CurrentFile++) {
FILEINFO FileInfo = { _T(""), _T(""), _T(""), _T(""), _T(""), _T(""), _T(""), { _T(""), _T("") } };
- mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", CurrentFile + 1);
+ mir_snprintf(szKey, _countof(szKey), "File_%d_CurrentVersion", CurrentFile + 1);
ptrT tszCurVer(db_get_tsa(NULL, MODNAME, szKey));
if (tszCurVer)
- mir_tstrncpy(FileInfo.tszCurVer, tszCurVer, SIZEOF(FileInfo.tszCurVer));
+ mir_tstrncpy(FileInfo.tszCurVer, tszCurVer, _countof(FileInfo.tszCurVer));
else
- mir_tstrncpy(FileInfo.tszCurVer, _T(""), SIZEOF(FileInfo.tszCurVer));
+ mir_tstrncpy(FileInfo.tszCurVer, _T(""), _countof(FileInfo.tszCurVer));
- mir_snprintf(szKey, SIZEOF(szKey), "File_%d_LastVersion", CurrentFile + 1);
+ mir_snprintf(szKey, _countof(szKey), "File_%d_LastVersion", CurrentFile + 1);
ptrT tszLastVer(db_get_tsa(NULL, MODNAME, szKey));
if (tszLastVer)
- mir_tstrncpy(FileInfo.tszLastVer, tszLastVer, SIZEOF(FileInfo.tszLastVer));
+ mir_tstrncpy(FileInfo.tszLastVer, tszLastVer, _countof(FileInfo.tszLastVer));
else
- mir_tstrncpy(FileInfo.tszLastVer, _T(""), SIZEOF(FileInfo.tszLastVer));
+ mir_tstrncpy(FileInfo.tszLastVer, _T(""), _countof(FileInfo.tszLastVer));
Files.push_back(FileInfo);
// Read version info
- mir_sntprintf(tszFileInfo, SIZEOF(tszFileInfo), _T("FileInfo_%d"), CurrentFile + 1);
- GetPrivateProfileString(tszFileInfo, _T("FileVersion"), _T(""), Files[CurrentFile].tszNewVer, SIZEOF(Files[CurrentFile].tszNewVer), tszTmpIni);
- GetPrivateProfileString(tszFileInfo, _T("Message"), _T(""), Files[CurrentFile].tszMessage, SIZEOF(Files[CurrentFile].tszMessage), tszTmpIni);
- GetPrivateProfileString(tszFileInfo, _T("DownloadURL"), _T(""), Files[CurrentFile].File.tszDownloadURL, SIZEOF(Files[CurrentFile].File.tszDownloadURL), tszTmpIni);
- GetPrivateProfileString(tszFileInfo, _T("AdvFolder"), _T(""), Files[CurrentFile].tszAdvFolder, SIZEOF(Files[CurrentFile].tszAdvFolder), tszTmpIni);
- GetPrivateProfileString(tszFileInfo, _T("Descr"), _T(""), Files[CurrentFile].tszDescr, SIZEOF(Files[CurrentFile].tszDescr), tszTmpIni);
+ mir_sntprintf(tszFileInfo, _countof(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);
+ GetPrivateProfileString(tszFileInfo, _T("AdvFolder"), _T(""), Files[CurrentFile].tszAdvFolder, _countof(Files[CurrentFile].tszAdvFolder), tszTmpIni);
+ GetPrivateProfileString(tszFileInfo, _T("Descr"), _T(""), Files[CurrentFile].tszDescr, _countof(Files[CurrentFile].tszDescr), tszTmpIni);
GetPrivateProfileString(tszFileInfo, _T("DiskFileName"), _T(""), tszBuff, MAX_PATH, tszTmpIni);
if (_tcsstr(tszBuff, _T("\\"))) { //check update name
@@ -257,17 +257,17 @@ static void CheckUpdates(void *) MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
continue;
} // end check update name
- mir_tstrncpy(Files[CurrentFile].File.tszDiskPath, tszBuff, SIZEOF(Files[CurrentFile].File.tszDiskPath));
- GetPrivateProfileString(tszFileInfo, _T("InfoURL"), _T(""), Files[CurrentFile].tszInfoURL, SIZEOF(Files[CurrentFile].tszInfoURL), tszTmpIni);
+ mir_tstrncpy(Files[CurrentFile].File.tszDiskPath, tszBuff, _countof(Files[CurrentFile].File.tszDiskPath));
+ GetPrivateProfileString(tszFileInfo, _T("InfoURL"), _T(""), Files[CurrentFile].tszInfoURL, _countof(Files[CurrentFile].tszInfoURL), tszTmpIni);
Files[CurrentFile].FileType = GetPrivateProfileInt(tszFileInfo, _T("FileType"), 0, tszTmpIni);
Files[CurrentFile].Force = GetPrivateProfileInt(tszFileInfo, _T("Force"), 0, tszTmpIni);
Files[CurrentFile].FileNum = CurrentFile + 1;
if (Files[CurrentFile].FileType == 2) {
if (mir_tstrcmp(Files[CurrentFile].tszAdvFolder, _T("")) == 0)
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("Plugins\\%s"), Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszBuff, _countof(tszBuff), _T("Plugins\\%s"), Files[CurrentFile].File.tszDiskPath);
else
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("Plugins\\%s\\%s"), Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszBuff, _countof(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, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, Files[CurrentFile].File.tszDiskPath);
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootPlug, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszFilePathDest, _countof(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, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, Files[CurrentFile].File.tszDiskPath);
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootIco, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszFilePathDest, _countof(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, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, Files[CurrentFile].File.tszDiskPath);
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
}
break;
}//end* switch (Files[CurrentFile].FileType)
@@ -321,8 +321,8 @@ static void CheckUpdates(void *) if (Files[CurrentFile].Force || Exists(tszFilePathDest))
UpdateFiles.push_back(Files[CurrentFile]);
// Save last version
- mir_tstrncpy(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, SIZEOF(Files[CurrentFile].tszLastVer));
- mir_snprintf(szKey, SIZEOF(szKey), "File_%d_LastVersion", CurrentFile + 1);
+ mir_tstrncpy(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, _countof(Files[CurrentFile].tszLastVer));
+ mir_snprintf(szKey, _countof(szKey), "File_%d_LastVersion", CurrentFile + 1);
db_set_ts(NULL, MODNAME, szKey, Files[CurrentFile].tszLastVer);
} // end compare versions
} //end checking all files in for ()
|