diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-06-08 16:28:10 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-06-08 16:28:10 +0200 |
commit | 6bf5ebc0019a605d4add8185b8bc4180c4e20088 (patch) | |
tree | 9f3693b5a8aebeae8439c25d29d7cf4297693f0a /stoc | |
parent | eac0f3023c920325a4c58bcf6d5d57041128c06e (diff) |
loplugin:cstylecast: deal with remaining pointer casts
Change-Id: Iaf1585c0413d07ce4f8712570d9195d6a21fa174
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/corereflection/base.hxx | 2 | ||||
-rw-r--r-- | stoc/source/corereflection/crarray.cxx | 16 | ||||
-rw-r--r-- | stoc/source/corereflection/crcomp.cxx | 10 | ||||
-rw-r--r-- | stoc/source/corereflection/crefl.cxx | 10 | ||||
-rw-r--r-- | stoc/source/corereflection/crenum.cxx | 4 | ||||
-rw-r--r-- | stoc/source/corereflection/criface.cxx | 8 | ||||
-rw-r--r-- | stoc/source/defaultregistry/defaultregistry.cxx | 12 | ||||
-rw-r--r-- | stoc/source/inspect/introspection.cxx | 2 | ||||
-rw-r--r-- | stoc/source/invocation/invocation.cxx | 4 | ||||
-rw-r--r-- | stoc/source/invocation_adapterfactory/iafactory.cxx | 2 | ||||
-rw-r--r-- | stoc/source/security/access_controller.cxx | 18 | ||||
-rw-r--r-- | stoc/source/security/file_policy.cxx | 2 | ||||
-rw-r--r-- | stoc/source/servicemanager/servicemanager.cxx | 8 |
13 files changed, 49 insertions, 49 deletions
diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx index 68462778e2b0..ea1b8527ad80 100644 --- a/stoc/source/corereflection/base.hxx +++ b/stoc/source/corereflection/base.hxx @@ -416,7 +416,7 @@ inline bool coerce_assign( { return uno_assignData( pDest, pTD, - (void *)&rSource, pTD, + const_cast<css::uno::Any *>(&rSource), pTD, reinterpret_cast< uno_QueryInterfaceFunc >(css::uno::cpp_queryInterface), reinterpret_cast< uno_AcquireFunc >(css::uno::cpp_acquire), reinterpret_cast< uno_ReleaseFunc >(css::uno::cpp_release) ); diff --git a/stoc/source/corereflection/crarray.cxx b/stoc/source/corereflection/crarray.cxx index 0d6fa9c29f89..7d70747670f6 100644 --- a/stoc/source/corereflection/crarray.cxx +++ b/stoc/source/corereflection/crarray.cxx @@ -85,13 +85,13 @@ void ArrayIdlClassImpl::realloc( Any & rArray, sal_Int32 nLen ) { throw IllegalArgumentException( "no sequence given!", - (XWeak *)(OWeakObject *)this, 0 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 ); } if (nLen < 0) { throw IllegalArgumentException( "illegal length given!", - (XWeak *)(OWeakObject *)this, 1 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 1 ); } uno_Sequence ** ppSeq = const_cast<uno_Sequence **>(static_cast<uno_Sequence * const *>(rArray.getValue())); @@ -110,7 +110,7 @@ sal_Int32 ArrayIdlClassImpl::getLen( const Any & rArray ) { throw IllegalArgumentException( "no sequence given!", - (XWeak *)(OWeakObject *)this, 0 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 ); } return (*static_cast<uno_Sequence * const *>(rArray.getValue()))->nElements; @@ -124,7 +124,7 @@ Any ArrayIdlClassImpl::get( const Any & rArray, sal_Int32 nIndex ) { throw IllegalArgumentException( "no sequence given!", - (XWeak *)(OWeakObject *)this, 0 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 ); } uno_Sequence * pSeq = *static_cast<uno_Sequence * const *>(rArray.getValue()); @@ -132,7 +132,7 @@ Any ArrayIdlClassImpl::get( const Any & rArray, sal_Int32 nIndex ) { throw ArrayIndexOutOfBoundsException( "illegal index given!", - (XWeak *)(OWeakObject *)this ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)) ); } Any aRet; @@ -155,7 +155,7 @@ void ArrayIdlClassImpl::set( Any & rArray, sal_Int32 nIndex, const Any & rNewVal { throw IllegalArgumentException( "no sequence given!", - (XWeak *)(OWeakObject *)this, 0 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 ); } uno_Sequence * pSeq = *static_cast<uno_Sequence * const *>(rArray.getValue()); @@ -163,7 +163,7 @@ void ArrayIdlClassImpl::set( Any & rArray, sal_Int32 nIndex, const Any & rNewVal { throw ArrayIndexOutOfBoundsException( "illegal index given!", - (XWeak *)(OWeakObject *)this ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)) ); } uno_Sequence ** ppSeq = const_cast<uno_Sequence **>(static_cast<uno_Sequence * const *>(rArray.getValue())); @@ -183,7 +183,7 @@ void ArrayIdlClassImpl::set( Any & rArray, sal_Int32 nIndex, const Any & rNewVal TYPELIB_DANGER_RELEASE( pElemTypeDescr ); throw IllegalArgumentException( "sequence element is not assignable by given value!", - (XWeak *)(OWeakObject *)this, 2 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 2 ); } TYPELIB_DANGER_RELEASE( pElemTypeDescr ); } diff --git a/stoc/source/corereflection/crcomp.cxx b/stoc/source/corereflection/crcomp.cxx index a49a69670e49..c085bd29bff4 100644 --- a/stoc/source/corereflection/crcomp.cxx +++ b/stoc/source/corereflection/crcomp.cxx @@ -198,7 +198,7 @@ Any IdlCompFieldImpl::get( const Any & rObj ) } throw IllegalArgumentException( "illegal object given!", - (XWeak *)(OWeakObject *)this, 0 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 ); } void IdlCompFieldImpl::set( const Any & rObj, const Any & rValue ) @@ -227,14 +227,14 @@ void IdlCompFieldImpl::set( const Any & rObj, const Any & rValue ) { throw IllegalArgumentException( "illegal value given!", - (XWeak *)(OWeakObject *)this, 1 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 1 ); } } TYPELIB_DANGER_RELEASE( pObjTD ); } throw IllegalArgumentException( "illegal object given!", - (XWeak *)(OWeakObject *)this, 0 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 ); } @@ -264,14 +264,14 @@ void IdlCompFieldImpl::set( Any & rObj, const Any & rValue ) { throw IllegalArgumentException( "illegal value given!", - (XWeak *)(OWeakObject *)this, 1 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 1 ); } } TYPELIB_DANGER_RELEASE( pObjTD ); } throw IllegalArgumentException( "illegal object given!", - (XWeak *)(OWeakObject *)this, 0 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 ); } diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx index 8710cf96a8aa..83707ead3ed6 100644 --- a/stoc/source/corereflection/crefl.cxx +++ b/stoc/source/corereflection/crefl.cxx @@ -353,7 +353,7 @@ Reference< XIdlClass > IdlReflectionServiceImpl::forType( typelib_TypeDescriptio } throw RuntimeException( "IdlReflectionServiceImpl::forType() failed!", - (XWeak *)(OWeakObject *)this ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)) ); } @@ -373,7 +373,7 @@ const Mapping & IdlReflectionServiceImpl::getCpp2Uno() { throw RuntimeException( "cannot get c++ to uno mapping!", - (XWeak *)(OWeakObject *)this ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)) ); } } } @@ -396,7 +396,7 @@ const Mapping & IdlReflectionServiceImpl::getUno2Cpp() { throw RuntimeException( "cannot get uno to c++ mapping!", - (XWeak *)(OWeakObject *)this ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)) ); } } } @@ -413,7 +413,7 @@ uno_Interface * IdlReflectionServiceImpl::mapToUno( throw RuntimeException( "illegal object given!", - (XWeak *)(OWeakObject *)this ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)) ); } @@ -421,7 +421,7 @@ Reference< XInterface > SAL_CALL IdlReflectionServiceImpl_create( const Reference< XComponentContext > & xContext ) throw(css::uno::Exception) { - return Reference< XInterface >( (XWeak *)(OWeakObject *)new IdlReflectionServiceImpl( xContext ) ); + return Reference< XInterface >( static_cast<XWeak *>(static_cast<OWeakObject *>(new IdlReflectionServiceImpl( xContext ))) ); } } diff --git a/stoc/source/corereflection/crenum.cxx b/stoc/source/corereflection/crenum.cxx index 8cd09763aeb9..6910ab31b798 100644 --- a/stoc/source/corereflection/crenum.cxx +++ b/stoc/source/corereflection/crenum.cxx @@ -156,7 +156,7 @@ void IdlEnumFieldImpl::set( const Any &, const Any & ) { throw IllegalAccessException( "enum field is constant!", - (XWeak *)(OWeakObject *)this ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)) ); } void IdlEnumFieldImpl::set( Any &, const Any & ) @@ -164,7 +164,7 @@ void IdlEnumFieldImpl::set( Any &, const Any & ) { throw IllegalAccessException( "enum field is constant!", - (XWeak *)(OWeakObject *)this ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)) ); } diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx index 98aaf0ada281..e8b6a1986bc7 100644 --- a/stoc/source/corereflection/criface.cxx +++ b/stoc/source/corereflection/criface.cxx @@ -201,7 +201,7 @@ Any IdlAttributeFieldImpl::get( const Any & rObj ) } throw IllegalArgumentException( "illegal object given!", - (XWeak *)(OWeakObject *)this, 0 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 ); } void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue ) @@ -211,7 +211,7 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue ) { throw IllegalAccessException( "cannot set readonly attribute!", - (XWeak *)(OWeakObject *)this ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)) ); } uno_Interface * pUnoI = getReflection()->mapToUno( @@ -291,7 +291,7 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue ) } throw IllegalArgumentException( "illegal destination object given!", - (XWeak *)(OWeakObject *)this, 0 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 ); } void IdlAttributeFieldImpl::set( const Any & rObj, const Any & rValue ) @@ -759,7 +759,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & } throw IllegalArgumentException( "illegal destination object given!", - (XWeak *)(OWeakObject *)this, 0 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 ); } diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx index 477a76ccb7d9..9f7acea2a5a4 100644 --- a/stoc/source/defaultregistry/defaultregistry.cxx +++ b/stoc/source/defaultregistry/defaultregistry.cxx @@ -679,7 +679,7 @@ Reference< XRegistryKey > SAL_CALL NestedKeyImpl::openKey( const OUString& aKeyN if ( localKey.is() || defaultKey.is() ) { - return ((XRegistryKey*)new NestedKeyImpl(m_pRegistry, localKey, defaultKey)); + return static_cast<XRegistryKey*>(new NestedKeyImpl(m_pRegistry, localKey, defaultKey)); } else { @@ -717,7 +717,7 @@ Reference< XRegistryKey > SAL_CALL NestedKeyImpl::createKey( const OUString& aKe m_state = m_pRegistry->m_state++; - return ((XRegistryKey*)new NestedKeyImpl(m_pRegistry, localKey, defaultKey)); + return (static_cast<XRegistryKey*>(new NestedKeyImpl(m_pRegistry, localKey, defaultKey))); } } else @@ -737,7 +737,7 @@ Reference< XRegistryKey > SAL_CALL NestedKeyImpl::createKey( const OUString& aKe m_state = m_pRegistry->m_state++; - return ((XRegistryKey*)new NestedKeyImpl(m_pRegistry, localKey, defaultKey)); + return (static_cast<XRegistryKey*>(new NestedKeyImpl(m_pRegistry, localKey, defaultKey))); } } } @@ -831,7 +831,7 @@ Sequence< Reference< XRegistryKey > > SAL_CALL NestedKeyImpl::openKeys( ) lastIndex = name.lastIndexOf('/'); name = name.copy(lastIndex); retSeq.getArray()[i] = - (XRegistryKey*)new NestedKeyImpl(name, this); + static_cast<XRegistryKey*>(new NestedKeyImpl(name, this)); } sal_uInt32 k = local; @@ -855,7 +855,7 @@ Sequence< Reference< XRegistryKey > > SAL_CALL NestedKeyImpl::openKeys( ) lastIndex = name.lastIndexOf('/'); name = name.copy(lastIndex); retSeq.getArray()[k++] = - (XRegistryKey*)new NestedKeyImpl(name, this); + static_cast<XRegistryKey*>(new NestedKeyImpl(name, this)); } } @@ -1302,7 +1302,7 @@ Reference< XRegistryKey > SAL_CALL NestedRegistryImpl::getRootKey( ) defaultKey = m_defaultReg->getRootKey(); } - return ((XRegistryKey*)new NestedKeyImpl(this, localKey, defaultKey)); + return (static_cast<XRegistryKey*>(new NestedKeyImpl(this, localKey, defaultKey))); } } else diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 49635c149a49..116b8ed535eb 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -921,7 +921,7 @@ Any SAL_CALL ImplIntrospectionAdapter::queryInterface( const Type& rType ) Reference<XPropertySetInfo> ImplIntrospectionAdapter::getPropertySetInfo() throw( RuntimeException, std::exception ) { - return (XPropertySetInfo *)this; + return static_cast<XPropertySetInfo *>(this); } void ImplIntrospectionAdapter::setPropertyValue(const OUString& aPropertyName, const Any& aValue) diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx index da5ff896e63a..a97c8046995e 100644 --- a/stoc/source/invocation/invocation.cxx +++ b/stoc/source/invocation/invocation.cxx @@ -621,7 +621,7 @@ Any Invocation_Impl::invoke( const OUString& FunctionName, const Sequence<Any>& { throw IllegalArgumentException( "incorrect number of parameters passed invoking function " + FunctionName, - (OWeakObject *) this, (sal_Int16) 1 ); + static_cast<OWeakObject *>(this), (sal_Int16) 1 ); } // IN Parameter @@ -905,7 +905,7 @@ InvocationInfo SAL_CALL Invocation_Impl::getInfoForName( const OUString& aName, { throw IllegalArgumentException( OUString( "Unknown name, getExactName() failed!" ), - (XWeak *)(OWeakObject *)this, 0 ); + static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 ); } return aRetInfo; } diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx index 2894fb2c3df7..dca1c9778919 100644 --- a/stoc/source/invocation_adapterfactory/iafactory.cxx +++ b/stoc/source/invocation_adapterfactory/iafactory.cxx @@ -896,7 +896,7 @@ static Reference< XInterface > SAL_CALL FactoryImpl_create( const Reference< XComponentContext > & xContext ) throw (Exception) { - return (::cppu::OWeakObject *)new FactoryImpl( xContext ); + return static_cast<cppu::OWeakObject *>(new FactoryImpl( xContext )); } } diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx index 82767f1b57ae..c59153ff6ee9 100644 --- a/stoc/source/security/access_controller.cxx +++ b/stoc/source/security/access_controller.cxx @@ -411,7 +411,7 @@ AccessController::AccessController( Reference< XComponentContext > const & xComp throw RuntimeException( "expected a user id in component context entry " "\"/services/" SERVICE_NAME "/single-user-id\"!", - (OWeakObject *)this ); + static_cast<OWeakObject *>(this) ); } m_mode = SINGLE_USER; } @@ -458,14 +458,14 @@ void AccessController::initialize( if (SINGLE_USER != m_mode) // only if in single-user mode { throw RuntimeException( - "invalid call: ac must be in \"single-user\" mode!", (OWeakObject *)this ); + "invalid call: ac must be in \"single-user\" mode!", static_cast<OWeakObject *>(this) ); } OUString userId; arguments[ 0 ] >>= userId; if ( userId.isEmpty() ) { throw RuntimeException( - "expected a user-id as first argument!", (OWeakObject *)this ); + "expected a user-id as first argument!", static_cast<OWeakObject *>(this) ); } // assured that no sync is necessary: no check happens at this forking time m_singleUserId = userId; @@ -492,7 +492,7 @@ Reference< security::XPolicy > const & AccessController::getPolicy() else { throw SecurityException( - "cannot get policy singleton!", (OWeakObject *)this ); + "cannot get policy singleton!", static_cast<OWeakObject *>(this) ); } } return m_xPolicy; @@ -629,7 +629,7 @@ PermissionCollection AccessController::getEffectivePermissions( if ( userId.isEmpty() ) { throw SecurityException( - "cannot determine current user in multi-user ac!", (OWeakObject *)this ); + "cannot determine current user in multi-user ac!", static_cast<OWeakObject *>(this) ); } // lookup policy for user @@ -784,7 +784,7 @@ void AccessController::checkPermission( if (rBHelper.bDisposed) { throw lang::DisposedException( - "checkPermission() call on disposed AccessController!", (OWeakObject *)this ); + "checkPermission() call on disposed AccessController!", static_cast<OWeakObject *>(this) ); } if (OFF == m_mode) @@ -814,7 +814,7 @@ Any AccessController::doRestricted( if (rBHelper.bDisposed) { throw lang::DisposedException( - "doRestricted() call on disposed AccessController!", (OWeakObject *)this ); + "doRestricted() call on disposed AccessController!", static_cast<OWeakObject *>(this) ); } if (OFF == m_mode) // optimize this way, because no dynamic check will be performed @@ -847,7 +847,7 @@ Any AccessController::doPrivileged( if (rBHelper.bDisposed) { throw lang::DisposedException( - "doPrivileged() call on disposed AccessController!", (OWeakObject *)this ); + "doPrivileged() call on disposed AccessController!", static_cast<OWeakObject *>(this) ); } if (OFF == m_mode) // no dynamic check will be performed @@ -882,7 +882,7 @@ Reference< security::XAccessControlContext > AccessController::getContext() if (rBHelper.bDisposed) { throw lang::DisposedException( - "getContext() call on disposed AccessController!", (OWeakObject *)this ); + "getContext() call on disposed AccessController!", static_cast<OWeakObject *>(this) ); } if (OFF == m_mode) // optimize this way, because no dynamic check will be performed diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index 68d87dd31641..3dc06e8515f0 100644 --- a/stoc/source/security/file_policy.cxx +++ b/stoc/source/security/file_policy.cxx @@ -402,7 +402,7 @@ void FilePolicy::refresh() { throw RuntimeException( "name of policy file unknown!", - (OWeakObject *)this ); + static_cast<OWeakObject *>(this) ); } PolicyReader reader( fileName, m_ac ); diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index 733bdb9a92f3..b84dd9d2a32a 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -481,7 +481,7 @@ inline void OServiceManager::check_undisposed() const { throw lang::DisposedException( "service manager instance has already been disposed!", - (OWeakObject *)this ); + static_cast<OWeakObject *>(const_cast<OServiceManager *>(this)) ); } } @@ -609,7 +609,7 @@ void SAL_CALL OServiceManagerWrapper::setPropertyValue( { throw IllegalArgumentException( "no XComponentContext given!", - (OWeakObject *)this, 1 ); + static_cast<OWeakObject *>(this), 1 ); } } else @@ -771,14 +771,14 @@ void OServiceManager::setPropertyValue( { throw IllegalArgumentException( "no XComponentContext given!", - (OWeakObject *)this, 1 ); + static_cast<OWeakObject *>(this), 1 ); } } else { throw UnknownPropertyException( "unknown property " + PropertyName, - (OWeakObject *)this ); + static_cast<OWeakObject *>(this) ); } } |