use SAL_N_ELEMENTS

This commit is contained in:
Florian Bircher 2010-10-18 18:54:59 -05:00 committed by Norbert Thiebaud
parent bc8fcf207f
commit ae635c1eda
4 changed files with 13 additions and 12 deletions

View file

@ -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 )
{

View file

@ -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 );

View file

@ -39,6 +39,7 @@
#include <tchar.h>
#include <stdio.h>
#include <systools/win32/uwinapi.h>
#include <sal/macros.h>
// 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 );

View file

@ -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