diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-20 08:43:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-20 12:11:11 +0200 |
commit | 1553d3787cbe0cdababf31382bf3376a3640d8cf (patch) | |
tree | b829cc1f97dac33abdf1e592a636d6fb24497f13 /desktop/source/deployment/gui | |
parent | c2ead5a142be19cb74127294641ec35da9e0f5c5 (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/gui')
5 files changed, 19 insertions, 26 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 ) ); |