summaryrefslogtreecommitdiff
path: root/basegfx/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-10 15:36:21 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-10 20:15:16 +0200
commitb24a4d255d31233c48152e6e1ce992a693cdaeae (patch)
treee0ad8f574d3b1ddcad3d81ec3ac438777ca4846d /basegfx/source
parent57f22d9b1a4e1cd161a35c8e4c390661db981d2c (diff)
use more string_view
found by tweaking the loplugin:stringview and making it whitelist getLength Change-Id: Ic15d3703d1fb07658e99e1db1c89e2fa5bc70c19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132771 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basegfx/source')
-rw-r--r--basegfx/source/inc/stringconversiontools.hxx2
-rw-r--r--basegfx/source/polygon/b2dsvgpolypolygon.cxx8
-rw-r--r--basegfx/source/tools/stringconversiontools.cxx19
3 files changed, 15 insertions, 14 deletions
diff --git a/basegfx/source/inc/stringconversiontools.hxx b/basegfx/source/inc/stringconversiontools.hxx
index fdf2f83e0f4e..797697d203ac 100644
--- a/basegfx/source/inc/stringconversiontools.hxx
+++ b/basegfx/source/inc/stringconversiontools.hxx
@@ -51,7 +51,7 @@ namespace basegfx::internal
bool importDoubleAndSpaces(double& o_fRetval,
sal_Int32& io_rPos,
- const OUString& rStr,
+ std::u16string_view rStr,
const sal_Int32 nLen );
bool importFlagAndSpaces(sal_Int32& o_nRetval,
diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
index 323fff14c024..aa0fedb2ddf2 100644
--- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
@@ -74,12 +74,12 @@ namespace basegfx::utils
bool importFromSvgD(
B2DPolyPolygon& o_rPolyPolygon,
- const OUString& rSvgDStatement,
+ std::u16string_view rSvgDStatement,
bool bHandleRelativeNextPointCompatible,
PointIndexSet* pHelpPointIndexSet)
{
o_rPolyPolygon.clear();
- const sal_Int32 nLen(rSvgDStatement.getLength());
+ const sal_Int32 nLen(rSvgDStatement.size());
sal_Int32 nPos(0);
double nLastX( 0.0 );
double nLastY( 0.0 );
@@ -664,10 +664,10 @@ namespace basegfx::utils
}
bool importFromSvgPoints( B2DPolygon& o_rPoly,
- const OUString& rSvgPointsAttribute )
+ std::u16string_view rSvgPointsAttribute )
{
o_rPoly.clear();
- const sal_Int32 nLen(rSvgPointsAttribute.getLength());
+ const sal_Int32 nLen(rSvgPointsAttribute.size());
sal_Int32 nPos(0);
double nX, nY;
diff --git a/basegfx/source/tools/stringconversiontools.cxx b/basegfx/source/tools/stringconversiontools.cxx
index d9f7df14cf50..d6a702faa687 100644
--- a/basegfx/source/tools/stringconversiontools.cxx
+++ b/basegfx/source/tools/stringconversiontools.cxx
@@ -46,9 +46,10 @@ namespace basegfx::internal
static bool getDoubleChar(double& o_fRetval,
sal_Int32& io_rPos,
- const OUString& rStr)
+ std::u16string_view rStr)
{
- sal_Unicode aChar = io_rPos < rStr.getLength() ? rStr[io_rPos] : 0;
+ const sal_Int64 nStrSize = rStr.size();
+ sal_Unicode aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
OUStringBuffer sNumberString;
// sign
@@ -63,7 +64,7 @@ namespace basegfx::internal
{
sNumberString.append(rStr[io_rPos]);
io_rPos++;
- aChar = io_rPos < rStr.getLength() ? rStr[io_rPos] : 0;
+ aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
}
// point
@@ -71,7 +72,7 @@ namespace basegfx::internal
{
sNumberString.append(rStr[io_rPos]);
io_rPos++;
- aChar = io_rPos < rStr.getLength() ? rStr[io_rPos] : 0;
+ aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
}
// numbers after point
@@ -79,7 +80,7 @@ namespace basegfx::internal
{
sNumberString.append(rStr[io_rPos]);
io_rPos++;
- aChar = io_rPos < rStr.getLength() ? rStr[io_rPos] : 0;
+ aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
}
// 'e'
@@ -87,14 +88,14 @@ namespace basegfx::internal
{
sNumberString.append(rStr[io_rPos]);
io_rPos++;
- aChar = io_rPos < rStr.getLength() ? rStr[io_rPos] : 0;
+ aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
// sign for 'e'
if(aChar == '+' || aChar == '-')
{
sNumberString.append(rStr[io_rPos]);
io_rPos++;
- aChar = io_rPos < rStr.getLength() ? rStr[io_rPos] : 0;
+ aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
}
// number for 'e'
@@ -102,7 +103,7 @@ namespace basegfx::internal
{
sNumberString.append(rStr[io_rPos]);
io_rPos++;
- aChar = io_rPos < rStr.getLength() ? rStr[io_rPos] : 0;
+ aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
}
}
@@ -121,7 +122,7 @@ namespace basegfx::internal
bool importDoubleAndSpaces(double& o_fRetval,
sal_Int32& io_rPos,
- const OUString& rStr,
+ std::u16string_view rStr,
const sal_Int32 nLen )
{
if( !getDoubleChar(o_fRetval, io_rPos, rStr) )