From b1df9c67349cf4cc5be4128d797aefb87f50e38f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 16 Jul 2021 14:48:25 +0200 Subject: [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 Reviewed-by: Noel Grandin --- sax/source/tools/fastattribs.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sax/source') 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; -- cgit