From 4c814798c7bc7f6a0f92c21b027b26290622aa2f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jun 2015 19:35:42 +0000 Subject: SIZEOF replaced with more secure analog - _countof git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/FavContacts/src/contact_cache.cpp | 8 ++++---- plugins/FavContacts/src/main.cpp | 2 +- plugins/FavContacts/src/menu.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'plugins/FavContacts') diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp index 896eae5cca..d35e8c890e 100644 --- a/plugins/FavContacts/src/contact_cache.cpp +++ b/plugins/FavContacts/src/contact_cache.cpp @@ -148,8 +148,8 @@ void CContactCache::TContactInfo::LoadInfo() CNF_CONAME, CNF_CODEPT, CNF_COCITY, CNF_COSTATE, CNF_COSTREET, CNF_COCOUNTRY }; - for (int i = 0; i < SIZEOF(items); ++i) - if (AppendInfo(p, SIZEOF(info) - (p - info), hContact, items[i])) + for (int i = 0; i < _countof(items); ++i) + if (AppendInfo(p, _countof(info) - (p - info), hContact, items[i])) p += mir_tstrlen(p) + 1; *p = 0; @@ -180,7 +180,7 @@ bool CContactCache::filter(int rate, TCHAR *str) HKL kbdLayoutActive = GetKeyboardLayout(GetCurrentThreadId()); HKL kbdLayouts[10]; - int nKbdLayouts = GetKeyboardLayoutList(SIZEOF(kbdLayouts), kbdLayouts); + int nKbdLayouts = GetKeyboardLayoutList(_countof(kbdLayouts), kbdLayouts); TCHAR buf[256]; BYTE keyState[256] = { 0 }; @@ -193,7 +193,7 @@ bool CContactCache::filter(int rate, TCHAR *str) for (i = 0; str[i]; ++i) { UINT vk = VkKeyScanEx(str[i], kbdLayoutActive); UINT scan = MapVirtualKeyEx(vk, 0, kbdLayoutActive); - ToUnicodeEx(vk, scan, keyState, buf + i, SIZEOF(buf) - i, 0, kbdLayouts[iLayout]); + ToUnicodeEx(vk, scan, keyState, buf + i, _countof(buf) - i, 0, kbdLayouts[iLayout]); } buf[i] = 0; } diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index 62579e9ba2..42cc773ae7 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -78,7 +78,7 @@ extern "C" __declspec(dllexport) int Load(void) ///////////////////////////////////////////////////////////////////////////////////// - Icon_Register(g_hInst, LPGEN("Favorites"), iconList, SIZEOF(iconList)); + Icon_Register(g_hInst, LPGEN("Favorites"), iconList, _countof(iconList)); LoadHttpApi(); return 0; diff --git a/plugins/FavContacts/src/menu.cpp b/plugins/FavContacts/src/menu.cpp index 0045f5da1b..2bb6fef449 100644 --- a/plugins/FavContacts/src/menu.cpp +++ b/plugins/FavContacts/src/menu.cpp @@ -394,7 +394,7 @@ static LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, g_filter[l-1] = 0; } else if (_istalnum(LOWORD(wParam))) { - if (mir_tstrlen(g_filter) < SIZEOF(g_filter) - 1) { + if (mir_tstrlen(g_filter) < _countof(g_filter) - 1) { TCHAR s[] = { LOWORD(wParam), 0 }; mir_tstrcat(g_filter, s); } -- cgit v1.2.3