package/qa/cppunit/test_package.cxx               |    8 --
 package/source/xstor/owriteablestream.cxx         |   34 +++++-----
 package/source/xstor/xfactory.cxx                 |   15 ++--
 package/source/xstor/xstorage.cxx                 |   68 ++++++++++----------
 package/source/zipapi/XBufferedThreadedStream.cxx |    3 
 package/source/zipapi/ZipFile.cxx                 |    3 
 package/source/zippackage/ZipPackage.cxx          |   22 +++---
 package/source/zippackage/ZipPackageFolder.cxx    |   13 ++-
 package/source/zippackage/ZipPackageStream.cxx    |   74 +++++++++++-----------
 package/source/zippackage/zipfileaccess.cxx       |   14 ++--
 pyuno/source/module/pyuno.cxx                     |   13 ---
 pyuno/source/module/pyuno_callable.cxx            |    3 
 pyuno/source/module/pyuno_runtime.cxx             |   11 ++-
 13 files changed, 142 insertions(+), 139 deletions(-)

New commits:
commit d0a8d4a973b5ae395b6fa925e27c7a120a324f4a
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Oct 29 09:54:10 2021 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sat Oct 30 20:17:13 2021 +0200

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

diff --git a/package/qa/cppunit/test_package.cxx 
b/package/qa/cppunit/test_package.cxx
index 6f767295618c..022d8a9eea53 100644
--- a/package/qa/cppunit/test_package.cxx
+++ b/package/qa/cppunit/test_package.cxx
@@ -53,12 +53,8 @@ namespace
         BootstrapFixtureBase::setUp();
         OUString aURL = 
m_directories.getURLFromSrc(u"/package/qa/cppunit/data/a2z.zip");
 
-        uno::Sequence<beans::NamedValue> aNVs(1);
-        aNVs[0].Name = "URL";
-        aNVs[0].Value <<= aURL;
-
-        uno::Sequence<uno::Any> aArgs(1);
-        aArgs[0] <<= aNVs;
+        uno::Sequence<beans::NamedValue> aNVs{ { "URL", uno::Any(aURL) } };
+        uno::Sequence<uno::Any> aArgs{ uno::Any(aNVs) };
 
         uno::Reference<uno::XComponentContext> xCxt = 
comphelper::getProcessComponentContext();
         uno::Reference<lang::XMultiComponentFactory> xSvcMgr = 
xCxt->getServiceManager();
diff --git a/package/source/xstor/owriteablestream.cxx 
b/package/source/xstor/owriteablestream.cxx
index c91996d0756c..b141a469ece2 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -775,8 +775,7 @@ void OWriteStream_Impl::Commit()
         return;
 
     uno::Reference< packages::XDataSinkEncrSupport > xNewPackageStream;
