Kaydet (Commit) b3105952 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Reduce to static_cast any reinterpret_cast from void pointers

Change-Id: Ib3610f9d244b15f8f752c0f781600f5c7e7a944f
üst c96f4e56
...@@ -387,7 +387,7 @@ inline bool extract( ...@@ -387,7 +387,7 @@ inline bool extract(
} }
else if (rObj.getValueTypeClass() == css::uno::TypeClass_TYPE) else if (rObj.getValueTypeClass() == css::uno::TypeClass_TYPE)
{ {
rDest = pRefl->forType( reinterpret_cast< const css::uno::Type * >( rObj.getValue() )->getTypeLibType() ); rDest = pRefl->forType( static_cast< const css::uno::Type * >( rObj.getValue() )->getTypeLibType() );
return rDest.is(); return rDest.is();
} }
} }
......
...@@ -275,7 +275,7 @@ bool AdapterImpl::coerce_assign( ...@@ -275,7 +275,7 @@ bool AdapterImpl::coerce_assign(
// set runtime exception // set runtime exception
constructRuntimeException( constructRuntimeException(
pOutExc, "type coercion failed: " + pOutExc, "type coercion failed: " +
reinterpret_cast< Exception const * >( static_cast< Exception const * >(
p_exc->pData )->Message ); p_exc->pData )->Message );
} }
::uno_any_destruct( p_exc, 0 ); ::uno_any_destruct( p_exc, 0 );
...@@ -330,7 +330,7 @@ static void handleInvokExc( uno_Any * pDest, uno_Any * pSource ) ...@@ -330,7 +330,7 @@ static void handleInvokExc( uno_Any * pDest, uno_Any * pSource )
{ {
// unwrap invocation target exception // unwrap invocation target exception
uno_Any * target_exc = uno_Any * target_exc =
&reinterpret_cast< reflection::InvocationTargetException * >( &static_cast< reflection::InvocationTargetException * >(
pSource->pData )->TargetException; pSource->pData )->TargetException;
::uno_type_any_construct( ::uno_type_any_construct(
pDest, target_exc->pData, target_exc->pType, 0 ); pDest, target_exc->pData, target_exc->pType, 0 );
...@@ -773,7 +773,7 @@ static inline AdapterImpl * lookup_adapter( ...@@ -773,7 +773,7 @@ static inline AdapterImpl * lookup_adapter(
t_ptr_set::const_iterator const iEnd( adapters_set.end() ); t_ptr_set::const_iterator const iEnd( adapters_set.end() );
while (iEnd != iPos) while (iEnd != iPos)
{ {
AdapterImpl * that = reinterpret_cast< AdapterImpl * >( *iPos ); AdapterImpl * that = static_cast< AdapterImpl * >( *iPos );
// iterate through all types if that is a matching adapter // iterate through all types if that is a matching adapter
sal_Int32 nPosTypes; sal_Int32 nPosTypes;
for ( nPosTypes = nTypes; nPosTypes--; ) for ( nPosTypes = nTypes; nPosTypes--; )
......
...@@ -247,7 +247,7 @@ const css::uno::Reference<XImplementationLoader> & JavaComponentLoader::getJavaL ...@@ -247,7 +247,7 @@ const css::uno::Reference<XImplementationLoader> & JavaComponentLoader::getJavaL
throw RuntimeException( throw RuntimeException(
"javaloader error - no type information for XImplementationLoader"); "javaloader error - no type information for XImplementationLoader");
m_javaLoader = css::uno::Reference<XImplementationLoader>(reinterpret_cast<XImplementationLoader *>( m_javaLoader = css::uno::Reference<XImplementationLoader>(static_cast<XImplementationLoader *>(
java_curr.mapInterface(joJavaLoader, pType_XImplementationLoader))); java_curr.mapInterface(joJavaLoader, pType_XImplementationLoader)));
pJNIEnv->DeleteLocalRef( joJavaLoader ); pJNIEnv->DeleteLocalRef( joJavaLoader );
if(!m_javaLoader.is()) if(!m_javaLoader.is())
......
...@@ -134,7 +134,7 @@ UnoInterfaceReference FactoryImpl::binuno_queryInterface( ...@@ -134,7 +134,7 @@ UnoInterfaceReference FactoryImpl::binuno_queryInterface(
UnoInterfaceReference ret; UnoInterfaceReference ret;
if (ret_val.pType->eTypeClass == typelib_TypeClass_INTERFACE) if (ret_val.pType->eTypeClass == typelib_TypeClass_INTERFACE)
{ {
ret.set( *reinterpret_cast< uno_Interface ** >(ret_val.pData), ret.set( *static_cast< uno_Interface ** >(ret_val.pData),
SAL_NO_ACQUIRE ); SAL_NO_ACQUIRE );
typelib_typedescriptionreference_release( ret_val.pType ); typelib_typedescriptionreference_release( ret_val.pType );
} }
...@@ -203,7 +203,7 @@ static void SAL_CALL binuno_proxy_free( ...@@ -203,7 +203,7 @@ static void SAL_CALL binuno_proxy_free(
{ {
(void) pEnv; // avoid warning about unused parameter (void) pEnv; // avoid warning about unused parameter
binuno_Proxy * proxy = static_cast< binuno_Proxy * >( binuno_Proxy * proxy = static_cast< binuno_Proxy * >(
reinterpret_cast< uno_Interface * >( pProxy ) ); static_cast< uno_Interface * >( pProxy ) );
OSL_ASSERT( proxy->m_root->m_factory->m_uno_env.get()->pExtEnv == pEnv ); OSL_ASSERT( proxy->m_root->m_factory->m_uno_env.get()->pExtEnv == pEnv );
delete proxy; delete proxy;
} }
...@@ -254,7 +254,7 @@ static void SAL_CALL binuno_proxy_dispatch( ...@@ -254,7 +254,7 @@ static void SAL_CALL binuno_proxy_dispatch(
try try
{ {
Type const & rType = Type const & rType =
*reinterpret_cast< Type const * >( pArgs[ 0 ] ); *static_cast< Type const * >( pArgs[ 0 ] );
Any ret( that->m_root->queryInterface( rType ) ); Any ret( that->m_root->queryInterface( rType ) );
uno_type_copyAndConvertData( uno_type_copyAndConvertData(
pReturn, &ret, ::getCppuType( &ret ).getTypeLibType(), pReturn, &ret, ::getCppuType( &ret ).getTypeLibType(),
......
...@@ -276,12 +276,12 @@ static inline Reference< security::XAccessControlContext > getDynamicRestriction ...@@ -276,12 +276,12 @@ static inline Reference< security::XAccessControlContext > getDynamicRestriction
if ( typeName == "com.sun.star.security.XAccessControlContext" ) if ( typeName == "com.sun.star.security.XAccessControlContext" )
{ {
return Reference< security::XAccessControlContext >( return Reference< security::XAccessControlContext >(
*reinterpret_cast< security::XAccessControlContext ** const >( acc.pData ) ); *static_cast< security::XAccessControlContext ** const >( acc.pData ) );
} }
else // try to query else // try to query
{ {
return Reference< security::XAccessControlContext >::query( return Reference< security::XAccessControlContext >::query(
*reinterpret_cast< XInterface ** const >( acc.pData ) ); *static_cast< XInterface ** const >( acc.pData ) );
} }
} }
} }
...@@ -530,14 +530,14 @@ static void dumpPermissions( ...@@ -530,14 +530,14 @@ static void dumpPermissions(
inline void AccessController::clearPostPoned() inline void AccessController::clearPostPoned()
{ {
delete reinterpret_cast< t_rec_vec * >( m_rec.getData() ); delete static_cast< t_rec_vec * >( m_rec.getData() );
m_rec.setData( 0 ); m_rec.setData( 0 );
} }
void AccessController::checkAndClearPostPoned() void AccessController::checkAndClearPostPoned()
{ {
// check postponed permissions // check postponed permissions
boost::scoped_ptr< t_rec_vec > rec( reinterpret_cast< t_rec_vec * >( m_rec.getData() ) ); boost::scoped_ptr< t_rec_vec > rec( static_cast< t_rec_vec * >( m_rec.getData() ) );
m_rec.setData( 0 ); // takeover ownership m_rec.setData( 0 ); // takeover ownership
OSL_ASSERT( rec.get() ); OSL_ASSERT( rec.get() );
if (rec.get()) if (rec.get())
...@@ -646,7 +646,7 @@ PermissionCollection AccessController::getEffectivePermissions( ...@@ -646,7 +646,7 @@ PermissionCollection AccessController::getEffectivePermissions(
// call on policy // call on policy
// iff this is a recurring call for the default user, then grant all permissions // iff this is a recurring call for the default user, then grant all permissions
t_rec_vec * rec = reinterpret_cast< t_rec_vec * >( m_rec.getData() ); t_rec_vec * rec = static_cast< t_rec_vec * >( m_rec.getData() );
if (rec) // tls entry exists => this is recursive call if (rec) // tls entry exists => this is recursive call
{ {
if (demanded_perm.hasValue()) if (demanded_perm.hasValue())
...@@ -756,7 +756,7 @@ PermissionCollection AccessController::getEffectivePermissions( ...@@ -756,7 +756,7 @@ PermissionCollection AccessController::getEffectivePermissions(
{ {
// dont check postponed, just cleanup // dont check postponed, just cleanup
clearPostPoned(); clearPostPoned();
delete reinterpret_cast< t_rec_vec * >( m_rec.getData() ); delete static_cast< t_rec_vec * >( m_rec.getData() );
m_rec.setData( 0 ); m_rec.setData( 0 );
throw; throw;
} }
......
...@@ -493,17 +493,17 @@ PermissionCollection::PermissionCollection( ...@@ -493,17 +493,17 @@ PermissionCollection::PermissionCollection(
if (perm_type.equals( cppu::UnoType<io::FilePermission>::get())) if (perm_type.equals( cppu::UnoType<io::FilePermission>::get()))
{ {
m_head = new FilePermission( m_head = new FilePermission(
*reinterpret_cast< io::FilePermission const * >( perm.pData ), m_head ); *static_cast< io::FilePermission const * >( perm.pData ), m_head );
} }
else if (perm_type.equals( cppu::UnoType<connection::SocketPermission>::get())) else if (perm_type.equals( cppu::UnoType<connection::SocketPermission>::get()))
{ {
m_head = new SocketPermission( m_head = new SocketPermission(
*reinterpret_cast< connection::SocketPermission const * >( perm.pData ), m_head ); *static_cast< connection::SocketPermission const * >( perm.pData ), m_head );
} }
else if (perm_type.equals( cppu::UnoType<security::RuntimePermission>::get())) else if (perm_type.equals( cppu::UnoType<security::RuntimePermission>::get()))
{ {
m_head = new RuntimePermission( m_head = new RuntimePermission(
*reinterpret_cast< security::RuntimePermission const * >( perm.pData ), m_head ); *static_cast< security::RuntimePermission const * >( perm.pData ), m_head );
} }
else if (perm_type.equals( cppu::UnoType<security::AllPermission>::get())) else if (perm_type.equals( cppu::UnoType<security::AllPermission>::get()))
{ {
...@@ -578,7 +578,7 @@ void PermissionCollection::checkPermission( Any const & perm ) const ...@@ -578,7 +578,7 @@ void PermissionCollection::checkPermission( Any const & perm ) const
if (demanded_type.equals( cppu::UnoType<io::FilePermission>::get())) if (demanded_type.equals( cppu::UnoType<io::FilePermission>::get()))
{ {
FilePermission demanded( FilePermission demanded(
*reinterpret_cast< io::FilePermission const * >( perm.pData ) ); *static_cast< io::FilePermission const * >( perm.pData ) );
if (__implies( m_head, demanded )) if (__implies( m_head, demanded ))
{ {
#ifdef __DIAGNOSE #ifdef __DIAGNOSE
...@@ -591,7 +591,7 @@ void PermissionCollection::checkPermission( Any const & perm ) const ...@@ -591,7 +591,7 @@ void PermissionCollection::checkPermission( Any const & perm ) const
else if (demanded_type.equals( cppu::UnoType<connection::SocketPermission>::get())) else if (demanded_type.equals( cppu::UnoType<connection::SocketPermission>::get()))
{ {
SocketPermission demanded( SocketPermission demanded(
*reinterpret_cast< connection::SocketPermission const * >( perm.pData ) ); *static_cast< connection::SocketPermission const * >( perm.pData ) );
if (__implies( m_head, demanded )) if (__implies( m_head, demanded ))
{ {
#ifdef __DIAGNOSE #ifdef __DIAGNOSE
...@@ -604,7 +604,7 @@ void PermissionCollection::checkPermission( Any const & perm ) const ...@@ -604,7 +604,7 @@ void PermissionCollection::checkPermission( Any const & perm ) const
else if (demanded_type.equals( cppu::UnoType<security::RuntimePermission>::get())) else if (demanded_type.equals( cppu::UnoType<security::RuntimePermission>::get()))
{ {
RuntimePermission demanded( RuntimePermission demanded(
*reinterpret_cast< security::RuntimePermission const * >( perm.pData ) ); *static_cast< security::RuntimePermission const * >( perm.pData ) );
if (__implies( m_head, demanded )) if (__implies( m_head, demanded ))
{ {
#ifdef __DIAGNOSE #ifdef __DIAGNOSE
......
...@@ -1152,7 +1152,7 @@ sal_Bool OServiceManager::has( const Any & Element ) ...@@ -1152,7 +1152,7 @@ sal_Bool OServiceManager::has( const Any & Element )
else if (Element.getValueTypeClass() == TypeClass_STRING) else if (Element.getValueTypeClass() == TypeClass_STRING)
{ {
OUString const & implName = OUString const & implName =
*reinterpret_cast< OUString const * >(Element.getValue()); *static_cast< OUString const * >(Element.getValue());
MutexGuard aGuard( m_mutex ); MutexGuard aGuard( m_mutex );
return m_ImplementationNameMap.find( implName ) != return m_ImplementationNameMap.find( implName ) !=
m_ImplementationNameMap.end(); m_ImplementationNameMap.end();
...@@ -1231,7 +1231,7 @@ void OServiceManager::remove( const Any & Element ) ...@@ -1231,7 +1231,7 @@ void OServiceManager::remove( const Any & Element )
else if (Element.getValueTypeClass() == TypeClass_STRING) else if (Element.getValueTypeClass() == TypeClass_STRING)
{ {
OUString const & implName = OUString const & implName =
*reinterpret_cast< OUString const * >(Element.getValue()); *static_cast< OUString const * >(Element.getValue());
MutexGuard aGuard( m_mutex ); MutexGuard aGuard( m_mutex );
HashMap_OWString_Interface::const_iterator const iFind( HashMap_OWString_Interface::const_iterator const iFind(
m_ImplementationNameMap.find( implName ) ); m_ImplementationNameMap.find( implName ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment