summaryrefslogtreecommitdiff
path: root/plugins/QuickMessages
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/QuickMessages
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/QuickMessages')
-rw-r--r--plugins/QuickMessages/src/Utils.cpp50
-rw-r--r--plugins/QuickMessages/src/options.cpp30
2 files changed, 40 insertions, 40 deletions
diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp
index 261e42198e..9de7e40fc4 100644
--- a/plugins/QuickMessages/src/Utils.cpp
+++ b/plugins/QuickMessages/src/Utils.cpp
@@ -157,22 +157,22 @@ void SaveModuleSettings(int buttonnum,ButtonData* bd)
{
char szMEntry[256]={'\0'};
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryName_%u_%u",buttonnum,bd->dwPos);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryName_%u_%u",buttonnum,bd->dwPos);
db_set_ts(NULL, PLGNAME,szMEntry,bd->pszName );
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryValue_%u_%u",buttonnum,bd->dwPos);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryValue_%u_%u",buttonnum,bd->dwPos);
if(bd->pszValue)
db_set_ts(NULL, PLGNAME,szMEntry,bd->pszValue );
else
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryRel_%u_%u",buttonnum,bd->dwPos);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryRel_%u_%u",buttonnum,bd->dwPos);
db_set_b(NULL, PLGNAME,szMEntry,bd->fEntryType );
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryToQMenu_%u_%u",buttonnum,bd->dwPos);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryToQMenu_%u_%u",buttonnum,bd->dwPos);
db_set_b(NULL, PLGNAME,szMEntry,bd->bInQMenu);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryIsServiceName_%u_%u",buttonnum,bd->dwPos);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryIsServiceName_%u_%u",buttonnum,bd->dwPos);
db_set_b(NULL, PLGNAME,szMEntry,bd->bIsServName);
}
@@ -181,27 +181,27 @@ void CleanSettings(int buttonnum,int from)
char szMEntry[256]={'\0'};
DBVARIANT dbv = {0};
if(from==-1){
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"ButtonName_%u",buttonnum);
+ mir_snprintf(szMEntry,_countof(szMEntry),"ButtonName_%u",buttonnum);
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"ButtonValue_%u",buttonnum);
+ mir_snprintf(szMEntry,_countof(szMEntry),"ButtonValue_%u",buttonnum);
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"RCEntryIsServiceName_%u",buttonnum);
+ mir_snprintf(szMEntry,_countof(szMEntry),"RCEntryIsServiceName_%u",buttonnum);
db_unset(NULL, PLGNAME,szMEntry);
}
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryName_%u_%u",buttonnum,from);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryName_%u_%u",buttonnum,from);
while(!db_get_ts(NULL, PLGNAME,szMEntry,&dbv)) {
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryValue_%u_%u",buttonnum,from);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryValue_%u_%u",buttonnum,from);
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryRel_%u_%u",buttonnum,from);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryRel_%u_%u",buttonnum,from);
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryToQMenu_%u_%u",buttonnum,from);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryToQMenu_%u_%u",buttonnum,from);
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryIsServiceName_%u_%u",buttonnum,from);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryIsServiceName_%u_%u",buttonnum,from);
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryName_%u_%u",buttonnum,++from);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryName_%u_%u",buttonnum,++from);
}
db_free(&dbv);
}
@@ -212,16 +212,16 @@ BYTE getEntryByte(int buttonnum,int entrynum,BOOL mode)
switch (mode) {
case 0:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryToQMenu_%u_%u", buttonnum, entrynum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "EntryToQMenu_%u_%u", buttonnum, entrynum);
break;
case 1:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryRel_%u_%u", buttonnum, entrynum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "EntryRel_%u_%u", buttonnum, entrynum);
break;
case 2:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryIsServiceName_%u_%u", buttonnum, entrynum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "EntryIsServiceName_%u_%u", buttonnum, entrynum);
break;
case 3:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "RCEntryIsServiceName_%u", buttonnum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "RCEntryIsServiceName_%u", buttonnum);
break;
}
return db_get_b(NULL, PLGNAME, szMEntry, 0);
@@ -230,7 +230,7 @@ BYTE getEntryByte(int buttonnum,int entrynum,BOOL mode)
static HANDLE AddIcon(char* szIcoName)
{
TCHAR tszPath[MAX_PATH];
- GetModuleFileName(hinstance, tszPath, SIZEOF(tszPath));
+ GetModuleFileName(hinstance, tszPath, _countof(tszPath));
SKINICONDESC sid = { 0 };
sid.flags = SIDF_PATH_TCHAR;
@@ -257,7 +257,7 @@ DWORD BalanceButtons(int buttonsWas, int buttonsNow)
while (buttonsWas < buttonsNow) {
if (ServiceExists(MS_BB_ADDBUTTON)) {
char iconname[40];
- mir_snprintf(iconname, SIZEOF(iconname), LPGEN("Quick Messages Button %u"), buttonsWas);
+ mir_snprintf(iconname, _countof(iconname), LPGEN("Quick Messages Button %u"), buttonsWas);
bb.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISLSIDEBUTTON;
bb.dwButtonID = buttonsWas++;
bb.dwDefPos = 300+buttonsWas;
@@ -348,16 +348,16 @@ TCHAR* getMenuEntry(int buttonnum, int entrynum, BYTE mode)
switch (mode) {
case 0:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryName_%u_%u", buttonnum, entrynum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "EntryName_%u_%u", buttonnum, entrynum);
break;
case 1:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryValue_%u_%u", buttonnum, entrynum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "EntryValue_%u_%u", buttonnum, entrynum);
break;
case 2:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "ButtonValue_%u", buttonnum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "ButtonValue_%u", buttonnum);
break;
case 3:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "ButtonName_%u", buttonnum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "ButtonName_%u", buttonnum);
break;
default:
szMEntry[0] = 0;
@@ -382,7 +382,7 @@ int RegisterCustomButton(WPARAM wParam,LPARAM lParam)
ListData* ld = ButtonsList[i];
char iconname[40];
- mir_snprintf(iconname, SIZEOF(iconname), LPGEN("Quick Messages Button %u"), i);
+ mir_snprintf(iconname, _countof(iconname), LPGEN("Quick Messages Button %u"), i);
BBButton bbd = { sizeof(bbd) };
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISLSIDEBUTTON;
diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp
index b8091558cb..ce1a2995c9 100644
--- a/plugins/QuickMessages/src/options.cpp
+++ b/plugins/QuickMessages/src/options.cpp
@@ -123,7 +123,7 @@ void SetMenuEntryProperties(HWND hdlg)
{
ListData* ld = ( ListData* )tvi.lParam;
TCHAR szValue[256];
- GetDlgItemText(hdlg, IDC_RCLICKVALUE, szValue, SIZEOF(szValue));
+ GetDlgItemText(hdlg, IDC_RCLICKVALUE, szValue, _countof(szValue));
if(mir_tstrlen(szValue))
{
if(ld->ptszOPQValue&&(ld->ptszOPQValue!=ld->ptszQValue))
@@ -144,7 +144,7 @@ void SetMenuEntryProperties(HWND hdlg)
{
ButtonData* bd = ( ButtonData* )tvi.lParam;
TCHAR szValue[256];
- GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, SIZEOF(szValue));
+ GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, _countof(szValue));
if(mir_tstrlen(szValue))
{
if(mir_tstrlen(bd->pszOpValue)&&(bd->pszOpValue!=bd->pszValue))
@@ -213,7 +213,7 @@ void SaveMenuTree(HWND hdlg)
g_iButtonsCount=TreeView_GetCount(hButtonsList);
tvi.pszText = strbuf;
- tvi.cchTextMax = SIZEOF(strbuf);
+ tvi.cchTextMax = _countof(strbuf);
tvi.mask=TVIF_HANDLE|TVIF_TEXT ;
tvi.hItem=TreeView_GetRoot(hButtonsList);
@@ -260,7 +260,7 @@ void SaveMenuTree(HWND hdlg)
if(ld->ptszQValue)
{
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "ButtonValue_%u", iBl);
+ mir_snprintf(szMEntry, _countof(szMEntry), "ButtonValue_%u", iBl);
db_set_ts(NULL, PLGNAME,szMEntry,ld->ptszQValue);
}
@@ -276,13 +276,13 @@ void SaveMenuTree(HWND hdlg)
}
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "ButtonName_%u", iBl);
+ mir_snprintf(szMEntry, _countof(szMEntry), "ButtonName_%u", iBl);
db_set_ts(NULL, PLGNAME,szMEntry,ld->ptszButtonName);
ld->dwOPFlags=0;
ld->dwPos=iBl;
ld->bIsServName=ld->bIsOpServName;
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "RCEntryIsServiceName_%u", iBl);
+ mir_snprintf(szMEntry, _countof(szMEntry), "RCEntryIsServiceName_%u", iBl);
db_set_b(NULL, PLGNAME,szMEntry,ld->bIsServName);
bDeleted=FALSE;
@@ -492,7 +492,7 @@ void MoveItem( HTREEITEM hItem, HTREEITEM hInsertAfter, BOOLEAN bAsChild )
tvis.item.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT;
tvis.item.pszText=strbuf;
- tvis.item.cchTextMax=SIZEOF(strbuf);
+ tvis.item.cchTextMax=_countof(strbuf);
tvis.item.hItem=hItem;
TreeView_GetItem(hMenuTree,&tvis.item);
}
@@ -766,12 +766,12 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
TCHAR szLabel[256];
tvi.pszText = strbuf;
- tvi.cchTextMax = SIZEOF(strbuf);
+ tvi.cchTextMax = _countof(strbuf);
tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
tvi.hItem=TreeView_GetSelection(hMenuTree);
TreeView_GetItem(hMenuTree,&tvi);
- GetWindowText(hwndEdit, szLabel, SIZEOF(szLabel));
+ GetWindowText(hwndEdit, szLabel, _countof(szLabel));
hwndEdit=NULL;
if (!mir_tstrlen(szLabel)) break;
if (bd = (ButtonData*)tvi.lParam){
@@ -828,7 +828,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
ButtonData *bd = ( ButtonData* )tvi.lParam;
if (bd) {
TCHAR szValue[256];
- GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, SIZEOF(szValue));
+ GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, _countof(szValue));
if(mir_tstrlen(szValue))
{
if(bd->pszOpValue&&(bd->pszOpValue!=bd->pszValue))
@@ -898,12 +898,12 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
TCHAR szLabel[128];
tvi.pszText = strbuf;
- tvi.cchTextMax = SIZEOF(strbuf);
+ tvi.cchTextMax = _countof(strbuf);
tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
tvi.hItem=TreeView_GetSelection(hButtonsList);
TreeView_GetItem(hButtonsList,&tvi);
- GetWindowText(hwndEdit, szLabel, SIZEOF(szLabel));
+ GetWindowText(hwndEdit, szLabel, _countof(szLabel));
hwndEdit=NULL;
if (!mir_tstrlen(szLabel)) break;
@@ -989,7 +989,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
- GetDlgItemText(hdlg, IDC_BUTTONNAME, namebuff, SIZEOF(namebuff));
+ GetDlgItemText(hdlg, IDC_BUTTONNAME, namebuff, _countof(namebuff));
tvis.item.mask=TVIF_PARAM|TVIF_TEXT;
tvis.item.pszText=(mir_tstrlen(namebuff))?namebuff:TranslateT("New Button");
@@ -1039,7 +1039,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
bd = (ButtonData *)mir_alloc(sizeof(ButtonData));
memset(bd,0,sizeof(ButtonData));
- GetDlgItemText(hdlg, IDC_MENUNAME, namebuff, SIZEOF(namebuff));
+ GetDlgItemText(hdlg, IDC_MENUNAME, namebuff, _countof(namebuff));
bd->dwOPPos=TreeView_GetCount(hMenuTree)-1;
bd->pszOpName=mir_tstrlen(namebuff)?mir_tstrdup(namebuff):mir_tstrdup(TranslateT("New Menu Entry"));
@@ -1086,7 +1086,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
while(tvi.hItem){
tvis.hInsertAfter=hti;
tvi.pszText = strbuf;
- tvi.cchTextMax = SIZEOF(strbuf);
+ tvi.cchTextMax = _countof(strbuf);
tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT;
TreeView_GetItem(hMenuTree,&tvi);