summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2018-08-12 23:07:44 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2018-09-09 21:07:53 +0200
commitd2fdf0610792f187f313e7ec64fa8049b814cb27 (patch)
treef5be6a44b0e97c64582dcf7df9f96958243ae7f2 /extensions
parent088cb5c33fc78606e1db9fef6d33f77e63bf7b24 (diff)
Avoid getTokenCount and use indexed getToken
Change-Id: Iaac598c9e56afa29db88237fecbe54d9cb4d4011
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/propctrlr/standardcontrol.cxx22
1 files changed, 15 insertions, 7 deletions
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index f6bd2718c35e..40e283108339 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -1055,9 +1055,17 @@ namespace pcr
{
sal_Int32 nLines = comphelper::string::getTokenCount(_rCompsedTextWithLineBreaks, '\n');
StlSyntaxSequence< OUString > aStrings( nLines );
- StlSyntaxSequence< OUString >::iterator stringItem = aStrings.begin();
- for ( sal_Int32 token = 0; token < nLines; ++token, ++stringItem )
- *stringItem = _rCompsedTextWithLineBreaks.getToken( token, '\n' );
+ if (nLines)
+ {
+ StlSyntaxSequence< OUString >::iterator stringItem = aStrings.begin();
+ sal_Int32 nIdx {0};
+ do
+ {
+ *stringItem = _rCompsedTextWithLineBreaks.getToken( 0, '\n', nIdx );
+ ++stringItem;
+ }
+ while (nIdx>0);
+ }
return aStrings;
}
@@ -1150,9 +1158,9 @@ namespace pcr
if (!aStr.isEmpty())
{
long nDiff=0;
- sal_Int32 nCount = comphelper::string::getTokenCount(aStr, '\n');
- OUString aInput = aStr.getToken(0,'\n' );
+ sal_Int32 nIdx {0};
+ OUString aInput = aStr.getToken(0, '\n', nIdx );
if (!aInput.isEmpty())
{
@@ -1168,9 +1176,9 @@ namespace pcr
}
else
{
- for (sal_Int32 i=1; i<nCount; ++i)
+ while (nIdx>0)
{
- aInput=aStr.getToken(static_cast<sal_uInt16>(i), '\n');
+ aInput=aStr.getToken(0, '\n', nIdx);
if (!aInput.isEmpty())
{
aOutput += ";";