From ac396f2f6b058ddff8c394443669b8c5d8b97b71 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 8 Jan 2021 19:54:55 +0000 Subject: fix coverity parse errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3a1179947704452e3ffec02be59d0f7bf0b75ab0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109017 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- connectivity/source/commontools/conncleanup.cxx | 2 +- connectivity/source/commontools/dbtools.cxx | 30 +++++++++++----------- connectivity/source/commontools/dbtools2.cxx | 2 +- connectivity/source/cpool/ZConnectionPool.cxx | 2 +- .../source/drivers/evoab2/NResultSetMetaData.cxx | 2 +- .../source/drivers/file/FDatabaseMetaData.cxx | 2 +- connectivity/source/drivers/firebird/Driver.cxx | 8 +++--- connectivity/source/drivers/jdbc/JConnection.cxx | 2 +- .../source/drivers/macab/MacabDatabaseMetaData.cxx | 4 +-- .../drivers/macab/MacabResultSetMetaData.cxx | 2 +- .../drivers/odbc/ODatabaseMetaDataResultSet.cxx | 4 +-- connectivity/source/parse/sqliterator.cxx | 2 +- 12 files changed, 31 insertions(+), 31 deletions(-) (limited to 'connectivity') diff --git a/connectivity/source/commontools/conncleanup.cxx b/connectivity/source/commontools/conncleanup.cxx index f1d80581ff5a..210c618d6a60 100644 --- a/connectivity/source/commontools/conncleanup.cxx +++ b/connectivity/source/commontools/conncleanup.cxx @@ -35,7 +35,7 @@ namespace dbtools using namespace css::sdbc; using namespace css::lang; - const OUStringLiteral ACTIVE_CONNECTION_PROPERTY_NAME = u"ActiveConnection"; + constexpr OUStringLiteral ACTIVE_CONNECTION_PROPERTY_NAME = u"ActiveConnection"; OAutoConnectionDisposer::OAutoConnectionDisposer(const Reference< XRowSet >& _rxRowSet, const Reference< XConnection >& _rxConnection) :m_xRowSet( _rxRowSet ) diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index f96e66e62c7e..cd9f2c9fc48f 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -917,7 +917,7 @@ Reference< XNumberFormatsSupplier> getNumberFormats( // ask the parent of the connection (should be a DatabaseAccess) Reference< XNumberFormatsSupplier> xReturn; Reference< XChild> xConnAsChild(_rxConn, UNO_QUERY); - static const OUStringLiteral sPropFormatsSupplier( u"NumberFormatsSupplier" ); + static constexpr OUStringLiteral sPropFormatsSupplier( u"NumberFormatsSupplier" ); if (xConnAsChild.is()) { Reference< XPropertySet> xConnParentProps(xConnAsChild->getParent(), UNO_QUERY); @@ -952,20 +952,20 @@ try Property* pNewProps = aNewProperties.getArray(); - static const OUStringLiteral sPropFormatsSupplier(u"FormatsSupplier"); - static const OUStringLiteral sPropCurrencySymbol(u"CurrencySymbol"); - static const OUStringLiteral sPropDecimals(u"Decimals"); - static const OUStringLiteral sPropEffectiveMin(u"EffectiveMin"); - static const OUStringLiteral sPropEffectiveMax(u"EffectiveMax"); - static const OUStringLiteral sPropEffectiveDefault(u"EffectiveDefault"); - static const OUStringLiteral sPropDefaultText(u"DefaultText"); - static const OUStringLiteral sPropDefaultDate(u"DefaultDate"); - static const OUStringLiteral sPropDefaultTime(u"DefaultTime"); - static const OUStringLiteral sPropValueMin(u"ValueMin"); - static const OUStringLiteral sPropValueMax(u"ValueMax"); - static const OUStringLiteral sPropDecimalAccuracy(u"DecimalAccuracy"); - static const OUStringLiteral sPropClassId(u"ClassId"); - static const OUStringLiteral sFormattedServiceName( u"com.sun.star.form.component.FormattedField" ); + static constexpr OUStringLiteral sPropFormatsSupplier(u"FormatsSupplier"); + static constexpr OUStringLiteral sPropCurrencySymbol(u"CurrencySymbol"); + static constexpr OUStringLiteral sPropDecimals(u"Decimals"); + static constexpr OUStringLiteral sPropEffectiveMin(u"EffectiveMin"); + static constexpr OUStringLiteral sPropEffectiveMax(u"EffectiveMax"); + static constexpr OUStringLiteral sPropEffectiveDefault(u"EffectiveDefault"); + static constexpr OUStringLiteral sPropDefaultText(u"DefaultText"); + static constexpr OUStringLiteral sPropDefaultDate(u"DefaultDate"); + static constexpr OUStringLiteral sPropDefaultTime(u"DefaultTime"); + static constexpr OUStringLiteral sPropValueMin(u"ValueMin"); + static constexpr OUStringLiteral sPropValueMax(u"ValueMax"); + static constexpr OUStringLiteral sPropDecimalAccuracy(u"DecimalAccuracy"); + static constexpr OUStringLiteral sPropClassId(u"ClassId"); + static constexpr OUStringLiteral sFormattedServiceName( u"com.sun.star.form.component.FormattedField" ); for (const Property& rOldProp : aOldProperties) { diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index a57ca9749770..01cdcc03aa76 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -1014,7 +1014,7 @@ bool isAggregateColumn( const Reference< XPropertySet > &_xColumn ) { bool bAgg(false); - static const OUStringLiteral sAgg = u"AggregateFunction"; + static constexpr OUStringLiteral sAgg = u"AggregateFunction"; if ( _xColumn->getPropertySetInfo()->hasPropertyByName(sAgg) ) _xColumn->getPropertyValue(sAgg) >>= bAgg; diff --git a/connectivity/source/cpool/ZConnectionPool.cxx b/connectivity/source/cpool/ZConnectionPool.cxx index c0b034814deb..2917ce019700 100644 --- a/connectivity/source/cpool/ZConnectionPool.cxx +++ b/connectivity/source/cpool/ZConnectionPool.cxx @@ -41,7 +41,7 @@ void SAL_CALL OPoolTimer::onShot() m_pPool->invalidatePooledConnections(); } -const OUStringLiteral TIMEOUT_NODENAME = u"Timeout"; +constexpr OUStringLiteral TIMEOUT_NODENAME = u"Timeout"; OConnectionPool::OConnectionPool(const Reference< XDriver >& _xDriver, const Reference< XInterface >& _xDriverNode, diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx index 4c9446348681..7f196bed35e7 100644 --- a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx @@ -40,7 +40,7 @@ OEvoabResultSetMetaData::~OEvoabResultSetMetaData() void OEvoabResultSetMetaData::setEvoabFields(const ::rtl::Reference &xColumns) { - static const OUStringLiteral aName = u"Name"; + static constexpr OUStringLiteral aName = u"Name"; for (const auto& rxColumn : *xColumns) { diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx index 6a247ee8f41e..2fffb76f78e3 100644 --- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -165,7 +165,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::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/firebird/Driver.cxx b/connectivity/source/drivers/firebird/Driver.cxx index 6adeb7207ecf..55e149e9de5c 100644 --- a/connectivity/source/drivers/firebird/Driver.cxx +++ b/connectivity/source/drivers/firebird/Driver.cxx @@ -45,11 +45,11 @@ using namespace connectivity::firebird; // Static const variables namespace { -const OUStringLiteral our_sFirebirdTmpVar = u"FIREBIRD_TMP"; -const OUStringLiteral our_sFirebirdLockVar = u"FIREBIRD_LOCK"; -const OUStringLiteral our_sFirebirdMsgVar = u"FIREBIRD_MSG"; +constexpr OUStringLiteral our_sFirebirdTmpVar = u"FIREBIRD_TMP"; +constexpr OUStringLiteral our_sFirebirdLockVar = u"FIREBIRD_LOCK"; +constexpr OUStringLiteral our_sFirebirdMsgVar = u"FIREBIRD_MSG"; #ifdef MACOSX -const OUStringLiteral our_sFirebirdLibVar = u"LIBREOFFICE_FIREBIRD_LIB"; +constexpr OUStringLiteral our_sFirebirdLibVar = u"LIBREOFFICE_FIREBIRD_LIB"; #endif }; diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx index cf0b549b11aa..e3cd11cabb90 100644 --- a/connectivity/source/drivers/jdbc/JConnection.cxx +++ b/connectivity/source/drivers/jdbc/JConnection.cxx @@ -699,7 +699,7 @@ void java_sql_Connection::loadDriverFromProperties( const OUString& _sDriverClas OUString java_sql_Connection::impl_getJavaDriverClassPath_nothrow(const OUString& _sDriverClass) { - static const OUStringLiteral s_sNodeName + static constexpr OUStringLiteral s_sNodeName = u"org.openoffice.Office.DataAccess/JDBC/DriverClassPaths"; ::utl::OConfigurationTreeRoot aNamesRoot = ::utl::OConfigurationTreeRoot::createWithComponentContext( m_pDriver->getContext(), s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY); diff --git a/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx b/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx index bc88b2360bd8..540e333aa639 100644 --- a/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx +++ b/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx @@ -739,7 +739,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTableTypes( ) static ODatabaseMetaDataResultSet::ORows aRows = [&] { - static const OUStringLiteral aTable = u"TABLE"; + static constexpr OUStringLiteral aTable = u"TABLE"; ODatabaseMetaDataResultSet::ORows tmp; ODatabaseMetaDataResultSet::ORow aRow(2); aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue(); @@ -925,7 +925,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTables( // check whether we have tables in the requested types // for the moment, we answer only the "TABLE" table type // when no types are given at all, we return all the tables - static const OUStringLiteral aTable = u"TABLE"; + static constexpr OUStringLiteral aTable = u"TABLE"; bool bTableFound = false; const OUString* p = types.getConstArray(), * pEnd = p + types.getLength(); diff --git a/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx b/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx index eed17c553a72..d0ed7298f92b 100644 --- a/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx +++ b/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx @@ -43,7 +43,7 @@ MacabResultSetMetaData::~MacabResultSetMetaData() void MacabResultSetMetaData::setMacabFields(const ::rtl::Reference &xColumns) { - static const OUStringLiteral aName = u"Name"; + static constexpr OUStringLiteral aName = u"Name"; MacabRecords *aRecords; MacabHeader *aHeader; diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx index 28cb14faa981..777f4712ce96 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx @@ -1090,9 +1090,9 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(bool _bRowVer,const Any& cat // E.g. psqlodbc up to at least version 09.01.0100 segfaults if (table.empty()) { - static const OUStringLiteral errMsg + static constexpr OUStringLiteral errMsg = u"ODBC: Trying to get special columns of empty table name"; - static const OUStringLiteral SQLState = u"HY009"; + static constexpr OUStringLiteral SQLState = u"HY009"; throw SQLException( errMsg, *this, SQLState, -1, Any() ); } diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 9f860327757c..766dcf3b8198 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -264,7 +264,7 @@ namespace { OUString sComposedName; - static const OUStringLiteral s_sWildcard = u"%" ; + static constexpr OUStringLiteral s_sWildcard = u"%" ; // we want all catalogues, all schemas, all tables Sequence< OUString > sTableTypes(3); -- cgit