basic/source/classes/sbunoobj.cxx       |   17 +++++++----------
 basic/source/classes/sbxmod.cxx         |    8 +++-----
 basic/source/runtime/comenumwrapper.cxx |    4 +---
 basic/source/runtime/methods1.cxx       |    6 +++---
 basic/source/uno/dlgcont.cxx            |    4 +---
 basic/source/uno/modsizeexceeded.cxx    |    4 +---
 basic/source/uno/namecont.cxx           |   16 +++++-----------
 binaryurp/source/bridge.cxx             |    2 +-
 binaryurp/source/bridgefactory.cxx      |    5 +++--
 9 files changed, 25 insertions(+), 41 deletions(-)

New commits:
commit f6aef99057c08490af49aec0fd5f2601a83c4e76
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Oct 28 16:11:26 2021 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Oct 29 06:50:43 2021 +0200

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

diff --git a/binaryurp/source/bridge.cxx b/binaryurp/source/bridge.cxx
index 9730036ab4a8..3299cd0ed519 100644
--- a/binaryurp/source/bridge.cxx
+++ b/binaryurp/source/bridge.cxx
@@ -950,7 +950,7 @@ void Bridge::removeEventListener(
 void Bridge::sendCommitChangeRequest() {
     assert(mode_ == MODE_REQUESTED || mode_ == MODE_REPLY_1);
     css::uno::Sequence< css::bridge::ProtocolProperty > s(1);
-    s[0].Name = "CurrentContext";
+    s.getArray()[0].Name = "CurrentContext";
     std::vector< BinaryAny > a { mapCppToBinaryAny(css::uno::Any(s)) };
     sendProtPropRequest(OutgoingRequest::KIND_COMMIT_CHANGE, a);
 }
diff --git a/binaryurp/source/bridgefactory.cxx 
b/binaryurp/source/bridgefactory.cxx
index d2fef4383c06..a2dd1fa97fba 100644
--- a/binaryurp/source/bridgefactory.cxx
+++ b/binaryurp/source/bridgefactory.cxx
@@ -141,12 +141,13 @@ BridgeFactory::getExistingBridges() {
     }
     n = static_cast< sal_Int32 >(n + named_.size());
     css::uno::Sequence< css::uno::Reference< css::bridge::XBridge > > s(n);
+    auto r = asNonConstRange(s);
     sal_Int32 i = 0;
     for (auto const& item : unnamed_)
-        s[i++] = item;
+        r[i++] = item;
 
     for (auto const& item : named_)
-        s[i++] = item.second;
+        r[i++] = item.second;
 
     return s;
 }
commit 81a7d46d9f89252146bf3ba4074625bdfe3345f8
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Oct 28 16:09:55 2021 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Oct 29 06:50:32 2021 +0200

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

