Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index


 some build breakers

#include <systools/win32/uwinapi.h>  has now #include <sal/macros.h>
(commit from shm_get)

todo:
so a next step would be remove all #include <sal/macros.h> where already
is a #include <systools/win32/uwinapi.h>


commint under lgpl v3


diff --git a/desktop/win32/source/guistdio/guistdio.inc b/desktop/win32/source/guistdio/guistdio.inc
index 7009b24..05d462d 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 c5e34dc..cce56b0 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 1eba75c..b50dc0c 100644
--- a/svx/source/dialog/sendreportw32.cxx
+++ b/svx/source/dialog/sendreportw32.cxx
@@ -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 );
 
diff --git a/sysui/source/win32/QuickStart/QuickStart.cpp 
b/sysui/source/win32/QuickStart/QuickStart.cpp
index 8e37560..65eba7d 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
diff --git a/sal/systools/win32/kill/kill.cxx b/sal/systools/win32/kill/kill.cxx
index 55966d6..4a6fa52 100644
--- a/sal/systools/win32/kill/kill.cxx
+++ b/sal/systools/win32/kill/kill.cxx
@@ -46,6 +46,7 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <sal/macros.h>
 
 #ifndef SIGNULL
 #define SIGNULL        0
diff --git a/sal/systools/win32/onlineupdate/onlinecheck.cxx 
b/sal/systools/win32/onlineupdate/onlinecheck.cxx
index 1ea7232..67289ba 100644
--- a/sal/systools/win32/onlineupdate/onlinecheck.cxx
+++ b/sal/systools/win32/onlineupdate/onlinecheck.cxx
@@ -33,6 +33,7 @@
 #endif
 
 #include <sal/types.h>
+#include <sal/macros.h>
 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
diff --git a/crashrep/source/win32/soreport.cpp b/crashrep/source/win32/soreport.cpp
index f7918ee..def4046 100644
--- a/crashrep/source/win32/soreport.cpp
+++ b/crashrep/source/win32/soreport.cpp
@@ -155,7 +155,7 @@ static FILE *_tmpfile(void)
 
     TCHAR      szTempPath[MAX_PATH];
 
-    if ( GetTempPath( elementsof(szTempPath), szTempPath ) )
+    if ( GetTempPath( SAL_N_ELEMENTS(szTempPath), szTempPath ) )
     {
         TCHAR  szFileName[MAX_PATH];
 
@@ -397,27 +397,27 @@ void CrashReportParams::ReadFromEnvironment()
 {
     TCHAR      szBuffer[2048];
 
-    DWORD dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_HTTPPROXYSERVER"), szBuffer, 
elementsof(szBuffer) );
+    DWORD dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_HTTPPROXYSERVER"), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
 
-    if ( dwResult && dwResult < elementsof(szBuffer) )
+    if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) )
         sProxyServer = szBuffer;
 
-    dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_HTTPPROXYPORT"), szBuffer, 
elementsof(szBuffer) );
+    dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_HTTPPROXYPORT"), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
 
-    if ( dwResult && dwResult < elementsof(szBuffer) )
+    if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) )
         sProxyPort = szBuffer;
 
-    dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_RETURNADDRESS"), szBuffer, 
elementsof(szBuffer) );
+    dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_RETURNADDRESS"), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
 
-    if ( dwResult && dwResult < elementsof(szBuffer) )
+    if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) )
     {
         sEmail = szBuffer;
         // fAllowContact = TRUE;
     }
 
-    dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_HTTPCONNECTIONTYPE"), szBuffer, 
elementsof(szBuffer) );
+    dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_HTTPCONNECTIONTYPE"), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
 
-    if ( dwResult && dwResult < elementsof(szBuffer) )
+    if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) )
     {
         if ( 0 == _tcsicmp( szBuffer, _T("DIRECT") ) )
             uInternetConnection = 1;
@@ -427,15 +427,15 @@ void CrashReportParams::ReadFromEnvironment()
             uInternetConnection = 0;
     }
 
-    dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_SUBJECT"), szBuffer, elementsof(szBuffer) 
);
+    dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_SUBJECT"), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
 
-    if ( dwResult && dwResult < elementsof(szBuffer) )
+    if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) )
         sTitle = szBuffer;
 
 
-    dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_BODYFILE"), szBuffer, 
elementsof(szBuffer) );
+    dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_BODYFILE"), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
 
