diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2018-03-13 00:45:01 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2018-03-13 09:10:42 +0100 |
commit | 71f2669b7fbbf3f51f43286dd64608a75ce95ad7 (patch) | |
tree | 3e4a2b237e7918b7789283ce72d2b86a72cb901d /extensions/source/update/check | |
parent | 3a4b0b4a86258f56e699c324fb2282c49319f92f (diff) |
Modernize a bit extensions
mainly by using for-range loops
Change-Id: I297275748ffdce0576e51f63294d7e5b21729af7
Reviewed-on: https://gerrit.libreoffice.org/51182
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'extensions/source/update/check')
-rw-r--r-- | extensions/source/update/check/updatecheck.cxx | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index e09eee8f97ed..ecb36ecaf28a 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -65,18 +65,15 @@ namespace uno = com::sun::star::uno ; // Returns the URL of the release note for the given position OUString getReleaseNote(const UpdateInfo& rInfo, sal_uInt8 pos, bool autoDownloadEnabled) { - std::vector< ReleaseNote >::const_iterator iter = rInfo.ReleaseNotes.begin(); - while( iter != rInfo.ReleaseNotes.end() ) + for (auto const& elem : rInfo.ReleaseNotes) { - if( pos == iter->Pos ) + if( pos == elem.Pos ) { - if( (pos > 2) || !autoDownloadEnabled || iter->URL2.isEmpty() ) - return iter->URL; + if( (pos > 2) || !autoDownloadEnabled || elem.URL2.isEmpty() ) + return elem.URL; } - else if( (pos == iter->Pos2) && ((1 == iter->Pos) || (2 == iter->Pos)) && autoDownloadEnabled ) - return iter->URL2; - - ++iter; + else if( (pos == elem.Pos2) && ((1 == elem.Pos) || (2 == elem.Pos)) && autoDownloadEnabled ) + return elem.URL2; } return OUString(); @@ -1249,18 +1246,15 @@ UpdateCheck::setUpdateInfo(const UpdateInfo& aInfo) // Decide whether to use alternate release note pos .. bool autoDownloadEnabled = rModel->isAutoDownloadEnabled(); - std::vector< ReleaseNote >::iterator iter2 = m_aUpdateInfo.ReleaseNotes.begin(); - while( iter2 != m_aUpdateInfo.ReleaseNotes.end() ) + for (auto & elem : m_aUpdateInfo.ReleaseNotes) { - if( ((1 == iter2->Pos) || (2 == iter2->Pos)) && autoDownloadEnabled && !iter2->URL2.isEmpty()) + if( ((1 == elem.Pos) || (2 == elem.Pos)) && autoDownloadEnabled && !elem.URL2.isEmpty()) { - iter2->URL = iter2->URL2; - iter2->URL2.clear(); - iter2->Pos = iter2->Pos2; - iter2->Pos2 = 0; + elem.URL = elem.URL2; + elem.URL2.clear(); + elem.Pos = elem.Pos2; + elem.Pos2 = 0; } - - ++iter2; } // do not move below store/clear .. |