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/Popup/src/popup_wnd2.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'plugins/Popup/src/popup_wnd2.cpp') diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index f1183f6dd4..f31013e2e6 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -65,7 +65,7 @@ bool LoadPopupWnd2() if (!g_wndClass.cPopupWnd2) { res = false; TCHAR msg[1024]; - mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); + mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); MessageBox(NULL, msg, _T(MODULNAME_LONG), MB_ICONSTOP | MB_OK); } @@ -80,7 +80,7 @@ bool LoadPopupWnd2() err = GetLastError(); if (!g_wndClass.cPopupEditBox) { TCHAR msg[2048]; - mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register custom edit box window class.\r\n\r\ncbSize: %i\r\nstyle: %p\r\nlpfnWndProc: %i\r\ncbClsExtra: %i\r\ncbWndExtra: %i\r\nhInstance: %i\r\nhIcon: %i\r\nhCursor: %i\r\nhbrBackground: %i\r\nlpszMenuName: %s\r\nlpszClassName: %s\r\nhIconSm: %i\r\n"), + mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register custom edit box window class.\r\n\r\ncbSize: %i\r\nstyle: %p\r\nlpfnWndProc: %i\r\ncbClsExtra: %i\r\ncbWndExtra: %i\r\nhInstance: %i\r\nhIcon: %i\r\nhCursor: %i\r\nhbrBackground: %i\r\nlpszMenuName: %s\r\nlpszClassName: %s\r\nhIconSm: %i\r\n"), wclw.cbSize, // UINT cbSize; wclw.style, // UINT style; wclw.lpfnWndProc, // WNDPROC lpfnWndProc; @@ -116,7 +116,7 @@ bool LoadPopupWnd2() if (!g_wndClass.cPopupMenuHostWnd) { res = false; TCHAR msg[1024]; - mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); + mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); MSGERROR(msg); } @@ -350,7 +350,7 @@ void PopupWnd2::show() if (*PopupOptions.Effect) { char vfxService[128]; - mir_snprintf(vfxService, SIZEOF(vfxService), "Popup/Vfx/%S", PopupOptions.Effect); + mir_snprintf(vfxService, _countof(vfxService), "Popup/Vfx/%S", PopupOptions.Effect); if (ServiceExists(vfxService)) if (effect = (IPopupPlusEffect *)CallService(vfxService, 0, 0)) { effect->beginEffect(m_bmp->getWidth(), m_bmp->getHeight(), m_btAlpha0, m_btAlpha1, dwTime1 - dwTime0); @@ -437,7 +437,7 @@ void PopupWnd2::hide() if (*PopupOptions.Effect) { char vfxService[128]; - mir_snprintf(vfxService, SIZEOF(vfxService), "Popup/Vfx/%S", PopupOptions.Effect); + mir_snprintf(vfxService, _countof(vfxService), "Popup/Vfx/%S", PopupOptions.Effect); if (ServiceExists(vfxService)) if (effect = (IPopupPlusEffect *)CallService(vfxService, 0, 0)) { effect->beginEffect(m_bmp->getWidth(), m_bmp->getHeight(), m_btAlpha0, m_btAlpha1, dwTime1 - dwTime0); @@ -712,7 +712,7 @@ void PopupWnd2::updateData(POPUPDATAW_V2 *ppd) m_PluginWindowProc = ppd->PluginWindowProc; if (m_options->DisplayTime) - GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, SIZEOF(m_time)); + GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, _countof(m_time)); else m_time[0] = 0; fixDefaults(); @@ -752,9 +752,9 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd) if (m_options->DisplayTime) { if (ppd->dwTimestamp) - TimeZone_ToStringT(ppd->dwTimestamp, _T("t"), m_time, SIZEOF(m_time)); + TimeZone_ToStringT(ppd->dwTimestamp, _T("t"), m_time, _countof(m_time)); else - GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, SIZEOF(m_time)); + GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, _countof(m_time)); } else m_time[0] = 0; @@ -847,7 +847,7 @@ LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM switch (wParam) { case VK_RETURN: TCHAR msg[2048]; - GetWindowText(hwnd, msg, SIZEOF(msg)); + GetWindowText(hwnd, msg, _countof(msg)); if (mir_wstrlen(msg) == 0) { DestroyWindow(hwnd); return 0; -- cgit v1.2.3