-    if ( dwResult && dwResult < elementsof(szBuffer) )
+    if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) )
     {
         FILE *fp = _xfopen( szBuffer, _T("rb") );
 
@@ -446,11 +446,11 @@ void CrashReportParams::ReadFromEnvironment()
 
             sComment = TEXT("");
 
-            while ( 0 != (nBytesRead = fread( aUTF8Buffer, sizeof(aUTF8Buffer[0]), 
elementsof(aUTF8Buffer), fp )) )
+            while ( 0 != (nBytesRead = fread( aUTF8Buffer, sizeof(aUTF8Buffer[0]), 
SAL_N_ELEMENTS(aUTF8Buffer), fp )) )
             {
                 TCHAR  aBuffer[256+1];
 
-                DWORD  dwCharacters = MultiByteToWideChar( CP_UTF8, 0, aUTF8Buffer, nBytesRead, 
aBuffer, elementsof(aBuffer) - 1 ); 
+                DWORD  dwCharacters = MultiByteToWideChar( CP_UTF8, 0, aUTF8Buffer, nBytesRead, 
aBuffer, SAL_N_ELEMENTS(aBuffer) - 1 ); 
                 aBuffer[dwCharacters] = 0;
                 sComment += aBuffer;
             }
@@ -513,7 +513,7 @@ static int LoadAndFormatString( HINSTANCE hInstance, UINT uID, LPTSTR lpBuffer,
     TCHAR      szBuffer[FORMATBUFSIZE];
     TCHAR      szBuffer2[FORMATBUFSIZE];
 
-    LoadString( hInstance, uID, szBuffer, elementsof(szBuffer) );
+    LoadString( hInstance, uID, szBuffer, SAL_N_ELEMENTS(szBuffer) );
 
     LPCTSTR    src;
     LPTSTR     dest;
@@ -622,7 +622,7 @@ static string GetModuleDirectory( HMODULE hModule )
 
     CHAR       szModuleNameUTF8[MAX_PATH] = "";
 
-    WideCharToMultiByte( CP_UTF8, 0, szModuleName, -1, szModuleNameUTF8, 
elementsof(szModuleNameUTF8), NULL, NULL );
+    WideCharToMultiByte( CP_UTF8, 0, szModuleName, -1, szModuleNameUTF8, 
SAL_N_ELEMENTS(szModuleNameUTF8), NULL, NULL );
     return string( szModuleNameUTF8 );
 }
 
@@ -661,7 +661,7 @@ BOOL WriteReportFile( CrashReportParams *pParams )
     BOOL       fSuccess = FALSE;
     TCHAR      szTempPath[MAX_PATH];
 
-    if ( GetTempPath( elementsof(szTempPath), szTempPath ) )
+    if ( GetTempPath( SAL_N_ELEMENTS(szTempPath), szTempPath ) )
     {
         TCHAR  szFileName[MAX_PATH];
 
@@ -900,10 +900,10 @@ BOOL CALLBACK PreviewDialogProc(
             HINSTANCE  hInstance = (HINSTANCE)GetWindowLong( hwndDlg, GWL_HINSTANCE );
             HWND       hwndParent = (HWND)GetWindowLong( hwndDlg, GWL_HWNDPARENT );
             
-            GetWindowText( hwndParent, szBuffer, elementsof(szBuffer) );
+            GetWindowText( hwndParent, szBuffer, SAL_N_ELEMENTS(szBuffer) );
             SetWindowText( hwndDlg, szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_OK_BUTTON, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_OK_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) );
             Button_SetText( GetDlgItem(hwndDlg, IDOK), szBuffer );
 
             basic_string<TCHAR>        aString;
@@ -919,11 +919,11 @@ BOOL CALLBACK PreviewDialogProc(
             {
                 char   buf[1024];
 
-                while ( fgets( buf, elementsof(buf), fp ) != NULL )
+                while ( fgets( buf, SAL_N_ELEMENTS(buf), fp ) != NULL )
                 {
                     WCHAR      bufW[1024];
 
-                    MultiByteToWideChar( CP_UTF8, 0, buf, -1, bufW, elementsof(bufW) );
+                    MultiByteToWideChar( CP_UTF8, 0, buf, -1, bufW, SAL_N_ELEMENTS(bufW) );
 
                     aString.append( bufW );
                 }
@@ -950,10 +950,10 @@ BOOL CALLBACK PreviewDialogProc(
                     {
                         TCHAR  output[16];
 
-                        _sntprintf( output, elementsof(output), _T("%02X\x20"), buf[i] );
+                        _sntprintf( output, SAL_N_ELEMENTS(output), _T("%02X\x20"), buf[i] );
                         aString.append( output );
                     }
-                    for ( ; i < elementsof(buf); i++ )
+                    for ( ; i < SAL_N_ELEMENTS(buf); i++ )
                     {
                         aString.append( _T("\x20\x20\x20") );
                     }
@@ -1052,31 +1052,31 @@ BOOL CALLBACK OptionsDialogProc(
 
             pParams = (CrashReportParams *)lParam;
 
-            LoadAndFormatString( hInstance, IDS_OPTIONS_CAPTION, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_OPTIONS_CAPTION, szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             SetWindowText( hwndDlg, szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_PROXY_SETTINGS_HEADER, szBuffer, 
elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_PROXY_SETTINGS_HEADER, szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             Static_SetText( GetDlgItem(hwndDlg, IDC_PROXY_SETTINGS), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_PROXY_SYSTEM, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_PROXY_SYSTEM, szBuffer, SAL_N_ELEMENTS(szBuffer) );
             Button_SetText( GetDlgItem(hwndDlg, IDC_RADIO_SYSTEM), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_PROXY_DIRECT, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_PROXY_DIRECT, szBuffer, SAL_N_ELEMENTS(szBuffer) );
             Button_SetText( GetDlgItem(hwndDlg, IDC_RADIO_DIRECT), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_PROXY_MANUAL, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_PROXY_MANUAL, szBuffer, SAL_N_ELEMENTS(szBuffer) );
             Button_SetText( GetDlgItem(hwndDlg, IDC_RADIO_MANUAL), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_LABEL_PROXYSERVER, szBuffer, elementsof(szBuffer) 
);
+            LoadAndFormatString( hInstance, IDS_LABEL_PROXYSERVER, szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             Static_SetText( GetDlgItem(hwndDlg, IDC_LABEL_PROXYSERVER), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_LABEL_PROXYPORT, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_LABEL_PROXYPORT, szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             Static_SetText( GetDlgItem(hwndDlg, IDC_LABEL_PROXYPORT), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_OK_BUTTON, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_OK_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) );
             Button_SetText( GetDlgItem(hwndDlg, IDOK), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_CANCEL_BUTTON, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_CANCEL_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) 
);
             Button_SetText( GetDlgItem(hwndDlg, IDCANCEL), szBuffer );
 
             Edit_SetText( GetDlgItem(hwndDlg, IDC_EDIT_PROXYSERVER), pParams->sProxyServer.c_str() 
);
@@ -1089,7 +1089,7 @@ BOOL CALLBACK OptionsDialogProc(
                 EM_SETBKGNDCOLOR, 
                 (WPARAM)FALSE, 
                 GetSysColor( COLOR_3DFACE ) );
-            LoadAndFormatString( hInstance, IDS_PROXY_DESCRIPTION, szBuffer, elementsof(szBuffer) 
);
+            LoadAndFormatString( hInstance, IDS_PROXY_DESCRIPTION, szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             Edit_SetText( GetDlgItem(hwndDlg, IDC_PROXY_DESCRIPTION), szBuffer );
 
             UpdateOptionsDialogControls( hwndDlg );
@@ -1108,10 +1108,10 @@ BOOL CALLBACK OptionsDialogProc(
             {
             TCHAR szBuffer[1024];
 
-            Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_PROXYSERVER), szBuffer, 
elementsof(szBuffer) );
+            Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_PROXYSERVER), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             pParams->sProxyServer = szBuffer;
 
-            Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_PROXYPORT), szBuffer, elementsof(szBuffer) 
);
+            Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_PROXYPORT), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             pParams->sProxyPort = szBuffer;
 
             if ( Button_GetCheck( GetDlgItem(hwndDlg, IDC_RADIO_DIRECT) ) & BST_CHECKED )
@@ -1178,21 +1178,21 @@ BOOL CALLBACK ReportDialogProc(
             HINSTANCE  hInstance = (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE );
             TCHAR              szBuffer[FORMATBUFSIZE];
 
-            LoadAndFormatString( hInstance, IDS_REPORT_INTRO, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_REPORT_INTRO, szBuffer, SAL_N_ELEMENTS(szBuffer) );
             Static_SetText( GetDlgItem(hwndDlg, IDC_REPORT_INTRO), szBuffer );
 
             Edit_SetText( GetDlgItem(hwndDlg, IDC_EDIT3), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_ENTER_TITLE, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_ENTER_TITLE, szBuffer, SAL_N_ELEMENTS(szBuffer) );
             Static_SetText( GetDlgItem(hwndDlg, IDC_ENTER_TITLE), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_ENTER_DESCRIPTION, szBuffer, elementsof(szBuffer) 
);
+            LoadAndFormatString( hInstance, IDS_ENTER_DESCRIPTION, szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             Static_SetText( GetDlgItem(hwndDlg, IDC_ENTER_DESCRIPTION), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_SHOW_REPORT_BUTTON, szBuffer, elementsof(szBuffer) 
);
+            LoadAndFormatString( hInstance, IDS_SHOW_REPORT_BUTTON, szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             Button_SetText( GetDlgItem(hwndDlg, IDC_SHOW_REPORT), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_SAVE_REPORT_BUTTON, szBuffer, elementsof(szBuffer) 
);
+            LoadAndFormatString( hInstance, IDS_SAVE_REPORT_BUTTON, szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             Button_SetText( GetDlgItem(hwndDlg, IDC_SAVE_REPORT), szBuffer );
 
             const char *pszUserType = getenv( "STAROFFICE_USERTYPE" );
@@ -1201,14 +1201,14 @@ BOOL CALLBACK ReportDialogProc(
             else
                 ShowWindow( GetDlgItem(hwndDlg, IDC_SAVE_REPORT), SW_HIDE );
 
-            LoadAndFormatString( hInstance, IDS_OPTIONS_BUTTON, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_OPTIONS_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) 
);
             Button_SetText( GetDlgItem(hwndDlg, IDC_OPTIONS), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_ALLOW_CONTACT, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_ALLOW_CONTACT, szBuffer, SAL_N_ELEMENTS(szBuffer) 
);
             Button_SetText( GetDlgItem(hwndDlg, IDC_ALLOW_CONTACT), szBuffer );
             Button_SetCheck( GetDlgItem(hwndDlg, IDC_ALLOW_CONTACT), pParams->fAllowContact ? 
BST_CHECKED : BST_UNCHECKED );
 
-            LoadAndFormatString( hInstance, IDS_LABEL_EMAIL, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_LABEL_EMAIL, szBuffer, SAL_N_ELEMENTS(szBuffer) );
             Button_SetText( GetDlgItem(hwndDlg, IDC_LABEL_EMAIL), szBuffer );
 
             Edit_SetText( GetDlgItem(hwndDlg, IDC_EDIT_EMAIL), pParams->sEmail.c_str() );
@@ -1223,13 +1223,13 @@ BOOL CALLBACK ReportDialogProc(
             CrashReportParams  *pParams = (CrashReportParams*)GetWindowLong( GetParent(hwndDlg), 
GWL_USERDATA );
             TCHAR              szBuffer[FORMATBUFSIZE];
 
-            LoadAndFormatString( hInstance, IDS_REPORT_CAPTION, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_REPORT_CAPTION, szBuffer, SAL_N_ELEMENTS(szBuffer) 
);
             SetWindowText( GetParent(hwndDlg), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_REPORT_HEADER, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_REPORT_HEADER, szBuffer, SAL_N_ELEMENTS(szBuffer) 
);
             SetWindowText( GetDlgItem(GetParent(hwndDlg), IDC_HEADER), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_DONOT_SEND_BUTTON, szBuffer, elementsof(szBuffer) 
);
+            LoadAndFormatString( hInstance, IDS_DONOT_SEND_BUTTON, szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             Button_SetText( GetDlgItem(GetParent(hwndDlg), IDCANCEL), szBuffer );
 
 
@@ -1260,13 +1260,13 @@ BOOL CALLBACK ReportDialogProc(
 
                 pParams->fAllowContact = Button_GetCheck( GetDlgItem(hwndDlg, IDC_ALLOW_CONTACT) ) 
? TRUE : FALSE;
 
-                Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_TITLE), szBuffer, elementsof(szBuffer) 
);
+                Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_TITLE), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
                 pParams->sTitle = szBuffer;
 
-                Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_DESCRIPTION), szBuffer, 
elementsof(szBuffer) );
+                Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_DESCRIPTION), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
                 pParams->sComment = szBuffer;
 
-                Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_EMAIL), szBuffer, elementsof(szBuffer) 
);
+                Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_EMAIL), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
                 pParams->sEmail = szBuffer;
 
                 PreviewReport( GetParent(hwndDlg), pParams );
@@ -1317,16 +1317,16 @@ BOOL CALLBACK WelcomeDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, 
LPARAM
             SendMessage( hwndRichEdit, EM_SETEVENTMASK, 0, ENM_LINK );
             SendMessage( hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0 );
 
-            LoadAndFormatString( hInstance, IDS_WELCOME_BODY1, szBuffer, elementsof(szBuffer) );
-            LoadAndFormatString( hInstance, IDS_WELCOME_BODY2, szBuffer2, elementsof(szBuffer2) );
-            _tcsncat( szBuffer, szBuffer2, elementsof(szBuffer) );
-            LoadAndFormatString( hInstance, IDS_WELCOME_BODY3, szBuffer2, elementsof(szBuffer2) );
-            _tcsncat( szBuffer, szBuffer2, elementsof(szBuffer) );
-            LoadString( hInstance, IDS_PRIVACY_URL, szURL, elementsof(szURL) );
-            _tcsncat( szBuffer, szURL, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_WELCOME_BODY1, szBuffer, SAL_N_ELEMENTS(szBuffer) 
);
+            LoadAndFormatString( hInstance, IDS_WELCOME_BODY2, szBuffer2, 
SAL_N_ELEMENTS(szBuffer2) );
+            _tcsncat( szBuffer, szBuffer2, SAL_N_ELEMENTS(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_WELCOME_BODY3, szBuffer2, 
SAL_N_ELEMENTS(szBuffer2) );
+            _tcsncat( szBuffer, szBuffer2, SAL_N_ELEMENTS(szBuffer) );
+            LoadString( hInstance, IDS_PRIVACY_URL, szURL, SAL_N_ELEMENTS(szURL) );
+            _tcsncat( szBuffer, szURL, SAL_N_ELEMENTS(szBuffer) );
             SetWindowText( hwndRichEdit, szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_WELCOME_CAPTION, szCaption, elementsof(szCaption) 
);
+            LoadAndFormatString( hInstance, IDS_WELCOME_CAPTION, szCaption, 
SAL_N_ELEMENTS(szCaption) );
             SetWindowText( GetParent(hwndDlg), szCaption );
              
         }
@@ -1337,13 +1337,13 @@ BOOL CALLBACK WelcomeDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, 
LPARAM
             HINSTANCE  hInstance = (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE );
             TCHAR              szBuffer[FORMATBUFSIZE];
 
-            LoadAndFormatString( hInstance, IDS_WELCOME_CAPTION, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_WELCOME_CAPTION, szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             SetWindowText( GetParent(hwndDlg), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_WELCOME_HEADER, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_WELCOME_HEADER, szBuffer, SAL_N_ELEMENTS(szBuffer) 
);
             SetWindowText( GetDlgItem(GetParent(hwndDlg), IDC_HEADER), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_CANCEL_BUTTON, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_CANCEL_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) 
);
             Button_SetText( GetDlgItem(GetParent(hwndDlg), IDCANCEL), szBuffer );
 
             ShowWindow( GetDlgItem(GetParent(hwndDlg),IDBACK), FALSE );
@@ -1422,16 +1422,16 @@ BOOL CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM 
lParam
                 SCF_ALL,
                 (LPARAM)&chfmt );
 
-            LoadAndFormatString( hInstance, IDS_CANCEL_BUTTON, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_CANCEL_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) 
);
             Button_SetText( GetDlgItem(hwndDlg, IDCANCEL), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_NEXT_BUTTON, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_NEXT_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) );
             Button_SetText( GetDlgItem(hwndDlg, IDNEXT), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_SEND_BUTTON, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_SEND_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) );
             Button_SetText( GetDlgItem(hwndDlg, IDFINISH), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_BACK_BUTTON, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_BACK_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) );
             Button_SetText( GetDlgItem(hwndDlg, IDBACK), szBuffer );
 
             ShowWindow( hwndPages[1], SW_HIDE );