-    uno::Sequence< uno::Any > aSeq( 1 );
-    aSeq[0] <<= false;
+    uno::Sequence< uno::Any > aSeq{ uno::Any(false) };
 
     if ( m_xCacheStream.is() )
     {
@@ -959,7 +958,7 @@ uno::Sequence< beans::PropertyValue > 
OWriteStream_Impl::InsertOwnProps(
                 break;
         if (i == aResult.getLength())
             aResult.realloc(i + 1);
-        aResult[i] = aPropVal;
+        aResult.getArray()[i] = aPropVal;
     }
 
     return aResult;
@@ -1030,30 +1029,32 @@ uno::Sequence< beans::PropertyValue > 
OWriteStream_Impl::ReadPackageStreamProper
         nPropNum = 3;
     else if ( m_nStorageType == embed::StorageFormats::PACKAGE )
         nPropNum = 4;
+    assert(nPropNum >= 2);
     uno::Sequence< beans::PropertyValue > aResult( nPropNum );
+    auto aResultRange = asNonConstRange(aResult);
 
     // The "Compressed" property must be set after "MediaType" property,
     // since the setting of the last one can change the value of the first one
 
     if ( m_nStorageType == embed::StorageFormats::OFOPXML || m_nStorageType == 
embed::StorageFormats::PACKAGE )
     {
-        aResult[0].Name = "MediaType";
-        aResult[1].Name = "Compressed";
-        aResult[2].Name = "Size";
+        aResultRange[0].Name = "MediaType";
+        aResultRange[1].Name = "Compressed";
+        aResultRange[2].Name = "Size";
 
         if ( m_nStorageType == embed::StorageFormats::PACKAGE )
-            aResult[3].Name = "Encrypted";
+            aResultRange[3].Name = "Encrypted";
     }
     else
     {
-        aResult[0].Name = "Compressed";
-        aResult[1].Name = "Size";
+        aResultRange[0].Name = "Compressed";
+        aResultRange[1].Name = "Size";
     }
 
     // TODO: may be also raw stream should be marked
 
     uno::Reference< beans::XPropertySet > xPropSet( m_xPackageStream, 
uno::UNO_QUERY_THROW );
-    for ( auto& rProp : asNonConstRange(aResult) )
+    for ( auto& rProp : aResultRange )
     {
         try {
             rProp.Value = xPropSet->getPropertyValue( rProp.Name );
@@ -2612,7 +2613,7 @@ void SAL_CALL OWriteStream::insertRelationshipByID(  
const OUString& sID, const
 
     const beans::StringPair aIDRel("Id", sID);
 
-    sal_Int32 nIDInd = -1;
+    uno::Sequence<beans::StringPair>* pPair = nullptr;
 
     // TODO/LATER: in future the unification of the ID could be checked
     uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = 
getAllRelationships();
@@ -2620,16 +2621,17 @@ void SAL_CALL OWriteStream::insertRelationshipByID(  
const OUString& sID, const
     {
         const auto& rRel = aSeq[nInd];
         if (std::find(rRel.begin(), rRel.end(), aIDRel) != rRel.end())
-            nIDInd = nInd;
+            pPair = &aSeq.getArray()[nInd];
     }
 
-    if ( nIDInd != -1 && !bReplace )
+    if ( pPair && !bReplace )
         throw container::ElementExistException(); // TODO
 
-    if ( nIDInd == -1 )
+    if ( !pPair )
     {
-        nIDInd = aSeq.getLength();
+        sal_Int32 nIDInd = aSeq.getLength();
         aSeq.realloc( nIDInd + 1 );
+        pPair = &aSeq.getArray()[nIDInd];
     }
 
     std::vector<beans::StringPair> aResult;
@@ -2639,7 +2641,7 @@ void SAL_CALL OWriteStream::insertRelationshipByID(  
const OUString& sID, const
     std::copy_if(aEntry.begin(), aEntry.end(), std::back_inserter(aResult),
         [](const beans::StringPair& rRel) { return rRel.First != "Id"; });
 
-    aSeq[nIDInd] = comphelper::containerToSequence(aResult);
+    *pPair = comphelper::containerToSequence(aResult);
 
     m_pImpl->m_aNewRelInfo = aSeq;
     m_pImpl->m_xNewRelInfoStream.clear();
diff --git a/package/source/xstor/xfactory.cxx 
b/package/source/xstor/xfactory.cxx
index f369acca6fd2..575715dab15b 100644
--- a/package/source/xstor/xfactory.cxx
+++ b/package/source/xstor/xfactory.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/io/XSeekable.hpp>
 
 #include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/weak.hxx>
@@ -161,9 +162,7 @@ uno::Reference< uno::XInterface > SAL_CALL 
OStorageFactory::createInstanceWithAr
         {
             if ( !aURL.isEmpty() )
             {
-                aPropsToSet.realloc(1);
-                aPropsToSet[0].Name = "URL";
-                aPropsToSet[0].Value <<= aURL;
+                aPropsToSet = { comphelper::makePropertyValue("URL", aURL) };
             }
 
             sal_Int32 nNumArgs = 1;
@@ -175,8 +174,9 @@ uno::Reference< uno::XInterface > SAL_CALL 
OStorageFactory::createInstanceWithAr
                   || rProp.Name == "StatusIndicator" )
                 {
                     aPropsToSet.realloc( ++nNumArgs );
-                    aPropsToSet[nNumArgs-1].Name = rProp.Name;
-                    aPropsToSet[nNumArgs-1].Value = rProp.Value;
+                    auto pPropsToSet = aPropsToSet.getArray();
+                    pPropsToSet[nNumArgs-1].Name = rProp.Name;
+                    pPropsToSet[nNumArgs-1].Value = rProp.Value;
                 }
                 else if ( rProp.Name == "StorageFormat" )
                 {
@@ -209,8 +209,9 @@ uno::Reference< uno::XInterface > SAL_CALL 
OStorageFactory::createInstanceWithAr
                 {
                     // Forward NoFileSync to the storage.
                     aPropsToSet.realloc(++nNumArgs);
-                    aPropsToSet[nNumArgs - 1].Name = rProp.Name;
-                    aPropsToSet[nNumArgs - 1].Value = rProp.Value;
+                    auto pPropsToSet = aPropsToSet.getArray();
+                    pPropsToSet[nNumArgs - 1].Name = rProp.Name;
+                    pPropsToSet[nNumArgs - 1].Value = rProp.Value;
                 }
                 else
                     OSL_FAIL( "Unacceptable property, will be ignored!" );
diff --git a/package/source/xstor/xstorage.cxx 
b/package/source/xstor/xstorage.cxx
index ddadab15afce..de84e2372bd3 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -120,15 +120,10 @@ void OStorage_Impl::completeStorageStreamCopy_Impl(
         // TODO: headers of encrypted streams should be copied also
         ::comphelper::OStorageHelper::CopyInputToOutput( xSourceInStream, 
xDestOutStream );
 
-        uno::Sequence<OUString> aPropNames { "Compressed" };
+        uno::Sequence<OUString> aPropNames { "Compressed", "MediaType",
+                                             
"UseCommonStoragePasswordEncryption" };
 
-        if ( nStorageType == embed::StorageFormats::PACKAGE )
-        {
-            aPropNames.realloc( 3 );
-            aPropNames[1] = "MediaType";
-            aPropNames[2] = "UseCommonStoragePasswordEncryption";
-        }
-        else if ( nStorageType == embed::StorageFormats::OFOPXML )
+        if ( nStorageType == embed::StorageFormats::OFOPXML )
         {
             // TODO/LATER: in future it might make sense to provide the stream 
if there is one
             uno::Reference< embed::XRelationshipAccess > xRelAccess( xDest, 
uno::UNO_QUERY_THROW );
@@ -136,7 +131,10 @@ void OStorage_Impl::completeStorageStreamCopy_Impl(
             xRelAccess->insertRelationships( aRelInfo, false );
 
             aPropNames.realloc( 2 );
-            aPropNames[1] = "MediaType";
+        }
+        else if ( nStorageType != embed::StorageFormats::PACKAGE )
+        {
+            aPropNames.realloc( 1 );
         }
 
         for ( const auto& rPropName : std::as_const(aPropNames) )
@@ -409,18 +407,19 @@ void OStorage_Impl::OpenOwnPackage()
         if ( !m_xPackage.is() )
         {
             uno::Sequence< uno::Any > aArguments( 2 );
+            auto pArguments = aArguments.getArray();
             if ( m_nStorageMode & embed::ElementModes::WRITE )
-                aArguments[ 0 ] <<= m_xStream;
+                pArguments[ 0 ] <<= m_xStream;
             else
             {
                 SAL_WARN_IF( !m_xInputStream.is(), "package.xstor", "Input 
stream must be set for readonly access!" );
-                aArguments[ 0 ] <<= m_xInputStream;
+                pArguments[ 0 ] <<= m_xInputStream;
                 // TODO: if input stream is not seekable or XSeekable 
interface is supported
                 // on XStream object a wrapper must be used
             }
 
             // do not allow elements to remove themself from the old container 
in case of insertion to another container
-            aArguments[ 1 ] <<= beans::NamedValue( "AllowRemoveOnInsert",
+            pArguments[ 1 ] <<= beans::NamedValue( "AllowRemoveOnInsert",
                                                     uno::makeAny( false ) );
 
             sal_Int32 nArgNum = 2;
@@ -433,7 +432,8 @@ void OStorage_Impl::OpenOwnPackage()
                     // Forward these to the package.
                     beans::NamedValue aNamedValue( rProp.Name, rProp.Value );
                     aArguments.realloc( ++nArgNum );
-                    aArguments[nArgNum-1] <<= aNamedValue;
+                    pArguments = aArguments.getArray();
+                    pArguments[nArgNum-1] <<= aNamedValue;
                 }
                 else if ( rProp.Name == "Password" )
                 {
@@ -449,7 +449,8 @@ void OStorage_Impl::OpenOwnPackage()
                 aNamedValue.Name = "StorageFormat";
                 aNamedValue.Value <<= OUString( "ZipFormat" );
                 aArguments.realloc( ++nArgNum );
-                aArguments[nArgNum-1] <<= aNamedValue;
+                pArguments = aArguments.getArray();
+                pArguments[nArgNum-1] <<= aNamedValue;
             }
             else if ( m_nStorageType == embed::StorageFormats::OFOPXML )
             {
@@ -458,7 +459,8 @@ void OStorage_Impl::OpenOwnPackage()
                 aNamedValue.Name = "StorageFormat";
                 aNamedValue.Value <<= OUString( "OFOPXMLFormat" );
                 aArguments.realloc( ++nArgNum );
-                aArguments[nArgNum-1] <<= aNamedValue;
+                pArguments = aArguments.getArray();
+                pArguments[nArgNum-1] <<= aNamedValue;
             }
 
             m_xPackage.set( 
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
@@ -770,16 +772,18 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* 
pElement,
                     if ( rSrcPkgProp.Name == "MediaType" || rSrcPkgProp.Name 
== "Compressed" )
                     {
                         aStrProps.realloc( ++nNum );
-                        aStrProps[nNum-1].Name = rSrcPkgProp.Name;
-                        aStrProps[nNum-1].Value = rSrcPkgProp.Value;
+                        auto pStrProps = aStrProps.getArray();
+                        pStrProps[nNum-1].Name = rSrcPkgProp.Name;
+                        pStrProps[nNum-1].Value = rSrcPkgProp.Value;
                     }
                 }
 
                 if ( m_nStorageType == embed::StorageFormats::PACKAGE )
                 {
                     aStrProps.realloc( ++nNum );
-                    aStrProps[nNum-1].Name = 
"UseCommonStoragePasswordEncryption";
-                    aStrProps[nNum-1].Value <<= 
pElement->m_xStream->UsesCommonEncryption_Impl();
+                    auto pStrProps = aStrProps.getArray();
+                    pStrProps[nNum-1].Name = 
"UseCommonStoragePasswordEncryption";
+                    pStrProps[nNum-1].Value <<= 
pElement->m_xStream->UsesCommonEncryption_Impl();
                 }
                 else if ( m_nStorageType == embed::StorageFormats::OFOPXML )
                 {
@@ -991,9 +995,7 @@ void OStorage_Impl::Commit()
     // it can be detected by m_bCommited flag ( root storage doesn't need 
temporary representation )
     if ( !m_bCommited && !m_bIsRoot )
     {
-        uno::Sequence< uno::Any > aSeq( 1 );
-        aSeq[0] <<= true;
-
+        uno::Sequence< uno::Any > aSeq{ uno::Any(true) };
         xNewPackageFolder.set( m_xPackage->createInstanceWithArguments( aSeq ),
                                uno::UNO_QUERY );
     }
@@ -1307,8 +1309,7 @@ SotElement_Impl* OStorage_Impl::InsertStream( const 
OUString& aName, bool bEncr
     if ( !m_xPackage.is() )
         throw embed::InvalidStorageException( THROW_WHERE);
 
-    uno::Sequence< uno::Any > aSeq( 1 );
-    aSeq[0] <<= false;
+    uno::Sequence< uno::Any > aSeq{ uno::Any(false) };
     uno::Reference< lang::XUnoTunnel > xNewElement( 
m_xPackage->createInstanceWithArguments( aSeq ),
                                                     uno::UNO_QUERY );
 
@@ -1347,8 +1348,7 @@ void OStorage_Impl::InsertRawStream( const OUString& 
aName, const uno::Reference
     uno::Reference< io::XInputStream > xInStrToInsert = xSeek.is() ? xInStream 
:
                                                                      
GetSeekableTempCopy( xInStream, m_xContext );
 
-    uno::Sequence< uno::Any > aSeq( 1 );
-    aSeq[0] <<= false;
+    uno::Sequence< uno::Any > aSeq{ uno::Any(false) };
     uno::Reference< lang::XUnoTunnel > xNewElement( 
m_xPackage->createInstanceWithArguments( aSeq ),
                                                     uno::UNO_QUERY );
 
@@ -1376,8 +1376,7 @@ std::unique_ptr<OStorage_Impl> 
OStorage_Impl::CreateNewStorageImpl( sal_Int32 nS
     if ( !m_xPackage.is() )
         throw embed::InvalidStorageException( THROW_WHERE );
 
-    uno::Sequence< uno::Any > aSeq( 1 );
-    aSeq[0] <<= true;
+    uno::Sequence< uno::Any > aSeq{ uno::Any(true) };
     uno::Reference< lang::XUnoTunnel > xNewElement( 
m_xPackage->createInstanceWithArguments( aSeq ),
                                                     uno::UNO_QUERY );
 
@@ -4779,7 +4778,7 @@ void SAL_CALL OStorage::insertRelationshipByID(  const 
OUString& sID, const uno:
 
     const beans::StringPair aIDRel("Id", sID);
 
-    sal_Int32 nIDInd = -1;
+    uno::Sequence<beans::StringPair>* pResult = nullptr;
 
     // TODO/LATER: in future the unification of the ID could be checked
     uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = 
getAllRelationships();
@@ -4787,16 +4786,17 @@ void SAL_CALL OStorage::insertRelationshipByID(  const 
OUString& sID, const uno:
     {
         const auto& rRel = aSeq[nInd];
         if (std::find(rRel.begin(), rRel.end(), aIDRel) != rRel.end())
-            nIDInd = nInd;
+            pResult = &aSeq.getArray()[nInd];
     }
 
-    if ( nIDInd != -1 && !bReplace )
+    if ( pResult && !bReplace )
         throw container::ElementExistException( THROW_WHERE );
 
-    if ( nIDInd == -1 )
+    if ( !pResult )
     {
-        nIDInd = aSeq.getLength();
+        const sal_Int32 nIDInd = aSeq.getLength();
         aSeq.realloc( nIDInd + 1 );
+        pResult = &aSeq.getArray()[nIDInd];
     }
 
     std::vector<beans::StringPair> aResult;
@@ -4806,7 +4806,7 @@ void SAL_CALL OStorage::insertRelationshipByID(  const 
OUString& sID, const uno:
     std::copy_if(aEntry.begin(), aEntry.end(), std::back_inserter(aResult),
         [](const beans::StringPair& rPair) { return rPair.First != "Id"; });
 
-    aSeq[nIDInd] = comphelper::containerToSequence(aResult);
+    *pResult = comphelper::containerToSequence(aResult);
 
     m_pImpl->m_aRelInfo = aSeq;
     m_pImpl->m_xNewRelInfoStream.clear();
diff --git a/package/source/zipapi/XBufferedThreadedStream.cxx 
b/package/source/zipapi/XBufferedThreadedStream.cxx
index c36a1845be6c..e2f963bf88c1 100644
--- a/package/source/zipapi/XBufferedThreadedStream.cxx
+++ b/package/source/zipapi/XBufferedThreadedStream.cxx
@@ -137,6 +137,7 @@ sal_Int32 SAL_CALL XBufferedThreadedStream::readBytes( 
Sequence< sal_Int8 >& rDa
 
     const sal_Int32 nAvailableSize = static_cast< sal_Int32 > ( std::min< 
sal_Int64 >( nBytesToRead, remainingSize() ) );
     rData.realloc( nAvailableSize );
+    auto pData = rData.getArray();
     sal_Int32 i = 0, nPendingBytes = nAvailableSize;
 
     while( nPendingBytes )
@@ -149,7 +150,7 @@ sal_Int32 SAL_CALL XBufferedThreadedStream::readBytes( 
Sequence< sal_Int8 >& rDa
         }
         const sal_Int32 limit = std::min<sal_Int32>( nPendingBytes, 
pBuffer.getLength() - mnOffset );
 
-        memcpy( &rData[i], &pBuffer[mnOffset], limit );
+        memcpy( &pData[i], &pBuffer[mnOffset], limit );
 
         nPendingBytes -= limit;
         mnOffset += limit;
diff --git a/package/source/zipapi/ZipFile.cxx 
b/package/source/zipapi/ZipFile.cxx
index 0869d58931c9..2b298e0ebdf8 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -579,10 +579,11 @@ public:
 
         sal_Int32 nReadSize = std::min<sal_Int32>(nBytesToRead, 
remainingSize());
         rData.realloc(nReadSize);
+        auto pData = rData.getArray();
         std::vector<sal_Int8>::const_iterator it = maBytes.cbegin();
         std::advance(it, mnPos);
         for (sal_Int32 i = 0; i < nReadSize; ++i, ++it)
-            rData[i] = *it;
+            pData[i] = *it;
 
         mnPos += nReadSize;
 
diff --git a/package/source/zippackage/ZipPackage.cxx 
b/package/source/zippackage/ZipPackage.cxx
index 8a74267d755f..3882bb887c99 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -1092,6 +1092,7 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& 
aZipOut, const std::vector<
     };
 
     uno::Sequence< beans::StringPair > aOverridesSequence(aManList.size());
+    auto aOverridesSequenceRange = asNonConstRange(aOverridesSequence);
     sal_Int32 nOverSeqLength = 0;
     for (const auto& rMan : aManList)
     {
@@ -1105,8 +1106,8 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& 
aZipOut, const std::vector<
             // only nonempty type makes sense here
             rMan[PKG_MNFST_FULLPATH].Value >>= aPath;
             //FIXME: For now we have no way of differentiating defaults from 
others.
-            aOverridesSequence[nOverSeqLength].First = "/" + aPath;
-            aOverridesSequence[nOverSeqLength].Second = aType;
+            aOverridesSequenceRange[nOverSeqLength].First = "/" + aPath;
+            aOverridesSequenceRange[nOverSeqLength].Second = aType;
             ++nOverSeqLength;
         }
     }
@@ -1255,17 +1256,18 @@ uno::Reference< io::XInputStream > 
ZipPackage::writeTempFile()
         {
             uno::Sequence < PropertyValue > aPropSeq(
                 bIsGpgEncrypt ? PKG_SIZE_NOENCR_MNFST+1 : 
PKG_SIZE_NOENCR_MNFST );
-            aPropSeq [PKG_MNFST_MEDIATYPE].Name = sMediaType;
-            aPropSeq [PKG_MNFST_MEDIATYPE].Value <<= 
m_xRootFolder->GetMediaType();
-            aPropSeq [PKG_MNFST_VERSION].Name = sVersion;
-            aPropSeq [PKG_MNFST_VERSION].Value <<= m_xRootFolder->GetVersion();
-            aPropSeq [PKG_MNFST_FULLPATH].Name = sFullPath;
-            aPropSeq [PKG_MNFST_FULLPATH].Value <<= OUString("/");
+            auto pPropSeq = aPropSeq.getArray();
+            pPropSeq [PKG_MNFST_MEDIATYPE].Name = sMediaType;
+            pPropSeq [PKG_MNFST_MEDIATYPE].Value <<= 
m_xRootFolder->GetMediaType();
+            pPropSeq [PKG_MNFST_VERSION].Name = sVersion;
+            pPropSeq [PKG_MNFST_VERSION].Value <<= m_xRootFolder->GetVersion();
+            pPropSeq [PKG_MNFST_FULLPATH].Name = sFullPath;
+            pPropSeq [PKG_MNFST_FULLPATH].Value <<= OUString("/");
 
             if( bIsGpgEncrypt )
             {
-                aPropSeq[PKG_SIZE_NOENCR_MNFST].Name = "KeyInfo";
-                aPropSeq[PKG_SIZE_NOENCR_MNFST].Value <<= m_aGpgProps;
+                pPropSeq[PKG_SIZE_NOENCR_MNFST].Name = "KeyInfo";
+                pPropSeq[PKG_SIZE_NOENCR_MNFST].Value <<= m_aGpgProps;
             }
             aManList.push_back( aPropSeq );
         }
diff --git a/package/source/zippackage/ZipPackageFolder.cxx 
b/package/source/zippackage/ZipPackageFolder.cxx
index 5ea4213f95fd..5690fd2fb530 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -240,12 +240,13 @@ bool ZipPackageFolder::saveChild(
 
     if ( !GetMediaType().isEmpty() )
     {
-        aPropSet[PKG_MNFST_MEDIATYPE].Name = "MediaType";
-        aPropSet[PKG_MNFST_MEDIATYPE].Value <<= GetMediaType();
-        aPropSet[PKG_MNFST_VERSION].Name = "Version";
-        aPropSet[PKG_MNFST_VERSION].Value <<= GetVersion();
-        aPropSet[PKG_MNFST_FULLPATH].Name = "FullPath";
-        aPropSet[PKG_MNFST_FULLPATH].Value <<= sTempName;
+        auto pPropSet = aPropSet.getArray();
+        pPropSet[PKG_MNFST_MEDIATYPE].Name = "MediaType";
+        pPropSet[PKG_MNFST_MEDIATYPE].Value <<= GetMediaType();
+        pPropSet[PKG_MNFST_VERSION].Name = "Version";
+        pPropSet[PKG_MNFST_VERSION].Value <<= GetVersion();
+        pPropSet[PKG_MNFST_FULLPATH].Name = "FullPath";
+        pPropSet[PKG_MNFST_FULLPATH].Value <<= sTempName;
     }
     else
         aPropSet.realloc( 0 );
diff --git a/package/source/zippackage/ZipPackageStream.cxx 
b/package/source/zippackage/ZipPackageStream.cxx
index 2b3bf5b5e7e3..58f55768066a 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -284,8 +284,7 @@ uno::Reference< io::XInputStream > 
ZipPackageStream::TryToGetRawFromDataStream(
         // create a package based on it
         rtl::Reference<ZipPackage> pPackage = new ZipPackage( m_xContext );
 
-        Sequence< Any > aArgs( 1 );
-        aArgs[0] <<= xTempStream;
+        Sequence< Any > aArgs{ Any(xTempStream) };
         pPackage->initialize( aArgs );
 
         // create a new package stream
@@ -471,12 +470,13 @@ bool ZipPackageStream::saveChild(
     const bool bToBeEncrypted = m_bToBeEncrypted && 
(rEncryptionKey.hasElements() || m_bHaveOwnKey);
     const bool bToBeCompressed = bToBeEncrypted || m_bToBeCompressed;
 
-    aPropSet[PKG_MNFST_MEDIATYPE].Name = "MediaType";
-    aPropSet[PKG_MNFST_MEDIATYPE].Value <<= GetMediaType( );
-    aPropSet[PKG_MNFST_VERSION].Name = "Version";
-    aPropSet[PKG_MNFST_VERSION].Value <<= OUString(); // no version is stored 
for streams currently
-    aPropSet[PKG_MNFST_FULLPATH].Name = "FullPath";
-    aPropSet[PKG_MNFST_FULLPATH].Value <<= pTempEntry->sPath;
+    auto pPropSet = aPropSet.getArray();
+    pPropSet[PKG_MNFST_MEDIATYPE].Name = "MediaType";
+    pPropSet[PKG_MNFST_MEDIATYPE].Value <<= GetMediaType( );
+    pPropSet[PKG_MNFST_VERSION].Name = "Version";
+    pPropSet[PKG_MNFST_VERSION].Value <<= OUString(); // no version is stored 
for streams currently
+    pPropSet[PKG_MNFST_FULLPATH].Name = "FullPath";
+    pPropSet[PKG_MNFST_FULLPATH].Value <<= pTempEntry->sPath;
 
     OSL_ENSURE( m_nStreamMode != PACKAGE_STREAM_NOTSET, "Unacceptable 
ZipPackageStream mode!" );
 
@@ -597,18 +597,18 @@ bool ZipPackageStream::saveChild(
             // last property is digest, which is inserted later if we didn't 
have
             // a magic header
             aPropSet.realloc(PKG_SIZE_ENCR_MNFST);
-
-            aPropSet[PKG_MNFST_INIVECTOR].Name = "InitialisationVector";
-            aPropSet[PKG_MNFST_INIVECTOR].Value <<= 
m_xBaseEncryptionData->m_aInitVector;
-            aPropSet[PKG_MNFST_SALT].Name = "Salt";
-            aPropSet[PKG_MNFST_SALT].Value <<= m_xBaseEncryptionData->m_aSalt;
-            aPropSet[PKG_MNFST_ITERATION].Name = "IterationCount";
-            aPropSet[PKG_MNFST_ITERATION].Value <<= 
m_xBaseEncryptionData->m_nIterationCount;
+            pPropSet = aPropSet.getArray();
+            pPropSet[PKG_MNFST_INIVECTOR].Name = "InitialisationVector";
+            pPropSet[PKG_MNFST_INIVECTOR].Value <<= 
m_xBaseEncryptionData->m_aInitVector;
+            pPropSet[PKG_MNFST_SALT].Name = "Salt";
+            pPropSet[PKG_MNFST_SALT].Value <<= m_xBaseEncryptionData->m_aSalt;
+            pPropSet[PKG_MNFST_ITERATION].Name = "IterationCount";
+            pPropSet[PKG_MNFST_ITERATION].Value <<= 
m_xBaseEncryptionData->m_nIterationCount;
 
             // Need to store the uncompressed size in the manifest
             OSL_ENSURE( m_nOwnStreamOrigSize >= 0, "The stream size was not 
correctly initialized!" );
-            aPropSet[PKG_MNFST_UCOMPSIZE].Name = "Size";
-            aPropSet[PKG_MNFST_UCOMPSIZE].Value <<= m_nOwnStreamOrigSize;
+            pPropSet[PKG_MNFST_UCOMPSIZE].Name = "Size";
+            pPropSet[PKG_MNFST_UCOMPSIZE].Value <<= m_nOwnStreamOrigSize;
 
             if ( m_bRawStream || bTransportOwnEncrStreamAsRaw )
             {
@@ -616,16 +616,16 @@ bool ZipPackageStream::saveChild(
                 if ( !xEncData.is() )
                     throw uno::RuntimeException();
 
-                aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
-                aPropSet[PKG_MNFST_DIGEST].Value <<= 
m_xBaseEncryptionData->m_aDigest;
-                aPropSet[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
-                aPropSet[PKG_MNFST_ENCALG].Value <<= xEncData->m_nEncAlg;
-                aPropSet[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
-                aPropSet[PKG_MNFST_STARTALG].Value <<= 
xEncData->m_nStartKeyGenID;
-                aPropSet[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
-                aPropSet[PKG_MNFST_DIGESTALG].Value <<= xEncData->m_nCheckAlg;
-                aPropSet[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty;
-                aPropSet[PKG_MNFST_DERKEYSIZE].Value <<= 
xEncData->m_nDerivedKeySize;
+                pPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
+                pPropSet[PKG_MNFST_DIGEST].Value <<= 
m_xBaseEncryptionData->m_aDigest;
+                pPropSet[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+                pPropSet[PKG_MNFST_ENCALG].Value <<= xEncData->m_nEncAlg;
+                pPropSet[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
+                pPropSet[PKG_MNFST_STARTALG].Value <<= 
xEncData->m_nStartKeyGenID;
+                pPropSet[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
+                pPropSet[PKG_MNFST_DIGESTALG].Value <<= xEncData->m_nCheckAlg;
+                pPropSet[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty;
+                pPropSet[PKG_MNFST_DERKEYSIZE].Value <<= 
xEncData->m_nDerivedKeySize;
             }
         }
     }
@@ -807,16 +807,16 @@ bool ZipPackageStream::saveChild(
             if ( !xEncData.is() )
                 throw uno::RuntimeException();
 
-            aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
-            aPropSet[PKG_MNFST_DIGEST].Value <<= 
m_xBaseEncryptionData->m_aDigest;
-            aPropSet[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
-            aPropSet[PKG_MNFST_ENCALG].Value <<= xEncData->m_nEncAlg;
-            aPropSet[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
-            aPropSet[PKG_MNFST_STARTALG].Value <<= xEncData->m_nStartKeyGenID;
-            aPropSet[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
-            aPropSet[PKG_MNFST_DIGESTALG].Value <<= xEncData->m_nCheckAlg;
-            aPropSet[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty;
-            aPropSet[PKG_MNFST_DERKEYSIZE].Value <<= 
xEncData->m_nDerivedKeySize;
+            pPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
+            pPropSet[PKG_MNFST_DIGEST].Value <<= 
m_xBaseEncryptionData->m_aDigest;
+            pPropSet[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+            pPropSet[PKG_MNFST_ENCALG].Value <<= xEncData->m_nEncAlg;
+            pPropSet[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
+            pPropSet[PKG_MNFST_STARTALG].Value <<= xEncData->m_nStartKeyGenID;
+            pPropSet[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
+            pPropSet[PKG_MNFST_DIGESTALG].Value <<= xEncData->m_nCheckAlg;
+            pPropSet[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty;
+            pPropSet[PKG_MNFST_DERKEYSIZE].Value <<= 
xEncData->m_nDerivedKeySize;
 
             SetIsEncrypted ( true );
         }
diff --git a/package/source/zippackage/zipfileaccess.cxx 
b/package/source/zippackage/zipfileaccess.cxx
index 801a9fe79e54..1e66e67936b0 100644
--- a/package/source/zippackage/zipfileaccess.cxx
+++ b/package/source/zippackage/zipfileaccess.cxx
@@ -75,6 +75,7 @@ uno::Sequence< OUString > 
OZipFileAccess::GetPatternsFromString_Impl( const OUSt
         return uno::Sequence< OUString >();
 
     uno::Sequence< OUString > aPattern( 1 );
+    auto pPattern = aPattern.getArray();
     sal_Int32 nInd = 0;
 
     const sal_Unicode* pString = aString.getStr();
@@ -86,28 +87,29 @@ uno::Sequence< OUString > 
OZipFileAccess::GetPatternsFromString_Impl( const OUSt
 
             if ( *pString == '\\' )
             {
-                aPattern[nInd] += "\\";
+                pPattern[nInd] += "\\";
                 pString++;
             }
             else if ( *pString == '*' )
             {
-                aPattern[nInd] += "*";
+                pPattern[nInd] += "*";
                 pString++;
             }
             else
             {
                 OSL_FAIL( "The backslash is not guarded!" );
-                aPattern[nInd] += "\\";
+                pPattern[nInd] += "\\";
             }
         }
         else if ( *pString == '*' )
         {
             aPattern.realloc( ( ++nInd ) + 1 );
+            pPattern = aPattern.getArray();
             pString++;
         }
         else
         {
-            aPattern[nInd] += OUStringChar( *pString );
+            pPattern[nInd] += OUStringChar( *pString );
             pString++;
         }
     }
@@ -306,6 +308,7 @@ uno::Sequence< OUString > SAL_CALL 
OZipFileAccess::getElementNames()
         throw uno::RuntimeException(THROW_WHERE);
 
     uno::Sequence< OUString > aNames( m_pZipFile->GetEntryHash().size() );
+    auto pNames = aNames.getArray();
     sal_Int32 nLen = 0;
 
     for ( const auto& rEntry : m_pZipFile->GetEntryHash() )
@@ -314,9 +317,10 @@ uno::Sequence< OUString > SAL_CALL 
OZipFileAccess::getElementNames()
         {
             OSL_FAIL( "The size must be the same!" );
             aNames.realloc( nLen );
+            pNames = aNames.getArray();
         }
 
-        aNames[nLen-1] = rEntry.second.sPath;
+        pNames[nLen-1] = rEntry.second.sPath;
     }
 
     if ( aNames.getLength() != nLen )
commit ce9611d13ff69306f8c44ac53110cc2cb4116e85
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Oct 29 09:55:04 2021 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sat Oct 30 20:16:57 2021 +0200

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

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index a177be410c79..cdd5e417feeb 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -593,8 +593,7 @@ static PyObject* lcl_getitem_XCellRange( PyUNO const * me, 
PyObject* pKey )
     // Single string key is sugar for getCellRangeByName()
     if ( PyUnicode_Check( pKey ) ) {
 
-        aParams.realloc (1);
-        aParams[0] <<= pyString2ustring( pKey );
+        aParams = { Any(pyString2ustring( pKey )) };
         {
             PyThreadDetach antiguard;
             aRet = me->members->xInvocation->invoke (
@@ -632,9 +631,7 @@ static PyObject* lcl_getitem_XCellRange( PyUNO const * me, 
PyObject* pKey )
         if ( ((nKey0_s == -1) || (nKey1_s == -1)) && PyErr_Occurred() )
             return nullptr;
 
-        aParams.realloc( 2 );
-        aParams[0] <<= nKey1_s;
-        aParams[1] <<= nKey0_s;
+        aParams = { Any(nKey1_s), Any(nKey0_s) };
         {
             PyThreadDetach antiguard;
             aRet = me->members->xInvocation->invoke (
@@ -680,11 +677,7 @@ static PyObject* lcl_getitem_XCellRange( PyUNO const * me, 
PyObject* pKey )
 
         if ( nStep0 == 1 && nStep1 == 1 )
         {
-            aParams.realloc (4);
-            aParams[0] <<= nStart1;
-            aParams[1] <<= nStart0;
-            aParams[2] <<= nStop1 - 1;
-            aParams[3] <<= nStop0 - 1;
+            aParams = { Any(nStart1), Any(nStart0), Any(nStop1 - 1), 
Any(nStop0 - 1) };
             {
                 PyThreadDetach antiguard;
                 aRet = me->members->xInvocation->invoke (
diff --git a/pyuno/source/module/pyuno_callable.cxx 
b/pyuno/source/module/pyuno_callable.cxx
index 1c138f71b419..7816bbf7de3b 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -83,8 +83,7 @@ static PyObject* PyUNO_callable_call(
         }
         else
         {
-            aParams.realloc (1);
-            aParams [0] = any_params;
+            aParams = { any_params };
         }
 
         {
diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 8c14bc0d2953..7f3eb7a6e95f 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -581,12 +581,13 @@ static Sequence< Type > invokeGetTypes( const Runtime & r 
, PyObject * o )
 
             // add the XUnoTunnel interface  for uno object identity concept 
(hack)
             ret.realloc( size + 1 );
+            auto pret = ret.getArray();
             for( int i = 0 ; i < size ; i ++ )
             {
                 Any a = r.pyObject2Any(PyTuple_GetItem(types.get(),i));
-                a >>= ret[i];
+                a >>= pret[i];
             }
-            ret[size] = cppu::UnoType<css::lang::XUnoTunnel>::get();
+            pret[size] = cppu::UnoType<css::lang::XUnoTunnel>::get();
         }
     }
     return ret;
@@ -699,9 +700,10 @@ Any Runtime::pyObject2Any(const PyRef & source, enum 
ConversionMode mode) const
     else if (PyTuple_Check (o))
     {
         Sequence<Any> s (PyTuple_Size (o));
+        auto sRange = asNonConstRange(s);
         for (Py_ssize_t i = 0; i < PyTuple_Size (o); i++)
         {
-            s[i] = pyObject2Any (PyTuple_GetItem (o, i), mode );
+            sRange[i] = pyObject2Any (PyTuple_GetItem (o, i), mode );
         }
         a <<= s;
     }
@@ -709,9 +711,10 @@ Any Runtime::pyObject2Any(const PyRef & source, enum 
ConversionMode mode) const
     {
         Py_ssize_t l = PyList_Size (o);
         Sequence<Any> s (l);
+        auto sRange = asNonConstRange(s);
         for (Py_ssize_t i = 0; i < l; i++)
         {
-            s[i] = pyObject2Any (PyList_GetItem (o, i), mode );
+            sRange[i] = pyObject2Any (PyList_GetItem (o, i), mode );
         }
         a <<= s;
     }

Reply via email to