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

loplugin:cstylecast: deal with remaining pointer casts

Change-Id: Iaf1585c0413d07ce4f8712570d9195d6a21fa174
üst eac0f302
......@@ -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) );
......
......@@ -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 );
}
......
......@@ -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 );
}
......
......@@ -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 ))) );
}
}
......
......@@ -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)) );
}
......
......@@ -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 );
}
......
......@@ -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
......
......@@ -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)
......
......@@ -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;
}
......
......@@ -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 ));
}
}
......
......@@ -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
......
......@@ -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 );
......
......@@ -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) );
}
}
......
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