summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx/src/ex_import
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/UserInfoEx/src/ex_import
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/UserInfoEx/src/ex_import')
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp4
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp12
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp8
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp8
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp6
6 files changed, 20 insertions, 20 deletions
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
index e210d536a1..50e52a490f 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
@@ -83,8 +83,8 @@ BYTE CExImContactXML::IsContactInfo(LPCSTR pszKey)
if (pszKey && *pszKey) {
char buf[MAXSETTING];
// convert to hash and make bsearch as it is much faster then working with strings
- const DWORD dwHash = hashSetting(_strlwr(mir_strncpy(buf, pszKey, SIZEOF(buf))));
- return bsearch(&dwHash, dwCiHash, SIZEOF(dwCiHash), sizeof(dwCiHash[0]), (int (*)(const void*, const void*))SortProc) != NULL;
+ const DWORD dwHash = hashSetting(_strlwr(mir_strncpy(buf, pszKey, _countof(buf))));
+ return bsearch(&dwHash, dwCiHash, _countof(dwCiHash), sizeof(dwCiHash[0]), (int (*)(const void*, const void*))SortProc) != NULL;
}
return FALSE;
}
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
index 374f296123..ddee777778 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
@@ -54,7 +54,7 @@ void ExportTree_AppendModuleList(HWND hTree, HTREEITEM hParent, DB::CEnumList* p
tvi.mask = TVIF_STATE|TVIF_TEXT;
tvi.stateMask = TVIS_STATEIMAGEMASK;
tvi.pszText = szModule;
- tvi.cchTextMax = SIZEOF(szModule);
+ tvi.cchTextMax = _countof(szModule);
do {
if (
@@ -89,7 +89,7 @@ HTREEITEM ExportTree_FindItem(HWND hTree, HTREEITEM hParent, LPSTR pszText)
tvi.mask = TVIF_TEXT;
tvi.pszText = szBuf;
- tvi.cchTextMax = SIZEOF(szBuf);
+ tvi.cchTextMax = _countof(szBuf);
for (tvi.hItem = TreeView_GetChild(hTree, hParent);
tvi.hItem != NULL;
@@ -171,7 +171,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
{ ICO_BTN_EXPORT, BM_SETIMAGE, IDOK },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 2;
+ const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
// create imagelist for treeview
@@ -225,8 +225,8 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
break;
}
TranslateDialogDefault(hDlg); //to translate oldTitle
- GetWindowText(hDlg, oldTitle, SIZEOF(oldTitle));
- mir_sntprintf(newTitle, SIZEOF(newTitle), _T("%s - %s"), name, oldTitle);
+ GetWindowText(hDlg, oldTitle, _countof(oldTitle));
+ mir_sntprintf(newTitle, _countof(newTitle), _T("%s - %s"), name, oldTitle);
SetWindowText(hDlg, newTitle);
}
@@ -394,7 +394,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
tvi.mask = TVIF_TEXT;
tvi.pszText = szText;
- tvi.cchTextMax = SIZEOF(szText);
+ tvi.cchTextMax = _countof(szText);
// search the tree item of optional items
for (tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_ROOT, NULL);
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp
index 7093d5770f..4f35dc0b5d 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp
@@ -61,7 +61,7 @@ static void InitAlteredPlacesBar()
dwFolderID = 17; RegSetValueEx(hkPlacesBar, _T("Place2"), 0, REG_DWORD, (PBYTE)&dwFolderID, sizeof(DWORD));
// Miranda's installation path
- GetModuleFileNameA(GetModuleHandleA("mir_app.dll"), szMirandaPath, SIZEOF(szMirandaPath));
+ GetModuleFileNameA(GetModuleHandleA("mir_app.dll"), szMirandaPath, _countof(szMirandaPath));
p = mir_strrchr(szMirandaPath, '\\');
if (p)
{
@@ -69,7 +69,7 @@ static void InitAlteredPlacesBar()
}
// Miranda's profile path
- if (!CallService(MS_DB_GETPROFILEPATH, SIZEOF(szProfilePath), (LPARAM)szProfilePath))
+ if (!CallService(MS_DB_GETPROFILEPATH, _countof(szProfilePath), (LPARAM)szProfilePath))
{
// only add if different from profile path
RegSetValueExA(hkPlacesBar, "Place4", 0, REG_SZ, (PBYTE)szProfilePath, (DWORD)mir_strlen(szProfilePath) + 1);
@@ -114,7 +114,7 @@ static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wPara
// miranda button
switch (tbb->idCommand) {
case 41063:
- mir_tstrncpy(szBtnText, TranslateT("Miranda NG"), SIZEOF(szBtnText));
+ mir_tstrncpy(szBtnText, TranslateT("Miranda NG"), _countof(szBtnText));
iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM)szBtnText);
if (iString != -1) tbb->iString = iString;
// set tooltip
@@ -204,7 +204,7 @@ static void GetInitialDir(LPSTR pszInitialDir)
szRelative[0] = 0;
// is some standard path defined
- if (!db_get_static(0, MODNAME, "vCardPath", szRelative, SIZEOF(szRelative))) {
+ if (!db_get_static(0, MODNAME, "vCardPath", szRelative, _countof(szRelative))) {
if (!PathToAbsolute(szRelative, pszInitialDir))
mir_strcpy(pszInitialDir, szRelative);
}
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
index 16d26c73d9..f2d1f52d8d 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
@@ -42,7 +42,7 @@ INT_PTR CALLBACK DlgProcProgress(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar
{ ICO_DLG_IMPORT, STM_SETIMAGE, ICO_DLGLOGO },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 2;
+ const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
TranslateDialogDefault(hDlg);
@@ -194,7 +194,7 @@ BYTE CProgress::UpdateContact(LPCTSTR pszFormat, ...)
va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(buf, SIZEOF(buf), TranslateTS(pszFormat), vl);
+ mir_vsntprintf(buf, _countof(buf), TranslateTS(pszFormat), vl);
va_end(vl);
SetDlgItemText(_hDlg, TXT_CONTACT, buf);
}
@@ -221,9 +221,9 @@ BYTE CProgress::UpdateSetting(LPCTSTR pszFormat, ...)
va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(buf, SIZEOF(buf), TranslateTS(pszFormat), vl);
+ mir_vsntprintf(buf, _countof(buf), TranslateTS(pszFormat), vl);
va_end(vl);
- GetDlgItemText(_hDlg, TXT_SETTING, tmp, SIZEOF(tmp));
+ GetDlgItemText(_hDlg, TXT_SETTING, tmp, _countof(tmp));
if (mir_tstrcmpi(tmp,buf))
SetDlgItemText(_hDlg, TXT_SETTING, buf);
}
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
index b2a0a1676f..7301d87175 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
@@ -35,7 +35,7 @@ INT_PTR CALLBACK DlgProc_DataHistory(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
{ ICO_BTN_EXPORT, BM_SETIMAGE, IDOK },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 2;
+ const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
TranslateDialogDefault(hDlg);
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp
index 3b7fea78fe..e9898a9e50 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp
@@ -115,7 +115,7 @@ INT_PTR SvcExImport_Export(lpExImParam ExImContact, HWND hwndParent)
{
CHAR szFileName[MAX_PATH] = { 0 };
// create the filename to suggest the user for the to export contact
- DisplayNameToFileName(ExImContact, szFileName, SIZEOF(szFileName));
+ DisplayNameToFileName(ExImContact, szFileName, _countof(szFileName));
int nIndex = DlgExIm_SaveFileName(hwndParent,
Translate("Select a destination file..."),
FilterString(ExImContact),
@@ -158,7 +158,7 @@ INT_PTR SvcExImport_Import(lpExImParam ExImContact, HWND hwndParent)
CHAR szFileName[MAX_PATH] = { 0 };
// create the filename to suggest the user for the to export contact
- DisplayNameToFileName(ExImContact, szFileName, SIZEOF(szFileName));
+ DisplayNameToFileName(ExImContact, szFileName, _countof(szFileName));
int nIndex = DlgExIm_OpenFileName(hwndParent,
Translate("Import User Details from VCard"),
@@ -280,7 +280,7 @@ INT_PTR svcExIm_Group_Service(WPARAM wParam, LPARAM lParam)
if (SendMessage(hClist,CLM_GETITEMTYPE, (WPARAM)hItem, 0) == CLCIT_GROUP) {
SendMessage(hClist,CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)ptszItem);
LPTSTR temp = mir_tstrdup(ptszGroup);
- mir_sntprintf(tszGroup, SIZEOF(tszGroup),_T("%s%s%s"), ptszItem, mir_tstrlen(temp)? _T("\\"):_T(""), temp);
+ mir_sntprintf(tszGroup, _countof(tszGroup),_T("%s%s%s"), ptszItem, mir_tstrlen(temp)? _T("\\"):_T(""), temp);
mir_free (temp);
}
hParent = SendMessage(hClist,CLM_GETNEXTITEM, (WPARAM)CLGN_PARENT, (LPARAM)hItem);