summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-06-23 12:34:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-06-26 13:12:31 +0200
commit0193b284e880a659ab73160e42238e1d5fe5cf8f (patch)
treeda09299838a6afb43d7c601803a6bab787489854 /desktop
parent2ef138de767c312188d41a7f206234eafac3108b (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 'desktop')
-rw-r--r--desktop/source/app/crashreport.cxx4
-rw-r--r--desktop/source/deployment/registry/help/dp_help.cxx2
-rw-r--r--desktop/source/deployment/registry/package/dp_package.cxx6
-rw-r--r--desktop/source/lib/init.cxx2
-rw-r--r--desktop/source/migration/migration.cxx18
5 files changed, 16 insertions, 16 deletions
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index ae6b9030f17f..59a2aa771b32 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -135,8 +135,8 @@ void CrashReporter::writeCommonInfo()
ucbhelper::InternetProxyDecider proxy_decider(::comphelper::getProcessComponentContext());
- static const OUStringLiteral protocol = u"https";
- static const OUStringLiteral url = u"crashreport.libreoffice.org";
+ static constexpr OUStringLiteral protocol = u"https";
+ static constexpr OUStringLiteral url = u"crashreport.libreoffice.org";
const sal_Int32 port = 443;
const ucbhelper::InternetProxyServer proxy_server = proxy_decider.getProxy(protocol, url, port);
diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx
index 9e1a75fb93fb..888f35262f3d 100644
--- a/desktop/source/deployment/registry/help/dp_help.cxx
+++ b/desktop/source/deployment/registry/help/dp_help.cxx
@@ -421,7 +421,7 @@ void BackendImpl::implProcessHelp(
&langFolderContent,
langFolderDest, xCmdEnv);
- static const OUStringLiteral aHelpStr(u"help");
+ static constexpr OUStringLiteral aHelpStr(u"help");
OUString aJarFile(
makeURL(sHelpFolder, langFolderURLSegment + "/" + aHelpStr + ".jar"));
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx
index 0eb02321a74f..c27f5174045a 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -1057,9 +1057,9 @@ void BackendImpl::PackageImpl::exportTo(
manifest.reserve( bundle.getLength() );
sal_Int32 baseURLlen = m_url_expanded.getLength();
Reference<deployment::XPackage> const *pbundle = bundle.getConstArray();
- static const OUStringLiteral strMediaType( u"MediaType" );
- static const OUStringLiteral strFullPath( u"FullPath" );
- static const OUStringLiteral strIsFolder( u"IsFolder" );
+ static constexpr OUStringLiteral strMediaType( u"MediaType" );
+ static constexpr OUStringLiteral strFullPath( u"FullPath" );
+ static constexpr OUStringLiteral strIsFolder( u"IsFolder" );
for ( sal_Int32 pos = bundle.getLength(); pos--; )
{
Reference<deployment::XPackage> const & xPackage = pbundle[ pos ];
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 52cd5411a7e5..102028689451 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5945,7 +5945,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
{
boost::property_tree::ptree aChild;
boost::property_tree::ptree aChildren;
- static const OUStringLiteral sPageStyles(u"PageStyles");
+ static constexpr OUStringLiteral sPageStyles(u"PageStyles");
uno::Reference<beans::XPropertySet> xProperty;
uno::Reference<container::XNameContainer> xContainer;
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 273dd5e3def6..3b60cd771c75 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -190,8 +190,8 @@ bool MigrationImpl::doMigration()
copyFiles();
- static const OUStringLiteral sMenubarResourceURL(u"private:resource/menubar/menubar");
- static const OUStringLiteral sToolbarResourcePre(u"private:resource/toolbar/");
+ static constexpr OUStringLiteral sMenubarResourceURL(u"private:resource/menubar/menubar");
+ static constexpr OUStringLiteral sToolbarResourcePre(u"private:resource/toolbar/");
for (MigrationModuleInfo & i : vModulesInfo) {
OUString sModuleIdentifier = mapModuleShortNameToIdentifier(i.sModuleShortName);
if (sModuleIdentifier.isEmpty())
@@ -307,8 +307,8 @@ void MigrationImpl::readAvailableMigrations(migrations_available& rAvailableMigr
uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration/SupportedVersions"), uno::UNO_SET_THROW);
const uno::Sequence< OUString > seqSupportedVersions = aMigrationAccess->getElementNames();
- static const OUStringLiteral aVersionIdentifiers( u"VersionIdentifiers" );
- static const OUStringLiteral aPriorityIdentifier( u"Priority" );
+ static constexpr OUStringLiteral aVersionIdentifiers( u"VersionIdentifiers" );
+ static constexpr OUStringLiteral aPriorityIdentifier( u"Priority" );
for (OUString const & supportedVersion :seqSupportedVersions) {
sal_Int32 nPriority( 0 );
@@ -905,8 +905,8 @@ void MigrationImpl::runServices()
std::vector< MigrationModuleInfo > MigrationImpl::detectUIChangesForAllModules() const
{
std::vector< MigrationModuleInfo > vModulesInfo;
- static const OUStringLiteral MENUBAR(u"menubar");
- static const OUStringLiteral TOOLBAR(u"toolbar");
+ static constexpr OUStringLiteral MENUBAR(u"menubar");
+ static constexpr OUStringLiteral TOOLBAR(u"toolbar");
uno::Sequence< uno::Any > lArgs {uno::Any(m_aInfo.userdata + "/user/config/soffice.cfg/modules"),
uno::Any(embed::ElementModes::READ)};
@@ -966,7 +966,7 @@ void MigrationImpl::compareOldAndNewConfig(const OUString& sParent,
const uno::Reference< container::XIndexContainer >& xIndexNew,
const OUString& sResourceURL)
{
- static const OUStringLiteral MENU_SEPARATOR(u" | ");
+ static constexpr OUStringLiteral MENU_SEPARATOR(u" | ");
std::vector< MigrationItem > vOldItems;
std::vector< MigrationItem > vNewItems;
@@ -1176,8 +1176,8 @@ void NewVersionUIInfo::init(const std::vector< MigrationModuleInfo >& vModulesIn
m_lNewVersionToolbarSettingsSeq.realloc(vModulesInfo.size());
auto p_lNewVersionToolbarSettingsSeq = m_lNewVersionToolbarSettingsSeq.getArray();
- static const OUStringLiteral sMenubarResourceURL(u"private:resource/menubar/menubar");
- static const OUStringLiteral sToolbarResourcePre(u"private:resource/toolbar/");
+ static constexpr OUStringLiteral sMenubarResourceURL(u"private:resource/menubar/menubar");
+ static constexpr OUStringLiteral sToolbarResourcePre(u"private:resource/toolbar/");
uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier = ui::theModuleUIConfigurationManagerSupplier::get( ::comphelper::getProcessComponentContext() );