summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-29 11:06:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-01 08:30:18 +0200
commit5200a73627d13e2997f81b53f61e143e77e328ee (patch)
treef95c8346d061ecd0ad33d574895d18e169662785 /svgio
parentb90d3d316dd9c720c83180b31f6bbd7003fead78 (diff)
use more string_view in various
found by examining uses of OUString::copy() for likely places Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/source/svgreader/svgtools.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx
index 38764729e33e..c6af0694fc83 100644
--- a/svgio/source/svgreader/svgtools.cxx
+++ b/svgio/source/svgreader/svgtools.cxx
@@ -21,6 +21,7 @@
#include <sal/log.hxx>
#include <tools/color.hxx>
#include <rtl/math.hxx>
+#include <o3tl/string_view.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <svgtoken.hxx>
@@ -1323,20 +1324,20 @@ namespace svgio::svgreader
if(rMimeType.startsWith("image"))
{
// image data
- OUString aData(rCandidate.copy(nPos));
- static const char aStrBase64[] = "base64";
+ std::u16string_view aData(rCandidate.subView(nPos));
+ static constexpr std::u16string_view aStrBase64 = u"base64";
- if(aData.startsWith(aStrBase64))
+ if(o3tl::starts_with(aData, aStrBase64))
{
// base64 encoded
- nPos = strlen(aStrBase64);
- nLen = aData.getLength();
+ nPos = aStrBase64.size();
+ nLen = aData.size();
skip_char(aData, ' ', ',', nPos, nLen);
if(nPos < nLen)
{
- rData = aData.copy(nPos);
+ rData = aData.substr(nPos);
}
}
}