@@ -1454,7 +1454,7 @@ BOOL CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM 
lParam
             }
             return TRUE;
         case IDNEXT:
-            if ( iActualPage < elementsof(hwndPages) - 1 )
+            if ( iActualPage < SAL_N_ELEMENTS(hwndPages) - 1 )
             {
                 ShowWindow( hwndPages[iActualPage], SW_HIDE );
                 ShowWindow( hwndPages[++iActualPage], SW_SHOW );
@@ -1467,20 +1467,20 @@ BOOL CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM 
lParam
 
                 pParams->fAllowContact = Button_GetCheck( GetDlgItem(hwndPages[1], 
IDC_ALLOW_CONTACT) ) ? TRUE : FALSE;
 
-                Edit_GetText( GetDlgItem(hwndPages[1], IDC_EDIT_TITLE), szBuffer, 
elementsof(szBuffer) );
+                Edit_GetText( GetDlgItem(hwndPages[1], IDC_EDIT_TITLE), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
                 pParams->sTitle = szBuffer;
 
-                Edit_GetText( GetDlgItem(hwndPages[1], IDC_EDIT_DESCRIPTION), szBuffer, 
elementsof(szBuffer) );
+                Edit_GetText( GetDlgItem(hwndPages[1], IDC_EDIT_DESCRIPTION), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
                 pParams->sComment = szBuffer;
 
-                Edit_GetText( GetDlgItem(hwndPages[1], IDC_EDIT_EMAIL), szBuffer, 
elementsof(szBuffer) );
+                Edit_GetText( GetDlgItem(hwndPages[1], IDC_EDIT_EMAIL), szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
                 pParams->sEmail = szBuffer;
 
                 if ( pParams->fAllowContact && !pParams->sEmail.length() )
                 {
                     TCHAR      szMessage[MAX_TEXT_BUFFER];
 
-                    LoadAndFormatString( GetModuleHandle(NULL), IDS_ERROR_MSG_NOEMAILADDRESS, 
szMessage, elementsof(szMessage) );
+                    LoadAndFormatString( GetModuleHandle(NULL), IDS_ERROR_MSG_NOEMAILADDRESS, 
szMessage, SAL_N_ELEMENTS(szMessage) );
 
                     MessageBox( hwndDlg, szMessage, NULL, MB_ICONERROR | MB_OK );
                     break;  // Don't end the dialog
@@ -1523,7 +1523,7 @@ static void repatch_soffice_exe( void *pBuffer, size_t nBufSize )
     wchar_t DescriptionBuffer[MAGIC_DESCRIPTION_COUNT];
 
     memset( DescriptionBuffer, 0, sizeof(DescriptionBuffer) );
-    wcsncpy( DescriptionBuffer, g_wstrProductKey.c_str(), elementsof(DescriptionBuffer) - 1 );
+    wcsncpy( DescriptionBuffer, g_wstrProductKey.c_str(), SAL_N_ELEMENTS(DescriptionBuffer) - 1 );
 
     bool bPatched = false;
 
@@ -1920,7 +1920,7 @@ BOOL WriteDumpFile( DWORD dwProcessId, PEXCEPTION_POINTERS 
pExceptionPointers, D
     {
         TCHAR  szTempPath[MAX_PATH];
 
-//             if ( GetTempPath( elementsof(szTempPath), szTempPath ) )
+//             if ( GetTempPath( SAL_N_ELEMENTS(szTempPath), szTempPath ) )
         if ( GetCrashDataPath( szTempPath ) )
         {
             TCHAR      szFileName[MAX_PATH];
@@ -1998,7 +1998,7 @@ static DWORD FindProcessForImage( LPCTSTR lpImagePath )
     DWORD      dwSize = 0;
     TCHAR      szShortImagePath[MAX_PATH];
 
-    if ( GetShortPathName( lpImagePath, szShortImagePath, elementsof(szShortImagePath) ) &&
+    if ( GetShortPathName( lpImagePath, szShortImagePath, SAL_N_ELEMENTS(szShortImagePath) ) &&
         EnumProcesses( aProcesses, sizeof(aProcesses), &dwSize ) )
     {
         unsigned nProcesses = dwSize / sizeof(aProcesses[0]);
@@ -2015,7 +2015,7 @@ static DWORD FindProcessForImage( LPCTSTR lpImagePath )
                 {
                     TCHAR      szShortModulePath[MAX_PATH];
 
-                    if ( GetShortPathName( szModulePath, szShortModulePath, 
elementsof(szShortModulePath) ) )
+                    if ( GetShortPathName( szModulePath, szShortModulePath, 
SAL_N_ELEMENTS(szShortModulePath) ) )
                     {
                         if ( 0 == _tcsicmp( szShortModulePath, szShortImagePath ) )
                             dwProcessId = aProcesses[i];
@@ -2088,10 +2088,10 @@ static bool ParseCommandArgs( LPDWORD pdwProcessId, PEXCEPTION_POINTERS* 
ppExcep
             TCHAR      szProcessDescription[FORMATBUFSIZE];
             TCHAR      szHelpDescription[FORMATBUFSIZE];
 
-            LoadAndFormatString( hInstance, IDS_MSG_CMDLINE_USAGE, szUsage, elementsof(szUsage) );
-            LoadAndFormatString( hInstance, IDS_MSG_PARAM_PROCESSID, szProcess, 
elementsof(szProcess) );
-            LoadAndFormatString( hInstance, IDS_MSG_PARAM_PROCESSID_DESCRIPTION, 
szProcessDescription, elementsof(szProcessDescription) );
-            LoadAndFormatString( hInstance, IDS_MSG_PARAM_HELP_DESCRIPTION, szHelpDescription, 
elementsof(szHelpDescription) );
+            LoadAndFormatString( hInstance, IDS_MSG_CMDLINE_USAGE, szUsage, 
SAL_N_ELEMENTS(szUsage) );
+            LoadAndFormatString( hInstance, IDS_MSG_PARAM_PROCESSID, szProcess, 
SAL_N_ELEMENTS(szProcess) );
+            LoadAndFormatString( hInstance, IDS_MSG_PARAM_PROCESSID_DESCRIPTION, 
szProcessDescription, SAL_N_ELEMENTS(szProcessDescription) );
+            LoadAndFormatString( hInstance, IDS_MSG_PARAM_HELP_DESCRIPTION, szHelpDescription, 
SAL_N_ELEMENTS(szHelpDescription) );
 
             _tprintf( 
                 TEXT("\n%s: crashrep %s\n\n")
@@ -2184,7 +2184,7 @@ BOOL WriteCommentFile( LPCTSTR lpComment )
     BOOL       fSuccess = FALSE;
     TCHAR      szTempPath[MAX_PATH];
 
-    if ( GetTempPath( elementsof(szTempPath), szTempPath ) )
+    if ( GetTempPath( SAL_N_ELEMENTS(szTempPath), szTempPath ) )
     {
         TCHAR  szFileName[MAX_PATH];
 
@@ -2336,7 +2336,7 @@ static bool ReadBootstrapParams( CrashReportParams &rParams )
         TEXT("ProductKey"), 
         TEXT("OpenOffice.org"), 
         szBuffer, 
-        elementsof(szBuffer), 
+        SAL_N_ELEMENTS(szBuffer), 
         szModuleName ) 
         )
     {
@@ -2364,7 +2364,7 @@ static bool ReadBootstrapParams( CrashReportParams &rParams )
         TEXT("Version"), 
         TEXT("buildid"), 
         TEXT("unknown"), 
-        g_szBuildId, elementsof(g_szBuildId), 
+        g_szBuildId, SAL_N_ELEMENTS(g_szBuildId), 
         szModuleVersionName );
 
     g_strDefaultLanguage = get_script_string( "instdb.inf", "DefaultLanguage" );
@@ -2373,7 +2373,7 @@ static bool ReadBootstrapParams( CrashReportParams &rParams )
         TEXT("ErrorReport"),
         TEXT("ErrorReportPort"),
         TEXT("80"),
-        szReportPort, elementsof(szReportPort),
+        szReportPort, SAL_N_ELEMENTS(szReportPort),
         szModuleName
         ) )
     {
@@ -2388,11 +2388,11 @@ static bool ReadBootstrapParams( CrashReportParams &rParams )
         TEXT("ErrorReport"),
         TEXT("ErrorReportServer"),
         TEXT(""),
-        szReportServer, elementsof(szReportServer),
+        szReportServer, SAL_N_ELEMENTS(szReportServer),
         szModuleName
         ) )
     {
-        bSuccess = 0 != WideCharToMultiByte( CP_ACP, 0, szReportServer, -1, g_szReportServerA, 
elementsof(g_szReportServerA), NULL, NULL );
+        bSuccess = 0 != WideCharToMultiByte( CP_ACP, 0, szReportServer, -1, g_szReportServerA, 
SAL_N_ELEMENTS(g_szReportServerA), NULL, NULL );
     }
 
     LPCTSTR    lpEnvString;
@@ -2625,13 +2625,13 @@ BOOL CALLBACK SendingStatusDialogProc(
 
             pRequest = (RequestParams *)lParam;
 
-            LoadAndFormatString( hInstance, IDS_SENDING_REPORT_HEADER, szBuffer, 
elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_SENDING_REPORT_HEADER, szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             SetWindowText( hwndDlg, szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_SENDING_REPORT_STATUS, szBuffer, 
elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_SENDING_REPORT_STATUS, szBuffer, 
SAL_N_ELEMENTS(szBuffer) );
             Static_SetText( GetDlgItem(hwndDlg, IDC_SENDING_REPORT_STATUS), szBuffer );
 
-            LoadAndFormatString( hInstance, IDS_CANCEL_BUTTON, szBuffer, elementsof(szBuffer) );
+            LoadAndFormatString( hInstance, IDS_CANCEL_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) 
);
             Button_SetText( GetDlgItem(hwndDlg, IDCANCEL), szBuffer );
 
             pRequest->hwndStatus = hwndDlg;
@@ -2768,7 +2768,7 @@ bool SendCrashReport( HWND hwndParent, const CrashReportParams &rParams )
                 {
                     TCHAR      szMessage[1024];
 
-                    LoadAndFormatString( GetModuleHandle(NULL), IDS_ERROR_MSG_PROXY, szMessage, 
elementsof(szMessage) );
+                    LoadAndFormatString( GetModuleHandle(NULL), IDS_ERROR_MSG_PROXY, szMessage, 
SAL_N_ELEMENTS(szMessage) );
 
                     MessageBox( hwndParent, szMessage, NULL, MB_ICONERROR | MB_OK );
                 }
@@ -2777,8 +2777,8 @@ bool SendCrashReport( HWND hwndParent, const CrashReportParams &rParams )
                     TCHAR      szMessage[1024];
                     TCHAR      szTitle[1024];
 
-                    LoadAndFormatString( GetModuleHandle(NULL), 
IDS_SENDING_REPORT_STATUS_FINISHED, szMessage, elementsof(szMessage) );
-                    LoadAndFormatString( GetModuleHandle(NULL), IDS_SENDING_REPORT_HEADER, 
szTitle, elementsof(szTitle) );
+                    LoadAndFormatString( GetModuleHandle(NULL), 
IDS_SENDING_REPORT_STATUS_FINISHED, szMessage, SAL_N_ELEMENTS(szMessage) );
+                    LoadAndFormatString( GetModuleHandle(NULL), IDS_SENDING_REPORT_HEADER, 
szTitle, SAL_N_ELEMENTS(szTitle) );
 
                     MessageBox( hwndParent, szMessage, szTitle, MB_ICONINFORMATION | MB_OK );
                 }
@@ -2796,14 +2796,14 @@ bool SendCrashReport( HWND hwndParent, const CrashReportParams &rParams )
             {
                 TCHAR  szMessage[1024];
 
-                LoadAndFormatString( GetModuleHandle(NULL), IDS_ERROR_MSG_PROXY, szMessage, 
elementsof(szMessage) );
+                LoadAndFormatString( GetModuleHandle(NULL), IDS_ERROR_MSG_PROXY, szMessage, 
SAL_N_ELEMENTS(szMessage) );
                 _ftprintf( stderr, _T("ERROR: %s\n"), szMessage );
             }
             else
             {
                 TCHAR  szMessage[1024];
 
-                LoadAndFormatString( GetModuleHandle(NULL), IDS_SENDING_REPORT_STATUS_FINISHED, 
szMessage, elementsof(szMessage) );
+                LoadAndFormatString( GetModuleHandle(NULL), IDS_SENDING_REPORT_STATUS_FINISHED, 
szMessage, SAL_N_ELEMENTS(szMessage) );
 
                 _ftprintf( stderr, _T("SUCCESS: %s\n"), szMessage );
             }
@@ -2814,7 +2814,7 @@ bool SendCrashReport( HWND hwndParent, const CrashReportParams &rParams )
     {
         TCHAR  szMessage[1024];
 
-        LoadAndFormatString( GetModuleHandle(NULL), IDS_ERROR_MSG_DISK_FULL, szMessage, 
elementsof(szMessage) );
+        LoadAndFormatString( GetModuleHandle(NULL), IDS_ERROR_MSG_DISK_FULL, szMessage, 
SAL_N_ELEMENTS(szMessage) );
 
         if ( hwndParent )
             MessageBox( hwndParent, szMessage, NULL, MB_ICONERROR | MB_OK );
diff --git 
a/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx 
b/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
index 9071b8c..21188ab 100644
--- a/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
+++ b/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
@@ -51,6 +51,7 @@
 #include <string>
 #include <queue>
 #include <stdio.h>
+#include <sal/macros.h>
 
 #include <systools/win32/uwinapi.h>
 #include <../tools/seterror.hxx>
@@ -65,7 +66,7 @@ inline void OutputDebugStringFormat( LPCTSTR pFormat, ... )
     va_list    args;
 
     va_start( args, pFormat );
-    _vsntprintf( buffer, elementsof(buffer), pFormat, args );
+    _vsntprintf( buffer, SAL_N_ELEMENTS(buffer), pFormat, args );
     OutputDebugString( buffer );
 }
 #else
@@ -127,7 +128,7 @@ static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWO
             )
         {
             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 );
@@ -135,7 +136,7 @@ static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWO
             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;
diff --git a/setup_native/source/win32/customactions/languagepacks/respintest.cxx 
b/setup_native/source/win32/customactions/languagepacks/respintest.cxx
index 4ff79de..7c2c62a 100644
--- a/setup_native/source/win32/customactions/languagepacks/respintest.cxx
+++ b/setup_native/source/win32/customactions/languagepacks/respintest.cxx
@@ -46,8 +46,9 @@
 
 #include <tchar.h>
 #include <string>
-#include <systools/win32/uwinapi.h>
+#include <sal/macros.h>
 
+#include <systools/win32/uwinapi.h>
 #include <../tools/seterror.hxx>
 
 using namespace std;
@@ -111,7 +112,7 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
         TEXT("ProductCode"),
         TEXT("INVALIDDIRECTORY"),
         szValue,
-        elementsof(szValue),
+        SAL_N_ELEMENTS(szValue),
         sSetupiniPath.c_str() 
         );
 
@@ -133,7 +134,7 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
         TEXT("buildid"),
         TEXT("ISWRONGPRODUCT"),
         szValue,
-        elementsof(szValue),
+        SAL_N_ELEMENTS(szValue),
         sSetupiniPath.c_str() 
         );
 
@@ -174,7 +175,7 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
             TEXT("ProductBuildid"),
             TEXT("8918"),
             szValue,
-            elementsof(szValue),
+            SAL_N_ELEMENTS(szValue),
             sSetupiniPath.c_str() 
             );
             
@@ -198,7 +199,7 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
         TEXT("ALLUSERS"),
         TEXT(""),
         szValue,
-        elementsof(szValue),
+        SAL_N_ELEMENTS(szValue),
         sSetupiniPath.c_str() 
         );
 
diff --git a/setup_native/source/win32/customactions/patch/swappatchfiles.cxx 
b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx
index 8249590..d416f9d 100644
--- a/setup_native/source/win32/customactions/patch/swappatchfiles.cxx
+++ b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx
@@ -51,6 +51,7 @@
 #include <string>
 #include <queue>
 #include <stdio.h>
+#include <sal/macros.h>
 
 #include <systools/win32/uwinapi.h>
 #include <../tools/seterror.hxx>
@@ -65,7 +66,7 @@ inline void OutputDebugStringFormat( LPCTSTR pFormat, ... )
     va_list    args;
 
     va_start( args, pFormat );
-    _vsntprintf( buffer, elementsof(buffer), pFormat, args );
+    _vsntprintf( buffer, SAL_N_ELEMENTS(buffer), pFormat, args );
     OutputDebugString( buffer );
 }
 #else
@@ -196,7 +197,7 @@ static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWO
             )
         {
             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 );
@@ -204,7 +205,7 @@ static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWO
             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;
@@ -735,7 +736,7 @@ extern "C" UINT __stdcall SetFeatureState( MSIHANDLE handle )
         TEXT("ProductCode"),
         TEXT("NOTFOUND"),
         szProductCode,
-        elementsof(szProductCode),
+        SAL_N_ELEMENTS(szProductCode),
         sSetupiniPath.c_str() 
         );
 
diff --git a/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx 
b/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx
index a3539f6..0cf8458 100644
--- a/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx
@@ -51,6 +51,7 @@
 #include <string>
 #include <queue>
 #include <stdio.h>
+#include <sal/macros.h>
 
 #include <systools/win32/uwinapi.h>
 #include <../tools/seterror.hxx>
@@ -65,7 +66,7 @@ inline void OutputDebugStringFormat( LPCTSTR pFormat, ... )
     va_list    args;
 
     va_start( args, pFormat );
-    _vsntprintf( buffer, elementsof(buffer), pFormat, args );
+    _vsntprintf( buffer, SAL_N_ELEMENTS(buffer), pFormat, args );
     OutputDebugString( buffer );
 }
 #else
@@ -127,7 +128,7 @@ static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWO
             )
         {
             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 );
@@ -135,7 +136,7 @@ static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWO
             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;

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.