xmlhelp/source/cxxhelp/provider/content.cxx      |    4 --
 xmlhelp/source/cxxhelp/provider/contentcaps.cxx  |   29 ++++++++-------
 xmlhelp/source/cxxhelp/provider/databases.cxx    |   43 +++++++++++++----------
 xmlhelp/source/cxxhelp/provider/urlparameter.cxx |    5 +-
 xmlhelp/source/treeview/tvread.cxx               |   11 +----
 5 files changed, 47 insertions(+), 45 deletions(-)

New commits:
commit cae7b855a5fd479e6df822f974870f42e91ce068
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Oct 29 10:27:52 2021 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon Nov 1 07:44:25 2021 +0100

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

diff --git a/xmlhelp/source/cxxhelp/provider/content.cxx 
b/xmlhelp/source/cxxhelp/provider/content.cxx
index f00b17b6277b..001d7ea76eb9 100644
--- a/xmlhelp/source/cxxhelp/provider/content.cxx
+++ b/xmlhelp/source/cxxhelp/provider/content.cxx
@@ -410,9 +410,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
             }
             else if ( rProp.Name == "SearchScopes" )
             {
-                uno::Sequence< OUString > seq( 2 );
-                seq[0] = "Heading";
-                seq[1] = "FullText";
+                uno::Sequence< OUString > seq{ "Heading", "FullText" };
                 xRow->appendObject( rProp, uno::Any(seq) );
             }
             else if ( rProp.Name == "Order" )
