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(
}
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();
}
}
......
......@@ -275,7 +275,7 @@ bool AdapterImpl::coerce_assign(
// set runtime exception
constructRuntimeException(
pOutExc, "type coercion failed: " +
reinterpret_cast< Exception const * >(
static_cast< Exception const * >(
p_exc->pData )->Message );
}
::uno_any_destruct( p_exc, 0 );
......@@ -330,7 +330,7 @@ static void handleInvokExc( uno_Any * pDest, uno_Any * pSource )
{
// unwrap invocation target exception
uno_Any * target_exc =
&reinterpret_cast< reflection::InvocationTargetException * >(
&static_cast< reflection::InvocationTargetException * >(
pSource->pData )->TargetException;
::uno_type_any_construct(
pDest, target_exc->pData, target_exc->pType, 0 );
......@@ -773,7 +773,7 @@ static inline AdapterImpl * lookup_adapter(
t_ptr_set::const_iterator const iEnd( adapters_set.end() );
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
sal_Int32 nPosTypes;
for ( nPosTypes = nTypes; nPosTypes--; )
......
......@@ -247,7 +247,7 @@ const css::uno::Reference<XImplementationLoader> & JavaComponentLoader::getJavaL
throw RuntimeException(
"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)));
pJNIEnv->DeleteLocalRef( joJavaLoader );
if(!m_javaLoader.is())
......
......@@ -134,7 +134,7 @@ UnoInterfaceReference FactoryImpl::binuno_queryInterface(
UnoInterfaceReference ret;
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 );
typelib_typedescriptionreference_release( ret_val.pType );
}
......@@ -203,7 +203,7 @@ static void SAL_CALL binuno_proxy_free(
{
(void) pEnv; // avoid warning about unused parameter
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 );
delete proxy;
}
......@@ -254,7 +254,7 @@ static void SAL_CALL binuno_proxy_dispatch(
try
{
Type const & rType =
*reinterpret_cast< Type const * >( pArgs[ 0 ] );
*static_cast< Type const * >( pArgs[ 0 ] );
Any ret( that->m_root->queryInterface( rType ) );
uno_type_copyAndConvertData(
pReturn, &ret, ::getCppuType( &ret ).getTypeLibType(),
......
......@@ -276,12 +276,12 @@ static inline Reference< security::XAccessControlContext > getDynamicRestriction
if ( typeName == "com.sun.star.security.XAccessControlContext" )
{
return Reference< security::XAccessControlContext >(
*reinterpret_cast< security::XAccessControlContext ** const >( acc.pData ) );
*static_cast< security::XAccessControlContext ** const >( acc.pData ) );
}
else // try to 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(
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 );
}
void AccessController::checkAndClearPostPoned()
{
// 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
OSL_ASSERT( rec.get() );
if (rec.get())
......@@ -646,7 +646,7 @@ PermissionCollection AccessController::getEffectivePermissions(
// call on policy
// 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 (demanded_perm.hasValue())
......@@ -756,7 +756,7 @@ PermissionCollection AccessController::getEffectivePermissions(
{
// dont check postponed, just cleanup
clearPostPoned();
delete reinterpret_cast< t_rec_vec * >( m_rec.getData() );
delete static_cast< t_rec_vec * >( m_rec.getData() );
m_rec.setData( 0 );
throw;
}
......
......@@ -493,17 +493,17 @@ PermissionCollection::PermissionCollection(
if (perm_type.equals( cppu::UnoType<io::FilePermission>::get()))
{
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()))
{
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()))
{
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()))
{
......@@ -578,7 +578,7 @@ void PermissionCollection::checkPermission( Any const & perm ) const
if (demanded_type.equals( cppu::UnoType<io::FilePermission>::get()))
{
FilePermission demanded(
*reinterpret_cast< io::FilePermission const * >( perm.pData ) );
*static_cast< io::FilePermission const * >( perm.pData ) );
if (__implies( m_head, demanded ))
{
#ifdef __DIAGNOSE
......@@ -591,7 +591,7 @@ void PermissionCollection::checkPermission( Any const & perm ) const
else if (demanded_type.equals( cppu::UnoType<connection::SocketPermission>::get()))
{
SocketPermission demanded(
*reinterpret_cast< connection::SocketPermission const * >( perm.pData ) );
*static_cast< connection::SocketPermission const * >( perm.pData ) );
if (__implies( m_head, demanded ))
{
#ifdef __DIAGNOSE
......@@ -604,7 +604,7 @@ void PermissionCollection::checkPermission( Any const & perm ) const
else if (demanded_type.equals( cppu::UnoType<security::RuntimePermission>::get()))
{
RuntimePermission demanded(
*reinterpret_cast< security::RuntimePermission const * >( perm.pData ) );
*static_cast< security::RuntimePermission const * >( perm.pData ) );
if (__implies( m_head, demanded ))
{
#ifdef __DIAGNOSE
......
......@@ -1152,7 +1152,7 @@ sal_Bool OServiceManager::has( const Any & Element )
else if (Element.getValueTypeClass() == TypeClass_STRING)
{
OUString const & implName =
*reinterpret_cast< OUString const * >(Element.getValue());
*static_cast< OUString const * >(Element.getValue());
MutexGuard aGuard( m_mutex );
return m_ImplementationNameMap.find( implName ) !=
m_ImplementationNameMap.end();
......@@ -1231,7 +1231,7 @@ void OServiceManager::remove( const Any & Element )
else if (Element.getValueTypeClass() == TypeClass_STRING)
{
OUString const & implName =
*reinterpret_cast< OUString const * >(Element.getValue());
*static_cast< OUString const * >(Element.getValue());
MutexGuard aGuard( m_mutex );
HashMap_OWString_Interface::const_iterator const iFind(
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