summaryrefslogtreecommitdiff
path: root/sal/systools
diff options
context:
space:
mode:
authorKenneth Venken <kenneth.venken@gmail.com>2010-10-18 19:47:47 +0100
committerMichael Meeks <michael.meeks@novell.com>2010-10-18 19:47:47 +0100
commit522faf9ccb25254e3c765425c74aee5c2aa6c950 (patch)
treefb4edb37fb880b3a8394d4b4d926a237a5c8908e /sal/systools
parentc189268e0ab3ec33c02c5dbabfd31b37e0b1f5ab (diff)
cleanup to use SAL_N_ELEMENTS
Diffstat (limited to 'sal/systools')
-rw-r--r--sal/systools/win32/kill/kill.cxx11
-rw-r--r--sal/systools/win32/onlineupdate/onlinecheck.cxx4
-rw-r--r--sal/systools/win32/uwinapi/MoveFileExA.cpp5
3 files changed, 8 insertions, 12 deletions
diff --git a/sal/systools/win32/kill/kill.cxx b/sal/systools/win32/kill/kill.cxx
index f10e5e5614f4..56a464c6448b 100644
--- a/sal/systools/win32/kill/kill.cxx
+++ b/sal/systools/win32/kill/kill.cxx
@@ -68,9 +68,6 @@ static inline bool IsValidHandle( HANDLE handle )
return INVALID_HANDLE_VALUE != handle && NULL != handle;
}
-
-#define elementsof( a ) (sizeof(a) / sizeof( (a)[0] ))
-
/////////////////////////////////////////////////////////////////////////////
// Retrieves function adress in another process
/////////////////////////////////////////////////////////////////////////////
@@ -91,7 +88,7 @@ FARPROC WINAPI GetProcAddressEx( HANDLE hProcess, HMODULE hModule, LPCSTR lpProc
FARPROC lpfnRemoteProcAddress = NULL;
TCHAR szBaseName[MAX_PATH];
- if ( GetModuleBaseName( GetCurrentProcess(), hModule, szBaseName, elementsof(szBaseName) ) )
+ if ( GetModuleBaseName( GetCurrentProcess(), hModule, szBaseName, SAL_N_ELEMENTS(szBaseName) ) )
{
HMODULE ahModules[MAX_MODULES];
DWORD cbNeeded = 0;
@@ -105,7 +102,7 @@ FARPROC WINAPI GetProcAddressEx( HANDLE hProcess, HMODULE hModule, LPCSTR lpProc
TCHAR szRemoteBaseName[MAX_PATH];
if ( GetModuleBaseName(
- hProcess, ahModules[n], szRemoteBaseName, elementsof(szRemoteBaseName) ) &&
+ hProcess, ahModules[n], szRemoteBaseName, SAL_N_ELEMENTS(szRemoteBaseName) ) &&
0 == lstrcmpi( szRemoteBaseName, szBaseName )
)
{
@@ -257,7 +254,7 @@ static void ParseCommandArgs( LPDWORD lpProcesses, LPDWORD lpdwNumProcesses, int
SIG_ENTRY( KILL )
};
- const int NumSupportedSignals = elementsof(SupportedSignals);
+ const int NumSupportedSignals = SAL_N_ELEMENTS(SupportedSignals);
DWORD dwMaxProcesses = *lpdwNumProcesses;
int argc = __argc;
@@ -402,7 +399,7 @@ void OutputSystemMessage( DWORD dwErrorCode )
int _tmain()
{
DWORD dwProcessIds[1024];
- DWORD nProcesses = elementsof(dwProcessIds);
+ DWORD nProcesses = SAL_N_ELEMENTS(dwProcessIds);
int sig = SIGTERM;
diff --git a/sal/systools/win32/onlineupdate/onlinecheck.cxx b/sal/systools/win32/onlineupdate/onlinecheck.cxx
index aa33c13a4879..25a2e579481a 100644
--- a/sal/systools/win32/onlineupdate/onlinecheck.cxx
+++ b/sal/systools/win32/onlineupdate/onlinecheck.cxx
@@ -46,8 +46,6 @@
#include <excpt.h>
#endif
-#define elementsof(a) (sizeof(a)/sizeof((a)[0]))
-
// #i71984
extern "C" sal_Bool SAL_CALL hasInternetConnection()
{
@@ -66,7 +64,7 @@ extern "C" sal_Bool SAL_CALL hasInternetConnection()
BOOL fIsConnected = InternetGetConnectedStateEx(
&dwFlags,
szConnectionName,
- elementsof(szConnectionName),
+ SAL_N_ELEMENTS(szConnectionName),
0 );
return fIsConnected ? sal_True : sal_False;
diff --git a/sal/systools/win32/uwinapi/MoveFileExA.cpp b/sal/systools/win32/uwinapi/MoveFileExA.cpp
index ca840c33fb4e..c1e6a3663576 100644
--- a/sal/systools/win32/uwinapi/MoveFileExA.cpp
+++ b/sal/systools/win32/uwinapi/MoveFileExA.cpp
@@ -27,6 +27,7 @@
************************************************************************/
#include "macros.h"
+#include <sal/macros.h>
#define WININIT_FILENAME "wininit.ini"
#define RENAME_SECTION "rename"
@@ -50,7 +51,7 @@ IMPLEMENT_THUNK( kernel32, WINDOWS, BOOL, WINAPI, MoveFileExA, ( LPCSTR lpExisti
)
{
CHAR szBuffer[32767]; // The buffer size must not exceed 32K
- DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, elementsof(szBuffer), WININIT_FILENAME );
+ DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, SAL_N_ELEMENTS(szBuffer), WININIT_FILENAME );
CHAR szRename[MAX_PATH]; // This is enough for at most to times 67 chracters
strcpy( szRename, szNewFileNameA );
@@ -58,7 +59,7 @@ IMPLEMENT_THUNK( kernel32, WINDOWS, BOOL, WINAPI, MoveFileExA, ( LPCSTR lpExisti
strcat( szRename, szExistingFileNameA );
size_t lnRename = strlen(szRename);
- if ( dwBufLen + lnRename + 2 <= elementsof(szBuffer) )
+ if ( dwBufLen + lnRename + 2 <= SAL_N_ELEMENTS(szBuffer) )
{
CopyMemory( &szBuffer[dwBufLen], szRename, lnRename );
szBuffer[dwBufLen + lnRename ] = 0;