diff options
author | Florian Bircher <florian.bi@gmx.net> | 2010-10-18 18:59:00 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2010-10-18 18:59:00 -0500 |
commit | 64e6130b14eff8754d248009fd528eb675e2e1f0 (patch) | |
tree | e4563c773903728980185d02160741fa7ca26447 /setup_native | |
parent | ab1663d2dbba9c07638b673c57014a23f07db6a4 (diff) |
use SAL_N_ELEMENTS
Diffstat (limited to 'setup_native')
4 files changed, 19 insertions, 15 deletions
diff --git a/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx b/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx index 0953389f078a..1bebed752e18 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 1d9a45e59dd3..5f979a81fa68 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 3ff14d244dc4..2ef10553e239 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 fb6f7999c904..f50c795c5c8a 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; |