From ae635c1eda512ad4e2d2f9181d6118654ff77e70 Mon Sep 17 00:00:00 2001 From: Florian Bircher Date: Mon, 18 Oct 2010 18:54:59 -0500 Subject: use SAL_N_ELEMENTS --- desktop/win32/source/guistdio/guistdio.inc | 4 ++-- desktop/win32/source/officeloader/officeloader.cxx | 10 +++++----- svx/source/dialog/sendreportw32.cxx | 5 +++-- sysui/source/win32/QuickStart/QuickStart.cpp | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/desktop/win32/source/guistdio/guistdio.inc b/desktop/win32/source/guistdio/guistdio.inc index 7009b24a0dc4..05d462d23197 100644 --- a/desktop/win32/source/guistdio/guistdio.inc +++ b/desktop/win32/source/guistdio/guistdio.inc @@ -411,13 +411,13 @@ int _tmain( int, _TCHAR ** ) }; #ifdef UNOPKG - dwWaitResult = WaitForMultipleObjects( elementsof(hObjects), hObjects, TRUE, INFINITE ); + dwWaitResult = WaitForMultipleObjects( SAL_N_ELEMENTS(hObjects), hObjects, TRUE, INFINITE ); #else bool bDetach = false; int nOpenPipes = 2; do { - dwWaitResult = WaitForMultipleObjects( elementsof(hObjects), hObjects, FALSE, INFINITE ); + dwWaitResult = WaitForMultipleObjects( SAL_N_ELEMENTS(hObjects), hObjects, FALSE, INFINITE ); switch ( dwWaitResult ) { diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx index 0588814a9076..d3335c80a560 100644 --- a/desktop/win32/source/officeloader/officeloader.cxx +++ b/desktop/win32/source/officeloader/officeloader.cxx @@ -230,7 +230,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int ) TEXT("FastPipeCommunication"), TEXT("0"), szKey, - elementsof(szKey), + SAL_N_ELEMENTS(szKey), szPerfTuneIniFile ); @@ -258,10 +258,10 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int ) fSuccess = ConvertSidToStringSid( pSid, &szUserIdent ); - _tcsncpy( szPipeName, PIPE_PREFIX, elementsof(szPipeName) ); - _tcsncat( szPipeName, szUserIdent, elementsof(szPipeName) - _tcslen(szPipeName) - 1 ); - _tcsncat( szPipeName, PIPE_POSTFIX, elementsof(szPipeName) - _tcslen(szPipeName) - 1 ); - _tcsncat( szPipeName, _ultot( SUPD, szSUPD, 10), elementsof(szPipeName) - _tcslen(szPipeName) - 1 ); + _tcsncpy( szPipeName, PIPE_PREFIX, SAL_N_ELEMENTS(szPipeName) ); + _tcsncat( szPipeName, szUserIdent, SAL_N_ELEMENTS(szPipeName) - _tcslen(szPipeName) - 1 ); + _tcsncat( szPipeName, PIPE_POSTFIX, SAL_N_ELEMENTS(szPipeName) - _tcslen(szPipeName) - 1 ); + _tcsncat( szPipeName, _ultot( SUPD, szSUPD, 10), SAL_N_ELEMENTS(szPipeName) - _tcslen(szPipeName) - 1 ); LocalFree( szUserIdent ); diff --git a/svx/source/dialog/sendreportw32.cxx b/svx/source/dialog/sendreportw32.cxx index fd064ed2606c..2c879b31a4f9 100644 --- a/svx/source/dialog/sendreportw32.cxx +++ b/svx/source/dialog/sendreportw32.cxx @@ -39,6 +39,7 @@ #include #include #include +#include // need to undef min and max macros from MS headers here to make // the std::min and std::max from stl visible again @@ -199,7 +200,7 @@ namespace svx{ TCHAR szTempPath[MAX_PATH]; TCHAR szFileName[MAX_PATH]; - GetTempPath( elementsof(szTempPath), szTempPath ); + GetTempPath( SAL_N_ELEMENTS(szTempPath), szTempPath ); GetTempFileName( szTempPath, TEXT("DSC"), 0, szFileName ); FILE *fp = _tfopen( szFileName, _T("wb") ); @@ -226,7 +227,7 @@ namespace svx{ ZeroMemory( &StartupInfo, sizeof(StartupInfo) ); StartupInfo.cb = sizeof(StartupInfo.cb); - sntprintf( szBuffer, elementsof(szBuffer), + sntprintf( szBuffer, SAL_N_ELEMENTS(szBuffer), _T("%s -noui -load -send"), szPath ); diff --git a/sysui/source/win32/QuickStart/QuickStart.cpp b/sysui/source/win32/QuickStart/QuickStart.cpp index 0fca25a17635..999701da985a 100644 --- a/sysui/source/win32/QuickStart/QuickStart.cpp +++ b/sysui/source/win32/QuickStart/QuickStart.cpp @@ -102,11 +102,11 @@ void NotifyListener( HWND hWnd ) nid.cbSize = sizeof(NOTIFYICONDATA); nid.hWnd = hWnd; nid.uID = IDM_QUICKSTART; - nid.szTip[elementsof(nid.szTip) - 1] = 0; + nid.szTip[SAL_N_ELEMENTS(nid.szTip) - 1] = 0; // nid.hIcon = bTerminateVeto ? hIconActive : hIconInActive; -// strncpy(nid.szTip, bTerminateVeto ? STRING_QUICKSTARTACTIVE : STRING_QUICKSTARTINACTIVE, elementsof(nid.szTip) - 1 ); +// strncpy(nid.szTip, bTerminateVeto ? STRING_QUICKSTARTACTIVE : STRING_QUICKSTARTINACTIVE, SAL_N_ELEMENTS(nid.szTip) - 1 ); nid.hIcon = hIconActive; - strncpy(nid.szTip, szTooltipString, elementsof(nid.szTip) - 1); + strncpy(nid.szTip, szTooltipString, SAL_N_ELEMENTS(nid.szTip) - 1); nid.uFlags = NIF_TIP|NIF_ICON; // update systray -- cgit