diff options
author | Noel Grandin <noel@peralex.com> | 2016-04-12 16:39:03 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-04-18 07:37:31 +0000 |
commit | 789055bc2acb4c71483fd60ea258d158bd5aec10 (patch) | |
tree | 7849de841a71f667a30b2a971ad0c3d406110396 /sw/source/uibase | |
parent | 150ac9cf05ed9da6a2af5bc3f820280fd853e519 (diff) |
clang-tidy performance-unnecessary-copy-initialization
probably not much performance benefit, but it sure is good at
identifying leftover intermediate variables from previous
refactorings.
Change-Id: I3ce16fe496ac2733c1cb0a35f74c0fc9193cc657
Reviewed-on: https://gerrit.libreoffice.org/24026
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/envelp/labelcfg.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/fldui/fldmgr.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/fldui/xfldui.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/misc/glosdoc.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/misc/redlndlg.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/ThemePanel.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewprt.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewtab.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unoatxt.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 44 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxvw.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 2 |
14 files changed, 43 insertions, 53 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 92c6112919cc..8b9d6d5341fa 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -717,9 +717,8 @@ bool SwDBManager::GetTableNames(ListBox* pListBox, const OUString& rDBName) xConnection = pParam->xConnection; else { - OUString sDBName(rDBName); - if ( !sDBName.isEmpty() ) - xConnection = RegisterConnection( sDBName ); + if ( !rDBName.isEmpty() ) + xConnection = RegisterConnection( rDBName ); } if(xConnection.is()) { @@ -768,8 +767,7 @@ void SwDBManager::GetColumnNames(ListBox* pListBox, xConnection = pParam->xConnection; else { - OUString sDBName(rDBName); - xConnection = RegisterConnection( sDBName ); + xConnection = RegisterConnection( rDBName ); } GetColumnNames(pListBox, xConnection, rTableName); } @@ -1666,8 +1664,7 @@ sal_uLong SwDBManager::GetColumnFormat( const OUString& rDBName, } else { - OUString sDBName(rDBName); - xConnection = RegisterConnection( sDBName ); + xConnection = RegisterConnection( rDBName ); bDisposeConnection = true; } if(bUseMergeData) @@ -1812,8 +1809,7 @@ sal_Int32 SwDBManager::GetColumnType( const OUString& rDBName, } else { - OUString sDBName(rDBName); - xConnection = RegisterConnection( sDBName ); + xConnection = RegisterConnection( rDBName ); } if( !xColsSupp.is() ) { diff --git a/sw/source/uibase/envelp/labelcfg.cxx b/sw/source/uibase/envelp/labelcfg.cxx index 21bfbf52c16e..72b22f2351dc 100644 --- a/sw/source/uibase/envelp/labelcfg.cxx +++ b/sw/source/uibase/envelp/labelcfg.cxx @@ -182,11 +182,10 @@ static std::unique_ptr<SwLabRec> lcl_CreateSwLabRec(const OUString& rType, const pNewRec->aType = rType; //all values are contained as colon-separated 1/100 mm values //except for the continuous flag ('C'/'S') and nCols, nRows (sal_Int32) - OUString sMeasure(rMeasure); - sal_uInt16 nTokenCount = comphelper::string::getTokenCount(sMeasure, ';'); + sal_uInt16 nTokenCount = comphelper::string::getTokenCount(rMeasure, ';'); for(sal_uInt16 i = 0; i < nTokenCount; i++) { - OUString sToken(sMeasure.getToken(i, ';' )); + OUString sToken(rMeasure.getToken(i, ';' )); int nVal = sToken.toInt32(); switch(i) { diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index f2119ac00909..38b413ad1770 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -1383,7 +1383,6 @@ void SwFieldMgr::UpdateCurField(sal_uLong nFormat, bool bSetPar2 = true; bool bSetPar1 = true; - OUString sPar1( rPar1 ); OUString sPar2( rPar2 ); // Order to Format @@ -1472,7 +1471,7 @@ void SwFieldMgr::UpdateCurField(sal_uLong nFormat, for(sal_Int32 nToken = 0; nToken < nTokenCount; nToken++) pArray[nToken] = sPar2.getToken(nToken, DB_DELIM); static_cast<SwDropDownField*>(pTmpField)->SetItems(aEntries); - static_cast<SwDropDownField*>(pTmpField)->SetName(sPar1); + static_cast<SwDropDownField*>(pTmpField)->SetName(rPar1); bSetPar1 = bSetPar2 = false; } break; @@ -1503,8 +1502,8 @@ void SwFieldMgr::UpdateCurField(sal_uLong nFormat, // setup format before SetPar2 because of NumberFormatter! pTmpField->ChangeFormat(nFormat); - if(bSetPar1) - pTmpField->SetPar1( sPar1 ); + if( bSetPar1 ) + pTmpField->SetPar1( rPar1 ); if( bSetPar2 ) pTmpField->SetPar2( sPar2 ); diff --git a/sw/source/uibase/fldui/xfldui.cxx b/sw/source/uibase/fldui/xfldui.cxx index c7164e5e771d..ef4e713c9a14 100644 --- a/sw/source/uibase/fldui/xfldui.cxx +++ b/sw/source/uibase/fldui/xfldui.cxx @@ -55,9 +55,8 @@ bool SwFieldMgr::IsDBNumeric( const OUString& rDBName, const OUString& rTableQry SwDBManager* pDBManager = pWrtShell ? pWrtShell->GetDBManager() : ::GetActiveView()->GetWrtShell().GetDBManager(); - OUString sSource(rDBName); Reference< XConnection> xConnection = - pDBManager->RegisterConnection(sSource); + pDBManager->RegisterConnection(rDBName); if( !xConnection.is() ) return bNumeric; diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index fa503d054a33..44426548e9ab 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -440,7 +440,6 @@ void SwGlossaries::RemoveFileFromList( const OUString& rGroup ) { if (*it == rGroup) { - OUString aUName = rGroup; { // tell the UNO AutoTextGroup object that it's not valid anymore for ( UnoAutoTextGroups::iterator aLoop = m_aGlossaryGroups.begin(); @@ -449,7 +448,7 @@ void SwGlossaries::RemoveFileFromList( const OUString& rGroup ) ) { Reference< container::XNamed > xNamed( aLoop->get(), UNO_QUERY ); - if ( xNamed.is() && ( xNamed->getName() == aUName ) ) + if ( xNamed.is() && ( xNamed->getName() == rGroup ) ) { static_cast< SwXAutoTextGroup* >( xNamed.get() )->Invalidate(); // note that this static_cast works because we know that the array only diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index dcdce1d6a3ed..6928993639ef 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -467,7 +467,7 @@ void SwRedlineAcceptDlg::Activate() if (pParent->pTLBParent) { // update only comment - OUString sComment(rRedln.GetComment()); + const OUString& sComment(rRedln.GetComment()); m_pTable->SetEntryText(sComment.replace('\n', ' '), pParent->pTLBParent, 3); } pParent->sComment = rRedln.GetComment(); @@ -757,7 +757,7 @@ void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd) pRedlineParent = new SwRedlineDataParent; pRedlineParent->pData = pRedlineData; pRedlineParent->pNext = nullptr; - OUString sComment(rRedln.GetComment()); + const OUString& sComment(rRedln.GetComment()); pRedlineParent->sComment = sComment.replace('\n', ' '); m_RedlineParents.insert(m_RedlineParents.begin() + i, std::unique_ptr<SwRedlineDataParent>(pRedlineParent)); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index ffa42b4147ee..e105efb0d442 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1797,7 +1797,7 @@ void SwTextShell::GetState( SfxItemSet &rSet ) uno::Reference <frame::XController> xController = GetView().GetController(); const lang::Locale aLocale( SW_BREAKITER()->GetLocale( GetAppLanguageTag() ) ); - const OUString aApplicationName( rSmartTagMgr.GetApplicationName() ); + const OUString& aApplicationName( rSmartTagMgr.GetApplicationName() ); const OUString aRangeText = xRange->getString(); const SvxSmartTagItem aItem( nWhich, diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx index 81bf6a486ae2..2047c2aab5cb 100644 --- a/sw/source/uibase/sidebar/ThemePanel.cxx +++ b/sw/source/uibase/sidebar/ThemePanel.cxx @@ -465,7 +465,7 @@ ThemePanel::ThemePanel(vcl::Window* pParent, { const svx::ColorSet& rColorSet = aColorSets[i]; - OUString aName = rColorSet.getName(); + const OUString& aName = rColorSet.getName(); BitmapEx aPreview = GenerateColorPreview(rColorSet); mpValueSetColors->InsertItem(i, Image(aPreview), aName); } diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index 79228e460ccf..e7855d887172 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -278,7 +278,7 @@ VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent, void SetAppPrintOptions( SwViewShell* pSh, bool bWeb ) { const IDocumentDeviceAccess& rIDDA = pSh->getIDocumentDeviceAccess(); - SwPrintData aPrtData = rIDDA.getPrintData(); + const SwPrintData& aPrtData = rIDDA.getPrintData(); if( rIDDA.getPrinter( false ) ) { diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index d7512009a491..7b94a1dad07f 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -1049,7 +1049,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) sal_uInt16 nColumnType = 0; const SwFrameFormat& rMaster = rDesc.GetMaster(); - SwFormatCol aCol(rMaster.GetCol()); + const SwFormatCol& aCol(rMaster.GetCol()); const sal_uInt16 nCols = aCol.GetNumCols(); if ( nCols == 0 ) { diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index c4ed4e58bcf8..51511337f51a 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -348,8 +348,8 @@ uno::Reference< text::XAutoTextEntry > SwXAutoTextGroup::insertNewByName(const throw uno::RuntimeException(); SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName) : nullptr; - OUString sShortName(aName); - OUString sLongName(aTitle); + const OUString& sShortName(aName); + const OUString& sLongName(aTitle); if (pGlosGroup && !pGlosGroup->GetError()) { uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 5a7d25211b92..31216c5434e3 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3707,62 +3707,61 @@ Any SwXLinkTargetSupplier::getByName(const OUString& rName) Any aRet; if(!pxDoc) throw RuntimeException(); - OUString sToCompare(rName); OUString sSuffix("|"); - if(sToCompare == sTables) + if(rName == sTables) { sSuffix += "table"; Reference< XNameAccess > xTables = new SwXLinkNameAccessWrapper( - pxDoc->getTextTables(), sToCompare, sSuffix ); + pxDoc->getTextTables(), rName, sSuffix ); Reference< XPropertySet > xRet(xTables, UNO_QUERY); aRet.setValue(&xRet, cppu::UnoType<XPropertySet>::get()); } - else if(sToCompare == sFrames) + else if(rName == sFrames) { sSuffix += "frame"; Reference< XNameAccess > xTables = new SwXLinkNameAccessWrapper( - pxDoc->getTextFrames(), sToCompare, sSuffix ); + pxDoc->getTextFrames(), rName, sSuffix ); Reference< XPropertySet > xRet(xTables, UNO_QUERY); aRet.setValue(&xRet, cppu::UnoType<XPropertySet>::get()); } - else if(sToCompare == sSections) + else if(rName == sSections) { sSuffix += "region"; Reference< XNameAccess > xTables = new SwXLinkNameAccessWrapper( - pxDoc->getTextSections(), sToCompare, sSuffix ); + pxDoc->getTextSections(), rName, sSuffix ); Reference< XPropertySet > xRet(xTables, UNO_QUERY); aRet.setValue(&xRet, cppu::UnoType<XPropertySet>::get()); } - else if(sToCompare == sGraphics) + else if(rName == sGraphics) { sSuffix += "graphic"; Reference< XNameAccess > xTables = new SwXLinkNameAccessWrapper( - pxDoc->getGraphicObjects(), sToCompare, sSuffix ); + pxDoc->getGraphicObjects(), rName, sSuffix ); Reference< XPropertySet > xRet(xTables, UNO_QUERY); aRet.setValue(&xRet, cppu::UnoType<XPropertySet>::get()); } - else if(sToCompare == sOLEs) + else if(rName == sOLEs) { sSuffix += "ole"; Reference< XNameAccess > xTables = new SwXLinkNameAccessWrapper( - pxDoc->getEmbeddedObjects(), sToCompare, sSuffix ); + pxDoc->getEmbeddedObjects(), rName, sSuffix ); Reference< XPropertySet > xRet(xTables, UNO_QUERY); aRet.setValue(&xRet, cppu::UnoType<XPropertySet>::get()); } - else if(sToCompare == sOutlines) + else if(rName == sOutlines) { sSuffix += "outline"; Reference< XNameAccess > xTables = new SwXLinkNameAccessWrapper( - *pxDoc, sToCompare, sSuffix ); + *pxDoc, rName, sSuffix ); Reference< XPropertySet > xRet(xTables, UNO_QUERY); aRet.setValue(&xRet, cppu::UnoType<XPropertySet>::get()); } - else if(sToCompare == sBookmarks) + else if(rName == sBookmarks) { sSuffix.clear(); Reference< XNameAccess > xBkms = new SwXLinkNameAccessWrapper( - pxDoc->getBookmarks(), sToCompare, sSuffix ); + pxDoc->getBookmarks(), rName, sSuffix ); Reference< XPropertySet > xRet(xBkms, UNO_QUERY); aRet.setValue(&xRet, cppu::UnoType<XPropertySet>::get()); } @@ -3789,14 +3788,13 @@ Sequence< OUString > SwXLinkTargetSupplier::getElementNames() sal_Bool SwXLinkTargetSupplier::hasByName(const OUString& rName) throw( RuntimeException, std::exception ) { - OUString sToCompare(rName); - if( sToCompare == sTables || - sToCompare == sFrames || - sToCompare == sGraphics|| - sToCompare == sOLEs || - sToCompare == sSections || - sToCompare == sOutlines || - sToCompare == sBookmarks ) + if( rName == sTables || + rName == sFrames || + rName == sGraphics|| + rName == sOLEs || + rName == sSections || + rName == sOutlines || + rName == sBookmarks ) return sal_True; return sal_False; } diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index ef20d115eca4..1fe0dcfe0ac8 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -911,7 +911,7 @@ awt::Point SwXTextViewCursor::getPosition() throw( uno::RuntimeException, std::e if(m_pView) { const SwWrtShell& rSh = m_pView->GetWrtShell(); - const SwRect aCharRect(rSh.GetCharRect()); + const SwRect& aCharRect(rSh.GetCharRect()); const SwFrameFormat& rMaster = rSh.GetPageDesc( rSh.GetCurPageDesc() ).GetMaster(); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 5ad5c931aa18..476c95e36b30 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -531,7 +531,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged) for(size_t i = 0; i < nMemberCount; ++i) { const SwFrameFormat& rTableFormat = pWrtShell->GetTableFrameFormat(i, true); - const OUString sTableName( rTableFormat.GetName() ); + const OUString& sTableName( rTableFormat.GetName() ); SwContent* pCnt = new SwContent(this, sTableName, rTableFormat.FindLayoutRect(false, &aNullPt).Top() ); |