From 9193a15fc55b24e9f463838fd2981ddb84dca227 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sat, 17 Jan 2015 18:18:10 +0100 Subject: Some more loplugin:cstylecast: cppu Change-Id: Iec1251648031afa9eddd7445135fb08dc74821bd --- .../source/helper/purpenv/helper_purpenv_Proxy.cxx | 26 ++--- cppu/source/threadpool/current.cxx | 16 +-- cppu/source/threadpool/threadident.cxx | 2 +- cppu/source/threadpool/threadpool.hxx | 2 +- cppu/source/typelib/static_types.cxx | 48 ++++----- cppu/source/typelib/typelib.cxx | 108 ++++++++++----------- cppu/source/uno/EnvStack.cxx | 4 +- cppu/source/uno/assign.hxx | 13 +-- cppu/source/uno/constr.hxx | 8 +- cppu/source/uno/copy.hxx | 44 ++++----- cppu/source/uno/data.cxx | 4 +- cppu/source/uno/destr.hxx | 12 +-- cppu/source/uno/eq.hxx | 12 +-- cppu/source/uno/lbenv.cxx | 34 +++---- cppu/source/uno/lbmap.cxx | 6 +- cppu/source/uno/prim.hxx | 4 +- cppu/source/uno/sequence.cxx | 42 ++++---- include/cppu/Enterable.hxx | 4 +- include/uno/environment.hxx | 2 +- include/uno/mapping.hxx | 6 +- 20 files changed, 195 insertions(+), 202 deletions(-) diff --git a/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx b/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx index d8e0dd40f98e..b51ea547733f 100644 --- a/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx +++ b/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx @@ -47,7 +47,7 @@ static bool relatesToInterface(typelib_TypeDescription * pTypeDescr) // case typelib_TypeClass_TYPEDEF: case typelib_TypeClass_SEQUENCE: { - switch (((typelib_IndirectTypeDescription *)pTypeDescr)->pType->eTypeClass) + switch (reinterpret_cast(pTypeDescr)->pType->eTypeClass) { case typelib_TypeClass_INTERFACE: case typelib_TypeClass_ANY: // might relate to interface @@ -57,7 +57,7 @@ static bool relatesToInterface(typelib_TypeDescription * pTypeDescr) case typelib_TypeClass_EXCEPTION: { typelib_TypeDescription * pTD = 0; - TYPELIB_DANGER_GET( &pTD, ((typelib_IndirectTypeDescription *)pTypeDescr)->pType ); + TYPELIB_DANGER_GET( &pTD, reinterpret_cast(pTypeDescr)->pType ); bool bRel = relatesToInterface( pTD ); TYPELIB_DANGER_RELEASE( pTD ); return bRel; @@ -71,7 +71,7 @@ static bool relatesToInterface(typelib_TypeDescription * pTypeDescr) case typelib_TypeClass_EXCEPTION: { // ...optimized... to avoid getDescription() calls! - typelib_CompoundTypeDescription * pComp = (typelib_CompoundTypeDescription *)pTypeDescr; + typelib_CompoundTypeDescription * pComp = reinterpret_cast(pTypeDescr); typelib_TypeDescriptionReference ** pTypes = pComp->ppTypeRefs; for ( sal_Int32 nPos = pComp->nMembers; nPos--; ) { @@ -97,7 +97,7 @@ static bool relatesToInterface(typelib_TypeDescription * pTypeDescr) } } if (pComp->pBaseTypeDescription) - return relatesToInterface( (typelib_TypeDescription *)pComp->pBaseTypeDescription ); + return relatesToInterface( &pComp->pBaseTypeDescription->aBase ); break; } case typelib_TypeClass_ANY: // might relate to interface @@ -132,14 +132,14 @@ extern "C" { static void SAL_CALL s_Proxy_dispatch( if (pReturn) { pReturnTypeRef = - ((typelib_InterfaceAttributeTypeDescription *) + reinterpret_cast( pMemberType)->pAttributeTypeRef; nParams = 0; pParams = NULL; } else { - param.pTypeRef = ((typelib_InterfaceAttributeTypeDescription *) + param.pTypeRef = reinterpret_cast( pMemberType)->pAttributeTypeRef; param.bIn = sal_True; param.bOut = sal_False; @@ -149,8 +149,8 @@ extern "C" { static void SAL_CALL s_Proxy_dispatch( break; case typelib_TypeClass_INTERFACE_METHOD: { - typelib_InterfaceMethodTypeDescription * method_td = - (typelib_InterfaceMethodTypeDescription *) pMemberType; + typelib_InterfaceMethodTypeDescription const * method_td = + reinterpret_cast(pMemberType); pReturnTypeRef = method_td->pReturnTypeRef; nParams = method_td->nParams; pParams = method_td->pParams; @@ -223,11 +223,11 @@ Proxy::Proxy(uno::Mapping const & to_from, { LOG_LIFECYCLE_Proxy_emit(fprintf(stderr, "LIFE: %s -> %p\n", "Proxy::Proxy(<>)", this)); - typelib_typedescription_acquire((typelib_TypeDescription *)m_pTypeDescr); - if (!((typelib_TypeDescription *)m_pTypeDescr)->bComplete) - typelib_typedescription_complete((typelib_TypeDescription **)&m_pTypeDescr); + typelib_typedescription_acquire(&m_pTypeDescr->aBase); + if (!m_pTypeDescr->aBase.bComplete) + typelib_typedescription_complete(reinterpret_cast(&m_pTypeDescr)); - OSL_ENSURE(((typelib_TypeDescription *)m_pTypeDescr)->bComplete, "### type is incomplete!"); + OSL_ENSURE(m_pTypeDescr->aBase.bComplete, "### type is incomplete!"); uno_Environment_invoke(m_to.get(), s_acquireAndRegister_v, m_pUnoI, rOId.pData, pTypeDescr, m_to.get()); @@ -252,7 +252,7 @@ Proxy::~Proxy() uno_Environment_invoke(m_to.get(), s_releaseAndRevoke_v, m_to.get(), m_pUnoI); - typelib_typedescription_release((typelib_TypeDescription *)m_pTypeDescr); + typelib_typedescription_release(&m_pTypeDescr->aBase); } static uno::TypeDescription getAcquireMethod(void) diff --git a/cppu/source/threadpool/current.cxx b/cppu/source/threadpool/current.cxx index 3135a4ba6344..63992dd87d74 100644 --- a/cppu/source/threadpool/current.cxx +++ b/cppu/source/threadpool/current.cxx @@ -63,7 +63,7 @@ static typelib_InterfaceTypeDescription * get_type_XCurrentContext() 1, pMembers ); - typelib_typedescription_register( (typelib_TypeDescription**)&pTD ); + typelib_typedescription_register( reinterpret_cast(&pTD) ); typelib_typedescriptionreference_release( pMembers[0] ); typelib_InterfaceMethodTypeDescription * pMethod = 0; @@ -85,8 +85,8 @@ static typelib_InterfaceTypeDescription * get_type_XCurrentContext() sMethodName0.pData, typelib_TypeClass_ANY, sReturnType0.pData, 1, aParameters, 1, pExceptions ); - typelib_typedescription_register( (typelib_TypeDescription**)&pMethod ); - typelib_typedescription_release( (typelib_TypeDescription*)pMethod ); + typelib_typedescription_register( reinterpret_cast(&pMethod) ); + typelib_typedescription_release( &pMethod->aBase.aBase ); // another static ref: ++reinterpret_cast< typelib_TypeDescription * >( pTD )-> nStaticRefCount; @@ -151,8 +151,8 @@ extern "C" void SAL_CALL delete_IdContainer( void * p ) { (*pId->pCurrentContextEnv->releaseInterface)( pId->pCurrentContextEnv, pId->pCurrentContext ); - (*((uno_Environment *)pId->pCurrentContextEnv)->release)( - (uno_Environment *)pId->pCurrentContextEnv ); + (*pId->pCurrentContextEnv->aBase.release)( + &pId->pCurrentContextEnv->aBase ); } if (pId->bInit) { @@ -196,8 +196,8 @@ extern "C" sal_Bool SAL_CALL uno_setCurrentContext( { (*pId->pCurrentContextEnv->releaseInterface)( pId->pCurrentContextEnv, pId->pCurrentContext ); - (*((uno_Environment *)pId->pCurrentContextEnv)->release)( - (uno_Environment *)pId->pCurrentContextEnv ); + (*pId->pCurrentContextEnv->aBase.release)( + &pId->pCurrentContextEnv->aBase ); pId->pCurrentContextEnv = 0; pId->pCurrentContext = 0; @@ -268,7 +268,7 @@ extern "C" sal_Bool SAL_CALL uno_getCurrentContext( return sal_False; } - Mapping mapping((uno_Environment *) pId->pCurrentContextEnv, target_env.get()); + Mapping mapping(&pId->pCurrentContextEnv->aBase, target_env.get()); OSL_ASSERT( mapping.is() ); if (! mapping.is()) return sal_False; diff --git a/cppu/source/threadpool/threadident.cxx b/cppu/source/threadpool/threadident.cxx index eaf5bc61156e..ce7fdc0efc68 100644 --- a/cppu/source/threadpool/threadident.cxx +++ b/cppu/source/threadpool/threadident.cxx @@ -46,7 +46,7 @@ static inline void createLocalId( sal_Sequence **ppThreadId ) (*ppThreadId)->elements[1] = (id >> 8) & 0xFF; (*ppThreadId)->elements[2] = (id >> 16) & 0xFF; (*ppThreadId)->elements[3] = (id >> 24) & 0xFF; - rtl_getGlobalProcessId( (sal_uInt8 * ) &( (*ppThreadId)->elements[4]) ); + rtl_getGlobalProcessId( reinterpret_cast(&(*ppThreadId)->elements[4]) ); } diff --git a/cppu/source/threadpool/threadpool.hxx b/cppu/source/threadpool/threadpool.hxx index a6b2fbc14de1..dc17d6490ac8 100644 --- a/cppu/source/threadpool/threadpool.hxx +++ b/cppu/source/threadpool/threadpool.hxx @@ -51,7 +51,7 @@ namespace cppu_threadpool { { if( a.getLength() >= 4 ) { - return *(sal_Int32 *)a.getConstArray(); + return *reinterpret_cast(a.getConstArray()); } return 0; } diff --git a/cppu/source/typelib/static_types.cxx b/cppu/source/typelib/static_types.cxx index 2d66d24b37f7..e5227553e97a 100644 --- a/cppu/source/typelib/static_types.cxx +++ b/cppu/source/typelib/static_types.cxx @@ -187,12 +187,12 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( ::typelib_typedescription_newInterface( &pTD, sTypeName.pData, 0, 0, 0, 0, 0, 0, 3, pMembers ); - ::typelib_typedescription_register( (typelib_TypeDescription **)&pTD ); + ::typelib_typedescription_register( reinterpret_cast(&pTD) ); ::typelib_typedescriptionreference_acquire( - s_aTypes[typelib_TypeClass_INTERFACE] = ((typelib_TypeDescription *)pTD)->pWeakRef ); + s_aTypes[typelib_TypeClass_INTERFACE] = pTD->aBase.pWeakRef ); // another static ref: ++s_aTypes[typelib_TypeClass_INTERFACE]->nStaticRefCount; - ::typelib_typedescription_release( (typelib_TypeDescription*)pTD ); + ::typelib_typedescription_release( &pTD->aBase ); ::typelib_typedescriptionreference_release( pMembers[0] ); ::typelib_typedescriptionreference_release( pMembers[1] ); @@ -247,20 +247,20 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( &pMethod, 0, sal_False, sMethodName0.pData, typelib_TypeClass_ANY, sReturnType0.pData, 1, aParameters, 1, pExceptions ); - ::typelib_typedescription_register( (typelib_TypeDescription**)&pMethod ); + ::typelib_typedescription_register( reinterpret_cast(&pMethod) ); OUString sReturnType1("void"); ::typelib_typedescription_newInterfaceMethod( &pMethod, 1, sal_True, sMethodName1.pData, typelib_TypeClass_VOID, sReturnType1.pData, 0, 0, 0, 0 ); - ::typelib_typedescription_register( (typelib_TypeDescription**)&pMethod ); + ::typelib_typedescription_register( reinterpret_cast(&pMethod) ); ::typelib_typedescription_newInterfaceMethod( &pMethod, 2, sal_True, sMethodName2.pData, typelib_TypeClass_VOID, sReturnType1.pData, 0, 0, 0, 0 ); - ::typelib_typedescription_register( (typelib_TypeDescription**)&pMethod ); - ::typelib_typedescription_release( (typelib_TypeDescription*)pMethod ); + ::typelib_typedescription_register( reinterpret_cast(&pMethod) ); + ::typelib_typedescription_release( &pMethod->aBase.aBase ); } break; } @@ -321,7 +321,7 @@ void SAL_CALL typelib_static_sequence_type_init( aTypeName.pData, pElementType, 0, 0 ); ::typelib_typedescription_register( &pReg ); - *ppRef = (typelib_TypeDescriptionReference *)pReg; + *ppRef = reinterpret_cast(pReg); assert( *ppRef == pReg->pWeakRef ); } // another static ref: @@ -354,16 +354,16 @@ void init( { typelib_CompoundTypeDescription * pComp = 0; ::typelib_typedescription_newEmpty( - (typelib_TypeDescription **)&pComp, eTypeClass, aTypeName.pData ); + reinterpret_cast(&pComp), eTypeClass, aTypeName.pData ); sal_Int32 nOffset = 0; if (pBaseType) { ::typelib_typedescriptionreference_getDescription( - (typelib_TypeDescription **)&pComp->pBaseTypeDescription, pBaseType ); + reinterpret_cast(&pComp->pBaseTypeDescription), pBaseType ); assert( pComp->pBaseTypeDescription ); - nOffset = ((typelib_TypeDescription *)pComp->pBaseTypeDescription)->nSize; - assert( newAlignedSize( 0, ((typelib_TypeDescription *)pComp->pBaseTypeDescription)->nSize, ((typelib_TypeDescription *)pComp->pBaseTypeDescription)->nAlignment ) == ((typelib_TypeDescription *)pComp->pBaseTypeDescription)->nSize ); // unexpected offset + nOffset = pComp->pBaseTypeDescription->aBase.nSize; + assert( newAlignedSize( 0, pComp->pBaseTypeDescription->aBase.nSize, pComp->pBaseTypeDescription->aBase.nAlignment ) == pComp->pBaseTypeDescription->aBase.nSize ); // unexpected offset } if (nMembers) @@ -396,15 +396,15 @@ void init( } } - typelib_TypeDescription * pReg = (typelib_TypeDescription *)pComp; - pReg->pWeakRef = (typelib_TypeDescriptionReference *)pReg; + typelib_TypeDescription * pReg = &pComp->aBase; + pReg->pWeakRef = reinterpret_cast(pReg); // sizeof( void ) not allowed pReg->nSize = ::typelib_typedescription_getAlignedUnoSize( pReg, 0, pReg->nAlignment ); pReg->nAlignment = adjustAlignment( pReg->nAlignment ); pReg->bComplete = sal_False; ::typelib_typedescription_register( &pReg ); - *ppRef = (typelib_TypeDescriptionReference *)pReg; + *ppRef = reinterpret_cast(pReg); assert( *ppRef == pReg->pWeakRef ); } // another static ref: @@ -467,7 +467,7 @@ void SAL_CALL typelib_static_mi_interface_type_init( { typelib_InterfaceTypeDescription * pIface = 0; ::typelib_typedescription_newEmpty( - (typelib_TypeDescription **)&pIface, typelib_TypeClass_INTERFACE, aTypeName.pData ); + reinterpret_cast(&pIface), typelib_TypeClass_INTERFACE, aTypeName.pData ); pIface->nBaseTypes = std::max< sal_Int32 >(nBaseTypes, 1); pIface->ppBaseTypes = new typelib_InterfaceTypeDescription *[ @@ -477,7 +477,7 @@ void SAL_CALL typelib_static_mi_interface_type_init( for (sal_Int32 i = 0; i < nBaseTypes; ++i) { pIface->ppBaseTypes[i] = 0; ::typelib_typedescriptionreference_getDescription( - (typelib_TypeDescription **)&pIface->ppBaseTypes[i], ppBaseTypes[i] ); + reinterpret_cast(&pIface->ppBaseTypes[i]), ppBaseTypes[i] ); assert( pIface->ppBaseTypes[i] ); } } @@ -485,7 +485,7 @@ void SAL_CALL typelib_static_mi_interface_type_init( { pIface->ppBaseTypes[0] = 0; ::typelib_typedescriptionreference_getDescription( - (typelib_TypeDescription **)&pIface->ppBaseTypes[0], + reinterpret_cast(&pIface->ppBaseTypes[0]), * ::typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ) ); assert( pIface->ppBaseTypes[0] ); } @@ -493,8 +493,8 @@ void SAL_CALL typelib_static_mi_interface_type_init( typelib_typedescription_acquire( &pIface->pBaseTypeDescription->aBase); - typelib_TypeDescription * pReg = (typelib_TypeDescription *)pIface; - pReg->pWeakRef = (typelib_TypeDescriptionReference *)pReg; + typelib_TypeDescription * pReg = &pIface->aBase; + pReg->pWeakRef = reinterpret_cast(pReg); // sizeof( void ) not allowed pReg->nSize = ::typelib_typedescription_getAlignedUnoSize( pReg, 0, pReg->nAlignment ); @@ -502,7 +502,7 @@ void SAL_CALL typelib_static_mi_interface_type_init( pReg->bComplete = sal_False; ::typelib_typedescription_register( &pReg ); - *ppRef = (typelib_TypeDescriptionReference *)pReg; + *ppRef = reinterpret_cast(pReg); assert( *ppRef == pReg->pWeakRef ); } // another static ref: @@ -531,18 +531,18 @@ void SAL_CALL typelib_static_enum_type_init( typelib_TypeDescription * pReg = 0; ::typelib_typedescription_newEmpty( &pReg, typelib_TypeClass_ENUM, aTypeName.pData ); - typelib_EnumTypeDescription * pEnum = (typelib_EnumTypeDescription *)pReg; + typelib_EnumTypeDescription * pEnum = reinterpret_cast(pReg); pEnum->nDefaultEnumValue = nDefaultValue; - pReg->pWeakRef = (typelib_TypeDescriptionReference *)pReg; + pReg->pWeakRef = reinterpret_cast(pReg); // sizeof( void ) not allowed pReg->nSize = ::typelib_typedescription_getAlignedUnoSize( pReg, 0, pReg->nAlignment ); pReg->nAlignment = ::adjustAlignment( pReg->nAlignment ); pReg->bComplete = sal_False; ::typelib_typedescription_register( &pReg ); - *ppRef = (typelib_TypeDescriptionReference *)pReg; + *ppRef = reinterpret_cast(pReg); assert( *ppRef == pReg->pWeakRef ); } // another static ref: diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 89427072ea4a..223549e34b91 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -382,7 +382,7 @@ extern "C" void SAL_CALL typelib_typedescription_revokeCallback( static inline void typelib_typedescription_initTables( typelib_TypeDescription * pTD ) { - typelib_InterfaceTypeDescription * pITD = (typelib_InterfaceTypeDescription *)pTD; + typelib_InterfaceTypeDescription * pITD = reinterpret_cast(pTD); sal_Bool * pReadWriteAttributes = (sal_Bool *)alloca( pITD->nAllMembers ); for ( sal_Int32 i = pITD->nAllMembers; i--; ) @@ -395,7 +395,7 @@ static inline void typelib_typedescription_initTables( OSL_ASSERT( pM ); if (pM) { - pReadWriteAttributes[i] = !((typelib_InterfaceAttributeTypeDescription *)pM)->bReadOnly; + pReadWriteAttributes[i] = !reinterpret_cast(pM)->bReadOnly; TYPELIB_DANGER_RELEASE( pM ); } #if OSL_DEBUG_LEVEL > 1 @@ -470,7 +470,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool initTables) { !reallyWeak( (*ppTypeDescr)->eTypeClass ) ); if (typelib_TypeClass_INTERFACE == (*ppTypeDescr)->eTypeClass && - ((typelib_InterfaceTypeDescription *)*ppTypeDescr)->ppAllMembers) + reinterpret_cast(*ppTypeDescr)->ppAllMembers) { if (initTables) { typelib_typedescription_initTables( *ppTypeDescr ); @@ -487,7 +487,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool initTables) { if (typelib_TypeClass_TYPEDEF == pTD->eTypeClass) { typelib_typedescriptionreference_getDescription( - &pTD, ((typelib_IndirectTypeDescription *)pTD)->pType ); + &pTD, reinterpret_cast(pTD)->pType ); OSL_ASSERT( pTD ); if (! pTD) return false; @@ -502,7 +502,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool initTables) { && !pTD->bComplete && initTables) { // mandatory info from callback chain - OSL_ASSERT( ((typelib_InterfaceTypeDescription *)pTD)->ppAllMembers ); + OSL_ASSERT( reinterpret_cast(pTD)->ppAllMembers ); // complete except of tables init typelib_typedescription_initTables( pTD ); pTD->bComplete = sal_True; @@ -569,7 +569,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( case typelib_TypeClass_SEQUENCE: { typelib_IndirectTypeDescription * pTmp = new typelib_IndirectTypeDescription(); - pRet = (typelib_TypeDescription *)pTmp; + pRet = &pTmp->aBase; #if OSL_DEBUG_LEVEL > 1 osl_atomic_increment( &Init::get().nIndirectTypeDescriptionCount ); #endif @@ -582,7 +582,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( // FEATURE_EMPTYCLASS typelib_StructTypeDescription * pTmp; pTmp = new typelib_StructTypeDescription(); - pRet = (typelib_TypeDescription *)pTmp; + pRet = &pTmp->aBase.aBase; #if OSL_DEBUG_LEVEL > 1 osl_atomic_increment( &Init::get().nCompoundTypeDescriptionCount ); #endif @@ -600,7 +600,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( // FEATURE_EMPTYCLASS typelib_CompoundTypeDescription * pTmp; pTmp = new typelib_CompoundTypeDescription(); - pRet = (typelib_TypeDescription *)pTmp; + pRet = &pTmp->aBase; #if OSL_DEBUG_LEVEL > 1 osl_atomic_increment( &Init::get().nCompoundTypeDescriptionCount ); #endif @@ -615,7 +615,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( case typelib_TypeClass_ENUM: { typelib_EnumTypeDescription * pTmp = new typelib_EnumTypeDescription(); - pRet = (typelib_TypeDescription *)pTmp; + pRet = &pTmp->aBase; #if OSL_DEBUG_LEVEL > 1 osl_atomic_increment( &Init::get().nEnumTypeDescriptionCount ); #endif @@ -629,7 +629,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( case typelib_TypeClass_INTERFACE: { typelib_InterfaceTypeDescription * pTmp = new typelib_InterfaceTypeDescription(); - pRet = (typelib_TypeDescription *)pTmp; + pRet = &pTmp->aBase; #if OSL_DEBUG_LEVEL > 1 osl_atomic_increment( &Init::get().nInterfaceTypeDescriptionCount ); #endif @@ -649,7 +649,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( case typelib_TypeClass_INTERFACE_METHOD: { typelib_InterfaceMethodTypeDescription * pTmp = new typelib_InterfaceMethodTypeDescription(); - pRet = (typelib_TypeDescription *)pTmp; + pRet = &pTmp->aBase.aBase; #if OSL_DEBUG_LEVEL > 1 osl_atomic_increment( &Init::get().nInterfaceMethodTypeDescriptionCount ); #endif @@ -668,7 +668,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( case typelib_TypeClass_INTERFACE_ATTRIBUTE: { typelib_InterfaceAttributeTypeDescription * pTmp = new typelib_InterfaceAttributeTypeDescription(); - pRet = (typelib_TypeDescription *)pTmp; + pRet = &pTmp->aBase.aBase; #if OSL_DEBUG_LEVEL > 1 osl_atomic_increment( &Init::get().nInterfaceAttributeTypeDescriptionCount ); #endif @@ -736,7 +736,7 @@ void newTypeDescription( { OSL_ASSERT( nMembers == 0 ); typelib_typedescriptionreference_acquire( pType ); - ((typelib_IndirectTypeDescription *)*ppRet)->pType = pType; + reinterpret_cast(*ppRet)->pType = pType; } break; @@ -744,15 +744,15 @@ void newTypeDescription( case typelib_TypeClass_STRUCT: { // FEATURE_EMPTYCLASS - typelib_CompoundTypeDescription * pTmp = (typelib_CompoundTypeDescription*)*ppRet; + typelib_CompoundTypeDescription * pTmp = reinterpret_cast(*ppRet); sal_Int32 nOffset = 0; if( pType ) { typelib_typedescriptionreference_getDescription( - (typelib_TypeDescription **)&pTmp->pBaseTypeDescription, pType ); - nOffset = ((typelib_TypeDescription *)pTmp->pBaseTypeDescription)->nSize; - OSL_ENSURE( newAlignedSize( 0, ((typelib_TypeDescription *)pTmp->pBaseTypeDescription)->nSize, ((typelib_TypeDescription *)pTmp->pBaseTypeDescription)->nAlignment ) == ((typelib_TypeDescription *)pTmp->pBaseTypeDescription)->nSize, "### unexpected offset!" ); + reinterpret_cast(&pTmp->pBaseTypeDescription), pType ); + nOffset = pTmp->pBaseTypeDescription->aBase.nSize; + OSL_ENSURE( newAlignedSize( 0, pTmp->pBaseTypeDescription->aBase.nSize, pTmp->pBaseTypeDescription->aBase.nAlignment ) == pTmp->pBaseTypeDescription->aBase.nSize, "### unexpected offset!" ); } if( nMembers ) { @@ -823,7 +823,7 @@ void newTypeDescription( } if( !reallyWeak( eTypeClass ) ) - (*ppRet)->pWeakRef = (typelib_TypeDescriptionReference *)*ppRet; + (*ppRet)->pWeakRef = reinterpret_cast(*ppRet); if( eTypeClass != typelib_TypeClass_VOID ) { // sizeof( void ) not allowed @@ -871,7 +871,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEnum( SAL_THROW_EXTERN_C() { typelib_typedescription_newEmpty( ppRet, typelib_TypeClass_ENUM, pTypeName ); - typelib_EnumTypeDescription * pEnum = (typelib_EnumTypeDescription *)*ppRet; + typelib_EnumTypeDescription * pEnum = reinterpret_cast(*ppRet); pEnum->nDefaultEnumValue = nDefaultValue; pEnum->nEnumValues = nEnumValues; @@ -883,7 +883,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEnum( pEnum->pEnumValues = new sal_Int32[ nEnumValues ]; ::memcpy( pEnum->pEnumValues, pEnumValues, nEnumValues * sizeof(sal_Int32) ); - (*ppRet)->pWeakRef = (typelib_TypeDescriptionReference *)*ppRet; + (*ppRet)->pWeakRef = reinterpret_cast(*ppRet); // sizeof( void ) not allowed (*ppRet)->nSize = typelib_typedescription_getAlignedUnoSize( (*ppRet), 0, (*ppRet)->nAlignment ); (*ppRet)->nAlignment = adjustAlignment( (*ppRet)->nAlignment ); @@ -995,7 +995,7 @@ extern "C" void SAL_CALL typelib_typedescription_newMIInterface( typelib_InterfaceTypeDescription * pITD = 0; typelib_typedescription_newEmpty( - (typelib_TypeDescription **)&pITD, typelib_TypeClass_INTERFACE, pTypeName ); + reinterpret_cast(&pITD), typelib_TypeClass_INTERFACE, pTypeName ); pITD->nBaseTypes = nBaseInterfaces; pITD->ppBaseTypes = new typelib_InterfaceTypeDescription *[nBaseInterfaces]; @@ -1076,9 +1076,9 @@ extern "C" void SAL_CALL typelib_typedescription_newMIInterface( } } - typelib_TypeDescription * pTmp = (typelib_TypeDescription *)pITD; + typelib_TypeDescription * pTmp = &pITD->aBase; if( !reallyWeak( typelib_TypeClass_INTERFACE ) ) - pTmp->pWeakRef = (typelib_TypeDescriptionReference *)pTmp; + pTmp->pWeakRef = reinterpret_cast(pTmp); pTmp->nSize = typelib_typedescription_getAlignedUnoSize( pTmp, 0, pTmp->nAlignment ); pTmp->nAlignment = adjustAlignment( pTmp->nAlignment ); pTmp->bComplete = sal_False; @@ -1147,8 +1147,8 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceMethod( } typelib_typedescription_newEmpty( - (typelib_TypeDescription **)ppRet, typelib_TypeClass_INTERFACE_METHOD, pTypeName ); - typelib_TypeDescription * pTmp = (typelib_TypeDescription *)*ppRet; + reinterpret_cast(ppRet), typelib_TypeClass_INTERFACE_METHOD, pTypeName ); + typelib_TypeDescription * pTmp = reinterpret_cast(*ppRet); rtl_uString_newFromStr_WithLength( &(*ppRet)->aBase.pMemberName, pTypeName->buffer + nOffset +1, @@ -1184,7 +1184,7 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceMethod( (*ppRet)->nIndex = nAbsolutePosition - (pInterface->nAllMembers - pInterface->nMembers); if( !reallyWeak( typelib_TypeClass_INTERFACE_METHOD ) ) - pTmp->pWeakRef = (typelib_TypeDescriptionReference *)pTmp; + pTmp->pWeakRef = reinterpret_cast(pTmp); } @@ -1240,8 +1240,8 @@ extern "C" void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute( } typelib_typedescription_newEmpty( - (typelib_TypeDescription **)ppRet, typelib_TypeClass_INTERFACE_ATTRIBUTE, pTypeName ); - typelib_TypeDescription * pTmp = (typelib_TypeDescription *)*ppRet; + reinterpret_cast(ppRet), typelib_TypeClass_INTERFACE_ATTRIBUTE, pTypeName ); + typelib_TypeDescription * pTmp = reinterpret_cast(*ppRet); rtl_uString_newFromStr_WithLength( &(*ppRet)->aBase.pMemberName, pTypeName->buffer + nOffset +1, @@ -1263,7 +1263,7 @@ extern "C" void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute( (*ppRet)->ppSetExceptions = copyExceptions( nSetExceptions, ppSetExceptionNames); if( !reallyWeak( typelib_TypeClass_INTERFACE_ATTRIBUTE ) ) - pTmp->pWeakRef = (typelib_TypeDescriptionReference *)pTmp; + pTmp->pWeakRef = reinterpret_cast(pTmp); } @@ -1298,8 +1298,8 @@ static inline void typelib_typedescription_destructExtendedMembers( switch( pTD->eTypeClass ) { case typelib_TypeClass_SEQUENCE: - if( ((typelib_IndirectTypeDescription*)pTD)->pType ) - typelib_typedescriptionreference_release( ((typelib_IndirectTypeDescription*)pTD)->pType ); + if( reinterpret_cast(pTD)->pType ) + typelib_typedescriptionreference_release( reinterpret_cast(pTD)->pType ); break; case typelib_TypeClass_STRUCT: delete[] reinterpret_cast< typelib_StructTypeDescription * >(pTD)-> @@ -1307,9 +1307,9 @@ static inline void typelib_typedescription_destructExtendedMembers( // Fall-through intentional case typelib_TypeClass_EXCEPTION: { - typelib_CompoundTypeDescription * pCTD = (typelib_CompoundTypeDescription*)pTD; + typelib_CompoundTypeDescription * pCTD = reinterpret_cast(pTD); if( pCTD->pBaseTypeDescription ) - typelib_typedescription_release( (typelib_TypeDescription *)pCTD->pBaseTypeDescription ); + typelib_typedescription_release( &pCTD->pBaseTypeDescription->aBase ); sal_Int32 i; for( i = 0; i < pCTD->nMembers; i++ ) { @@ -1329,7 +1329,7 @@ static inline void typelib_typedescription_destructExtendedMembers( break; case typelib_TypeClass_INTERFACE: { - typelib_InterfaceTypeDescription * pITD = (typelib_InterfaceTypeDescription*)pTD; + typelib_InterfaceTypeDescription * pITD = reinterpret_cast(pTD); for( sal_Int32 i = 0; i < pITD->nAllMembers; i++ ) { typelib_typedescriptionreference_release( pITD->ppAllMembers[i] ); @@ -1347,7 +1347,7 @@ static inline void typelib_typedescription_destructExtendedMembers( } case typelib_TypeClass_INTERFACE_METHOD: { - typelib_InterfaceMethodTypeDescription * pIMTD = (typelib_InterfaceMethodTypeDescription*)pTD; + typelib_InterfaceMethodTypeDescription * pIMTD = reinterpret_cast(pTD); if( pIMTD->pReturnTypeRef ) typelib_typedescriptionreference_release( pIMTD->pReturnTypeRef ); for( sal_Int32 i = 0; i < pIMTD->nParams; i++ ) @@ -1366,7 +1366,7 @@ static inline void typelib_typedescription_destructExtendedMembers( break; case typelib_TypeClass_INTERFACE_ATTRIBUTE: { - typelib_InterfaceAttributeTypeDescription * pIATD = (typelib_InterfaceAttributeTypeDescription*)pTD; + typelib_InterfaceAttributeTypeDescription * pIATD = reinterpret_cast(pTD); deleteExceptions(pIATD->nGetExceptions, pIATD->ppGetExceptions); deleteExceptions(pIATD->nSetExceptions, pIATD->ppSetExceptions); if( pIATD->pAttributeTypeRef ) @@ -1381,7 +1381,7 @@ static inline void typelib_typedescription_destructExtendedMembers( break; case typelib_TypeClass_ENUM: { - typelib_EnumTypeDescription * pEnum = (typelib_EnumTypeDescription *)pTD; + typelib_EnumTypeDescription * pEnum = reinterpret_cast(pTD); for ( sal_Int32 nPos = pEnum->nEnumValues; nPos--; ) { rtl_uString_release( pEnum->ppEnumNames[nPos] ); @@ -1519,8 +1519,8 @@ extern "C" void SAL_CALL typelib_typedescription_register( (!pTDR->pType->bComplete && (*ppNewDescription)->bComplete) || // new one may be partly initialized interface (except of tables): (typelib_TypeClass_INTERFACE == pTDR->pType->eTypeClass && - !((typelib_InterfaceTypeDescription *)pTDR->pType)->ppAllMembers && - (*(typelib_InterfaceTypeDescription **)ppNewDescription)->ppAllMembers))) + !reinterpret_cast(pTDR->pType)->ppAllMembers && + (*reinterpret_cast(ppNewDescription))->ppAllMembers))) { // uninitialized or incomplete @@ -1579,7 +1579,7 @@ extern "C" void SAL_CALL typelib_typedescription_register( } else { - pTDR = (typelib_TypeDescriptionReference *)*ppNewDescription; + pTDR = reinterpret_cast(*ppNewDescription); if( !rInit.pWeakMap ) rInit.pWeakMap = new WeakMap_Impl; @@ -1604,7 +1604,7 @@ extern "C" void SAL_CALL typelib_typedescription_register( static inline bool type_equals( - typelib_TypeDescriptionReference * p1, typelib_TypeDescriptionReference * p2 ) + typelib_TypeDescriptionReference const * p1, typelib_TypeDescriptionReference const * p2 ) { return (p1 == p2 || (p1->eTypeClass == p2->eTypeClass && @@ -1616,7 +1616,7 @@ extern "C" sal_Bool SAL_CALL typelib_typedescription_equals( SAL_THROW_EXTERN_C() { return type_equals( - (typelib_TypeDescriptionReference *)p1, (typelib_TypeDescriptionReference *)p2 ); + reinterpret_cast(p1), reinterpret_cast(p2) ); } @@ -1652,7 +1652,7 @@ extern "C" sal_Int32 SAL_CALL typelib_typedescription_getAlignedUnoSize( case typelib_TypeClass_EXCEPTION: // FEATURE_EMPTYCLASS { - typelib_CompoundTypeDescription * pTmp = (typelib_CompoundTypeDescription *)pTypeDescription; + typelib_CompoundTypeDescription const * pTmp = reinterpret_cast(pTypeDescription); sal_Int32 nStructSize = 0; if( pTmp->pBaseTypeDescription ) { @@ -2026,7 +2026,7 @@ extern "C" void SAL_CALL typelib_typedescription_getByName( { typelib_TypeDescription * pTD = 0; typelib_typedescriptionreference_getDescription( - &pTD, ((typelib_IndirectTypeDescription *)*ppRet)->pType ); + &pTD, reinterpret_cast(*ppRet)->pType ); typelib_typedescription_release( *ppRet ); *ppRet = pTD; } @@ -2082,10 +2082,10 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_new( if (typelib_TypeClass_TYPEDEF == pRet->eTypeClass) { typelib_typedescriptionreference_acquire( - ((typelib_IndirectTypeDescription *)pRet)->pType ); + reinterpret_cast(pRet)->pType ); if (*ppTDR) typelib_typedescriptionreference_release( *ppTDR ); - *ppTDR = ((typelib_IndirectTypeDescription *)pRet)->pType; + *ppTDR = reinterpret_cast(pRet)->pType; typelib_typedescription_release( pRet ); } else @@ -2148,10 +2148,10 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_new( } else { - typelib_typedescription_newEmpty( (typelib_TypeDescription ** )ppTDR, eTypeClass, pTypeName ); + typelib_typedescription_newEmpty( reinterpret_cast(ppTDR), eTypeClass, pTypeName ); // description will be registered but not acquired - (*(typelib_TypeDescription ** )ppTDR)->bOnDemand = sal_True; - (*(typelib_TypeDescription ** )ppTDR)->bComplete = sal_False; + (*reinterpret_cast(ppTDR))->bOnDemand = sal_True; + (*reinterpret_cast(ppTDR))->bComplete = sal_False; } if( !rInit.pWeakMap ) @@ -2201,7 +2201,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_release( } else { - typelib_typedescription_release( (typelib_TypeDescription *)pRef ); + typelib_typedescription_release( reinterpret_cast(pRef) ); } } @@ -2219,8 +2219,8 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_getDescription( if( !reallyWeak( pRef->eTypeClass ) && pRef->pType && pRef->pType->pWeakRef ) { // reference is a description and initialized - osl_atomic_increment( &((typelib_TypeDescription *)pRef)->nRefCount ); - *ppRet = (typelib_TypeDescription *)pRef; + osl_atomic_increment( &reinterpret_cast(pRef)->nRefCount ); + *ppRet = reinterpret_cast(pRef); return; } @@ -2380,14 +2380,14 @@ extern "C" sal_Bool SAL_CALL typelib_typedescriptionreference_isAssignableFrom( { typelib_TypeDescription * pFromDescr = 0; TYPELIB_DANGER_GET( &pFromDescr, pFrom ); - if (! ((typelib_CompoundTypeDescription *)pFromDescr)->pBaseTypeDescription) + if (!reinterpret_cast(pFromDescr)->pBaseTypeDescription) { TYPELIB_DANGER_RELEASE( pFromDescr ); return sal_False; } bool bRet = typelib_typedescriptionreference_isAssignableFrom( pAssignable, - ((typelib_TypeDescription *)((typelib_CompoundTypeDescription *)pFromDescr)->pBaseTypeDescription)->pWeakRef ); + reinterpret_cast(pFromDescr)->pBaseTypeDescription->aBase.pWeakRef ); TYPELIB_DANGER_RELEASE( pFromDescr ); return bRet; } diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx index 731ee46de3e8..abc39a5d05f9 100644 --- a/cppu/source/uno/EnvStack.cxx +++ b/cppu/source/uno/EnvStack.cxx @@ -365,7 +365,7 @@ int SAL_CALL uno_Environment_isValid(uno_Environment * pEnv, rtl_uString ** pRea { cppu::Enterable * pEnterable = reinterpret_cast(pEnv->pReserved); if (pEnterable) - result = pEnterable->isValid((rtl::OUString *)pReason); + result = pEnterable->isValid(reinterpret_cast(pReason)); } else { @@ -374,7 +374,7 @@ int SAL_CALL uno_Environment_isValid(uno_Environment * pEnv, rtl_uString ** pRea uno::Environment env(envDcp); - result = env.isValid((rtl::OUString *)pReason); + result = env.isValid(reinterpret_cast(pReason)); } return result; diff --git a/cppu/source/uno/assign.hxx b/cppu/source/uno/assign.hxx index 28a4917b46b1..473cd8659071 100644 --- a/cppu/source/uno/assign.hxx +++ b/cppu/source/uno/assign.hxx @@ -356,10 +356,9 @@ inline bool _assignData( if (pSourceTypeDescr) { typelib_CompoundTypeDescription * pTypeDescr = - (typelib_CompoundTypeDescription *)pSourceTypeDescr; + reinterpret_cast(pSourceTypeDescr); while (pTypeDescr && - !_type_equals( - ((typelib_TypeDescription *)pTypeDescr)->pWeakRef, pDestType )) + !_type_equals(pTypeDescr->aBase.pWeakRef, pDestType)) { pTypeDescr = pTypeDescr->pBaseTypeDescription; } @@ -373,10 +372,9 @@ inline bool _assignData( { TYPELIB_DANGER_GET( &pSourceTypeDescr, pSourceType ); typelib_CompoundTypeDescription * pTypeDescr = - (typelib_CompoundTypeDescription *)pSourceTypeDescr; + reinterpret_cast(pSourceTypeDescr); while (pTypeDescr && - !_type_equals( - ((typelib_TypeDescription *)pTypeDescr)->pWeakRef, pDestType )) + !_type_equals(pTypeDescr->aBase.pWeakRef, pDestType)) { pTypeDescr = pTypeDescr->pBaseTypeDescription; } @@ -429,8 +427,7 @@ inline bool _assignData( typelib_TypeDescription * pTD = pSourceTypeDescr; while (pTD && !_type_equals( pTD->pWeakRef, pDestType )) { - pTD = (typelib_TypeDescription *) - ((typelib_InterfaceTypeDescription *)pTD)->pBaseTypeDescription; + pTD = &(reinterpret_cast(pTD))->pBaseTypeDescription->aBase; } if (pTD) // is base of dest { diff --git a/cppu/source/uno/constr.hxx b/cppu/source/uno/constr.hxx index a174b805f749..10e12a933b83 100644 --- a/cppu/source/uno/constr.hxx +++ b/cppu/source/uno/constr.hxx @@ -101,12 +101,12 @@ inline void _defaultConstructData( case typelib_TypeClass_ENUM: if (pTypeDescr) { - *(sal_Int32 *)pMem = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue; + *(sal_Int32 *)pMem = reinterpret_cast(pTypeDescr)->nDefaultEnumValue; } else { TYPELIB_DANGER_GET( &pTypeDescr, pType ); - *(sal_Int32 *)pMem = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue; + *(sal_Int32 *)pMem = reinterpret_cast(pTypeDescr)->nDefaultEnumValue; TYPELIB_DANGER_RELEASE( pTypeDescr ); } break; @@ -114,12 +114,12 @@ inline void _defaultConstructData( case typelib_TypeClass_EXCEPTION: if (pTypeDescr) { - _defaultConstructStruct( pMem, (typelib_CompoundTypeDescription *)pTypeDescr ); + _defaultConstructStruct( pMem, reinterpret_cast(pTypeDescr) ); } else { TYPELIB_DANGER_GET( &pTypeDescr, pType ); - _defaultConstructStruct( pMem, (typelib_CompoundTypeDescription *)pTypeDescr ); + _defaultConstructStruct( pMem, reinterpret_cast(pTypeDescr) ); TYPELIB_DANGER_RELEASE( pTypeDescr ); } break; diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx index 591f437b9551..fc2ca00ceeb2 100644 --- a/cppu/source/uno/copy.hxx +++ b/cppu/source/uno/copy.hxx @@ -180,7 +180,7 @@ inline void _copyConstructAnyFromData( pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize ); _copyConstructStruct( pDestAny->pData, pSource, - (typelib_CompoundTypeDescription *)pTypeDescr, + reinterpret_cast(pTypeDescr), acquire, mapping ); } else @@ -189,7 +189,7 @@ inline void _copyConstructAnyFromData( pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize ); _copyConstructStruct( pDestAny->pData, pSource, - (typelib_CompoundTypeDescription *)pTypeDescr, + reinterpret_cast(pTypeDescr), acquire, mapping ); TYPELIB_DANGER_RELEASE( pTypeDescr ); } @@ -200,7 +200,7 @@ inline void _copyConstructAnyFromData( { *(uno_Sequence **)pDestAny->pData = copyConstructSequence( *(uno_Sequence **)pSource, - ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, + reinterpret_cast(pTypeDescr)->pType, acquire, mapping ); } else @@ -208,7 +208,7 @@ inline void _copyConstructAnyFromData( TYPELIB_DANGER_GET( &pTypeDescr, pType ); *(uno_Sequence **)pDestAny->pData = copyConstructSequence( *(uno_Sequence **)pSource, - ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, + reinterpret_cast(pTypeDescr)->pType, acquire, mapping ); TYPELIB_DANGER_RELEASE( pTypeDescr ); } @@ -327,12 +327,12 @@ inline void _copyConstructAny( pDestAny->pData = &pDestAny->pReserved; if (pTypeDescr) { - *(sal_Int32 *)pDestAny->pData = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue; + *(sal_Int32 *)pDestAny->pData = reinterpret_cast(pTypeDescr)->nDefaultEnumValue; } else { TYPELIB_DANGER_GET( &pTypeDescr, pType ); - *(sal_Int32 *)pDestAny->pData = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue; + *(sal_Int32 *)pDestAny->pData = reinterpret_cast(pTypeDescr)->nDefaultEnumValue; TYPELIB_DANGER_RELEASE( pTypeDescr ); } break; @@ -342,14 +342,14 @@ inline void _copyConstructAny( { pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize ); _defaultConstructStruct( - pDestAny->pData, (typelib_CompoundTypeDescription *)pTypeDescr ); + pDestAny->pData, reinterpret_cast(pTypeDescr) ); } else { TYPELIB_DANGER_GET( &pTypeDescr, pType ); pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize ); _defaultConstructStruct( - pDestAny->pData, (typelib_CompoundTypeDescription *)pTypeDescr ); + pDestAny->pData, reinterpret_cast(pTypeDescr) ); TYPELIB_DANGER_RELEASE( pTypeDescr ); } break; @@ -395,8 +395,8 @@ inline uno_Sequence * icopyConstructSequence( pDest = allocSeq( sizeof (uno_Any), nElements ); if (pDest != 0) { - uno_Any * pDestElements = (uno_Any *)pDest->elements; - uno_Any * pSourceElements = (uno_Any *)pSource->elements; + uno_Any * pDestElements = reinterpret_cast(pDest->elements); + uno_Any * pSourceElements = reinterpret_cast(pSource->elements); for ( sal_Int32 nPos = nElements; nPos--; ) { typelib_TypeDescriptionReference * pType = @@ -433,8 +433,8 @@ inline uno_Sequence * icopyConstructSequence( _copyConstructStruct( pElements + (nPos * nElementSize), pSourceElements + (nPos * nElementSize), - (typelib_CompoundTypeDescription *) - pElementTypeDescr, + reinterpret_cast( + pElementTypeDescr), acquire, mapping ); } } @@ -450,13 +450,13 @@ inline uno_Sequence * icopyConstructSequence( typelib_TypeDescription * pElementTypeDescr = 0; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); typelib_TypeDescriptionReference * pSeqElementType = - ((typelib_IndirectTypeDescription *) - pElementTypeDescr)->pType; + reinterpret_cast( + pElementTypeDescr)->pType; uno_Sequence ** pDestElements = - (uno_Sequence **) pDest->elements; + reinterpret_cast(pDest->elements); uno_Sequence ** pSourceElements = - (uno_Sequence **) pSource->elements; + reinterpret_cast(pSource->elements); for ( sal_Int32 nPos = nElements; nPos--; ) { uno_Sequence * pNew = copyConstructSequence( @@ -490,8 +490,8 @@ inline uno_Sequence * icopyConstructSequence( (*mapping->mapInterface)( mapping, (void **)pElements + nPos, pSourceElements[nPos], - (typelib_InterfaceTypeDescription *) - pElementTypeDescr ); + reinterpret_cast( + pElementTypeDescr) ); } } TYPELIB_DANGER_RELEASE( pElementTypeDescr ); @@ -571,7 +571,7 @@ inline void _copyConstructData( { _copyConstructStruct( pDest, pSource, - (typelib_CompoundTypeDescription *)pTypeDescr, + reinterpret_cast(pTypeDescr), acquire, mapping ); } else @@ -579,7 +579,7 @@ inline void _copyConstructData( TYPELIB_DANGER_GET( &pTypeDescr, pType ); _copyConstructStruct( pDest, pSource, - (typelib_CompoundTypeDescription *)pTypeDescr, + reinterpret_cast(pTypeDescr), acquire, mapping ); TYPELIB_DANGER_RELEASE( pTypeDescr ); } @@ -591,7 +591,7 @@ inline void _copyConstructData( { *(uno_Sequence **)pDest = icopyConstructSequence( *(uno_Sequence **)pSource, - ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, + reinterpret_cast(pTypeDescr)->pType, acquire, mapping ); } else @@ -599,7 +599,7 @@ inline void _copyConstructData( TYPELIB_DANGER_GET( &pTypeDescr, pType ); *(uno_Sequence **)pDest = icopyConstructSequence( *(uno_Sequence **)pSource, - ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, + reinterpret_cast(pTypeDescr)->pType, acquire, mapping ); TYPELIB_DANGER_RELEASE( pTypeDescr ); } diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx index d69bfb649a09..6b831000a4b8 100644 --- a/cppu/source/uno/data.cxx +++ b/cppu/source/uno/data.cxx @@ -57,11 +57,11 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p typelib_TypeDescriptionReference * type_XInterface = * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); typelib_InterfaceTypeDescription * pTXInterfaceDescr = 0; - TYPELIB_DANGER_GET( (typelib_TypeDescription **) &pTXInterfaceDescr, type_XInterface ); + TYPELIB_DANGER_GET( reinterpret_cast(&pTXInterfaceDescr), type_XInterface ); assert(pTXInterfaceDescr->ppAllMembers); typelib_typedescriptionreference_getDescription( &g_pQITD, pTXInterfaceDescr->ppAllMembers[ 0 ] ); - TYPELIB_DANGER_RELEASE( (typelib_TypeDescription *) pTXInterfaceDescr ); + TYPELIB_DANGER_RELEASE( &pTXInterfaceDescr->aBase ); } } diff --git a/cppu/source/uno/destr.hxx b/cppu/source/uno/destr.hxx index 95f496e10c56..89144742d4a0 100644 --- a/cppu/source/uno/destr.hxx +++ b/cppu/source/uno/destr.hxx @@ -115,7 +115,7 @@ inline void _destructAny( { typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pType ); - _destructStruct( pAny->pData, (typelib_CompoundTypeDescription *)pTypeDescr, release ); + _destructStruct( pAny->pData, reinterpret_cast(pTypeDescr), release ); TYPELIB_DANGER_RELEASE( pTypeDescr ); ::rtl_freeMemory( pAny->pData ); break; @@ -205,7 +205,7 @@ inline sal_Int32 idestructElements( { _destructStruct( (char *)pElements + (nElementSize * nPos), - (typelib_CompoundTypeDescription *)pElementTypeDescr, + reinterpret_cast(pElementTypeDescr), release ); } sal_Int32 nSize = pElementTypeDescr->nSize; @@ -273,7 +273,7 @@ inline void idestroySequence( { idestructElements( pSeq->elements, - ((typelib_IndirectTypeDescription *) pTypeDescr)->pType, 0, + reinterpret_cast(pTypeDescr)->pType, 0, pSeq->nElements, release ); } else @@ -281,7 +281,7 @@ inline void idestroySequence( TYPELIB_DANGER_GET( &pTypeDescr, pType ); idestructElements( pSeq->elements, - ((typelib_IndirectTypeDescription *) pTypeDescr)->pType, 0, + reinterpret_cast(pTypeDescr)->pType, 0, pSeq->nElements, release ); TYPELIB_DANGER_RELEASE( pTypeDescr ); } @@ -325,12 +325,12 @@ inline void _destructData( case typelib_TypeClass_EXCEPTION: if (pTypeDescr) { - _destructStruct( pValue, (typelib_CompoundTypeDescription *)pTypeDescr, release ); + _destructStruct( pValue, reinterpret_cast(pTypeDescr), release ); } else { TYPELIB_DANGER_GET( &pTypeDescr, pType ); - _destructStruct( pValue, (typelib_CompoundTypeDescription *)pTypeDescr, release ); + _destructStruct( pValue, reinterpret_cast(pTypeDescr), release ); TYPELIB_DANGER_RELEASE( pTypeDescr ); } break; diff --git a/cppu/source/uno/eq.hxx b/cppu/source/uno/eq.hxx index dc064bef28b6..5c6a973d05a2 100644 --- a/cppu/source/uno/eq.hxx +++ b/cppu/source/uno/eq.hxx @@ -211,7 +211,7 @@ inline bool _equalSequence( { if (! _equalStruct( (char *)pDestElements + (nPos * nElementSize), (char *)pSourceElements + (nPos * nElementSize), - (typelib_CompoundTypeDescription *)pElementTypeDescr, + reinterpret_cast(pElementTypeDescr), queryInterface, release )) { TYPELIB_DANGER_RELEASE( pElementTypeDescr ); @@ -226,7 +226,7 @@ inline bool _equalSequence( typelib_TypeDescription * pElementTypeDescr = 0; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); typelib_TypeDescriptionReference * pSeqElementType = - ((typelib_IndirectTypeDescription *)pElementTypeDescr)->pType; + reinterpret_cast(pElementTypeDescr)->pType; for ( sal_Int32 nPos = nElements; nPos--; ) { if (! equalSequence( ((uno_Sequence **)pDestElements)[nPos], @@ -541,7 +541,7 @@ inline bool _equalData( { return _equalStruct( pDest, pSource, - (typelib_CompoundTypeDescription *)pDestTypeDescr, + reinterpret_cast(pDestTypeDescr), queryInterface, release ); } else @@ -549,7 +549,7 @@ inline bool _equalData( TYPELIB_DANGER_GET( &pDestTypeDescr, pDestType ); bool bRet = _equalStruct( pDest, pSource, - (typelib_CompoundTypeDescription *)pDestTypeDescr, + reinterpret_cast(pDestTypeDescr), queryInterface, release ); TYPELIB_DANGER_RELEASE( pDestTypeDescr ); return bRet; @@ -561,7 +561,7 @@ inline bool _equalData( { return _equalSequence( *(uno_Sequence **)pDest, *(uno_Sequence **)pSource, - ((typelib_IndirectTypeDescription *)pDestTypeDescr)->pType, + reinterpret_cast(pDestTypeDescr)->pType, queryInterface, release ); } else @@ -569,7 +569,7 @@ inline bool _equalData( TYPELIB_DANGER_GET( &pDestTypeDescr, pDestType ); bool bRet = _equalSequence( *(uno_Sequence **)pDest, *(uno_Sequence **)pSource, - ((typelib_IndirectTypeDescription *)pDestTypeDescr)->pType, + reinterpret_cast(pDestTypeDescr)->pType, queryInterface, release ); TYPELIB_DANGER_RELEASE( pDestTypeDescr ); return bRet; diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index 721005d6a5ed..5cba0fcf4184 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -57,11 +57,10 @@ inline static bool td_equals( typelib_InterfaceTypeDescription * pTD1, typelib_InterfaceTypeDescription * pTD2 ) { return (pTD1 == pTD2 || - (((typelib_TypeDescription *)pTD1)->pTypeName->length == - ((typelib_TypeDescription *)pTD2)->pTypeName->length && + (pTD1->aBase.pTypeName->length == pTD2->aBase.pTypeName->length && ::rtl_ustr_compare( - ((typelib_TypeDescription *) pTD1)->pTypeName->buffer, - ((typelib_TypeDescription *) pTD2)->pTypeName->buffer ) == 0)); + pTD1->aBase.pTypeName->buffer, + pTD2->aBase.pTypeName->buffer ) == 0)); } struct ObjectEntry; @@ -170,7 +169,7 @@ inline void ObjectEntry::append( aNewEntry.refCount = 1; aNewEntry.pInterface = pInterface; aNewEntry.fpFreeProxy = fpFreeProxy; - typelib_typedescription_acquire( (typelib_TypeDescription *) pTypeDescr ); + typelib_typedescription_acquire( &pTypeDescr->aBase ); aNewEntry.pTypeDescr = pTypeDescr; ::std::pair< Ptr2ObjectMap::iterator, bool > i( @@ -194,8 +193,7 @@ inline InterfaceEntry * ObjectEntry::find( // shortcut common case: OUString const & type_name = - OUString::unacquired( - &((typelib_TypeDescription *) pTypeDescr_)->pTypeName ); + OUString::unacquired( &pTypeDescr_->aBase.pTypeName ); if ( type_name == "com.sun.star.uno.XInterface" ) { return &aInterfaces[ 0 ]; @@ -370,8 +368,7 @@ static void SAL_CALL s_stub_defenv_revokeInterface(va_list * pParam) for ( nPos = pOEntry->aInterfaces.size(); nPos--; ) { InterfaceEntry const & rEntry = pOEntry->aInterfaces[nPos]; - typelib_typedescription_release( - (typelib_TypeDescription *) rEntry.pTypeDescr ); + typelib_typedescription_release( &rEntry.pTypeDescr->aBase ); if (rEntry.fpFreeProxy) // is proxy or used interface? { (*rEntry.fpFreeProxy)( pEnv, rEntry.pInterface ); @@ -522,7 +519,7 @@ static void SAL_CALL defenv_getRegisteredInterfaces( static void SAL_CALL defenv_acquire( uno_Environment * pEnv ) { - uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv; + uno_DefaultEnvironment * that = reinterpret_cast(pEnv); osl_atomic_increment( &that->nWeakRef ); osl_atomic_increment( &that->nRef ); } @@ -530,7 +527,7 @@ static void SAL_CALL defenv_acquire( uno_Environment * pEnv ) static void SAL_CALL defenv_release( uno_Environment * pEnv ) { - uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv; + uno_DefaultEnvironment * that = reinterpret_cast(pEnv); if (! osl_atomic_decrement( &that->nRef )) { // invoke dispose callback @@ -551,14 +548,14 @@ static void SAL_CALL defenv_release( uno_Environment * pEnv ) static void SAL_CALL defenv_acquireWeak( uno_Environment * pEnv ) { - uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv; + uno_DefaultEnvironment * that = reinterpret_cast(pEnv); osl_atomic_increment( &that->nWeakRef ); } static void SAL_CALL defenv_releaseWeak( uno_Environment * pEnv ) { - uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv; + uno_DefaultEnvironment * that = reinterpret_cast(pEnv); if (! osl_atomic_decrement( &that->nWeakRef )) { delete that; @@ -580,7 +577,7 @@ static void SAL_CALL defenv_harden( if (rData.isDisposing) return; - uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv; + uno_DefaultEnvironment * that = reinterpret_cast(pEnv); { ::osl::MutexGuard guard( rData.mutex ); if (1 == osl_atomic_increment( &that->nRef )) // is dead @@ -636,7 +633,7 @@ uno_DefaultEnvironment::uno_DefaultEnvironment( uno_DefaultEnvironment::~uno_DefaultEnvironment() { - ::rtl_uString_release( ((uno_Environment *) this)->pTypeName ); + ::rtl_uString_release( aBase.pTypeName ); } @@ -744,8 +741,7 @@ extern "C" void SAL_CALL uno_dumpEnvironment( const InterfaceEntry & rIEntry = pOEntry->aInterfaces[nPos]; buf.append( " - " ); - buf.append( - ((typelib_TypeDescription *) rIEntry.pTypeDescr)->pTypeName ); + buf.append( rIEntry.pTypeDescr->aBase.pTypeName ); if (rIEntry.fpFreeProxy) { buf.append( "; proxy free=0x" ); @@ -870,7 +866,7 @@ static void SAL_CALL unoenv_computeObjectIdentifier( oid.append( reinterpret_cast< sal_Int64 >(pUnoI), 16 ); oid.append( ';' ); // environment[context] - oid.append( ((uno_Environment *) pEnv)->pTypeName ); + oid.append( pEnv->aBase.pTypeName ); oid.append( '[' ); oid.append( reinterpret_cast< sal_Int64 >( reinterpret_cast< @@ -1091,7 +1087,7 @@ static uno_Environment * initDefaultEnvironment( // create default environment if ( envTypeName == UNO_LB_UNO ) { - uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv; + uno_DefaultEnvironment * that = reinterpret_cast(pEnv); that->computeObjectIdentifier = unoenv_computeObjectIdentifier; that->acquireInterface = unoenv_acquireInterface; that->releaseInterface = unoenv_releaseInterface; diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx index 454653b6e4d0..aa6587f74237 100644 --- a/cppu/source/uno/lbmap.cxx +++ b/cppu/source/uno/lbmap.cxx @@ -426,7 +426,7 @@ static Mapping loadExternalMapping( if (fpGetMapFunc) { Mapping aExt; - (*fpGetMapFunc)( (uno_Mapping **)&aExt, rFrom.get(), rTo.get() ); + (*fpGetMapFunc)( reinterpret_cast(&aExt), rFrom.get(), rTo.get() ); OSL_ASSERT( aExt.is() ); if (aExt.is()) { @@ -503,7 +503,7 @@ static Mapping getMediateMapping( else { // get registered uno env - ::uno_getEnvironment( (uno_Environment **)&aUno, aUnoEnvTypeName.pData, 0 ); + ::uno_getEnvironment( reinterpret_cast(&aUno), aUnoEnvTypeName.pData, 0 ); aUno2To = getDirectMapping( aUno, rTo ); // : uno <-> to @@ -516,7 +516,7 @@ static Mapping getMediateMapping( { // create anonymous uno env Environment aAnUno; - ::uno_createEnvironment( (uno_Environment **)&aAnUno, aUnoEnvTypeName.pData, 0 ); + ::uno_createEnvironment( reinterpret_cast(&aAnUno), aUnoEnvTypeName.pData, 0 ); Mapping aAnUno2Uno( getDirectMapping( aAnUno, aUno, rAddPurpose ) ); if (! aAnUno2Uno.is()) diff --git a/cppu/source/uno/prim.hxx b/cppu/source/uno/prim.hxx index 545f239ecaa2..6f50f9282ce7 100644 --- a/cppu/source/uno/prim.hxx +++ b/cppu/source/uno/prim.hxx @@ -57,13 +57,13 @@ inline void * _map( if (pTypeDescr) { (*mapping->mapInterface)( - mapping, &pRet, p, (typelib_InterfaceTypeDescription *)pTypeDescr ); + mapping, &pRet, p, reinterpret_cast(pTypeDescr) ); } else { TYPELIB_DANGER_GET( &pTypeDescr, pType ); (*mapping->mapInterface)( - mapping, &pRet, p, (typelib_InterfaceTypeDescription *)pTypeDescr ); + mapping, &pRet, p, reinterpret_cast(pTypeDescr) ); TYPELIB_DANGER_RELEASE( pTypeDescr ); } } diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx index 2d2a894b36e9..9575fcc7c05b 100644 --- a/cppu/source/uno/sequence.cxx +++ b/cppu/source/uno/sequence.cxx @@ -152,7 +152,7 @@ static inline bool idefaultConstructElements( pSeq = reallocSeq( pSeq, sizeof(float), nAlloc ); if (pSeq != 0) { - float * pElements = (float *) pSeq->elements; + float * pElements = reinterpret_cast(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { pElements[nPos] = 0.0; @@ -166,7 +166,7 @@ static inline bool idefaultConstructElements( pSeq = reallocSeq( pSeq, sizeof(double), nAlloc ); if (pSeq != 0) { - double * pElements = (double *) pSeq->elements; + double * pElements = reinterpret_cast(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { pElements[nPos] = 0.0; @@ -180,7 +180,7 @@ static inline bool idefaultConstructElements( pSeq = reallocSeq( pSeq, sizeof(rtl_uString *), nAlloc ); if (pSeq != 0) { - rtl_uString ** pElements = (rtl_uString **) pSeq->elements; + rtl_uString ** pElements = reinterpret_cast(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { pElements[nPos] = 0; @@ -199,7 +199,7 @@ static inline bool idefaultConstructElements( if (pSeq != 0) { typelib_TypeDescriptionReference ** pElements = - (typelib_TypeDescriptionReference **) pSeq->elements; + reinterpret_cast(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { pElements[nPos] = _getVoidType(); @@ -213,7 +213,7 @@ static inline bool idefaultConstructElements( pSeq = reallocSeq( pSeq, sizeof(uno_Any), nAlloc ); if (pSeq != 0) { - uno_Any * pElements = (uno_Any *) pSeq->elements; + uno_Any * pElements = reinterpret_cast(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { CONSTRUCT_EMPTY_ANY( &pElements[nPos] ); @@ -230,11 +230,11 @@ static inline bool idefaultConstructElements( typelib_TypeDescription * pElementTypeDescr = 0; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 eEnum = - ((typelib_EnumTypeDescription *) + reinterpret_cast( pElementTypeDescr)->nDefaultEnumValue; TYPELIB_DANGER_RELEASE( pElementTypeDescr ); - sal_Int32 * pElements = (sal_Int32 *) pSeq->elements; + sal_Int32 * pElements = reinterpret_cast(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { pElements[nPos] = eEnum; @@ -258,7 +258,7 @@ static inline bool idefaultConstructElements( { _defaultConstructStruct( pElements + (nElementSize * nPos), - (typelib_CompoundTypeDescription *)pElementTypeDescr ); + reinterpret_cast(pElementTypeDescr) ); } } @@ -275,7 +275,7 @@ static inline bool idefaultConstructElements( if (pSeq != 0) { uno_Sequence ** pElements = - (uno_Sequence **) pSeq->elements; + reinterpret_cast(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { pElements[nPos] = createEmptySequence(); @@ -431,7 +431,7 @@ static inline bool icopyConstructFromElements( pSeq = reallocSeq( pSeq, sizeof(rtl_uString *), nAlloc ); if (pSeq != 0) { - rtl_uString ** pDestElements = (rtl_uString **) pSeq->elements; + rtl_uString ** pDestElements = reinterpret_cast(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { // This code tends to trigger coverity's overrun-buffer-arg warning @@ -453,7 +453,7 @@ static inline bool icopyConstructFromElements( if (pSeq != 0) { typelib_TypeDescriptionReference ** pDestElements = - (typelib_TypeDescriptionReference **) pSeq->elements; + reinterpret_cast(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { TYPE_ACQUIRE( @@ -472,7 +472,7 @@ static inline bool icopyConstructFromElements( pSeq = reallocSeq( pSeq, sizeof(uno_Any), nAlloc ); if (pSeq != 0) { - uno_Any * pDestElements = (uno_Any *) pSeq->elements; + uno_Any * pDestElements = reinterpret_cast(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { uno_Any * pSource = (uno_Any *)pSourceElements + nPos; @@ -499,7 +499,7 @@ static inline bool icopyConstructFromElements( char * pDestElements = pSeq->elements; typelib_CompoundTypeDescription * pTypeDescr = - (typelib_CompoundTypeDescription *)pElementTypeDescr; + reinterpret_cast(pElementTypeDescr); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { char * pDest = @@ -546,8 +546,8 @@ static inline bool icopyConstructFromElements( typelib_TypeDescription * pElementTypeDescr = 0; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); typelib_TypeDescriptionReference * pSeqElementType = - ((typelib_IndirectTypeDescription *) pElementTypeDescr)->pType; - uno_Sequence ** pDestElements = (uno_Sequence **) pSeq->elements; + reinterpret_cast(pElementTypeDescr)->pType; + uno_Sequence ** pDestElements = reinterpret_cast(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { uno_Sequence * pNew = icopyConstructSequence( @@ -695,7 +695,7 @@ sal_Bool SAL_CALL uno_type_sequence_construct( TYPELIB_DANGER_GET( &pTypeDescr, pType ); typelib_TypeDescriptionReference * pElementType = - ((typelib_IndirectTypeDescription *)pTypeDescr)->pType; + reinterpret_cast(pTypeDescr)->pType; *ppSequence = 0; if (pElements == 0) @@ -736,7 +736,7 @@ sal_Bool SAL_CALL uno_sequence_construct( if (len > 0) { typelib_TypeDescriptionReference * pElementType = - ((typelib_IndirectTypeDescription *)pTypeDescr)->pType; + reinterpret_cast(pTypeDescr)->pType; *ppSequence = 0; if (pElements == 0) @@ -779,7 +779,7 @@ sal_Bool SAL_CALL uno_type_sequence_realloc( typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pType ); ret = ireallocSequence( - ppSequence, ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, + ppSequence, reinterpret_cast(pTypeDescr)->pType, nSize, acquire, release ); TYPELIB_DANGER_RELEASE( pTypeDescr ); } @@ -799,7 +799,7 @@ sal_Bool SAL_CALL uno_sequence_realloc( if (nSize != (*ppSequence)->nElements) { ret = ireallocSequence( - ppSequence, ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, + ppSequence, reinterpret_cast(pTypeDescr)->pType, nSize, acquire, release ); } return ret; @@ -825,7 +825,7 @@ sal_Bool SAL_CALL uno_type_sequence_reference2One( ret = icopyConstructFromElements( &pNew, pSequence->elements, - ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, + reinterpret_cast(pTypeDescr)->pType, 0, pSequence->nElements, acquire, pSequence->nElements ); // alloc nElements if (ret) @@ -869,7 +869,7 @@ sal_Bool SAL_CALL uno_sequence_reference2One( { ret = icopyConstructFromElements( &pNew, pSequence->elements, - ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, + reinterpret_cast(pTypeDescr)->pType, 0, pSequence->nElements, acquire, pSequence->nElements ); // alloc nElements if (ret) diff --git a/include/cppu/Enterable.hxx b/include/cppu/Enterable.hxx index f855ab70c041..1a5b3c7736eb 100644 --- a/include/cppu/Enterable.hxx +++ b/include/cppu/Enterable.hxx @@ -56,7 +56,7 @@ public: inline void callInto(uno_EnvCallee * pCallee, ...); inline void callOut (uno_EnvCallee * pCallee, ...); - inline int isValid (rtl::OUString * pReason) {return m_isValid(this, (rtl_uString **)pReason);} + inline int isValid (rtl::OUString * pReason) {return m_isValid(this, &pReason->pData);} private: Enterable(Enterable const &); @@ -70,7 +70,7 @@ extern "C" inline void Enterable_call_callInto_v(void * context, uno_EnvCallee * extern "C" inline void Enterable_call_callOut_v (void * context, uno_EnvCallee * pCallee, va_list * pParam) { ((Enterable *)context)->v_callOut_v(pCallee, pParam); } extern "C" inline int Enterable_call_isValid (void * context, rtl_uString ** pReason) - {return ((Enterable *)context)->v_isValid((rtl::OUString *)pReason);} + {return ((Enterable *)context)->v_isValid(reinterpret_cast(pReason));} Enterable::Enterable(void) diff --git a/include/uno/environment.hxx b/include/uno/environment.hxx index 1878ebcb376e..78cf1634cd41 100644 --- a/include/uno/environment.hxx +++ b/include/uno/environment.hxx @@ -244,7 +244,7 @@ inline void SAL_CALL Environment::enter() const inline int SAL_CALL Environment::isValid(rtl::OUString * pReason) const { - return uno_Environment_isValid(_pEnv, (rtl_uString **)pReason); + return uno_Environment_isValid(_pEnv, &pReason->pData); } inline Environment Environment::getCurrent(rtl::OUString const & typeName) diff --git a/include/uno/mapping.hxx b/include/uno/mapping.hxx index 949542f1b9c6..1199c71ff4e3 100644 --- a/include/uno/mapping.hxx +++ b/include/uno/mapping.hxx @@ -157,7 +157,7 @@ public: @return mapped interface */ inline void * SAL_CALL mapInterface( void * pInterface, typelib_TypeDescription * pTypeDescr ) const - { return mapInterface( pInterface, (typelib_InterfaceTypeDescription *)pTypeDescr ); } + { return mapInterface( pInterface, reinterpret_cast(pTypeDescr) ); } /** Maps an interface from one environment to another. @@ -183,7 +183,7 @@ public: @param pTypeDescr type description of interface */ inline void SAL_CALL mapInterface( void ** ppOut, void * pInterface, typelib_TypeDescription * pTypeDescr ) const - { (*_pMapping->mapInterface)( _pMapping, ppOut, pInterface, (typelib_InterfaceTypeDescription *)pTypeDescr ); } + { (*_pMapping->mapInterface)( _pMapping, ppOut, pInterface, reinterpret_cast(pTypeDescr) ); } /** Maps an interface from one environment to another. @@ -261,7 +261,7 @@ inline void Mapping::mapInterface( TYPELIB_DANGER_GET( &pTD, rType.getTypeLibType() ); if (pTD) { - (*_pMapping->mapInterface)( _pMapping, ppOut, pInterface, (typelib_InterfaceTypeDescription *)pTD ); + (*_pMapping->mapInterface)( _pMapping, ppOut, pInterface, reinterpret_cast(pTD) ); TYPELIB_DANGER_RELEASE( pTD ); } } -- cgit