diff --git a/xmlhelp/source/cxxhelp/provider/contentcaps.cxx 
b/xmlhelp/source/cxxhelp/provider/contentcaps.cxx
index 15ad6ba6af76..b18061e43474 100644
--- a/xmlhelp/source/cxxhelp/provider/contentcaps.cxx
+++ b/xmlhelp/source/cxxhelp/provider/contentcaps.cxx
@@ -43,44 +43,45 @@ uno::Sequence< beans::Property > Content::getProperties(
     if( isFile )   num++;
 
     uno::Sequence< beans::Property > props(num);
+    auto pprops = props.getArray();
 
     sal_Int32 idx = 0;
-    props[idx++] =
+    pprops[idx++] =
         beans::Property(
             "ContentType",
             -1,
             cppu::UnoType<OUString>::get(),
             beans::PropertyAttribute::BOUND | 
beans::PropertyAttribute::READONLY );
 
-    props[idx++] =
+    pprops[idx++] =
         beans::Property(
             "IsReadOnly",
             -1,
             cppu::UnoType<bool>::get(),
             beans::PropertyAttribute::BOUND | 
beans::PropertyAttribute::READONLY );
 
-    props[idx++] =
+    pprops[idx++] =
         beans::Property(
             "IsErrorDocument",
             -1,
             cppu::UnoType<bool>::get(),
             beans::PropertyAttribute::BOUND | 
beans::PropertyAttribute::READONLY );
 
-    props[idx++] =
+    pprops[idx++] =
         beans::Property(
             "IsDocument",
             -1,
             cppu::UnoType<bool>::get(),
             beans::PropertyAttribute::BOUND | 
beans::PropertyAttribute::READONLY );
 
-    props[idx++] =
+    pprops[idx++] =
         beans::Property(
             "IsFolder",
             -1,
             cppu::UnoType<bool>::get(),
             beans::PropertyAttribute::BOUND | 
beans::PropertyAttribute::READONLY );
 
-    props[idx++] =
+    pprops[idx++] =
         beans::Property(
             "Title",
             -1,
@@ -88,7 +89,7 @@ uno::Sequence< beans::Property > Content::getProperties(
             beans::PropertyAttribute::BOUND | 
beans::PropertyAttribute::READONLY );
 
     if( withMediaType )
-        props[idx++] =
+        pprops[idx++] =
             beans::Property(
                 "MediaType",
                 -1,
@@ -97,42 +98,42 @@ uno::Sequence< beans::Property > Content::getProperties(
 
     if( isModule )
     {
-        props[idx++] =
+        pprops[idx++] =
             beans::Property(
                 "Order",
                 -1,
                 cppu::UnoType<sal_Int32>::get(),
                 beans::PropertyAttribute::BOUND | 
beans::PropertyAttribute::READONLY );
 
-        props[idx++] =
+        pprops[idx++] =
             beans::Property(
                 "KeywordList",
                 -1,
                 cppu::UnoType<uno::Sequence< OUString >>::get(),
                 beans::PropertyAttribute::BOUND | 
beans::PropertyAttribute::READONLY );
 
-        props[idx++] =
+        pprops[idx++] =
             beans::Property(
                 "KeywordRef",
                 -1,
                 cppu::UnoType<uno::Sequence< uno::Sequence< OUString > 
>>::get(),
                 beans::PropertyAttribute::BOUND | 
beans::PropertyAttribute::READONLY );
 
-        props[idx++] =
+        pprops[idx++] =
             beans::Property(
                 "KeywordTitleForRef",
                 -1,
                 cppu::UnoType<uno::Sequence< uno::Sequence< OUString > 
>>::get(),
                 beans::PropertyAttribute::BOUND | 
beans::PropertyAttribute::READONLY );
 
-        props[idx++] =
+        pprops[idx++] =
             beans::Property(
                 "KeywordAnchorForRef",
                 -1,
                 cppu::UnoType<uno::Sequence< uno::Sequence< OUString > 
>>::get(),
                 beans::PropertyAttribute::BOUND | 
beans::PropertyAttribute::READONLY );
 
-        props[idx++] =
+        pprops[idx++] =
             beans::Property(
                 "SearchScopes",
                 -1,
@@ -142,7 +143,7 @@ uno::Sequence< beans::Property > Content::getProperties(
 
     if( isFile )
     {
-        props[idx++] =
+        pprops[idx++] =
             beans::Property(
                 "AnchorName",
                 -1,
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx 
b/xmlhelp/source/cxxhelp/provider/databases.cxx
index b5ca5ade2d11..48e6788b0639 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -55,6 +55,7 @@
 #include <com/sun/star/awt/XVclWindowPeer.hpp>
 #include <com/sun/star/awt/XTopWindow.hpp>
 
+#include <comphelper/propertyvalue.hxx>
 #include <comphelper/storagehelper.hxx>
 
 #include "databases.hxx"
@@ -598,13 +599,16 @@ void KeywordInfo::KeywordElement::init( Databases const 
*pDatabases,helpdatafile
     }
 
     listId.realloc( id.size() );
+    auto plistId = listId.getArray();
     listAnchor.realloc( id.size() );
+    auto plistAnchor = listAnchor.getArray();
     listTitle.realloc( id.size() );
+    auto plistTitle = listTitle.getArray();
 
     for( size_t i = 0; i < id.size(); ++i )
     {
-        listId[i] = id[i];
-        listAnchor[i] = anchor[i];
+        plistId[i] = id[i];
+        plistAnchor[i] = anchor[i];
 
         helpdatafileproxy::HDFData aHDFData;
         const char* pData = nullptr;
@@ -621,7 +625,7 @@ void KeywordInfo::KeywordElement::init( Databases const 
*pDatabases,helpdatafile
 
         OUString title = converter.getTitle();
         pDatabases->replaceName( title );
-        listTitle[i] = title;
+        plistTitle[i] = title;
     }
 }
 
@@ -631,12 +635,16 @@ KeywordInfo::KeywordInfo( const std::vector< 
KeywordElement >& aVec )
       listAnchor( aVec.size() ),
       listTitle( aVec.size() )
 {
+    auto listKeyRange = asNonConstRange(listKey);
+    auto listIdRange = asNonConstRange(listId);
+    auto listAnchorRange = asNonConstRange(listAnchor);
+    auto listTitleRange = asNonConstRange(listTitle);
     for( size_t i = 0; i < aVec.size(); ++i )
     {
-        listKey[i] = aVec[i].key;
-        listId[i] = aVec[i].listId;
-        listAnchor[i] = aVec[i].listAnchor;
-        listTitle[i] = aVec[i].listTitle;
+        listKeyRange[i] = aVec[i].key;
+        listIdRange[i] = aVec[i].listId;
+        listAnchorRange[i] = aVec[i].listAnchor;
+        listTitleRange[i] = aVec[i].listTitle;
     }
 }
 
@@ -802,23 +810,24 @@ Reference< XHierarchicalNameAccess > Databases::jarFile( 
const OUString& jar,
             }
 
             Sequence< Any > aArguments( 2 );
+            auto pArguments = aArguments.getArray();
 
             rtl::Reference<XInputStream_impl> p(new XInputStream_impl( zipFile 
));
             if( p->CtorSuccess() )
             {
-                aArguments[ 0 ] <<= Reference< XInputStream >( p );
+                pArguments[ 0 ] <<= Reference< XInputStream >( p );
             }
             else
             {
                 p.clear();
-                aArguments[ 0 ] <<= zipFile;
+                pArguments[ 0 ] <<= zipFile;
             }
 
             // let ZipPackage be used ( no manifest.xml is required )
             beans::NamedValue aArg;
             aArg.Name = "StorageFormat";
             aArg.Value <<= OUString(ZIP_STORAGE_FORMAT_STRING);
-            aArguments[ 1 ] <<= aArg;
+            pArguments[ 1 ] <<= aArg;
 
             Reference< XInterface > xIfc
                 = m_xSMgr->createInstanceWithArgumentsAndContext(
@@ -1593,14 +1602,12 @@ Reference< XHierarchicalNameAccess > 
JarFileIterator::implGetJarFromPackage
 
     try
     {
-        Sequence< Any > aArguments( 2 );
-        aArguments[ 0 ] <<= zipFile;
-
-        // let ZipPackage be used ( no manifest.xml is required )
-        beans::NamedValue aArg;
-        aArg.Name = "StorageFormat";
-        aArg.Value <<= OUString(ZIP_STORAGE_FORMAT_STRING);
-        aArguments[ 1 ] <<= aArg;
+        Sequence< Any > aArguments{
+            Any(zipFile),
+            // let ZipPackage be used ( no manifest.xml is required )
+            Any(comphelper::makePropertyValue("StorageFormat",
+                                              
OUString(ZIP_STORAGE_FORMAT_STRING)))
+        };
 
         Reference< XMultiComponentFactory >xSMgr = 
m_xContext->getServiceManager();
         Reference< XInterface > xIfc
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx 
b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
index 0474bc5738fa..9393692b7656 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -41,6 +41,7 @@
 #include "urlparameter.hxx"
 #include "databases.hxx"
 
+#include <algorithm>
 #include <memory>
 #include <mutex>
 
@@ -914,8 +915,8 @@ sal_Int32 SAL_CALL InputStreamTransformer::readBytes( 
Sequence< sal_Int8 >& aDat
     if( 0 <= curr && aData.getLength() < curr )
         aData.realloc( curr );
 
-    for( int k = 0; k < curr; ++k )
-        aData[k] = buffer[pos++];
+    std::copy_n(buffer.getStr() + pos, curr, aData.getArray());
+    pos += curr;
 
     return std::max(curr, 0);
 }
diff --git a/xmlhelp/source/treeview/tvread.cxx 
b/xmlhelp/source/treeview/tvread.cxx
index 8a33329f6810..17e3116e26ad 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -259,13 +259,7 @@ TVRead::getByName( const OUString& aName )
 Sequence< OUString > SAL_CALL
 TVRead::getElementNames( )
 {
-    Sequence< OUString > seq( 3 );
-
-    seq[0] = "Title";
-    seq[1] = "TargetURL";
-    seq[2] = "Children";
-
-    return seq;
+    return { "Title", "TargetURL", "Children" };
 }
 
 sal_Bool SAL_CALL
@@ -519,8 +513,9 @@ Sequence< OUString > SAL_CALL
 TVChildTarget::getElementNames( )
 {
     Sequence< OUString > seq( Elements.size() );
+    auto seqRange = asNonConstRange(seq);
     for( size_t i = 0; i < Elements.size(); ++i )
-        seq[i] = OUString::number( 1+i );
+        seqRange[i] = OUString::number( 1+i );
 
     return seq;
 }

Reply via email to