summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-06-23 12:34:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-06-26 13:12:31 +0200
commit0193b284e880a659ab73160e42238e1d5fe5cf8f (patch)
treeda09299838a6afb43d7c601803a6bab787489854 /i18npool
parent2ef138de767c312188d41a7f206234eafac3108b (diff)
new loplugin:constexprliteral
OUStringLiteral should be declared constexpr, to enforce that it is initialised at compile-time and not runtime. This seems to make a different at least on Visual Studio Change-Id: I1698f5fa22ddb480347c2f4d444530c2e0e88d92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153499 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/breakiterator/breakiteratorImpl.cxx2
-rw-r--r--i18npool/source/collator/chaptercollator.cxx2
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx10
3 files changed, 7 insertions, 7 deletions
diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx
index 5402caa7a469..2b56d2726303 100644
--- a/i18npool/source/breakiterator/breakiteratorImpl.cxx
+++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx
@@ -623,7 +623,7 @@ BreakIteratorImpl::getLocaleSpecificBreakIterator(const Locale& rLocale)
}
}
- OUStringLiteral under(u"_");
+ static constexpr OUStringLiteral under(u"_");
sal_Int32 l = rLocale.Language.getLength();
sal_Int32 c = rLocale.Country.getLength();
diff --git a/i18npool/source/collator/chaptercollator.cxx b/i18npool/source/collator/chaptercollator.cxx
index 729045ac59e0..06e2fcbc04cb 100644
--- a/i18npool/source/collator/chaptercollator.cxx
+++ b/i18npool/source/collator/chaptercollator.cxx
@@ -61,7 +61,7 @@ ChapterCollator::compareSubstring( const OUString& str1, sal_Int32 off1, sal_Int
if( ans != 0 )
return ans;
- static const OUStringLiteral aAddAllowed(u"?");
+ static constexpr OUStringLiteral aAddAllowed(u"?");
ParseResult res1, res2;
// since parseAnyToken does not take length as parameter, we have to copy
// it to a temp. string.
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 7bc4da873138..fa63ac0dc5c8 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -1837,35 +1837,35 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
of.writeInt(nbOfCalendars);
of.writeAsciiString(";\n\n");
- of.writeAsciiString("static const OUStringLiteral nbOfDays = u\"");
+ of.writeAsciiString("static constexpr OUStringLiteral nbOfDays = u\"");
for(i = 0; i < nbOfCalendars; i++) {
of.writeAsciiString("\\x");
of.writeHexInt(nbOfDays[i]);
}
of.writeAsciiString("\";\n");
- of.writeAsciiString("static const OUStringLiteral nbOfMonths = u\"");
+ of.writeAsciiString("static constexpr OUStringLiteral nbOfMonths = u\"");
for(i = 0; i < nbOfCalendars; i++) {
of.writeAsciiString("\\x");
of.writeHexInt(nbOfMonths[i]);
}
of.writeAsciiString("\";\n");
- of.writeAsciiString("static const OUStringLiteral nbOfGenitiveMonths = u\"");
+ of.writeAsciiString("static constexpr OUStringLiteral nbOfGenitiveMonths = u\"");
for(i = 0; i < nbOfCalendars; i++) {
of.writeAsciiString("\\x");
of.writeHexInt(nbOfGenitiveMonths[i]);
}
of.writeAsciiString("\";\n");
- of.writeAsciiString("static const OUStringLiteral nbOfPartitiveMonths = u\"");
+ of.writeAsciiString("static constexpr OUStringLiteral nbOfPartitiveMonths = u\"");
for(i = 0; i < nbOfCalendars; i++) {
of.writeAsciiString("\\x");
of.writeHexInt(nbOfPartitiveMonths[i]);
}
of.writeAsciiString("\";\n");
- of.writeAsciiString("static const OUStringLiteral nbOfEras = u\"");
+ of.writeAsciiString("static constexpr OUStringLiteral nbOfEras = u\"");
for(i = 0; i < nbOfCalendars; i++) {
of.writeAsciiString("\\x");
of.writeHexInt(nbOfEras[i]);