summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-07-01 14:04:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-07-04 16:28:41 +0200
commit895643431e6aea672158bae3772a36f26cd05cde (patch)
tree6f02f0ced08b4b79e3655b273d568b2b34c4520b /basegfx
parentde59dbdc488122f70229550dba21ba76e2c61146 (diff)
tdf#137544 no need to create a OUStringBuffer here
we can just pass a view here Change-Id: I71679106ee749f64eac4819c2a4f282e40865639 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136803 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/tools/stringconversiontools.cxx15
1 files changed, 5 insertions, 10 deletions
diff --git a/basegfx/source/tools/stringconversiontools.cxx b/basegfx/source/tools/stringconversiontools.cxx
index 3a671ae539f0..79b6d604662e 100644
--- a/basegfx/source/tools/stringconversiontools.cxx
+++ b/basegfx/source/tools/stringconversiontools.cxx
@@ -50,19 +50,17 @@ namespace basegfx::internal
{
const sal_Int64 nStrSize = rStr.size();
sal_Unicode aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
- OUStringBuffer sNumberString;
+ const sal_Int32 nStartPos = io_rPos;
// sign
if(aChar == '+' || aChar == '-')
{
- sNumberString.append(rStr[io_rPos]);
aChar = rStr[++io_rPos];
}
// numbers before point
while('0' <= aChar && '9' >= aChar)
{
- sNumberString.append(rStr[io_rPos]);
io_rPos++;
aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
}
@@ -70,7 +68,6 @@ namespace basegfx::internal
// point
if(aChar == '.')
{
- sNumberString.append(rStr[io_rPos]);
io_rPos++;
aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
}
@@ -78,7 +75,6 @@ namespace basegfx::internal
// numbers after point
while ('0' <= aChar && '9' >= aChar)
{
- sNumberString.append(rStr[io_rPos]);
io_rPos++;
aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
}
@@ -86,14 +82,12 @@ namespace basegfx::internal
// 'e'
if(aChar == 'e' || aChar == 'E')
{
- sNumberString.append(rStr[io_rPos]);
io_rPos++;
aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
// sign for 'e'
if(aChar == '+' || aChar == '-')
{
- sNumberString.append(rStr[io_rPos]);
io_rPos++;
aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
}
@@ -101,16 +95,17 @@ namespace basegfx::internal
// number for 'e'
while('0' <= aChar && '9' >= aChar)
{
- sNumberString.append(rStr[io_rPos]);
io_rPos++;
aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
}
}
- if(sNumberString.getLength())
+ const sal_Int32 nLen = io_rPos - nStartPos;
+ if(nLen)
{
+ rStr = rStr.substr(nStartPos, nLen);
rtl_math_ConversionStatus eStatus;
- o_fRetval = ::rtl::math::stringToDouble( sNumberString,
+ o_fRetval = ::rtl::math::stringToDouble( rStr,
'.',
',',
&eStatus );