summaryrefslogtreecommitdiff
path: root/sax/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-08-01 18:58:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-08-01 20:53:28 +0200
commit75a862b887fb0b7ff633a396ee7f7f34c2c82964 (patch)
tree50361f282bfcd20ff04f97b59806b95029a9a405 /sax/source
parentf8d764b138fddde719a04683f9bd3720c21e0656 (diff)
use more string_view when dealing with attributes
which means we don't need to call strlen on them, since we already know how long they are. Change-Id: Iefc76f38a23250e87a65c27df3634d562464a760 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137679 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sax/source')
-rw-r--r--sax/source/tools/fastattribs.cxx11
1 files changed, 3 insertions, 8 deletions
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 3522f38f3ef5..d020e18de18c 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -242,7 +242,7 @@ bool FastAttributeList::getAsDouble( sal_Int32 nToken, double &rDouble) const
return false;
}
-bool FastAttributeList::getAsChar( sal_Int32 nToken, const char*& rPos ) const
+bool FastAttributeList::getAsView( sal_Int32 nToken, std::string_view& rPos ) const
{
for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i)
{
@@ -250,19 +250,14 @@ bool FastAttributeList::getAsChar( sal_Int32 nToken, const char*& rPos ) const
continue;
sal_Int32 nOffset = maAttributeValues[i];
- rPos = mpChunk + nOffset;
+ size_t nValueLen = maAttributeValues[i + 1] - maAttributeValues[i] - 1;
+ rPos = { mpChunk + nOffset, nValueLen };
return true;
}
return false;
}
-const char* FastAttributeList::getAsCharByIndex( sal_Int32 nTokenIndex ) const
-{
- sal_Int32 nOffset = maAttributeValues[nTokenIndex];
- return mpChunk + nOffset;
-}
-
std::string_view FastAttributeList::getAsViewByIndex( sal_Int32 nTokenIndex ) const
{
sal_Int32 nOffset = maAttributeValues[nTokenIndex];