summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-28 21:15:12 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-29 10:31:51 +0200
commit089dbfda13bbc43ef2bc4b4c6f2cb06163545c2d (patch)
tree81d9fc1a0ca0805eb71c67189e6ddb5c4e90bf19 /connectivity
parent5661f257f9edd8bc80bb9dc62855d6bbe88a541f (diff)
Prepare for removal of non-const operator[] from Sequence in connectivity
Change-Id: If92f9af5e248f4b066359fe043adf221102e8561 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124353 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/commontools/CommonTools.cxx8
-rw-r--r--connectivity/source/commontools/ConnectionWrapper.cxx2
-rw-r--r--connectivity/source/commontools/dbtools.cxx8
-rw-r--r--connectivity/source/commontools/paramwrapper.cxx2
-rw-r--r--connectivity/source/cpool/ZPoolCollection.cxx3
-rw-r--r--connectivity/source/drivers/calc/CConnection.cxx17
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx8
-rw-r--r--connectivity/source/drivers/hsqldb/HConnection.cxx14
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageAccess.cxx10
-rw-r--r--connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx2
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx3
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_connection.cxx3
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_driver.cxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_statics.cxx65
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.cxx3
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcontainer.cxx3
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexes.cxx3
-rw-r--r--connectivity/source/drivers/writer/WConnection.cxx17
-rw-r--r--connectivity/source/manager/mdrivermanager.cxx4
20 files changed, 78 insertions, 105 deletions
diff --git a/connectivity/source/commontools/CommonTools.cxx b/connectivity/source/commontools/CommonTools.cxx
index 223129a71e92..b7467c6933ab 100644
--- a/connectivity/source/commontools/CommonTools.cxx
+++ b/connectivity/source/commontools/CommonTools.cxx
@@ -120,10 +120,10 @@ namespace connectivity
{
Reference< XJavaVM > xVM = JavaVirtualMachine::create(_rxContext);
- Sequence<sal_Int8> processID(16);
- rtl_getGlobalProcessId( reinterpret_cast<sal_uInt8*>(processID.getArray()) );
- processID.realloc(17);
- processID[16] = 0;
+ Sequence<sal_Int8> processID(17); // 16 + 1
+ auto pprocessID = processID.getArray();
+ rtl_getGlobalProcessId( reinterpret_cast<sal_uInt8*>(pprocessID) );
+ pprocessID[16] = 0; // RETURN_VIRTUALMACHINE
Any uaJVM = xVM->getJavaVM( processID );
sal_Int64 nTemp;
diff --git a/connectivity/source/commontools/ConnectionWrapper.cxx b/connectivity/source/commontools/ConnectionWrapper.cxx
index 8a0cc852ed98..9ed4f394b5ee 100644
--- a/connectivity/source/commontools/ConnectionWrapper.cxx
+++ b/connectivity/source/commontools/ConnectionWrapper.cxx
@@ -122,7 +122,7 @@ css::uno::Sequence< OUString > SAL_CALL OConnectionWrapper::getSupportedServiceN
{
sal_Int32 nLen = aSupported.getLength();
aSupported.realloc( nLen + 1 );
- aSupported[ nLen ] = sConnectionService;
+ aSupported.getArray()[ nLen ] = sConnectionService;
}
// outta here
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index 88f9e37760c0..8cb7a292c375 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -279,9 +279,7 @@ static Reference< XConnection > getConnection_allowException(
Reference<XInitialization> xIni(xDataSource, UNO_QUERY);
if (xIni.is())
{
- Sequence< Any > aArgs(1);
- NamedValue aParam( "ParentWindow", makeAny(_rxParent) );
- aArgs[0] <<= aParam;
+ Sequence< Any > aArgs{ Any(NamedValue( "ParentWindow", makeAny(_rxParent) )) };
xIni->initialize(aArgs);
}
@@ -319,9 +317,7 @@ static Reference< XConnection > getConnection_allowException(
if (xIni.is())
{
- Sequence< Any > aArgs(1);
- NamedValue aParam( "ParentWindow", makeAny(Reference<XWindow>()) );
- aArgs[0] <<= aParam;
+ Sequence< Any > aArgs{ Any(NamedValue( "ParentWindow", makeAny(Reference<XWindow>()) )) };
xIni->initialize(aArgs);
}
diff --git a/connectivity/source/commontools/paramwrapper.cxx b/connectivity/source/commontools/paramwrapper.cxx
index a914115d895b..8616277c7ddf 100644
--- a/connectivity/source/commontools/paramwrapper.cxx
+++ b/connectivity/source/commontools/paramwrapper.cxx
@@ -158,7 +158,7 @@ namespace dbtools::param
aProperties = m_xDelegatorPSI->getProperties();
sal_Int32 nProperties( aProperties.getLength() );
aProperties.realloc( nProperties + 1 );
- aProperties[ nProperties ] = Property(
+ aProperties.getArray()[ nProperties ] = Property(
"Value",
PROPERTY_ID_VALUE,
::cppu::UnoType< Any >::get(),
diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx
index 30b7f1e366ea..1f5bd030203c 100644
--- a/connectivity/source/cpool/ZPoolCollection.cxx
+++ b/connectivity/source/cpool/ZPoolCollection.cxx
@@ -295,8 +295,7 @@ Reference< XInterface > OPoolCollection::createWithProvider(const Reference< XMu
const OUString& _rPath)
{
OSL_ASSERT(_rxConfProvider.is());
- Sequence< Any > args(1);
- args[0] <<= NamedValue( "nodepath", makeAny(_rPath));
+ Sequence< Any > args{ Any(NamedValue( "nodepath", makeAny(_rPath))) };
Reference< XInterface > xInterface(
_rxConfProvider->createInstanceWithArguments(
"com.sun.star.configuration.ConfigurationAccess",
diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx
index 78bbf7835169..8d4a0c01ebc1 100644
--- a/connectivity/source/drivers/calc/CConnection.cxx
+++ b/connectivity/source/drivers/calc/CConnection.cxx
@@ -104,18 +104,17 @@ Reference< XSpreadsheetDocument> const & OCalcConnection::acquireDoc()
return m_xDoc;
}
// open read-only as long as updating isn't implemented
- Sequence<PropertyValue> aArgs(2);
- aArgs[0].Name = "Hidden";
- aArgs[0].Value <<= true;
- aArgs[1].Name = "ReadOnly";
- aArgs[1].Value <<= true;
+ Sequence<PropertyValue> aArgs(m_sPassword.isEmpty() ? 2 : 3);
+ auto pArgs = aArgs.getArray();
+ pArgs[0].Name = "Hidden";
+ pArgs[0].Value <<= true;
+ pArgs[1].Name = "ReadOnly";
+ pArgs[1].Value <<= true;
if ( !m_sPassword.isEmpty() )
{
- const sal_Int32 nPos = aArgs.getLength();
- aArgs.realloc(nPos+1);
- aArgs[nPos].Name = "Password";
- aArgs[nPos].Value <<= m_sPassword;
+ pArgs[2].Name = "Password";
+ pArgs[2].Value <<= m_sPassword;
}
Reference< XDesktop2 > xDesktop = Desktop::create( getDriver()->getComponentContext() );
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 73a0d5db7df1..c153ebc909eb 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -2332,10 +2332,10 @@ namespace
{
Content aContent(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
- Sequence< PropertyValue > aProps( 1 );
- aProps[0].Name = "Title";
- aProps[0].Handle = -1; // n/a
- aProps[0].Value <<= sNewName;
+ Sequence< PropertyValue > aProps{ { "Title",
+ -1, // n/a
+ Any(sNewName),
+ css::beans::PropertyState_DIRECT_VALUE } };
Sequence< Any > aValues;
aContent.executeCommand( "setPropertyValues",makeAny(aProps) ) >>= aValues;
if(aValues.hasElements() && aValues[0].hasValue())
diff --git a/connectivity/source/drivers/hsqldb/HConnection.cxx b/connectivity/source/drivers/hsqldb/HConnection.cxx
index c3ff0169cea7..506bf5b075f9 100644
--- a/connectivity/source/drivers/hsqldb/HConnection.cxx
+++ b/connectivity/source/drivers/hsqldb/HConnection.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/sdbc/XDatabaseMetaData2.hpp>
+#include <comphelper/propertyvalue.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
@@ -315,13 +316,12 @@ namespace connectivity::hsqldb
xProvider.set( GraphicProvider::create(m_xContext) );
// ask the provider to obtain a graphic
- Sequence< PropertyValue > aMediaProperties( 1 );
- aMediaProperties[0].Name = "URL";
- aMediaProperties[0].Value <<= OUString(
- // load the graphic from the global graphic repository
- "private:graphicrepository/"
- // the relative path within the images.zip
- LINKED_TEXT_TABLE_IMAGE_RESOURCE);
+ Sequence< PropertyValue > aMediaProperties{ comphelper::makePropertyValue(
+ "URL", OUString(
+ // load the graphic from the global graphic repository
+ "private:graphicrepository/"
+ // the relative path within the images.zip
+ LINKED_TEXT_TABLE_IMAGE_RESOURCE)) };
xGraphic = xProvider->queryGraphic( aMediaProperties );
OSL_ENSURE( xGraphic.is(), "OHsqlConnection::impl_getTextTableIcon_nothrow: the provider did not give us a graphic object!" );
}
diff --git a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
index 4e939ad58603..09ab485d9fd7 100644
--- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
@@ -26,6 +26,8 @@
#include <string.h>
+#include <algorithm>
+
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::embed;
@@ -229,7 +231,7 @@ jint read_from_storage_stream_into_buffer( JNIEnv * env, jstring name, jstring k
if (nBytesRead <= 0)
return -1;
- env->SetByteArrayRegion(buffer,off,nBytesRead,reinterpret_cast<jbyte*>(&aData[0]));
+ env->SetByteArrayRegion(buffer,off,nBytesRead,reinterpret_cast<const jbyte*>(&aData[0]));
return nBytesRead;
}
@@ -299,10 +301,8 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Nativ
}
Sequence< sal_Int32 > ch(4);
- for(sal_Int32 i = 0;i < 4; ++i)
- {
- ch[i] = static_cast<unsigned char>(aData[i]);
- }
+ std::transform(aData.begin(), aData.end(), ch.getArray(),
+ [](auto c) { return static_cast<unsigned char>(c); });
if ((ch[0] | ch[1] | ch[2] | ch[3]) < 0)
{
diff --git a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx
index 7ddf79aa5e77..4fcbbc5aa6cd 100644
--- a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx
+++ b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx
@@ -277,7 +277,7 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora
}
OSL_ENSURE(nLen >= nBytesRead,"Buffer is too small!");
OSL_ENSURE(aData.getLength() >= nBytesRead,"Buffer is too small!");
- env->SetByteArrayRegion(buffer, 0, nBytesRead, reinterpret_cast<jbyte*>(&aData[0]));
+ env->SetByteArrayRegion(buffer, 0, nBytesRead, reinterpret_cast<const jbyte*>(&aData[0]));
#ifdef HSQLDB_DBG
aDataLog.write( &aData[0], nBytesRead );
#endif
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
index 4dd9110a6f0f..18d95cdbdb81 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
@@ -168,11 +168,12 @@ namespace connectivity::mozab
sal_Int32 index=static_cast<sal_Int32>(product);
ProductStruct &rProduct = m_ProductProfileList[index];
list.realloc(static_cast<sal_Int32>(rProduct.mProfileList.size()));
+ auto listRange = list.getArray();
sal_Int32 i=0;
for(const auto& rEntry : rProduct.mProfileList)
{
const ProfileStruct& rProfile = rEntry.second;
- list[i] = rProfile.getProfileName();
+ listRange[i] = rProfile.getProfileName();
i++;
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index 600e131b89b1..4cf9e916f3df 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
@@ -460,9 +460,8 @@ OUString OConnection::transFormPreparedStatement(const OUString& _sSQL)
{
try
{
- Sequence<Any> aArgs(1);
Reference<XConnection> xCon = this;
- aArgs[0] <<= NamedValue("ActiveConnection", makeAny(xCon));
+ Sequence<Any> aArgs{ Any(NamedValue("ActiveConnection", makeAny(xCon))) };
m_xParameterSubstitution.set(
m_xDriver->getFactory()->createInstanceWithArguments(
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
index 13afe4fbbb5e..a96d70f3461e 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
@@ -41,8 +41,6 @@ static void lcl_setRows_throw(const Reference<XResultSet>& _xResultSet, sal_Int3
const std::vector<std::vector<Any>>& _rRows)
{
Reference<XInitialization> xIni(_xResultSet, UNO_QUERY);
- Sequence<Any> aArgs(2);
- aArgs[0] <<= _nType;
Sequence<Sequence<Any>> aRows(_rRows.size());
@@ -55,7 +53,7 @@ static void lcl_setRows_throw(const Reference<XResultSet>& _xResultSet, sal_Int3
}
++pRowsIter;
}
- aArgs[1] <<= aRows;
+ Sequence<Any> aArgs{ Any(_nType), Any(aRows) };
xIni->initialize(aArgs);
}
diff --git a/connectivity/source/drivers/postgresql/pq_driver.cxx b/connectivity/source/drivers/postgresql/pq_driver.cxx
index 2a5becec5149..09fe61ab2824 100644
--- a/connectivity/source/drivers/postgresql/pq_driver.cxx
+++ b/connectivity/source/drivers/postgresql/pq_driver.cxx
@@ -70,9 +70,7 @@ Reference< XConnection > Driver::connect(
if( ! acceptsURL( url ) ) // XDriver spec tells me to do so ...
return Reference< XConnection > ();
- Sequence< Any > seq ( 2 );
- seq[0] <<= url;
- seq[1] <<= info;
+ Sequence< Any > seq{ Any(url), Any(info) };
return Reference< XConnection> (
m_smgr->createInstanceWithArgumentsAndContext(
"org.openoffice.comp.connectivity.pq.Connection.noext",
diff --git a/connectivity/source/drivers/postgresql/pq_statics.cxx b/connectivity/source/drivers/postgresql/pq_statics.cxx
index c4bee2152ef2..7169f4617821 100644
--- a/connectivity/source/drivers/postgresql/pq_statics.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statics.cxx
@@ -89,9 +89,10 @@ static cppu::IPropertyArrayHelper * createPropertyArrayHelper(
PropertyDef const *props, int count , sal_Int16 attr )
{
Sequence< Property > seq( count );
+ auto seqRange = asNonConstRange(seq);
for( int i = 0 ; i < count ; i ++ )
{
- seq[i] = Property( props[i].name, i, props[i].type, attr );
+ seqRange[i] = Property( props[i].name, i, props[i].type, attr );
}
return new cppu::OPropertyArrayHelper( seq, true );
}
@@ -100,9 +101,10 @@ static cppu::IPropertyArrayHelper * createPropertyArrayHelper(
PropertyDefEx const *props, int count )
{
Sequence< Property > seq( count );
+ auto seqRange = asNonConstRange(seq);
for( int i = 0 ; i < count ; i ++ )
{
- seq[i] = Property( props[i].name, i, props[i].type, props[i].attribute );
+ seqRange[i] = Property( props[i].name, i, props[i].type, props[i].attribute );
}
return new cppu::OPropertyArrayHelper( seq, true );
}
@@ -184,8 +186,7 @@ Statics & getStatics()
// Table props set
ImplementationStatics &ist = statics.refl.table;
ist.implName = "org.openoffice.comp.pq.sdbcx.Table";
- ist.serviceNames = Sequence< OUString > ( 1 );
- ist.serviceNames[0] = "com.sun.star.sdbcx.Table";
+ ist.serviceNames = { "com.sun.star.sdbcx.Table" };
PropertyDef tableDef[] =
{
PropertyDef( statics.CATALOG_NAME , tString ),
@@ -214,8 +215,7 @@ Statics & getStatics()
// Column props set
statics.refl.column.implName = "org.openoffice.comp.pq.sdbcx.Column";
- statics.refl.column.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.column.serviceNames[0] = "com.sun.star.sdbcx.Column";
+ statics.refl.column.serviceNames = { "com.sun.star.sdbcx.Column" };
PropertyDefEx columnDef[] =
{
PropertyDefEx( statics.CATALOG_NAME , tString, READONLY ),
@@ -237,9 +237,7 @@ Statics & getStatics()
statics.refl.columnDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.ColumnDescriptor";
- statics.refl.columnDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.columnDescriptor.serviceNames[0] =
- "com.sun.star.sdbcx.ColumnDescriptor";
+ statics.refl.columnDescriptor.serviceNames = { "com.sun.star.sdbcx.ColumnDescriptor" };
PropertyDef columnDescDef[] =
{
PropertyDef( statics.CATALOG_NAME , tString ),
@@ -262,8 +260,7 @@ Statics & getStatics()
// Key properties
statics.refl.key.implName = "org.openoffice.comp.pq.sdbcx.Key";
- statics.refl.key.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.key.serviceNames[0] = "com.sun.star.sdbcx.Key";
+ statics.refl.key.serviceNames = { "com.sun.star.sdbcx.Key" };
PropertyDef keyDef[] =
{
PropertyDef( statics.DELETE_RULE, tInt ),
@@ -281,9 +278,7 @@ Statics & getStatics()
// Key properties
statics.refl.keyDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.KeyDescriptor";
- statics.refl.keyDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.keyDescriptor.serviceNames[0] =
- "com.sun.star.sdbcx.KeyDescriptor";
+ statics.refl.keyDescriptor.serviceNames = { "com.sun.star.sdbcx.KeyDescriptor" };
PropertyDef keyDescDef[] =
{
PropertyDef( statics.DELETE_RULE, tInt ),
@@ -298,8 +293,7 @@ Statics & getStatics()
// KeyColumn props set
statics.refl.keycolumn.implName = "org.openoffice.comp.pq.sdbcx.KeyColumn";
- statics.refl.keycolumn.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.keycolumn.serviceNames[0] = "com.sun.star.sdbcx.KeyColumn";
+ statics.refl.keycolumn.serviceNames = { "com.sun.star.sdbcx.KeyColumn" };
PropertyDef keycolumnDef[] =
{
PropertyDef( statics.CATALOG_NAME , tString ),
@@ -322,9 +316,8 @@ Statics & getStatics()
// KeyColumn props set
statics.refl.keycolumnDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.KeyColumnDescriptor";
- statics.refl.keycolumnDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.keycolumnDescriptor.serviceNames[0] =
- "com.sun.star.sdbcx.KeyColumnDescriptor";
+ statics.refl.keycolumnDescriptor.serviceNames =
+ { "com.sun.star.sdbcx.KeyColumnDescriptor" };
PropertyDef keycolumnDescDef[] =
{
PropertyDef( statics.NAME , tString ),
@@ -335,8 +328,7 @@ Statics & getStatics()
// view props set
statics.refl.view.implName = "org.openoffice.comp.pq.sdbcx.View";
- statics.refl.view.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.view.serviceNames[0] = "com.sun.star.sdbcx.View";
+ statics.refl.view.serviceNames = { "com.sun.star.sdbcx.View" };
PropertyDef viewDef[] =
{
PropertyDef( statics.CATALOG_NAME , tString ),
@@ -350,14 +342,12 @@ Statics & getStatics()
// view props set
statics.refl.viewDescriptor.implName = "org.openoffice.comp.pq.sdbcx.ViewDescriptor";
- statics.refl.viewDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.viewDescriptor.serviceNames[0] = "com.sun.star.sdbcx.ViewDescriptor";
+ statics.refl.viewDescriptor.serviceNames = { "com.sun.star.sdbcx.ViewDescriptor" };
statics.refl.viewDescriptor.pProps = createPropertyArrayHelper(
viewDef, SAL_N_ELEMENTS(viewDef), 0 ); // reuse view, as it is identical
// user props set
statics.refl.user.implName = "org.openoffice.comp.pq.sdbcx.User";
- statics.refl.user.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.user.serviceNames[0] = "com.sun.star.sdbcx.User";
+ statics.refl.user.serviceNames = { "com.sun.star.sdbcx.User" };
PropertyDef userDefRO[] =
{
PropertyDef( statics.NAME , tString )
@@ -368,9 +358,7 @@ Statics & getStatics()
// user props set
statics.refl.userDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.UserDescriptor";
- statics.refl.userDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.userDescriptor.serviceNames[0] =
- "com.sun.star.sdbcx.UserDescriptor";
+ statics.refl.userDescriptor.serviceNames = { "com.sun.star.sdbcx.UserDescriptor" };
PropertyDef userDefWR[] =
{
PropertyDef( statics.NAME , tString ),
@@ -381,8 +369,7 @@ Statics & getStatics()
// index props set
statics.refl.index.implName = "org.openoffice.comp.pq.sdbcx.Index";
- statics.refl.index.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.index.serviceNames[0] = "com.sun.star.sdbcx.Index";
+ statics.refl.index.serviceNames = { "com.sun.star.sdbcx.Index" };
PropertyDef indexDef[] =
{
PropertyDef( statics.CATALOG , tString ),
@@ -398,16 +385,13 @@ Statics & getStatics()
// index props set
statics.refl.indexDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.IndexDescriptor";
- statics.refl.indexDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.indexDescriptor.serviceNames[0] =
- "com.sun.star.sdbcx.IndexDescriptor";
+ statics.refl.indexDescriptor.serviceNames = { "com.sun.star.sdbcx.IndexDescriptor" };
statics.refl.indexDescriptor.pProps = createPropertyArrayHelper(
indexDef, SAL_N_ELEMENTS(indexDef), 0 );
// indexColumn props set
statics.refl.indexColumn.implName = "org.openoffice.comp.pq.sdbcx.IndexColumn";
- statics.refl.indexColumn.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.indexColumn.serviceNames[0] = "com.sun.star.sdbcx.IndexColumn";
+ statics.refl.indexColumn.serviceNames = { "com.sun.star.sdbcx.IndexColumn" };
PropertyDef indexColumnDef[] =
{
PropertyDef( statics.CATALOG_NAME , tString ),
@@ -430,9 +414,8 @@ Statics & getStatics()
// indexColumn props set
statics.refl.indexColumnDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.IndexColumnDescriptor";
- statics.refl.indexColumnDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.indexColumnDescriptor.serviceNames[0] =
- "com.sun.star.sdbcx.IndexColumnDescriptor";
+ statics.refl.indexColumnDescriptor.serviceNames =
+ { "com.sun.star.sdbcx.IndexColumnDescriptor" };
PropertyDef indexColumnDescDef[] =
{
PropertyDef( statics.IS_ASCENDING, tBool ),
@@ -443,8 +426,7 @@ Statics & getStatics()
// resultset
statics.refl.resultSet.implName = "org.openoffice.comp.pq.ResultSet";
- statics.refl.resultSet.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.resultSet.serviceNames[0] = "com.sun.star.sdbc.ResultSet";
+ statics.refl.resultSet.serviceNames = { "com.sun.star.sdbc.ResultSet" };
statics.refl.resultSet.types = UpdateableResultSet::getStaticTypes( false /* updateable */ );
PropertyDef resultSet[] =
{
@@ -461,8 +443,7 @@ Statics & getStatics()
// updateableResultset
statics.refl.updateableResultSet.implName = "org.openoffice.comp.pq.UpdateableResultSet";
- statics.refl.updateableResultSet.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.updateableResultSet.serviceNames[0] = "com.sun.star.sdbc.ResultSet";
+ statics.refl.updateableResultSet.serviceNames = { "com.sun.star.sdbc.ResultSet" };
statics.refl.updateableResultSet.types = UpdateableResultSet::getStaticTypes( true /* updateable */ );
statics.refl.updateableResultSet.pProps = createPropertyArrayHelper(
resultSet, SAL_N_ELEMENTS(resultSet), 0 );
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 1bb089a5407a..9b75d69ba46c 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -918,11 +918,12 @@ Sequence< OUString > convertMappedIntArray2StringArray(
const Int2StringMap &map, const Sequence< sal_Int32 > &intArray )
{
Sequence< OUString > ret( intArray.getLength() );
+ auto retRange = asNonConstRange(ret);
for( int i = 0; i < intArray.getLength() ; i ++ )
{
Int2StringMap::const_iterator ii = map.find( intArray[i] );
if( ii != map.end() )
- ret[i] = ii->second;
+ retRange[i] = ii->second;
}
return ret;
}
diff --git a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
index 6f368a5290c8..d2bcf941a68d 100644
--- a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
@@ -163,10 +163,11 @@ Any Container::getByName( const OUString& aName )
Sequence< OUString > Container::getElementNames( )
{
Sequence< OUString > ret( m_values.size() );
+ auto retRange = asNonConstRange(ret);
for( const auto& [rName, rIndex] : m_name2index )
{
// give element names in index order !
- ret[rIndex] = rName;
+ retRange[rIndex] = rName;
}
return ret;
}
diff --git a/connectivity/source/drivers/postgresql/pq_xindexes.cxx b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
index 5f97fed9510a..332a9a9e5311 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexes.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
@@ -153,9 +153,10 @@ void Indexes::refresh()
std::vector< sal_Int32 > seq = parseIntArray( row->getString( C_COLUMNS ) );
Sequence< OUString > columnNames(seq.size());
+ auto columnNamesRange = asNonConstRange(columnNames);
for( size_t columns = 0 ; columns < seq.size() ; columns ++ )
{
- columnNames[columns] = column2NameMap[ seq[columns] ];
+ columnNamesRange[columns] = column2NameMap[ seq[columns] ];
}
pIndex->setPropertyValue_NoBroadcast_public(
diff --git a/connectivity/source/drivers/writer/WConnection.cxx b/connectivity/source/drivers/writer/WConnection.cxx
index d8fd10302e00..385692951518 100644
--- a/connectivity/source/drivers/writer/WConnection.cxx
+++ b/connectivity/source/drivers/writer/WConnection.cxx
@@ -97,18 +97,17 @@ uno::Reference<text::XTextDocument> const& OWriterConnection::acquireDoc()
return m_xDoc;
}
// open read-only as long as updating isn't implemented
- uno::Sequence<beans::PropertyValue> aArgs(2);
- aArgs[0].Name = "Hidden";
- aArgs[0].Value <<= true;
- aArgs[1].Name = "ReadOnly";
- aArgs[1].Value <<= true;
+ uno::Sequence<beans::PropertyValue> aArgs(m_sPassword.isEmpty() ? 2 : 3);
+ auto pArgs = aArgs.getArray();
+ pArgs[0].Name = "Hidden";
+ pArgs[0].Value <<= true;
+ pArgs[1].Name = "ReadOnly";
+ pArgs[1].Value <<= true;
if (!m_sPassword.isEmpty())
{
- const sal_Int32 nPos = aArgs.getLength();
- aArgs.realloc(nPos + 1);
- aArgs[nPos].Name = "Password";
- aArgs[nPos].Value <<= m_sPassword;
+ pArgs[2].Name = "Password";
+ pArgs[2].Value <<= m_sPassword;
}
uno::Reference<frame::XDesktop2> xDesktop
diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx
index c48d3b9c06f9..bef3c8d74eaa 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -186,8 +186,8 @@ Any SAL_CALL ODriverEnumeration::nextElement( )
css::configuration::theDefaultProvider::get( _rContext ) );
// one argument for creating the node access: the path to the configuration node
- Sequence< Any > aCreationArgs(1);
- aCreationArgs[0] <<= NamedValue( "nodepath", makeAny( OUString("org.openoffice.Office.DataAccess/DriverManager") ) );
+ Sequence< Any > aCreationArgs{ Any(NamedValue(
+ "nodepath", makeAny( OUString("org.openoffice.Office.DataAccess/DriverManager") ) )) };
// create the node access
Reference< XNameAccess > xDriverManagerNode(