From ab35d2ded153b0129fed16f9a7e882c8600933e6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 30 Oct 2019 08:41:43 +0200 Subject: 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 --- include/rtl/string.h | 25 +++++++++++++++++++++++++ include/rtl/ustring.h | 25 +++++++++++++++++++++++++ include/sax/tools/converter.hxx | 4 ++-- 3 files changed, 52 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/rtl/string.h b/include/rtl/string.h index 4996e1d07b4d..81322b186875 100644 --- a/include/rtl/string.h +++ b/include/rtl/string.h @@ -783,6 +783,31 @@ SAL_DLLPUBLIC sal_uInt32 SAL_CALL rtl_str_toUInt32( SAL_DLLPUBLIC sal_Int64 SAL_CALL rtl_str_toInt64( const sal_Char * str, sal_Int16 radix ) SAL_THROW_EXTERN_C(); +/** Interpret a string as a long integer. + + This function cannot be used for language-specific conversion. The string + must be null-terminated. + + @param str + a null-terminated string. + + @param radix + the radix. Must be between RTL_STR_MIN_RADIX (2) and RTL_STR_MAX_RADIX + (36), inclusive. + + @param nStrLength + number of sal_Chars to process + + @return + the long integer value represented by the string, or 0 if the string does + not represent a long integer. + + @internal + @since LibreOffice 6.4 +*/ +SAL_DLLPUBLIC sal_Int64 SAL_CALL rtl_str_toInt64_WithLength( + const sal_Char * str, sal_Int16 radix, sal_Int32 nStrLength ) SAL_THROW_EXTERN_C(); + /** Interpret a string as an unsigned long integer. This function cannot be used for language-specific conversion. The string diff --git a/include/rtl/ustring.h b/include/rtl/ustring.h index 35e4a7d4ad67..5e481c21c4c4 100644 --- a/include/rtl/ustring.h +++ b/include/rtl/ustring.h @@ -1113,6 +1113,31 @@ SAL_DLLPUBLIC sal_uInt32 SAL_CALL rtl_ustr_toUInt32( SAL_DLLPUBLIC sal_Int64 SAL_CALL rtl_ustr_toInt64( const sal_Unicode * str, sal_Int16 radix ) SAL_THROW_EXTERN_C(); +/** Interpret a string as a long integer. + + This function cannot be used for language-specific conversion. The string + must be null-terminated. + + @param str + a null-terminated string. + + @param radix + the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX + (36), inclusive. + + @param nStrLength + number of chars to process + + @return + the long integer value represented by the string, or 0 if the string does + not represent a long integer. + + @internal + @since LibreOffice 6.4 +*/ +SAL_DLLPUBLIC sal_Int64 SAL_CALL rtl_ustr_toInt64_WithLength( + const sal_Unicode * str, sal_Int16 radix, sal_Int32 nStrLength ) SAL_THROW_EXTERN_C(); + /** Interpret a string as an unsigned long integer. This function cannot be used for language-specific conversion. The string diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx index d1dbdac62d54..a372360f6d8d 100644 --- a/include/sax/tools/converter.hxx +++ b/include/sax/tools/converter.hxx @@ -112,13 +112,13 @@ public: /** convert string to number with optional min and max values */ static bool convertNumber( sal_Int32& rValue, - const OUString& rString, + std::u16string_view aString, sal_Int32 nMin = SAL_MIN_INT32, sal_Int32 nMax = SAL_MAX_INT32 ); /** convert string to number with optional min and max values */ static bool convertNumber64(sal_Int64& rValue, - const OUString& rString, + std::u16string_view aString, sal_Int64 nMin = SAL_MIN_INT64, sal_Int64 nMax = SAL_MAX_INT64); -- cgit