diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-26 17:47:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-27 12:19:55 +0200 |
commit | d506ff97c25b5f433aa25d8b373f1a732af493d1 (patch) | |
tree | 600e211e3426a3b43407b01d6f93e5379d608b26 /sc | |
parent | 148f45253f75bc724804f3231a0b04b2d453e0c7 (diff) |
add string_view wrappers for rtl::math::stringToDouble
Change-Id: I114bec72cb933238675e539a8388a607226827cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133455
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/stringutil.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/oox/condformatbuffer.cxx | 7 |
2 files changed, 8 insertions, 9 deletions
diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx index 131853a5f162..493f3fdeed93 100644 --- a/sc/source/core/tool/stringutil.cxx +++ b/sc/source/core/tool/stringutil.cxx @@ -191,9 +191,8 @@ bool ScStringUtil::parseSimpleNumber( rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok; sal_Int32 nParseEnd = 0; - OUString aString( aBuf.makeStringAndClear()); - rVal = ::rtl::math::stringToDouble( aString, dsep, gsep, &eStatus, &nParseEnd); - if (eStatus != rtl_math_ConversionStatus_Ok || nParseEnd < aString.getLength()) + rVal = ::rtl::math::stringToDouble( aBuf, dsep, gsep, &eStatus, &nParseEnd); + if (eStatus != rtl_math_ConversionStatus_Ok || nParseEnd < aBuf.getLength()) // Not a valid number or not entire string consumed. return false; @@ -337,9 +336,8 @@ bool ScStringUtil::parseSimpleNumber( rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok; sal_Int32 nParseEnd = 0; - OString aString( aBuf.makeStringAndClear()); - rVal = ::rtl::math::stringToDouble( aString, dsep, gsep, &eStatus, &nParseEnd); - if (eStatus != rtl_math_ConversionStatus_Ok || nParseEnd < aString.getLength()) + rVal = ::rtl::math::stringToDouble( aBuf, dsep, gsep, &eStatus, &nParseEnd); + if (eStatus != rtl_math_ConversionStatus_Ok || nParseEnd < aBuf.getLength()) // Not a valid number or not entire string consumed. return false; diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 13ca11ed9333..dbe8f626fee0 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/sheet/ConditionOperator2.hpp> #include <sal/log.hxx> #include <osl/diagnose.h> +#include <o3tl/string_view.hxx> #include <svl/sharedstringpool.hxx> #include <oox/core/filterbase.hxx> #include <oox/helper/binaryinputstream.hxx> @@ -101,12 +102,12 @@ const sal_uInt16 BIFF12_CFRULE_ABOVEAVERAGE = 0x0004; const sal_uInt16 BIFF12_CFRULE_BOTTOM = 0x0008; const sal_uInt16 BIFF12_CFRULE_PERCENT = 0x0010; -bool isValue(const OUString& rStr, double& rVal) +bool isValue(std::u16string_view rStr, double& rVal) { sal_Int32 nEnd = -1; - rVal = rtl::math::stringToDouble(rStr.trim(), '.', ',', nullptr, &nEnd); + rVal = rtl::math::stringToDouble(o3tl::trim(rStr), '.', ',', nullptr, &nEnd); - return nEnd >= rStr.getLength(); + return nEnd >= static_cast<sal_Int32>(rStr.size()); } void SetCfvoData( ColorScaleRuleModelEntry* pEntry, const AttributeList& rAttribs ) |