From cc4831a7a5f5476d1c184b127127e9388c4a51ee Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 13 Jan 2024 19:13:00 +0000 Subject: cid#1546354 COPY_INSTEAD_OF_MOVE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and cid#1546319 COPY_INSTEAD_OF_MOVE cid#1546286 COPY_INSTEAD_OF_MOVE cid#1546283 COPY_INSTEAD_OF_MOVE cid#1546191 COPY_INSTEAD_OF_MOVE cid#1545953 COPY_INSTEAD_OF_MOVE cid#1545874 COPY_INSTEAD_OF_MOVE cid#1545857 COPY_INSTEAD_OF_MOVE cid#1545781 COPY_INSTEAD_OF_MOVE cid#1545765 COPY_INSTEAD_OF_MOVE cid#1545546 COPY_INSTEAD_OF_MOVE cid#1545338 COPY_INSTEAD_OF_MOVE cid#1545190 COPY_INSTEAD_OF_MOVE cid#1545272 COPY_INSTEAD_OF_MOVE cid#1545242 COPY_INSTEAD_OF_MOVE cid#1545229 COPY_INSTEAD_OF_MOVE Change-Id: I88813d9dbd87ce10375db8198028f8b70e23f0fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162027 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- chart2/source/model/main/ChartModel.cxx | 21 ++++++++++++--------- chart2/source/model/main/Diagram.cxx | 4 ++-- chart2/source/view/charttypes/CandleStickChart.cxx | 4 +--- connectivity/source/manager/mdrivermanager.cxx | 4 ++-- framework/source/services/frame.cxx | 18 ++++++++++-------- include/oox/helper/refvector.hxx | 6 +++--- oox/source/ole/vbaproject.cxx | 4 ++-- sc/source/core/data/column.cxx | 8 +++++--- sc/source/core/data/table3.cxx | 12 ++++++++---- ucb/source/core/ucbstore.cxx | 2 +- vcl/inc/jsdialog/jsdialogbuilder.hxx | 6 +++--- .../source/dmapper/DomainMapperTableHandler.cxx | 5 +++-- writerfilter/source/ooxml/OOXMLDocumentImpl.cxx | 8 ++++---- xmlhelp/source/cxxhelp/provider/databases.cxx | 3 +-- 14 files changed, 57 insertions(+), 48 deletions(-) diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 19fccff373e9..6c4fe2dfa658 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -159,17 +159,20 @@ ChartModel::ChartModel( const ChartModel & rOther ) if (rOther.m_xDiagram.is()) xNewDiagram = new ::chart::Diagram( *rOther.m_xDiagram ); rtl::Reference< ::chart::PageBackground > xNewPageBackground = new PageBackground( *rOther.m_xPageBackground ); - rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager; // does not implement XCloneable - rtl::Reference< ::chart::NameContainer > xXMLNamespaceMap = new NameContainer( *rOther.m_xXMLNamespaceMap ); { - MutexGuard aGuard( m_aModelMutex ); - xListener = this; - m_xTitle = xNewTitle; - m_xDiagram = xNewDiagram; - m_xPageBackground = xNewPageBackground; - m_xChartTypeManager = xChartTypeManager; - m_xXMLNamespaceMap = xXMLNamespaceMap; + rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager; // does not implement XCloneable + rtl::Reference< ::chart::NameContainer > xXMLNamespaceMap = new NameContainer( *rOther.m_xXMLNamespaceMap ); + + { + MutexGuard aGuard( m_aModelMutex ); + xListener = this; + m_xTitle = xNewTitle; + m_xDiagram = xNewDiagram; + m_xPageBackground = std::move(xNewPageBackground); + m_xChartTypeManager = std::move(xChartTypeManager); + m_xXMLNamespaceMap = std::move(xXMLNamespaceMap); + } } ModifyListenerHelper::addListener( xNewTitle, xListener ); diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx index db7be686b0c9..bd0275dd8e98 100644 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -1098,11 +1098,11 @@ static bool lcl_moveSeriesOrCheckIfMoveIsAllowed( std::vector< rtl::Reference< DataSeries > > aOtherSeriesList = xOtherChartType->getDataSeries2(); if( !aOtherSeriesList.empty() ) { - rtl::Reference< DataSeries > xExchangeSeries( aOtherSeriesList[0] ); + rtl::Reference xExchangeSeries(aOtherSeriesList[0]); aOtherSeriesList[0] = xGivenDataSeries; xOtherChartType->setDataSeries(aOtherSeriesList); - aSeriesList[nOldSeriesIndex]=xExchangeSeries; + aSeriesList[nOldSeriesIndex] = std::move(xExchangeSeries); xCurrentChartType->setDataSeries(aSeriesList); } } diff --git a/chart2/source/view/charttypes/CandleStickChart.cxx b/chart2/source/view/charttypes/CandleStickChart.cxx index 20c53461d19b..5d907269c119 100644 --- a/chart2/source/view/charttypes/CandleStickChart.cxx +++ b/chart2/source/view/charttypes/CandleStickChart.cxx @@ -201,9 +201,7 @@ void CandleStickChart::createShapes() drawing::Position3D aPosMiddleMinimum( pPosHelper->transformScaledLogicToScene( fScaledX, fScaledY_Min ,0 ,true ) ); drawing::Position3D aPosMiddleMaximum( pPosHelper->transformScaledLogicToScene( fScaledX, fScaledY_Max ,0 ,true ) ); - rtl::Reference xLossGainTarget( xGainTarget ); - if(bBlack) - xLossGainTarget = xLossTarget; + rtl::Reference xLossGainTarget(bBlack ? xLossTarget : xGainTarget); uno::Reference< beans::XPropertySet > xPointProp( pSeries->getPropertiesOfPoint( nIndex )); rtl::Reference xPointGroupShape_Shapes; diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx index 5c283be5d82d..ee80460621f5 100644 --- a/connectivity/source/manager/mdrivermanager.cxx +++ b/connectivity/source/manager/mdrivermanager.cxx @@ -591,8 +591,8 @@ Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const OUString& _rU { const OUString sDriverFactoryName = m_aDriverConfig.getDriverFactoryName(_rURL); - EqualDriverAccessToName aEqual(sDriverFactoryName); - DriverAccessArray::const_iterator aFind = std::find_if(m_aDriversBS.begin(),m_aDriversBS.end(),aEqual); + DriverAccessArray::const_iterator aFind = std::find_if(m_aDriversBS.begin(), m_aDriversBS.end(), + EqualDriverAccessToName(sDriverFactoryName)); if ( aFind == m_aDriversBS.end() ) { // search all bootstrapped drivers diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 659578975a5e..34024b45f5ad 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -800,15 +800,17 @@ void SAL_CALL XFrameImpl::initialize( const css::uno::Reference< css::awt::XWind // create progress helper css::uno::Reference< css::frame::XFrame > xThis (this); - css::uno::Reference< css::task::XStatusIndicatorFactory > xIndicatorFactory = - css::task::StatusIndicatorFactory::createWithFrame(m_xContext, xThis, - false/*DisableReschedule*/, true/*AllowParentShow*/ ); + { + css::uno::Reference< css::task::XStatusIndicatorFactory > xIndicatorFactory = + css::task::StatusIndicatorFactory::createWithFrame(m_xContext, xThis, + false/*DisableReschedule*/, true/*AllowParentShow*/ ); - // SAFE -> ---------------------------------- - aWriteLock.reset(); - m_xIndicatorFactoryHelper = xIndicatorFactory; - aWriteLock.clear(); - // <- SAFE ---------------------------------- + // SAFE -> ---------------------------------- + aWriteLock.reset(); + m_xIndicatorFactoryHelper = std::move(xIndicatorFactory); + aWriteLock.clear(); + // <- SAFE ---------------------------------- + } // Start listening for events after setting it on helper class ... // So superfluous messages are filtered to NULL :-) diff --git a/include/oox/helper/refvector.hxx b/include/oox/helper/refvector.hxx index 8e60c20798b8..61bd04344080 100644 --- a/include/oox/helper/refvector.hxx +++ b/include/oox/helper/refvector.hxx @@ -58,9 +58,9 @@ public: skips all elements that are empty references. */ template< typename FunctorType > void forEach( FunctorType aFunctor ) const - { - ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( aFunctor ) ); - } + { + std::for_each(this->begin(), this->end(), ForEachFunctor(std::move(aFunctor))); + } /** Calls the passed member function of ObjType on every contained object, automatically skips all elements that are empty references. */ diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx index d87c689f8eeb..3f52d15032e7 100644 --- a/oox/source/ole/vbaproject.cxx +++ b/oox/source/ole/vbaproject.cxx @@ -162,11 +162,11 @@ bool VbaProject::importVbaProject( StorageBase& rVbaPrjStrg ) Reference< css::frame::XController > xController = mxDocModel->getCurrentController(); xFrame = xController.is() ? xController->getFrame() : nullptr; } - StorageRef noStorage; + // if the GraphicHelper tries to use noStorage it will of course crash // but... this shouldn't happen as there is no reason for GraphicHelper // to do that when importing VBA projects - GraphicHelper grfHlp( mxContext, xFrame, noStorage ); + GraphicHelper grfHlp(mxContext, xFrame, StorageRef()); importVbaProject( rVbaPrjStrg, grfHlp ); // return true if something has been imported return (mxBasicLib.is() && mxBasicLib->hasElements()) || diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 6c6b55efa309..16b9560cc027 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2385,15 +2385,17 @@ bool ScColumn::UpdateReference( sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc // Check the row positions at which the group must be split per relative // references. - UpdateRefGroupBoundChecker aBoundChecker(rCxt, aBounds); - std::for_each(maCells.begin(), maCells.end(), aBoundChecker); + { + UpdateRefGroupBoundChecker aBoundChecker(rCxt, aBounds); + std::for_each(maCells.begin(), maCells.end(), std::move(aBoundChecker)); + } // If expand reference edges is on, splitting groups may happen anywhere // where a reference points to an adjacent row of the insertion. if (rCxt.mnRowDelta > 0 && rCxt.mrDoc.IsExpandRefs()) { UpdateRefExpandGroupBoundChecker aExpandChecker(rCxt, aBounds); - std::for_each(maCells.begin(), maCells.end(), aExpandChecker); + std::for_each(maCells.begin(), maCells.end(), std::move(aExpandChecker)); } // Do the actual splitting. diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 359cc5dcc4f5..9dfa0ddc24fa 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1043,8 +1043,10 @@ void ScTable::SortReorderByColumn( // once. std::sort(aListeners.begin(), aListeners.end()); aListeners.erase(std::unique(aListeners.begin(), aListeners.end()), aListeners.end()); - ReorderNotifier aFunc(aColMap, nTab, nRow1, nRow2); - std::for_each(aListeners.begin(), aListeners.end(), aFunc); + { + ReorderNotifier aFunc(aColMap, nTab, nRow1, nRow2); + std::for_each(aListeners.begin(), aListeners.end(), std::move(aFunc)); + } // Re-start area listeners on the reordered columns. { @@ -1488,8 +1490,10 @@ void ScTable::SortReorderByRowRefUpdate( } // Notify the listeners to update their references. - ReorderNotifier aFunc(aRowMap, nTab, nCol1, nCol2); - std::for_each(aListeners.begin(), aListeners.end(), aFunc); + { + ReorderNotifier aFunc(aRowMap, nTab, nCol1, nCol2); + std::for_each(aListeners.begin(), aListeners.end(), std::move(aFunc)); + } // Re-group formulas in affected columns. for (const auto& [rTab, rCols] : rGroupTabs) diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx index 10dafddc81a5..c57af43642da 100644 --- a/ucb/source/core/ucbstore.cxx +++ b/ucb/source/core/ucbstore.cxx @@ -1830,7 +1830,7 @@ void SAL_CALL PersistentPropertySet::setPropertyValues( aEvt.PropertyName = rNewValue.Name; aEvt.PropertyHandle = rNewValue.Handle; aEvt.Further = false; - aEvt.OldValue = aOldValue; + aEvt.OldValue = std::move(aOldValue); aEvt.NewValue = rNewValue.Value; aEvents.push_back( aEvt ); diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 3d98e7e61a19..6a88d270351f 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -168,10 +168,10 @@ public: void flush() { mpIdleNotify->Invoke(); } protected: - void initializeSender(VclPtr aNotifierWindow, VclPtr aContentWindow, - const OUString& sTypeOfJSON) + void initializeSender(const VclPtr& rNotifierWindow, + const VclPtr& rContentWindow, const OUString& rTypeOfJSON) { - mpIdleNotify.reset(new JSDialogNotifyIdle(aNotifierWindow, aContentWindow, sTypeOfJSON)); + mpIdleNotify.reset(new JSDialogNotifyIdle(rNotifierWindow, rContentWindow, rTypeOfJSON)); } }; diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 0ecc6701551a..15f44a8cc880 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -1140,9 +1140,10 @@ void DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag } OUString sParaStyleName; rParaProp.m_rPropertySet->getPropertyValue("ParaStyleName") >>= sParaStyleName; - StyleSheetEntryPtr pEntry = m_rDMapper_Impl.GetStyleSheetTable()->FindStyleSheetByConvertedStyleName(sParaStyleName); bool bDocDefault; - uno::Any aParaStyle = m_rDMapper_Impl.GetPropertyFromStyleSheet(eId, pEntry, true, true, &bDocDefault); + uno::Any aParaStyle = m_rDMapper_Impl.GetPropertyFromStyleSheet(eId, + m_rDMapper_Impl.GetStyleSheetTable()->FindStyleSheetByConvertedStyleName(sParaStyleName), + true, true, &bDocDefault); // A very strange compatibility rule says that the DEFAULT style's specified fontsize of 11 or 12 // or a specified left justify will always be overridden by the table-style. // Normally this rule is applied, so always do this unless a compatSetting indicates otherwise. diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index d9900ea7e4fc..c576aa330d46 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -336,13 +336,13 @@ void OOXMLDocumentImpl::resolveComment(Stream & rStream, OOXMLPropertySet * OOXMLDocumentImpl::getPicturePropSet (const OUString & rId) { - OOXMLStream::Pointer_t pStream + OOXMLStream::Pointer_t xStream (OOXMLDocumentFactory::createStream(mpStream, rId)); - writerfilter::Reference::Pointer_t pPicture - (new OOXMLBinaryObjectReference(pStream)); + writerfilter::Reference::Pointer_t xPicture + (new OOXMLBinaryObjectReference(std::move(xStream))); - OOXMLValue::Pointer_t pPayloadValue(new OOXMLBinaryValue(pPicture)); + OOXMLValue::Pointer_t pPayloadValue(new OOXMLBinaryValue(std::move(xPicture))); OOXMLPropertySet::Pointer_t pBlipSet(new OOXMLPropertySet); diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 1969c1d3908c..cc05fb69ea29 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -789,8 +789,7 @@ KeywordInfo* Databases::getKeyword( const OUString& Database, // sorting Reference xCollator = getCollator(aGuard, Language); - KeywordElementComparator aComparator( xCollator ); - std::sort(aVector.begin(),aVector.end(),aComparator); + std::sort(aVector.begin(), aVector.end(), KeywordElementComparator(xCollator)); it->second.reset(new KeywordInfo( aVector )); } -- cgit