Kaydet (Commit) 532a4dcb authored tarafından Mike Kaganski's avatar Mike Kaganski

Replace more reinterpret_cast with SAL_W/SAL_U

Change-Id: Ia632e4083222ad9e7f17c2ad0d0825f189c700cc
Reviewed-on: https://gerrit.libreoffice.org/43071Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 372d2d78
......@@ -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;
}
......
......@@ -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) ) ) &&
......
......@@ -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;
......
......@@ -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;
......
......@@ -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) );
......
......@@ -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,
......
......@@ -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
}
......
......@@ -505,7 +505,7 @@ void SAL_CALL CXTDataObject::renderSynthesizedTextAndSetupStgMedium( FORMATETC&
WideCharToMultiByteEx(
GetACP( ),
reinterpret_cast<LPCWSTR>( aUnicodeText.getStr( ) ),
SAL_W( aUnicodeText.getStr( ) ),
aUnicodeText.getLength( ),
stgTransfHelper );
......
......@@ -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);
}
......
......@@ -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 );
......
......@@ -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!
......
......@@ -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
......
......@@ -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")));
......
......@@ -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 )
{
......
......@@ -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
......
......@@ -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 );
}
}
......
......@@ -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();
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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()) );
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment