summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-26 13:15:05 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-27 11:15:46 +0200
commitc8fa03b1f565461364b9f6423b65680e09281c14 (patch)
tree78ff35dfeb569354b41e89b9d55d77b46f7d3d95 /unotools
parent82a4ef72d6e34c2f5075069a1b353f7fd41c7595 (diff)
new loplugin:stringloop, and applied in various
look for OUString being appended to in a loop, better to use OUStringBuffer to accumulate the results. Change-Id: Ia36e06e2781a7c546ce9cbad62727aa4c5f10c4b Reviewed-on: https://gerrit.libreoffice.org/58092 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/defaultoptions.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/unotools/source/config/defaultoptions.cxx b/unotools/source/config/defaultoptions.cxx
index c338a741e24c..0a74a321825a 100644
--- a/unotools/source/config/defaultoptions.cxx
+++ b/unotools/source/config/defaultoptions.cxx
@@ -32,6 +32,7 @@
#include <osl/mutex.hxx>
#include <rtl/instance.hxx>
+#include <rtl/ustrbuf.hxx>
#include "itemholder1.hxx"
@@ -234,7 +235,8 @@ SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : ConfigItem( "Office.Common/Pa
if ( aValues.getLength() == aNames.getLength() )
{
SvtPathOptions aPathOpt;
- OUString aTempStr, aFullPath;
+ OUString aTempStr;
+ OUStringBuffer aFullPathBuf;
for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
{
@@ -246,7 +248,7 @@ SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : ConfigItem( "Office.Common/Pa
{
// multi paths
if ( pValues[nProp] >>= aTempStr )
- aFullPath = aPathOpt.SubstituteVariable( aTempStr );
+ aFullPathBuf = aPathOpt.SubstituteVariable( aTempStr );
else
{
SAL_WARN( "unotools.config", "any operator >>= failed" );
@@ -257,17 +259,16 @@ SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : ConfigItem( "Office.Common/Pa
case css::uno::TypeClass_SEQUENCE :
{
// single paths
- aFullPath.clear();
+ aFullPathBuf.setLength(0);
Sequence < OUString > aList;
if ( pValues[nProp] >>= aList )
{
sal_Int32 nCount = aList.getLength();
for ( sal_Int32 nPosition = 0; nPosition < nCount; ++nPosition )
{
- aTempStr = aPathOpt.SubstituteVariable( aList[ nPosition ] );
- aFullPath += aTempStr;
+ aFullPathBuf.append(aPathOpt.SubstituteVariable( aList[ nPosition ] ));
if ( nPosition < nCount-1 )
- aFullPath += ";";
+ aFullPathBuf.append(";");
}
}
else
@@ -283,6 +284,7 @@ SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : ConfigItem( "Office.Common/Pa
}
}
+ auto aFullPath = aFullPathBuf.makeStringAndClear();
switch ( nProp )
{
case DEFAULTPATH_ADDIN: m_aAddinPath = aFullPath; break;