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

Some more loplugin:cstylecast: stoc

Change-Id: I3d820a1df3750d20e704a163f45c16ea29a1b4bd
üst d6ca554f
......@@ -215,7 +215,7 @@ class InterfaceIdlClassImpl
public:
typelib_InterfaceTypeDescription * getTypeDescr() const
{ return (typelib_InterfaceTypeDescription *)IdlClassImpl::getTypeDescr(); }
{ return reinterpret_cast<typelib_InterfaceTypeDescription *>(IdlClassImpl::getTypeDescr()); }
// ctor/ dtor
InterfaceIdlClassImpl( IdlReflectionServiceImpl * pReflection,
......@@ -250,7 +250,7 @@ class CompoundIdlClassImpl
public:
typelib_CompoundTypeDescription * getTypeDescr() const
{ return (typelib_CompoundTypeDescription *)IdlClassImpl::getTypeDescr(); }
{ return reinterpret_cast<typelib_CompoundTypeDescription *>(IdlClassImpl::getTypeDescr()); }
// ctor/ dtor
CompoundIdlClassImpl( IdlReflectionServiceImpl * pReflection,
......@@ -275,7 +275,7 @@ class ArrayIdlClassImpl
{
public:
typelib_IndirectTypeDescription * getTypeDescr() const
{ return (typelib_IndirectTypeDescription *)IdlClassImpl::getTypeDescr(); }
{ return reinterpret_cast<typelib_IndirectTypeDescription *>(IdlClassImpl::getTypeDescr()); }
// ctor
ArrayIdlClassImpl( IdlReflectionServiceImpl * pReflection,
......@@ -313,7 +313,7 @@ class EnumIdlClassImpl
public:
typelib_EnumTypeDescription * getTypeDescr() const
{ return (typelib_EnumTypeDescription *)IdlClassImpl::getTypeDescr(); }
{ return reinterpret_cast<typelib_EnumTypeDescription *>(IdlClassImpl::getTypeDescr()); }
// ctor/ dtor
EnumIdlClassImpl( IdlReflectionServiceImpl * pReflection,
......@@ -379,7 +379,7 @@ inline bool extract(
if (rObj.getValueTypeClass() == css::uno::TypeClass_INTERFACE)
{
return ::uno_type_assignData(
&rDest, ((typelib_TypeDescription *)pTo)->pWeakRef,
&rDest, pTo->aBase.pWeakRef,
const_cast< void * >( rObj.getValue() ), rObj.getValueTypeRef(),
reinterpret_cast< uno_QueryInterfaceFunc >(css::uno::cpp_queryInterface),
reinterpret_cast< uno_AcquireFunc >(css::uno::cpp_acquire),
......@@ -401,7 +401,7 @@ inline bool coerce_assign(
if (pTD->eTypeClass == typelib_TypeClass_INTERFACE)
{
css::uno::Reference< css::uno::XInterface > xVal;
if (extract( rSource, (typelib_InterfaceTypeDescription *)pTD, xVal, pRefl ))
if (extract( rSource, reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD), xVal, pRefl ))
{
if (*(css::uno::XInterface **)pDest)
(*(css::uno::XInterface **)pDest)->release();
......
......@@ -95,7 +95,7 @@ void ArrayIdlClassImpl::realloc( Any & rArray, sal_Int32 nLen )
}
uno_Sequence ** ppSeq = (uno_Sequence **)rArray.getValue();
uno_sequence_realloc( ppSeq, (typelib_TypeDescription *)getTypeDescr(),
uno_sequence_realloc( ppSeq, &getTypeDescr()->aBase,
nLen,
reinterpret_cast< uno_AcquireFunc >(cpp_acquire),
reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
......@@ -168,7 +168,7 @@ void ArrayIdlClassImpl::set( Any & rArray, sal_Int32 nIndex, const Any & rNewVal
uno_Sequence ** ppSeq = (uno_Sequence **)rArray.getValue();
uno_sequence_reference2One(
ppSeq, (typelib_TypeDescription *)getTypeDescr(),
ppSeq, &getTypeDescr()->aBase,
reinterpret_cast< uno_AcquireFunc >(cpp_acquire),
reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
rArray.pData = ppSeq;
......
......@@ -129,7 +129,7 @@ Reference< XIdlClass > IdlCompFieldImpl::getDeclaringClass()
if (! _xDeclClass.is())
{
typelib_CompoundTypeDescription * pTD =
(typelib_CompoundTypeDescription *)getDeclTypeDescr();
reinterpret_cast<typelib_CompoundTypeDescription *>(getDeclTypeDescr());
while (pTD)
{
typelib_TypeDescriptionReference ** ppTypeRefs = pTD->ppTypeRefs;
......@@ -137,7 +137,7 @@ Reference< XIdlClass > IdlCompFieldImpl::getDeclaringClass()
{
if (td_equals( (typelib_TypeDescription *)getTypeDescr(), ppTypeRefs[nPos] ))
{
_xDeclClass = getReflection()->forType( (typelib_TypeDescription *)pTD );
_xDeclClass = getReflection()->forType( &pTD->aBase );
return _xDeclClass;
}
}
......@@ -180,7 +180,7 @@ Any IdlCompFieldImpl::get( const Any & rObj )
typelib_TypeDescription * pTD = pObjTD;
typelib_TypeDescription * pDeclTD = getDeclTypeDescr();
while (pTD && !typelib_typedescription_equals( pTD, pDeclTD ))
pTD = (typelib_TypeDescription *)((typelib_CompoundTypeDescription *)pTD)->pBaseTypeDescription;
pTD = &reinterpret_cast<typelib_CompoundTypeDescription *>(pTD)->pBaseTypeDescription->aBase;
OSL_ENSURE( pTD, "### illegal object type!" );
if (pTD)
......@@ -213,7 +213,7 @@ void IdlCompFieldImpl::set( const Any & rObj, const Any & rValue )
typelib_TypeDescription * pTD = pObjTD;
typelib_TypeDescription * pDeclTD = getDeclTypeDescr();
while (pTD && !typelib_typedescription_equals( pTD, pDeclTD ))
pTD = (typelib_TypeDescription *)((typelib_CompoundTypeDescription *)pTD)->pBaseTypeDescription;
pTD = &reinterpret_cast<typelib_CompoundTypeDescription *>(pTD)->pBaseTypeDescription->aBase;
OSL_ENSURE( pTD, "### illegal object type!" );
if (pTD)
......@@ -250,7 +250,7 @@ void IdlCompFieldImpl::set( Any & rObj, const Any & rValue )
typelib_TypeDescription * pTD = pObjTD;
typelib_TypeDescription * pDeclTD = getDeclTypeDescr();
while (pTD && !typelib_typedescription_equals( pTD, pDeclTD ))
pTD = (typelib_TypeDescription *)((typelib_CompoundTypeDescription *)pTD)->pBaseTypeDescription;
pTD = &reinterpret_cast<typelib_CompoundTypeDescription *>(pTD)->pBaseTypeDescription->aBase;
OSL_ENSURE( pTD, "### illegal object type!" );
if (pTD)
......@@ -320,7 +320,7 @@ Sequence< Reference< XIdlClass > > CompoundIdlClassImpl::getSuperclasses()
{
typelib_CompoundTypeDescription * pCompTypeDescr = getTypeDescr()->pBaseTypeDescription;
if (pCompTypeDescr)
_xSuperClass = getReflection()->forType( (typelib_TypeDescription *)pCompTypeDescr );
_xSuperClass = getReflection()->forType( &pCompTypeDescr->aBase );
}
}
if (_xSuperClass.is())
......
......@@ -223,7 +223,7 @@ void EnumIdlClassImpl::createObject( Any & rObj )
throw(css::uno::RuntimeException, std::exception)
{
sal_Int32 eVal =
((typelib_EnumTypeDescription *)IdlClassImpl::getTypeDescr())->nDefaultEnumValue;
reinterpret_cast<typelib_EnumTypeDescription *>(IdlClassImpl::getTypeDescr())->nDefaultEnumValue;
rObj.setValue( &eVal, IdlClassImpl::getTypeDescr() );
}
......
......@@ -50,7 +50,7 @@ class IdlAttributeFieldImpl
{
public:
typelib_InterfaceAttributeTypeDescription * getAttributeTypeDescr()
{ return (typelib_InterfaceAttributeTypeDescription *)getTypeDescr(); }
{ return reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>(getTypeDescr()); }
IdlAttributeFieldImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName,
typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr )
......@@ -175,7 +175,7 @@ Any IdlAttributeFieldImpl::get( const Any & rObj )
throw(css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
{
uno_Interface * pUnoI = getReflection()->mapToUno(
rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
rObj, reinterpret_cast<typelib_InterfaceTypeDescription *>(getDeclTypeDescr()) );
OSL_ENSURE( pUnoI, "### illegal destination object given!" );
if (pUnoI)
{
......@@ -215,7 +215,7 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue )
}
uno_Interface * pUnoI = getReflection()->mapToUno(
rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
rObj, reinterpret_cast<typelib_InterfaceTypeDescription *>(getDeclTypeDescr()) );
OSL_ENSURE( pUnoI, "### illegal destination object given!" );
if (pUnoI)
{
......@@ -243,12 +243,12 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue )
{
Reference< XInterface > xObj;
bAssign = extract(
rValue, (typelib_InterfaceTypeDescription *)pTD, xObj,
rValue, reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD), xObj,
getReflection() );
if (bAssign)
{
*(void **)pArg = getReflection()->getCpp2Uno().mapInterface(
xObj.get(), (typelib_InterfaceTypeDescription *)pTD );
xObj.get(), reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) );
}
}
else
......@@ -339,7 +339,7 @@ class IdlInterfaceMethodImpl
public:
typelib_InterfaceMethodTypeDescription * getMethodTypeDescr()
{ return (typelib_InterfaceMethodTypeDescription *)getTypeDescr(); }
{ return reinterpret_cast<typelib_InterfaceMethodTypeDescription *>(getTypeDescr()); }
IdlInterfaceMethodImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName,
typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr )
......@@ -598,7 +598,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
}
uno_Interface * pUnoI = getReflection()->mapToUno(
rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
rObj, reinterpret_cast<typelib_InterfaceTypeDescription *>(getDeclTypeDescr()) );
OSL_ENSURE( pUnoI, "### illegal destination object given!" );
if (pUnoI)
{
......@@ -651,12 +651,12 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
{
Reference< XInterface > xDest;
bAssign = extract(
pCppArgs[nPos], (typelib_InterfaceTypeDescription *)pTD,
pCppArgs[nPos], reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD),
xDest, getReflection() );
if (bAssign)
{
*(void **)ppUnoArgs[nPos] = getReflection()->getCpp2Uno().mapInterface(
xDest.get(), (typelib_InterfaceTypeDescription *)pTD );
xDest.get(), reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) );
}
}
else
......@@ -819,7 +819,7 @@ void InterfaceIdlClassImpl::initMembers()
typelib_TypeDescription * pTD = 0;
typelib_typedescriptionreference_getDescription( &pTD, ppAllMembers[nPos] );
assert(pTD && "### cannot get type description!");
pSortedMemberInit[nIndex].first = ((typelib_InterfaceMemberTypeDescription *)pTD)->pMemberName;
pSortedMemberInit[nIndex].first = reinterpret_cast<typelib_InterfaceMemberTypeDescription *>(pTD)->pMemberName;
pSortedMemberInit[nIndex].second = pTD;
}
......
......@@ -170,7 +170,7 @@ inline AdapterImpl::~AdapterImpl()
for ( sal_Int32 nPos = m_nInterfaces; nPos--; )
{
::typelib_typedescription_release(
(typelib_TypeDescription *)m_pInterfaces[ nPos ].m_pTypeDescr );
&m_pInterfaces[ nPos ].m_pTypeDescr->aBase );
}
delete [] m_pInterfaces;
......@@ -356,8 +356,8 @@ void AdapterImpl::getValue(
{
uno_Any aInvokRet;
void * pInvokArgs[1];
pInvokArgs[0] =
&((typelib_InterfaceMemberTypeDescription *)pMemberType)->pMemberName;
pInvokArgs[0] = const_cast<rtl_uString **>(
&reinterpret_cast<typelib_InterfaceMemberTypeDescription const *>(pMemberType)->pMemberName);
uno_Any aInvokExc;
uno_Any * pInvokExc = &aInvokExc;
......@@ -375,7 +375,7 @@ void AdapterImpl::getValue(
{
if (coerce_construct(
pReturn,
((typelib_InterfaceAttributeTypeDescription *)
reinterpret_cast<typelib_InterfaceAttributeTypeDescription const *>(
pMemberType)->pAttributeTypeRef,
&aInvokRet, *ppException ))
{
......@@ -392,12 +392,12 @@ void AdapterImpl::setValue(
uno_Any aInvokVal;
::uno_type_any_construct(
&aInvokVal, pArgs[0],
((typelib_InterfaceAttributeTypeDescription *)
reinterpret_cast<typelib_InterfaceAttributeTypeDescription const *>(
pMemberType)->pAttributeTypeRef, 0 );
void * pInvokArgs[2];
pInvokArgs[0] =
&((typelib_InterfaceMemberTypeDescription *)pMemberType)->pMemberName;
pInvokArgs[0] = const_cast<rtl_uString **>(
&reinterpret_cast<typelib_InterfaceMemberTypeDescription const *>(pMemberType)->pMemberName);
pInvokArgs[1] = &aInvokVal;
uno_Any aInvokExc;
uno_Any * pInvokExc = &aInvokExc;
......@@ -424,15 +424,15 @@ void AdapterImpl::invoke(
void * pReturn, void * pArgs[], uno_Any ** ppException )
{
sal_Int32 nParams =
((typelib_InterfaceMethodTypeDescription *)pMemberType)->nParams;
reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(pMemberType)->nParams;
typelib_MethodParameter * pFormalParams =
((typelib_InterfaceMethodTypeDescription *)pMemberType)->pParams;
reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(pMemberType)->pParams;
// in params
uno_Sequence * pInParamsSeq = 0;
::uno_sequence_construct(
&pInParamsSeq, m_pFactory->m_pAnySeqTD, 0, nParams, 0 );
uno_Any * pInAnys = (uno_Any *)pInParamsSeq->elements;
uno_Any * pInAnys = reinterpret_cast<uno_Any *>(pInParamsSeq->elements);
sal_Int32 nOutParams = 0;
sal_Int32 nPos;
for ( nPos = nParams; nPos--; )
......@@ -456,8 +456,8 @@ void AdapterImpl::invoke(
uno_Any aInvokRet;
// perform call
void * pInvokArgs[4];
pInvokArgs[0] =
&((typelib_InterfaceMemberTypeDescription *)pMemberType)->pMemberName;
pInvokArgs[0] = const_cast<rtl_uString **>(
&reinterpret_cast<typelib_InterfaceMemberTypeDescription const *>(pMemberType)->pMemberName);
pInvokArgs[1] = &pInParamsSeq;
pInvokArgs[2] = &pOutIndices;
pInvokArgs[3] = &pOutParams;
......@@ -484,8 +484,8 @@ void AdapterImpl::invoke(
if (pOutParams->nElements == nOutParams &&
pOutIndices->nElements == nOutParams)
{
sal_Int16 * pIndices = (sal_Int16 *)pOutIndices->elements;
uno_Any * pOut = (uno_Any *)pOutParams->elements;
sal_Int16 * pIndices = reinterpret_cast<sal_Int16 *>(pOutIndices->elements);
uno_Any * pOut = reinterpret_cast<uno_Any *>(pOutParams->elements);
for ( nPos = 0; nPos < nOutParams; ++nPos )
{
sal_Int32 nIndex = pIndices[nPos];
......@@ -525,7 +525,7 @@ void AdapterImpl::invoke(
// out param copy ok; write return value
if (coerce_construct(
pReturn,
((typelib_InterfaceMethodTypeDescription *)
reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(
pMemberType)->pReturnTypeRef,
&aInvokRet, *ppException ))
{
......@@ -568,7 +568,7 @@ static void SAL_CALL adapter_dispatch(
void * pReturn, void * pArgs[], uno_Any ** ppException )
{
// query to emulated interface
switch (((typelib_InterfaceMemberTypeDescription *)pMemberType)->nPosition)
switch (reinterpret_cast<typelib_InterfaceMemberTypeDescription const *>(pMemberType)->nPosition)
{
case 0: // queryInterface()
{
......@@ -584,13 +584,12 @@ static void SAL_CALL adapter_dispatch(
that->m_pInterfaces[nPos].m_pTypeDescr;
while (pTD)
{
if (type_equals(
((typelib_TypeDescription *)pTD)->pWeakRef, pDemanded ))
if (type_equals( pTD->aBase.pWeakRef, pDemanded ))
{
uno_Interface * pUnoI2 = &that->m_pInterfaces[nPos];
::uno_any_construct(
(uno_Any *)pReturn, &pUnoI2,
(typelib_TypeDescription *)pTD, 0 );
&pTD->aBase, 0 );
return;
}
pTD = pTD->pBaseTypeDescription;
......@@ -649,15 +648,14 @@ AdapterImpl::AdapterImpl(
pInterface->m_pAdapter = this;
pInterface->m_pTypeDescr = 0;
pTypes[nPos].getDescription(
(typelib_TypeDescription **)&pInterface->m_pTypeDescr );
reinterpret_cast<typelib_TypeDescription **>(&pInterface->m_pTypeDescr) );
OSL_ASSERT( pInterface->m_pTypeDescr );
if (! pInterface->m_pTypeDescr)
{
for ( sal_Int32 n = 0; n < nPos; ++n )
{
::typelib_typedescription_release(
(typelib_TypeDescription *)
m_pInterfaces[ n ].m_pTypeDescr );
&m_pInterfaces[ n ].m_pTypeDescr->aBase );
}
delete [] m_pInterfaces;
throw RuntimeException(
......@@ -787,8 +785,7 @@ static inline AdapterImpl * lookup_adapter(
{
if (::typelib_typedescriptionreference_isAssignableFrom(
rType.getTypeLibType(),
((typelib_TypeDescription *)that->
m_pInterfaces[ nPos ].m_pTypeDescr)->pWeakRef ))
that->m_pInterfaces[ nPos ].m_pTypeDescr->aBase.pWeakRef ))
{
// found
break;
......
......@@ -244,7 +244,7 @@ const css::uno::Reference<XImplementationLoader> & JavaComponentLoader::getJavaL
pUno_environment = NULL;
cppu::UnoType<XImplementationLoader>::get().
getDescription((typelib_TypeDescription **) & pType_XImplementationLoader);
getDescription(reinterpret_cast<typelib_TypeDescription **>(&pType_XImplementationLoader));
if(!pType_XImplementationLoader)
throw RuntimeException(
"javaloader error - no type information for XImplementationLoader");
......
......@@ -584,11 +584,11 @@ Any SAL_CALL TypeConverter_Impl::convertTo( const Any& rVal, const Type& aDestTy
typelib_TypeDescription * pSourceElementTD = 0;
TYPELIB_DANGER_GET(
&pSourceElementTD,
((typelib_IndirectTypeDescription *)aSourceTD.get())->pType );
reinterpret_cast<typelib_IndirectTypeDescription *>(aSourceTD.get())->pType );
typelib_TypeDescription * pDestElementTD = 0;
TYPELIB_DANGER_GET(
&pDestElementTD,
((typelib_IndirectTypeDescription *)aDestTD.get())->pType );
reinterpret_cast<typelib_IndirectTypeDescription *>(aDestTD.get())->pType );
sal_uInt32 nPos = (*(const uno_Sequence * const *)rVal.getValue())->nElements;
uno_Sequence * pRet = 0;
......@@ -641,10 +641,10 @@ Any SAL_CALL TypeConverter_Impl::convertTo( const Any& rVal, const Type& aDestTy
if (aSourceClass==TypeClass_STRING)
{
for ( nPos = ((typelib_EnumTypeDescription *)aEnumTD.get())->nEnumValues; nPos--; )
for ( nPos = reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->nEnumValues; nPos--; )
{
if (((const OUString *)rVal.getValue())->equalsIgnoreAsciiCase(
((typelib_EnumTypeDescription *)aEnumTD.get())->ppEnumNames[nPos] ))
reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->ppEnumNames[nPos] ))
break;
}
}
......@@ -653,9 +653,9 @@ Any SAL_CALL TypeConverter_Impl::convertTo( const Any& rVal, const Type& aDestTy
aSourceClass!=TypeClass_CHAR)
{
sal_Int32 nEnumValue = (sal_Int32)toHyper( rVal, -(sal_Int64)0x80000000, 0x7fffffff );
for ( nPos = ((typelib_EnumTypeDescription *)aEnumTD.get())->nEnumValues; nPos--; )
for ( nPos = reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->nEnumValues; nPos--; )
{
if (nEnumValue == ((typelib_EnumTypeDescription *)aEnumTD.get())->pEnumValues[nPos])
if (nEnumValue == reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->pEnumValues[nPos])
break;
}
}
......@@ -663,7 +663,7 @@ Any SAL_CALL TypeConverter_Impl::convertTo( const Any& rVal, const Type& aDestTy
if (nPos >= 0)
{
aRet.setValue(
&((typelib_EnumTypeDescription *)aEnumTD.get())->pEnumValues[nPos],
&reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->pEnumValues[nPos],
aEnumTD.get() );
}
else
......@@ -839,15 +839,15 @@ Any TypeConverter_Impl::convertToSimpleType( const Any& rVal, TypeClass aDestina
aEnumTD.makeComplete();
sal_Int32 nPos;
sal_Int32 nEnumValue = *(sal_Int32 *)rVal.getValue();
for ( nPos = ((typelib_EnumTypeDescription *)aEnumTD.get())->nEnumValues; nPos--; )
for ( nPos = reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->nEnumValues; nPos--; )
{
if (nEnumValue == ((typelib_EnumTypeDescription *)aEnumTD.get())->pEnumValues[nPos])
if (nEnumValue == reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->pEnumValues[nPos])
break;
}
if (nPos >= 0)
{
aRet.setValue(
&((typelib_EnumTypeDescription *)aEnumTD.get())->ppEnumNames[nPos],
&reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->ppEnumNames[nPos],
cppu::UnoType<OUString>::get());
}
else
......
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