From 4592d27dca75e73218ddca2039b1a1332adc828c Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 21 Apr 2015 08:39:10 +0200 Subject: Get rid of trivial comphelper::in-/decrement wrappers Change-Id: Id3a12ef9d56c30719f483e610c8a8b08caf05def --- forms/source/component/Button.cxx | 4 ++-- forms/source/component/Columns.cxx | 8 ++++---- forms/source/component/DatabaseForm.cxx | 5 ++--- forms/source/component/Edit.cxx | 4 ++-- forms/source/component/EventThread.cxx | 4 ++-- forms/source/component/FormComponent.cxx | 24 ++++++++++++------------ forms/source/component/FormattedField.cxx | 8 ++++---- forms/source/component/FormattedFieldWrapper.cxx | 12 ++++++------ forms/source/component/GroupManager.cxx | 6 +++--- forms/source/component/ImageButton.cxx | 4 ++-- forms/source/component/ImageControl.cxx | 4 ++-- forms/source/component/ListBox.cxx | 4 ++-- forms/source/component/clickableimage.cxx | 4 ++-- forms/source/richtext/richtextmodel.cxx | 4 ++-- 14 files changed, 47 insertions(+), 48 deletions(-) (limited to 'forms') diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx index 9870aec1a130..41e8e357ca75 100644 --- a/forms/source/component/Button.cxx +++ b/forms/source/component/Button.cxx @@ -357,7 +357,7 @@ OButtonControl::OButtonControl(const Reference& _rxFactory) ,m_nTargetUrlFeatureId( -1 ) ,m_bEnabledByPropertyValue( false ) { - increment(m_refCount); + osl_atomic_increment(&m_refCount); { // Register as ActionListener Reference xButton; @@ -366,7 +366,7 @@ OButtonControl::OButtonControl(const Reference& _rxFactory) xButton->addActionListener(this); } // For Listener: refcount at one - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); } diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx index 68e668edfb68..944374e1ed2d 100644 --- a/forms/source/component/Columns.cxx +++ b/forms/source/component/Columns.cxx @@ -206,7 +206,7 @@ OGridColumn::OGridColumn( const Reference& _rContext, const O // Create the UnoControlModel if ( !m_aModelName.isEmpty() ) // is there a to-be-aggregated model? { - increment( m_refCount ); + osl_atomic_increment( &m_refCount ); { m_xAggregate.set( _rContext->getServiceManager()->createInstanceWithContext( m_aModelName, _rContext ), UNO_QUERY ); @@ -219,7 +219,7 @@ OGridColumn::OGridColumn( const Reference& _rContext, const O } // Set refcount back to zero - decrement( m_refCount ); + osl_atomic_decrement( &m_refCount ); } } @@ -235,7 +235,7 @@ OGridColumn::OGridColumn( const OGridColumn* _pOriginal ) m_aModelName = _pOriginal->m_aModelName; m_aLabel = _pOriginal->m_aLabel; - increment( m_refCount ); + osl_atomic_increment( &m_refCount ); { { m_xAggregate = createAggregateClone( _pOriginal ); @@ -247,7 +247,7 @@ OGridColumn::OGridColumn( const OGridColumn* _pOriginal ) m_xAggregate->setDelegator( static_cast< ::cppu::OWeakObject* >( this ) ); } } - decrement( m_refCount ); + osl_atomic_decrement( &m_refCount ); } diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 1bf4af9d43bc..1ba1e15e663b 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -61,7 +61,6 @@ #include #include #include -#include #include #include #include @@ -392,7 +391,7 @@ ODatabaseForm::ODatabaseForm( const ODatabaseForm& _cloneSource ) void ODatabaseForm::impl_construct() { // aggregate a row set - increment(m_refCount); + osl_atomic_increment(&m_refCount); { m_xAggregate = Reference< XAggregation >( m_xContext->getServiceManager()->createInstanceWithContext(SRV_SDB_ROWSET, m_xContext), UNO_QUERY_THROW ); m_xAggregateAsRowSet.set( m_xAggregate, UNO_QUERY_THROW ); @@ -424,7 +423,7 @@ void ODatabaseForm::impl_construct() declareForwardedProperty( PROPERTY_ID_ACTIVE_CONNECTION ); } - decrement( m_refCount ); + osl_atomic_decrement( &m_refCount ); m_pGroupManager = new OGroupManager( this ); m_pGroupManager->acquire(); diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx index f4aced15587a..ffcc37a88633 100644 --- a/forms/source/component/Edit.cxx +++ b/forms/source/component/Edit.cxx @@ -88,7 +88,7 @@ OEditControl::OEditControl(const Reference& _rxFactory) ,m_nKeyEvent( 0 ) { - increment(m_refCount); + osl_atomic_increment(&m_refCount); { Reference xComp; if (query_aggregation(m_xAggregate, xComp)) @@ -97,7 +97,7 @@ OEditControl::OEditControl(const Reference& _rxFactory) xComp->addKeyListener(this); } } - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); } diff --git a/forms/source/component/EventThread.cxx b/forms/source/component/EventThread.cxx index 47a192927f8d..737774baa57b 100644 --- a/forms/source/component/EventThread.cxx +++ b/forms/source/component/EventThread.cxx @@ -35,7 +35,7 @@ OComponentEventThread::OComponentEventThread( ::cppu::OComponentHelper* pCompImp m_pCompImpl( pCompImpl ) { - increment(m_refCount); + osl_atomic_increment(&m_refCount); // Hold a reference of the Control { @@ -49,7 +49,7 @@ OComponentEventThread::OComponentEventThread( ::cppu::OComponentHelper* pCompImp m_xComp->addEventListener( xEvtLstnr ); } - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); } OComponentEventThread::~OComponentEventThread() diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 86ab00c47e08..8f0aea69fbae 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -122,12 +122,12 @@ OControl::OControl( const Reference< XComponentContext >& _rxContext, const OUSt { // Aggregate VCL Control // Increment the RefCount for aggregates, because the aggregate by itself increments the RefCount in the setDelegator - increment( m_refCount ); + osl_atomic_increment( &m_refCount ); { m_xAggregate.set(_rxContext->getServiceManager()->createInstanceWithContext(_rAggregateService, _rxContext), css::uno::UNO_QUERY); m_xControl.set(m_xAggregate, css::uno::UNO_QUERY); } - decrement( m_refCount ); + osl_atomic_decrement( &m_refCount ); if ( _bSetDelegator ) doSetDelegator(); @@ -146,14 +146,14 @@ void OControl::doResetDelegator() void OControl::doSetDelegator() { - increment( m_refCount ); + osl_atomic_increment( &m_refCount ); if ( m_xAggregate.is() ) { // those brackets are important for some compilers, don't remove! // (they ensure that the temporary object created in the line below // is destroyed *before* the refcount-decrement) m_xAggregate->setDelegator( static_cast< XWeak* >( this ) ); } - decrement( m_refCount ); + osl_atomic_decrement( &m_refCount ); } // UNO Binding @@ -516,7 +516,7 @@ OControlModel::OControlModel( { if (!_rUnoControlModelTypeName.isEmpty()) // the is a model we have to aggregate { - increment(m_refCount); + osl_atomic_increment(&m_refCount); { m_xAggregate = Reference(m_xContext->getServiceManager()->createInstanceWithContext(_rUnoControlModelTypeName, m_xContext), UNO_QUERY); setAggregation(m_xAggregate); @@ -539,7 +539,7 @@ OControlModel::OControlModel( doSetDelegator(); // Refcount is at NULL again - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); } } @@ -567,7 +567,7 @@ OControlModel::OControlModel( const OControlModel* _pOriginal, const Reference< if ( _bCloneAggregate ) { // temporarily increment refcount because of temporary references to ourself in the following - increment( m_refCount ); + osl_atomic_increment( &m_refCount ); { // transfer the (only, at the very moment!) ref count m_xAggregate = createAggregateClone( _pOriginal ); @@ -581,7 +581,7 @@ OControlModel::OControlModel( const OControlModel* _pOriginal, const Reference< doSetDelegator(); // decrement ref count - decrement( m_refCount ); + osl_atomic_decrement( &m_refCount ); } } @@ -604,12 +604,12 @@ void OControlModel::doResetDelegator() void OControlModel::doSetDelegator() { - increment(m_refCount); + osl_atomic_increment(&m_refCount); if (m_xAggregate.is()) { m_xAggregate->setDelegator(static_cast(this)); } - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); } // XChild @@ -1263,14 +1263,14 @@ void OBoundControlModel::clonedFrom( const OControlModel* _pOriginal ) void OBoundControlModel::implInitAggMultiplexer( ) { - increment( m_refCount ); + osl_atomic_increment( &m_refCount ); if ( m_xAggregateSet.is() ) { m_pAggPropMultiplexer = new OPropertyChangeMultiplexer( this, m_xAggregateSet, false ); m_pAggPropMultiplexer->acquire(); } - decrement( m_refCount ); + osl_atomic_decrement( &m_refCount ); doSetDelegator(); } diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index 1d2fada88d51..f28c34774512 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -166,7 +166,7 @@ OFormattedControl::OFormattedControl(const Reference& _rxFact :OBoundControl(_rxFactory, VCL_CONTROL_FORMATTEDFIELD) ,m_nKeyEvent(0) { - increment(m_refCount); + osl_atomic_increment(&m_refCount); { Reference xComp; if (query_aggregation(m_xAggregate, xComp)) @@ -174,7 +174,7 @@ OFormattedControl::OFormattedControl(const Reference& _rxFact xComp->addKeyListener(this); } } - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); } OFormattedControl::~OFormattedControl() { @@ -276,9 +276,9 @@ void OFormattedModel::implConstruct() m_aNullDate = DBTypeConversion::getStandardDate(); m_nFieldType = DataType::OTHER; // default our formats supplier - increment(m_refCount); + osl_atomic_increment(&m_refCount); setPropertyToDefaultByHandle(PROPERTY_ID_FORMATSSUPPLIER); - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); startAggregatePropertyListening( PROPERTY_FORMATKEY ); startAggregatePropertyListening( PROPERTY_FORMATSSUPPLIER ); } diff --git a/forms/source/component/FormattedFieldWrapper.cxx b/forms/source/component/FormattedFieldWrapper.cxx index b368eaca33ee..3ae02677e079 100644 --- a/forms/source/component/FormattedFieldWrapper.cxx +++ b/forms/source/component/FormattedFieldWrapper.cxx @@ -69,7 +69,7 @@ InterfaceRef OFormattedFieldWrapper::createFormattedFieldWrapper(const ::com::su pRef->m_pEditPart = rtl::Reference< OEditModel >(new OEditModel(pRef->m_xContext)); } - increment(pRef->m_refCount); + osl_atomic_increment(&pRef->m_refCount); if (pRef->m_xAggregate.is()) { // has to be in it's own block because of the temporary variable created by *this @@ -77,7 +77,7 @@ InterfaceRef OFormattedFieldWrapper::createFormattedFieldWrapper(const ::com::su } InterfaceRef xRef(*pRef); - decrement(pRef->m_refCount); + osl_atomic_decrement(&pRef->m_refCount); return xRef; } @@ -296,12 +296,12 @@ void SAL_CALL OFormattedFieldWrapper::read(const Reference& } // do the aggregation - increment(m_refCount); + osl_atomic_increment(&m_refCount); if (m_xAggregate.is()) { // has to be in it's own block because of the temporary variable created by *this m_xAggregate->setDelegator(static_cast(this)); } - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); } void OFormattedFieldWrapper::ensureAggregate() @@ -333,12 +333,12 @@ void OFormattedFieldWrapper::ensureAggregate() } } - increment(m_refCount); + osl_atomic_increment(&m_refCount); if (m_xAggregate.is()) { // has to be in it's own block because of the temporary variable created by *this m_xAggregate->setDelegator(static_cast(this)); } - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); } extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL diff --git a/forms/source/component/GroupManager.cxx b/forms/source/component/GroupManager.cxx index 8f6a40f2bfc4..b8eedbd82f66 100644 --- a/forms/source/component/GroupManager.cxx +++ b/forms/source/component/GroupManager.cxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include "property.hrc" @@ -203,11 +203,11 @@ OGroupManager::OGroupManager(const Reference< XContainer >& _rxContainer) :m_pCompGroup( new OGroup( OUString("AllComponentGroup") ) ) ,m_xContainer(_rxContainer) { - increment(m_refCount); + osl_atomic_increment(&m_refCount); { _rxContainer->addContainerListener(this); } - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); } OGroupManager::~OGroupManager() diff --git a/forms/source/component/ImageButton.cxx b/forms/source/component/ImageButton.cxx index 4889d9d8f274..7a677d5b2f1f 100644 --- a/forms/source/component/ImageButton.cxx +++ b/forms/source/component/ImageButton.cxx @@ -164,7 +164,7 @@ StringSequence OImageButtonControl::getSupportedServiceNames() throw(std::excep OImageButtonControl::OImageButtonControl(const Reference& _rxFactory) :OClickableImageBaseControl(_rxFactory, VCL_CONTROL_IMAGEBUTTON) { - increment(m_refCount); + osl_atomic_increment(&m_refCount); { // Register as MouseListener Reference< awt::XWindow > xComp; @@ -172,7 +172,7 @@ OImageButtonControl::OImageButtonControl(const Reference& _rx if (xComp.is()) xComp->addMouseListener( static_cast< awt::XMouseListener* >( this ) ); } - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); } // UNO Binding diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx index e3789cf92030..8f66e1b91fb6 100644 --- a/forms/source/component/ImageControl.cxx +++ b/forms/source/component/ImageControl.cxx @@ -697,7 +697,7 @@ OImageControlControl::OImageControlControl(const Reference& _ :OBoundControl(_rxFactory, VCL_CONTROL_IMAGECONTROL) ,m_aModifyListeners( m_aMutex ) { - increment(m_refCount); + osl_atomic_increment(&m_refCount); { // Add as Focus- and MouseListener Reference< XWindow > xComp; @@ -705,7 +705,7 @@ OImageControlControl::OImageControlControl(const Reference& _ if ( xComp.is() ) xComp->addMouseListener( this ); } - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); } diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index f9d856b28ecc..5c8fd838e002 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -1770,7 +1770,7 @@ namespace frm ,m_aItemListeners( m_aMutex ) { - increment(m_refCount); + osl_atomic_increment(&m_refCount); { // Register as FocusListener Reference xComp; @@ -1782,7 +1782,7 @@ namespace frm m_xAggregateListBox->addItemListener(this); } // Refcount at 2 for registered Listener - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); doSetDelegator(); diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx index 796335772f4a..f8c178a29501 100644 --- a/forms/source/component/clickableimage.cxx +++ b/forms/source/component/clickableimage.cxx @@ -497,7 +497,7 @@ namespace frm void OClickableImageBaseModel::implConstruct() { m_pProducer = new ImageProducer; - increment( m_refCount ); + osl_atomic_increment( &m_refCount ); { m_xProducer = m_pProducer; @@ -507,7 +507,7 @@ namespace frm pMultiplexer->addProperty( PROPERTY_IMAGE_URL ); } } - decrement(m_refCount); + osl_atomic_decrement(&m_refCount); } diff --git a/forms/source/richtext/richtextmodel.cxx b/forms/source/richtext/richtextmodel.cxx index 7db6a9f5e633..313c28ff20cd 100644 --- a/forms/source/richtext/richtextmodel.cxx +++ b/forms/source/richtext/richtextmodel.cxx @@ -142,7 +142,7 @@ namespace frm void ORichTextModel::implDoAggregation() { - increment( m_refCount ); + osl_atomic_increment( &m_refCount ); { m_xAggregate = new ORichTextUnoWrapper( *m_pEngine, this ); @@ -150,7 +150,7 @@ namespace frm doSetDelegator(); } - decrement( m_refCount ); + osl_atomic_decrement( &m_refCount ); } -- cgit