diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-26 13:15:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-27 11:15:46 +0200 |
commit | c8fa03b1f565461364b9f6423b65680e09281c14 (patch) | |
tree | 78ff35dfeb569354b41e89b9d55d77b46f7d3d95 /opencl | |
parent | 82a4ef72d6e34c2f5075069a1b353f7fd41c7595 (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 'opencl')
-rw-r--r-- | opencl/source/openclconfig.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
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 <opencl/openclconfig.hxx> #include <opencl/platforminfo.hxx> #include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> #include <sal/log.hxx> #include <sal/types.h> @@ -69,16 +70,16 @@ css::uno::Sequence<OUString> 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<OUString>& rSequence) |