diff options
Diffstat (limited to 'desktop/win32')
-rw-r--r-- | desktop/win32/source/guistdio/guistdio.inc | 3 | ||||
-rw-r--r-- | desktop/win32/source/officeloader/officeloader.cxx | 3 | ||||
-rw-r--r-- | desktop/win32/source/rebase/rebase.cxx | 5 |
3 files changed, 7 insertions, 4 deletions
diff --git a/desktop/win32/source/guistdio/guistdio.inc b/desktop/win32/source/guistdio/guistdio.inc index 7f2bbe9002..7009b24a0d 100644 --- a/desktop/win32/source/guistdio/guistdio.inc +++ b/desktop/win32/source/guistdio/guistdio.inc @@ -43,6 +43,7 @@ #include <systools/win32/uwinapi.h> #include <stdio.h> +#include <sal/macros.h> #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 094d7fda9e..c5e34dce08 100644 --- a/desktop/win32/source/officeloader/officeloader.cxx +++ b/desktop/win32/source/officeloader/officeloader.cxx @@ -51,6 +51,7 @@ #include <systools/win32/uwinapi.h> #include "rtl/string.h" +#include <sal/macros.h> #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 5afc00b5b0..e712c8d548 100644 --- a/desktop/win32/source/rebase/rebase.cxx +++ b/desktop/win32/source/rebase/rebase.cxx @@ -44,6 +44,7 @@ #include <time.h> #include "sal/config.h" +#include <sal/macros.h> #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 ); |