diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-16 14:48:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-17 09:12:26 +0200 |
commit | b1df9c67349cf4cc5be4128d797aefb87f50e38f (patch) | |
tree | 171fbccaadecd8fac85e1e6212ce560162fabc7f /sax/source | |
parent | 3545caa5aac59022d5c00d4a0c2a74657cbcae8d (diff) |
[API CHANGE] reduce cost of numeric conversion
on a hot path, since we already know the length of these strings.
Which requires adding some new variants of our string conversion
functions
Change-Id: I1877f8f3c72934c07f14eec7e73bbe8d7b0f1808
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119065
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sax/source')
-rw-r--r-- | sax/source/tools/fastattribs.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index 554232260aef..9cec32318108 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -196,7 +196,7 @@ bool FastAttributeList::getAsInteger( sal_Int32 nToken, sal_Int32 &rInt) const for (size_t i = 0; i < maAttributeTokens.size(); ++i) if (maAttributeTokens[i] == nToken) { - rInt = rtl_str_toInt32( getFastAttributeValue(i), 10 ); + rInt = rtl_str_toInt32_WithLength( getFastAttributeValue(i), 10, AttributeValueLength(i) ); return true; } return false; @@ -204,7 +204,7 @@ bool FastAttributeList::getAsInteger( sal_Int32 nToken, sal_Int32 &rInt) const sal_Int32 FastAttributeList::getAsIntegerByIndex( sal_Int32 nTokenIndex ) const { - return rtl_str_toInt32( getFastAttributeValue(nTokenIndex), 10 ); + return rtl_str_toInt32_WithLength( getFastAttributeValue(nTokenIndex), 10, AttributeValueLength(nTokenIndex) ); } bool FastAttributeList::getAsDouble( sal_Int32 nToken, double &rDouble) const @@ -213,7 +213,7 @@ bool FastAttributeList::getAsDouble( sal_Int32 nToken, double &rDouble) const for (size_t i = 0; i < maAttributeTokens.size(); ++i) if (maAttributeTokens[i] == nToken) { - rDouble = rtl_str_toDouble( getFastAttributeValue(i) ); + rDouble = rtl_str_toDouble_WithLength( getFastAttributeValue(i), AttributeValueLength(i) ); return true; } return false; |