From b83cc2b0108a4ec2087221a6150a66578788e5b4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 26 Jul 2018 17:16:16 +0200 Subject: loplugin:stringloop in basic, framework, sax, svtools Change-Id: I2bad74a8f103e9dc68c8e0d0e6315697068d2f6d Reviewed-on: https://gerrit.libreoffice.org/58135 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svtools/source/contnr/fileview.cxx | 3 +-- svtools/source/contnr/svtabbx.cxx | 16 ++++++++-------- svtools/source/contnr/treelistbox.cxx | 6 +++--- 3 files changed, 12 insertions(+), 13 deletions(-) (limited to 'svtools') diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index fc41f053337e..7d3c41bc7045 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -1843,14 +1843,13 @@ void SvtFileView_Impl::CreateDisplayText_Impl() { ::osl::MutexGuard aGuard( maMutex ); - OUString aValue; OUString const aTab( "\t" ); OUString const aDateSep( ", " ); for (auto const& elem : maContent) { // title, type, size, date - aValue = elem->GetTitle(); + OUString aValue = elem->GetTitle(); ReplaceTabWithString( aValue ); aValue += aTab + elem->maType + aTab; // folders don't have a size diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index f1106d6e220b..28495cf5e47b 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -232,7 +232,7 @@ OUString SvTabListBox::GetEntryText( SvTreeListEntry* pEntry ) const OUString SvTabListBox::GetEntryText( SvTreeListEntry* pEntry, sal_uInt16 nCol ) { DBG_ASSERT(pEntry,"GetEntryText:Invalid Entry"); - OUString aResult; + OUStringBuffer aResult; if( pEntry ) { sal_uInt16 nCount = pEntry->ItemCount(); @@ -245,8 +245,8 @@ OUString SvTabListBox::GetEntryText( SvTreeListEntry* pEntry, sal_uInt16 nCol ) if( nCol == 0xffff ) { if (!aResult.isEmpty()) - aResult += "\t"; - aResult += static_cast(rStr).GetText(); + aResult.append("\t"); + aResult.append(static_cast(rStr).GetText()); } else { @@ -258,7 +258,7 @@ OUString SvTabListBox::GetEntryText( SvTreeListEntry* pEntry, sal_uInt16 nCol ) nCur++; } } - return aResult; + return aResult.makeStringAndClear(); } OUString SvTabListBox::GetEntryText( sal_uLong nPos, sal_uInt16 nCol ) const @@ -363,7 +363,7 @@ OUString SvTabListBox::GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const { SvTreeListEntry* pEntry = SvTreeListBox::GetEntry( nPos ); DBG_ASSERT( pEntry, "GetTabEntryText(): Invalid entry " ); - OUString aResult; + OUStringBuffer aResult; if ( pEntry ) { sal_uInt16 nCount = pEntry->ItemCount(); @@ -376,8 +376,8 @@ OUString SvTabListBox::GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const if ( nCol == 0xffff ) { if (!aResult.isEmpty()) - aResult += "\t"; - aResult += static_cast(rBoxItem).GetText(); + aResult.append("\t"); + aResult.append(static_cast(rBoxItem).GetText()); } else { @@ -394,7 +394,7 @@ OUString SvTabListBox::GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const ++nCur; } } - return aResult; + return aResult.makeStringAndClear(); } SvTreeListEntry* SvTabListBox::GetEntryOnPos( sal_uLong _nEntryPos ) const diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index ea710b2da653..7a930883f51d 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -1314,7 +1314,7 @@ OUString SvTreeListBox::GetEntryLongDescription( SvTreeListEntry* ) const OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry ) { assert(pEntry); - OUString sRet; + OUStringBuffer sRet; sal_uInt16 nCount = pEntry->ItemCount(); sal_uInt16 nCur = 0; @@ -1324,14 +1324,14 @@ OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry ) if ( (rItem.GetType() == SvLBoxItemType::String) && !static_cast( rItem ).GetText().isEmpty() ) { - sRet += static_cast( rItem ).GetText() + ","; + sRet.append(static_cast( rItem ).GetText()).append(","); } nCur++; } if (!sRet.isEmpty()) sRet = sRet.copy(0, sRet.getLength() - 1); - return sRet; + return sRet.makeStringAndClear(); } SvTreeListBox::~SvTreeListBox() -- cgit