From a36dcb29132d4f8a0fc740a7714aec34ed53b8ce Mon Sep 17 00:00:00 2001 From: Kenneth Venken Date: Sun, 17 Oct 2010 00:13:19 -0500 Subject: use SAL_N_ELEMENTS macro --- desktop/win32/source/guistdio/guistdio.inc | 3 ++- desktop/win32/source/officeloader/officeloader.cxx | 3 ++- desktop/win32/source/rebase/rebase.cxx | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'desktop') diff --git a/desktop/win32/source/guistdio/guistdio.inc b/desktop/win32/source/guistdio/guistdio.inc index 7f2bbe9002d8..7009b24a0dc4 100644 --- a/desktop/win32/source/guistdio/guistdio.inc +++ b/desktop/win32/source/guistdio/guistdio.inc @@ -43,6 +43,7 @@ #include #include +#include #ifdef UNOPKG @@ -358,7 +359,7 @@ int _tmain( int, _TCHAR ** ) { size_t len = lpLastDot - szModuleFileName; _tcsncpy( szTargetFileName, szModuleFileName, len ); - _tcsncpy( szTargetFileName + len, _T(".EXE"), sizeof(szTargetFileName)/sizeof(szTargetFileName[0]) - len ); + _tcsncpy( szTargetFileName + len, _T(".EXE"), SAL_N_ELEMENTS(szTargetFileName) - len ); } // Create process with same command line, environment and stdio handles which diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx index d0880df4d874..0588814a9076 100644 --- a/desktop/win32/source/officeloader/officeloader.cxx +++ b/desktop/win32/source/officeloader/officeloader.cxx @@ -51,6 +51,7 @@ #include #include "rtl/string.h" +#include #include "../../../source/inc/exithelper.hxx" #include "../extendloaderenvironment.hxx" @@ -201,7 +202,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int ) { size_t len = lpLastSlash - szModuleFileName + 1; _tcsncpy( szPerfTuneIniFile, szModuleFileName, len ); - _tcsncpy( szPerfTuneIniFile + len, _T("perftune.ini"), sizeof(szPerfTuneIniFile)/sizeof(szPerfTuneIniFile[0]) - len ); + _tcsncpy( szPerfTuneIniFile + len, _T("perftune.ini"), SAL_N_ELEMENTS(szPerfTuneIniFile) - len ); } // Create process with same command line, environment and stdio handles which diff --git a/desktop/win32/source/rebase/rebase.cxx b/desktop/win32/source/rebase/rebase.cxx index b9dc64420e99..ba6c3937227a 100644 --- a/desktop/win32/source/rebase/rebase.cxx +++ b/desktop/win32/source/rebase/rebase.cxx @@ -44,6 +44,7 @@ #include #include "sal/config.h" +#include #include "tools/pathutils.hxx" #define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1) @@ -120,7 +121,7 @@ void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase ) { size_t len = lpLastSlash - pszFolder + 1; wcsncpy( szPattern, pszFolder, len ); - wcsncpy( szPattern + len, TEXT("*.dll"), sizeof(szPattern)/sizeof(szPattern[0]) - len ); + wcsncpy( szPattern + len, TEXT("*.dll"), SAL_N_ELEMENTS(szPattern) - len ); } WIN32_FIND_DATA aFindFileData; @@ -138,7 +139,7 @@ void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase ) { size_t len = lpLastSlash - pszFolder + 1; wcsncpy( szLibFilePath, pszFolder, len ); - wcsncpy( szLibFilePath + len, aFindFileData.cFileName, sizeof(szLibFilePath)/sizeof(szLibFilePath[0]) - len ); + wcsncpy( szLibFilePath + len, aFindFileData.cFileName, SAL_N_ELEMENTS(szLibFilePath) - len ); } rebaseImage( szLibFilePath, nNewImageBase ); -- cgit