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/QuickMessages/src/Utils.cpp | |
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/QuickMessages/src/Utils.cpp')
-rw-r--r-- | plugins/QuickMessages/src/Utils.cpp | 50 |
1 files changed, 25 insertions, 25 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; |