diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-12-23 13:16:31 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-12-26 14:51:15 +0100 |
commit | a3d0091d185f39eddabf4d372ebe0ac3061dbb89 (patch) | |
tree | 4d70cedc274972ccc21b6b8e7105f042090cf5d6 /dbaccess | |
parent | af791fb775e35c11ad01c42a7085dd121ab9c7a6 (diff) |
New loplugin:stringliteralvar
See the comment at the top of compilerplugins/clang/stringliteralvar.cxx for
details.
(Turned some affected variables in included files into inline variables, to
avoid GCC warnings about unused variables.)
Change-Id: Ie77219e6adfdaaceaa8b4e590b08971f2f04c83a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108239
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/qa/unit/embeddeddb_performancetest.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/core/api/FilteredContainer.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/databasedocument.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/datasource.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/misc/DatabaseDataProvider.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/recovery/dbdocrecovery.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/core/recovery/storagetextstream.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/recovery/subcomponentrecovery.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/filter/hsqldb/hsqlimport.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/filter/hsqldb/parseschema.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/filter/hsqldb/utils.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppController.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppControllerGen.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/queryfilter.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/indexcollection.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/querycontroller.cxx | 4 |
16 files changed, 26 insertions, 25 deletions
diff --git a/dbaccess/qa/unit/embeddeddb_performancetest.cxx b/dbaccess/qa/unit/embeddeddb_performancetest.cxx index 0517a9fd170c..abd72db66fe4 100644 --- a/dbaccess/qa/unit/embeddeddb_performancetest.cxx +++ b/dbaccess/qa/unit/embeddeddb_performancetest.cxx @@ -82,7 +82,8 @@ class EmbeddedDBPerformanceTest : public DBTestBase { private: - static const char our_sEnableTestEnvVar[]; + static constexpr OUStringLiteral our_sEnableTestEnvVar = u"DBA_PERFTEST"; + // We store the results and print them at the end due to the amount of warning // noise present which otherwise obscures the results. @@ -140,8 +141,6 @@ void EmbeddedDBPerformanceTest::printTimes( .append("\n"); } -const char EmbeddedDBPerformanceTest::our_sEnableTestEnvVar[] = "DBA_PERFTEST"; - // TODO: we probably should create a document from scratch instead? void EmbeddedDBPerformanceTest::testPerformance() diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx index 0e8b2926c37e..74b522a4b459 100644 --- a/dbaccess/source/core/api/FilteredContainer.cxx +++ b/dbaccess/source/core/api/FilteredContainer.cxx @@ -343,7 +343,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std:: } } - static const char sAll[] = "%"; + static const OUStringLiteral sAll = u"%"; Reference< XResultSet > xTables = m_xMetaData->getTables( Any(), sAll, sAll, aTableTypeFilter ); Reference< XRow > xCurrentRow( xTables, UNO_QUERY_THROW ); diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index cf6753794800..b5a789fad212 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -311,7 +311,7 @@ namespace } } -const char sPictures[] = "Pictures"; +const OUStringLiteral sPictures = u"Pictures"; // base documents seem to have a different behaviour to other documents, the // root storage contents at least seem to be re-used over different saves, thus if there is a diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 891df4de9dc8..206b8e490e6e 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -644,7 +644,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString if (bNeedMigration) { // back up content xml file if migration was successful - constexpr char BACKUP_XML_NAME[] = "content_before_migration.xml"; + static constexpr OUStringLiteral BACKUP_XML_NAME = u"content_before_migration.xml"; try { if(xRootStorage->isStreamElement(BACKUP_XML_NAME)) diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index b6366e4482fb..f317bd474c38 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -266,7 +266,7 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::cre osl::MutexGuard g(m_aMutex); uno::Reference< chart2::data::XDataSequence > xData = m_xInternal->createDataSequenceByRangeRepresentation(_sRangeRepresentation); uno::Reference<beans::XPropertySet> xProp(xData,uno::UNO_QUERY); - static const char s_sNumberFormatKey[] = "NumberFormatKey"; + static const OUStringLiteral s_sNumberFormatKey = u"NumberFormatKey"; if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(s_sNumberFormatKey) ) { xProp->setPropertyValue(s_sNumberFormatKey,impl_getNumberFormatKey_nothrow(_sRangeRepresentation)); diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx index ab5947d91261..d111aa86b6cf 100644 --- a/dbaccess/source/core/recovery/dbdocrecovery.cxx +++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx @@ -86,9 +86,9 @@ namespace dbaccess return true; } - const char sRecoveryDataSubStorageName[] = "recovery"; + const OUStringLiteral sRecoveryDataSubStorageName = u"recovery"; - const char sObjectMapStreamName[] = "storage-component-map.ini"; + const OUStringLiteral sObjectMapStreamName = u"storage-component-map.ini"; void lcl_writeObjectMap_throw( const Reference<XComponentContext> & i_rContext, const Reference< XStorage >& i_rStorage, const MapStringToCompDesc& i_mapStorageToCompDesc ) diff --git a/dbaccess/source/core/recovery/storagetextstream.cxx b/dbaccess/source/core/recovery/storagetextstream.cxx index 6ea4ef005320..1dd774bc8a31 100644 --- a/dbaccess/source/core/recovery/storagetextstream.cxx +++ b/dbaccess/source/core/recovery/storagetextstream.cxx @@ -36,7 +36,7 @@ namespace dbaccess Reference< XTextOutputStream2 > xTextOutput; }; - const char sLineFeed[] = "\n"; + const OUStringLiteral sLineFeed = u"\n"; // StorageTextOutputStream StorageTextOutputStream::StorageTextOutputStream( const Reference<XComponentContext>& i_rContext, diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.cxx b/dbaccess/source/core/recovery/subcomponentrecovery.cxx index ab16ee9e2c04..11dfa49d17ad 100644 --- a/dbaccess/source/core/recovery/subcomponentrecovery.cxx +++ b/dbaccess/source/core/recovery/subcomponentrecovery.cxx @@ -160,8 +160,8 @@ namespace dbaccess return xCommandProcessor; } - const char sSettingsStreamName[] = "settings.xml"; - const char sCurrentQueryDesignName[] = "ooo:current-query-design"; + const OUStringLiteral sSettingsStreamName = u"settings.xml"; + const OUStringLiteral sCurrentQueryDesignName = u"ooo:current-query-design"; } namespace { diff --git a/dbaccess/source/filter/hsqldb/hsqlimport.cxx b/dbaccess/source/filter/hsqldb/hsqlimport.cxx index a017d8dfa12e..f24ceb6f2ff0 100644 --- a/dbaccess/source/filter/hsqldb/hsqlimport.cxx +++ b/dbaccess/source/filter/hsqldb/hsqlimport.cxx @@ -266,7 +266,7 @@ void HsqlImporter::parseTableRows(const std::vector<sal_Int32>& rIndexes, const std::vector<ColumnDefinition>& rColTypes, const OUString& sTableName) { - constexpr char BINARY_FILENAME[] = "data"; + static constexpr OUStringLiteral BINARY_FILENAME = u"data"; if (!m_xStorage->hasByName(BINARY_FILENAME)) { diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx b/dbaccess/source/filter/hsqldb/parseschema.cxx index 6dfc59778bf0..e1d794cdca8b 100644 --- a/dbaccess/source/filter/hsqldb/parseschema.cxx +++ b/dbaccess/source/filter/hsqldb/parseschema.cxx @@ -111,7 +111,7 @@ void SchemaParser::parseSchema() { assert(m_rStorage); - constexpr char SCHEMA_FILENAME[] = "script"; + static constexpr OUStringLiteral SCHEMA_FILENAME = u"script"; if (!m_rStorage->hasByName(SCHEMA_FILENAME)) { SAL_WARN("dbaccess", "script file does not exist in storage during hsqldb import"); @@ -175,7 +175,8 @@ std::vector<ColumnDefinition> SchemaParser::getTableColumnTypes(const OUString& { if (m_ColumnTypes.count(sTableName) < 1) { - constexpr char NOT_EXIST[] = "Internal error while getting column information of table"; + static constexpr OUStringLiteral NOT_EXIST + = u"Internal error while getting column information of table"; SAL_WARN("dbaccess", NOT_EXIST << ". Table name is: " << sTableName); dbtools::throwGenericSQLException(NOT_EXIST, ::comphelper::getProcessComponentContext()); } diff --git a/dbaccess/source/filter/hsqldb/utils.cxx b/dbaccess/source/filter/hsqldb/utils.cxx index f2b2b517b8fc..041df17a700a 100644 --- a/dbaccess/source/filter/hsqldb/utils.cxx +++ b/dbaccess/source/filter/hsqldb/utils.cxx @@ -129,9 +129,10 @@ void utils::ensureFirebirdTableLength(const OUString& sName) { if (sName.getLength() > 30) // Firebird limitation { - constexpr char NAME_TOO_LONG[] = "Firebird 3 doesn't support object (table, field) names " - "of more than 30 characters; please shorten your object " - "names in the original file and try again."; + static constexpr OUStringLiteral NAME_TOO_LONG + = u"Firebird 3 doesn't support object (table, field) names " + "of more than 30 characters; please shorten your object " + "names in the original file and try again."; dbtools::throwGenericSQLException(NAME_TOO_LONG, ::comphelper::getProcessComponentContext()); } diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 987536261316..d75d557615a2 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -674,7 +674,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = xEnumAccess.is(); if ( aReturn.bEnabled ) { - static const char s_sReportDesign[] = "org.libreoffice.report.pentaho.SOReportJobFactory"; + static const OUStringLiteral s_sReportDesign = u"org.libreoffice.report.pentaho.SOReportJobFactory"; Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(s_sReportDesign); aReturn.bEnabled = xEnumDrivers.is() && xEnumDrivers->hasMoreElements(); } diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 1d7019a81b29..0ce728d7fa2a 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -639,7 +639,7 @@ void OApplicationController::onLoadedMenu(const Reference< css::frame::XLayoutMa if ( !_xLayoutManager.is() ) return; - static const char s_sStatusbar[] = "private:resource/statusbar/statusbar"; + static const OUStringLiteral s_sStatusbar = u"private:resource/statusbar/statusbar"; _xLayoutManager->createElement( s_sStatusbar ); _xLayoutManager->requestElement( s_sStatusbar ); diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx index 67df2db8ccdf..da4d61641936 100644 --- a/dbaccess/source/ui/dlg/queryfilter.cxx +++ b/dbaccess/source/ui/dlg/queryfilter.cxx @@ -304,10 +304,10 @@ bool DlgFilterCrit::getCondition(const weld::ComboBox& _rField,const weld::Combo } } xColumn->getPropertyValue(PROPERTY_REALNAME) >>= _rFilter.Name; - static const char sAgg[] = "AggregateFunction"; + static const OUStringLiteral sAgg = u"AggregateFunction"; if ( xInfo->hasPropertyByName(sAgg) ) xColumn->getPropertyValue(sAgg) >>= bHaving; - static const char sFunction[] = "Function"; + static const OUStringLiteral sFunction = u"Function"; if ( xInfo->hasPropertyByName(sFunction) ) xColumn->getPropertyValue(sFunction) >>= bFunction; } diff --git a/dbaccess/source/ui/misc/indexcollection.cxx b/dbaccess/source/ui/misc/indexcollection.cxx index fb83377f1740..046a41a000ea 100644 --- a/dbaccess/source/ui/misc/indexcollection.cxx +++ b/dbaccess/source/ui/misc/indexcollection.cxx @@ -122,7 +122,7 @@ namespace dbaui } // set the properties - static const char s_sNamePropertyName[] = "Name"; + static const OUStringLiteral s_sNamePropertyName = u"Name"; // the index' own props xIndexDescriptor->setPropertyValue("IsUnique", css::uno::makeAny(_rPos->bUnique)); xIndexDescriptor->setPropertyValue(s_sNamePropertyName, makeAny(_rPos->sName)); diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 6a77aa548855..5bab3d26f30b 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -149,8 +149,8 @@ namespace return; xLayoutManager->lock(); - static const char s_sDesignToolbar[] = "private:resource/toolbar/designobjectbar"; - static const char s_sSqlToolbar[] = "private:resource/toolbar/sqlobjectbar"; + static const OUStringLiteral s_sDesignToolbar = u"private:resource/toolbar/designobjectbar"; + static const OUStringLiteral s_sSqlToolbar = u"private:resource/toolbar/sqlobjectbar"; if ( _bDesign ) { xLayoutManager->destroyElement( s_sSqlToolbar ); |