summaryrefslogtreecommitdiff
path: root/extensions
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 /extensions
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 'extensions')
-rw-r--r--extensions/source/config/ldap/ldapaccess.cxx20
-rw-r--r--extensions/source/ole/oleobjw.cxx34
-rw-r--r--extensions/source/ole/servprov.cxx8
-rw-r--r--extensions/source/ole/servreg.cxx16
-rw-r--r--extensions/source/ole/unoconversionutilities.hxx13
-rw-r--r--extensions/source/ole/unoobjw.cxx17
-rw-r--r--extensions/source/update/check/updatecheckconfig.cxx4
7 files changed, 55 insertions, 57 deletions
diff --git a/extensions/source/config/ldap/ldapaccess.cxx b/extensions/source/config/ldap/ldapaccess.cxx
index 0ef10fb913b0..8dcd911e7034 100644
--- a/extensions/source/config/ldap/ldapaccess.cxx
+++ b/extensions/source/config/ldap/ldapaccess.cxx
@@ -131,8 +131,8 @@ void LdapConnection::connectSimple()
// Do the bind
#ifdef _WIN32
LdapErrCode retCode = ldap_simple_bind_sW(mConnection,
- reinterpret_cast<wchar_t *>(const_cast<sal_Unicode *>(mLdapDefinition.mAnonUser.getStr())),
- reinterpret_cast<wchar_t *>(const_cast<sal_Unicode *>(mLdapDefinition.mAnonCredentials.getStr())) );
+ const_cast<PWSTR>(SAL_W(mLdapDefinition.mAnonUser.getStr())),
+ const_cast<PWSTR>(SAL_W(mLdapDefinition.mAnonCredentials.getStr())) );
#else
LdapErrCode retCode = ldap_simple_bind_s(mConnection,
OUStringToOString( mLdapDefinition.mAnonUser, RTL_TEXTENCODING_UTF8 ).getStr(),
@@ -153,7 +153,7 @@ void LdapConnection::initConnection()
if (mLdapDefinition.mPort == 0) mLdapDefinition.mPort = LDAP_PORT;
#ifdef _WIN32
- mConnection = ldap_initW(reinterpret_cast<wchar_t *>(const_cast<sal_Unicode *>(mLdapDefinition.mServer.getStr())),
+ mConnection = ldap_initW(const_cast<PWSTR>(SAL_W(mLdapDefinition.mServer.getStr())),
mLdapDefinition.mPort) ;
#else
mConnection = ldap_init(OUStringToOString( mLdapDefinition.mServer, RTL_TEXTENCODING_UTF8 ).getStr(),
@@ -178,9 +178,9 @@ void LdapConnection::initConnection()
LdapMessageHolder result;
#ifdef _WIN32
LdapErrCode retCode = ldap_search_sW(mConnection,
- reinterpret_cast<wchar_t *>(const_cast<sal_Unicode *>(aUserDn.getStr())),
+ const_cast<PWSTR>(SAL_W(aUserDn.getStr())),
LDAP_SCOPE_BASE,
- const_cast<PWCHAR>( L"(objectclass=*)" ),
+ const_cast<PWSTR>( L"(objectclass=*)" ),
nullptr,
0, // Attributes + values
&result.msg) ;
@@ -201,8 +201,8 @@ void LdapConnection::initConnection()
while (attr) {
PWCHAR * values = ldap_get_valuesW(mConnection, result.msg, attr);
if (values) {
- const OUString aAttr( reinterpret_cast<sal_Unicode*>( attr ) );
- const OUString aValues( reinterpret_cast<sal_Unicode*>( *values ) );
+ const OUString aAttr( SAL_U( attr ) );
+ const OUString aValues( SAL_U( *values ) );
data->emplace( aAttr, aValues );
ldap_value_freeW(values);
}
@@ -243,9 +243,9 @@ void LdapConnection::initConnection()
#ifdef _WIN32
PWCHAR attributes [2] = { const_cast<PWCHAR>( L"1.1" ), nullptr };
LdapErrCode retCode = ldap_search_sW(mConnection,
- reinterpret_cast<wchar_t *>(const_cast<sal_Unicode *>(mLdapDefinition.mBaseDN.getStr())),
+ const_cast<PWSTR>(SAL_W(mLdapDefinition.mBaseDN.getStr())),
LDAP_SCOPE_SUBTREE,
- reinterpret_cast<wchar_t *>(const_cast<sal_Unicode *>(filter.makeStringAndClear().getStr())), attributes, 0, &result.msg) ;
+ const_cast<PWSTR>(SAL_W(filter.makeStringAndClear().getStr())), attributes, 0, &result.msg) ;
#else
sal_Char * attributes [2] = { const_cast<sal_Char *>(LDAP_NO_ATTRS), nullptr };
LdapErrCode retCode = ldap_search_s(mConnection,
@@ -262,7 +262,7 @@ void LdapConnection::initConnection()
#ifdef _WIN32
PWCHAR charsDn = ldap_get_dnW(mConnection, entry) ;
- userDn = OUString( reinterpret_cast<const sal_Unicode*>( charsDn ) );
+ userDn = OUString( SAL_U( charsDn ) );
ldap_memfreeW(charsDn) ;
#else
sal_Char *charsDn = ldap_get_dn(mConnection, entry) ;
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index 197e635f1937..ccb4004eabf5 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -459,7 +459,7 @@ Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
if ( SUCCEEDED( pInfo->GetDocumentation( -1, &sName, nullptr, nullptr, nullptr ) ) )
{
- OUString sTmp( reinterpret_cast<const sal_Unicode*>(LPCOLESTR(sName)));
+ OUString sTmp( SAL_U(LPCOLESTR(sName)));
if ( sTmp.startsWith("_") )
sTmp = sTmp.copy(1);
// do we own the memory for pTypeLib, msdn doc is vague
@@ -470,7 +470,7 @@ Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
{
if ( SUCCEEDED( pTypeLib->GetDocumentation( -1, &sName, nullptr, nullptr, nullptr ) ) )
{
- OUString sLibName( reinterpret_cast<const sal_Unicode*>(LPCOLESTR(sName)));
+ OUString sLibName( SAL_U(LPCOLESTR(sName)));
m_sTypeName = sLibName.concat( "." ).concat( sTmp );
}
@@ -538,13 +538,13 @@ Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
case DISP_E_BADPARAMCOUNT:
case DISP_E_BADVARTYPE:
case DISP_E_EXCEPTION:
- throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)));
+ throw RuntimeException(OUString(SAL_U(excepinfo.bstrDescription)));
break;
case DISP_E_MEMBERNOTFOUND:
- throw UnknownPropertyException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)));
+ throw UnknownPropertyException(OUString(SAL_U(excepinfo.bstrDescription)));
break;
default:
- throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)));
+ throw RuntimeException(OUString(SAL_U(excepinfo.bstrDescription)));
break;
}
}
@@ -1187,7 +1187,7 @@ void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArgument
CComBSTR defaultMemberName;
if ( SUCCEEDED( pType->GetDocumentation(0, &defaultMemberName, nullptr, nullptr, nullptr ) ) )
{
- OUString usName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(defaultMemberName)));
+ OUString usName(SAL_U(LPCOLESTR(defaultMemberName)));
FuncDesc aDescGet(pType);
FuncDesc aDescPut(pType);
VarDesc aVarDesc(pType);
@@ -1283,7 +1283,7 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
std::unique_ptr<OLECHAR*[]> saNames(new OLECHAR*[nSizeAr]);
OLECHAR ** pNames = saNames.get();
- pNames[0] = const_cast<OLECHAR*>(reinterpret_cast<LPCOLESTR>(aName.getStr()));
+ pNames[0] = const_cast<OLECHAR*>(SAL_W(aName.getStr()));
int cNamedArg = 0;
for ( size_t nInd = 0; nInd < dispparams.cArgs; nInd++ )
@@ -1295,7 +1295,7 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
//We put the parameter names in reverse order into the array,
//so we can use the DISPID array for DISPPARAMS::rgdispidNamedArgs
//The first name in the array is the method name
- pNames[nSizeAr - 1 - cNamedArg++] = const_cast<OLECHAR*>(reinterpret_cast<LPCOLESTR>(arg.Name.getStr()));
+ pNames[nSizeAr - 1 - cNamedArg++] = const_cast<OLECHAR*>(SAL_W(arg.Name.getStr()));
}
}
@@ -1422,7 +1422,7 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
break;
case DISP_E_EXCEPTION:
message = "[automation bridge]: ";
- message += OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription),
+ message += OUString(SAL_U(excepinfo.bstrDescription),
::SysStringLen(excepinfo.bstrDescription));
throw InvocationTargetException(message, Reference<XInterface>(), Any());
break;
@@ -1722,7 +1722,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
std::unique_ptr<OLECHAR*[]> saNames(new OLECHAR*[nSizeAr]);
OLECHAR ** arNames = saNames.get();
- arNames[0] = const_cast<OLECHAR*>(reinterpret_cast<LPCOLESTR>(sFuncName.getStr()));
+ arNames[0] = const_cast<OLECHAR*>(SAL_W(sFuncName.getStr()));
int cNamedArg = 0;
for (size_t iParams = 0; iParams < dispparams.cArgs; iParams ++)
@@ -1734,7 +1734,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
//We put the parameter names in reverse order into the array,
//so we can use the DISPID array for DISPPARAMS::rgdispidNamedArgs
//The first name in the array is the method name
- arNames[nSizeAr - 1 - cNamedArg++] = const_cast<OLECHAR*>(reinterpret_cast<LPCOLESTR>(arg.Name.getStr()));
+ arNames[nSizeAr - 1 - cNamedArg++] = const_cast<OLECHAR*>(SAL_W(arg.Name.getStr()));
}
}
@@ -2048,7 +2048,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
break;
case DISP_E_EXCEPTION:
message = "[automation bridge]: ";
- message += OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription),
+ message += OUString(SAL_U(excepinfo.bstrDescription),
::SysStringLen(excepinfo.bstrDescription));
throw InvocationTargetException(message, Reference<XInterface>(), Any());
@@ -2157,7 +2157,7 @@ void IUnknownWrapper_Impl::getFuncDescForInvoke(const OUString & sFuncName,
bool IUnknownWrapper_Impl::getDispid(const OUString& sFuncName, DISPID * id)
{
OSL_ASSERT(m_spDispatch);
- LPOLESTR lpsz = const_cast<LPOLESTR> (reinterpret_cast<LPCOLESTR>(sFuncName.getStr()));
+ LPOLESTR lpsz = const_cast<LPOLESTR> (SAL_W(sFuncName.getStr()));
HRESULT hr = m_spDispatch->GetIDsOfNames(IID_NULL, &lpsz, 1, LOCALE_USER_DEFAULT, id);
return hr == S_OK;
}
@@ -2184,7 +2184,7 @@ void IUnknownWrapper_Impl::getFuncDesc(const OUString & sFuncName, FUNCDESC ** p
//get the associated index and add an entry to the map
//with the name sFuncName which differs in the casing of the letters to
//the actual name as obtained from ITypeInfo
- OUString sRealName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(memberName)));
+ OUString sRealName(SAL_U(LPCOLESTR(memberName)));
cit itOrg = m_mapComFunc.find(sRealName);
OSL_ASSERT(itOrg != m_mapComFunc.end());
// maybe this is a property, if so we need
@@ -2252,7 +2252,7 @@ void IUnknownWrapper_Impl::getPropDesc(const OUString & sFuncName, FUNCDESC ** p
//As opposed to getFuncDesc, we do not add the value because we would
// need to find the get and set description for the property. This would
//mean to iterate over all FUNCDESCs again.
- p = m_mapComFunc.equal_range(OUString(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(memberName))));
+ p = m_mapComFunc.equal_range(OUString(SAL_U(LPCOLESTR(memberName))));
}
}
}
@@ -2393,7 +2393,7 @@ void IUnknownWrapper_Impl::buildComTlbIndex()
unsigned int pcNames=0;
if( SUCCEEDED(pType->GetNames( funcDesc->memid, & memberName, 1, &pcNames)))
{
- OUString usName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(memberName)));
+ OUString usName(SAL_U(LPCOLESTR(memberName)));
m_mapComFunc.emplace(usName, i);
}
else
@@ -2420,7 +2420,7 @@ void IUnknownWrapper_Impl::buildComTlbIndex()
{
if (varDesc->varkind == VAR_DISPATCH)
{
- OUString usName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(memberName)));
+ OUString usName(SAL_U(LPCOLESTR(memberName)));
m_mapComFunc.emplace(usName, i);
}
}
diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
index 76663c49ec28..f3cacec755a7 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -59,7 +59,7 @@ ProviderOleWrapper_Impl::ProviderOleWrapper_Impl(const Reference<XMultiServiceFa
{
m_guid = *pGuid;
- Reference<XInterface> xInt = smgr->createInstance(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.bridge.oleautomation.BridgeSupplier"));
+ Reference<XInterface> xInt = smgr->createInstance("com.sun.star.bridge.oleautomation.BridgeSupplier");
if (xInt.is())
{
@@ -196,7 +196,7 @@ OneInstanceOleWrapper_Impl::OneInstanceOleWrapper_Impl( const Reference<XMultiS
{
m_guid = *pGuid;
- Reference<XInterface> xInt = m_smgr->createInstance(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.bridge.oleautomation.BridgeSupplier"));
+ Reference<XInterface> xInt = m_smgr->createInstance("com.sun.star.bridge.oleautomation.BridgeSupplier");
if (xInt.is())
{
@@ -537,7 +537,7 @@ Reference<XInterface> SAL_CALL OleClient_Impl::createInstance(const OUString& Se
o2u_attachCurrentThread();
result = CLSIDFromProgID(
- reinterpret_cast<LPCWSTR>(ServiceSpecifier.getStr()), //Pointer to the ProgID
+ SAL_W(ServiceSpecifier.getStr()), //Pointer to the ProgID
&classId); //Pointer to the CLSID
@@ -615,7 +615,7 @@ Reference< XInterface > OleClient_Impl::createComWrapperInstance( )
OleServer_Impl::OleServer_Impl( const Reference<XMultiServiceFactory>& smgr):
m_smgr( smgr)
{
- Reference<XInterface> xInt = m_smgr->createInstance(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.bridge.oleautomation.BridgeSupplier"));
+ Reference<XInterface> xInt = m_smgr->createInstance("com.sun.star.bridge.oleautomation.BridgeSupplier");
if (xInt.is())
{
diff --git a/extensions/source/ole/servreg.cxx b/extensions/source/ole/servreg.cxx
index bb2b1f839464..70dfe403338d 100644
--- a/extensions/source/ole/servreg.cxx
+++ b/extensions/source/ole/servreg.cxx
@@ -62,28 +62,28 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL oleautobridge_component_getFacto
OUString aImplName( OUString::createFromAscii( pImplName ) );
Reference< XSingleServiceFactory > xFactory;
Sequence<OUString> seqServiceNames;
- if (pServiceManager && aImplName.equals( reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleConverter2") ))
+ if (pServiceManager && aImplName == "com.sun.star.comp.ole.OleConverter2")
{
xFactory= createSingleFactory( static_cast< XMultiServiceFactory*>(pServiceManager),
- "com.sun.star.comp.ole.OleConverter2",
+ aImplName,
ConverterProvider_CreateInstance2, seqServiceNames );
}
- else if (pServiceManager && aImplName.equals( reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleConverterVar1") ))
+ else if (pServiceManager && aImplName == "com.sun.star.comp.ole.OleConverterVar1")
{
xFactory= createSingleFactory( static_cast<XMultiServiceFactory*>(pServiceManager),
- "com.sun.star.comp.ole.OleConverterVar1",
+ aImplName,
ConverterProvider_CreateInstanceVar1, seqServiceNames );
}
- else if(pServiceManager && aImplName.equals(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleClient")))
+ else if(pServiceManager && aImplName == "com.sun.star.comp.ole.OleClient")
{
xFactory= createSingleFactory( static_cast< XMultiServiceFactory*>(pServiceManager),
- "com.sun.star.comp.ole.OleClient",
+ aImplName,
OleClient_CreateInstance, seqServiceNames );
}
- else if(pServiceManager && aImplName.equals(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleServer")))
+ else if(pServiceManager && aImplName == "com.sun.star.comp.ole.OleServer")
{
xFactory= createOneInstanceFactory( static_cast< XMultiServiceFactory*>(pServiceManager),
- "com.sun.star.comp.ole.OleServer",
+ aImplName,
OleServer_CreateInstance, seqServiceNames );
}
diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx
index 194bdf6942ff..56ab58a1e9e8 100644
--- a/extensions/source/ole/unoconversionutilities.hxx
+++ b/extensions/source/ole/unoconversionutilities.hxx
@@ -42,13 +42,13 @@ typedef unsigned char BYTE;
#define INTERFACE_OLE_WRAPPER_IMPL 1
#define UNO_OBJECT_WRAPPER_REMOTE_OPT 2
-#define INVOCATION_SERVICE reinterpret_cast<const sal_Unicode*>(L"com.sun.star.script.Invocation")
+#define INVOCATION_SERVICE "com.sun.star.script.Invocation"
// classes for wrapping ole objects
#define IUNKNOWN_WRAPPER_IMPL 1
-#define INTERFACE_ADAPTER_FACTORY reinterpret_cast<const sal_Unicode*>(L"com.sun.star.script.InvocationAdapterFactory")
+#define INTERFACE_ADAPTER_FACTORY "com.sun.star.script.InvocationAdapterFactory"
// COM or JScript objects implementing UNO interfaces have to implement this property
#define SUPPORTED_INTERFACES_PROP L"_implementedInterfaces"
// Second property without leading underscore for use in VB
@@ -812,7 +812,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny)
if (rAny >>= value)
{
pVariant->vt = VT_BSTR;
- pVariant->bstrVal = SysAllocString(reinterpret_cast<LPCOLESTR>(value.getStr()));
+ pVariant->bstrVal = SysAllocString(SAL_W(value.getStr()));
}
else
{
@@ -1507,7 +1507,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny
}
case VT_BSTR:
{
- OUString b(reinterpret_cast<const sal_Unicode*>(var.bstrVal));
+ OUString b(SAL_U(var.bstrVal));
rAny.setValue( &b, cppu::UnoType<decltype(b)>::get());
break;
}
@@ -1528,7 +1528,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny
{
throw CannotConvertException(
"[automation bridge]UnoConversionUtilities<T>::variantToAny \n"
- "A UNO type with the name: " + OUString(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(sName))) +
+ "A UNO type with the name: " + OUString(SAL_U(LPCOLESTR(sName))) +
"does not exist!",
nullptr, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0);
}
@@ -1993,8 +1993,7 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva
for( sal_Int32 i= 0; i< length; i++)
{
OUString ousIndex=OUString::number( i);
- OLECHAR* sindex = reinterpret_cast<wchar_t *>(
- const_cast<sal_Unicode *>(ousIndex.getStr()));
+ OLECHAR* sindex = const_cast<OLECHAR *>(SAL_W(ousIndex.getStr()));
if( FAILED( hr= pdispEx->GetIDsOfNames(IID_NULL, &sindex , 1, LOCALE_USER_DEFAULT, &dispid)))
{
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index bd8f386a5b50..cb2634ac6a87 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -84,7 +84,7 @@ static void writeExcepinfo(EXCEPINFO * pInfo, const OUString& message)
{
pInfo->wCode = UNO_2_OLE_EXCEPTIONCODE;
pInfo->bstrSource = SysAllocString(L"[automation bridge] ");
- pInfo->bstrDescription = SysAllocString(reinterpret_cast<LPCOLESTR>(message.getStr()));
+ pInfo->bstrDescription = SysAllocString(SAL_W(message.getStr()));
}
}
@@ -219,7 +219,7 @@ STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/,
if (m_xInvocation.is() && (cNames > 0))
{
- OUString name(reinterpret_cast<const sal_Unicode*>(rgszNames[0]));
+ OUString name(SAL_U(rgszNames[0]));
NameToIdMap::iterator iter = m_nameToDispIdMap.find(name);
if (iter == m_nameToDispIdMap.end())
@@ -538,7 +538,7 @@ bool getType( const BSTR name, Type & type)
{
bool ret = false;
typelib_TypeDescription * pDesc= nullptr;
- OUString str( reinterpret_cast<const sal_Unicode*>(name));
+ OUString str(SAL_U(name));
typelib_typedescription_getByName( &pDesc, str.pData );
if( pDesc)
{
@@ -1023,7 +1023,7 @@ HRESULT InterfaceOleWrapper_Impl::doSetProperty( DISPPARAMS * /*pdispparams*/, V
pexcepinfo->wCode = UNO_2_OLE_EXCEPTIONCODE;
pexcepinfo->bstrSource = SysAllocString(L"any ONE component");
pexcepinfo->bstrDescription = SysAllocString(
- reinterpret_cast<LPCOLESTR>(org.getValueType().getTypeName().getStr()));
+ SAL_W(org.getValueType().getTypeName().getStr()));
}
ret = DISP_E_EXCEPTION;
}
@@ -1085,7 +1085,7 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s
CComVariant arg;
if( pdispparams->cArgs == 1 && SUCCEEDED( arg.ChangeType( VT_BSTR, &pdispparams->rgvarg[0])) )
{
- Reference<XIdlClass> classStruct= xRefl->forName( reinterpret_cast<const sal_Unicode*>(arg.bstrVal));
+ Reference<XIdlClass> classStruct= xRefl->forName(SAL_U(arg.bstrVal));
if( classStruct.is())
{
Any anyStruct;
@@ -1118,9 +1118,8 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s
Type type;
if (!getType(arg.bstrVal, type))
{
- writeExcepinfo(pexcepinfo,OUString(
- "[automation bridge] A UNO type with the name " +
- OUString(reinterpret_cast<const sal_Unicode*>(arg.bstrVal)) + " does not exist!"));
+ writeExcepinfo(pexcepinfo, "[automation bridge] A UNO type with the name " +
+ OUString(SAL_U(arg.bstrVal)) + " does not exist!");
return DISP_E_EXCEPTION;
}
@@ -1256,7 +1255,7 @@ STDMETHODIMP UnoObjectWrapperRemoteOpt::GetIDsOfNames ( REFIID /*riid*/, OLECHA
if (m_xInvocation.is() && (cNames > 0))
{
- OUString name(reinterpret_cast<const sal_Unicode*>(rgszNames[0]));
+ OUString name(SAL_U(rgszNames[0]));
// has this name been determined as "bad"
BadNameMap::iterator badIter= m_badNameMap.find( name);
if( badIter == m_badNameMap.end() )
diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx
index 5befb380f243..81d94c0c1f63 100644
--- a/extensions/source/update/check/updatecheckconfig.cxx
+++ b/extensions/source/update/check/updatecheckconfig.cxx
@@ -169,7 +169,7 @@ OUString UpdateCheckConfig::getDownloadsDirectory()
if (SHGetKnownFolderPath(FOLDERID_Downloads, 0, nullptr, &szPath) == S_OK)
{
- aRet = OUString( reinterpret_cast< sal_Unicode * >(szPath) );
+ aRet = SAL_U(szPath);
CoTaskMemFree(szPath);
osl::FileBase::getFileURLFromSystemPath( aRet, aRet );
}
@@ -197,7 +197,7 @@ OUString UpdateCheckConfig::getAllUsersDirectory()
if (TRUE == SHGetSpecialFolderPathW(nullptr, szPath, CSIDL_COMMON_DOCUMENTS, true))
{
- aRet = OUString( reinterpret_cast< sal_Unicode * >(szPath) );
+ aRet = SAL_U(szPath);
osl::FileBase::getFileURLFromSystemPath( aRet, aRet );
}
#else