summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-29 10:08:39 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-31 15:49:25 +0100
commit1a5ddf061ef53fb9feda0ee319fa36cadef020da (patch)
tree3366342b899487a61ed9a95e66b6bd267ca632dc /stoc
parent5b54ba7084d6b575814af26be30cf5af5dfca12c (diff)
Prepare for removal of non-const operator[] from Sequence in stoc
Change-Id: I2aabd9a1c764ae69a933bdb4df635ebb0c91f0cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124393 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/corereflection/criface.cxx3
-rw-r--r--stoc/source/implementationregistration/implreg.cxx8
-rw-r--r--stoc/source/javaloader/javaloader.cxx2
-rw-r--r--stoc/source/javavm/interact.cxx4
-rw-r--r--stoc/source/security/file_policy.cxx4
-rw-r--r--stoc/source/servicemanager/servicemanager.cxx16
-rw-r--r--stoc/source/simpleregistry/simpleregistry.cxx15
7 files changed, 27 insertions, 25 deletions
diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx
index de8f9380a2f7..88dcc29ffdb7 100644
--- a/stoc/source/corereflection/criface.cxx
+++ b/stoc/source/corereflection/criface.cxx
@@ -743,8 +743,9 @@ Sequence< Reference< XIdlClass > > InterfaceIdlClassImpl::getSuperclasses()
if (!_xSuperClasses.hasElements()) {
typelib_InterfaceTypeDescription * pType = getTypeDescr();
_xSuperClasses.realloc(pType->nBaseTypes);
+ auto pSuperClasses = _xSuperClasses.getArray();
for (sal_Int32 i = 0; i < pType->nBaseTypes; ++i) {
- _xSuperClasses[i] = getReflection()->forType(
+ pSuperClasses[i] = getReflection()->forType(
&pType->ppBaseTypes[i]->aBase);
OSL_ASSERT(_xSuperClasses[i].is());
}
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index 912ed434d29e..d0d57055b59d 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -674,18 +674,18 @@ void delete_all_singleton_entries(
catch (registry::InvalidValueException &)
{
}
- OUString const * p = registered_implnames.getConstArray();
+ auto aNonConstRange = asNonConstRange(registered_implnames);
sal_Int32 nOrigRegLength = registered_implnames.getLength();
sal_Int32 nNewLength = nOrigRegLength;
for ( sal_Int32 n = nOrigRegLength; n--; )
{
- OUString const & registered_implname = p[ n ];
+ OUString const & registered_implname = registered_implnames[ n ];
for (auto const& impl_name : impl_names)
{
if (impl_name == registered_implname)
{
- registered_implnames[ n ] = p[ nNewLength -1 ];
+ aNonConstRange[ n ] = registered_implnames[ nNewLength -1 ];
--nNewLength;
}
}
@@ -890,7 +890,7 @@ void insert_singletons(
{
// append and write back
implnames.realloc( implnames.getLength() +1 );
- implnames[ implnames.getLength() -1 ] = implname;
+ implnames.getArray()[ implnames.getLength() -1 ] = implname;
xRegisteredImplNames->setAsciiListValue( implnames );
}
}
diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx
index 08a6e94b9318..dfb281ae99fb 100644
--- a/stoc/source/javaloader/javaloader.cxx
+++ b/stoc/source/javaloader/javaloader.cxx
@@ -136,7 +136,7 @@ const css::uno::Reference<XImplementationLoader> & JavaComponentLoader::getJavaL
// underlying JavaVM pointer:
Sequence<sal_Int8> processID(17);
rtl_getGlobalProcessId(reinterpret_cast<sal_uInt8 *>(processID.getArray()));
- processID[16] = 1;
+ processID.getArray()[16] = 1;
// We get a non-refcounted pointer to a jvmaccess::UnoVirtualMachine
// from the XJavaVM service (the pointer is guaranteed to be valid
diff --git a/stoc/source/javavm/interact.cxx b/stoc/source/javavm/interact.cxx
index 4836a0710c2d..d1399c065a89 100644
--- a/stoc/source/javavm/interact.cxx
+++ b/stoc/source/javavm/interact.cxx
@@ -81,10 +81,8 @@ bool InteractionRequest::RetryContinuation::isSelected() const
InteractionRequest::InteractionRequest(css::uno::Any const & rRequest):
m_aRequest(rRequest)
{
- m_aContinuations.realloc(2);
m_xRetryContinuation = new RetryContinuation;
- m_aContinuations[0] = new AbortContinuation;
- m_aContinuations[1] = m_xRetryContinuation.get();
+ m_aContinuations = { new AbortContinuation, m_xRetryContinuation };
}
css::uno::Any SAL_CALL InteractionRequest::getRequest()
diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx
index 85825886b9ea..11c54444adef 100644
--- a/stoc/source/security/file_policy.cxx
+++ b/stoc/source/security/file_policy.cxx
@@ -444,14 +444,14 @@ void FilePolicy::refresh()
Sequence< Any > perms( userPermissions[ userId ] );
sal_Int32 len = perms.getLength();
perms.realloc( len +1 );
- perms[ len ] = perm;
+ perms.getArray()[ len ] = perm;
userPermissions[ userId ] = perms;
}
else
{
sal_Int32 len = defaultPermissions.getLength();
defaultPermissions.realloc( len +1 );
- defaultPermissions[ len ] = perm;
+ defaultPermissions.getArray()[ len ] = perm;
}
token = reader.assureToken(); // next permissions token
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index 82f0335a0808..5fb5b3962495 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -641,9 +641,8 @@ Reference<XPropertySetInfo > OServiceManager::getPropertySetInfo()
check_undisposed();
if (! m_xPropertyInfo.is())
{
- Sequence< beans::Property > seq( 1 );
- seq[ 0 ] = beans::Property(
- "DefaultContext", -1, cppu::UnoType<decltype(m_xContext)>::get(), 0 );
+ Sequence< beans::Property > seq{ beans::Property(
+ "DefaultContext", -1, cppu::UnoType<decltype(m_xContext)>::get(), 0 ) };
Reference< beans::XPropertySetInfo > xInfo( new PropertySetInfo_Impl( seq ) );
MutexGuard aGuard( m_mutex );
@@ -1422,12 +1421,11 @@ Reference<XPropertySetInfo > ORegistryServiceManager::getPropertySetInfo()
check_undisposed();
if (! m_xPropertyInfo.is())
{
- Sequence< beans::Property > seq( 2 );
- seq[ 0 ] = beans::Property(
- "DefaultContext", -1, cppu::UnoType<decltype(m_xContext)>::get(), 0 );
- seq[ 1 ] = beans::Property(
- "Registry", -1, cppu::UnoType<decltype(m_xRegistry)>::get(),
- beans::PropertyAttribute::READONLY );
+ Sequence< beans::Property > seq{
+ beans::Property("DefaultContext", -1, cppu::UnoType<decltype(m_xContext)>::get(), 0),
+ beans::Property("Registry", -1, cppu::UnoType<decltype(m_xRegistry)>::get(),
+ beans::PropertyAttribute::READONLY)
+ };
Reference< beans::XPropertySetInfo > xInfo( new PropertySetInfo_Impl( seq ) );
MutexGuard aGuard( m_mutex );
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index 6175de241400..0b7fae2b8641 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -305,8 +305,9 @@ css::uno::Sequence< sal_Int32 > Key::getLongListValue()
static_cast< OWeakObject * >(this));
}
css::uno::Sequence< sal_Int32 > value(static_cast< sal_Int32 >(n));
+ auto aValueRange = asNonConstRange(value);
for (sal_uInt32 i = 0; i < n; ++i) {
- value[static_cast< sal_Int32 >(i)] = list.getElement(i);
+ aValueRange[static_cast< sal_Int32 >(i)] = list.getElement(i);
}
return value;
}
@@ -446,11 +447,12 @@ css::uno::Sequence< OUString > Key::getAsciiListValue()
static_cast< OWeakObject * >(this));
}
css::uno::Sequence< OUString > value(static_cast< sal_Int32 >(n));
+ auto aValueRange = asNonConstRange(value);
for (sal_uInt32 i = 0; i < n; ++i) {
char * el = list.getElement(i);
sal_Int32 size = rtl_str_getLength(el);
if (!rtl_convertStringToUString(
- &value[static_cast< sal_Int32 >(i)].pData, el, size,
+ &aValueRange[static_cast< sal_Int32 >(i)].pData, el, size,
RTL_TEXTENCODING_UTF8,
(RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
@@ -600,8 +602,9 @@ css::uno::Sequence< OUString > Key::getStringListValue()
static_cast< OWeakObject * >(this));
}
css::uno::Sequence< OUString > value(static_cast< sal_Int32 >(n));
+ auto aValueRange = asNonConstRange(value);
for (sal_uInt32 i = 0; i < n; ++i) {
- value[static_cast< sal_Int32 >(i)] = list.getElement(i);
+ aValueRange[static_cast< sal_Int32 >(i)] = list.getElement(i);
}
return value;
}
@@ -758,8 +761,9 @@ Key::openKeys()
}
css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
keys(static_cast< sal_Int32 >(n));
+ auto aKeysRange = asNonConstRange(keys);
for (sal_uInt32 i = 0; i < n; ++i) {
- keys[static_cast< sal_Int32 >(i)] = new Key(
+ aKeysRange[static_cast< sal_Int32 >(i)] = new Key(
registry_, list.getElement(i));
}
return keys;
@@ -784,8 +788,9 @@ css::uno::Sequence< OUString > Key::getKeyNames()
static_cast< OWeakObject * >(this));
}
css::uno::Sequence< OUString > names(static_cast< sal_Int32 >(n));
+ auto aNamesRange = asNonConstRange(names);
for (sal_uInt32 i = 0; i < n; ++i) {
- names[static_cast< sal_Int32 >(i)] = list.getElement(i);
+ aNamesRange[static_cast< sal_Int32 >(i)] = list.getElement(i);
}
return names;
}