scripting/source/stringresource/stringresource.cxx | 3 - sd/source/core/CustomAnimationEffect.cxx | 2 sd/source/core/EffectMigration.cxx | 22 +++++----- sd/source/core/drawdoc3.cxx | 6 +- sd/source/core/sdpage.cxx | 2 sd/source/filter/eppt/epptso.cxx | 8 +-- sd/source/filter/html/htmlex.cxx | 2 sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx | 2 sd/source/ui/framework/configuration/ConfigurationUpdater.cxx | 7 +-- xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx | 4 - xmloff/source/chart/SchXMLAxisContext.cxx | 6 +- xmloff/source/chart/SchXMLPlotAreaContext.cxx | 2 xmloff/source/chart/SchXMLTools.cxx | 2 xmloff/source/core/xmlexp.cxx | 2 xmloff/source/text/txtflde.cxx | 2 15 files changed, 35 insertions(+), 37 deletions(-)
New commits: commit e23be78a6a98c3eb4bef0d598369238ee1ec0cf5 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Nov 11 22:06:52 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Nov 12 11:15:26 2024 +0100 clang-tidy: performance-unnecessary-copy-initialization in xmloff Change-Id: I086167b3d24c125efac99180012e32d9851d49ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176444 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx index 07cbdb15b6e6..cbeeed2f4159 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx @@ -113,7 +113,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte } std::vector< OUString > aCompleteResultVector; - OUString scope = aURLParameter.get_scope(); + const OUString& scope = aURLParameter.get_scope(); bool bCaptionsOnly = scope == "Heading"; sal_Int32 hitCount = aURLParameter.get_hitCount(); @@ -297,7 +297,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte int nResultCount = aCompleteResultVector.size(); for( int r = 0 ; r < nResultCount ; ++r ) { - OUString aURL = aCompleteResultVector[r]; + const OUString& aURL = aCompleteResultVector[r]; OUString aResultStr = replWith + aURL.subView(replIdx); m_aPath.push_back( aResultStr ); } diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx index 4e118e81c72c..626da82c6fdb 100644 --- a/xmloff/source/chart/SchXMLAxisContext.cxx +++ b/xmloff/source/chart/SchXMLAxisContext.cxx @@ -293,7 +293,7 @@ Reference< chart2::XAxis > lcl_getAxis( const Reference< frame::XModel >& xChart sal_Int32 nCooSysIndex = 0; if( nCooSysIndex < aCooSysSeq.getLength() ) { - Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[nCooSysIndex] ); + const Reference< chart2::XCoordinateSystem >& xCooSys( aCooSysSeq[nCooSysIndex] ); if( xCooSys.is() && nDimensionIndex < xCooSys->getDimension() ) { const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex); @@ -499,7 +499,7 @@ void SchXMLAxisContext::CreateAxis() if( aCooSysSeq.hasElements() ) { bool bSwapXandYAxis = false; - Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] ); + const Reference< chart2::XCoordinateSystem >& xCooSys( aCooSysSeq[0] ); Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY ); if( xCooSysProp.is() && ( xCooSysProp->getPropertyValue(u"SwapXAndYAxis"_ustr) >>= bSwapXandYAxis ) && bSwapXandYAxis ) @@ -675,7 +675,7 @@ void SchXMLAxisContext::CorrectAxisPositions( const Reference< chart2::XChartDoc uno::Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); if( aCooSysSeq.hasElements() ) { - Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] ); + const Reference< chart2::XCoordinateSystem >& xCooSys( aCooSysSeq[0] ); if( xCooSys.is() ) { Reference< chart2::XAxis > xMainXAxis = lcl_getAxis( xCooSys, 0, 0 ); diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 4ace40238e47..373c355141a1 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -158,7 +158,7 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext( m_rbHasRangeAtPlotArea = false; // get Diagram - uno::Reference< chart::XChartDocument > xDoc = rImpHelper.GetChartDocument(); + const uno::Reference< chart::XChartDocument >& xDoc = rImpHelper.GetChartDocument(); if( xDoc.is()) { mxDiagram = xDoc->getDiagram(); diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index c71867a25613..2cda1e39c5a2 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -466,7 +466,7 @@ void CreateCategories( aCooSysSeq( xCooSysCnt->getCoordinateSystems()); if( nCooSysIndex < aCooSysSeq.getLength()) { - uno::Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[nCooSysIndex] ); + const uno::Reference< chart2::XCoordinateSystem >& xCooSys( aCooSysSeq[nCooSysIndex] ); SAL_WARN_IF( !xCooSys.is(), "xmloff.chart", "xCooSys is NULL"); if( nDimensionIndex < xCooSys->getDimension() ) { diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 587700619976..2cec3eb32f89 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1903,7 +1903,7 @@ OUString SvXMLExport::AddEmbeddedXGraphic(uno::Reference<graphic::XGraphic> cons OUString sURL; Graphic aGraphic(rxGraphic); - OUString aOriginURL = aGraphic.getOriginURL(); + const OUString& aOriginURL = aGraphic.getOriginURL(); if (!aOriginURL.isEmpty()) { diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index b7172fb46e6c..67f5a9ce2412 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -2919,7 +2919,7 @@ bool XMLTextFieldExport::GetDependentFieldPropertySet( if (aFields.hasElements()) { // get first one and return - Reference<XDependentTextField> xTField = aFields[0]; + const Reference<XDependentTextField>& xTField = aFields[0]; xField.set(xTField, UNO_QUERY); DBG_ASSERT(xField.is(), "Surprisingly, this TextField refuses to be a PropertySet!"); commit 20d971a58727715475b3dcdd22ad568190c2fac4 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Nov 11 22:04:52 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Nov 12 11:15:14 2024 +0100 clang-tidy: performance-unnecessary-copy-initialization in sd Change-Id: I2521bc29afb9ae98d7db2fab81f93264c91c4065 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176438 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 1e548d6ae3bc..ca9d55ba3f79 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -1373,8 +1373,7 @@ void StringResourcePersistenceImpl::importBinary( const Sequence< ::sal_Int8 >& nOldLocaleCount = aLocaleSeq.getLength(); if( nOldLocaleCount > 0 ) { - Locale aLocale = aLocaleSeq[0]; - removeLocale( aLocale ); + removeLocale( aLocaleSeq[0] ); } } while( nOldLocaleCount > 0 ); diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index c0db269932d4..c74d384c17a8 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -2717,7 +2717,7 @@ void EffectSequenceHelper::setAnimateForm( const CustomAnimationTextGroupPtr& pT if( !bAnimateForm && (aEffects.size() == 1) ) { - CustomAnimationEffectPtr pEffect( *aIter ); + const CustomAnimationEffectPtr& pEffect( *aIter ); pEffect->setTarget( Any( (*aIter)->getTargetShape() ) ); pEffect->setTargetSubItem( ShapeAnimationSubType::ONLY_TEXT ); pTextGroup->addEffect( pEffect ); diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx index 8acdd0681dd9..e1a880592101 100644 --- a/sd/source/core/EffectMigration.cxx +++ b/sd/source/core/EffectMigration.cxx @@ -832,7 +832,7 @@ void EffectMigration::SetAnimationSpeed( SvxShape* pShape, AnimationSpeed eSpeed for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter ) { - CustomAnimationEffectPtr pEffect( *aIter ); + const CustomAnimationEffectPtr& pEffect( *aIter ); if( pEffect->getTargetShape() == xShape ) { if( pEffect->getDuration() != 0.1 ) @@ -861,7 +861,7 @@ AnimationSpeed EffectMigration::GetAnimationSpeed( SvxShape* pShape ) }); if (aIter != pMainSequence->getEnd()) { - CustomAnimationEffectPtr pEffect( *aIter ); + const CustomAnimationEffectPtr& pEffect( *aIter ); fDuration = pEffect->getDuration(); } @@ -902,7 +902,7 @@ void EffectMigration::SetDimColor( SvxShape* pShape, sal_Int32 nColor ) for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter ) { - CustomAnimationEffectPtr pEffect( *aIter ); + const CustomAnimationEffectPtr& pEffect( *aIter ); if( pEffect->getTargetShape() == xShape ) { pEffect->setHasAfterEffect( true ); @@ -935,7 +935,7 @@ sal_Int32 EffectMigration::GetDimColor( SvxShape* pShape ) }); if (aIter != pMainSequence->getEnd()) { - CustomAnimationEffectPtr pEffect( *aIter ); + const CustomAnimationEffectPtr& pEffect( *aIter ); pEffect->getDimColor() >>= nColor; } } @@ -964,7 +964,7 @@ void EffectMigration::SetDimHide( SvxShape* pShape, bool bDimHide ) for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter ) { - CustomAnimationEffectPtr pEffect( *aIter ); + const CustomAnimationEffectPtr& pEffect( *aIter ); if( pEffect->getTargetShape() == xShape ) { pEffect->setHasAfterEffect( bDimHide ); @@ -997,7 +997,7 @@ bool EffectMigration::GetDimHide( SvxShape* pShape ) [&xShape](const CustomAnimationEffectPtr& pEffect) { return pEffect->getTargetShape() == xShape; }); if (aIter != pMainSequence->getEnd()) { - CustomAnimationEffectPtr pEffect( *aIter ); + const CustomAnimationEffectPtr& pEffect( *aIter ); bRet = pEffect->hasAfterEffect() && !pEffect->getDimColor().hasValue() && (!pEffect->IsAfterEffectOnNext()); @@ -1033,7 +1033,7 @@ void EffectMigration::SetDimPrevious( SvxShape* pShape, bool bDimPrevious ) for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter ) { - CustomAnimationEffectPtr pEffect( *aIter ); + const CustomAnimationEffectPtr& pEffect( *aIter ); if( pEffect->getTargetShape() == xShape ) { pEffect->setHasAfterEffect( bDimPrevious ); @@ -1064,7 +1064,7 @@ bool EffectMigration::GetDimPrevious( SvxShape* pShape ) [&xShape](const CustomAnimationEffectPtr& pEffect) { return pEffect->getTargetShape() == xShape; }); if (aIter != pMainSequence->getEnd()) { - CustomAnimationEffectPtr pEffect( *aIter ); + const CustomAnimationEffectPtr& pEffect( *aIter ); bRet = pEffect->hasAfterEffect() && pEffect->getDimColor().hasValue() && pEffect->IsAfterEffectOnNext(); @@ -1097,7 +1097,7 @@ void EffectMigration::SetPresentationOrder( SvxShape* pShape, sal_Int32 nNewPos EffectSequence::iterator aEnd( rSequence.end() ); for( nPos = 0; aIter != aEnd; ++aIter ) { - CustomAnimationEffectPtr pEffect = *aIter; + const CustomAnimationEffectPtr& pEffect = *aIter; if( !xCurrent.is() ) { @@ -1210,7 +1210,7 @@ void EffectMigration::UpdateSoundEffect( SvxShape* pShape, SdAnimationInfo const for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter ) { - CustomAnimationEffectPtr pEffect( *aIter ); + const CustomAnimationEffectPtr& pEffect( *aIter ); if( pEffect->getTargetShape() == xShape ) { if( !aSoundFile.isEmpty() ) @@ -1248,7 +1248,7 @@ OUString EffectMigration::GetSoundFile( SvxShape* pShape ) (aSoundFile.isEmpty()) && (aIter != pMainSequence->getEnd()); ++aIter ) { - CustomAnimationEffectPtr pEffect( *aIter ); + const CustomAnimationEffectPtr& pEffect( *aIter ); if( pEffect->getTargetShape() == xShape ) { if( pEffect->getAudio().is() ) diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 77975328daed..82cc1611caff 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -158,7 +158,7 @@ static void lcl_IterateBookmarkPages( SdDrawDocument &rDoc, SdDrawDocument* pBoo else { // fetch nPos'th entry from bookmark list, and determine master page - OUString aBMPgName(rBookmarkList[nPos]); + const OUString& aBMPgName(rBookmarkList[nPos]); bool bIsMasterPage; sal_uInt16 nBMPage = pBookmarkDoc->GetPageByName( aBMPgName, bIsMasterPage ); @@ -664,7 +664,7 @@ bool SdDrawDocument::InsertBookmarkAsPage( ::std::vector<SdPage*> aBookmarkedPages (rBookmarkList.size(), nullptr); for ( size_t nPos = 0, n = rBookmarkList.size(); nPos < n; ++nPos) { - OUString aPgName(rBookmarkList[nPos]); + const OUString& aPgName(rBookmarkList[nPos]); bool bIsMasterPage; sal_uInt16 nBMPage = pBookmarkDoc->GetPageByName( aPgName, bIsMasterPage ); @@ -687,7 +687,7 @@ bool SdDrawDocument::InsertBookmarkAsPage( // delay renaming *after* pages are copied (might destroy source otherwise) // don't change name if source and dest model are the same! // avoid renaming if replacing the same page - OUString aPgName(rBookmarkList[nPos]); + const OUString& aPgName(rBookmarkList[nPos]); bool bIsMasterPage; sal_uInt16 nPageSameName = GetPageByName(aPgName, bIsMasterPage); if( pBookmarkDoc != this && diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index de125de66590..ba3bbfb9d014 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -1394,7 +1394,7 @@ static void CalcAutoLayoutRectangles( SdPage const & rPage,::tools::Rectangle* r return; int count=0; - Reference<XNode> layoutNode = *aIter; + const Reference<XNode>& layoutNode = *aIter; Reference<XNodeList> layoutChildren = layoutNode->getChildNodes(); const int presobjsize = layoutChildren->getLength(); for( int j=0; j< presobjsize ; j++) diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index a5305e60404c..ffec0145717c 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -87,10 +87,10 @@ sal_uInt16 PPTExBulletProvider::GetId(Graphic const & rGraphic, Size& rGraphicSi if (!rGraphic.IsNone()) { - Graphic aMappedGraphic, aGraphic(rGraphic); - GraphicObject aGraphicObject(aGraphic); - Size aPrefSize( aGraphic.GetPrefSize() ); - BitmapEx aBmpEx( aGraphic.GetBitmapEx() ); + Graphic aMappedGraphic; + GraphicObject aGraphicObject(rGraphic); + Size aPrefSize( rGraphic.GetPrefSize() ); + BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); if ( rGraphicSize.Width() && rGraphicSize.Height() ) { diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index d64005a44710..fb9a276c58e7 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -270,7 +270,7 @@ namespace OUString getParagraphStyle( const SdrOutliner* pOutliner, sal_Int32 nPara ) { - SfxItemSet aParaSet( pOutliner->GetParaAttribs( nPara ) ); + const SfxItemSet& aParaSet( pOutliner->GetParaAttribs( nPara ) ); OUString sStyle; diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx index 2c1898d1242a..abf5a5ffb046 100644 --- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx +++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx @@ -525,7 +525,7 @@ OUString AccessibleDrawDocumentView::CreateAccessibleName() if (xInfo.is()) { uno::Sequence< OUString > aServices( xInfo->getSupportedServiceNames() ); - OUString sFirstService = aServices[0]; + const OUString& sFirstService = aServices[0]; if ( sFirstService == "com.sun.star.drawing.DrawingDocumentDrawView" ) { if( aServices.getLength() >= 2 && aServices[1] == "com.sun.star.presentation.PresentationView") diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx index feea95eacc13..9a35356d99f5 100644 --- a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx @@ -291,7 +291,7 @@ void ConfigurationUpdater::CheckPureAnchors ( sal_Int32 nIndex (nCount-1); while (nIndex >= 0) { - const Reference<XResourceId> xResourceId (aResources[nIndex]); + const Reference<XResourceId>& xResourceId (aResources[nIndex]); const Reference<XResource> xResource ( mpResourceManager->GetResource(xResourceId).mxResource); bool bDeactiveCurrentResource (false); @@ -309,7 +309,7 @@ void ConfigurationUpdater::CheckPureAnchors ( } else { - const Reference<XResourceId> xPrevResourceId (aResources[nIndex+1]); + const Reference<XResourceId>& xPrevResourceId (aResources[nIndex+1]); if ( ! xPrevResourceId.is() || ! xPrevResourceId->isBoundTo(xResourceId, AnchorBindingMode_DIRECT)) { @@ -325,12 +325,11 @@ void ConfigurationUpdater::CheckPureAnchors ( SAL_INFO("sd.fwk", __func__ << ": deactivating pure anchor " << FrameworkHelper::ResourceIdToString(xResourceId) << "because it has no children"); + rResourcesToDeactivate.push_back(xResourceId); // Erase element from current configuration. for (sal_Int32 nI=nIndex; nI<nCount-2; ++nI) aResourcesRange[nI] = aResources[nI+1]; nCount -= 1; - - rResourcesToDeactivate.push_back(xResourceId); } nIndex -= 1; }