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/SkypeStatusChange/src/main.cpp | 8 ++++---- plugins/SkypeStatusChange/src/options.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'plugins/SkypeStatusChange') diff --git a/plugins/SkypeStatusChange/src/main.cpp b/plugins/SkypeStatusChange/src/main.cpp index 068342e2fc..fab0d1ce7d 100644 --- a/plugins/SkypeStatusChange/src/main.cpp +++ b/plugins/SkypeStatusChange/src/main.cpp @@ -100,7 +100,7 @@ int SSC_OnProtocolAck(WPARAM, LPARAM lParam) if (!g_Options.IsProtocolExcluded(pAckData->szModule)) { int nStatus = CallProtoService(pAckData->szModule,PS_GETSTATUS,0,0); - for(size_t i = 0; i < SIZEOF(g_aStatusCode); ++i) { + for(size_t i = 0; i < _countof(g_aStatusCode); ++i) { const CMirandaStatus2SkypeStatus& ms = g_aStatusCode[i]; if (ms.m_nMirandaStatus == nStatus) { int nPrevStatus; @@ -171,7 +171,7 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) mir_cslock guard(g_csStatusInfo); si = g_CurrStatusInfo; } - if (INVALID_INDEX != si.StatusIndex() && si.StatusIndex() < SIZEOF(g_aStatusCode)) { + if (INVALID_INDEX != si.StatusIndex() && si.StatusIndex() < _countof(g_aStatusCode)) { const CMirandaStatus2SkypeStatus& ms = g_aStatusCode[si.StatusIndex()]; HWND wndSkypeAPIWindow = reinterpret_cast(wp); @@ -179,7 +179,7 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) char szSkypeCmd[BUFFER_SIZE]; const char szSkypeCmdSetStatus[] = "SET USERSTATUS "; ::strncpy_s(szSkypeCmd,szSkypeCmdSetStatus,sizeof(szSkypeCmdSetStatus)/sizeof(szSkypeCmdSetStatus[0])); - ::strncat_s(szSkypeCmd, ms.m_pszSkypeStatus, SIZEOF(szSkypeCmd) - mir_strlen(szSkypeCmd)); + ::strncat_s(szSkypeCmd, ms.m_pszSkypeStatus, _countof(szSkypeCmd) - mir_strlen(szSkypeCmd)); DWORD cLength = static_cast(mir_strlen(szSkypeCmd)); COPYDATASTRUCT oCopyData; @@ -201,7 +201,7 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) const char szSkypeCmdSetStatusMsg[] = "SET PROFILE MOOD_TEXT "; ::strncpy_s(szSkypeCmd,szSkypeCmdSetStatusMsg,sizeof(szSkypeCmdSetStatusMsg)/sizeof(szSkypeCmdSetStatusMsg[0])); - ::strncat_s(szSkypeCmd, pMsg, SIZEOF(szSkypeCmd) - mir_strlen(szSkypeCmd)); + ::strncat_s(szSkypeCmd, pMsg, _countof(szSkypeCmd) - mir_strlen(szSkypeCmd)); DWORD cLength = static_cast(mir_strlen(szSkypeCmd)); diff --git a/plugins/SkypeStatusChange/src/options.cpp b/plugins/SkypeStatusChange/src/options.cpp index 5fc56c5a53..d761a98d86 100644 --- a/plugins/SkypeStatusChange/src/options.cpp +++ b/plugins/SkypeStatusChange/src/options.cpp @@ -79,7 +79,7 @@ void InitProtocolTree(HWND hDlg,HWND hwndTreeCtrl) nState = TCBS_UNCHECKED; } tree_insert_item(hDlg,hwndTreeCtrl,TranslateTS(g_aStatusCode[OFFLINE_STATUS_INDEX].m_ptszStatusName),hti,nState,pItemData); - for(size_t k = 0; k < SIZEOF(g_aStatusCode); ++k) { + for(size_t k = 0; k < _countof(g_aStatusCode); ++k) { const CMirandaStatus2SkypeStatus& m2s = g_aStatusCode[k]; unsigned long statusFlags = Proto_Status2Flag(m2s.m_nMirandaStatus); if ((m2s.m_nMirandaStatus != ID_STATUS_OFFLINE) && (nStatusBits & statusFlags) && !(nStatusExcluded & statusFlags)) { -- cgit v1.2.3