diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-09-01 19:07:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-09-02 08:56:56 +0200 |
commit | aff6205058e896ffa129f9efa470b49adee0a09d (patch) | |
tree | bb5c8949abc395a67950c02ebca0eb2407dd817b | |
parent | 9c636d76a9a7e167da39913ab60f5135f8e831a6 (diff) |
replace set(nullptr) with clear()
It's a little easier to read, but mostly it makes an upcoming
loplugin easier to implement
Change-Id: I4ae7db8eda77795dab3255d1afd8ba4f20a8de76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156451
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | canvas/source/cairo/cairo_canvashelper.cxx | 4 | ||||
-rw-r--r-- | chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx | 24 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/tp_DataSource.cxx | 2 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController.cxx | 4 | ||||
-rw-r--r-- | chart2/source/inc/DisposeHelper.hxx | 2 | ||||
-rw-r--r-- | chart2/source/model/main/Axis.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/main/VDataSeries.cxx | 12 | ||||
-rw-r--r-- | cui/source/dialogs/SignSignatureLineDialog.cxx | 2 | ||||
-rw-r--r-- | desktop/source/deployment/registry/component/dp_component.cxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/composeduiupdate.cxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/formcomponenthandler.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 2 | ||||
-rw-r--r-- | svx/source/unodraw/unoshap2.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltbli.cxx | 2 | ||||
-rw-r--r-- | vcl/win/dtrans/XTDataObject.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/text/txtimp.cxx | 6 |
19 files changed, 42 insertions, 42 deletions
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index b8c4f26be2ca..2eb13678ca72 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -1229,7 +1229,7 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas:: free( data ); } else - rv.set(nullptr); + rv.clear(); #ifdef CAIRO_CANVAS_PERF_TRACE mxDevice->stopPerfTrace( &aTimer, "drawBitmap" ); @@ -1262,7 +1262,7 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas:: free( data ); } else - rv.set(nullptr); + rv.clear(); #ifdef CAIRO_CANVAS_PERF_TRACE mxDevice->stopPerfTrace( &aTimer, "drawBitmap" ); diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index 85ff5c7022c3..70c9ace455b9 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -868,9 +868,9 @@ void SAL_CALL ChartDocumentWrapper::dispose() DisposeHelper::DisposeAndClear( m_xChartData ); DisposeHelper::DisposeAndClear( m_xDiagram ); DisposeHelper::DisposeAndClear( m_xArea ); - m_xChartView.set( nullptr ); - m_xShapeFactory.set( nullptr ); - m_xDelegator.set( nullptr ); + m_xChartView.clear(); + m_xShapeFactory.clear(); + m_xDelegator.clear(); clearWrappedPropertySet(); m_spChart2ModelContact->clear(); @@ -897,7 +897,7 @@ void SAL_CALL ChartDocumentWrapper::dispose() void ChartDocumentWrapper::impl_resetAddIn() { Reference< util::XRefreshable > xAddIn( m_xAddIn ); - m_xAddIn.set( nullptr ); + m_xAddIn.clear(); if( !xAddIn.is() ) return; @@ -1349,21 +1349,21 @@ uno::Any SAL_CALL ChartDocumentWrapper::queryAggregation( const uno::Type& rType void ChartDocumentWrapper::_disposing( const lang::EventObject& rSource ) { if( rSource.Source == m_xTitle ) - m_xTitle.set( nullptr ); + m_xTitle.clear(); else if( rSource.Source == m_xSubTitle ) - m_xSubTitle.set( nullptr ); + m_xSubTitle.clear(); else if( rSource.Source == m_xLegend ) - m_xLegend.set( nullptr ); + m_xLegend.clear(); else if( rSource.Source == m_xChartData ) - m_xChartData.set( nullptr ); + m_xChartData.clear(); else if( rSource.Source == m_xDiagram ) - m_xDiagram.set( nullptr ); + m_xDiagram.clear(); else if( rSource.Source == m_xArea ) - m_xArea.set( nullptr ); + m_xArea.clear(); else if( rSource.Source == m_xAddIn ) - m_xAddIn.set( nullptr ); + m_xAddIn.clear(); else if( rSource.Source == static_cast<cppu::OWeakObject*>(m_xChartView.get()) ) - m_xChartView.set( nullptr ); + m_xChartView.clear(); } // WrappedPropertySet diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx index 0f21a03fd4f8..7ac75f3afa2b 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.cxx +++ b/chart2/source/controller/dialogs/tp_DataSource.cxx @@ -768,7 +768,7 @@ bool DataSourceTabPage::updateModelFromControl(const weld::Entry* pField) else if( xLabeledSeq.is()) { // clear existing categories - xLabeledSeq.set(nullptr); + xLabeledSeq.clear(); m_rDialogModel.setCategories( xLabeledSeq ); } } diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 3f94410d22b0..1c85ab369269 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -817,7 +817,7 @@ void SAL_CALL ChartController::dispose() if( m_xLayoutManagerEventBroadcaster.is()) { m_xLayoutManagerEventBroadcaster->removeLayoutManagerEventListener( this ); - m_xLayoutManagerEventBroadcaster.set( nullptr ); + m_xLayoutManagerEventBroadcaster.clear(); } m_xFrame.clear(); @@ -961,7 +961,7 @@ void SAL_CALL ChartController::disposing( if( !impl_releaseThisModel( rSource.Source )) { if( rSource.Source == m_xLayoutManagerEventBroadcaster ) - m_xLayoutManagerEventBroadcaster.set( nullptr ); + m_xLayoutManagerEventBroadcaster.clear(); } } diff --git a/chart2/source/inc/DisposeHelper.hxx b/chart2/source/inc/DisposeHelper.hxx index 8c9b0b7d47f3..58dc2d5c55ba 100644 --- a/chart2/source/inc/DisposeHelper.hxx +++ b/chart2/source/inc/DisposeHelper.hxx @@ -33,7 +33,7 @@ template <class T> void Dispose(const T& xInterface) template <class T> void DisposeAndClear(css::uno::Reference<T>& rInterface) { Dispose<css::uno::Reference<T>>(rInterface); - rInterface.set(nullptr); + rInterface.clear(); } template <class Container> void DisposeAllElements(Container& rContainer) diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx index 99e20fbc86fb..26a6d48368b9 100644 --- a/chart2/source/model/main/Axis.cxx +++ b/chart2/source/model/main/Axis.cxx @@ -340,7 +340,7 @@ Axis::~Axis() if( m_aScaleData.Categories.is()) { ModifyListenerHelper::removeListener( m_aScaleData.Categories, m_xModifyEventForwarder ); - m_aScaleData.Categories.set(nullptr); + m_aScaleData.Categories.clear(); } } catch( const uno::Exception & ) diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 0ff045b5fde9..49b606ae0a6c 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -285,12 +285,12 @@ void VDataSeries::doSortByXValues() void VDataSeries::releaseShapes() { - m_xGroupShape.set(nullptr); - m_xLabelsGroupShape.set(nullptr); - m_xErrorXBarsGroupShape.set(nullptr); - m_xErrorYBarsGroupShape.set(nullptr); - m_xFrontSubGroupShape.set(nullptr); - m_xBackSubGroupShape.set(nullptr); + m_xGroupShape.clear(); + m_xLabelsGroupShape.clear(); + m_xErrorXBarsGroupShape.clear(); + m_xErrorYBarsGroupShape.clear(); + m_xFrontSubGroupShape.clear(); + m_xBackSubGroupShape.clear(); m_aPolyPolygonShape3D.clear(); m_nPolygonIndex = 0; diff --git a/cui/source/dialogs/SignSignatureLineDialog.cxx b/cui/source/dialogs/SignSignatureLineDialog.cxx index 94306764b201..4088b40e1765 100644 --- a/cui/source/dialogs/SignSignatureLineDialog.cxx +++ b/cui/source/dialogs/SignSignatureLineDialog.cxx @@ -147,7 +147,7 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, loadImage, weld::Button&, void) IMPL_LINK_NOARG(SignSignatureLineDialog, clearImage, weld::Button&, void) { - m_xSignatureImage.set(nullptr); + m_xSignatureImage.clear(); m_xBtnLoadImage->set_label(m_sOriginalImageBtnLabel); ValidateFields(); } diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index cbe7548f05cb..635ff1af4f60 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -1560,7 +1560,7 @@ BackendImpl::OtherPlatformPackageImpl::impl_openRDB() const catch (registry::InvalidRegistryException const&) { // If the registry does not exist, we do not need to bother at all - xRegistry.set(nullptr); + xRegistry.clear(); } SAL_WARN_IF( !xRegistry.is(), "desktop.deployment", "could not create registry for the package's platform"); diff --git a/extensions/source/propctrlr/composeduiupdate.cxx b/extensions/source/propctrlr/composeduiupdate.cxx index 0e32ef19a9db..247dd4ab3e71 100644 --- a/extensions/source/propctrlr/composeduiupdate.cxx +++ b/extensions/source/propctrlr/composeduiupdate.cxx @@ -766,7 +766,7 @@ namespace pcr singleUI.second->dispose(); } m_pCollectedUIs.reset(); - m_xDelegatorUI.set( nullptr ); + m_xDelegatorUI.clear(); } diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 1ca87af6e2fb..4265a8bc2dee 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -3151,7 +3151,7 @@ namespace pcr return true; } m_xCommandDesigner->dispose(); - m_xCommandDesigner.set( nullptr ); + m_xCommandDesigner.clear(); } if ( !impl_ensureRowsetConnection_nothrow() ) diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index f3c989ee8293..6c5c4e96a9f4 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -3273,7 +3273,7 @@ uno::Reference<sdbc::XRowSet> ScDPCollection::DBCaches::createRowSet( OSL_ENSURE( xRowProp.is(), "can't get RowSet" ); if (!xRowProp.is()) { - xRowSet.set(nullptr); + xRowSet.clear(); return xRowSet; } @@ -3309,7 +3309,7 @@ uno::Reference<sdbc::XRowSet> ScDPCollection::DBCaches::createRowSet( TOOLS_WARN_EXCEPTION( "sc", "Unexpected exception in database"); } - xRowSet.set(nullptr); + xRowSet.clear(); return xRowSet; } diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index e46dda12580b..917935d907d1 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -288,7 +288,7 @@ SfxObjectShell::~SfxObjectShell() EnableSetModified( false ); SfxObjectShell::CloseInternal(); - pImpl->pBaseModel.set( nullptr ); + pImpl->pBaseModel.clear(); pImpl->pReloadTimer.reset(); @@ -302,7 +302,7 @@ SfxObjectShell::~SfxObjectShell() if ( pSfxApp && pSfxApp->GetDdeService() ) pSfxApp->RemoveDdeTopic( this ); - pImpl->pBaseModel.set( nullptr ); + pImpl->pBaseModel.clear(); // don't call GetStorage() here, in case of Load Failure it's possible that a storage was never assigned! if ( pMedium && pMedium->HasStorage_Impl() && pMedium->GetStorage( false ) == pImpl->m_xDocStorage ) diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index ca960f43fec6..69ff73cad760 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -3245,7 +3245,7 @@ void SdrObjCustomShape::setUnoShape(const uno::Reference<drawing::XShape>& rxUno // The shape engine is created with _current_ shape. This means we // _must_ reset it when the shape changes. - mxCustomShapeEngine.set(nullptr); + mxCustomShapeEngine.clear(); } OUString SdrObjCustomShape::GetCustomShapeName() const diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx index c1f715bd2ad5..96d34a601f27 100644 --- a/svx/source/unodraw/unoshap2.cxx +++ b/svx/source/unodraw/unoshap2.cxx @@ -1699,7 +1699,7 @@ void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, c // UNO API object, but the XCustomShapeEngine involved. This // object is on-demand replaceable and can be reset here. This // will free the involved EditEngine and VirtualDevice. - pTarget->mxCustomShapeEngine.set(nullptr); + pTarget->mxCustomShapeEngine.clear(); } // since this case is only for the application cores // we should return from this function now diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 9578b45cdfe7..1c9c6a8345b2 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -2643,7 +2643,7 @@ void SwXMLTableContext::MakeTable() m_pTableNode ); // 2) release the DDE source context, - m_xDDESource.set(nullptr); + m_xDDESource.clear(); // 3) create new DDE table, and std::unique_ptr<SwDDETable> pDDETable( new SwDDETable( m_pTableNode->GetTable(), diff --git a/vcl/win/dtrans/XTDataObject.cxx b/vcl/win/dtrans/XTDataObject.cxx index adbed6bbec9f..18c9144439e6 100644 --- a/vcl/win/dtrans/XTDataObject.cxx +++ b/vcl/win/dtrans/XTDataObject.cxx @@ -93,7 +93,7 @@ public: virtual void SAL_CALL notify(css::uno::Any const &) override { - maTransferable.set(nullptr); + maTransferable.clear(); } }; diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 1efe8b78416e..24264a77460b 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -1794,8 +1794,8 @@ void SvXMLImport::DisposingModel() if( mxMasterStyles.is() ) mxMasterStyles->dispose(); - mxModel.set(nullptr); - mxEventListener.set(nullptr); + mxModel.clear(); + mxEventListener.clear(); } ::comphelper::UnoInterfaceToUniqueIdentifierMapper& SvXMLImport::getInterfaceToIdentifierMapper() diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 0a4a18ad10d3..fa43e44e2b22 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -621,9 +621,9 @@ void XMLTextImportHelper::SetCursor( const Reference < XTextCursor > & rCursor ) void XMLTextImportHelper::ResetCursor() { - m_xImpl->m_xCursor.set(nullptr); - m_xImpl->m_xText.set(nullptr); - m_xImpl->m_xCursorAsRange.set(nullptr); + m_xImpl->m_xCursor.clear(); + m_xImpl->m_xText.clear(); + m_xImpl->m_xCursorAsRange.clear(); } |