summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap
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/Db3x_mmap
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/Db3x_mmap')
-rw-r--r--plugins/Db3x_mmap/src/database.cpp12
-rw-r--r--plugins/Db3x_mmap/src/dbheaders.cpp2
-rw-r--r--plugins/Db3x_mmap/src/dbintf.cpp2
-rw-r--r--plugins/Db3x_mmap/src/dbtool/modulechain.cpp2
-rw-r--r--plugins/Db3x_mmap/src/ui.cpp10
5 files changed, 14 insertions, 14 deletions
diff --git a/plugins/Db3x_mmap/src/database.cpp b/plugins/Db3x_mmap/src/database.cpp
index aa28878fad..d095b64df0 100644
--- a/plugins/Db3x_mmap/src/database.cpp
+++ b/plugins/Db3x_mmap/src/database.cpp
@@ -87,7 +87,7 @@ void __cdecl dbpanic(void *)
msg = TranslateT("Disk is full. Miranda will now shut down.");
TCHAR err[256];
- mir_sntprintf(err, SIZEOF(err), msg, TranslateT("Database failure. Miranda will now shut down."), dwErr);
+ mir_sntprintf(err, _countof(err), msg, TranslateT("Database failure. Miranda will now shut down."), dwErr);
MessageBox(0, err, TranslateT("Database Error"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
}
@@ -128,13 +128,13 @@ char* printVariant(DBVARIANT* p)
static char boo[1000];
switch (p->type) {
- case DBVT_BYTE: mir_snprintf(boo, SIZEOF(boo), "byte: %d", p->bVal ); break;
- case DBVT_WORD: mir_snprintf(boo, SIZEOF(boo), "word: %d", p->wVal ); break;
- case DBVT_DWORD: mir_snprintf(boo, SIZEOF(boo), "dword: %d", p->dVal ); break;
+ case DBVT_BYTE: mir_snprintf(boo, _countof(boo), "byte: %d", p->bVal ); break;
+ case DBVT_WORD: mir_snprintf(boo, _countof(boo), "word: %d", p->wVal ); break;
+ case DBVT_DWORD: mir_snprintf(boo, _countof(boo), "dword: %d", p->dVal ); break;
case DBVT_UTF8:
- case DBVT_ASCIIZ: mir_snprintf(boo, SIZEOF(boo), "string: '%s'", p->pszVal); break;
+ case DBVT_ASCIIZ: mir_snprintf(boo, _countof(boo), "string: '%s'", p->pszVal); break;
case DBVT_DELETED: mir_strcpy(boo, "deleted"); break;
- default: mir_snprintf(boo, SIZEOF(boo), "crap: %d", p->type ); break;
+ default: mir_snprintf(boo, _countof(boo), "crap: %d", p->type ); break;
}
return boo;
}
diff --git a/plugins/Db3x_mmap/src/dbheaders.cpp b/plugins/Db3x_mmap/src/dbheaders.cpp
index 8598fe26ce..2a5c15de99 100644
--- a/plugins/Db3x_mmap/src/dbheaders.cpp
+++ b/plugins/Db3x_mmap/src/dbheaders.cpp
@@ -71,7 +71,7 @@ int CDb3Mmap::CheckDbHeaders(bool bInteractive)
if (bInteractive)
if (IDYES == MessageBox(NULL, TranslateTS(tszOldHeaders), TranslateT("Obsolete database format"), MB_YESNO | MB_ICONWARNING)) {
TCHAR tszCurPath[MAX_PATH];
- GetModuleFileName(NULL, tszCurPath, SIZEOF(tszCurPath));
+ GetModuleFileName(NULL, tszCurPath, _countof(tszCurPath));
TCHAR *p = _tcsrchr(tszCurPath, '\\');
if (p) *p = 0;
diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp
index ee14dd7a17..8a11e52b51 100644
--- a/plugins/Db3x_mmap/src/dbintf.cpp
+++ b/plugins/Db3x_mmap/src/dbintf.cpp
@@ -219,7 +219,7 @@ int CDb3Mmap::Start(DBCHeckCallback *callback)
int CDb3Mmap::CheckDb(int phase, int firstTime)
{
- if (phase >= SIZEOF(Workers))
+ if (phase >= _countof(Workers))
return ERROR_OUT_OF_PAPER;
return (this->*Workers[phase])(firstTime);
diff --git a/plugins/Db3x_mmap/src/dbtool/modulechain.cpp b/plugins/Db3x_mmap/src/dbtool/modulechain.cpp
index c96d0b010e..695698ee7f 100644
--- a/plugins/Db3x_mmap/src/dbtool/modulechain.cpp
+++ b/plugins/Db3x_mmap/src/dbtool/modulechain.cpp
@@ -97,7 +97,7 @@ int CDb3Mmap::WorkModuleChain(int firstTime)
}
if (n) {
TCHAR szModuleName[257];
- MultiByteToWideChar(CP_ACP, 0, modChain[iCurrentModName].name, -1, szModuleName, SIZEOF(szModuleName));
+ MultiByteToWideChar(CP_ACP, 0, modChain[iCurrentModName].name, -1, szModuleName, _countof(szModuleName));
TCHAR *pszModuleName = szModuleName;
cb->pfnAddLogMessage(STATUS_WARNING, TranslateT("Module name '%s' is not unique: %d duplicates found"), pszModuleName, n);
diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp
index c19b0fc031..4ac0e56d8f 100644
--- a/plugins/Db3x_mmap/src/ui.cpp
+++ b/plugins/Db3x_mmap/src/ui.cpp
@@ -100,7 +100,7 @@ static INT_PTR CALLBACK sttEnterPassword(HWND hwndDlg, UINT uMsg, WPARAM wParam,
break;
case IDOK:
- GetDlgItemText(hwndDlg, IDC_USERPASS, param->newPass, SIZEOF(param->newPass));
+ GetDlgItemText(hwndDlg, IDC_USERPASS, param->newPass, _countof(param->newPass));
EndDialog(hwndDlg, IDOK);
}
break;
@@ -142,7 +142,7 @@ static bool CheckOldPassword(HWND hwndDlg, CDb3Mmap *db)
{
if (db->usesPassword()) {
TCHAR buf[100];
- GetDlgItemText(hwndDlg, IDC_OLDPASS, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_OLDPASS, buf, _countof(buf));
if (!db->m_crypto->checkPassword(T2Utf(buf))) {
SetDlgItemText(hwndDlg, IDC_HEADERBAR, TranslateT("Wrong old password entered!"));
return false;
@@ -200,13 +200,13 @@ static INT_PTR CALLBACK sttChangePassword(HWND hwndDlg, UINT uMsg, WPARAM wParam
case IDOK:
TCHAR buf2[100];
- GetDlgItemText(hwndDlg, IDC_USERPASS1, buf2, SIZEOF(buf2));
+ GetDlgItemText(hwndDlg, IDC_USERPASS1, buf2, _countof(buf2));
if (mir_tstrlen(buf2) < 3) {
SetDlgItemText(hwndDlg, IDC_HEADERBAR, TranslateT("Password is too short!"));
goto LBL_Error;
}
- GetDlgItemText(hwndDlg, IDC_USERPASS2, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_USERPASS2, buf, _countof(buf));
if (mir_tstrcmp(buf2, buf)) {
SetDlgItemText(hwndDlg, IDC_HEADERBAR, TranslateT("Passwords do not match!"));
goto LBL_Error;
@@ -310,7 +310,7 @@ static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM)
{
CDb3Mmap *db = (CDb3Mmap*)obj;
- Icon_Register(g_hInst, LPGEN("Database"), iconList, SIZEOF(iconList), "mmap");
+ Icon_Register(g_hInst, LPGEN("Database"), iconList, _countof(iconList), "mmap");
HookEventObj(ME_OPT_INITIALISE, OnOptionsInit, db);