diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-12-17 23:00:24 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-12-18 07:36:32 +0100 |
commit | 4e144751f12a06e358e4f7efa7c8f13954e6cfd7 (patch) | |
tree | c6df66d58d02ecaf5caa437a944665fe83959402 /desktop | |
parent | 39c618caf5aa19da95285bec6cab7108bee3984c (diff) |
loplugin:unusedindex
Change-Id: I256a807dd2a4c81126b5a76f3d472e31b8224146
Reviewed-on: https://gerrit.libreoffice.org/46652
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/migration/migration.cxx | 53 | ||||
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx | 11 |
2 files changed, 25 insertions, 39 deletions
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 043fe62e6c8d..86925c518a15 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -389,55 +389,49 @@ migrations_vr MigrationImpl::readMigrationSteps(const OUString& rMigrationName) // get migration description from org.openoffice.Setup/Migration // and build vector of migration steps uno::Reference< XNameAccess > theNameAccess(xMigrationData->getByName("MigrationSteps"), uno::UNO_QUERY_THROW); - uno::Sequence< OUString > seqMigrations = theNameAccess->getElementNames(); uno::Reference< XNameAccess > tmpAccess; uno::Sequence< OUString > tmpSeq; migrations_vr vrMigrations(new migrations_v); - for (sal_Int32 i = 0; i < seqMigrations.getLength(); i++) { + for (const OUString& rMigrationStep : theNameAccess->getElementNames()) { // get current migration step - theNameAccess->getByName(seqMigrations[i]) >>= tmpAccess; + theNameAccess->getByName(rMigrationStep) >>= tmpAccess; migration_step tmpStep; - tmpStep.name = seqMigrations[i]; + tmpStep.name = rMigrationStep; // read included files from current step description - OUString aSeqEntry; if (tmpAccess->getByName("IncludedFiles") >>= tmpSeq) { - for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) { - aSeqEntry = tmpSeq[j]; - tmpStep.includeFiles.push_back(aSeqEntry); - } + for (const OUString& rSeqEntry : tmpSeq) + tmpStep.includeFiles.push_back(rSeqEntry); } // excluded files... if (tmpAccess->getByName("ExcludedFiles") >>= tmpSeq) { - for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) - tmpStep.excludeFiles.push_back(tmpSeq[j]); + for (const OUString& rSeqEntry : tmpSeq) + tmpStep.excludeFiles.push_back(rSeqEntry); } // included nodes... if (tmpAccess->getByName("IncludedNodes") >>= tmpSeq) { - for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) - tmpStep.includeConfig.push_back(tmpSeq[j]); + for (const OUString& rSeqEntry : tmpSeq) + tmpStep.includeConfig.push_back(rSeqEntry); } // excluded nodes... if (tmpAccess->getByName("ExcludedNodes") >>= tmpSeq) { - for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) - tmpStep.excludeConfig.push_back(tmpSeq[j]); + for (const OUString& rSeqEntry : tmpSeq) + tmpStep.excludeConfig.push_back(rSeqEntry); } // included extensions... if (tmpAccess->getByName("IncludedExtensions") >>= tmpSeq) { - for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) - tmpStep.includeExtensions.push_back(tmpSeq[j]); + for (const OUString& rSeqEntry : tmpSeq) + tmpStep.includeExtensions.push_back(rSeqEntry); } // excluded extensions... if (tmpAccess->getByName("ExcludedExtensions") >>= tmpSeq) { - for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) { - aSeqEntry = tmpSeq[j]; - tmpStep.excludeExtensions.push_back(aSeqEntry); - } + for (const OUString& rSeqEntry : tmpSeq) + tmpStep.excludeExtensions.push_back(rSeqEntry); } // generic service @@ -714,20 +708,17 @@ uno::Sequence< OUString > setToSeq(std::set< OUString > const & set) void MigrationImpl::copyConfig() { Components comps; - for (migrations_v::const_iterator i(m_vrMigrations->begin()); - i != m_vrMigrations->end(); ++i) { - for (strings_v::const_iterator j(i->includeConfig.begin()); - j != i->includeConfig.end(); ++j) { + for (auto const& rMigrationStep : *m_vrMigrations) { + for (const OUString& rIncludePath : rMigrationStep.includeConfig) { OUString comp; - if (getComponent(*j, &comp)) { - comps[comp].includedPaths.insert(*j); + if (getComponent(rIncludePath, &comp)) { + comps[comp].includedPaths.insert(rIncludePath); } } - for (strings_v::const_iterator j(i->excludeConfig.begin()); - j != i->excludeConfig.end(); ++j) { + for (const OUString& rExcludePath : rMigrationStep.excludeConfig) { OUString comp; - if (getComponent(*j, &comp)) { - comps[comp].excludedPaths.insert(*j); + if (getComponent(rExcludePath, &comp)) { + comps[comp].excludedPaths.insert(rExcludePath); } } } diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index a9eb2cdb1488..6ed4cd3cd3a7 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -284,16 +284,11 @@ void CommandEnvironmentImpl::handle( } // select: - Sequence< Reference<task::XInteractionContinuation> > conts( - xRequest->getContinuations() ); - Reference<task::XInteractionContinuation> const * pConts = - conts.getConstArray(); - sal_Int32 len = conts.getLength(); - for ( sal_Int32 pos = 0; pos < len; ++pos ) + for ( auto const& rCont : xRequest->getContinuations() ) { if (approve) { Reference<task::XInteractionApprove> xInteractionApprove( - pConts[ pos ], UNO_QUERY ); + rCont, UNO_QUERY ); if (xInteractionApprove.is()) { xInteractionApprove->select(); break; @@ -301,7 +296,7 @@ void CommandEnvironmentImpl::handle( } else if (abort) { Reference<task::XInteractionAbort> xInteractionAbort( - pConts[ pos ], UNO_QUERY ); + rCont, UNO_QUERY ); if (xInteractionAbort.is()) { xInteractionAbort->select(); break; |