summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-05-04 14:26:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-05 08:39:23 +0200
commitd15a6560bd445cd1931e9fded6ad8ecfdd54211b (patch)
treedc23fce7925c88620abe8cc032b27f25b0a888e0 /cppuhelper
parentc895edf3f67f19d8d2012674c084456a7851436e (diff)
use more string_view
found by examining the call sites of OString::getToken which means I needed to add a new o3tl::equalsAscii function Change-Id: I7dc0ea1cf5ce8090a708d44f2cf7c938fa200c5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133826 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/source/loadsharedlibcomponentfactory.hxx2
-rw-r--r--cppuhelper/source/shlib.cxx13
2 files changed, 8 insertions, 7 deletions
diff --git a/cppuhelper/source/loadsharedlibcomponentfactory.hxx b/cppuhelper/source/loadsharedlibcomponentfactory.hxx
index 3678c32e76fb..d8c7bb55536b 100644
--- a/cppuhelper/source/loadsharedlibcomponentfactory.hxx
+++ b/cppuhelper/source/loadsharedlibcomponentfactory.hxx
@@ -26,7 +26,7 @@ namespace com::sun::star {
namespace cppuhelper::detail {
css::uno::Environment getEnvironment(
- OUString const & name, OUString const & implementation);
+ OUString const & name, std::u16string_view implementation);
void loadSharedLibComponentFactory(
OUString const & uri, OUString const & environment,
diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx
index 41af3dd80ebc..b270c62c5cb4 100644
--- a/cppuhelper/source/shlib.cxx
+++ b/cppuhelper/source/shlib.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/shlib.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/module.hxx>
#include <sal/log.hxx>
#include <uno/environment.hxx>
@@ -46,17 +47,17 @@
#endif
css::uno::Environment cppuhelper::detail::getEnvironment(
- OUString const & name, OUString const & implementation)
+ OUString const & name, std::u16string_view implementation)
{
OUString n(name);
- if (!implementation.isEmpty()) {
+ if (!implementation.empty()) {
static char const * log = std::getenv("UNO_ENV_LOG");
if (log != nullptr && *log != 0) {
OString imps(log);
for (sal_Int32 i = 0; i != -1;) {
- OString imp(imps.getToken(0, ';', i));
+ std::string_view imp(o3tl::getToken(imps, 0, ';', i));
//TODO: this assumes UNO_ENV_LOG only contains ASCII characters:
- if (implementation.equalsAsciiL(imp.getStr(), imp.getLength()))
+ if (o3tl::equalsAscii(implementation, imp))
{
n += ":log";
break;
@@ -73,7 +74,7 @@ namespace {
css::uno::Environment getEnvironmentFromModule(
osl::Module const & module, css::uno::Environment const & target,
- OUString const & implementation, OUString const & prefix)
+ std::u16string_view implementation, OUString const & prefix)
{
char const * name = nullptr;
css::uno::Environment env;
@@ -402,7 +403,7 @@ void cppu::writeSharedLibComponentInfo(
css::uno::Reference<css::uno::XInterface>());
}
css::uno::Environment curEnv(css::uno::Environment::getCurrent());
- css::uno::Environment env(getEnvironmentFromModule(mod, curEnv, "", ""));
+ css::uno::Environment env(getEnvironmentFromModule(mod, curEnv, u"", ""));
if (!(curEnv.is() && env.is())) {
throw css::registry::CannotRegisterImplementationException(
"cannot get environments",