diff options
Diffstat (limited to 'sal/systools/win32')
-rw-r--r-- | sal/systools/win32/kill/kill.cxx | 11 | ||||
-rw-r--r-- | sal/systools/win32/onlineupdate/onlinecheck.cxx | 4 | ||||
-rw-r--r-- | sal/systools/win32/uwinapi/MoveFileExA.cpp | 5 |
3 files changed, 8 insertions, 12 deletions
diff --git a/sal/systools/win32/kill/kill.cxx b/sal/systools/win32/kill/kill.cxx index 1103950d5..55966d6b5 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 dfcf2de53..1ea723219 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 4f7522fa5..6c47078a4 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; |