sc/source/core/tool/interpr2.cxx | 58 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-)
New commits: commit 15912d7d6026018db81c53dfcbf9cfbdee1e3afe Author: Mike Kaganski <[email protected]> AuthorDate: Sun Nov 2 23:04:43 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Nov 3 05:44:16 2025 +0100 Use UTF-16 literals instead of UTF-6 byte sequences Change-Id: Ibb1d6220c2d5aa758b095ee5caed797452741b09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193305 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 8edd187df9e8..0a3acc6e4d2f 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -3375,39 +3375,39 @@ void ScInterpreter::ScEuroConvert() } // BAHTTEXT -#define UTF8_TH_0 "ศูนย์" -#define UTF8_TH_1 "หนึ่ง" -#define UTF8_TH_2 "สอง" -#define UTF8_TH_3 "สาม" -#define UTF8_TH_4 "สี่" -#define UTF8_TH_5 "ห้า" -#define UTF8_TH_6 "หก" -#define UTF8_TH_7 "เจ็ด" -#define UTF8_TH_8 "แปด" -#define UTF8_TH_9 "เก้า" -#define UTF8_TH_10 "สิบ" -#define UTF8_TH_11 "เอ็ด" -#define UTF8_TH_20 "ยี่" -#define UTF8_TH_1E2 "ร้อย" -#define UTF8_TH_1E3 "พัน" -#define UTF8_TH_1E4 "หมื่น" -#define UTF8_TH_1E5 "แสน" -#define UTF8_TH_1E6 "ล้าน" -#define UTF8_TH_DOT0 "ถ้วน" -#define UTF8_TH_BAHT "บาท" -#define UTF8_TH_SATANG "สตางค์" -#define UTF8_TH_MINUS "ลบ" - // local functions namespace { +constexpr std::u16string_view UTF8_TH_0 = u"ศูนย์"; +constexpr std::u16string_view UTF8_TH_1 = u"หนึ่ง"; +constexpr std::u16string_view UTF8_TH_2 = u"สอง"; +constexpr std::u16string_view UTF8_TH_3 = u"สาม"; +constexpr std::u16string_view UTF8_TH_4 = u"สี่"; +constexpr std::u16string_view UTF8_TH_5 = u"ห้า"; +constexpr std::u16string_view UTF8_TH_6 = u"หก"; +constexpr std::u16string_view UTF8_TH_7 = u"เจ็ด"; +constexpr std::u16string_view UTF8_TH_8 = u"แปด"; +constexpr std::u16string_view UTF8_TH_9 = u"เก้า"; +constexpr std::u16string_view UTF8_TH_10 = u"สิบ"; +constexpr std::u16string_view UTF8_TH_11 = u"เอ็ด"; +constexpr std::u16string_view UTF8_TH_20 = u"ยี่"; +constexpr std::u16string_view UTF8_TH_1E2 = u"ร้อย"; +constexpr std::u16string_view UTF8_TH_1E3 = u"พัน"; +constexpr std::u16string_view UTF8_TH_1E4 = u"หมื่น"; +constexpr std::u16string_view UTF8_TH_1E5 = u"แสน"; +constexpr std::u16string_view UTF8_TH_1E6 = u"ล้าน"; +constexpr std::u16string_view UTF8_TH_DOT0 = u"ถ้วน"; +constexpr std::u16string_view UTF8_TH_BAHT = u"บาท"; +constexpr std::u16string_view UTF8_TH_SATANG = u"สตางค์"; +constexpr std::u16string_view UTF8_TH_MINUS = u"ลบ"; + void lclSplitBlock( double& rfInt, sal_Int32& rnBlock, double fValue, double fSize ) { rnBlock = static_cast< sal_Int32 >( modf( (fValue + 0.1) / fSize, &rfInt ) * fSize + 0.1 ); } /** Appends a digit (0 to 9) to the passed string. */ -void lclAppendDigit( OStringBuffer& rText, sal_Int32 nDigit ) +void lclAppendDigit( OUStringBuffer& rText, sal_Int32 nDigit ) { switch( nDigit ) { @@ -3429,7 +3429,7 @@ void lclAppendDigit( OStringBuffer& rText, sal_Int32 nDigit ) @param nDigit A digit in the range from 1 to 9. @param nPow10 A value in the range from 2 to 5. */ -void lclAppendPow10( OStringBuffer& rText, sal_Int32 nDigit, sal_Int32 nPow10 ) +void lclAppendPow10( OUStringBuffer& rText, sal_Int32 nDigit, sal_Int32 nPow10 ) { OSL_ENSURE( (1 <= nDigit) && (nDigit <= 9), "lclAppendPow10 - illegal digit" ); lclAppendDigit( rText, nDigit ); @@ -3444,7 +3444,7 @@ void lclAppendPow10( OStringBuffer& rText, sal_Int32 nDigit, sal_Int32 nPow10 ) } /** Appends a block of 6 digits (value from 1 to 999,999) to the passed string. */ -void lclAppendBlock( OStringBuffer& rText, sal_Int32 nValue ) +void lclAppendBlock( OUStringBuffer& rText, sal_Int32 nValue ) { OSL_ENSURE( (1 <= nValue) && (nValue <= 999999), "lclAppendBlock - illegal value" ); if( nValue >= 100000 ) @@ -3513,7 +3513,7 @@ void ScInterpreter::ScBahtText() sal_Int32 nSatang = 0; lclSplitBlock( fBaht, nSatang, fValue, 100.0 ); - OStringBuffer aText; + OUStringBuffer aText; // generate text for Baht value if( fBaht == 0.0 ) @@ -3523,7 +3523,7 @@ void ScInterpreter::ScBahtText() } else while( fBaht > 0.0 ) { - OStringBuffer aBlock; + OUStringBuffer aBlock; sal_Int32 nBlock = 0; lclSplitBlock( fBaht, nBlock, fBaht, 1.0e6 ); if( nBlock > 0 ) @@ -3552,7 +3552,7 @@ void ScInterpreter::ScBahtText() if( bMinus ) aText.insert( 0, UTF8_TH_MINUS ); - PushString( OStringToOUString(aText, RTL_TEXTENCODING_UTF8) ); + PushString(aText.makeStringAndClear()); } void ScInterpreter::ScGetPivotData()
