summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-09-29 17:33:15 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-09-30 19:08:28 +0200
commitc3609f107b16eb888edf284f4637be6cb09234eb (patch)
treeda52e05b5cdf26d5d3a57f510f8b32d8af10a026 /basic
parent8a4df9376bf299beb49fe116882ffdbd10b5e02b (diff)
Use SAL_W/SAL_U instead of reinterpret_cast btwn wchar_t* and sal_Unicode*
This is type-safe, and allows to catch cases where a source type is changed for some reason, but reinterpret_cast masks that Change-Id: Ib64b6fa2e22d94a6bba890f0ccc3e20325c6f0a1 Reviewed-on: https://gerrit.libreoffice.org/42961 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/qa/cppunit/test_vba.cxx3
-rw-r--r--basic/source/runtime/methods.cxx3
-rw-r--r--basic/source/sbx/sbxdec.cxx10
3 files changed, 5 insertions, 11 deletions
diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx
index 97470dd515a5..39efcb7d5805 100644
--- a/basic/qa/cppunit/test_vba.cxx
+++ b/basic/qa/cppunit/test_vba.cxx
@@ -233,8 +233,7 @@ void VBATest::testMiscOLEStuff()
sPath = sPath.replaceAll( "/", "\\" );
aArgs[ 0 ] <<= sPath;
- aArgs[ 1 ] <<= OUString(
- reinterpret_cast<sal_Unicode const *>(pODBCDriverName));
+ aArgs[ 1 ] <<= OUString(SAL_U(pODBCDriverName));
for ( sal_uInt32 i=0; i<SAL_N_ELEMENTS( macroSource ); ++i )
{
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index cef5dd269a3a..748675bfd272 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -387,8 +387,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(
- OUString( reinterpret_cast<sal_Unicode const *>(pBuffer) ) );
+ rPar.Get(0)->PutString( SAL_U(pBuffer) );
}
else
{
diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index 99d46128c9da..f546434df434 100644
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -227,15 +227,11 @@ bool SbxDecimal::setString( OUString* pOUString )
pBuffer[i] = ',';
i++;
}
- hResult = VarDecFromStr(
- reinterpret_cast<wchar_t const *>(pBuffer.get()), nLANGID, 0,
- &maDec );
+ hResult = VarDecFromStr( SAL_W(pBuffer.get()), nLANGID, 0, &maDec );
}
else
{
- hResult = VarDecFromStr(
- reinterpret_cast<wchar_t const *>(pOUString->getStr()), nLANGID, 0,
- &maDec );
+ hResult = VarDecFromStr( SAL_W(pOUString->getStr()), nLANGID, 0, &maDec );
}
bRet = ( hResult == S_OK );
return bRet;
@@ -378,7 +374,7 @@ void SbxDecimal::getString( OUString& rString )
i++;
}
}
- rString = reinterpret_cast<const sal_Unicode*>(aBStr);
+ rString = SAL_U(aBStr);
}
SysFreeString( aBStr );