[Libreoffice-commits] core.git: basic/source framework/source sax/source svtools/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Jul 27 09:35:51 UTC 2018
basic/source/comp/codegen.cxx | 8 +--
basic/source/runtime/methods1.cxx | 8 +--
basic/source/sbx/sbxexec.cxx | 6 +-
basic/source/sbx/sbxvar.cxx | 30 ++++++-------
framework/source/accelerators/storageholder.cxx | 7 +--
framework/source/fwe/xml/menudocumenthandler.cxx | 8 +--
framework/source/fwe/xml/toolboxdocumenthandler.cxx | 8 +--
framework/source/uielement/langselectionmenucontroller.cxx | 6 --
sax/source/tools/converter.cxx | 6 +-
svtools/source/contnr/fileview.cxx | 3 -
svtools/source/contnr/svtabbx.cxx | 16 +++---
svtools/source/contnr/treelistbox.cxx | 6 +-
12 files changed, 55 insertions(+), 57 deletions(-)
New commits:
commit b83cc2b0108a4ec2087221a6150a66578788e5b4
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 26 17:16:16 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 27 11:35:24 2018 +0200
loplugin:stringloop in basic, framework, sax, svtools
Change-Id: I2bad74a8f103e9dc68c8e0d0e6315697068d2f6d
Reviewed-on: https://gerrit.libreoffice.org/58135
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index 4e13f6a83336..fc234dfa1579 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -189,7 +189,7 @@ void SbiCodeGen::Save()
if( pProc && pProc->IsDefined() )
{
OUString aProcName = pProc->GetName();
- OUString aIfaceProcName;
+ OUStringBuffer aIfaceProcName;
OUString aIfaceName;
sal_uInt16 nPassCount = 1;
if( nIfaceCount )
@@ -210,9 +210,9 @@ void SbiCodeGen::Save()
{
if( nPropPrefixFound == 0 )
{
- aIfaceProcName += aPropPrefix;
+ aIfaceProcName.append(aPropPrefix);
}
- aIfaceProcName += aPureProcName.copy( rIfaceName.getLength() + 1 );
+ aIfaceProcName.append(aPureProcName.copy( rIfaceName.getLength() + 1 ));
aIfaceName = rIfaceName;
nPassCount = 2;
break;
@@ -224,7 +224,7 @@ void SbiCodeGen::Save()
{
if( nPass == 1 )
{
- aProcName = aIfaceProcName;
+ aProcName = aIfaceProcName.toString();
}
PropertyMode ePropMode = pProc->getPropertyMode();
if( ePropMode != PropertyMode::NONE )
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 8c8c3dcbcd7d..4b59ea081c28 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1550,20 +1550,20 @@ void SbRtl_Join(StarBASIC *, SbxArray & rPar, bool)
{
aDelim = " ";
}
- OUString aRetStr;
+ OUStringBuffer aRetStr;
short nLower, nUpper;
pArr->GetDim( 1, nLower, nUpper );
short aIdx[1];
for (aIdx[0] = nLower; aIdx[0] <= nUpper; ++aIdx[0])
{
OUString aStr = pArr->Get(aIdx)->GetOUString();
- aRetStr += aStr;
+ aRetStr.append(aStr);
if (aIdx[0] != nUpper)
{
- aRetStr += aDelim;
+ aRetStr.append(aDelim);
}
}
- rPar.Get(0)->PutString( aRetStr );
+ rPar.Get(0)->PutString( aRetStr.makeStringAndClear() );
}
else
{
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index a74cdf5c2655..7f177c27814d 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -140,7 +140,7 @@ static SbxVariableRef Operand
else if( !bVar && *p == '"' )
{
// A string
- OUString aString;
+ OUStringBuffer aString;
p++;
for( ;; )
{
@@ -157,9 +157,9 @@ static SbxVariableRef Operand
break;
}
}
- aString += OUStringLiteral1(*p++);
+ aString.append(*p++);
}
- refVar->PutString( aString );
+ refVar->PutString( aString.makeStringAndClear() );
}
else
{
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 59751d4d6288..3172cf5f686e 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -233,7 +233,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
return maName;
}
sal_Unicode cType = ' ';
- OUString aTmp( maName );
+ OUStringBuffer aTmp( maName );
// short type? Then fetch it, possible this is 0.
SbxDataType et = GetType();
if( t == SbxNameType::ShortTypes )
@@ -244,10 +244,10 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
}
if( cType != ' ' )
{
- aTmp += OUStringLiteral1(cType);
+ aTmp.append(cType);
}
}
- aTmp += "(";
+ aTmp.append("(");
for (SbxParams::const_iterator iter = pInfo->m_Params.begin(); iter != pInfo->m_Params.end(); ++iter)
{
@@ -255,17 +255,17 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
int nt = i->eType & 0x0FFF;
if (iter != pInfo->m_Params.begin())
{
- aTmp += ",";
+ aTmp.append(",");
}
if( i->nFlags & SbxFlagBits::Optional )
{
- aTmp += GetSbxRes( StringId::Optional );
+ aTmp.append( GetSbxRes( StringId::Optional ) );
}
if( i->eType & SbxBYREF )
{
- aTmp += GetSbxRes( StringId::ByRef );
+ aTmp.append( GetSbxRes( StringId::ByRef ) );
}
- aTmp += i->aName;
+ aTmp.append( i->aName );
cType = ' ';
// short type? Then fetch it, possible this is 0.
if( t == SbxNameType::ShortTypes )
@@ -277,32 +277,32 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
}
if( cType != ' ' )
{
- aTmp += OUStringLiteral1(cType);
+ aTmp.append(cType);
if( i->eType & SbxARRAY )
{
- aTmp += "()";
+ aTmp.append("()");
}
}
else
{
if( i->eType & SbxARRAY )
{
- aTmp += "()";
+ aTmp.append("()");
}
// long type?
- aTmp += GetSbxRes( StringId::As );
+ aTmp.append(GetSbxRes( StringId::As ));
if( nt < 32 )
{
- aTmp += GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + nt ) );
+ aTmp.append(GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + nt ) ));
}
else
{
- aTmp += GetSbxRes( StringId::Any );
+ aTmp.append(GetSbxRes( StringId::Any ));
}
}
}
- aTmp += ")";
- const_cast<SbxVariable*>(this)->aToolString = aTmp;
+ aTmp.append(")");
+ const_cast<SbxVariable*>(this)->aToolString = aTmp.makeStringAndClear();
return aToolString;
}
diff --git a/framework/source/accelerators/storageholder.cxx b/framework/source/accelerators/storageholder.cxx
index 99c67af297e0..a07883803443 100644
--- a/framework/source/accelerators/storageholder.cxx
+++ b/framework/source/accelerators/storageholder.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <rtl/ustrbuf.hxx>
#include <algorithm>
@@ -350,14 +351,14 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::getParentStorage(cons
return m_xRoot;
// c)
- OUString sParentPath;
+ OUStringBuffer sParentPath;
sal_Int32 i = 0;
for (i=0; i<c-1; ++i)
{
- sParentPath += lFolders[i] + PATH_SEPARATOR;
+ sParentPath.append(lFolders[i]).append(PATH_SEPARATOR);
}
- TPath2StorageInfo::const_iterator pParent = m_lStorages.find(sParentPath);
+ TPath2StorageInfo::const_iterator pParent = m_lStorages.find(sParentPath.makeStringAndClear());
if (pParent != m_lStorages.end())
return pParent->second.Storage;
diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx
index d6bff96e3155..da691e77276a 100644
--- a/framework/source/fwe/xml/menudocumenthandler.cxx
+++ b/framework/source/fwe/xml/menudocumenthandler.cxx
@@ -864,7 +864,7 @@ void OWriteMenuDocumentHandler::WriteMenuItem( const OUString& aCommandURL, cons
}
if ( nStyle > 0 )
{
- OUString aValue;
+ OUStringBuffer aValue;
const MenuStyleItem* pStyle = MenuItemStyles;
for ( sal_Int32 nIndex = 0; nIndex < nMenuStyleItemEntries; ++nIndex, ++pStyle )
@@ -872,13 +872,13 @@ void OWriteMenuDocumentHandler::WriteMenuItem( const OUString& aCommandURL, cons
if ( nStyle & pStyle->nBit )
{
if ( !aValue.isEmpty() )
- aValue += "+";
- aValue += OUString::createFromAscii( pStyle->attrName );
+ aValue.append("+");
+ aValue.appendAscii( pStyle->attrName );
}
}
pList->AddAttribute( ATTRIBUTE_NS_STYLE,
m_aAttributeType,
- aValue );
+ aValue.makeStringAndClear() );
}
m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
index f7d04c20708b..f2fbb715a6e6 100644
--- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx
+++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
@@ -711,7 +711,7 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxItem(
if ( nStyle > 0 )
{
- OUString aValue;
+ OUStringBuffer aValue;
const ToolboxStyleItem* pStyle = Styles;
for ( sal_Int32 nIndex = 0; nIndex < nStyleItemEntries; ++nIndex, ++pStyle )
@@ -719,13 +719,13 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxItem(
if ( nStyle & pStyle->nBit )
{
if ( !aValue.isEmpty() )
- aValue += " ";
- aValue += OUString::createFromAscii( pStyle->attrName );
+ aValue.append(" ");
+ aValue.appendAscii( pStyle->attrName );
}
}
pList->AddAttribute( m_aXMLToolbarNS + ATTRIBUTE_ITEMSTYLE,
m_aAttributeType,
- aValue );
+ aValue.makeStringAndClear() );
}
m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx
index e696f13b5a8c..3f633eaecdf8 100644
--- a/framework/source/uielement/langselectionmenucontroller.cxx
+++ b/framework/source/uielement/langselectionmenucontroller.cxx
@@ -167,7 +167,6 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
if ( pVCLPopupMenu )
pPopupMenu = static_cast<PopupMenu *>(pVCLPopupMenu->GetMenu());
- OUString aCmd;
OUString aCmd_Dialog;
OUString aCmd_Language;
if( eMode == MODE_SetLanguageSelectionMenu )
@@ -205,8 +204,7 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
!langItem.isEmpty()) // 'no language found' from language guessing
{
pPopupMenu->InsertItem( nItemId, langItem);
- aCmd = aCmd_Language;
- aCmd += langItem;
+ OUString aCmd = aCmd_Language + langItem;
pPopupMenu->SetItemCommand( nItemId, aCmd );
if (langItem == m_aCurLang && eMode == MODE_SetLanguageSelectionMenu )
{
@@ -220,7 +218,7 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
// entry for LANGUAGE_NONE
++nItemId;
pPopupMenu->InsertItem( nItemId, FwkResId(STR_LANGSTATUS_NONE) );
- aCmd = aCmd_Language + "LANGUAGE_NONE";
+ OUString aCmd = aCmd_Language + "LANGUAGE_NONE";
pPopupMenu->SetItemCommand( nItemId, aCmd );
// entry for 'Reset to default language'
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index fd450affb5f4..be9992d470ac 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -778,7 +778,7 @@ bool Converter::convertDuration(double& rfTime,
if ( *(pStr++) != 'P' ) // duration must start with "P"
return false;
- OUString sDoubleStr;
+ OUStringBuffer sDoubleStr;
bool bSuccess = true;
bool bDone = false;
bool bTimePart = false;
@@ -807,7 +807,7 @@ bool Converter::convertDuration(double& rfTime,
}
else
{
- sDoubleStr += OUStringLiteral1(c);
+ sDoubleStr.append(c);
}
}
}
@@ -870,7 +870,7 @@ bool Converter::convertDuration(double& rfTime,
double fHour = nHours;
double fMin = nMins;
double fSec = nSecs;
- double fFraction = sDoubleStr.toDouble();
+ double fFraction = sDoubleStr.makeStringAndClear().toDouble();
double fTempTime = fHour / 24;
fTempTime += fMin / (24 * 60);
fTempTime += fSec / (24 * 60 * 60);
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<const SvLBoxString&>(rStr).GetText();
+ aResult.append("\t");
+ aResult.append(static_cast<const SvLBoxString&>(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<const SvLBoxString&>(rBoxItem).GetText();
+ aResult.append("\t");
+ aResult.append(static_cast<const SvLBoxString&>(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<SvLBoxString&>( rItem ).GetText().isEmpty() )
{
- sRet += static_cast<SvLBoxString&>( rItem ).GetText() + ",";
+ sRet.append(static_cast<SvLBoxString&>( rItem ).GetText()).append(",");
}
nCur++;
}
if (!sRet.isEmpty())
sRet = sRet.copy(0, sRet.getLength() - 1);
- return sRet;
+ return sRet.makeStringAndClear();
}
SvTreeListBox::~SvTreeListBox()
More information about the Libreoffice-commits
mailing list