From c8fa03b1f565461364b9f6423b65680e09281c14 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 26 Jul 2018 13:15:05 +0200 Subject: 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 --- opencl/source/openclconfig.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'opencl') diff --git a/opencl/source/openclconfig.cxx b/opencl/source/openclconfig.cxx index 0ec2347fb332..18a9f865be00 100644 --- a/opencl/source/openclconfig.cxx +++ b/opencl/source/openclconfig.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -69,16 +70,16 @@ css::uno::Sequence SetOfImplMatcherToStringSequence(const OpenCLConfig OUString getToken(const OUString& string, sal_Int32& index) { OUString token(string.getToken(0, '/', index)); - OUString result; + OUStringBuffer result; sal_Int32 i(0); sal_Int32 p; while ((p = token.indexOf('%', i)) >= 0) { if (p > i) - result += token.copy(i, p - i); + result.append(token.copy(i, p - i)); if (p < token.getLength() - 2) { - result += OUStringLiteral1(token.copy(p+1, 2).toInt32(16)); + result.append(OUStringLiteral1(token.copy(p+1, 2).toInt32(16))); i = p + 3; } else @@ -86,9 +87,9 @@ OUString getToken(const OUString& string, sal_Int32& index) i = token.getLength(); } } - result += token.copy(i); + result.append(token.copy(i)); - return result; + return result.makeStringAndClear(); } OpenCLConfig::ImplMatcherSet StringSequenceToSetOfImplMatcher(const css::uno::Sequence& rSequence) -- cgit v1.2.3