From f210fd9645258bac88a5fd1c0ffcf11ee428733b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 14 Jun 2023 11:57:27 +0200 Subject: speed up startup time by avoid conversion of static locale data from sal_Unicode to OUString data - we can declare the data as OUStringConstExpr arrays and then no conversion is necessary. Change-Id: Ia8186b2e6540287eae1312bf9755d5e6bea359c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153057 Tested-by: Jenkins Reviewed-by: Noel Grandin --- i18npool/source/localedata/LocaleNode.cxx | 8 ++++---- i18npool/source/localedata/localedata.cxx | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'i18npool') diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index a6e22bf8cedc..e0cac2020d4c 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -618,7 +618,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const { case 0: of.writeOUStringRefFunction("getAllFormats0_", useLocale, "replaceTo0"); - of.writeRefFunction("getDateAcceptancePatterns_", useLocale); + of.writeOUStringRefFunction("getDateAcceptancePatterns_", useLocale); break; case 1: of.writeOUStringRefFunction("getAllFormats1_", useLocale, "replaceTo1"); @@ -1288,14 +1288,14 @@ void LCFormatNode::generateCode (const OFileWriter &of) const for (sal_Int16 i = 0; i < nbOfDateAcceptancePatterns; ++i) { - of.writeParameter("DateAcceptancePattern", theDateAcceptancePatterns[i], i); + of.writeOUStringLiteralParameter("DateAcceptancePattern", theDateAcceptancePatterns[i], i); } of.writeAsciiString("static const sal_Int16 DateAcceptancePatternsCount = "); of.writeInt( nbOfDateAcceptancePatterns); of.writeAsciiString(";\n"); - of.writeAsciiString("static const sal_Unicode* DateAcceptancePatternsArray[] = {\n"); + of.writeAsciiString("static constexpr rtl::OUStringConstExpr DateAcceptancePatternsArray[] = {\n"); for (sal_Int16 i = 0; i < nbOfDateAcceptancePatterns; ++i) { of.writeAsciiString("\t"); @@ -1305,7 +1305,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const } of.writeAsciiString("};\n\n"); - of.writeFunction("getDateAcceptancePatterns_", "DateAcceptancePatternsCount", "DateAcceptancePatternsArray"); + of.writeOUStringFunction("getDateAcceptancePatterns_", "DateAcceptancePatternsCount", "DateAcceptancePatternsArray"); } ++mnSection; diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 8e10d2e5cf19..12149ca14ff7 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -875,17 +875,17 @@ LocaleDataImpl::getAllFormats( const Locale& rLocale ) Sequence< OUString > SAL_CALL LocaleDataImpl::getDateAcceptancePatterns( const Locale& rLocale ) { - MyFunc_Type func = reinterpret_cast(getFunctionSymbol( rLocale, "getDateAcceptancePatterns" )); + MyFuncOUString_Type func = reinterpret_cast(getFunctionSymbol( rLocale, "getDateAcceptancePatterns" )); if (func) { sal_Int16 patternsCount = 0; - sal_Unicode **patternsArray = func( patternsCount ); + OUString const *patternsArray = func( patternsCount ); Sequence< OUString > seq( patternsCount ); auto seqRange = asNonConstRange(seq); for (sal_Int16 i = 0; i < patternsCount; ++i) { - seqRange[i] = OUString( patternsArray[i] ); + seqRange[i] = patternsArray[i]; } return seq; } -- cgit