summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-11-25 08:14:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-30 12:32:14 +0100
commit8332d6d8200e8ca1f22dd98d9373efd5a431d09c (patch)
treedd45d452202998297b8562743ea6345462304d04 /desktop
parentd05a4cfbdcece491f7385dbeaa7eca03f2fdc1d5 (diff)
loplugin:stringviewparam include comparisons with string literals
Change-Id: I8ba1214500dddaf413c506a4b82f43d63cda804b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106559 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.cxx12
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.hxx2
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx8
-rw-r--r--desktop/source/deployment/misc/dp_platform.cxx82
-rw-r--r--desktop/source/lib/init.cxx4
-rw-r--r--desktop/source/migration/migration.cxx28
-rw-r--r--desktop/source/migration/migration_impl.hxx4
7 files changed, 70 insertions, 70 deletions
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index d126ccdd8412..62063f81e148 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -214,18 +214,18 @@ Reference<task::XAbortChannel> ExtensionManager::createAbortChannel()
}
css::uno::Reference<css::deployment::XPackageManager>
-ExtensionManager::getPackageManager(OUString const & repository)
+ExtensionManager::getPackageManager(std::u16string_view repository)
{
Reference<css::deployment::XPackageManager> xPackageManager;
- if (repository == "user")
+ if (repository == u"user")
xPackageManager = getUserRepository();
- else if (repository == "shared")
+ else if (repository == u"shared")
xPackageManager = getSharedRepository();
- else if (repository == "bundled")
+ else if (repository == u"bundled")
xPackageManager = getBundledRepository();
- else if (repository == "tmp")
+ else if (repository == u"tmp")
xPackageManager = getTmpRepository();
- else if (repository == "bak")
+ else if (repository == u"bak")
xPackageManager = getBakRepository();
else
throw lang::IllegalArgumentException(
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx
index 28c2f569f6ef..aeee0d15683a 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.hxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx
@@ -204,7 +204,7 @@ private:
/// @throws css::lang::IllegalArgumentException
/// @throws css::uno::RuntimeException
css::uno::Reference<css::deployment::XPackageManager>
- getPackageManager(OUString const & repository);
+ getPackageManager(std::u16string_view repository);
/// @throws css::deployment::DeploymentException
/// @throws css::ucb::CommandFailedException
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index a76076e623f9..21b9d4b4496b 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -195,16 +195,16 @@ bool compareExtensionFolderWithLastSynchronizedFile(
return bNeedsSync;
}
-bool needToSyncRepository(OUString const & name)
+bool needToSyncRepository(std::u16string_view name)
{
OUString folder;
OUString file;
- if ( name == "bundled" )
+ if ( name == u"bundled" )
{
folder = "$BUNDLED_EXTENSIONS";
file = "$BUNDLED_EXTENSIONS_USER/lastsynchronized";
}
- else if ( name == "shared" )
+ else if ( name == u"shared" )
{
folder = "$UNO_SHARED_PACKAGES_CACHE/uno_packages";
file = "$SHARED_EXTENSIONS_USER/lastsynchronized";
@@ -502,7 +502,7 @@ void syncRepositories(
//synchronize shared before bundled otherwise there are
//more revoke and registration calls.
bool bModified = false;
- if (force || needToSyncRepository("shared") || needToSyncRepository("bundled"))
+ if (force || needToSyncRepository(u"shared") || needToSyncRepository(u"bundled"))
{
xExtensionManager =
deployment::ExtensionManager::get(
diff --git a/desktop/source/deployment/misc/dp_platform.cxx b/desktop/source/deployment/misc/dp_platform.cxx
index 229208916598..d551263d9b9d 100644
--- a/desktop/source/deployment/misc/dp_platform.cxx
+++ b/desktop/source/deployment/misc/dp_platform.cxx
@@ -25,7 +25,7 @@
#include <rtl/bootstrap.hxx>
#include <osl/diagnose.h>
-#define PLATFORM_ALL "all"
+#define PLATFORM_ALL u"all"
namespace dp_misc
@@ -68,88 +68,88 @@ namespace
&& (cpu == StrCPU::get());
}
- bool isPlatformSupported( OUString const & token )
+ bool isPlatformSupported( std::u16string_view token )
{
bool ret = false;
if (token == PLATFORM_ALL)
ret = true;
- else if (token == "windows_x86")
+ else if (token == u"windows_x86")
ret = checkOSandCPU(u"Windows", u"x86");
- else if (token == "windows_x86_64")
+ else if (token == u"windows_x86_64")
ret = checkOSandCPU(u"Windows", u"X86_64");
- else if (token == "solaris_sparc")
+ else if (token == u"solaris_sparc")
ret = checkOSandCPU(u"Solaris", u"SPARC");
- else if (token == "solaris_sparc64")
+ else if (token == u"solaris_sparc64")
ret = checkOSandCPU(u"Solaris", u"SPARC64");
- else if (token == "solaris_x86")
+ else if (token == u"solaris_x86")
ret = checkOSandCPU(u"Solaris", u"x86");
- else if (token == "aix_powerpc")
+ else if (token == u"aix_powerpc")
ret = checkOSandCPU(u"AIX", u"PowerPC");
- else if (token == "macosx_x86_64")
+ else if (token == u"macosx_x86_64")
ret = checkOSandCPU(u"MacOSX", u"X86_64");
- else if (token == "linux_x86")
+ else if (token == u"linux_x86")
ret = checkOSandCPU(u"Linux", u"x86");
- else if (token == "linux_x86_64")
+ else if (token == u"linux_x86_64")
ret = checkOSandCPU(u"Linux", u"X86_64");
- else if (token == "linux_sparc")
+ else if (token == u"linux_sparc")
ret = checkOSandCPU(u"Linux", u"SPARC");
- else if (token == "linux_sparc64")
+ else if (token == u"linux_sparc64")
ret = checkOSandCPU(u"Linux", u"SPARC64");
- else if (token == "linux_powerpc")
+ else if (token == u"linux_powerpc")
ret = checkOSandCPU(u"Linux", u"PowerPC");
- else if (token == "linux_powerpc64")
+ else if (token == u"linux_powerpc64")
ret = checkOSandCPU(u"Linux", u"PowerPC_64");
- else if (token == "linux_powerpc64_le")
+ else if (token == u"linux_powerpc64_le")
ret = checkOSandCPU(u"Linux", u"PowerPC_64_LE");
- else if (token == "linux_arm_eabi")
+ else if (token == u"linux_arm_eabi")
ret = checkOSandCPU(u"Linux", u"ARM_EABI");
- else if (token == "linux_arm_oabi")
+ else if (token == u"linux_arm_oabi")
ret = checkOSandCPU(u"Linux", u"ARM_OABI");
- else if (token == "linux_mips_el")
+ else if (token == u"linux_mips_el")
ret = checkOSandCPU(u"Linux", u"MIPS_EL");
- else if (token == "linux_mips64_el")
+ else if (token == u"linux_mips64_el")
ret = checkOSandCPU(u"Linux", u"MIPS64_EL");
- else if (token == "linux_mips_eb")
+ else if (token == u"linux_mips_eb")
ret = checkOSandCPU(u"Linux", u"MIPS_EB");
- else if (token == "linux_mips64_eb")
+ else if (token == u"linux_mips64_eb")
ret = checkOSandCPU(u"Linux", u"MIPS64_EB");
- else if (token == "linux_ia64")
+ else if (token == u"linux_ia64")
ret = checkOSandCPU(u"Linux", u"IA64");
- else if (token == "linux_m68k")
+ else if (token == u"linux_m68k")
ret = checkOSandCPU(u"Linux", u"M68K");
- else if (token == "linux_s390")
+ else if (token == u"linux_s390")
ret = checkOSandCPU(u"Linux", u"S390");
- else if (token == "linux_s390x")
+ else if (token == u"linux_s390x")
ret = checkOSandCPU(u"Linux", u"S390x");
- else if (token == "linux_hppa")
+ else if (token == u"linux_hppa")
ret = checkOSandCPU(u"Linux", u"HPPA");
- else if (token == "linux_alpha")
+ else if (token == u"linux_alpha")
ret = checkOSandCPU(u"Linux", u"ALPHA");
- else if (token == "linux_aarch64")
+ else if (token == u"linux_aarch64")
ret = checkOSandCPU(u"Linux", u"AARCH64");
- else if (token == "freebsd_x86")
+ else if (token == u"freebsd_x86")
ret = checkOSandCPU(u"FreeBSD", u"x86");
- else if (token == "freebsd_x86_64")
+ else if (token == u"freebsd_x86_64")
ret = checkOSandCPU(u"FreeBSD", u"X86_64");
- else if (token == "freebsd_powerpc")
+ else if (token == u"freebsd_powerpc")
ret = checkOSandCPU(u"FreeBSD", u"PowerPC");
- else if (token == "freebsd_powerpc64")
+ else if (token == u"freebsd_powerpc64")
ret = checkOSandCPU(u"FreeBSD", u"PowerPC64");
- else if (token == "kfreebsd_x86")
+ else if (token == u"kfreebsd_x86")
ret = checkOSandCPU(u"kFreeBSD", u"x86");
- else if (token == "kfreebsd_x86_64")
+ else if (token == u"kfreebsd_x86_64")
ret = checkOSandCPU(u"kFreeBSD", u"X86_64");
- else if (token == "netbsd_x86")
+ else if (token == u"netbsd_x86")
ret = checkOSandCPU(u"NetBSD", u"x86");
- else if (token == "netbsd_x86_64")
+ else if (token == u"netbsd_x86_64")
ret = checkOSandCPU(u"NetBSD", u"X86_64");
- else if (token == "openbsd_x86")
+ else if (token == u"openbsd_x86")
ret = checkOSandCPU(u"OpenBSD", u"x86");
- else if (token == "openbsd_x86_64")
+ else if (token == u"openbsd_x86_64")
ret = checkOSandCPU(u"OpenBSD", u"X86_64");
- else if (token == "dragonfly_x86")
+ else if (token == u"dragonfly_x86")
ret = checkOSandCPU(u"DragonFly", u"x86");
- else if (token == "dragonfly_x86_64")
+ else if (token == u"dragonfly_x86_64")
ret = checkOSandCPU(u"DragonFly", u"X86_64");
else
{
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f53fd96eb609..66a32dafbc97 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2147,9 +2147,9 @@ void setLanguageAndLocale(OUString const & aLangISO)
aLocalOptions.Commit();
}
-void setFormatSpecificFilterData(OUString const & sFormat, comphelper::SequenceAsHashMap & rFilterDataMap)
+void setFormatSpecificFilterData(std::u16string_view sFormat, comphelper::SequenceAsHashMap & rFilterDataMap)
{
- if (sFormat == "pdf")
+ if (sFormat == u"pdf")
{
// always export bookmarks, which is needed for annotations
rFilterDataMap["ExportBookmarks"] <<= true;
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 4197a245cd94..1637a9d63ade 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -73,47 +73,47 @@ const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL";
const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer";
const char ITEM_DESCRIPTOR_LABEL[] = "Label";
-static OUString mapModuleShortNameToIdentifier(const OUString& sShortName)
+static OUString mapModuleShortNameToIdentifier(std::u16string_view sShortName)
{
OUString sIdentifier;
- if ( sShortName == "StartModule" )
+ if ( sShortName == u"StartModule" )
sIdentifier = "com.sun.star.frame.StartModule";
- else if ( sShortName == "swriter" )
+ else if ( sShortName == u"swriter" )
sIdentifier = "com.sun.star.text.TextDocument";
- else if ( sShortName == "scalc" )
+ else if ( sShortName == u"scalc" )
sIdentifier = "com.sun.star.sheet.SpreadsheetDocument";
- else if ( sShortName == "sdraw" )
+ else if ( sShortName == u"sdraw" )
sIdentifier = "com.sun.star.drawing.DrawingDocument";
- else if ( sShortName == "simpress" )
+ else if ( sShortName == u"simpress" )
sIdentifier = "com.sun.star.presentation.PresentationDocument";
- else if ( sShortName == "smath" )
+ else if ( sShortName == u"smath" )
sIdentifier = "com.sun.star.formula.FormulaProperties";
- else if ( sShortName == "schart" )
+ else if ( sShortName == u"schart" )
sIdentifier = "com.sun.star.chart2.ChartDocument";
- else if ( sShortName == "BasicIDE" )
+ else if ( sShortName == u"BasicIDE" )
sIdentifier = "com.sun.star.script.BasicIDE";
- else if ( sShortName == "dbapp" )
+ else if ( sShortName == u"dbapp" )
sIdentifier = "com.sun.star.sdb.OfficeDatabaseDocument";
- else if ( sShortName == "sglobal" )
+ else if ( sShortName == u"sglobal" )
sIdentifier = "com.sun.star.text.GlobalDocument";
- else if ( sShortName == "sweb" )
+ else if ( sShortName == u"sweb" )
sIdentifier = "com.sun.star.text.WebDocument";
- else if ( sShortName == "swxform" )
+ else if ( sShortName == u"swxform" )
sIdentifier = "com.sun.star.xforms.XMLFormDocument";
- else if ( sShortName == "sbibliography" )
+ else if ( sShortName == u"sbibliography" )
sIdentifier = "com.sun.star.frame.Bibliography";
return sIdentifier;
diff --git a/desktop/source/migration/migration_impl.hxx b/desktop/source/migration/migration_impl.hxx
index 3b9cb09d3856..a3e21a4a1f24 100644
--- a/desktop/source/migration/migration_impl.hxx
+++ b/desktop/source/migration/migration_impl.hxx
@@ -64,9 +64,9 @@ typedef std::vector< migration_step > migrations_v;
typedef std::unique_ptr< migrations_v > migrations_vr;
typedef std::vector< supported_migration > migrations_available;
-inline bool areBothOpenFrom(OUString const & cmd1, OUString const & cmd2)
+inline bool areBothOpenFrom(std::u16string_view cmd1, OUString const & cmd2)
{
- return cmd1 == ".uno:Open" && cmd2.startsWith(".uno:OpenFrom");
+ return cmd1 == u".uno:Open" && cmd2.startsWith(".uno:OpenFrom");
}
/**