diff --git a/basic/source/classes/sbunoobj.cxx 
b/basic/source/classes/sbunoobj.cxx
index c1753a67aca0..f9d378ea8865 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -542,6 +542,7 @@ static void implSequenceToMultiDimArray( SbxDimArray*& 
pArray, Sequence< sal_Int
         sal_Int32 nLen = xIdlArray->getLen( aValue );
         for ( sal_Int32 index = 0; index < nLen; ++index )
         {
+            auto pindices = indices.getArray();
             Any aElementAny = xIdlArray->get( aValue, 
static_cast<sal_uInt32>(index) );
             // This detects the dimension were currently processing
             if ( dimCopy == dimension )
@@ -550,15 +551,16 @@ static void implSequenceToMultiDimArray( SbxDimArray*& 
pArray, Sequence< sal_Int
                 if ( sizes.getLength() < dimCopy )
                 {
                     sizes.realloc( sizes.getLength() + 1 );
-                    sizes[ sizes.getLength() - 1 ] = nLen;
+                    sizes.getArray()[ sizes.getLength() - 1 ] = nLen;
                     indices.realloc( indices.getLength() + 1 );
+                    pindices = indices.getArray();
                 }
             }
 
             if ( bIsZeroIndex )
-                indices[ dimCopy - 1 ] = index;
+                pindices[ dimCopy - 1 ] = index;
             else
-                indices[ dimCopy - 1] = index + 1;
+                pindices[ dimCopy - 1] = index + 1;
 
             implSequenceToMultiDimArray( pArray, indices, sizes, aElementAny, 
dimCopy, bIsZeroIndex, &aElementType );
         }
@@ -4385,10 +4387,7 @@ Reference< XInterface > createComListener( const Any& 
aControlAny, const OUStrin
 
     Reference< XInvocation > xProxy = new ModuleInvocationProxy( aPrefix, 
xScopeObj );
 
-    Sequence<Any> args( 3 );
-    args[0] = aControlAny;
-    args[1] <<= aVBAType;
-    args[2] <<= xProxy;
+    Sequence<Any> args{ aControlAny, Any(aVBAType), Any(xProxy) };
 
     try
     {
@@ -4524,9 +4523,7 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, 
SbClassModuleObject* pP
             }
             Reference< XInvocation > xProxy = new ModuleInvocationProxy( 
aPureIfaceName, pProxyClassModuleObject );
 
-            Sequence<Any> args( 2 );
-            args[0] <<= aIfaceName;
-            args[1] <<= xProxy;
+            Sequence<Any> args{ Any(aIfaceName), Any(xProxy) };
 
             Reference< XInterface > xRet;
             try
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 75c323afe848..cdd05c0c1f14 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -2450,9 +2450,10 @@ void SbUserFormModule::triggerMethod( const OUString& 
aMethodToRun, Sequence< An
         SbxValues aVals;
         pMeth->Get( aVals );
 
+        auto pArguments = aArguments.getArray();
         for ( sal_Int32 i = 0; i < aArguments.getLength(); ++i )
         {
-            aArguments[i] = 
sbxToUnoValue(xArray->Get(static_cast<sal_uInt32>(i) + 1));
+            pArguments[i] = 
sbxToUnoValue(xArray->Get(static_cast<sal_uInt32>(i) + 1));
         }
         pMeth->SetParameters( nullptr );
     }
@@ -2536,10 +2537,7 @@ void SbUserFormModule::Unload()
 {
     sal_Int8 nCancel = 0;
 
-    Sequence< Any > aParams;
-    aParams.realloc(2);
-    aParams[0] <<= nCancel;
-    aParams[1] <<= sal_Int8(::ooo::vba::VbQueryClose::vbFormCode);
+    Sequence< Any > aParams = { Any(nCancel), 
Any(sal_Int8(::ooo::vba::VbQueryClose::vbFormCode)) };
 
     triggerMethod( "Userform_QueryClose", aParams);
 
diff --git a/basic/source/runtime/comenumwrapper.cxx 
b/basic/source/runtime/comenumwrapper.cxx
index 7e2432e43b15..b7881a1b9ade 100644
--- a/basic/source/runtime/comenumwrapper.cxx
+++ b/basic/source/runtime/comenumwrapper.cxx
@@ -47,9 +47,7 @@ uno::Any SAL_CALL ComEnumerationWrapper::nextElement()
         {
             uno::Sequence< sal_Int16 > aNamedParamIndex;
             uno::Sequence< uno::Any > aNamedParam;
-            uno::Sequence< uno::Any > aArgs( 1 );
-
-            aArgs[0] <<= m_nCurInd++;
+            uno::Sequence< uno::Any > aArgs{ uno::Any(m_nCurInd++) };
 
             return m_xInvocation->invoke( "item",
                                           aArgs,
diff --git a/basic/source/runtime/methods1.cxx 
b/basic/source/runtime/methods1.cxx
index 8351100c9b62..a7212fc13151 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -2630,7 +2630,7 @@ void SbRtl_NPV(StarBASIC *, SbxArray & rPar, bool)
 
     // convert for calc functions
     Sequence< Sequence< double > > sValues(1);
-    aValues >>= sValues[ 0 ];
+    aValues >>= sValues.getArray()[ 0 ];
     aValues <<= sValues;
 
     Sequence< Any > aParams
@@ -2703,7 +2703,7 @@ void SbRtl_MIRR(StarBASIC *, SbxArray & rPar, bool)
 
     // convert for calc functions
     Sequence< Sequence< double > > sValues(1);
-    aValues >>= sValues[ 0 ];
+    aValues >>= sValues.getArray()[ 0 ];
     aValues <<= sValues;
 
     Sequence< Any > aParams
@@ -2731,7 +2731,7 @@ void SbRtl_IRR(StarBASIC *, SbxArray & rPar, bool)
 
     // convert for calc functions
     Sequence< Sequence< double > > sValues(1);
-    aValues >>= sValues[ 0 ];
+    aValues >>= sValues.getArray()[ 0 ];
     aValues <<= sValues;
 
     // set default values for Optional args
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 56305e820870..31c64aef95f5 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -121,9 +121,7 @@ static bool writeOasis2OOoLibraryElement(
 
     xWriter->setOutputStream( xOutput );
 
-    Sequence<Any> aArgs( 1 );
-    aArgs[0] <<= xWriter;
-
+    Sequence<Any> aArgs{ Any(xWriter) };
     Reference< xml::sax::XDocumentHandler > xHandler(
         xSMgr->createInstanceWithArgumentsAndContext(
             "com.sun.star.comp.Oasis2OOoTransformer",
diff --git a/basic/source/uno/modsizeexceeded.cxx 
b/basic/source/uno/modsizeexceeded.cxx
index 897c460f5940..27c795934961 100644
--- a/basic/source/uno/modsizeexceeded.cxx
+++ b/basic/source/uno/modsizeexceeded.cxx
@@ -36,9 +36,7 @@ ModuleSizeExceeded::ModuleSizeExceeded(const 
std::vector<OUString>& sModules)
 
     m_xAbort = new comphelper::OInteractionAbort;
     m_xApprove = new comphelper::OInteractionApprove;
-    m_lContinuations.realloc(2);
-    m_lContinuations[0] = m_xApprove;
-    m_lContinuations[1] = m_xAbort;
+    m_lContinuations = { m_xApprove, m_xAbort };
 }
 
 bool ModuleSizeExceeded::isAbort() const
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 98b999ecf29e..a2cb37611f08 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -172,10 +172,7 @@ void NameContainer::replaceByName( const OUString& aName, 
const Any& aElement )
         ChangesEvent aEvent;
         aEvent.Source = mpxEventSource;
         aEvent.Base <<= aEvent.Source;
-        aEvent.Changes.realloc( 1 );
-        aEvent.Changes[ 0 ].Accessor <<= aName;
-        aEvent.Changes[ 0 ].Element = aElement;
-        aEvent.Changes[ 0 ].ReplacedElement = aOldElement;
+        aEvent.Changes = { { Any(aName), aElement, aOldElement } };
         maChangesListeners.notifyEach( &XChangesListener::changesOccurred, 
aEvent );
     }
 }
@@ -223,9 +220,7 @@ void NameContainer::insertNoCheck(const OUString& aName, 
const Any& aElement)
         ChangesEvent aEvent;
         aEvent.Source = mpxEventSource;
         aEvent.Base <<= aEvent.Source;
-        aEvent.Changes.realloc( 1 );
-        aEvent.Changes[ 0 ].Accessor <<= aName;
-        aEvent.Changes[ 0 ].Element = aElement;
+        aEvent.Changes = { { Any(aName), aElement, {} } };
         maChangesListeners.notifyEach( &XChangesListener::changesOccurred, 
aEvent );
     }
 }
@@ -277,10 +272,9 @@ void NameContainer::removeByName( const OUString& aName )
         ChangesEvent aEvent;
         aEvent.Source = mpxEventSource;
         aEvent.Base <<= aEvent.Source;
-        aEvent.Changes.realloc( 1 );
-        aEvent.Changes[ 0 ].Accessor <<= aName;
-        // aEvent.Changes[ 0 ].Element remains empty (meaning "replaced with 
nothing")
-        aEvent.Changes[ 0 ].ReplacedElement = aOldElement;
+        aEvent.Changes = { { Any(aName),
+                             {}, // Element remains empty (meaning "replaced 
with nothing")
+                             aOldElement } };
         maChangesListeners.notifyEach( &XChangesListener::changesOccurred, 
aEvent );
     }
 }

Reply via email to