summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-06-14 11:38:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-06-14 19:16:38 +0200
commitd900f60fa9f0a1772069cbe6e2536311393bff6d (patch)
tree2f3ac8e7c868edf1330ecbbd26f60e864c292ec6 /i18npool
parent7b61cfc01fdac9f7162c674e888ccf129c2433b4 (diff)
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: I4aac81c9224971683cfc7c9085edc7dcd3ee5f10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153056 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx22
-rw-r--r--i18npool/source/localedata/localedata.cxx15
2 files changed, 18 insertions, 19 deletions
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index cab4f1f08ba5..a6e22bf8cedc 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -1957,7 +1957,7 @@ void LCCurrencyNode::generateCode (const OFileWriter &of) const
OUString useLocale = getAttr().getValueByName("ref");
if (!useLocale.isEmpty()) {
useLocale = useLocale.replace( '-', '_');
- of.writeRefFunction("getAllCurrencies_", useLocale);
+ of.writeOUStringRefFunction("getAllCurrencies_", useLocale);
return;
}
sal_Int16 nbOfCurrencies = 0;
@@ -1968,11 +1968,11 @@ void LCCurrencyNode::generateCode (const OFileWriter &of) const
for ( sal_Int32 i = 0; i < getNumberOfChildren(); i++,nbOfCurrencies++) {
LocaleNode * currencyNode = getChildAt (i);
str = currencyNode->getAttr().getValueByName("default");
- bool bDefault = of.writeDefaultParameter("Currency", str, nbOfCurrencies);
+ bool bDefault = of.writeOUStringLiteralDefaultParameter("Currency", str, nbOfCurrencies);
str = currencyNode->getAttr().getValueByName("usedInCompatibleFormatCodes");
- bool bCompatible = of.writeDefaultParameter("CurrencyUsedInCompatibleFormatCodes", str, nbOfCurrencies);
+ bool bCompatible = of.writeOUStringLiteralDefaultParameter("CurrencyUsedInCompatibleFormatCodes", str, nbOfCurrencies);
str = currencyNode->getAttr().getValueByName("legacyOnly");
- bool bLegacy = of.writeDefaultParameter("CurrencyLegacyOnly", str, nbOfCurrencies);
+ bool bLegacy = of.writeOUStringLiteralDefaultParameter("CurrencyLegacyOnly", str, nbOfCurrencies);
if (bLegacy && (bDefault || bCompatible))
incError( "Currency: if legacyOnly==true, both 'default' and 'usedInCompatibleFormatCodes' must be false.");
if (bDefault)
@@ -1988,12 +1988,12 @@ void LCCurrencyNode::generateCode (const OFileWriter &of) const
bTheCompatible = true;
}
str = currencyNode -> findNode ("CurrencyID") -> getValue();
- of.writeParameter("currencyID", str, nbOfCurrencies);
+ of.writeOUStringLiteralParameter("currencyID", str, nbOfCurrencies);
// CurrencyID MUST be ISO 4217.
if (!bLegacy && !isIso4217(str))
incError( "CurrencyID is not ISO 4217");
str = currencyNode -> findNode ("CurrencySymbol") -> getValue();
- of.writeParameter("currencySymbol", str, nbOfCurrencies);
+ of.writeOUStringLiteralParameter("currencySymbol", str, nbOfCurrencies);
// Check if this currency really is the one used in number format
// codes. In case of ref=... mechanisms it may be that TheCurrency
// couldn't had been determined from the current locale (i.e. is
@@ -2001,16 +2001,16 @@ void LCCurrencyNode::generateCode (const OFileWriter &of) const
if (bCompatible && !sTheCompatibleCurrency.isEmpty() && sTheCompatibleCurrency != str)
incErrorStrStr( "Error: CurrencySymbol \"%s\" flagged as usedInCompatibleFormatCodes doesn't match \"%s\" determined from format codes.\n", str, sTheCompatibleCurrency);
str = currencyNode -> findNode ("BankSymbol") -> getValue();
- of.writeParameter("bankSymbol", str, nbOfCurrencies);
+ of.writeOUStringLiteralParameter("bankSymbol", str, nbOfCurrencies);
// BankSymbol currently must be ISO 4217. May change later if
// application always uses CurrencyID instead of BankSymbol.
if (!bLegacy && !isIso4217(str))
incError( "BankSymbol is not ISO 4217");
str = currencyNode -> findNode ("CurrencyName") -> getValue();
- of.writeParameter("currencyName", str, nbOfCurrencies);
+ of.writeOUStringLiteralParameter("currencyName", str, nbOfCurrencies);
str = currencyNode -> findNode ("DecimalPlaces") -> getValue();
sal_Int16 nDecimalPlaces = static_cast<sal_Int16>(str.toInt32());
- of.writeIntParameter("currencyDecimalPlaces", nbOfCurrencies, nDecimalPlaces);
+ of.writeOUStringLiteralIntParameter("currencyDecimalPlaces", nbOfCurrencies, nDecimalPlaces);
of.writeAsciiString("\n");
};
@@ -2022,7 +2022,7 @@ void LCCurrencyNode::generateCode (const OFileWriter &of) const
of.writeAsciiString("static const sal_Int16 currencyCount = ");
of.writeInt(nbOfCurrencies);
of.writeAsciiString(";\n\n");
- of.writeAsciiString("static const sal_Unicode* currencies[] = {\n");
+ of.writeAsciiString("static constexpr rtl::OUStringConstExpr currencies[] = {\n");
for(sal_Int16 i = 0; i < nbOfCurrencies; i++) {
of.writeAsciiString("\tcurrencyID");
of.writeInt(i);
@@ -2050,7 +2050,7 @@ void LCCurrencyNode::generateCode (const OFileWriter &of) const
of.writeAsciiString(",\n");
}
of.writeAsciiString("};\n\n");
- of.writeFunction("getAllCurrencies_", "currencyCount", "currencies");
+ of.writeOUStringFunction("getAllCurrencies_", "currencyCount", "currencies");
}
void LCTransliterationNode::generateCode (const OFileWriter &of) const
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index ccc4ba51d74c..8e10d2e5cf19 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -786,26 +786,25 @@ LocaleDataImpl::getAllCalendars( const Locale& rLocale )
Sequence< Currency2 > SAL_CALL
LocaleDataImpl::getAllCurrencies2( const Locale& rLocale )
{
- MyFunc_Type func = reinterpret_cast<MyFunc_Type>(getFunctionSymbol( rLocale, "getAllCurrencies" ));
+ MyFuncOUString_Type func = reinterpret_cast<MyFuncOUString_Type>(getFunctionSymbol( rLocale, "getAllCurrencies" ));
if ( func ) {
sal_Int16 currencyCount = 0;
- sal_Unicode **allCurrencies = func(currencyCount);
+ OUString const *allCurrencies = func(currencyCount);
Sequence< Currency2 > seq(currencyCount);
auto seqRange = asNonConstRange(seq);
for(int i = 0, nOff = 0; i < currencyCount; i++, nOff += 8 ) {
- Currency2 cur(
- OUString(allCurrencies[nOff]), // string ID
- OUString(allCurrencies[nOff+1]), // string Symbol
- OUString(allCurrencies[nOff+2]), // string BankSymbol
- OUString(allCurrencies[nOff+3]), // string Name
+ seqRange[i] = Currency2(
+ allCurrencies[nOff], // string ID
+ allCurrencies[nOff+1], // string Symbol
+ allCurrencies[nOff+2], // string BankSymbol
+ allCurrencies[nOff+3], // string Name
allCurrencies[nOff+4][0] != 0, // boolean Default
allCurrencies[nOff+5][0] != 0, // boolean UsedInCompatibleFormatCodes
allCurrencies[nOff+6][0], // short DecimalPlaces
allCurrencies[nOff+7][0] != 0 // boolean LegacyOnly
);
- seqRange[i] = cur;
}
return seq;
}