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 /ucb | |
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 'ucb')
-rw-r--r-- | ucb/source/core/ucbcmds.cxx | 2 | ||||
-rw-r--r-- | ucb/source/core/ucbstore.cxx | 12 | ||||
-rw-r--r-- | ucb/source/ucp/ext/ucpext_provider.cxx | 2 | ||||
-rw-r--r-- | ucb/source/ucp/file/bc.cxx | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/ucb/source/core/ucbcmds.cxx b/ucb/source/core/ucbcmds.cxx index b0264080de00..8b95f48c0702 100644 --- a/ucb/source/core/ucbcmds.cxx +++ b/ucb/source/core/ucbcmds.cxx @@ -1501,7 +1501,7 @@ void globalTransfer_( 0, rContext.xEnv ); - static const OUStringLiteral cmdName(u"flush"); + static constexpr OUStringLiteral cmdName(u"flush"); if((aAny >>= xci) && xci->hasCommandByName(cmdName)) xcp->execute( ucb::Command( diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx index 1aae1235c0f0..a06e430c3586 100644 --- a/ucb/source/core/ucbstore.cxx +++ b/ucb/source/core/ucbstore.cxx @@ -1670,9 +1670,9 @@ Sequence< PropertyValue > SAL_CALL PersistentPropertySet::getPropertyValues() Sequence< PropertyValue > aValues( nCount ); auto pValues = aValues.getArray(); - static const OUStringLiteral aHandleName(u"/Handle"); - static const OUStringLiteral aValueName(u"/Value"); - static const OUStringLiteral aStateName(u"/State"); + static constexpr OUStringLiteral aHandleName(u"/Handle"); + static constexpr OUStringLiteral aValueName(u"/Value"); + static constexpr OUStringLiteral aStateName(u"/State"); for ( sal_Int32 n = 0; n < nCount; ++n ) { @@ -1981,9 +1981,9 @@ Sequence< Property > SAL_CALL PropertySetInfo_Impl::getProperties() if ( xHierNameAccess.is() ) { - static const OUStringLiteral aHandleName(u"/Handle"); - static const OUStringLiteral aValueName(u"/Value"); - static const OUStringLiteral aAttrName(u"/Attributes"); + static constexpr OUStringLiteral aHandleName(u"/Handle"); + static constexpr OUStringLiteral aValueName(u"/Value"); + static constexpr OUStringLiteral aAttrName(u"/Attributes"); Property* pProps = aPropSeq.getArray(); diff --git a/ucb/source/ucp/ext/ucpext_provider.cxx b/ucb/source/ucp/ext/ucpext_provider.cxx index faf96540675a..c35c54220fa3 100644 --- a/ucb/source/ucp/ext/ucpext_provider.cxx +++ b/ucb/source/ucp/ext/ucpext_provider.cxx @@ -93,7 +93,7 @@ namespace ucb::ucp::ext Reference< XContent > SAL_CALL ContentProvider::queryContent( const Reference< XContentIdentifier >& i_rIdentifier ) { // Check URL scheme... - static const OUStringLiteral sScheme( u"vnd.sun.star.extension" ); + static constexpr OUStringLiteral sScheme( u"vnd.sun.star.extension" ); if ( !i_rIdentifier->getContentProviderScheme().equalsIgnoreAsciiCase( sScheme ) ) throw IllegalIdentifierException(); diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx index 9b0618690331..c5e47c6b0b55 100644 --- a/ucb/source/ucp/file/bc.cxx +++ b/ucb/source/ucp/file/bc.cxx @@ -685,7 +685,7 @@ BaseContent::setPropertyValues( return Sequence< Any >( Values.getLength() ); } - static const OUStringLiteral Title(u"Title"); + static constexpr OUStringLiteral Title(u"Title"); // Special handling for files which have to be inserted if( m_nState & JustInserted ) |