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/Exchange/src/MirandaExchange.cpp | 4 ++-- plugins/Exchange/src/dlg_handlers.cpp | 18 +++++++++--------- plugins/Exchange/src/emails.cpp | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'plugins/Exchange/src') diff --git a/plugins/Exchange/src/MirandaExchange.cpp b/plugins/Exchange/src/MirandaExchange.cpp index 52a21e8a18..5d2c21c5db 100644 --- a/plugins/Exchange/src/MirandaExchange.cpp +++ b/plugins/Exchange/src/MirandaExchange.cpp @@ -435,8 +435,8 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass TCHAR szPID[20]; _tstrtime(szPID); - _tcsncpy(szPIDandName, m_szUsername, SIZEOF(szPIDandName)-1); - mir_tstrncat(szPIDandName, szPID, SIZEOF(szPIDandName) - mir_tstrlen(szPIDandName)); + _tcsncpy(szPIDandName, m_szUsername, _countof(szPIDandName)-1); + mir_tstrncat(szPIDandName, szPID, _countof(szPIDandName) - mir_tstrlen(szPIDandName)); hr = CreateProfile(szPIDandName); if ( HR_FAILED(hr)) { diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp index 754cefb113..badc63fc33 100644 --- a/plugins/Exchange/src/dlg_handlers.cpp +++ b/plugins/Exchange/src/dlg_handlers.cpp @@ -41,13 +41,13 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara int bCheck = db_get_b(NULL, ModuleName, "Check", 1); TCHAR buffer[4096]; - GetStringFromDatabase("Username", _T(""), buffer, SIZEOF(buffer)); + GetStringFromDatabase("Username", _T(""), buffer, _countof(buffer)); SetDlgItemText(hWnd, IDC_USER_EDIT, buffer); - GetStringFromDatabase("Password", _T(""), buffer, SIZEOF(buffer)); + GetStringFromDatabase("Password", _T(""), buffer, _countof(buffer)); SetDlgItemText(hWnd, IDC_PASSWORD_EDIT, buffer); - GetStringFromDatabase("Server", _T(""), buffer, SIZEOF(buffer)); + GetStringFromDatabase("Server", _T(""), buffer, _countof(buffer)); SetDlgItemText(hWnd, IDC_SERVER_EDIT, buffer); SetDlgItemInt(hWnd, IDC_PORT_EDIT, db_get_dw(NULL, ModuleName, "Port", EXCHANGE_PORT), FALSE); @@ -111,16 +111,16 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara db_set_b(NULL, ModuleName, "Check", IsDlgButtonChecked(hWnd, IDC_CHECK_EMAILS)); TCHAR buffer[4096]; - GetDlgItemText(hWnd, IDC_USER_EDIT, buffer, SIZEOF(buffer)); + GetDlgItemText(hWnd, IDC_USER_EDIT, buffer, _countof(buffer)); db_set_ts(NULL, ModuleName, "Username", buffer); - GetDlgItemText(hWnd, IDC_PASSWORD_EDIT, buffer, SIZEOF(buffer)); + GetDlgItemText(hWnd, IDC_PASSWORD_EDIT, buffer, _countof(buffer)); db_set_ts(NULL, ModuleName, "Password", buffer); - GetDlgItemText(hWnd, IDC_SERVER_EDIT, buffer, SIZEOF(buffer)); + GetDlgItemText(hWnd, IDC_SERVER_EDIT, buffer, _countof(buffer)); db_set_ts(NULL, ModuleName, "Server", buffer); - GetDlgItemText(hWnd, IDC_PORT_EDIT, buffer, SIZEOF(buffer)); + GetDlgItemText(hWnd, IDC_PORT_EDIT, buffer, _countof(buffer)); db_set_dw(NULL, ModuleName, "Port", GetDlgItemInt(hWnd,IDC_PORT_EDIT,NULL,FALSE)); db_set_dw(NULL, ModuleName, "Interval", GetDlgItemInt(hWnd,IDC_INTERVAL_EDIT,NULL,FALSE)); @@ -174,7 +174,7 @@ int CALLBACK ListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) for (int i = 0; i < count; i++) { if (ListView_GetItemState(hWnd, i, LVIS_SELECTED)) { TCHAR emailID[4096]; //uhh - ListView_GetItemText(hWnd, i, 2, emailID, SIZEOF(emailID)); + ListView_GetItemText(hWnd, i, 2, emailID, _countof(emailID)); exchangeServer.OpenMessage(emailID); } } @@ -303,7 +303,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam item.iItem = i; item.mask = LVIF_TEXT; item.iSubItem = 2; - item.cchTextMax = SIZEOF(emailID); + item.cchTextMax = _countof(emailID); item.pszText = emailID; ListView_GetItem(hList, &item); exchangeServer.MarkEmailAsRead(emailID); diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp index ae6b2309e7..c362ac3852 100644 --- a/plugins/Exchange/src/emails.cpp +++ b/plugins/Exchange/src/emails.cpp @@ -280,9 +280,9 @@ int CExchangeServer::Check(int bNoEmailsNotify) if (((count > 0) || ((bNoEmailsNotify) && (count >= 0))) && (count != -1)) { TCHAR buffer[1024]; if (count != 1) - mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("You have %d unread emails..."), count); + mir_sntprintf(buffer, _countof(buffer), TranslateT("You have %d unread emails..."), count); else - mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("You have one unread email...")); + mir_sntprintf(buffer, _countof(buffer), TranslateT("You have one unread email...")); ShowMessage(buffer, count); } -- cgit v1.2.3