summaryrefslogtreecommitdiff
path: root/comphelper
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 /comphelper
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 'comphelper')
-rw-r--r--comphelper/source/misc/mimeconfighelper.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/comphelper/source/misc/mimeconfighelper.cxx b/comphelper/source/misc/mimeconfighelper.cxx
index 08ac2f958f37..c027bc1ff00f 100644
--- a/comphelper/source/misc/mimeconfighelper.cxx
+++ b/comphelper/source/misc/mimeconfighelper.cxx
@@ -30,6 +30,7 @@
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/documentconstants.hxx>
#include <comphelper/propertysequence.hxx>
+#include <rtl/ustrbuf.hxx>
using namespace ::com::sun::star;
@@ -46,22 +47,22 @@ MimeConfigurationHelper::MimeConfigurationHelper( const uno::Reference< uno::XCo
OUString MimeConfigurationHelper::GetStringClassIDRepresentation( const uno::Sequence< sal_Int8 >& aClassID )
{
- OUString aResult;
+ OUStringBuffer aResult;
if ( aClassID.getLength() == 16 )
{
for ( sal_Int32 nInd = 0; nInd < aClassID.getLength(); nInd++ )
{
if ( nInd == 4 || nInd == 6 || nInd == 8 || nInd == 10 )
- aResult += "-";
+ aResult.append("-");
sal_Int32 nDigit1 = static_cast<sal_Int32>( static_cast<sal_uInt8>(aClassID[nInd]) / 16 );
sal_Int32 nDigit2 = static_cast<sal_uInt8>(aClassID[nInd]) % 16;
- aResult += OUString::number( nDigit1, 16 ) + OUString::number( nDigit2, 16 );
+ aResult.append(OUString::number( nDigit1, 16 )).append(OUString::number( nDigit2, 16 ));
}
}
- return aResult;
+ return aResult.makeStringAndClear();
}