summaryrefslogtreecommitdiff
path: root/stoc/source/corereflection
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-03-28 19:07:13 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-03-28 19:09:26 +0100
commit116b969fc9916a0414d79e5276623b8b8dcc5f3d (patch)
tree58d256c618896aa9de549242bc4b07276964f5fb /stoc/source/corereflection
parent8b2779bf61993ead742a95f3abda5d96a7a86644 (diff)
Clean up C-style casts from pointers to void
Change-Id: I2ac79c757d9116d35436ae1adc0e11e7040e725d
Diffstat (limited to 'stoc/source/corereflection')
-rw-r--r--stoc/source/corereflection/base.hxx10
-rw-r--r--stoc/source/corereflection/crarray.cxx10
-rw-r--r--stoc/source/corereflection/crcomp.cxx6
-rw-r--r--stoc/source/corereflection/crefl.cxx8
-rw-r--r--stoc/source/corereflection/criface.cxx22
5 files changed, 28 insertions, 28 deletions
diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx
index 7e6eaf0efb7f..7c83960acd4f 100644
--- a/stoc/source/corereflection/base.hxx
+++ b/stoc/source/corereflection/base.hxx
@@ -403,11 +403,11 @@ inline bool coerce_assign(
css::uno::Reference< css::uno::XInterface > xVal;
if (extract( rSource, reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD), xVal, pRefl ))
{
- if (*(css::uno::XInterface **)pDest)
- (*(css::uno::XInterface **)pDest)->release();
- *(css::uno::XInterface **)pDest = xVal.get();
- if (*(css::uno::XInterface **)pDest)
- (*(css::uno::XInterface **)pDest)->acquire();
+ if (*static_cast<css::uno::XInterface **>(pDest))
+ (*static_cast<css::uno::XInterface **>(pDest))->release();
+ *static_cast<css::uno::XInterface **>(pDest) = xVal.get();
+ if (*static_cast<css::uno::XInterface **>(pDest))
+ (*static_cast<css::uno::XInterface **>(pDest))->acquire();
return true;
}
return false;
diff --git a/stoc/source/corereflection/crarray.cxx b/stoc/source/corereflection/crarray.cxx
index e35d30ef1306..0d6fa9c29f89 100644
--- a/stoc/source/corereflection/crarray.cxx
+++ b/stoc/source/corereflection/crarray.cxx
@@ -94,7 +94,7 @@ void ArrayIdlClassImpl::realloc( Any & rArray, sal_Int32 nLen )
(XWeak *)(OWeakObject *)this, 1 );
}
- uno_Sequence ** ppSeq = (uno_Sequence **)rArray.getValue();
+ uno_Sequence ** ppSeq = const_cast<uno_Sequence **>(static_cast<uno_Sequence * const *>(rArray.getValue()));
uno_sequence_realloc( ppSeq, &getTypeDescr()->aBase,
nLen,
reinterpret_cast< uno_AcquireFunc >(cpp_acquire),
@@ -113,7 +113,7 @@ sal_Int32 ArrayIdlClassImpl::getLen( const Any & rArray )
(XWeak *)(OWeakObject *)this, 0 );
}
- return (*(uno_Sequence **)rArray.getValue())->nElements;
+ return (*static_cast<uno_Sequence * const *>(rArray.getValue()))->nElements;
}
Any ArrayIdlClassImpl::get( const Any & rArray, sal_Int32 nIndex )
@@ -127,7 +127,7 @@ Any ArrayIdlClassImpl::get( const Any & rArray, sal_Int32 nIndex )
(XWeak *)(OWeakObject *)this, 0 );
}
- uno_Sequence * pSeq = *(uno_Sequence **)rArray.getValue();
+ uno_Sequence * pSeq = *static_cast<uno_Sequence * const *>(rArray.getValue());
if (pSeq->nElements <= nIndex)
{
throw ArrayIndexOutOfBoundsException(
@@ -158,7 +158,7 @@ void ArrayIdlClassImpl::set( Any & rArray, sal_Int32 nIndex, const Any & rNewVal
(XWeak *)(OWeakObject *)this, 0 );
}
- uno_Sequence * pSeq = *(uno_Sequence **)rArray.getValue();
+ uno_Sequence * pSeq = *static_cast<uno_Sequence * const *>(rArray.getValue());
if (pSeq->nElements <= nIndex)
{
throw ArrayIndexOutOfBoundsException(
@@ -166,7 +166,7 @@ void ArrayIdlClassImpl::set( Any & rArray, sal_Int32 nIndex, const Any & rNewVal
(XWeak *)(OWeakObject *)this );
}
- uno_Sequence ** ppSeq = (uno_Sequence **)rArray.getValue();
+ uno_Sequence ** ppSeq = const_cast<uno_Sequence **>(static_cast<uno_Sequence * const *>(rArray.getValue()));
uno_sequence_reference2One(
ppSeq, &getTypeDescr()->aBase,
reinterpret_cast< uno_AcquireFunc >(cpp_acquire),
diff --git a/stoc/source/corereflection/crcomp.cxx b/stoc/source/corereflection/crcomp.cxx
index 9805938c56f0..995c74badb3f 100644
--- a/stoc/source/corereflection/crcomp.cxx
+++ b/stoc/source/corereflection/crcomp.cxx
@@ -190,7 +190,7 @@ Any IdlCompFieldImpl::get( const Any & rObj )
uno_any_destruct(
&aRet, reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
uno_any_construct(
- &aRet, (char *)rObj.getValue() + _nOffset, getTypeDescr(),
+ &aRet, const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(),
reinterpret_cast< uno_AcquireFunc >(cpp_acquire) );
return aRet;
}
@@ -219,7 +219,7 @@ void IdlCompFieldImpl::set( const Any & rObj, const Any & rValue )
if (pTD)
{
TYPELIB_DANGER_RELEASE( pObjTD );
- if (coerce_assign( (char *)rObj.getValue() + _nOffset, getTypeDescr(), rValue, getReflection() ))
+ if (coerce_assign( const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(), rValue, getReflection() ))
{
return;
}
@@ -256,7 +256,7 @@ void IdlCompFieldImpl::set( Any & rObj, const Any & rValue )
if (pTD)
{
TYPELIB_DANGER_RELEASE( pObjTD );
- if (coerce_assign( (char *)rObj.getValue() + _nOffset, getTypeDescr(), rValue, getReflection() ))
+ if (coerce_assign( const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(), rValue, getReflection() ))
{
return;
}
diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx
index 23089fb9f7cb..8710cf96a8aa 100644
--- a/stoc/source/corereflection/crefl.cxx
+++ b/stoc/source/corereflection/crefl.cxx
@@ -231,7 +231,7 @@ Reference< XIdlClass > IdlReflectionServiceImpl::forName( const OUString & rType
if (aAny.hasValue())
{
if (aAny.getValueTypeClass() == TypeClass_INTERFACE)
- xRet = *(const Reference< XIdlClass > *)aAny.getValue();
+ xRet = *static_cast<const Reference< XIdlClass > *>(aAny.getValue());
}
else
{
@@ -261,7 +261,7 @@ Any IdlReflectionServiceImpl::getByHierarchicalName( const OUString & rName )
if (aRet.getValueTypeClass() == TypeClass_INTERFACE)
{
// type retrieved from tdmgr
- OSL_ASSERT( (*(Reference< XInterface > *)aRet.getValue())->queryInterface(
+ OSL_ASSERT( (*static_cast<Reference< XInterface > const *>(aRet.getValue()))->queryInterface(
cppu::UnoType<XTypeDescription>::get()).hasValue() );
css::uno::Reference< css::reflection::XConstantTypeDescription >
@@ -329,7 +329,7 @@ Reference< XIdlClass > IdlReflectionServiceImpl::forType( typelib_TypeDescriptio
if (aAny.hasValue())
{
if (aAny.getValueTypeClass() == TypeClass_INTERFACE)
- xRet = *(const Reference< XIdlClass > *)aAny.getValue();
+ xRet = *static_cast<const Reference< XIdlClass > *>(aAny.getValue());
}
else
{
@@ -409,7 +409,7 @@ uno_Interface * IdlReflectionServiceImpl::mapToUno(
{
Reference< XInterface > xObj;
if (extract( rObj, pTo, xObj, this ))
- return (uno_Interface *)getCpp2Uno().mapInterface( xObj.get(), pTo );
+ return static_cast<uno_Interface *>(getCpp2Uno().mapInterface( xObj.get(), pTo ));
throw RuntimeException(
"illegal object given!",
diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx
index 872f98b297d9..a3b72bc47ebf 100644
--- a/stoc/source/corereflection/criface.cxx
+++ b/stoc/source/corereflection/criface.cxx
@@ -247,7 +247,7 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue )
getReflection() );
if (bAssign)
{
- *(void **)pArg = getReflection()->getCpp2Uno().mapInterface(
+ *static_cast<void **>(pArg) = getReflection()->getCpp2Uno().mapInterface(
xObj.get(), reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) );
}
}
@@ -287,7 +287,7 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue )
throw IllegalArgumentException(
"illegal value given!",
- *(const Reference< XInterface > *)rObj.getValue(), 1 );
+ *static_cast<const Reference< XInterface > *>(rObj.getValue()), 1 );
}
throw IllegalArgumentException(
"illegal destination object given!",
@@ -586,13 +586,13 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
if (rtl_ustr_ascii_compare( getTypeDescr()->pTypeName->buffer,
"com.sun.star.uno.XInterface::acquire" ) == 0)
{
- (*(const Reference< XInterface > *)rObj.getValue())->acquire();
+ (*static_cast<const Reference< XInterface > *>(rObj.getValue()))->acquire();
return Any();
}
else if (rtl_ustr_ascii_compare( getTypeDescr()->pTypeName->buffer,
"com.sun.star.uno.XInterface::release" ) == 0)
{
- (*(const Reference< XInterface > *)rObj.getValue())->release();
+ (*static_cast<const Reference< XInterface > *>(rObj.getValue()))->release();
return Any();
}
}
@@ -608,7 +608,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
(*pUnoI->release)( pUnoI );
throw IllegalArgumentException(
"arguments len differ!",
- *(const Reference< XInterface > *)rObj.getValue(), 1 );
+ *static_cast<const Reference< XInterface > *>(rObj.getValue()), 1 );
}
Any * pCppArgs = rArgs.getArray();
@@ -618,8 +618,8 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
&pReturnType, getMethodTypeDescr()->pReturnTypeRef );
void * pUnoReturn = alloca( pReturnType->nSize );
- void ** ppUnoArgs = (void **)alloca( sizeof(void *) * nParams *2 );
- typelib_TypeDescription ** ppParamTypes = (typelib_TypeDescription **)(ppUnoArgs + nParams);
+ void ** ppUnoArgs = static_cast<void **>(alloca( sizeof(void *) * nParams *2 ));
+ typelib_TypeDescription ** ppParamTypes = reinterpret_cast<typelib_TypeDescription **>(ppUnoArgs + nParams);
// convert arguments
for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
@@ -643,7 +643,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
else if (pTD->eTypeClass == typelib_TypeClass_ANY)
{
uno_type_any_constructAndConvert(
- (uno_Any *)ppUnoArgs[nPos], (void *)pCppArgs[nPos].getValue(),
+ static_cast<uno_Any *>(ppUnoArgs[nPos]), (void *)pCppArgs[nPos].getValue(),
pCppArgs[nPos].getValueTypeRef(), getReflection()->getCpp2Uno().get() );
bAssign = true;
}
@@ -655,7 +655,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
xDest, getReflection() );
if (bAssign)
{
- *(void **)ppUnoArgs[nPos] = getReflection()->getCpp2Uno().mapInterface(
+ *static_cast<void **>(ppUnoArgs[nPos]) = getReflection()->getCpp2Uno().mapInterface(
xDest.get(), reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) );
}
}
@@ -682,7 +682,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
{
IllegalArgumentException aExc(
"cannot coerce argument type during corereflection call!",
- *(const Reference< XInterface > *)rObj.getValue(), (sal_Int16)nPos );
+ *static_cast<const Reference< XInterface > *>(rObj.getValue()), (sal_Int16)nPos );
// cleanup
while (nPos--)
@@ -719,7 +719,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
TYPELIB_DANGER_RELEASE( pReturnType );
InvocationTargetException aExc;
- aExc.Context = *(const Reference< XInterface > *)rObj.getValue();
+ aExc.Context = *static_cast<const Reference< XInterface > *>(rObj.getValue());
aExc.Message = "exception occurred during invocation!";
uno_any_destruct(
&aExc.TargetException,