summaryrefslogtreecommitdiff
path: root/plugins/StatusPlugins/StartupStatus
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
commit4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch)
tree9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /plugins/StatusPlugins/StartupStatus
parentf0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (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/StatusPlugins/StartupStatus')
-rw-r--r--plugins/StatusPlugins/StartupStatus/options.cpp12
-rw-r--r--plugins/StatusPlugins/StartupStatus/profiles.cpp8
-rw-r--r--plugins/StatusPlugins/StartupStatus/startupstatus.cpp6
-rw-r--r--plugins/StatusPlugins/StartupStatus/toolbars.cpp2
4 files changed, 14 insertions, 14 deletions
diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp
index ca7d35b838..21ca2d2385 100644
--- a/plugins/StatusPlugins/StartupStatus/options.cpp
+++ b/plugins/StatusPlugins/StartupStatus/options.cpp
@@ -161,9 +161,9 @@ HRESULT CreateLink(TSettingsList& protoSettings)
{
TCHAR savePath[MAX_PATH];
if (SHGetSpecialFolderPath(NULL, savePath, 0x10, FALSE))
- _tcsncat_s(savePath, SHORTCUT_FILENAME, SIZEOF(savePath) - mir_tstrlen(savePath));
+ _tcsncat_s(savePath, SHORTCUT_FILENAME, _countof(savePath) - mir_tstrlen(savePath));
else
- mir_sntprintf(savePath, SIZEOF(savePath), _T(".\\%s"), SHORTCUT_FILENAME);
+ mir_sntprintf(savePath, _countof(savePath), _T(".\\%s"), SHORTCUT_FILENAME);
// Get a pointer to the IShellLink interface.
IShellLink *psl;
@@ -175,7 +175,7 @@ HRESULT CreateLink(TSettingsList& protoSettings)
// Set the path to the shortcut target, and add the
// description.
TCHAR path[MAX_PATH];
- GetModuleFileName(NULL, path, SIZEOF(path));
+ GetModuleFileName(NULL, path, _countof(path));
psl->SetPath(path);
psl->SetDescription(desc);
psl->SetArguments( _A2T(args));
@@ -220,7 +220,7 @@ INT_PTR CALLBACK CmdlOptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
EmptyClipboard();
char cmdl[2048];
- GetDlgItemTextA(hwndDlg,IDC_CMDL, cmdl, SIZEOF(cmdl));
+ GetDlgItemTextA(hwndDlg,IDC_CMDL, cmdl, _countof(cmdl));
HGLOBAL cmdlGlob = GlobalAlloc(GMEM_MOVEABLE, sizeof(cmdl));
if (cmdlGlob == NULL) {
CloseClipboard();
@@ -610,7 +610,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
int flags = (CallProtoService(ps->szName, PS_GETCAPS, PFLAGNUM_2, 0))&~(CallProtoService(ps->szName, PS_GETCAPS, PFLAGNUM_5, 0));
SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_RESETCONTENT, 0, 0);
- for ( int i=0; i < SIZEOF(statusModeList); i++ ) {
+ for ( int i=0; i < _countof(statusModeList); i++ ) {
if ( (flags&statusModePf2List[i]) || (statusModeList[i] == ID_STATUS_OFFLINE)) {
int item = SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(statusModeList[i], 0));
SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_SETITEMDATA, (WPARAM)item, (LPARAM)statusModeList[i]);
@@ -866,7 +866,7 @@ INT_PTR CALLBACK addProfileDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lP
case WM_COMMAND:
if (LOWORD(wParam) == IDC_OK) {
TCHAR profileName[128];
- GetDlgItemText(hwndDlg, IDC_PROFILENAME, profileName, SIZEOF(profileName));
+ GetDlgItemText(hwndDlg, IDC_PROFILENAME, profileName, _countof(profileName));
SendMessage(hwndParent, UM_ADDPROFILE, 0, (LPARAM)profileName);
// done and exit
DestroyWindow(hwndDlg);
diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp
index a3b6687216..d8a5b7df9a 100644
--- a/plugins/StatusPlugins/StartupStatus/profiles.cpp
+++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp
@@ -107,7 +107,7 @@ static int CreateMainMenuItems(WPARAM, LPARAM)
mi.ptszName = profilename;
mi.position = 2000100000 + mcount;
- mir_snprintf(servicename, SIZEOF(servicename), "%s%d", MS_SS_MENUSETPROFILEPREFIX, mcount);
+ mir_snprintf(servicename, _countof(servicename), "%s%d", MS_SS_MENUSETPROFILEPREFIX, mcount);
switch(mcount) {
case 0:
hProfileServices[mcount] = CreateServiceFunction(servicename, profileService0);
@@ -190,7 +190,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto)
for ( int i=0; i < pceCount; i++ ) {
if ( (pce[i].profile == profile) && (!mir_strcmp(pce[i].szProto, szProto))) {
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
if (!db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) { // reload from db
pce[i].msg = ( TCHAR* )realloc(pce[i].msg, sizeof(TCHAR)*(mir_tstrlen(dbv.ptszVal)+1));
if (pce[i].msg != NULL) {
@@ -214,7 +214,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto)
pce[pceCount].profile = profile;
pce[pceCount].szProto = _strdup(szProto);
pce[pceCount].msg = NULL;
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
if (!db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) {
pce[pceCount].msg = _tcsdup(dbv.ptszVal);
db_free(&dbv);
@@ -339,7 +339,7 @@ static int RegisterHotKeys()
return -1;
char atomname[255];
- mir_snprintf(atomname, SIZEOF(atomname), "StatusProfile_%d", i);
+ mir_snprintf(atomname, _countof(atomname), "StatusProfile_%d", i);
hkInfo[hkiCount].id = GlobalAddAtomA(atomname);
if (hkInfo[hkiCount].id == 0)
continue;
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
index 155cc1e17b..d1591e98c4 100644
--- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
@@ -168,7 +168,7 @@ static void SetLastStatusMessages(TSettingsList &ps)
continue;
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s%s", PREFIX_LASTMSG, ps[i].szName);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s%s", PREFIX_LASTMSG, ps[i].szName);
DBVARIANT dbv;
if (ps[i].szMsg == NULL && !db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) {
@@ -301,9 +301,9 @@ static int OnOkToExit(WPARAM, LPARAM)
continue;
char lastName[128], lastMsg[128];
- mir_snprintf(lastName, SIZEOF(lastName), "%s%s", PREFIX_LAST, pa->szModuleName);
+ mir_snprintf(lastName, _countof(lastName), "%s%s", PREFIX_LAST, pa->szModuleName);
db_set_w(NULL, MODULENAME, lastName, (WORD)CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0));
- mir_snprintf(lastMsg, SIZEOF(lastMsg), "%s%s", PREFIX_LASTMSG, pa->szModuleName);
+ mir_snprintf(lastMsg, _countof(lastMsg), "%s%s", PREFIX_LASTMSG, pa->szModuleName);
db_unset(NULL, MODULENAME, lastMsg);
if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0) & PF1_MODEMSGSEND & ~PF1_INDIVMODEMSG))
diff --git a/plugins/StatusPlugins/StartupStatus/toolbars.cpp b/plugins/StatusPlugins/StartupStatus/toolbars.cpp
index 6fc5b99823..e5029981d1 100644
--- a/plugins/StatusPlugins/StartupStatus/toolbars.cpp
+++ b/plugins/StatusPlugins/StartupStatus/toolbars.cpp
@@ -45,7 +45,7 @@ void RemoveTopToolbarButtons()
int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam)
{
if (iconList[0].hIcolib == NULL)
- Icon_Register(hInst, "Toolbar/StartupStatus", iconList, SIZEOF(iconList));
+ Icon_Register(hInst, "Toolbar/StartupStatus", iconList, _countof(iconList));
int profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0);