configmgr/source/access.cxx                |   16 +++++++++-------
 configmgr/source/configurationregistry.cxx |    4 ++--
 configmgr/source/valueparser.cxx           |    3 ++-
 3 files changed, 13 insertions(+), 10 deletions(-)

New commits:
commit 0787aeac2428bf6a2e372ed5f2eac2f079c28ba6
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Oct 28 21:14:47 2021 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Oct 29 10:33:14 2021 +0200

    Prepare for removal of non-const operator[] from Sequence in configmgr
    
    Change-Id: Ia349292783b81f0b4eebe64ae672ea5cb6d6cd59
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124352
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx
index dc16b0211ade..95c5de4ed47a 100644
--- a/configmgr/source/access.cxx
+++ b/configmgr/source/access.cxx
@@ -856,10 +856,10 @@ css::uno::Sequence< css::uno::Any > 
Access::getPropertyValues(
     assert(thisIs(IS_GROUP));
     osl::MutexGuard g(*lock_);
     css::uno::Sequence< css::uno::Any > vals(aPropertyNames.getLength());
-
+    auto aValsRange = asNonConstRange(vals);
     for (sal_Int32 i = 0; i < aPropertyNames.getLength(); ++i)
     {
-        if (!getByNameFast(aPropertyNames[i], vals[i]))
+        if (!getByNameFast(aPropertyNames[i], aValsRange[i]))
             throw css::uno::RuntimeException(
                 "configmgr getPropertyValues inappropriate property name",
                 static_cast< cppu::OWeakObject * >(this));
@@ -912,11 +912,12 @@ void Access::firePropertiesChangeEvent(
     assert(thisIs(IS_GROUP));
     css::uno::Sequence< css::beans::PropertyChangeEvent > events(
         aPropertyNames.getLength());
+    auto aEventsRange = asNonConstRange(events);
     for (sal_Int32 i = 0; i < events.getLength(); ++i) {
-        events[i].Source = static_cast< cppu::OWeakObject * >(this);
-        events[i].PropertyName = aPropertyNames[i];
-        events[i].Further = false;
-        events[i].PropertyHandle = -1;
+        aEventsRange[i].Source = static_cast< cppu::OWeakObject * >(this);
+        aEventsRange[i].PropertyName = aPropertyNames[i];
+        aEventsRange[i].Further = false;
+        aEventsRange[i].PropertyHandle = -1;
     }
     xListener->propertiesChange(events);
 }
@@ -1013,6 +1014,7 @@ css::uno::Sequence< css::uno::Any > 
Access::getHierarchicalPropertyValues(
     osl::MutexGuard g(*lock_);
     css::uno::Sequence< css::uno::Any > vals(
         aHierarchicalPropertyNames.getLength());
+    auto aValsRange = asNonConstRange(vals);
     for (sal_Int32 i = 0; i < aHierarchicalPropertyNames.getLength(); ++i) {
         rtl::Reference< ChildAccess > child(
             getSubChild(aHierarchicalPropertyNames[i]));
@@ -1022,7 +1024,7 @@ css::uno::Sequence< css::uno::Any > 
Access::getHierarchicalPropertyValues(
                  " hierarchical property name"),
                 static_cast< cppu::OWeakObject * >(this), -1);
         }
-        vals[i] = child->asValue();
+        aValsRange[i] = child->asValue();
     }
     return vals;
 }
diff --git a/configmgr/source/configurationregistry.cxx 
b/configmgr/source/configurationregistry.cxx
index c0e945ffc622..e4d86c46e9f2 100644
--- a/configmgr/source/configurationregistry.cxx
+++ b/configmgr/source/configurationregistry.cxx
@@ -246,8 +246,8 @@ void Service::open(OUString const & rURL, sal_Bool 
bReadOnly, sal_Bool)
     if (access_.is()) {
         doClose();
     }
-    css::uno::Sequence< css::uno::Any > args(1);
-    args[0] <<= css::beans::NamedValue("nodepath", css::uno::Any(rURL));
+    css::uno::Sequence< css::uno::Any > args{ css::uno::Any(
+        css::beans::NamedValue("nodepath", css::uno::Any(rURL))) };
     try {
         access_ = provider_->createInstanceWithArguments(
             (bReadOnly
diff --git a/configmgr/source/valueparser.cxx b/configmgr/source/valueparser.cxx
index 6245cb11b654..a70c3231b702 100644
--- a/configmgr/source/valueparser.cxx
+++ b/configmgr/source/valueparser.cxx
@@ -439,8 +439,9 @@ void ValueParser::start(
 
 template< typename T > css::uno::Any ValueParser::convertItems() {
     css::uno::Sequence< T > seq(items_.size());
+    auto seqRange = asNonConstRange(seq);
     for (sal_Int32 i = 0; i < seq.getLength(); ++i) {
-        bool ok = (items_[i] >>= seq[i]);
+        bool ok = (items_[i] >>= seqRange[i]);
         assert(ok);
         (void) ok; // avoid warnings
     }

Reply via email to