summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2019-01-26 00:33:34 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2019-01-27 11:44:17 +0100
commitb8fdb4c9c4a3451dc7bec7cd0e8424e8047ead6a (patch)
tree7250374580c410f65d87f3c824e952b77a08448f /vcl
parentbe3cb2cb8df286fba0b141692307f0342aeeecee (diff)
getToken: reuse known index information
Change-Id: I87f274addcba0776016e9996a0b568f503e2081a Reviewed-on: https://gerrit.libreoffice.org/66939 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/font/FeatureParser.cxx19
1 files changed, 11 insertions, 8 deletions
diff --git a/vcl/source/font/FeatureParser.cxx b/vcl/source/font/FeatureParser.cxx
index abfda4b0734d..a7626a564942 100644
--- a/vcl/source/font/FeatureParser.cxx
+++ b/vcl/source/font/FeatureParser.cxx
@@ -17,27 +17,30 @@ namespace font
{
OUString trimFontNameFeatures(OUString const& rFontName)
{
- OUString sResultName(rFontName);
+ const sal_Int32 nPrefixIdx{ rFontName.indexOf(vcl::font::FeaturePrefix) };
- if (sResultName.indexOf(vcl::font::FeaturePrefix) < 0)
- return sResultName;
+ if (nPrefixIdx < 0)
+ return rFontName;
- return sResultName.getToken(0, vcl::font::FeaturePrefix);
+ return rFontName.copy(0, nPrefixIdx);
}
FeatureParser::FeatureParser(OUString const& rFontName)
{
- if (rFontName.indexOf(vcl::font::FeaturePrefix) < 0)
+ sal_Int32 nPrefixIdx{ rFontName.indexOf(vcl::font::FeaturePrefix) };
+
+ if (nPrefixIdx < 0)
return;
- OUString sName = rFontName.getToken(1, vcl::font::FeaturePrefix);
+ OUString sName = rFontName.getToken(0, vcl::font::FeaturePrefix, ++nPrefixIdx);
sal_Int32 nIndex = 0;
do
{
OUString sToken = sName.getToken(0, vcl::font::FeatureSeparator, nIndex);
- OUString sID = sToken.getToken(0, '=');
- OUString sValue = sToken.getToken(1, '=');
+ sal_Int32 nInnerIdx{ 0 };
+ OUString sID = sToken.getToken(0, '=', nInnerIdx);
+ OUString sValue = sToken.getToken(0, '=', nInnerIdx);
if (sID.getLength() == 4 && sValue != "0")
{