From 9a274915a16eea5e3ce51a27b1a8741ac5e785b8 Mon Sep 17 00:00:00 2001 From: Chris Sherlock Date: Sun, 7 May 2017 08:11:12 +1000 Subject: tdf#43157: convert cppuhelper and io from OSL_ASSERT to assert Change-Id: I56d49e1ce9f1c070fedcabb8f1637d17dee1083b --- cppuhelper/source/component.cxx | 2 +- cppuhelper/source/component_context.cxx | 6 +++--- cppuhelper/source/exc_thrower.cxx | 10 +++++----- cppuhelper/source/implbase.cxx | 4 ++-- cppuhelper/source/interfacecontainer.cxx | 8 ++++---- cppuhelper/source/tdmgr.cxx | 14 +++++++------- cppuhelper/source/weak.cxx | 10 +++++----- io/source/acceptor/acc_pipe.cxx | 2 +- io/source/stm/omark.cxx | 4 ++-- io/test/stm/datatest.cxx | 24 ++++++++++++------------ io/test/stm/marktest.cxx | 8 ++++---- io/test/testconnection.cxx | 6 +++--- 12 files changed, 49 insertions(+), 49 deletions(-) diff --git a/cppuhelper/source/component.cxx b/cppuhelper/source/component.cxx index fdff1a21bab8..b9b97d953e8b 100644 --- a/cppuhelper/source/component.cxx +++ b/cppuhelper/source/component.cxx @@ -101,7 +101,7 @@ void OComponentHelper::release() throw() } // only the alive ref holds the object - OSL_ASSERT( m_refCount == 1 ); + assert( m_refCount == 1 ); // destroy the object if xHoldAlive decrement the refcount to 0 return; } diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx index 2df1b495689c..d3bbeea5f3b9 100644 --- a/cppuhelper/source/component_context.cxx +++ b/cppuhelper/source/component_context.cxx @@ -85,7 +85,7 @@ class DisposingForwarder explicit DisposingForwarder( Reference< lang::XComponent > const & xTarget ) : m_xTarget( xTarget ) { - OSL_ASSERT( m_xTarget.is() ); + assert( m_xTarget.is() ); } public: // listens at source for disposing, then disposes target @@ -532,7 +532,7 @@ ComponentContext::ComponentContext( UNO_QUERY ); // patch DefaultContext property of new one Reference< beans::XPropertySet > xProps( m_xSMgr, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); + assert( xProps.is() ); if (xProps.is()) { Reference< XComponentContext > xThis( this ); @@ -545,7 +545,7 @@ ComponentContext::ComponentContext( throw; } osl_atomic_decrement( &m_refCount ); - OSL_ASSERT( m_xSMgr.is() ); + assert( m_xSMgr.is() ); } } } diff --git a/cppuhelper/source/exc_thrower.cxx b/cppuhelper/source/exc_thrower.cxx index 8bd5084c7e8c..de05ab727215 100644 --- a/cppuhelper/source/exc_thrower.cxx +++ b/cppuhelper/source/exc_thrower.cxx @@ -75,7 +75,7 @@ void SAL_CALL ExceptionThrower_dispatch( uno_Interface * pUnoI, typelib_TypeDescription const * pMemberType, void * pReturn, void * pArgs [], uno_Any ** ppException ) { - OSL_ASSERT( pMemberType->eTypeClass == typelib_TypeClass_INTERFACE_METHOD ); + assert( pMemberType->eTypeClass == typelib_TypeClass_INTERFACE_METHOD ); switch (reinterpret_cast< typelib_InterfaceMemberTypeDescription * >( const_cast< typelib_TypeDescription * >( pMemberType ) )-> @@ -109,13 +109,13 @@ void SAL_CALL ExceptionThrower_dispatch( case 3: // throwException() { uno_Any * pAny = static_cast< uno_Any * >( pArgs[ 0 ] ); - OSL_ASSERT( pAny->pType->eTypeClass == typelib_TypeClass_EXCEPTION ); + assert( pAny->pType->eTypeClass == typelib_TypeClass_EXCEPTION ); uno_type_any_construct( *ppException, pAny->pData, pAny->pType, nullptr ); break; } default: { - OSL_ASSERT( false ); + assert( false ); RuntimeException exc( "not implemented!" ); uno_type_any_construct( *ppException, &exc, cppu::UnoType::get().getTypeLibType(), nullptr ); @@ -198,7 +198,7 @@ void SAL_CALL throwException( Any const & exc ) reinterpret_cast< void ** >( &xThrower ), static_cast< uno_Interface * >( &theExceptionThrower::get() ), ExceptionThrower::getCppuType() ); - OSL_ASSERT( xThrower.is() ); + assert( xThrower.is() ); xThrower->throwException( exc ); } @@ -226,7 +226,7 @@ Any SAL_CALL getCaughtException() cpp2uno.mapInterface( reinterpret_cast< void ** >( &unoI.m_pUnoI ), static_cast< XExceptionThrower * >( &theExceptionThrower::get() ), pTD ); - OSL_ASSERT( unoI.is() ); + assert( unoI.is() ); typelib_TypeDescription * pMemberTD = nullptr; TYPELIB_DANGER_GET( diff --git a/cppuhelper/source/implbase.cxx b/cppuhelper/source/implbase.cxx index 6118ccb79fc1..596508e213a8 100644 --- a/cppuhelper/source/implbase.cxx +++ b/cppuhelper/source/implbase.cxx @@ -82,7 +82,7 @@ void WeakComponentImplHelperBase::release() exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); static_cast(exc); } - OSL_ASSERT( rBHelper.bDisposed ); + assert( rBHelper.bDisposed ); } OWeakObject::release(); } @@ -209,7 +209,7 @@ void WeakAggComponentImplHelperBase::release() exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); static_cast(exc); } - OSL_ASSERT( rBHelper.bDisposed ); + assert( rBHelper.bDisposed ); } OWeakAggObject::release(); } diff --git a/cppuhelper/source/interfacecontainer.cxx b/cppuhelper/source/interfacecontainer.cxx index 2eb7197bf9e6..0571c4c87e66 100644 --- a/cppuhelper/source/interfacecontainer.cxx +++ b/cppuhelper/source/interfacecontainer.cxx @@ -126,14 +126,14 @@ void OInterfaceIteratorHelper::remove() { if( bIsList ) { - OSL_ASSERT( nRemain >= 0 && + assert( nRemain >= 0 && nRemain < aData.pAsSequence->getLength() ); XInterface * p = aData.pAsSequence->getConstArray()[nRemain].get(); rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >( &p ) ); } else { - OSL_ASSERT( 0 == nRemain ); + assert( 0 == nRemain ); rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >(&aData.pAsInterface)); } } @@ -195,7 +195,7 @@ void OInterfaceContainerHelper::copyAndResetInUse() sal_Int32 OInterfaceContainerHelper::addInterface( const Reference & rListener ) { - OSL_ASSERT( rListener.is() ); + assert( rListener.is() ); MutexGuard aGuard( rMutex ); if( bInUse ) copyAndResetInUse(); @@ -226,7 +226,7 @@ sal_Int32 OInterfaceContainerHelper::addInterface( const Reference & sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference & rListener ) { - OSL_ASSERT( rListener.is() ); + assert( rListener.is() ); MutexGuard aGuard( rMutex ); if( bInUse ) copyAndResetInUse(); diff --git a/cppuhelper/source/tdmgr.cxx b/cppuhelper/source/tdmgr.cxx index 02da05163732..9a5b7f6cba58 100644 --- a/cppuhelper/source/tdmgr.cxx +++ b/cppuhelper/source/tdmgr.cxx @@ -155,11 +155,11 @@ inline static typelib_TypeDescription * createCTD( Reference< XStructTypeDescription > templateDesc( access->getByHierarchicalName(aTypeName.copy(0, i)), UNO_QUERY_THROW); - OSL_ASSERT( + assert( templateDesc->getTypeParameters().getLength() == xType->getTypeArguments().getLength()); templateMemberTypes = templateDesc->getMemberTypes(); - OSL_ASSERT(templateMemberTypes.getLength() == nMembers); + assert(templateMemberTypes.getLength() == nMembers); } sal_Int32 nPos; @@ -212,7 +212,7 @@ inline static typelib_TypeDescription * createCTD( xAttribute->getGetExceptions() ); for (sal_Int32 i = 0; i != getExcs.getLength(); ++i) { - OSL_ASSERT( getExcs[i].is() ); + assert( getExcs[i].is() ); getExc.push_back( getExcs[i]->getName().pData ); } std::vector< rtl_uString * > setExc; @@ -220,7 +220,7 @@ inline static typelib_TypeDescription * createCTD( xAttribute->getSetExceptions() ); for (sal_Int32 i = 0; i != setExcs.getLength(); ++i) { - OSL_ASSERT( setExcs[i].is() ); + assert( setExcs[i].is() ); setExc.push_back( setExcs[i]->getName().pData ); } typelib_typedescription_newExtendedInterfaceAttribute( @@ -322,7 +322,7 @@ inline static typelib_TypeDescription * createCTD( new typelib_TypeDescription *[nBases]); for (sal_Int32 i = 0; i < nBases; ++i) { typelib_TypeDescription * p = createCTD(access, aBases[i]); - OSL_ASSERT( + assert( !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(p->eTypeClass)); typelib_typedescription_register(&p); aBaseTypes[i] = p; @@ -380,7 +380,7 @@ inline static typelib_TypeDescription * createCTD( const Reference< XEnumTypeDes { OUString aTypeName( xType->getName() ); Sequence< OUString > aNames( xType->getEnumNames() ); - OSL_ASSERT( sizeof(OUString) == sizeof(rtl_uString *) ); // !!! + assert( sizeof(OUString) == sizeof(rtl_uString *) ); // !!! Sequence< sal_Int32 > aValues( xType->getEnumValues() ); typelib_typedescription_newEnum( @@ -621,7 +621,7 @@ public: void EventListenerImpl::disposing( lang::EventObject const & rEvt ) { if (rEvt.Source != m_xTDMgr) { - OSL_ASSERT(false); + assert(false); } // deregister of c typelib callback ::typelib_typedescription_revokeCallback( m_xTDMgr.get(), typelib_callback ); diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx index b52634b26ecc..981867ec5162 100644 --- a/cppuhelper/source/weak.cxx +++ b/cppuhelper/source/weak.cxx @@ -383,7 +383,7 @@ OWeakRefListener::OWeakRefListener(const Reference< XInterface >& xInt) } } } - catch (RuntimeException &) { OSL_ASSERT( false ); } // assert here, but no unexpected() + catch (RuntimeException &) { assert( false ); } // assert here, but no unexpected() osl_atomic_decrement( &m_aRefCount ); } @@ -397,7 +397,7 @@ OWeakRefListener::~OWeakRefListener() m_XWeakConnectionPoint->removeReference(static_cast(this)); } } - catch (RuntimeException &) { OSL_ASSERT( false ); } // assert here, but no unexpected() + catch (RuntimeException &) { assert( false ); } // assert here, but no unexpected() } // XInterface @@ -471,7 +471,7 @@ void WeakReferenceHelper::clear() m_pImpl = nullptr; } } - catch (RuntimeException &) { OSL_ASSERT( false ); } // assert here, but no unexpected() + catch (RuntimeException &) { assert( false ); } // assert here, but no unexpected() } WeakReferenceHelper& WeakReferenceHelper::operator=(const WeakReferenceHelper& rWeakRef) @@ -504,7 +504,7 @@ WeakReferenceHelper::operator= (const Reference< XInterface > & xInt) m_pImpl->acquire(); } } - catch (RuntimeException &) { OSL_ASSERT( false ); } // assert here, but no unexpected() + catch (RuntimeException &) { assert( false ); } // assert here, but no unexpected() return *this; } @@ -530,7 +530,7 @@ Reference< XInterface > WeakReferenceHelper::get() const } catch (RuntimeException &) { - OSL_ASSERT( false ); + assert( false ); } // assert here, but no unexpected() return Reference< XInterface >(); diff --git a/io/source/acceptor/acc_pipe.cxx b/io/source/acceptor/acc_pipe.cxx index b1395946d936..d01daeadf931 100644 --- a/io/source/acceptor/acc_pipe.cxx +++ b/io/source/acceptor/acc_pipe.cxx @@ -77,7 +77,7 @@ namespace io_acceptor aReadBytes.realloc( nBytesToRead ); } sal_Int32 n = m_pipe.read( aReadBytes.getArray(), nBytesToRead ); - OSL_ASSERT( n >= 0 && n <= aReadBytes.getLength() ); + assert( n >= 0 && n <= aReadBytes.getLength() ); if( n < aReadBytes.getLength() ) { aReadBytes.realloc( n ); diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx index 9053ada96698..e47a4f342e31 100644 --- a/io/source/stm/omark.cxx +++ b/io/source/stm/omark.cxx @@ -497,7 +497,7 @@ sal_Int32 OMarkableInputStream::readBytes(Sequence< sal_Int8 >& aData, sal_Int32 sal_Int32 nToRead = nBytesToRead - ( m_pBuffer->getSize() - m_nCurrentPos ); nRead = m_input->readBytes( aData , nToRead ); - OSL_ASSERT( aData.getLength() == nRead ); + assert( aData.getLength() == nRead ); m_pBuffer->writeAt( m_pBuffer->getSize() , aData ); @@ -506,7 +506,7 @@ sal_Int32 OMarkableInputStream::readBytes(Sequence< sal_Int8 >& aData, sal_Int32 } } - OSL_ASSERT( m_pBuffer->getSize() - m_nCurrentPos >= nBytesToRead ); + assert( m_pBuffer->getSize() - m_nCurrentPos >= nBytesToRead ); m_pBuffer->readAt( m_nCurrentPos , aData , nBytesToRead ); diff --git a/io/test/stm/datatest.cxx b/io/test/stm/datatest.cxx index 283344c271ee..44c587895114 100644 --- a/io/test/stm/datatest.cxx +++ b/io/test/stm/datatest.cxx @@ -181,13 +181,13 @@ sal_Int32 ODataStreamTest::test( rSource.set( x, UNO_QUERY ); } - OSL_ASSERT( rPipeInput.is() ); - OSL_ASSERT( rPipeOutput.is() ); + assert( rPipeInput.is() ); + assert( rPipeOutput.is() ); rSink->setInputStream( rPipeInput ); rSource->setOutputStream( rPipeOutput ); - OSL_ASSERT( rSink->getInputStream().is() ); - OSL_ASSERT( rSource->getOutputStream().is() ); + assert( rSink->getInputStream().is() ); + assert( rSource->getOutputStream().is() ); if( 1 == hTestHandle ) { testSimple( rInput , rOutput ); @@ -727,10 +727,10 @@ sal_Int32 OObjectStreamTest::test( const OUString& TestName, Reference markableOutput( x , UNO_QUERY ); Reference markableSource( x , UNO_QUERY ); - OSL_ASSERT( markableInput.is() ); - OSL_ASSERT( markableOutput.is() ); - OSL_ASSERT( markableSink.is() ); - OSL_ASSERT( markableSource.is() ); + assert( markableInput.is() ); + assert( markableOutput.is() ); + assert( markableSink.is() ); + assert( markableSource.is() ); markableSink->setInputStream( rPipeInput ); markableSource->setOutputStream( rPipeOutput ); @@ -748,14 +748,14 @@ sal_Int32 OObjectStreamTest::test( const OUString& TestName, rSource.set( x, UNO_QUERY ); } - OSL_ASSERT( rPipeInput.is() ); - OSL_ASSERT( rPipeOutput.is() ); + assert( rPipeInput.is() ); + assert( rPipeOutput.is() ); rSink->setInputStream( markableInput ); rSource->setOutputStream( markableOutput ); - OSL_ASSERT( rSink->getInputStream().is() ); - OSL_ASSERT( rSource->getOutputStream().is() ); + assert( rSink->getInputStream().is() ); + assert( rSource->getOutputStream().is() ); if( 1 + DATASTREAM_TEST_MAX_HANDLE == hTestHandle ) { testObject( rOutput , rInput); diff --git a/io/test/stm/marktest.cxx b/io/test/stm/marktest.cxx index 8892e7338330..b8c229dab312 100644 --- a/io/test/stm/marktest.cxx +++ b/io/test/stm/marktest.cxx @@ -135,8 +135,8 @@ sal_Int32 OMarkableOutputStreamTest::test( Reference< XOutputStream > rOutput( TestObject , UNO_QUERY ); - OSL_ASSERT( rPipeInput.is() ); - OSL_ASSERT( rOutput.is() ); + assert( rPipeInput.is() ); + assert( rOutput.is() ); if( 1 == hTestHandle ) { // checks usual streaming testSimple( rOutput , rPipeInput ); @@ -489,8 +489,8 @@ sal_Int32 OMarkableInputStreamTest::test( Reference < XInputStream > rInput( TestObject , UNO_QUERY ); - OSL_ASSERT( rPipeOutput.is() ); - OSL_ASSERT( rInput.is() ); + assert( rPipeOutput.is() ); + assert( rInput.is() ); if( 1 == hTestHandle ) { // checks usual streaming testSimple( rPipeOutput , rInput ); diff --git a/io/test/testconnection.cxx b/io/test/testconnection.cxx index 69a2bdeccfb8..67310cf854a7 100644 --- a/io/test/testconnection.cxx +++ b/io/test/testconnection.cxx @@ -72,11 +72,11 @@ void doRead( const Reference < XConnection > &r ) { Sequence < sal_Int8 > seq(10); - OSL_ASSERT( 10 == r->read( seq , 10 ) ); + assert( 10 == r->read( seq , 10 ) ); for( sal_Int32 i = 0 ; i < 10 ; i ++ ) { - OSL_ASSERT( seq.getConstArray()[i] == i ); + assert( seq.getConstArray()[i] == i ); } } @@ -130,7 +130,7 @@ void testConnection( const OUString &sConnectionDescription , TimeValue value = {1,0}; osl_waitThread( &value ); r = rConnector->connect( sConnectionDescription ); - OSL_ASSERT( r.is() ); + assert( r.is() ); doWrite( r ); doRead( r ); bGotit = sal_True; -- cgit