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 /connectivity | |
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 'connectivity')
6 files changed, 10 insertions, 10 deletions
diff --git a/connectivity/qa/connectivity/ado/DriverTest.cxx b/connectivity/qa/connectivity/ado/DriverTest.cxx index abe4da67b012..a737387fe010 100644 --- a/connectivity/qa/connectivity/ado/DriverTest.cxx +++ b/connectivity/qa/connectivity/ado/DriverTest.cxx @@ -93,8 +93,8 @@ void AdoDriverTest::test_metadata() } const Any catalog; - static const OUStringLiteral schemaPattern = u"%"; - static const OUStringLiteral tableNamePattern = u"%"; + static constexpr OUStringLiteral schemaPattern = u"%"; + static constexpr OUStringLiteral tableNamePattern = u"%"; const Sequence< OUString > types; Reference< XResultSet > xResultSet = @@ -107,7 +107,7 @@ void AdoDriverTest::test_metadata() void AdoDriverTest::test_select_default_all() { - static const OUStringLiteral sql = u"select \"FirstName\" from \"Students\" ORDER BY \"FirstName\""; + static constexpr OUStringLiteral sql = u"select \"FirstName\" from \"Students\" ORDER BY \"FirstName\""; Reference< XPreparedStatement > xStatement = m_xConnection->prepareStatement(sql); if (!xStatement.is()) { diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index b6ab062c94dc..1e66826e80b6 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -389,7 +389,7 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet, // build a connection with its current settings (4. data source name, or 5. URL) - static const OUStringLiteral sUserProp( u"User" ); + static constexpr OUStringLiteral sUserProp( u"User" ); OUString sDataSourceName; xRowSetProps->getPropertyValue("DataSourceName") >>= sDataSourceName; OUString sURL; diff --git a/connectivity/source/commontools/formattedcolumnvalue.cxx b/connectivity/source/commontools/formattedcolumnvalue.cxx index b13637a97a67..621bc9acf59b 100644 --- a/connectivity/source/commontools/formattedcolumnvalue.cxx +++ b/connectivity/source/commontools/formattedcolumnvalue.cxx @@ -147,7 +147,7 @@ namespace dbtools // get the format key of our bound field Reference< XPropertySetInfo > xPSI( _rxColumn->getPropertySetInfo(), UNO_SET_THROW ); bool bHaveFieldFormat = false; - static const OUStringLiteral sFormatKeyProperty( u"FormatKey" ); + static constexpr OUStringLiteral sFormatKeyProperty( u"FormatKey" ); if ( xPSI->hasPropertyByName( sFormatKeyProperty ) ) { bHaveFieldFormat = ( _rxColumn->getPropertyValue( sFormatKeyProperty ) >>= _rData.m_nFormatKey ); diff --git a/connectivity/source/commontools/statementcomposer.cxx b/connectivity/source/commontools/statementcomposer.cxx index eb199c50641d..c7113b2f179f 100644 --- a/connectivity/source/commontools/statementcomposer.cxx +++ b/connectivity/source/commontools/statementcomposer.cxx @@ -166,7 +166,7 @@ namespace dbtools xComposer->setElementaryQuery( sStatement ); // the sort order - static const OUStringLiteral sPropOrder( u"Order" ); + static constexpr OUStringLiteral sPropOrder( u"Order" ); if ( ::comphelper::hasProperty( sPropOrder, xQuery ) ) { OUString sOrder; @@ -176,7 +176,7 @@ namespace dbtools // the filter bool bApplyFilter = true; - static const OUStringLiteral sPropApply( u"ApplyFilter" ); + static constexpr OUStringLiteral sPropApply( u"ApplyFilter" ); if ( ::comphelper::hasProperty( sPropApply, xQuery ) ) { OSL_VERIFY( xQuery->getPropertyValue( sPropApply ) >>= bApplyFilter ); diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx index 4589a636d951..4585629a877c 100644 --- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx @@ -1074,7 +1074,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( // check if any type is given // when no types are given then we have to return all tables e.g. TABLE - static const OUStringLiteral aTable(u"TABLE"); + static constexpr OUStringLiteral aTable(u"TABLE"); bool bTableFound = true; sal_Int32 nLength = types.getLength(); diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index 200d9f4bd3fe..5b69086b3934 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -243,7 +243,7 @@ namespace connectivity OUString sMessage; try { - static const OUStringLiteral sProperties( u"properties" ); + static constexpr OUStringLiteral sProperties( u"properties" ); if ( !bIsNewDatabase && xStorage->isStreamElement(sProperties) ) { Reference<XStream > xStream = xStorage->openStreamElement(sProperties,ElementModes::READ); @@ -297,7 +297,7 @@ namespace connectivity // // hsqldb 2.6.0 release notes have: added system role SCRIPT_OPS for export / import of database structure and data // which seems to provide a builtin way to do this with contemporary hsqldb - static const OUStringLiteral sScript(u"script"); + static constexpr OUStringLiteral sScript(u"script"); if (!bIsNewDatabase && xStorage->isStreamElement(sScript)) { Reference<XStream > xStream = xStorage->openStreamElement(sScript, ElementModes::READ); |