summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-30 08:41:43 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-31 07:02:09 +0100
commitab35d2ded153b0129fed16f9a7e882c8600933e6 (patch)
tree13f1776117f743c34761b6a31ca93f80020e20d3 /sal
parent877d0c2c211067e8c1b5fdff0f6d9703c94767e9 (diff)
tdf#125688 speed up load of change-tracking ODS
by 10%, by avoiding an OUString construction in a hot path through XMLTextColumnContext_Impl::XMLTextColumnContext_Impl -> sax::Convert::convertNumber Also changed XMLTextAnimationStepPropertyHdl::importXML to take advantage of the modified convertNumber passing convention. Change-Id: I4e5503dbb094c88a09af8b6dc8c22b6c53f9eb75 Reviewed-on: https://gerrit.libreoffice.org/81726 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/strtmpl.cxx24
-rw-r--r--sal/util/sal.map6
2 files changed, 24 insertions, 6 deletions
diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index 3cc4d9927274..4e6035d478e2 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -989,20 +989,23 @@ sal_Bool SAL_CALL IMPL_RTL_STRNAME( toBoolean )( const IMPL_RTL_STRCODE* pStr )
/* ----------------------------------------------------------------------- */
namespace {
- template<typename T, typename U> T IMPL_RTL_STRNAME( toInt )( const IMPL_RTL_STRCODE* pStr,
- sal_Int16 nRadix )
+ template<typename T, typename U> T IMPL_RTL_STRNAME( toInt_WithLength )( const IMPL_RTL_STRCODE* pStr,
+ sal_Int16 nRadix,
+ sal_Int32 nStrLength )
{
static_assert(std::numeric_limits<T>::is_signed, "is signed");
assert( nRadix >= RTL_STR_MIN_RADIX && nRadix <= RTL_STR_MAX_RADIX );
+ assert( nStrLength >= 0 );
bool bNeg;
sal_Int16 nDigit;
U n = 0;
+ const IMPL_RTL_STRCODE* pEnd = pStr + nStrLength;
if ( (nRadix < RTL_STR_MIN_RADIX) || (nRadix > RTL_STR_MAX_RADIX) )
nRadix = 10;
/* Skip whitespaces */
- while ( *pStr && rtl_ImplIsWhitespace( IMPL_RTL_USTRCODE( *pStr ) ) )
+ while ( pStr != pEnd && rtl_ImplIsWhitespace( IMPL_RTL_USTRCODE( *pStr ) ) )
pStr++;
if ( *pStr == '-' )
@@ -1039,7 +1042,7 @@ namespace {
nMod = std::numeric_limits<T>::max() % nRadix;
}
- while ( *pStr )
+ while ( pStr != pEnd )
{
nDigit = rtl_ImplGetDigit( IMPL_RTL_USTRCODE( *pStr ), nRadix );
if ( nDigit < 0 )
@@ -1067,7 +1070,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( toInt32 )( const IMPL_RTL_STRCODE* pStr,
SAL_THROW_EXTERN_C()
{
assert(pStr);
- return IMPL_RTL_STRNAME( toInt )<sal_Int32, sal_uInt32>(pStr, nRadix);
+ return IMPL_RTL_STRNAME( toInt_WithLength )<sal_Int32, sal_uInt32>(pStr, nRadix, IMPL_RTL_STRNAME( getLength )(pStr));
}
sal_Int64 SAL_CALL IMPL_RTL_STRNAME( toInt64 )( const IMPL_RTL_STRCODE* pStr,
@@ -1075,7 +1078,16 @@ sal_Int64 SAL_CALL IMPL_RTL_STRNAME( toInt64 )( const IMPL_RTL_STRCODE* pStr,
SAL_THROW_EXTERN_C()
{
assert(pStr);
- return IMPL_RTL_STRNAME( toInt )<sal_Int64, sal_uInt64>(pStr, nRadix);
+ return IMPL_RTL_STRNAME( toInt_WithLength )<sal_Int64, sal_uInt64>(pStr, nRadix, IMPL_RTL_STRNAME( getLength )(pStr));
+}
+
+sal_Int64 SAL_CALL IMPL_RTL_STRNAME( toInt64_WithLength )( const IMPL_RTL_STRCODE* pStr,
+ sal_Int16 nRadix,
+ sal_Int32 nStrLength)
+ SAL_THROW_EXTERN_C()
+{
+ assert(pStr);
+ return IMPL_RTL_STRNAME( toInt_WithLength )<sal_Int64, sal_uInt64>(pStr, nRadix, nStrLength);
}
/* ----------------------------------------------------------------------- */
diff --git a/sal/util/sal.map b/sal/util/sal.map
index 9292d50ca423..48d76b1a3802 100644
--- a/sal/util/sal.map
+++ b/sal/util/sal.map
@@ -743,6 +743,12 @@ PRIVATE_1.5 { # LibreOffice 6.1
rtl_alloc_preInit;
} PRIVATE_1.4;
+PRIVATE_1.6 { # LibreOffice 6.4
+ global:
+ rtl_str_toInt64_WithLength;
+ rtl_ustr_toInt64_WithLength;
+} PRIVATE_1.5;
+
PRIVATE_textenc.1 { # LibreOffice 3.6
global:
_ZN3sal6detail7textenc20convertCharToUnicode*;