diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2014-05-22 23:19:05 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2014-05-22 23:21:18 +0200 |
commit | b09b5f8f7cfd2d7f3125dab93ebe996c160e1e0c (patch) | |
tree | dacb87512726af1941d0c6b072d0b3626335cc4c /extensions/source/ole | |
parent | 87c1aa16a95dcff9247ae12a4bb5ea2d866b1772 (diff) |
Prefer cppu::UnoType<T>::get() to ::getCppuType((T*)0) part19
Change-Id: Iab50c52a132c90389992ef68c2d31df95a193ab9
Diffstat (limited to 'extensions/source/ole')
-rw-r--r-- | extensions/source/ole/oleobjw.cxx | 6 | ||||
-rw-r--r-- | extensions/source/ole/servprov.cxx | 16 | ||||
-rw-r--r-- | extensions/source/ole/unoconversionutilities.hxx | 12 |
3 files changed, 15 insertions, 19 deletions
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index ca0c8156be96..2b0c14792b01 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -138,11 +138,11 @@ IUnknownWrapper_Impl::~IUnknownWrapper_Impl() Any IUnknownWrapper_Impl::queryInterface(const Type& t) throw (RuntimeException) { - if (t == getCppuType(static_cast<Reference<XDefaultMethod>*>( 0)) && !m_bHasDfltMethod ) + if (t == cppu::UnoType<XDefaultMethod>::get() && !m_bHasDfltMethod ) return Any(); - if (t == getCppuType(static_cast<Reference<XDefaultProperty>*>( 0)) && !m_bHasDfltProperty ) + if (t == cppu::UnoType<XDefaultProperty>::get() && !m_bHasDfltProperty ) return Any(); - if ( ( t == getCppuType(static_cast<Reference<XInvocation>*>( 0)) || t == getCppuType(static_cast<Reference<XAutomationInvocation>*>( 0)) ) && !m_spDispatch) + if ( ( t == cppu::UnoType<XInvocation>::get() || t == cppu::UnoType<XAutomationInvocation>::get() ) && !m_spDispatch) return Any(); // XDirectInvocation seems to be an oracle replacement for XAutomationInvocation, however it is flawed esecially wrt. assumptions about whether to invoke a // Put or Get property, the implementation code has no business guessing that, it's up to the caller to decide that. Worse XDirectInvocation duplicates lots of code. diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx index 77006bf6432c..221e9de00f8a 100644 --- a/extensions/source/ole/servprov.cxx +++ b/extensions/source/ole/servprov.cxx @@ -64,8 +64,7 @@ ProviderOleWrapper_Impl::ProviderOleWrapper_Impl(const Reference<XMultiServiceFa if (xInt.is()) { - Any a= xInt->queryInterface( ::getCppuType( reinterpret_cast< - Reference< XBridgeSupplier2>* >(0))); + Any a= xInt->queryInterface( cppu::UnoType<XBridgeSupplier2>::get() ); a >>= m_bridgeSupplier; } @@ -202,8 +201,7 @@ OneInstanceOleWrapper_Impl::OneInstanceOleWrapper_Impl( const Reference<XMultiS if (xInt.is()) { - Any a= xInt->queryInterface( getCppuType( - reinterpret_cast< Reference<XBridgeSupplier2>*>(0))); + Any a= xInt->queryInterface( cppu::UnoType<XBridgeSupplier2>::get() ); a >>= m_bridgeSupplier; } } @@ -481,8 +479,7 @@ OleClient_Impl::OleClient_Impl( const Reference<XMultiServiceFactory>& smgr): if (xInt.is()) { - Any a= xInt->queryInterface(getCppuType( - reinterpret_cast<Reference<XBridgeSupplier2>*>(0))); + Any a= xInt->queryInterface(cppu::UnoType<XBridgeSupplier2>::get() ); a >>= m_bridgeSupplier; } } @@ -597,8 +594,7 @@ OleServer_Impl::OleServer_Impl( const Reference<XMultiServiceFactory>& smgr): if (xInt.is()) { - Any a= xInt->queryInterface( getCppuType( - reinterpret_cast< Reference<XBridgeSupplier2>*>(0))); + Any a= xInt->queryInterface( cppu::UnoType<XBridgeSupplier2>::get() ); a >>= m_bridgeSupplier; } @@ -644,8 +640,8 @@ Sequence< Type > SAL_CALL OleServer_Impl::getTypes( ) throw(RuntimeException) if( ! pCollection ) { static OTypeCollection collection( - getCppuType(reinterpret_cast< Reference< XWeak>*>(0)), - getCppuType(reinterpret_cast< Reference< XTypeProvider>*>(0)) ); + cppu::UnoType<XWeak>::get(), + cppu::UnoType<XTypeProvider>::get() ); pCollection = &collection; } } diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index 083d50284165..2f969834d7a9 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -706,7 +706,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny) } case TypeClass_STRUCT: { - if (rAny.getValueType() == getCppuType((Date*)0)) + if (rAny.getValueType() == cppu::UnoType<Date>::get() ) { Date d; if (rAny >>= d) @@ -1572,7 +1572,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny rAny.setValue( & var.bVal, cppu::UnoType<sal_Int8>::get()); break; case VT_UI2: - rAny.setValue( & var.uiVal, getCppuType( (sal_uInt16*)0)); + rAny.setValue( & var.uiVal, cppu::UnoType<cppu::UnoUnsignedShortType>::get() ); break; case VT_UI4: rAny.setValue( & var.ulVal, cppu::UnoType<sal_uInt32>::get()); @@ -1704,10 +1704,10 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& { case VT_EMPTY: case VT_UNKNOWN: - desiredType = getCppuType((Reference<XInterface>*) 0); + desiredType = cppu::UnoType<XInterface>::get(); break; case VT_DISPATCH: - desiredType = getCppuType((Reference<XInvocation>*) 0); + desiredType = cppu::UnoType<XInvocation>::get(); break; default: desiredType = aType; @@ -1811,7 +1811,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& // If the object implements UNO interfaces then get the types. Sequence<Type> seqTypes = getImplementedInterfaces(spUnknown); if (seqTypes.getLength() == 0 && - aType != VOID_TYPE && aType != getCppuType((Reference<XInvocation>*)0)) + aType != VOID_TYPE && aType != cppu::UnoType<XInvocation>::get()) { seqTypes = Sequence<Type>( & aType, 1); } @@ -1847,7 +1847,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& // we have a wrapper object //The wrapper implements already XInvocation and XInterface. If //param aType is void then the object is supposed to have XInvocation. - if (aType == getCppuType((Reference<XInvocation>*)0) || + if (aType == cppu::UnoType<XInvocation>::get()|| (aType == VOID_TYPE && seqTypes.getLength() == 0 )) { ret = xIntNewProxy->queryInterface(desiredType); |