diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-23 12:34:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-26 13:12:31 +0200 |
commit | 0193b284e880a659ab73160e42238e1d5fe5cf8f (patch) | |
tree | da09299838a6afb43d7c601803a6bab787489854 /xmloff/source/core | |
parent | 2ef138de767c312188d41a7f206234eafac3108b (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 'xmloff/source/core')
-rw-r--r-- | xmloff/source/core/SettingsExportHelper.cxx | 30 | ||||
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 4 |
2 files changed, 17 insertions, 17 deletions
diff --git a/xmloff/source/core/SettingsExportHelper.cxx b/xmloff/source/core/SettingsExportHelper.cxx index ad73fe9843d1..8cd0519918a5 100644 --- a/xmloff/source/core/SettingsExportHelper.cxx +++ b/xmloff/source/core/SettingsExportHelper.cxx @@ -287,16 +287,16 @@ void XMLSettingsExportHelper::exportSymbolDescriptors( { rtl::Reference< comphelper::IndexedPropertyValuesContainer > xBox = new comphelper::IndexedPropertyValuesContainer(); - static const OUStringLiteral sName ( u"Name" ); - static const OUStringLiteral sExportName ( u"ExportName" ); - static const OUStringLiteral sSymbolSet ( u"SymbolSet" ); - static const OUStringLiteral sCharacter ( u"Character" ); - static const OUStringLiteral sFontName ( u"FontName" ); - static const OUStringLiteral sCharSet ( u"CharSet" ); - static const OUStringLiteral sFamily ( u"Family" ); - static const OUStringLiteral sPitch ( u"Pitch" ); - static const OUStringLiteral sWeight ( u"Weight" ); - static const OUStringLiteral sItalic ( u"Italic" ); + static constexpr OUStringLiteral sName ( u"Name" ); + static constexpr OUStringLiteral sExportName ( u"ExportName" ); + static constexpr OUStringLiteral sSymbolSet ( u"SymbolSet" ); + static constexpr OUStringLiteral sCharacter ( u"Character" ); + static constexpr OUStringLiteral sFontName ( u"FontName" ); + static constexpr OUStringLiteral sCharSet ( u"CharSet" ); + static constexpr OUStringLiteral sFamily ( u"Family" ); + static constexpr OUStringLiteral sPitch ( u"Pitch" ); + static constexpr OUStringLiteral sWeight ( u"Weight" ); + static constexpr OUStringLiteral sItalic ( u"Italic" ); sal_Int32 nCount = rProps.getLength(); const formula::SymbolDescriptor *pDescriptor = rProps.getConstArray(); @@ -427,11 +427,11 @@ void XMLSettingsExportHelper::exportForbiddenCharacters( * xmloff/source/core/DocumentSettingsContext.cxx * XMLConfigItemMapIndexedContext::EndElement() */ - static const OUStringLiteral sLanguage ( u"Language" ); - static const OUStringLiteral sCountry ( u"Country" ); - static const OUStringLiteral sVariant ( u"Variant" ); - static const OUStringLiteral sBeginLine ( u"BeginLine" ); - static const OUStringLiteral sEndLine ( u"EndLine" ); + static constexpr OUStringLiteral sLanguage ( u"Language" ); + static constexpr OUStringLiteral sCountry ( u"Country" ); + static constexpr OUStringLiteral sVariant ( u"Variant" ); + static constexpr OUStringLiteral sBeginLine ( u"BeginLine" ); + static constexpr OUStringLiteral sEndLine ( u"EndLine" ); sal_Int32 nPos = 0; for( const auto& rLocale : aLocales ) diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 03277884ae0b..36e0a8454ebf 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -731,7 +731,7 @@ void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArgumen mpImpl->mStreamName = sName; // Note: may be empty (XSLT) // Written OpenDocument file format doesn't fit to the created text document (#i69627#) - static const OUStringLiteral sOutlineStyleAsNormalListStyle( + static constexpr OUStringLiteral sOutlineStyleAsNormalListStyle( u"OutlineStyleAsNormalListStyle" ); if( xPropertySetInfo->hasPropertyByName( sOutlineStyleAsNormalListStyle ) ) { @@ -743,7 +743,7 @@ void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArgumen if( xPropertySetInfo->hasPropertyByName( sTargetStorage ) ) mxExportInfo->getPropertyValue( sTargetStorage ) >>= mpImpl->mxTargetStorage; - static const OUStringLiteral sExportTextNumberElement( + static constexpr OUStringLiteral sExportTextNumberElement( u"ExportTextNumberElement" ); if( xPropertySetInfo->hasPropertyByName( sExportTextNumberElement ) ) { |