diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-11-11 22:04:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-11-12 11:15:45 +0100 |
commit | 134afb333ace20672531e464f4e21f1d00cf7bee (patch) | |
tree | 28026cdede4b44254af30635aa25dceaeaa187d4 /sc/source | |
parent | 33c2a79f141cd20078f82dba5a9292dd6046df6e (diff) |
clang-tidy: performance-unnecessary-copy-initialization in sc
Change-Id: I5d4b2190af6373772fcea7c8427454170fde2e6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176437
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/SolverSettings.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/column.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/column4.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/documen5.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/documen7.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/tool/sharedformula.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/excform8.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/excel/xechart.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/html/htmlpars.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLExportDataPilot.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlwrap.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/dbgui/pvfundlg.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/fuins1.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/acredlin.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/solveroptions.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/PivotTableDataProvider.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsha.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshb.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun6.cxx | 5 |
21 files changed, 30 insertions, 34 deletions
diff --git a/sc/source/core/data/SolverSettings.cxx b/sc/source/core/data/SolverSettings.cxx index 215a662080f9..97103659b94c 100644 --- a/sc/source/core/data/SolverSettings.cxx +++ b/sc/source/core/data/SolverSettings.cxx @@ -644,7 +644,7 @@ void SolverSettings::GetEngineOptions(css::uno::Sequence<css::beans::PropertyVal for (auto i = 0; i < nOptionsSize; i++) { - css::beans::PropertyValue aProp = aOptions[i]; + const css::beans::PropertyValue& aProp = aOptions[i]; OUString sLOParamName = aProp.Name; // Only try to get the parameter value if it is an expected parameter name if (SolverParamNames.count(sLOParamName)) @@ -691,7 +691,7 @@ void SolverSettings::SetEngineOptions(const css::uno::Sequence<css::beans::Prope for (auto i = 0; i < nOptionsSize; i++) { - css::beans::PropertyValue aProp = aOptions[i]; + const css::beans::PropertyValue& aProp = aOptions[i]; OUString sLOParamName = aProp.Name; // Only try to set the parameter value if it is an expected parameter name if (SolverParamNames.count(sLOParamName)) diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index fe53ac7325da..15060d98c1b3 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -202,10 +202,9 @@ bool ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark, const ScRange ScAddress aCurOrigin = aOrigin; bool bOpen = false; - ScRangeList aRanges = rRangeList; // cached rMark.GetMarkedRanges(), for performance reasons (tdf#148147) - for (size_t i = 0, n = aRanges.size(); i < n; ++i) + for (size_t i = 0, n = rRangeList.size(); i < n; ++i) { - const ScRange& r = aRanges[i]; + const ScRange& r = rRangeList[i]; if (nTab < r.aStart.Tab() || r.aEnd.Tab() < nTab) continue; diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index 3b322c73c23f..79ca0357361a 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -374,7 +374,7 @@ void ScColumn::duplicateSparkline(sc::CopyFromClipContext& rContext, sc::ColumnB if ((rContext.getInsertFlag() & InsertDeleteFlags::SPARKLINES) == InsertDeleteFlags::NONE) return; - auto pSparkline = rContext.getSingleSparkline(nColOffset); + const auto& pSparkline = rContext.getSingleSparkline(nColOffset); if (pSparkline) { auto const& pSparklineGroup = pSparkline->getSparklineGroup(); diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx index 21e21b3ab05e..7e2aa26679ce 100644 --- a/sc/source/core/data/documen5.cxx +++ b/sc/source/core/data/documen5.cxx @@ -193,7 +193,7 @@ void ScDocument::SetChartRanges( std::u16string_view rChartName, const ::std::ve auto aRangeStringsRange = asNonConstRange(aRangeStrings); for( sal_Int32 nN=0; nN<nCount; nN++ ) { - ScRangeList aScRangeList( rRangesVector[nN] ); + const ScRangeList& aScRangeList( rRangesVector[nN] ); OUString sRangeStr; aScRangeList.Format( sRangeStr, ScRefFlags::RANGE_ABS_3D, *this, GetAddressConvention() ); aRangeStringsRange[nN]=sRangeStr; diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx index 6ebc5d51ef77..96f9edd7edbc 100644 --- a/sc/source/core/data/documen7.cxx +++ b/sc/source/core/data/documen7.cxx @@ -137,7 +137,7 @@ void ScDocument::Broadcast( const ScHint& rHint ) bool ScDocument::BroadcastHintInternal( const ScHint& rHint ) { bool bIsBroadcasted = false; - const ScAddress address(rHint.GetStartAddress()); + const ScAddress& address(rHint.GetStartAddress()); SvtBroadcaster* pLastBC = nullptr; // Process all broadcasters for the given row range. for( SCROW nRow = 0; nRow < rHint.GetRowCount(); ++nRow ) diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 2f5656769ced..2116cab1297f 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -9066,7 +9066,7 @@ void ScInterpreter::ScLet() } else { - FormulaConstTokenRef xTok(aInt.GetResultToken()); + const FormulaConstTokenRef& xTok(aInt.GetResultToken()); if (!nResultIndexes.insert(std::make_pair(aStrName, xTok->Clone())).second) { PushIllegalParameter(); @@ -9100,7 +9100,7 @@ void ScInterpreter::ScLet() } else { - formula::FormulaConstTokenRef xLambdaResult(aInt.GetResultToken()); + const formula::FormulaConstTokenRef& xLambdaResult(aInt.GetResultToken()); if (xLambdaResult) { nGlobalError = xLambdaResult->GetError(); @@ -11072,7 +11072,7 @@ void ScInterpreter::ScRegex() } else { - const OUString aFlags( aFlagsString.getString()); + const OUString& aFlags( aFlagsString.getString()); // Empty flags string is valid => no flag set. if (aFlags.getLength() > 1) { diff --git a/sc/source/core/tool/sharedformula.cxx b/sc/source/core/tool/sharedformula.cxx index 7680aac405d4..98fa783c07ae 100644 --- a/sc/source/core/tool/sharedformula.cxx +++ b/sc/source/core/tool/sharedformula.cxx @@ -276,7 +276,7 @@ void SharedFormulaUtil::unshareFormulaCell(const CellStoreType::position_type& a else { // In the middle of the shared range. Split it into two groups. - ScFormulaCellGroupRef xGroup = rCell.GetCellGroup(); + const ScFormulaCellGroupRef& xGroup = rCell.GetCellGroup(); SCROW nEndRow = xGroup->mpTopCell->aPos.Row() + xGroup->mnLength - 1; xGroup->mnLength = rCell.aPos.Row() - xGroup->mpTopCell->aPos.Row(); // Shorten the top group. if (xGroup->mnLength == 1) diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index 144b4da1e7d4..48f4d0c3ad97 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -1341,7 +1341,7 @@ void ExcelToSc8::ConvertExternName( std::unique_ptr<ScTokenArray>& rpArray, XclI aSRD.SetFlag3D(true); ExcRelToScRel8(nRow, nGrbitCol, aSRD, true); aCRD.Ref1 = aCRD.Ref2 = aSRD; - OUString aTabName = rTabNames[nExtTab1]; + const OUString& aTabName = rTabNames[nExtTab1]; if (nExtTab1 == nExtTab2) { @@ -1384,7 +1384,7 @@ void ExcelToSc8::ConvertExternName( std::unique_ptr<ScTokenArray>& rpArray, XclI rR2.SetFlag3D(true); ExcRelToScRel8(nRow2, nGrbitCol2, rR2, true); - OUString aTabName = rTabNames[nExtTab1]; + const OUString& aTabName = rTabNames[nExtTab1]; aStack << aPool.StoreExtRef(nFileId, aTabName, aCRD); } break; diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index d5dd440be239..3bedcb3c60be 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -3086,7 +3086,7 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > const & xDiagram, sal { /* Process first coordinate system only. Import filter puts all chart types into one coordinate system. */ - Reference< XCoordinateSystem > xCoordSystem = aCoordSysSeq[ 0 ]; + const Reference< XCoordinateSystem >& xCoordSystem = aCoordSysSeq[ 0 ]; sal_Int32 nApiAxesSetIdx = GetApiAxesSetIndex(); // 3d mode diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 9b825df20f7d..dd2395074bd2 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -2283,7 +2283,7 @@ void ScHTMLTable::DataOn( const HtmlImportInfo& rInfo ) { // Pick up the number format associated with this class (if // any). - OUString aClass = rOption.GetString(); + const OUString& aClass = rOption.GetString(); const ScHTMLStyles& rStyles = mpParser->GetStyles(); const OUString& rVal = rStyles.getPropertyValue(u"td"_ustr, aClass, u"mso-number-format"_ustr); if (!rVal.isEmpty()) diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx index 83ea28584e9f..5161dede5137 100644 --- a/sc/source/filter/xml/XMLExportDataPilot.cxx +++ b/sc/source/filter/xml/XMLExportDataPilot.cxx @@ -151,7 +151,7 @@ void ScXMLExportDataPilot::WriteDPFilter(const ScQueryParam& aQueryParam) for ( j = 0; (j < nQueryEntryCount) && bHasEntries; ++j) { - ScQueryEntry aEntry = aQueryParam.GetEntry(j); + const ScQueryEntry& aEntry = aQueryParam.GetEntry(j); if (aEntry.bDoQuery) { if (nEntries > 0) diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index 86ff69d0ec2d..bf4e055440db 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -113,7 +113,6 @@ ErrCodeMsg ScXMLImportWrapper::ImportFromComponent(const uno::Reference<uno::XCo xStorage = pMedium->GetStorage(); bool bEncrypted = false; - OUString sStream(sDocName); if( xStorage.is() ) { try @@ -152,7 +151,7 @@ ErrCodeMsg ScXMLImportWrapper::ImportFromComponent(const uno::Reference<uno::XCo OSL_ENSURE( xInfoSet.is(), "missing property set" ); if( xInfoSet.is() ) { - xInfoSet->setPropertyValue( u"StreamName"_ustr, uno::Any( sStream ) ); + xInfoSet->setPropertyValue( u"StreamName"_ustr, uno::Any( sDocName ) ); } ErrCodeMsg nReturn = ERRCODE_NONE; diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx index d62aff05b79c..27b2e28b44d8 100644 --- a/sc/source/ui/dbgui/pvfundlg.cxx +++ b/sc/source/ui/dbgui/pvfundlg.cxx @@ -95,7 +95,7 @@ bool lclFillListBox(weld::TreeView& rLBox, const vector<ScDPLabelData::Member>& rLBox.append(); int pos = rLBox.n_children() - 1; rLBox.set_toggle(pos, TRISTATE_FALSE); - OUString aName = rMember.getDisplayName(); + const OUString& aName = rMember.getDisplayName(); if (!aName.isEmpty()) rLBox.set_text(pos, aName, 0); else diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index 83fd3d7227c0..728865a43f4d 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -276,7 +276,7 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell& rViewSh, if ( pReqArgs && (pGraphicItem = pReqArgs->GetItemIfSet( SID_INSERT_GRAPHIC, true )) ) { - OUString aFileName = pGraphicItem->GetValue(); + const OUString& aFileName = pGraphicItem->GetValue(); OUString aFilterName; if ( const SfxStringItem* pFilterItem = pReqArgs->GetItemIfSet( FN_PARAM_FILTER ) ) diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 782b08b87d47..b93d10aec8fc 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -317,7 +317,7 @@ bool ScAcceptChgDlg::IsValidAction(const ScChangeAction* pScChangeAction) bool bFlag = false; ScRange aRef=pScChangeAction->GetBigRange().MakeRange(*pDoc); - OUString aUser=pScChangeAction->GetUser(); + const OUString& aUser=pScChangeAction->GetUser(); DateTime aDateTime=pScChangeAction->GetDateTime(); ScChangeActionType eType=pScChangeAction->GetType(); @@ -513,7 +513,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendFilteredAction( bool bFlag = false; ScRange aRef=pScChangeAction->GetBigRange().MakeRange(*pDoc); - OUString aUser=pScChangeAction->GetUser(); + const OUString& aUser=pScChangeAction->GetUser(); DateTime aDateTime=pScChangeAction->GetDateTime(); if (pTheView->IsValidEntry(aUser, aDateTime) || bIsGenerated) diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index b3cc8e543c3e..014a7632ea49 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -85,7 +85,7 @@ ScSolverOptionsDialog::ScSolverOptionsDialog(weld::Window* pParent, for (sal_Int32 nImpl=0; nImpl<nImplCount; ++nImpl) { OUString aImplName( maImplNames[nImpl] ); - OUString aDescription( rDescriptions[nImpl] ); // user-visible descriptions in list box + const OUString& aDescription( rDescriptions[nImpl] ); // user-visible descriptions in list box m_xLbEngine->append_text(aDescription); if ( aImplName == maEngine ) nSelect = nImpl; diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx index 5dc82b93bff0..cbd7ebbecda5 100644 --- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx +++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx @@ -536,7 +536,7 @@ void PivotTableDataProvider::collectPivotTableData() size_t i = 0; for (ValueAndFormat & rItem : rDataRow) { - OUString sName = aDataFieldNamesVectors[i]; + const OUString& sName = aDataFieldNamesVectors[i]; sal_Int32 nNumberFormat = aDataFieldNumberFormatMap[sName]; rItem.m_nNumberFormat = nNumberFormat; i++; @@ -548,7 +548,7 @@ void PivotTableDataProvider::collectPivotTableData() size_t i = 0; for (std::vector<ValueAndFormat> & rDataRow : m_aDataRowVector) { - OUString sName = aDataFieldNamesVectors[i]; + const OUString& sName = aDataFieldNamesVectors[i]; sal_Int32 nNumberFormat = aDataFieldNumberFormatMap[sName]; for (ValueAndFormat & rItem : rDataRow) { diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 0437ca0d6da8..2fc2d2d576d2 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -972,7 +972,7 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) eFamily = static_cast<SfxStyleFamily>(pFamItem->GetValue()); else if ( pArgs && (pFamilyNameItem = pArgs->GetItemIfSet( SID_STYLE_FAMILYNAME )) ) { - OUString sFamily = pFamilyNameItem->GetValue(); + const OUString& sFamily = pFamilyNameItem->GetValue(); if (sFamily == "CellStyles") eFamily = SfxStyleFamily::Para; else if (sFamily == "PageStyles") diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index a2b5fb9e8873..3b1bf47dc238 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -74,7 +74,7 @@ void ScTabViewShell::ConnectObject( const SdrOle2Obj* pObj ) { // is called from paint - uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef(); + const uno::Reference < embed::XEmbeddedObject >& xObj = pObj->GetObjRef(); vcl::Window* pWin = GetActiveWin(); // when already connected do not execute SetObjArea/SetSizeScale again diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 7e944557856f..1e8a19021c08 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -857,11 +857,10 @@ OUString ScViewFunc::GetAutoSumFormula( const ScRangeList& rRangeList, bool bSub if(!rRangeList.empty()) { - ScRangeList aRangeList = rRangeList; - size_t ListSize = aRangeList.size(); + size_t ListSize = rRangeList.size(); for ( size_t i = 0; i < ListSize; ++i ) { - const ScRange & r = aRangeList[i]; + const ScRange & r = rRangeList[i]; if (i != 0) aArray.AddOpCode(ocSep); ScComplexRefData aRef; diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx index ca636813f139..510ab6f0ab51 100644 --- a/sc/source/ui/view/viewfun6.cxx +++ b/sc/source/ui/view/viewfun6.cxx @@ -142,13 +142,12 @@ void ScViewFunc::MarkAndJumpToRanges(const ScRangeList& rRanges) ScViewData& rView = GetViewData(); ScDocShell* pDocSh = rView.GetDocShell(); - ScRangeList aRanges(rRanges); ScRangeList aRangesToMark; ScAddress aCurPos = rView.GetCurPos(); - size_t ListSize = aRanges.size(); + size_t ListSize = rRanges.size(); for ( size_t i = 0; i < ListSize; ++i ) { - const ScRange & r = aRanges[i]; + const ScRange & r = rRanges[i]; // Collect only those ranges that are on the same sheet as the current // cursor. if (r.aStart.Tab() == aCurPos.Tab()) |