diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-28 19:00:21 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-28 19:09:19 +0100 |
commit | e97b3272668ecbe5454ffc7f394680dbcae27395 (patch) | |
tree | e4a36cfa4b270196e6b65ace1d40c26a89ec8dee /cppuhelper | |
parent | 1777f6fedbd59b440e06c17f90842a2c2b5e349c (diff) |
Clean up C-style casts from pointers to void
Change-Id: I92c0a6c602e473b796df43b88c98b823de8d9399
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/implbase_ex.cxx | 2 | ||||
-rw-r--r-- | cppuhelper/source/interfacecontainer.cxx | 56 | ||||
-rw-r--r-- | cppuhelper/source/macro_expander.cxx | 2 | ||||
-rw-r--r-- | cppuhelper/source/propshlp.cxx | 24 | ||||
-rw-r--r-- | cppuhelper/source/tdmgr.cxx | 20 |
5 files changed, 52 insertions, 52 deletions
diff --git a/cppuhelper/source/implbase_ex.cxx b/cppuhelper/source/implbase_ex.cxx index 8e3fe2afec6d..4542cb00d5e2 100644 --- a/cppuhelper/source/implbase_ex.cxx +++ b/cppuhelper/source/implbase_ex.cxx @@ -71,7 +71,7 @@ static inline bool isXInterface( rtl_uString * pStr ) static inline void * makeInterface( sal_IntPtr nOffset, void * that ) { - return (((char *)that) + nOffset); + return (static_cast<char *>(that) + nOffset); } static inline bool __td_equals( diff --git a/cppuhelper/source/interfacecontainer.cxx b/cppuhelper/source/interfacecontainer.cxx index da37a8c425b0..9800a191a751 100644 --- a/cppuhelper/source/interfacecontainer.cxx +++ b/cppuhelper/source/interfacecontainer.cxx @@ -348,13 +348,13 @@ OMultiTypeInterfaceContainerHelper::OMultiTypeInterfaceContainerHelper( Mutex & OMultiTypeInterfaceContainerHelper::~OMultiTypeInterfaceContainerHelper() { - t_type2ptr * pMap = (t_type2ptr *)m_pMap; + t_type2ptr * pMap = static_cast<t_type2ptr *>(m_pMap); t_type2ptr::iterator iter = pMap->begin(); t_type2ptr::iterator end = pMap->end(); while( iter != end ) { - delete (OInterfaceContainerHelper*)(*iter).second; + delete static_cast<OInterfaceContainerHelper*>((*iter).second); (*iter).second = 0; ++iter; } @@ -363,7 +363,7 @@ OMultiTypeInterfaceContainerHelper::~OMultiTypeInterfaceContainerHelper() Sequence< Type > OMultiTypeInterfaceContainerHelper::getContainedTypes() const { - t_type2ptr * pMap = (t_type2ptr *)m_pMap; + t_type2ptr * pMap = static_cast<t_type2ptr *>(m_pMap); t_type2ptr::size_type nSize; ::osl::MutexGuard aGuard( rMutex ); @@ -380,7 +380,7 @@ Sequence< Type > OMultiTypeInterfaceContainerHelper::getContainedTypes() const while( iter != end ) { // are interfaces added to this container? - if( ((OInterfaceContainerHelper*)(*iter).second)->getLength() ) + if( static_cast<OInterfaceContainerHelper*>((*iter).second)->getLength() ) // yes, put the type in the array pArray[i++] = (*iter).first; ++iter; @@ -412,10 +412,10 @@ OInterfaceContainerHelper * OMultiTypeInterfaceContainerHelper::getContainer( co { ::osl::MutexGuard aGuard( rMutex ); - t_type2ptr * pMap = (t_type2ptr *)m_pMap; + t_type2ptr * pMap = static_cast<t_type2ptr *>(m_pMap); t_type2ptr::iterator iter = findType( pMap, rKey ); if( iter != pMap->end() ) - return (OInterfaceContainerHelper*) (*iter).second; + return static_cast<OInterfaceContainerHelper*>((*iter).second); return 0; } @@ -423,7 +423,7 @@ sal_Int32 OMultiTypeInterfaceContainerHelper::addInterface( const Type & rKey, const Reference< XInterface > & rListener ) { ::osl::MutexGuard aGuard( rMutex ); - t_type2ptr * pMap = (t_type2ptr *)m_pMap; + t_type2ptr * pMap = static_cast<t_type2ptr *>(m_pMap); t_type2ptr::iterator iter = findType( pMap, rKey ); if( iter == pMap->end() ) { @@ -432,7 +432,7 @@ sal_Int32 OMultiTypeInterfaceContainerHelper::addInterface( return pLC->addInterface( rListener ); } else - return ((OInterfaceContainerHelper*)(*iter).second)->addInterface( rListener ); + return static_cast<OInterfaceContainerHelper*>((*iter).second)->addInterface( rListener ); } sal_Int32 OMultiTypeInterfaceContainerHelper::removeInterface( @@ -441,11 +441,11 @@ sal_Int32 OMultiTypeInterfaceContainerHelper::removeInterface( ::osl::MutexGuard aGuard( rMutex ); // search container with id nUik - t_type2ptr * pMap = (t_type2ptr *)m_pMap; + t_type2ptr * pMap = static_cast<t_type2ptr *>(m_pMap); t_type2ptr::iterator iter = findType( pMap, rKey ); // container found? if( iter != pMap->end() ) - return ((OInterfaceContainerHelper*)(*iter).second)->removeInterface( rListener ); + return static_cast<OInterfaceContainerHelper*>((*iter).second)->removeInterface( rListener ); // no container with this id. Always return 0 return 0; @@ -457,7 +457,7 @@ void OMultiTypeInterfaceContainerHelper::disposeAndClear( const EventObject & rE boost::scoped_array<OInterfaceContainerHelper *> ppListenerContainers; { ::osl::MutexGuard aGuard( rMutex ); - t_type2ptr * pMap = (t_type2ptr *)m_pMap; + t_type2ptr * pMap = static_cast<t_type2ptr *>(m_pMap); nSize = pMap->size(); if( nSize ) { @@ -471,7 +471,7 @@ void OMultiTypeInterfaceContainerHelper::disposeAndClear( const EventObject & rE t_type2ptr::size_type i = 0; while( iter != end ) { - ppListenerContainers[i++] = (OInterfaceContainerHelper*)(*iter).second; + ppListenerContainers[i++] = static_cast<OInterfaceContainerHelper*>((*iter).second); ++iter; } } @@ -489,13 +489,13 @@ void OMultiTypeInterfaceContainerHelper::disposeAndClear( const EventObject & rE void OMultiTypeInterfaceContainerHelper::clear() { ::osl::MutexGuard aGuard( rMutex ); - t_type2ptr * pMap = (t_type2ptr *)m_pMap; + t_type2ptr * pMap = static_cast<t_type2ptr *>(m_pMap); t_type2ptr::iterator iter = pMap->begin(); t_type2ptr::iterator end = pMap->end(); while( iter != end ) { - ((OInterfaceContainerHelper*)(*iter).second)->clear(); + static_cast<OInterfaceContainerHelper*>((*iter).second)->clear(); ++iter; } } @@ -530,13 +530,13 @@ OMultiTypeInterfaceContainerHelperInt32::~OMultiTypeInterfaceContainerHelperInt3 if (!m_pMap) return; - t_long2ptr * pMap = (t_long2ptr *)m_pMap; + t_long2ptr * pMap = static_cast<t_long2ptr *>(m_pMap); t_long2ptr::iterator iter = pMap->begin(); t_long2ptr::iterator end = pMap->end(); while( iter != end ) { - delete (OInterfaceContainerHelper*)(*iter).second; + delete static_cast<OInterfaceContainerHelper*>((*iter).second); (*iter).second = 0; ++iter; } @@ -545,7 +545,7 @@ OMultiTypeInterfaceContainerHelperInt32::~OMultiTypeInterfaceContainerHelperInt3 Sequence< sal_Int32 > OMultiTypeInterfaceContainerHelperInt32::getContainedTypes() const { - t_long2ptr * pMap = (t_long2ptr *)m_pMap; + t_long2ptr * pMap = static_cast<t_long2ptr *>(m_pMap); t_long2ptr::size_type nSize; ::osl::MutexGuard aGuard( rMutex ); @@ -562,7 +562,7 @@ Sequence< sal_Int32 > OMultiTypeInterfaceContainerHelperInt32::getContainedTypes while( iter != end ) { // are interfaces added to this container? - if( ((OInterfaceContainerHelper*)(*iter).second)->getLength() ) + if( static_cast<OInterfaceContainerHelper*>((*iter).second)->getLength() ) // yes, put the type in the array pArray[i++] = (*iter).first; ++iter; @@ -582,10 +582,10 @@ OInterfaceContainerHelper * OMultiTypeInterfaceContainerHelperInt32::getContaine if (!m_pMap) return 0; - t_long2ptr * pMap = (t_long2ptr *)m_pMap; + t_long2ptr * pMap = static_cast<t_long2ptr *>(m_pMap); t_long2ptr::iterator iter = findLong( pMap, rKey ); if( iter != pMap->end() ) - return (OInterfaceContainerHelper*) (*iter).second; + return static_cast<OInterfaceContainerHelper*>((*iter).second); return 0; } @@ -595,7 +595,7 @@ sal_Int32 OMultiTypeInterfaceContainerHelperInt32::addInterface( ::osl::MutexGuard aGuard( rMutex ); if (!m_pMap) m_pMap = new t_long2ptr(); - t_long2ptr * pMap = (t_long2ptr *)m_pMap; + t_long2ptr * pMap = static_cast<t_long2ptr *>(m_pMap); t_long2ptr::iterator iter = findLong( pMap, rKey ); if( iter == pMap->end() ) { @@ -604,7 +604,7 @@ sal_Int32 OMultiTypeInterfaceContainerHelperInt32::addInterface( return pLC->addInterface( rListener ); } else - return ((OInterfaceContainerHelper*)(*iter).second)->addInterface( rListener ); + return static_cast<OInterfaceContainerHelper*>((*iter).second)->addInterface( rListener ); } sal_Int32 OMultiTypeInterfaceContainerHelperInt32::removeInterface( @@ -615,11 +615,11 @@ sal_Int32 OMultiTypeInterfaceContainerHelperInt32::removeInterface( if (!m_pMap) return 0; // search container with id nUik - t_long2ptr * pMap = (t_long2ptr *)m_pMap; + t_long2ptr * pMap = static_cast<t_long2ptr *>(m_pMap); t_long2ptr::iterator iter = findLong( pMap, rKey ); // container found? if( iter != pMap->end() ) - return ((OInterfaceContainerHelper*)(*iter).second)->removeInterface( rListener ); + return static_cast<OInterfaceContainerHelper*>((*iter).second)->removeInterface( rListener ); // no container with this id. Always return 0 return 0; @@ -634,7 +634,7 @@ void OMultiTypeInterfaceContainerHelperInt32::disposeAndClear( const EventObject if (!m_pMap) return; - t_long2ptr * pMap = (t_long2ptr *)m_pMap; + t_long2ptr * pMap = static_cast<t_long2ptr *>(m_pMap); nSize = pMap->size(); if( nSize ) { @@ -647,7 +647,7 @@ void OMultiTypeInterfaceContainerHelperInt32::disposeAndClear( const EventObject t_long2ptr::size_type i = 0; while( iter != end ) { - ppListenerContainers[i++] = (OInterfaceContainerHelper*)(*iter).second; + ppListenerContainers[i++] = static_cast<OInterfaceContainerHelper*>((*iter).second); ++iter; } } @@ -667,13 +667,13 @@ void OMultiTypeInterfaceContainerHelperInt32::clear() ::osl::MutexGuard aGuard( rMutex ); if (!m_pMap) return; - t_long2ptr * pMap = (t_long2ptr *)m_pMap; + t_long2ptr * pMap = static_cast<t_long2ptr *>(m_pMap); t_long2ptr::iterator iter = pMap->begin(); t_long2ptr::iterator end = pMap->end(); while( iter != end ) { - ((OInterfaceContainerHelper*)(*iter).second)->clear(); + static_cast<OInterfaceContainerHelper*>((*iter).second)->clear(); ++iter; } } diff --git a/cppuhelper/source/macro_expander.cxx b/cppuhelper/source/macro_expander.cxx index 857e62d02dad..dc610a4ddc88 100644 --- a/cppuhelper/source/macro_expander.cxx +++ b/cppuhelper/source/macro_expander.cxx @@ -68,7 +68,7 @@ Bootstrap const & get_unorc() s_bstrap = bstrap; } } - return *(Bootstrap const *)&s_bstrap; + return *reinterpret_cast<Bootstrap const *>(&s_bstrap); } } diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx index bcc8f0fa1850..20be194b4b45 100644 --- a/cppuhelper/source/propshlp.cxx +++ b/cppuhelper/source/propshlp.cxx @@ -60,7 +60,7 @@ extern "C" { static int compare_OUString_Property_Impl( const void *arg1, const void *arg2 ) SAL_THROW_EXTERN_C() { - return ((OUString *)arg1)->compareTo( ((Property *)arg2)->Name ); + return static_cast<OUString const *>(arg1)->compareTo( static_cast<Property const *>(arg2)->Name ); } } @@ -107,9 +107,9 @@ Sequence< Property > OPropertySetHelperInfo_Impl::getProperties(void) throw(::co Property OPropertySetHelperInfo_Impl::getPropertyByName( const OUString & PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) { Property * pR; - pR = (Property *)bsearch( &PropertyName, aInfos.getConstArray(), aInfos.getLength(), + pR = static_cast<Property *>(bsearch( &PropertyName, aInfos.getConstArray(), aInfos.getLength(), sizeof( Property ), - compare_OUString_Property_Impl ); + compare_OUString_Property_Impl )); if( !pR ) { throw UnknownPropertyException(); } @@ -123,9 +123,9 @@ Property OPropertySetHelperInfo_Impl::getPropertyByName( const OUString & Proper sal_Bool OPropertySetHelperInfo_Impl::hasPropertyByName( const OUString & PropertyName ) throw(::com::sun::star::uno::RuntimeException, std::exception) { Property * pR; - pR = (Property *)bsearch( &PropertyName, aInfos.getConstArray(), aInfos.getLength(), + pR = static_cast<Property *>(bsearch( &PropertyName, aInfos.getConstArray(), aInfos.getLength(), sizeof( Property ), - compare_OUString_Property_Impl ); + compare_OUString_Property_Impl )); return pR != NULL; } @@ -1009,7 +1009,7 @@ extern "C" { static int compare_Property_Impl( const void *arg1, const void *arg2 ) SAL_THROW_EXTERN_C() { - return ((Property *)arg1)->Name.compareTo( ((Property *)arg2)->Name ); + return static_cast<Property const *>(arg1)->Name.compareTo( static_cast<Property const *>(arg2)->Name ); } } @@ -1118,9 +1118,9 @@ Property OPropertyArrayHelper::getPropertyByName(const OUString& aPropertyName) throw (UnknownPropertyException) { Property * pR; - pR = (Property *)bsearch( &aPropertyName, aInfos.getConstArray(), aInfos.getLength(), + pR = static_cast<Property *>(bsearch( &aPropertyName, aInfos.getConstArray(), aInfos.getLength(), sizeof( Property ), - compare_OUString_Property_Impl ); + compare_OUString_Property_Impl )); if( !pR ) { throw UnknownPropertyException(); } @@ -1131,9 +1131,9 @@ Property OPropertyArrayHelper::getPropertyByName(const OUString& aPropertyName) sal_Bool OPropertyArrayHelper::hasPropertyByName(const OUString& aPropertyName) { Property * pR; - pR = (Property *)bsearch( &aPropertyName, aInfos.getConstArray(), aInfos.getLength(), + pR = static_cast<Property *>(bsearch( &aPropertyName, aInfos.getConstArray(), aInfos.getLength(), sizeof( Property ), - compare_OUString_Property_Impl ); + compare_OUString_Property_Impl )); return pR != NULL; } @@ -1141,9 +1141,9 @@ sal_Bool OPropertyArrayHelper::hasPropertyByName(const OUString& aPropertyName) sal_Int32 OPropertyArrayHelper::getHandleByName( const OUString & rPropName ) { Property * pR; - pR = (Property *)bsearch( &rPropName, aInfos.getConstArray(), aInfos.getLength(), + pR = static_cast<Property *>(bsearch( &rPropName, aInfos.getConstArray(), aInfos.getLength(), sizeof( Property ), - compare_OUString_Property_Impl ); + compare_OUString_Property_Impl )); return pR ? pR->Handle : -1; } diff --git a/cppuhelper/source/tdmgr.cxx b/cppuhelper/source/tdmgr.cxx index 4a454e616324..7e02154c0d97 100644 --- a/cppuhelper/source/tdmgr.cxx +++ b/cppuhelper/source/tdmgr.cxx @@ -88,8 +88,8 @@ inline static typelib_TypeDescription * createCTD( OUString aTypeName( xType->getName() ); - typelib_CompoundMember_Init * pMemberInits = (typelib_CompoundMember_Init *)alloca( - sizeof(typelib_CompoundMember_Init) * nMembers ); + typelib_CompoundMember_Init * pMemberInits = static_cast<typelib_CompoundMember_Init *>(alloca( + sizeof(typelib_CompoundMember_Init) * nMembers )); sal_Int32 nPos; for ( nPos = nMembers; nPos--; ) @@ -146,8 +146,8 @@ inline static typelib_TypeDescription * createCTD( OUString aTypeName( xType->getName() ); - typelib_StructMember_Init * pMemberInits = (typelib_StructMember_Init *)alloca( - sizeof(typelib_StructMember_Init) * nMembers ); + typelib_StructMember_Init * pMemberInits = static_cast<typelib_StructMember_Init *>(alloca( + sizeof(typelib_StructMember_Init) * nMembers )); Sequence< Reference< XTypeDescription > > templateMemberTypes; sal_Int32 i = aTypeName.indexOf('<'); @@ -249,8 +249,8 @@ static typelib_TypeDescription * createCTD( const Reference< XMethodParameter > * pParams = rParams.getConstArray(); sal_Int32 nParams = rParams.getLength(); - typelib_Parameter_Init * pParamInit = (typelib_Parameter_Init *)alloca( - sizeof(typelib_Parameter_Init) * nParams ); + typelib_Parameter_Init * pParamInit = static_cast<typelib_Parameter_Init *>(alloca( + sizeof(typelib_Parameter_Init) * nParams )); sal_Int32 nPos; for ( nPos = nParams; nPos--; ) @@ -272,8 +272,8 @@ static typelib_TypeDescription * createCTD( const Sequence<Reference< XTypeDescription > > & rExceptions = xMethod->getExceptions(); const Reference< XTypeDescription > * pExceptions = rExceptions.getConstArray(); sal_Int32 nExceptions = rExceptions.getLength(); - rtl_uString ** ppExceptionNames = (rtl_uString **)alloca( - sizeof(rtl_uString *) * nExceptions ); + rtl_uString ** ppExceptionNames = static_cast<rtl_uString **>(alloca( + sizeof(rtl_uString *) * nExceptions )); for ( nPos = nExceptions; nPos--; ) { @@ -335,8 +335,8 @@ inline static typelib_TypeDescription * createCTD( const Sequence<Reference< XInterfaceMemberTypeDescription > > & rMembers = xType->getMembers(); sal_Int32 nMembers = rMembers.getLength(); - typelib_TypeDescriptionReference ** ppMemberRefs = (typelib_TypeDescriptionReference **)alloca( - sizeof(typelib_TypeDescriptionReference *) * nMembers ); + typelib_TypeDescriptionReference ** ppMemberRefs = static_cast<typelib_TypeDescriptionReference **>(alloca( + sizeof(typelib_TypeDescriptionReference *) * nMembers )); const Reference< XInterfaceMemberTypeDescription > * pMembers = rMembers.getConstArray(); |