summaryrefslogtreecommitdiff
path: root/desktop/source/deployment
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-05-20 08:43:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-05-20 12:11:11 +0200
commit1553d3787cbe0cdababf31382bf3376a3640d8cf (patch)
treeb829cc1f97dac33abdf1e592a636d6fb24497f13 /desktop/source/deployment
parentc2ead5a142be19cb74127294641ec35da9e0f5c5 (diff)
use for-range on Sequence in d*
and fix bug in GenericClipboard::initialize, where it was looping through the arguments, but always reading the first one. I'm guessing it was never an issue because it is always called with only one argument Change-Id: I8f72b6bce8c77a69c7d75115e34630e2c308261e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94553 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop/source/deployment')
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog2.cxx3
-rw-r--r--desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx5
-rw-r--r--desktop/source/deployment/gui/dp_gui_extlistbox.cxx4
-rw-r--r--desktop/source/deployment/gui/dp_gui_theextmgr.cxx28
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.cxx5
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.cxx19
-rw-r--r--desktop/source/deployment/manager/dp_properties.cxx3
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx4
-rw-r--r--desktop/source/deployment/misc/dp_platform.cxx4
-rw-r--r--desktop/source/deployment/misc/dp_ucb.cxx3
-rw-r--r--desktop/source/deployment/misc/dp_update.cxx14
-rw-r--r--desktop/source/deployment/registry/component/dp_component.cxx18
-rw-r--r--desktop/source/deployment/registry/dp_backend.cxx7
-rw-r--r--desktop/source/deployment/registry/dp_registry.cxx4
14 files changed, 53 insertions, 68 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index a345a87d22a9..d018edad0109 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -639,9 +639,8 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
const uno::Sequence< uno::Reference< deployment::XPackageTypeInfo > > packageTypes(
m_pManager->getExtensionManager()->getSupportedPackageTypes() );
- for ( sal_Int32 pos = 0; pos < packageTypes.getLength(); ++pos )
+ for ( uno::Reference< deployment::XPackageTypeInfo > const & xPackageType : packageTypes )
{
- uno::Reference< deployment::XPackageTypeInfo > const & xPackageType = packageTypes[ pos ];
const OUString filter( xPackageType->getFileFilter() );
if (!filter.isEmpty())
{
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index b6231ab9c73c..00ed69d515de 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -366,10 +366,9 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
{
std::vector< OUString > deps;
deps.reserve(depExc.UnsatisfiedDependencies.getLength());
- for (sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); ++i)
+ for (auto const & i : std::as_const(depExc.UnsatisfiedDependencies))
{
- deps.push_back(
- dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]) );
+ deps.push_back( dp_misc::Dependencies::getErrorText(i) );
}
{
SolarMutexGuard guard;
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index e42b6e41c172..89aaed148346 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -145,10 +145,10 @@ void Entry_Impl::checkDependencies()
if ( e.Cause >>= depExc )
{
OUStringBuffer aMissingDep( DpResId( RID_STR_ERROR_MISSING_DEPENDENCIES ) );
- for ( sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); ++i )
+ for ( const auto& i : std::as_const(depExc.UnsatisfiedDependencies) )
{
aMissingDep.append("\n");
- aMissingDep.append(dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]));
+ aMissingDep.append(dp_misc::Dependencies::getErrorText(i));
}
aMissingDep.append("\n");
m_sErrorText = aMissingDep.makeStringAndClear();
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
index 66600848abd2..1f3d8d710b03 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
@@ -220,9 +220,9 @@ void TheExtensionManager::checkUpdates()
e.Context, anyEx );
}
- for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i )
+ for ( auto const & i : std::as_const(xAllPackages) )
{
- uno::Reference< deployment::XPackage > xPackage = dp_misc::getExtensionWithHighestVersion(xAllPackages[i]);
+ uno::Reference< deployment::XPackage > xPackage = dp_misc::getExtensionWithHighestVersion(i);
OSL_ASSERT(xPackage.is());
if ( xPackage.is() )
{
@@ -303,13 +303,10 @@ void TheExtensionManager::createPackageList()
e.Context, anyEx );
}
- for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i )
+ for ( uno::Sequence< uno::Reference< deployment::XPackage > > const & xPackageList : std::as_const(xAllPackages) )
{
- uno::Sequence< uno::Reference< deployment::XPackage > > xPackageList = xAllPackages[i];
-
- for ( sal_Int32 j = 0; j < xPackageList.getLength(); ++j )
+ for ( uno::Reference< deployment::XPackage > const & xPackage : xPackageList )
{
- uno::Reference< deployment::XPackage > xPackage = xPackageList[j];
if ( xPackage.is() )
{
PackageState eState = getPackageState( xPackage );
@@ -322,11 +319,10 @@ void TheExtensionManager::createPackageList()
}
}
- uno::Sequence< uno::Reference< deployment::XPackage > > xNoLicPackages = m_xExtensionManager->getExtensionsWithUnacceptedLicenses( SHARED_PACKAGE_MANAGER,
+ const uno::Sequence< uno::Reference< deployment::XPackage > > xNoLicPackages = m_xExtensionManager->getExtensionsWithUnacceptedLicenses( SHARED_PACKAGE_MANAGER,
uno::Reference< ucb::XCommandEnvironment >() );
- for ( sal_Int32 i = 0; i < xNoLicPackages.getLength(); ++i )
+ for ( uno::Reference< deployment::XPackage > const & xPackage : xNoLicPackages )
{
- uno::Reference< deployment::XPackage > xPackage = xNoLicPackages[i];
if ( xPackage.is() )
{
getDialogHelper()->addPackageToList( xPackage, true );
@@ -387,11 +383,11 @@ bool TheExtensionManager::supportsOptions( const uno::Reference< deployment::XPa
OSL_ASSERT( aId.IsPresent );
//iterate over all available nodes
- uno::Sequence< OUString > seqNames = m_xNameAccessNodes->getElementNames();
+ const uno::Sequence< OUString > seqNames = m_xNameAccessNodes->getElementNames();
- for ( int i = 0; i < seqNames.getLength(); i++ )
+ for ( OUString const & nodeName : seqNames )
{
- uno::Any anyNode = m_xNameAccessNodes->getByName( seqNames[i] );
+ uno::Any anyNode = m_xNameAccessNodes->getByName( nodeName );
//If we have a node then it must contain the set of leaves. This is part of OptionsDialog.xcs
uno::Reference< XInterface> xIntNode = anyNode.get< uno::Reference< XInterface > >();
uno::Reference< container::XNameAccess > xNode( xIntNode, uno::UNO_QUERY_THROW );
@@ -401,10 +397,10 @@ bool TheExtensionManager::supportsOptions( const uno::Reference< deployment::XPa
uno::Reference< container::XNameAccess > xLeaves( xIntLeaves, uno::UNO_QUERY_THROW );
//iterate over all available leaves
- uno::Sequence< OUString > seqLeafNames = xLeaves->getElementNames();
- for ( int j = 0; j < seqLeafNames.getLength(); j++ )
+ const uno::Sequence< OUString > seqLeafNames = xLeaves->getElementNames();
+ for ( OUString const & leafName : seqLeafNames )
{
- uno::Any anyLeaf = xLeaves->getByName( seqLeafNames[j] );
+ uno::Any anyLeaf = xLeaves->getByName( leafName );
uno::Reference< XInterface > xIntLeaf = anyLeaf.get< uno::Reference< XInterface > >();
uno::Reference< beans::XPropertySet > xLeaf( xIntLeaf, uno::UNO_QUERY_THROW );
//investigate the Id property if it matches the extension identifier which
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 4c5269499f19..60a0337119d5 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -775,11 +775,10 @@ void UpdateDialog::getIgnoredUpdates()
args[0] <<= aValue;
uno::Reference< container::XNameAccess > xNameAccess( xConfig->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", args), uno::UNO_QUERY_THROW );
- uno::Sequence< OUString > aElementNames = xNameAccess->getElementNames();
+ const uno::Sequence< OUString > aElementNames = xNameAccess->getElementNames();
- for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ )
+ for ( OUString const & aIdentifier : aElementNames )
{
- OUString aIdentifier = aElementNames[i];
OUString aVersion;
uno::Any aPropValue( uno::Reference< beans::XPropertySet >( xNameAccess->getByName( aIdentifier ), uno::UNO_QUERY_THROW )->getPropertyValue( PROPERTY_VERSION ) );
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index b8c23c60dfdb..39bdbf65cced 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -239,9 +239,8 @@ void ExtensionManager::addExtensionsToMap(
++index;
}
- for (int i = 0; i < seqExt.getLength(); ++i)
+ for (const Reference<css::deployment::XPackage>& xExtension : seqExt)
{
- Reference<css::deployment::XPackage> const & xExtension = seqExt[i];
OUString id = dp_misc::getIdentifier(xExtension);
id2extensions::iterator ivec = mapExt.find(id);
if (ivec == mapExt.end())
@@ -1142,17 +1141,17 @@ void ExtensionManager::reinstallDeployedExtensions(
{
const uno::Sequence< Reference<css::deployment::XPackage> > extensions(
xPackageManager->getDeployedPackages(xAbortChannel, xCmdEnv));
- for ( sal_Int32 pos = 0; pos < extensions.getLength(); ++pos )
+ for ( const Reference<css::deployment::XPackage>& package : extensions )
{
try
{
beans::Optional< beans::Ambiguous< sal_Bool > > registered(
- extensions[pos]->isRegistered(xAbortChannel, xCmdEnv));
+ package->isRegistered(xAbortChannel, xCmdEnv));
if (registered.IsPresent &&
!(registered.Value.IsAmbiguous ||
registered.Value.Value))
{
- const OUString id = dp_misc::getIdentifier(extensions[ pos ]);
+ const OUString id = dp_misc::getIdentifier(package);
OSL_ASSERT(!id.isEmpty());
disabledExts.insert(id);
}
@@ -1172,12 +1171,12 @@ void ExtensionManager::reinstallDeployedExtensions(
const uno::Sequence< Reference<css::deployment::XPackage> > extensions(
xPackageManager->getDeployedPackages(xAbortChannel, xCmdEnv));
- for ( sal_Int32 pos = 0; pos < extensions.getLength(); ++pos )
+ for ( const Reference<css::deployment::XPackage>& package : extensions )
{
try
{
- const OUString id = dp_misc::getIdentifier(extensions[ pos ]);
- const OUString fileName = extensions[ pos ]->getName();
+ const OUString id = dp_misc::getIdentifier(package);
+ const OUString fileName = package->getName();
OSL_ASSERT(!id.isEmpty());
activateExtension(
id, fileName, disabledExts.find(id) != disabledExts.end(),
@@ -1237,10 +1236,8 @@ sal_Bool ExtensionManager::synchronize(
{
const uno::Sequence<uno::Sequence<Reference<css::deployment::XPackage> > >
seqSeqExt = getAllExtensions(xAbortChannel, xCmdEnv);
- for (sal_Int32 i = 0; i < seqSeqExt.getLength(); i++)
+ for (uno::Sequence<Reference<css::deployment::XPackage> > const & seqExt : seqSeqExt)
{
- uno::Sequence<Reference<css::deployment::XPackage> > const & seqExt =
- seqSeqExt[i];
activateExtension(seqExt, isUserDisabled(seqExt), true,
xAbortChannel, xCmdEnv);
}
diff --git a/desktop/source/deployment/manager/dp_properties.cxx b/desktop/source/deployment/manager/dp_properties.cxx
index 46535e0ee0e1..ab5ccc7eb5c7 100644
--- a/desktop/source/deployment/manager/dp_properties.cxx
+++ b/desktop/source/deployment/manager/dp_properties.cxx
@@ -72,9 +72,8 @@ ExtensionProperties::ExtensionProperties(
{
m_propFileUrl = urlExtension + "properties";
- for (sal_Int32 i = 0; i < properties.getLength(); i++)
+ for (css::beans::NamedValue const & v : properties)
{
- css::beans::NamedValue const & v = properties[i];
if (v.Name == PROP_SUPPRESS_LICENSE)
{
m_prop_suppress_license = getPropertyValue(v);
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index 0621cc51e099..513294535ce8 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -535,9 +535,9 @@ void disposeBridges(Reference<css::uno::XComponentContext> const & ctx)
Reference<css::bridge::XBridgeFactory2> bridgeFac( css::bridge::BridgeFactory::create(ctx) );
const Sequence< Reference<css::bridge::XBridge> >seqBridges = bridgeFac->getExistingBridges();
- for (sal_Int32 i = 0; i < seqBridges.getLength(); i++)
+ for (const Reference<css::bridge::XBridge>& bridge : seqBridges)
{
- Reference<css::lang::XComponent> comp(seqBridges[i], UNO_QUERY);
+ Reference<css::lang::XComponent> comp(bridge, UNO_QUERY);
if (comp.is())
{
try {
diff --git a/desktop/source/deployment/misc/dp_platform.cxx b/desktop/source/deployment/misc/dp_platform.cxx
index 50ca73a362f4..9e4fd320b39f 100644
--- a/desktop/source/deployment/misc/dp_platform.cxx
+++ b/desktop/source/deployment/misc/dp_platform.cxx
@@ -189,9 +189,9 @@ bool platform_fits( OUString const & platform_string )
bool hasValidPlatform( css::uno::Sequence<OUString> const & platformStrings)
{
bool ret = false;
- for (sal_Int32 i = 0; i < platformStrings.getLength(); i++)
+ for (const OUString& s : platformStrings)
{
- if ( isPlatformSupported( platformStrings[i] ))
+ if ( isPlatformSupported( s ) )
{
ret = true;
break;
diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx
index 09ce86610cb8..71e7d18a1c9c 100644
--- a/desktop/source/deployment/misc/dp_ucb.cxx
+++ b/desktop/source/deployment/misc/dp_ucb.cxx
@@ -119,10 +119,9 @@ bool create_folder(
RTL_TEXTENCODING_UTF8 ) );
const Sequence<ContentInfo> infos(
parentContent.queryCreatableContentsInfo() );
- for ( sal_Int32 pos = 0; pos < infos.getLength(); ++pos )
+ for ( ContentInfo const & info : infos )
{
// look KIND_FOLDER:
- ContentInfo const & info = infos[ pos ];
if ((info.Attributes & ContentInfoAttribute::KIND_FOLDER) != 0)
{
// make sure the only required bootstrap property is "Title":
diff --git a/desktop/source/deployment/misc/dp_update.cxx b/desktop/source/deployment/misc/dp_update.cxx
index 0d6f4acdee45..7116be42bf44 100644
--- a/desktop/source/deployment/misc/dp_update.cxx
+++ b/desktop/source/deployment/misc/dp_update.cxx
@@ -100,16 +100,16 @@ void getOwnUpdateInfos(
uno::Any anyError;
//It is unclear from the idl if there can be a null reference returned.
//However all valid information should be the same
- Sequence<Reference< xml::dom::XElement > >
+ const Sequence<Reference< xml::dom::XElement > >
infos(getUpdateInformation(updateInformation, urls, search_id, anyError));
if (anyError.hasValue())
out_errors.emplace_back(inout.second.extension, anyError);
- for (sal_Int32 j = 0; j < infos.getLength(); ++j)
+ for (const Reference< xml::dom::XElement >& element : infos)
{
dp_misc::DescriptionInfoset infoset(
xContext,
- Reference< xml::dom::XNode >(infos[j], UNO_QUERY_THROW));
+ Reference< xml::dom::XNode >(element, UNO_QUERY_THROW));
if (!infoset.hasDescription())
continue;
std::optional< OUString > result_id(infoset.getIdentifier());
@@ -120,7 +120,7 @@ void getOwnUpdateInfos(
if (*result_id != search_id)
continue;
inout.second.version = infoset.getVersion();
- inout.second.info.set(infos[j], UNO_QUERY_THROW);
+ inout.second.info.set(element, UNO_QUERY_THROW);
break;
}
}
@@ -142,16 +142,16 @@ void getDefaultUpdateInfos(
OSL_ASSERT(!sDefaultURL.isEmpty());
Any anyError;
- Sequence< Reference< xml::dom::XElement > >
+ const Sequence< Reference< xml::dom::XElement > >
infos(
getUpdateInformation(
updateInformation,
Sequence< OUString >(&sDefaultURL, 1), OUString(), anyError));
if (anyError.hasValue())
out_errors.emplace_back(Reference<deployment::XPackage>(), anyError);
- for (sal_Int32 i = 0; i < infos.getLength(); ++i)
+ for (const Reference< xml::dom::XElement >& element : infos)
{
- Reference< xml::dom::XNode > node(infos[i], UNO_QUERY_THROW);
+ Reference< xml::dom::XNode > node(element, UNO_QUERY_THROW);
dp_misc::DescriptionInfoset infoset(xContext, node);
std::optional< OUString > id(infoset.getIdentifier());
if (!id) {
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index cdc840762068..8cb39ce476bd 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -1105,30 +1105,30 @@ void extractComponentData(
if (!registryName.endsWith("/")) {
prefix += RTL_CONSTASCII_LENGTH("/");
}
- css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+ const css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
keys(registry->openKeys());
css::uno::Reference< css::lang::XMultiComponentFactory > smgr(
context->getServiceManager(), css::uno::UNO_SET_THROW);
- for (sal_Int32 i = 0; i < keys.getLength(); ++i) {
- OUString name(keys[i]->getKeyName().copy(prefix));
+ for (css::uno::Reference< css::registry::XRegistryKey > const & key : keys) {
+ OUString name(key->getKeyName().copy(prefix));
data->implementationNames.push_back(name);
css::uno::Reference< css::registry::XRegistryKey > singletons(
- keys[i]->openKey("UNO/SINGLETONS"));
+ key->openKey("UNO/SINGLETONS"));
if (singletons.is()) {
- sal_Int32 prefix2 = keys[i]->getKeyName().getLength() +
+ sal_Int32 prefix2 = key->getKeyName().getLength() +
RTL_CONSTASCII_LENGTH("/UNO/SINGLETONS/");
- css::uno::Sequence<
+ const css::uno::Sequence<
css::uno::Reference< css::registry::XRegistryKey > >
singletonKeys(singletons->openKeys());
- for (sal_Int32 j = 0; j < singletonKeys.getLength(); ++j) {
+ for (css::uno::Reference< css::registry::XRegistryKey > const & singletonKey : singletonKeys) {
data->singletons.emplace_back(
- singletonKeys[j]->getKeyName().copy(prefix2), name);
+ singletonKey->getKeyName().copy(prefix2), name);
}
}
if (factories != nullptr) {
factories->push_back(
componentLoader->activate(
- name, OUString(), componentUrl, keys[i]));
+ name, OUString(), componentUrl, key));
}
}
}
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index e6339def509a..42bbc65cdb4c 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -556,13 +556,12 @@ void Package::fireModified()
if (container == nullptr)
return;
- Sequence< Reference<XInterface> > elements(
+ const Sequence< Reference<XInterface> > elements(
container->getElements() );
lang::EventObject evt( static_cast<OWeakObject *>(this) );
- for ( sal_Int32 pos = 0; pos < elements.getLength(); ++pos )
+ for ( const Reference<XInterface>& x : elements )
{
- Reference<util::XModifyListener> xListener(
- elements[ pos ], UNO_QUERY );
+ Reference<util::XModifyListener> xListener( x, UNO_QUERY );
if (xListener.is())
xListener->modified( evt );
}
diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx
index 7a63de3250f0..50d0c0c4d68e 100644
--- a/desktop/source/deployment/registry/dp_registry.cxx
+++ b/desktop/source/deployment/registry/dp_registry.cxx
@@ -184,10 +184,8 @@ void PackageRegistryImpl::insertBackend(
const Sequence< Reference<deployment::XPackageTypeInfo> > packageTypes(
xBackend->getSupportedPackageTypes() );
- for ( sal_Int32 pos = 0; pos < packageTypes.getLength(); ++pos )
+ for ( Reference<deployment::XPackageTypeInfo> const & xPackageType : packageTypes )
{
- Reference<deployment::XPackageTypeInfo> const & xPackageType =
- packageTypes[ pos ];
m_typesInfos.push_back( xPackageType );
const OUString mediaType( normalizeMediaType(