diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2024-09-29 12:19:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-09-29 18:31:30 +0200 |
commit | a8cc5deeb1d5f10120a9207018808ef712844890 (patch) | |
tree | bd8772938c3dde6bd923d7ea12b2903fba15a41c | |
parent | 9e5321f46d175e827924a8040f6325cdcd7d751f (diff) |
avoid temporary OUString in lcl_getSingleCellAddressFromXMLString
Change-Id: I3ec79a4ae0259babb8aa472c338cc78910abc800
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174181
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | chart2/source/tools/XMLRangeHelper.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/unocore/XMLRangeHelper.cxx | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/chart2/source/tools/XMLRangeHelper.cxx b/chart2/source/tools/XMLRangeHelper.cxx index 196a0396542a..1a7e789d3098 100644 --- a/chart2/source/tools/XMLRangeHelper.cxx +++ b/chart2/source/tools/XMLRangeHelper.cxx @@ -112,15 +112,15 @@ void lcl_getSingleCellAddressFromXMLString( static const sal_Unicode aDollar( '$' ); static const sal_Unicode aLetterA( 'A' ); - OUString aCellStr = OUString(rXMLString.substr( nStartPos, nEndPos - nStartPos + 1 )).toAsciiUpperCase(); - const sal_Unicode* pStrArray = aCellStr.getStr(); - sal_Int32 nLength = aCellStr.getLength(); + std::u16string_view aCellStr = rXMLString.substr( nStartPos, nEndPos - nStartPos + 1 ); + const sal_Unicode* pStrArray = aCellStr.data(); + sal_Int32 nLength = aCellStr.size(); sal_Int32 i = nLength - 1, nColumn = 0; // parse number for row while( rtl::isAsciiDigit( pStrArray[ i ] ) && i >= 0 ) i--; - rOutCell.nRow = (o3tl::toInt32(aCellStr.subView( i + 1 ))) - 1; + rOutCell.nRow = (o3tl::toInt32(aCellStr.substr( i + 1 ))) - 1; // a dollar in XML means absolute (whereas in UI it means relative) if( pStrArray[ i ] == aDollar ) { @@ -134,7 +134,7 @@ void lcl_getSingleCellAddressFromXMLString( sal_Int32 nPower = 1; while( rtl::isAsciiAlpha( pStrArray[ i ] )) { - nColumn += (pStrArray[ i ] - aLetterA + 1) * nPower; + nColumn += (rtl::toAsciiUpperCase(pStrArray[ i ]) - aLetterA + 1) * nPower; i--; nPower *= 26; } diff --git a/sw/source/core/unocore/XMLRangeHelper.cxx b/sw/source/core/unocore/XMLRangeHelper.cxx index ad2d56bd19d5..037fe76d2dbe 100644 --- a/sw/source/core/unocore/XMLRangeHelper.cxx +++ b/sw/source/core/unocore/XMLRangeHelper.cxx @@ -110,15 +110,15 @@ void lcl_getSingleCellAddressFromXMLString( static const sal_Unicode aDollar( '$' ); static const sal_Unicode aLetterA( 'A' ); - OUString aCellStr = OUString(rXMLString.substr( nStartPos, nEndPos - nStartPos + 1 )).toAsciiUpperCase(); - const sal_Unicode* pStrArray = aCellStr.getStr(); - sal_Int32 nLength = aCellStr.getLength(); + std::u16string_view aCellStr = rXMLString.substr( nStartPos, nEndPos - nStartPos + 1 ); + const sal_Unicode* pStrArray = aCellStr.data(); + sal_Int32 nLength = aCellStr.size(); sal_Int32 i = nLength - 1, nColumn = 0; // parse number for row while( rtl::isAsciiDigit( pStrArray[ i ] ) && i >= 0 ) i--; - rOutCell.nRow = (o3tl::toInt32(aCellStr.subView( i + 1 ))) - 1; + rOutCell.nRow = (o3tl::toInt32(aCellStr.substr( i + 1 ))) - 1; // a dollar in XML means absolute (whereas in UI it means relative) if( pStrArray[ i ] == aDollar ) { @@ -133,7 +133,7 @@ void lcl_getSingleCellAddressFromXMLString( sal_Int32 nPower = 1; while( i >= 0 && rtl::isAsciiAlpha( pStrArray[ i ] )) { - nColumn += (pStrArray[ i ] - aLetterA + 1) * nPower; + nColumn += (rtl::toAsciiUpperCase(pStrArray[ i ]) - aLetterA + 1) * nPower; i--; nPower *= 26; } |