diff options
Diffstat (limited to 'basic')
-rw-r--r-- | basic/qa/cppunit/test_vba.cxx | 3 | ||||
-rw-r--r-- | basic/source/runtime/dllmgr-x64.cxx | 3 | ||||
-rw-r--r-- | basic/source/runtime/dllmgr-x86.cxx | 3 | ||||
-rw-r--r-- | basic/source/runtime/methods.cxx | 5 | ||||
-rw-r--r-- | basic/source/sbx/sbxdec.cxx | 69 |
5 files changed, 40 insertions, 43 deletions
diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx index 39efcb7d5805..0289f641f771 100644 --- a/basic/qa/cppunit/test_vba.cxx +++ b/basic/qa/cppunit/test_vba.cxx @@ -9,6 +9,7 @@ #include "basictest.hxx" #include <comphelper/processfactory.hxx> #include <unotools/syslocaleoptions.hxx> +#include <o3tl/char16_t2wchar_t.hxx> #ifdef _WIN32 #include <string.h> @@ -233,7 +234,7 @@ void VBATest::testMiscOLEStuff() sPath = sPath.replaceAll( "/", "\\" ); aArgs[ 0 ] <<= sPath; - aArgs[ 1 ] <<= OUString(SAL_U(pODBCDriverName)); + aArgs[ 1 ] <<= OUString(o3tl::toU(pODBCDriverName)); for ( sal_uInt32 i=0; i<SAL_N_ELEMENTS( macroSource ); ++i ) { diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx index fdd54b129da8..96aa4fcbdd78 100644 --- a/basic/source/runtime/dllmgr-x64.cxx +++ b/basic/source/runtime/dllmgr-x64.cxx @@ -37,6 +37,7 @@ #include <rtl/string.hxx> #include <rtl/ustring.hxx> #include <salhelper/simplereferenceobject.hxx> +#include <o3tl/char16_t2wchar_t.hxx> #undef max @@ -734,7 +735,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(SAL_W(name.getStr())); + HMODULE h = LoadLibraryW(o3tl::toW(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 ff3e80549e71..576e3da1b736 100644 --- a/basic/source/runtime/dllmgr-x86.cxx +++ b/basic/source/runtime/dllmgr-x86.cxx @@ -37,6 +37,7 @@ #include <rtl/string.hxx> #include <rtl/ustring.hxx> #include <salhelper/simplereferenceobject.hxx> +#include <o3tl/char16_t2wchar_t.hxx> #undef max @@ -688,7 +689,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(SAL_W(name.getStr())); + HMODULE h = LoadLibraryW(o3tl::toW(name.getStr())); if (h == 0) { dlls.erase(i); return 0; diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 748675bfd272..377cb27f13a9 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -61,6 +61,7 @@ #include <memory> #include <random> #include <o3tl/make_unique.hxx> +#include <o3tl/char16_t2wchar_t.hxx> using namespace comphelper; using namespace osl; @@ -387,7 +388,7 @@ void SbRtl_CurDir(StarBASIC * pBasic, SbxArray & rPar, bool bWrite) wchar_t pBuffer[ _MAX_PATH ]; if ( _wgetdcwd( nCurDir, pBuffer, _MAX_PATH ) != nullptr ) { - rPar.Get(0)->PutString( SAL_U(pBuffer) ); + rPar.Get(0)->PutString( o3tl::toU(pBuffer) ); } else { @@ -2957,7 +2958,7 @@ void SbRtl_GetAttr(StarBASIC * pBasic, SbxArray & rPar, bool bWrite) OUString aPathURL = getFullPath( rPar.Get(1)->GetOUString() ); OUString aPath; FileBase::getSystemPathFromFileURL( aPathURL, aPath ); - DWORD nRealFlags = GetFileAttributesW (SAL_W(aPath.getStr())); + DWORD nRealFlags = GetFileAttributesW (o3tl::toW(aPath.getStr())); if (nRealFlags != 0xffffffff) { if (nRealFlags == FILE_ATTRIBUTE_NORMAL) diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx index f546434df434..8356d36cab77 100644 --- a/basic/source/sbx/sbxdec.cxx +++ b/basic/source/sbx/sbxdec.cxx @@ -18,6 +18,7 @@ */ #include <vcl/errcode.hxx> +#include <o3tl/char16_t2wchar_t.hxx> #include <basic/sbx.hxx> #include <basic/sberrors.hxx> @@ -213,25 +214,21 @@ bool SbxDecimal::setString( OUString* pOUString ) pBuffer[nLen] = 0; const sal_Unicode* pSrc = pOUString->getStr(); - int i; - for( i = 0 ; i < nLen ; ++i ) - pBuffer[i] = pSrc[i]; - - sal_Unicode c; - i = 0; - while( (c = pBuffer[i]) != 0 ) + for( int i = 0 ; i < nLen ; ++i ) { - if( c == cDecimalSep ) - pBuffer[i] = '.'; - else if( c == cThousandSep ) - pBuffer[i] = ','; - i++; + sal_Unicode c = pSrc[i]; + if (c == cDecimalSep) + c = '.'; + else if (c == cThousandSep) + c = ','; + + pBuffer[i] = c; } - hResult = VarDecFromStr( SAL_W(pBuffer.get()), nLANGID, 0, &maDec ); + hResult = VarDecFromStr( o3tl::toW(pBuffer.get()), nLANGID, 0, &maDec ); } else { - hResult = VarDecFromStr( SAL_W(pOUString->getStr()), nLANGID, 0, &maDec ); + hResult = VarDecFromStr( o3tl::toW(pOUString->getStr()), nLANGID, 0, &maDec ); } bRet = ( hResult == S_OK ); return bRet; @@ -349,35 +346,31 @@ void SbxDecimal::getString( OUString& rString ) #ifdef _WIN32 static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ); - OLECHAR sz[100]; - BSTR aBStr = SysAllocString( sz ); - if( aBStr != nullptr ) + BSTR pBStr = nullptr; + // VarBstrFromDec allocates new BSTR that needs to be released with SysFreeString + HRESULT hResult = VarBstrFromDec( &maDec, nLANGID, 0, &pBStr ); + if( hResult == S_OK ) { - HRESULT hResult = VarBstrFromDec( &maDec, nLANGID, 0, &aBStr ); - if( hResult == S_OK ) - { - // Convert delimiter - sal_Unicode cDecimalSep; - sal_Unicode cThousandSep; - ImpGetIntntlSep( cDecimalSep, cThousandSep ); + // Convert delimiter + sal_Unicode cDecimalSep; + sal_Unicode cThousandSep; + ImpGetIntntlSep( cDecimalSep, cThousandSep ); - if( cDecimalSep != '.' || cThousandSep != ',' ) + if( cDecimalSep != '.' || cThousandSep != ',' ) + { + sal_Unicode c; + int i = 0; + while( (c = pBStr[i]) != 0 ) { - sal_Unicode c; - int i = 0; - while( (c = aBStr[i]) != 0 ) - { - if( c == '.' ) - aBStr[i] = cDecimalSep; - else if( c == ',' ) - aBStr[i] = cThousandSep; - i++; - } + if( c == '.' ) + pBStr[i] = cDecimalSep; + else if( c == ',' ) + pBStr[i] = cThousandSep; + i++; } - rString = SAL_U(aBStr); } - - SysFreeString( aBStr ); + rString = o3tl::toU( pBStr ); + SysFreeString( pBStr ); } #else (void)rString; |