diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-29 11:06:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-01 08:30:18 +0200 |
commit | 5200a73627d13e2997f81b53f61e143e77e328ee (patch) | |
tree | f95c8346d061ecd0ad33d574895d18e169662785 /basic/source/runtime/methods.cxx | |
parent | b90d3d316dd9c720c83180b31f6bbd7003fead78 (diff) |
use more string_view in various
found by examining uses of OUString::copy() for likely places
Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source/runtime/methods.cxx')
-rw-r--r-- | basic/source/runtime/methods.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 972038744dae..8cc49c2a5024 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -1911,7 +1911,7 @@ void SbRtl_CDateFromIso(StarBASIC *, SbxArray & rPar, bool) break; bool bUseTwoDigitYear = false; - OUString aYearStr, aMonthStr, aDayStr; + std::u16string_view aYearStr, aMonthStr, aDayStr; if (nLen == 6 || nLen == 8 || nLen == 9) { // ((Y)YY)YYMMDD @@ -1921,9 +1921,9 @@ void SbRtl_CDateFromIso(StarBASIC *, SbxArray & rPar, bool) const sal_Int32 nMonthPos = (nLen == 8 ? 4 : (nLen == 6 ? 2 : 5)); if (nMonthPos == 2) bUseTwoDigitYear = true; - aYearStr = aStr.copy( 0, nMonthPos ); - aMonthStr = aStr.copy( nMonthPos, 2 ); - aDayStr = aStr.copy( nMonthPos + 2, 2 ); + aYearStr = aStr.subView( 0, nMonthPos ); + aMonthStr = aStr.subView( nMonthPos, 2 ); + aDayStr = aStr.subView( nMonthPos + 2, 2 ); } else { @@ -1934,9 +1934,9 @@ void SbRtl_CDateFromIso(StarBASIC *, SbxArray & rPar, bool) if (aStr.indexOf('-', nMonthSep + 1) != nMonthSep + 3) break; - aYearStr = aStr.copy( 0, nMonthSep ); - aMonthStr = aStr.copy( nMonthSep + 1, 2 ); - aDayStr = aStr.copy( nMonthSep + 4, 2 ); + aYearStr = aStr.subView( 0, nMonthSep ); + aMonthStr = aStr.subView( nMonthSep + 1, 2 ); + aDayStr = aStr.subView( nMonthSep + 4, 2 ); if ( !comphelper::string::isdigitAsciiString(aYearStr) || !comphelper::string::isdigitAsciiString(aMonthStr) || !comphelper::string::isdigitAsciiString(aDayStr)) @@ -1944,8 +1944,8 @@ void SbRtl_CDateFromIso(StarBASIC *, SbxArray & rPar, bool) } double dDate; - if (!implDateSerial( static_cast<sal_Int16>(nSign * aYearStr.toInt32()), - static_cast<sal_Int16>(aMonthStr.toInt32()), static_cast<sal_Int16>(aDayStr.toInt32()), + if (!implDateSerial( static_cast<sal_Int16>(nSign * o3tl::toInt32(aYearStr)), + static_cast<sal_Int16>(o3tl::toInt32(aMonthStr)), static_cast<sal_Int16>(o3tl::toInt32(aDayStr)), bUseTwoDigitYear, SbDateCorrection::None, dDate )) break; |