summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--avmedia/source/win/framegrabber.cxx7
-rw-r--r--avmedia/source/win/player.cxx2
-rw-r--r--basic/source/runtime/dllmgr-x64.cxx2
-rw-r--r--basic/source/runtime/dllmgr-x86.cxx2
-rw-r--r--canvas/source/directx/dx_canvasfont.cxx2
-rw-r--r--canvas/source/directx/dx_canvashelper.cxx5
-rw-r--r--desktop/source/app/crashreport.cxx3
-rw-r--r--dtrans/source/win32/dtobj/XTDataObject.cxx2
-rw-r--r--extensions/source/ole/unotypewrapper.cxx2
-rw-r--r--fpicker/source/win32/folderpicker/MtaFop.cxx6
-rw-r--r--framework/source/uielement/spinfieldtoolbarcontroller.cxx7
-rw-r--r--helpcompiler/inc/HelpCompiler.hxx4
-rw-r--r--helpcompiler/source/HelpLinker.cxx52
-rw-r--r--sal/osl/w32/file_dirvol.cxx6
-rw-r--r--sal/osl/w32/path_helper.hxx2
-rw-r--r--sal/osl/w32/profile.cxx20
-rw-r--r--sfx2/source/appl/shutdowniconw32.cxx2
-rw-r--r--winaccessibility/source/UAccCOM/AccActionBase.cxx5
-rw-r--r--winaccessibility/source/UAccCOM/AccImage.cxx2
-rw-r--r--winaccessibility/source/UAccCOM/AccTable.cxx4
-rw-r--r--winaccessibility/source/UAccCOM/AccTextBase.cxx12
-rw-r--r--winaccessibility/source/UAccCOM/MAccessible.cxx20
-rw-r--r--winaccessibility/source/service/AccObject.cxx22
23 files changed, 81 insertions, 110 deletions
diff --git a/avmedia/source/win/framegrabber.cxx b/avmedia/source/win/framegrabber.cxx
index ce24b96f7ad2..e6c808787bee 100644
--- a/avmedia/source/win/framegrabber.cxx
+++ b/avmedia/source/win/framegrabber.cxx
@@ -78,8 +78,13 @@ IMediaDet* implCreateMediaDet( const OUString& rURL )
if( osl::FileBase::getSystemPathFromFileURL( rURL, aLocalStr )
== osl::FileBase::E_None )
{
- if( !SUCCEEDED( pDet->put_Filename( ::SysAllocString( reinterpret_cast<LPCOLESTR>(aLocalStr.getStr()) ) ) ) )
+ BSTR bstrFilename = SysAllocString(SAL_W(aLocalStr.getStr()));
+ if( !SUCCEEDED( pDet->put_Filename( bstrFilename ) ) )
{
+ // Shouldn't we free this string unconditionally, not only in case of failure?
+ // I cannot find information why do we pass a newly allocated BSTR to the put_Filename
+ // and if it frees the string internally
+ SysFreeString(bstrFilename);
pDet->Release();
pDet = nullptr;
}
diff --git a/avmedia/source/win/player.cxx b/avmedia/source/win/player.cxx
index 268babd1b17c..6ecb6a261ecc 100644
--- a/avmedia/source/win/player.cxx
+++ b/avmedia/source/win/player.cxx
@@ -148,7 +148,7 @@ bool Player::create( const OUString& rURL )
// It disables the desktop composition as soon as RenderFile is called
// also causes some other problems: video rendering is not reliable
- if( SUCCEEDED( hR = mpGB->RenderFile( reinterpret_cast<LPCWSTR>(rURL.getStr()), nullptr ) ) &&
+ if( SUCCEEDED( hR = mpGB->RenderFile( SAL_W(rURL.getStr()), nullptr ) ) &&
SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaControl, reinterpret_cast<void**>(&mpMC) ) ) &&
SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaEventEx, reinterpret_cast<void**>(&mpME) ) ) &&
SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaSeeking, reinterpret_cast<void**>(&mpMS) ) ) &&
diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx
index a0902dad034c..fdd54b129da8 100644
--- a/basic/source/runtime/dllmgr-x64.cxx
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -734,7 +734,7 @@ Dll * SbiDllMgr::Impl::getDll(OUString const & name) {
Dlls::iterator i(dlls.find(name));
if (i == dlls.end()) {
i = dlls.emplace(name, new Dll).first;
- HMODULE h = LoadLibraryW(reinterpret_cast<LPCWSTR>(name.getStr()));
+ HMODULE h = LoadLibraryW(SAL_W(name.getStr()));
if (h == nullptr) {
dlls.erase(i);
return nullptr;
diff --git a/basic/source/runtime/dllmgr-x86.cxx b/basic/source/runtime/dllmgr-x86.cxx
index 5f752dfced93..ff3e80549e71 100644
--- a/basic/source/runtime/dllmgr-x86.cxx
+++ b/basic/source/runtime/dllmgr-x86.cxx
@@ -688,7 +688,7 @@ Dll * SbiDllMgr::Impl::getDll(OUString const & name) {
Dlls::iterator i(dlls.find(name));
if (i == dlls.end()) {
i = dlls.emplace(name, new Dll).first;
- HMODULE h = LoadLibraryW(reinterpret_cast<LPCWSTR>(name.getStr()));
+ HMODULE h = LoadLibraryW(SAL_W(name.getStr()));
if (h == 0) {
dlls.erase(i);
return 0;
diff --git a/canvas/source/directx/dx_canvasfont.cxx b/canvas/source/directx/dx_canvasfont.cxx
index e780634223e3..0fa32688ea6f 100644
--- a/canvas/source/directx/dx_canvasfont.cxx
+++ b/canvas/source/directx/dx_canvasfont.cxx
@@ -61,7 +61,7 @@ namespace dxcanvas
std::vector< sal_Unicode > pStrBuf(nLen+1,0);
std::copy(pStr,pStr+nLen,&pStrBuf[0]);
- mpFontFamily.reset( new Gdiplus::FontFamily(reinterpret_cast<LPCWSTR>(&pStrBuf[0]),nullptr) );
+ mpFontFamily.reset( new Gdiplus::FontFamily(SAL_W(&pStrBuf[0]),nullptr) );
if( !mpFontFamily->IsAvailable() )
mpFontFamily.reset( new Gdiplus::FontFamily(L"Arial",nullptr) );
diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx
index f266ce86db0c..87b9066fc08f 100644
--- a/canvas/source/directx/dx_canvashelper.cxx
+++ b/canvas/source/directx/dx_canvashelper.cxx
@@ -521,9 +521,8 @@ namespace dxcanvas
// TODO(F2): Proper layout (BiDi, CTL)! IMHO must use
// DrawDriverString here, and perform layouting myself...
ENSURE_OR_THROW(
- Gdiplus::Ok == pGraphics->DrawString( reinterpret_cast<LPCWSTR>(
- text.Text.copy( text.StartPosition,
- text.Length ).getStr()),
+ Gdiplus::Ok == pGraphics->DrawString( SAL_W(text.Text.copy( text.StartPosition,
+ text.Length ).getStr()),
text.Length,
pFont->getFont().get(),
aPoint,
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index 373793f94470..28360ca4dfeb 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -122,8 +122,7 @@ void CrashReporter::updateMinidumpLocation()
mpExceptionHandler->set_minidump_descriptor(descriptor);
#elif defined WNT
OUString aURL = getCrashDirectory();
- mpExceptionHandler->set_dump_path(
- reinterpret_cast<wchar_t const *>(aURL.getStr()));
+ mpExceptionHandler->set_dump_path(SAL_W(aURL.getStr()));
#endif
}
diff --git a/dtrans/source/win32/dtobj/XTDataObject.cxx b/dtrans/source/win32/dtobj/XTDataObject.cxx
index 3599f5589b52..ed498372d0aa 100644
--- a/dtrans/source/win32/dtobj/XTDataObject.cxx
+++ b/dtrans/source/win32/dtobj/XTDataObject.cxx
@@ -505,7 +505,7 @@ void SAL_CALL CXTDataObject::renderSynthesizedTextAndSetupStgMedium( FORMATETC&
WideCharToMultiByteEx(
GetACP( ),
- reinterpret_cast<LPCWSTR>( aUnicodeText.getStr( ) ),
+ SAL_W( aUnicodeText.getStr( ) ),
aUnicodeText.getLength( ),
stgTransfHelper );
diff --git a/extensions/source/ole/unotypewrapper.cxx b/extensions/source/ole/unotypewrapper.cxx
index da1d13207615..e719e8c66f43 100644
--- a/extensions/source/ole/unotypewrapper.cxx
+++ b/extensions/source/ole/unotypewrapper.cxx
@@ -47,7 +47,7 @@ bool createUnoTypeWrapper(BSTR sTypeName, VARIANT * pVar)
bool createUnoTypeWrapper(const OUString& sTypeName, VARIANT * pVar)
{
- CComBSTR bstr(reinterpret_cast<LPCOLESTR>(sTypeName.getStr()));
+ CComBSTR bstr(SAL_W(sTypeName.getStr()));
return createUnoTypeWrapper(bstr, pVar);
}
diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx
index e98c20b6e732..b0bd86550f52 100644
--- a/fpicker/source/win32/folderpicker/MtaFop.cxx
+++ b/fpicker/source/win32/folderpicker/MtaFop.cxx
@@ -364,10 +364,10 @@ bool SAL_CALL CMtaFolderPicker::onBrowseForFolder( )
// pre SHBrowseFroFolder
m_bi.pidlRoot = nullptr;
- m_bi.pszDisplayName = reinterpret_cast<LPWSTR>(m_pathBuff);
+ m_bi.pszDisplayName = SAL_W(m_pathBuff);
if ( m_Description.getLength( ) )
- m_bi.lpszTitle = reinterpret_cast<LPCWSTR>(m_Description.getStr( ));
+ m_bi.lpszTitle = SAL_W(m_Description.getStr( ));
lpiid = SHBrowseForFolderW( &m_bi );
bRet = ( nullptr != lpiid );
@@ -409,7 +409,7 @@ LPITEMIDLIST SAL_CALL CMtaFolderPicker::getItemIdListFromPath( const OUString& a
pIShellFolder->ParseDisplayName(
nullptr,
nullptr,
- reinterpret_cast<LPWSTR>(const_cast< sal_Unicode* >( aDirectory.getStr( ) )),
+ const_cast<LPWSTR>(SAL_W( aDirectory.getStr( ) )),
nullptr,
&lpItemIdList,
nullptr );
diff --git a/framework/source/uielement/spinfieldtoolbarcontroller.cxx b/framework/source/uielement/spinfieldtoolbarcontroller.cxx
index f0c2d11cbddb..135a708e069b 100644
--- a/framework/source/uielement/spinfieldtoolbarcontroller.cxx
+++ b/framework/source/uielement/spinfieldtoolbarcontroller.cxx
@@ -459,12 +459,11 @@ OUString SpinfieldToolbarController::impl_formatOutputString( double fValue )
aBuffer[0] = 0;
if ( m_bFloat )
- _snwprintf( reinterpret_cast<wchar_t *>(aBuffer), 128, reinterpret_cast<const wchar_t *>(m_aOutFormat.getStr()), fValue );
+ _snwprintf( SAL_W(aBuffer), SAL_N_ELEMENTS(aBuffer), SAL_W(m_aOutFormat.getStr()), fValue );
else
- _snwprintf( reinterpret_cast<wchar_t *>(aBuffer), 128, reinterpret_cast<const wchar_t *>(m_aOutFormat.getStr()), sal_Int32( fValue ));
+ _snwprintf( SAL_W(aBuffer), SAL_N_ELEMENTS(aBuffer), SAL_W(m_aOutFormat.getStr()), sal_Int32( fValue ));
- sal_Int32 nSize = rtl_ustr_getLength( aBuffer );
- return OUString( aBuffer, nSize );
+ return aBuffer;
#else
// Currently we have no support for a format string using sal_Unicode. wchar_t
// is 32 bit on Unix platform!
diff --git a/helpcompiler/inc/HelpCompiler.hxx b/helpcompiler/inc/HelpCompiler.hxx
index 12f6ada7b824..8d8a920da696 100644
--- a/helpcompiler/inc/HelpCompiler.hxx
+++ b/helpcompiler/inc/HelpCompiler.hxx
@@ -88,11 +88,11 @@ namespace fs
return std::string(tmp.getStr());
}
#ifdef _WIN32
- wchar_t const * native_file_string_w() const
+ std::wstring native_file_string_w() const
{
OUString ustrSystemPath;
osl::File::getSystemPathFromFileURL(data, ustrSystemPath);
- return reinterpret_cast<wchar_t const *>(ustrSystemPath.getStr());
+ return std::wstring(SAL_W(ustrSystemPath.getStr()));
}
#endif
std::string toUTF8() const
diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx
index ae54fadb68a7..07303afe9e6a 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -38,6 +38,17 @@
#include <expat.h>
#include <memory>
+namespace {
+FILE* fopen_impl(const fs::path& rPath, const char* szMode)
+{
+#ifdef _WIN32 //We need _wfopen to support long file paths on Windows XP
+ return _wfopen(rPath.native_file_string_w().c_str(), SAL_W(OUString::createFromAscii(szMode).getStr()));
+#else
+ return fopen(rPath.native_file_string().c_str(), szMode);
+#endif
+}
+}
+
IndexerPreProcessor::IndexerPreProcessor
( const fs::path& fsIndexBaseDir,
const fs::path& idxCaptionStylesheet, const fs::path& idxContentStylesheet )
@@ -87,13 +98,7 @@ void IndexerPreProcessor::processDocument
if( pResNodeCaption )
{
fs::path fsCaptionPureTextFile_docURL = m_fsCaptionFilesDirName / aStdStr_EncodedDocPathURL;
-#ifdef _WIN32 //We need _wfopen to support long file paths on Windows XP
- FILE* pFile_docURL = _wfopen(
- fsCaptionPureTextFile_docURL.native_file_string_w(), L"w" );
-#else
- FILE* pFile_docURL = fopen(
- fsCaptionPureTextFile_docURL.native_file_string().c_str(), "w" );
-#endif
+ FILE* pFile_docURL = fopen_impl( fsCaptionPureTextFile_docURL, "w" );
if( pFile_docURL )
{
fprintf( pFile_docURL, "%s\n", pResNodeCaption->content );
@@ -110,13 +115,7 @@ void IndexerPreProcessor::processDocument
if( pResNodeContent )
{
fs::path fsContentPureTextFile_docURL = m_fsContentFilesDirName / aStdStr_EncodedDocPathURL;
-#ifdef _WIN32 //We need _wfopen to support long file paths on Windows XP
- FILE* pFile_docURL = _wfopen(
- fsContentPureTextFile_docURL.native_file_string_w(), L"w" );
-#else
- FILE* pFile_docURL = fopen(
- fsContentPureTextFile_docURL.native_file_string().c_str(), "w" );
-#endif
+ FILE* pFile_docURL = fopen_impl( fsContentPureTextFile_docURL, "w" );
if( pFile_docURL )
{
fprintf( pFile_docURL, "%s\n", pResNodeContent->content );
@@ -186,11 +185,7 @@ public:
void dump_DBHelp( const fs::path& rFileName )
{
-#ifdef _WIN32 //We need _wfopen to support long file paths on Windows XP
- FILE* pFile = _wfopen( rFileName.native_file_string_w(), L"wb" );
-#else
- FILE* pFile = fopen( rFileName.native_file_string().c_str(), "wb" );
-#endif
+ FILE* pFile = fopen_impl( rFileName, "wb" );
if( pFile == nullptr )
return;
@@ -296,25 +291,10 @@ void HelpLinker::link()
bUse_ = false;
fs::path helpTextFileName_DBHelp(indexDirParentName / (mod + (bUse_ ? ".ht_" : ".ht")));
-#ifdef _WIN32
- //We need _wfopen to support long file paths on Windows XP
- FILE* pFileHelpText_DBHelp = _wfopen
- ( helpTextFileName_DBHelp.native_file_string_w(), L"wb" );
-#else
-
- FILE* pFileHelpText_DBHelp = fopen
- ( helpTextFileName_DBHelp.native_file_string().c_str(), "wb" );
-#endif
+ FILE* pFileHelpText_DBHelp = fopen_impl( helpTextFileName_DBHelp, "wb" );
fs::path dbBaseFileName_DBHelp(indexDirParentName / (mod + (bUse_ ? ".db_" : ".db")));
-#ifdef _WIN32
- //We need _wfopen to support long file paths on Windows XP
- FILE* pFileDbBase_DBHelp = _wfopen
- ( dbBaseFileName_DBHelp.native_file_string_w(), L"wb" );
-#else
- FILE* pFileDbBase_DBHelp = fopen
- ( dbBaseFileName_DBHelp.native_file_string().c_str(), "wb" );
-#endif
+ FILE* pFileDbBase_DBHelp = fopen_impl( dbBaseFileName_DBHelp, "wb" );
fs::path keyWordFileName_DBHelp(indexDirParentName / (mod + (bUse_ ? ".key_" : ".key")));
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index 446654f98759..f94c91f5aaf4 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -1647,9 +1647,9 @@ oslFileError SAL_CALL osl_getFileStatus(
{
::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
sal_uInt32 nNewLen = GetCaseCorrectPathName( SAL_W(rtl_uString_getStr( pItemImpl->m_pFullPath )),
- ::osl::mingw_reinterpret_cast<LPWSTR>( aBuffer ),
- aBuffer.getBufSizeInSymbols(),
- true );
+ SAL_W( aBuffer ),
+ aBuffer.getBufSizeInSymbols(),
+ true );
if ( nNewLen )
{
diff --git a/sal/osl/w32/path_helper.hxx b/sal/osl/w32/path_helper.hxx
index 68cf92cc05d8..31c245ac868c 100644
--- a/sal/osl/w32/path_helper.hxx
+++ b/sal/osl/w32/path_helper.hxx
@@ -118,8 +118,6 @@ public:
};
- template< class U, class T > U mingw_reinterpret_cast(LongPathBuffer<T>& a) { return reinterpret_cast<U>(static_cast<T*>(a)); }
-
} // end namespace osl
#endif
diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx
index f3539e658110..0137a0fc539d 100644
--- a/sal/osl/w32/profile.cxx
+++ b/sal/osl/w32/profile.cxx
@@ -1977,7 +1977,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
while ((strPath[i] != L'"') && (strPath[i] != L'\0'))
i++;
- WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(strPath), i, Product, sizeof(Product), nullptr, nullptr);
+ WideCharToMultiByte(CP_ACP,0, SAL_W(strPath), i, Product, sizeof(Product), nullptr, nullptr);
Product[i] = '\0';
strPath += i;
@@ -2121,12 +2121,12 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
int nLen = 0;
- if ((nLen = WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), nullptr, nullptr)) > 0)
+ if ((nLen = WideCharToMultiByte(CP_ACP,0, SAL_W(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), nullptr, nullptr)) > 0)
{
strcpy(aTmpPath + nLen, SVERSION_USER);
if (access(aTmpPath, 0) >= 0)
{
- dwPathLen += MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, reinterpret_cast<LPWSTR>(aPath + dwPathLen), aPath.getBufSizeInSymbols() - dwPathLen );
+ dwPathLen += MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, SAL_W(aPath + dwPathLen), aPath.getBufSizeInSymbols() - dwPathLen );
}
}
}
@@ -2180,7 +2180,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
/* if we have no product identification use the executable file name */
if (*Product == 0)
{
- WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(strExecutable->buffer + nPos + 1), -1, Product, sizeof(Product), nullptr, nullptr);
+ WideCharToMultiByte(CP_ACP,0, SAL_W(strExecutable->buffer + nPos + 1), -1, Product, sizeof(Product), nullptr, nullptr);
/* remove extension */
if ((pChr = strrchr(Product, '.')) != nullptr)
@@ -2203,7 +2203,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
{
::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), nullptr, nullptr);
+ WideCharToMultiByte(CP_ACP,0, SAL_W(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), nullptr, nullptr);
/* if file not exists, remove any specified subdirectories
like "bin" or "program" */
@@ -2227,7 +2227,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
}
else
{
- dwPathLen = nPos + MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, reinterpret_cast<LPWSTR>(aPath + nPos + 1), aPath.getBufSizeInSymbols() - (nPos + 1) );
+ dwPathLen = nPos + MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, SAL_W(aPath + nPos + 1), aPath.getBufSizeInSymbols() - (nPos + 1) );
}
}
else
@@ -2252,7 +2252,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
{
::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), nullptr, nullptr);
+ WideCharToMultiByte(CP_ACP,0, SAL_W(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), nullptr, nullptr);
if ((access(aTmpPath, 0) < 0) && (Product[0] != '\0'))
{
@@ -2301,7 +2301,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
if (Buffer[0] != '\0')
{
dwPathLen = MultiByteToWideChar(
- CP_ACP, 0, Buffer, -1, ::osl::mingw_reinterpret_cast<LPWSTR>(aPath), aPath.getBufSizeInSymbols() );
+ CP_ACP, 0, Buffer, -1, SAL_W(aPath), aPath.getBufSizeInSymbols() );
dwPathLen -=1;
/* build full path */
@@ -2322,7 +2322,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
int n;
if ((n = WideCharToMultiByte(
- CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath2,
+ CP_ACP,0, SAL_W(aPath), -1, aTmpPath2,
aTmpPath2.getBufSizeInSymbols(), nullptr, nullptr))
> 0)
{
@@ -2331,7 +2331,7 @@ static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile
{
dwPathLen += MultiByteToWideChar(
CP_ACP, 0, SVERSION_USER, -1,
- reinterpret_cast<LPWSTR>(aPath + dwPathLen),
+ SAL_W(aPath + dwPathLen),
aPath.getBufSizeInSymbols() - dwPathLen );
}
}
diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx
index e670d62e4d7e..98b84d2c3d64 100644
--- a/sfx2/source/appl/shutdowniconw32.cxx
+++ b/sfx2/source/appl/shutdowniconw32.cxx
@@ -754,7 +754,7 @@ BOOL CreateShortcut( const OUString& rAbsObject, const OUString& rAbsObjectPath,
if( SUCCEEDED(hres) )
{
- hres = ppf->Save( reinterpret_cast<LPCOLESTR>(rAbsShortcut.getStr()), TRUE );
+ hres = ppf->Save( SAL_W(rAbsShortcut.getStr()), TRUE );
ppf->Release();
} else return FALSE;
psl->Release();
diff --git a/winaccessibility/source/UAccCOM/AccActionBase.cxx b/winaccessibility/source/UAccCOM/AccActionBase.cxx
index c873b44115c4..8feee0227c83 100644
--- a/winaccessibility/source/UAccCOM/AccActionBase.cxx
+++ b/winaccessibility/source/UAccCOM/AccActionBase.cxx
@@ -117,7 +117,7 @@ STDMETHODIMP CAccActionBase::get_description(long actionIndex,BSTR __RPC_FAR *de
// #CHECK#
SAFE_SYSFREESTRING(*description);
- *description = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr()));
+ *description = SysAllocString(SAL_W(ouStr.getStr()));
return S_OK;
@@ -176,8 +176,7 @@ STDMETHODIMP CAccActionBase::get_keyBinding(
{
auto const wString = GetkeyBindingStrByXkeyBinding( (binding.get())->getAccessibleKeyBinding(index) );
- (*keyBinding)[index] = SysAllocString(
- reinterpret_cast<wchar_t const *>(wString.getStr()));
+ (*keyBinding)[index] = SysAllocString(SAL_W(wString.getStr()));
}
*nBinding = nCount;
diff --git a/winaccessibility/source/UAccCOM/AccImage.cxx b/winaccessibility/source/UAccCOM/AccImage.cxx
index 4435841ed457..5b0e88fd47d1 100644
--- a/winaccessibility/source/UAccCOM/AccImage.cxx
+++ b/winaccessibility/source/UAccCOM/AccImage.cxx
@@ -56,7 +56,7 @@ STDMETHODIMP CAccImage::get_description(BSTR * description)
::rtl::OUString ouStr = GetXInterface()->getAccessibleImageDescription();
SAFE_SYSFREESTRING(*description);
- *description = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr()));
+ *description = SysAllocString(SAL_W(ouStr.getStr()));
return S_OK;
diff --git a/winaccessibility/source/UAccCOM/AccTable.cxx b/winaccessibility/source/UAccCOM/AccTable.cxx
index f39fab74431d..6c6aebf32761 100644
--- a/winaccessibility/source/UAccCOM/AccTable.cxx
+++ b/winaccessibility/source/UAccCOM/AccTable.cxx
@@ -132,7 +132,7 @@ STDMETHODIMP CAccTable::get_columnDescription(long column, BSTR * description)
// #CHECK#
SAFE_SYSFREESTRING(*description);//??
- *description = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr()));
+ *description = SysAllocString(SAL_W(ouStr.getStr()));
if(description==nullptr)
return E_FAIL;
return S_OK;
@@ -351,7 +351,7 @@ STDMETHODIMP CAccTable::get_rowDescription(long row, BSTR * description)
// #CHECK#
SAFE_SYSFREESTRING(*description);
- *description = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr()));
+ *description = SysAllocString(SAL_W(ouStr.getStr()));
if(description==nullptr)
return E_FAIL;
diff --git a/winaccessibility/source/UAccCOM/AccTextBase.cxx b/winaccessibility/source/UAccCOM/AccTextBase.cxx
index 0c7a58dbdade..651a1abe5347 100644
--- a/winaccessibility/source/UAccCOM/AccTextBase.cxx
+++ b/winaccessibility/source/UAccCOM/AccTextBase.cxx
@@ -183,9 +183,7 @@ STDMETHODIMP CAccTextBase::get_attributes(long offset, long * startOffset, long
// #CHECK#
if(*textAttributes)
SysFreeString(*textAttributes);
- *textAttributes = SysAllocString(
- reinterpret_cast<wchar_t const *>(
- strAttrs.makeStringAndClear().getStr()));
+ *textAttributes = SysAllocString(SAL_W(strAttrs.makeStringAndClear().getStr()));
if( offset < GetXInterface()->getCharacterCount() )
{
@@ -493,7 +491,7 @@ STDMETHODIMP CAccTextBase::get_text(long startOffset, long endOffset, BSTR * tex
}
SysFreeString(*text);
- *text = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr()));
+ *text = SysAllocString(SAL_W(ouStr.getStr()));
return S_OK;
LEAVE_PROTECTED_BLOCK
@@ -578,7 +576,7 @@ STDMETHODIMP CAccTextBase::get_textBeforeOffset(long offset, IA2TextBoundaryType
TextSegment segment = GetXInterface()->getTextBeforeIndex( offset, sal_Int16(lUnoBoundaryType));
::rtl::OUString ouStr = segment.SegmentText;
SysFreeString(*text);
- *text = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr()));
+ *text = SysAllocString(SAL_W(ouStr.getStr()));
*startOffset = segment.SegmentStart;
*endOffset = segment.SegmentEnd;
@@ -664,7 +662,7 @@ STDMETHODIMP CAccTextBase::get_textAfterOffset(long offset, IA2TextBoundaryType
TextSegment segment = GetXInterface()->getTextBehindIndex( offset, sal_Int16(lUnoBoundaryType));
::rtl::OUString ouStr = segment.SegmentText;
SysFreeString(*text);
- *text = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr()));
+ *text = SysAllocString(SAL_W(ouStr.getStr()));
*startOffset = segment.SegmentStart;
*endOffset = segment.SegmentEnd;
@@ -751,7 +749,7 @@ STDMETHODIMP CAccTextBase::get_textAtOffset(long offset, IA2TextBoundaryType bou
TextSegment segment = GetXInterface()->getTextAtIndex( offset, sal_Int16(lUnoBoundaryType));
::rtl::OUString ouStr = segment.SegmentText;
SysFreeString(*text);
- *text = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr()));
+ *text = SysAllocString(SAL_W(ouStr.getStr()));
*startOffset = segment.SegmentStart;
*endOffset = segment.SegmentEnd;
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx
index f0a72faa2d15..4a713760c21c 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cxx
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -737,8 +737,7 @@ STDMETHODIMP CMAccessible::get_accKeyboardShortcut(VARIANT varChild, BSTR *pszKe
}
SAFE_SYSFREESTRING(*pszKeyboardShortcut);
- *pszKeyboardShortcut = SysAllocString(
- reinterpret_cast<wchar_t const *>(wString.getStr()));
+ *pszKeyboardShortcut = SysAllocString(SAL_W(wString.getStr()));
return S_OK;
}
@@ -2959,8 +2958,7 @@ void CMAccessible::ConvertAnyToVariant(const css::uno::Any &rAnyVal, VARIANT *pv
pvData->vt = VT_BSTR;
::rtl::OUString val;
rAnyVal >>= val;
- pvData->bstrVal = SysAllocString(
- reinterpret_cast<wchar_t const *>(val.getStr()));
+ pvData->bstrVal = SysAllocString(SAL_W(val.getStr()));
break;
}
@@ -3013,7 +3011,7 @@ void CMAccessible::ConvertAnyToVariant(const css::uno::Any &rAnyVal, VARIANT *pv
case TypeClass::TypeClass_MAKE_FIXED_SIZE:
// Output the type string, if there is other uno value type.
pvData->vt = VT_BSTR;
- pvData->bstrVal = SysAllocString(reinterpret_cast<wchar_t const *>(rAnyVal.getValueTypeName().getStr()));
+ pvData->bstrVal = SysAllocString(SAL_W(rAnyVal.getValueTypeName().getStr()));
break;
default:
@@ -3127,12 +3125,9 @@ STDMETHODIMP CMAccessible:: get_locale( IA2Locale __RPC_FAR *locale )
return E_FAIL;
css::lang::Locale unoLoc = m_xContext.get()->getLocale();
- locale->language = SysAllocString(
- reinterpret_cast<wchar_t const *>(unoLoc.Language.getStr()));
- locale->country = SysAllocString(
- reinterpret_cast<wchar_t const *>(unoLoc.Country.getStr()));
- locale->variant = SysAllocString(
- reinterpret_cast<wchar_t const *>(unoLoc.Variant.getStr()));
+ locale->language = SysAllocString(SAL_W(unoLoc.Language.getStr()));
+ locale->country = SysAllocString(SAL_W(unoLoc.Country.getStr()));
+ locale->variant = SysAllocString(SAL_W(unoLoc.Variant.getStr()));
return S_OK;
@@ -3219,8 +3214,7 @@ STDMETHODIMP CMAccessible::get_attributes(/*[out]*/ BSTR *pAttr)
if(*pAttr)
SAFE_SYSFREESTRING(*pAttr);
- *pAttr = SysAllocString(
- reinterpret_cast<wchar_t const *>(val.getStr()));
+ *pAttr = SysAllocString(SAL_W(val.getStr()));
return S_OK;
}
diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx
index ccec26629c23..04f09d7c7725 100644
--- a/winaccessibility/source/service/AccObject.cxx
+++ b/winaccessibility/source/service/AccObject.cxx
@@ -271,7 +271,7 @@ void AccObject::UpdateName( )
}
if( ( TEXT_FRAME == m_accRole ) && ( m_pParentObj !=nullptr )&& ( SCROLL_PANE == m_pParentObj -> m_accRole ) )
- m_pIMAcc->Put_XAccName( reinterpret_cast<wchar_t const *>(m_pParentObj->m_xAccContextRef->getAccessibleName().getStr()) );
+ m_pIMAcc->Put_XAccName( SAL_W(m_pParentObj->m_xAccContextRef->getAccessibleName().getStr()) );
//IAccessibility2 Implementation 2009-----
if ( PARAGRAPH == m_accRole)
{
@@ -279,7 +279,7 @@ void AccObject::UpdateName( )
}
//-----IAccessibility2 Implementation 2009
else
- m_pIMAcc->Put_XAccName(reinterpret_cast<wchar_t const *>(m_xAccContextRef->getAccessibleName().getStr()));
+ m_pIMAcc->Put_XAccName(SAL_W(m_xAccContextRef->getAccessibleName().getStr()));
return ;
}
@@ -296,7 +296,7 @@ void AccObject::UpdateDescription()
return;
}
- m_pIMAcc->Put_XAccDescription(reinterpret_cast<wchar_t const *>(m_xAccContextRef->getAccessibleDescription().getStr()));
+ m_pIMAcc->Put_XAccDescription(SAL_W(m_xAccContextRef->getAccessibleDescription().getStr()));
return ;
}
@@ -365,7 +365,7 @@ void AccObject::UpdateDefaultAction( )
case CHECK_BOX:
case TREE_ITEM:
case BUTTON_DROPDOWN:
- m_pIMAcc->Put_ActionDescription( reinterpret_cast<wchar_t const *>(m_xAccActionRef->getAccessibleActionDescription((sal_Int32)0).getStr()) );
+ m_pIMAcc->Put_ActionDescription( SAL_W(m_xAccActionRef->getAccessibleActionDescription((sal_Int32)0).getStr()) );
return;
}
}
@@ -401,19 +401,19 @@ void AccObject::SetValue( Any pAny )
{
val = pRText->getText();
}
- m_pIMAcc->Put_XAccValue( reinterpret_cast<wchar_t const *>(val.getStr()) );
+ m_pIMAcc->Put_XAccValue( SAL_W(val.getStr()) );
break;
case TREE_ITEM:
//case CHECK_BOX: //Commented by Li Xing to disable the value for general checkbox
case COMBO_BOX:
case NOTE:
case SCROLL_BAR:
- m_pIMAcc->Put_XAccValue( reinterpret_cast<wchar_t const *>(GetMAccessibleValueFromAny(pAny).getStr()) );
+ m_pIMAcc->Put_XAccValue( SAL_W(GetMAccessibleValueFromAny(pAny).getStr()) );
break ;
// Added by Li Xing, only the checkbox in tree should have the value.
case CHECK_BOX:
if( ( m_pParentObj !=nullptr ) && (TREE == m_pParentObj->m_accRole || TREE_ITEM == m_pParentObj->m_accRole ))
- m_pIMAcc->Put_XAccValue( reinterpret_cast<wchar_t const *>(GetMAccessibleValueFromAny(pAny).getStr()) );
+ m_pIMAcc->Put_XAccValue( SAL_W(GetMAccessibleValueFromAny(pAny).getStr()) );
break;
default:
break;
@@ -499,7 +499,7 @@ void AccObject::SetName( Any pAny)
if( nullptr == m_pIMAcc )
return ;
- m_pIMAcc->Put_XAccName( reinterpret_cast<wchar_t const *>(GetMAccessibleValueFromAny(pAny).getStr()) );
+ m_pIMAcc->Put_XAccName( SAL_W(GetMAccessibleValueFromAny(pAny).getStr()) );
}
@@ -512,7 +512,7 @@ void AccObject::SetDescription( Any pAny )
{
if( nullptr == m_pIMAcc )
return ;
- m_pIMAcc->Put_XAccDescription( reinterpret_cast<wchar_t const *>(GetMAccessibleValueFromAny(pAny).getStr()) );
+ m_pIMAcc->Put_XAccDescription( SAL_W(GetMAccessibleValueFromAny(pAny).getStr()) );
}
/**
@@ -754,7 +754,7 @@ void AccObject::UpdateActionDesc()
}
::rtl::OUString pXString = m_xAccContextRef->getAccessibleDescription();
- m_pIMAcc->Put_XAccDescription(reinterpret_cast<wchar_t const *>(pXString.getStr()));
+ m_pIMAcc->Put_XAccDescription(SAL_W(pXString.getStr()));
long Role = m_accRole;
if( Role == PUSH_BUTTON || Role == RADIO_BUTTON || Role == MENU_ITEM ||
@@ -776,7 +776,7 @@ void AccObject::UpdateActionDesc()
pXString = m_xAccActionRef->getAccessibleActionDescription( 0 );
//Solution: if string length is more than zero, action is set.
if( pXString.getLength() > 0)
- m_pIMAcc->Put_ActionDescription( reinterpret_cast<wchar_t const *>(pXString.getStr()) );
+ m_pIMAcc->Put_ActionDescription( SAL_W(pXString.getStr()) );
}
}
}