configmgr/source/components.cxx |   14 +++++++-------
 configmgr/source/components.hxx |    2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 902e81b1b0c62993270846962d44aea6774e9687
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Apr 13 16:13:41 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Apr 13 20:35:21 2022 +0200

    use more string_view in configmgr
    
    Change-Id: Ia8aab5ea1a03d1512a1da806d505ce06f6977828
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132971
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index cf1375956571..57f9e30e185b 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -405,15 +405,15 @@ void Components::insertModificationXcuFile(
 }
 
 css::beans::Optional< css::uno::Any > Components::getExternalValue(
-    OUString const & descriptor)
+    std::u16string_view descriptor)
 {
-    sal_Int32 i = descriptor.indexOf(' ');
-    if (i <= 0) {
+    size_t i = descriptor.find(' ');
+    if (i == 0 || i == std::u16string_view::npos) {
         throw css::uno::RuntimeException(
-            "bad external value descriptor " + descriptor);
+            OUString::Concat("bad external value descriptor ") + descriptor);
     }
     //TODO: Do not make calls with mutex locked:
-    OUString name(descriptor.copy(0, i));
+    OUString name(descriptor.substr(0, i));
     ExternalServices::iterator j(externalServices_.find(name));
     if (j == externalServices_.end()) {
         css::uno::Reference< css::uno::XInterface > service;
@@ -439,11 +439,11 @@ css::beans::Optional< css::uno::Any > 
Components::getExternalValue(
     css::beans::Optional< css::uno::Any > value;
     if (j->second.is()) {
         try {
-            if (!(j->second->getPropertyValue(descriptor.copy(i + 1)) >>=
+            if (!(j->second->getPropertyValue(OUString(descriptor.substr(i + 
1))) >>=
                   value))
             {
                 throw css::uno::RuntimeException(
-                    "cannot obtain external value through " + descriptor);
+                    OUString::Concat("cannot obtain external value through ") 
+ descriptor);
             }
         } catch (css::beans::UnknownPropertyException & e) {
             throw css::uno::RuntimeException(
diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx
index 08f14a8b7bf9..5d7b6b5967ee 100644
--- a/configmgr/source/components.hxx
+++ b/configmgr/source/components.hxx
@@ -96,7 +96,7 @@ public:
         Modifications * modifications);
 
     css::beans::Optional< css::uno::Any >
-    getExternalValue(OUString const & descriptor);
+    getExternalValue(std::u16string_view descriptor);
 
 private:
     Components(const Components&) = delete;

Reply via email to