Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package syndication for openSUSE:Factory checked in at 2022-03-14 19:35:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/syndication (Old) and /work/SRC/openSUSE:Factory/.syndication.new.25692 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "syndication" Mon Mar 14 19:35:02 2022 rev:81 rq:961292 version:5.92.0 Changes: -------- --- /work/SRC/openSUSE:Factory/syndication/syndication.changes 2022-02-24 18:22:44.350669749 +0100 +++ /work/SRC/openSUSE:Factory/.syndication.new.25692/syndication.changes 2022-03-14 19:36:40.322098014 +0100 @@ -1,0 +2,10 @@ +Mon Mar 7 09:27:23 UTC 2022 - Christophe Giboudeaux <[email protected]> + +- Update to 5.92.0 + * New feature release + * For more details please see: + * https://kde.org/announcements/frameworks/5/5.92.0 +- Changes since 5.91.0: + * Add Qt6 Android CI + +------------------------------------------------------------------- Old: ---- syndication-5.91.0.tar.xz syndication-5.91.0.tar.xz.sig New: ---- syndication-5.92.0.tar.xz syndication-5.92.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ syndication.spec ++++++ --- /var/tmp/diff_new_pack.0CbAyw/_old 2022-03-14 19:36:40.834098629 +0100 +++ /var/tmp/diff_new_pack.0CbAyw/_new 2022-03-14 19:36:40.838098633 +0100 @@ -17,14 +17,14 @@ %define lname libKF5Syndication5 -%define _tar_path 5.91 +%define _tar_path 5.92 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} %bcond_without released Name: syndication -Version: 5.91.0 +Version: 5.92.0 Release: 0 Summary: RSS/Atom parsing library License: LGPL-2.1-or-later ++++++ syndication-5.91.0.tar.xz -> syndication-5.92.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/.gitlab-ci.yml new/syndication-5.92.0/.gitlab-ci.yml --- old/syndication-5.91.0/.gitlab-ci.yml 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/.gitlab-ci.yml 2022-03-05 12:21:18.000000000 +0100 @@ -6,3 +6,4 @@ - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/android.yml - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd.yml - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux-qt6.yml + - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/android-qt6.yml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/CMakeLists.txt new/syndication-5.92.0/CMakeLists.txt --- old/syndication-5.91.0/CMakeLists.txt 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/CMakeLists.txt 2022-03-05 12:21:18.000000000 +0100 @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.16) -set(KF_VERSION "5.91.0") # handled by release scripts -set(KF_DEP_VERSION "5.91.0") # handled by release scripts +set(KF_VERSION "5.92.0") # handled by release scripts +set(KF_DEP_VERSION "5.92.0") # handled by release scripts project(Syndication VERSION ${KF_VERSION}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/atom/document.cpp new/syndication-5.92.0/src/atom/document.cpp --- old/syndication-5.91.0/src/atom/document.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/atom/document.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -44,48 +44,39 @@ QList<Person> FeedDocument::authors() const { - QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("author")); + const QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("author")); QList<Person> list; list.reserve(a.count()); - QList<QDomElement>::ConstIterator it = a.constBegin(); - const QList<QDomElement>::ConstIterator end = a.constEnd(); - - for (; it != end; ++it) { - list.append(Person(*it)); - } + std::transform(a.cbegin(), a.cend(), std::back_inserter(list), [](const QDomElement &element) { + return Person(element); + }); return list; } QList<Person> FeedDocument::contributors() const { - QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("contributor")); + const QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("contributor")); QList<Person> list; list.reserve(a.count()); - QList<QDomElement>::ConstIterator it = a.constBegin(); - const QList<QDomElement>::ConstIterator end = a.constEnd(); - - for (; it != end; ++it) { - list.append(Person(*it)); - } + std::transform(a.cbegin(), a.cend(), std::back_inserter(list), [](const QDomElement &element) { + return Person(element); + }); return list; } QList<Category> FeedDocument::categories() const { - QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("category")); + const QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("category")); QList<Category> list; list.reserve(a.count()); - QList<QDomElement>::ConstIterator it = a.constBegin(); - const QList<QDomElement>::ConstIterator end = a.constEnd(); - - for (; it != end; ++it) { - list.append(Category(*it)); - } + std::transform(a.cbegin(), a.cend(), std::back_inserter(list), [](const QDomElement &element) { + return Category(element); + }); return list; } @@ -137,35 +128,30 @@ QList<Link> FeedDocument::links() const { - QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("link")); + const QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("link")); QList<Link> list; list.reserve(a.count()); - QList<QDomElement>::ConstIterator it = a.constBegin(); - QList<QDomElement>::ConstIterator end = a.constEnd(); - - for (; it != end; ++it) { - list.append(Link(*it)); - } + std::transform(a.cbegin(), a.cend(), std::back_inserter(list), [](const QDomElement &element) { + return Link(element); + }); return list; } QList<Entry> FeedDocument::entries() const { - QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("entry")); + const QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("entry")); QList<Entry> list; list.reserve(a.count()); - QList<Person> feedAuthors = authors(); - QList<QDomElement>::ConstIterator it = a.constBegin(); - QList<QDomElement>::ConstIterator end = a.constEnd(); + const QList<Person> feedAuthors = authors(); - for (; it != end; ++it) { - Entry entry(*it); + std::transform(a.cbegin(), a.cend(), std::back_inserter(list), [&feedAuthors](const QDomElement &element) { + Entry entry(element); entry.setFeedAuthors(feedAuthors); - list.append(entry); - } + return entry; + }); return list; } @@ -242,38 +228,33 @@ info += QLatin1String("updated: #") + dupdated + QLatin1String("#\n"); } - QList<Link> dlinks = links(); - QList<Link>::ConstIterator endlinks = dlinks.constEnd(); - for (QList<Link>::ConstIterator it = dlinks.constBegin(); it != endlinks; ++it) { - info += (*it).debugInfo(); + const QList<Link> dlinks = links(); + for (const auto &link : dlinks) { + info += link.debugInfo(); } - QList<Category> dcats = categories(); - QList<Category>::ConstIterator endcats = dcats.constEnd(); - for (QList<Category>::ConstIterator it = dcats.constBegin(); it != endcats; ++it) { - info += (*it).debugInfo(); + const QList<Category> dcats = categories(); + for (const auto &cat : dcats) { + info += cat.debugInfo(); } info += QLatin1String("### Authors: ###################\n"); - QList<Person> dauthors = authors(); - QList<Person>::ConstIterator endauthors = dauthors.constEnd(); - for (QList<Person>::ConstIterator it = dauthors.constBegin(); it != endauthors; ++it) { - info += (*it).debugInfo(); + const QList<Person> dauthors = authors(); + for (const auto &author : dauthors) { + info += author.debugInfo(); } info += QLatin1String("### Contributors: ###################\n"); - QList<Person> dcontri = contributors(); - QList<Person>::ConstIterator endcontri = dcontri.constEnd(); - for (QList<Person>::ConstIterator it = dcontri.constBegin(); it != endcontri; ++it) { - info += (*it).debugInfo(); + const QList<Person> dcontri = contributors(); + for (const auto &person : dcontri) { + info += person.debugInfo(); } - QList<Entry> dentries = entries(); - QList<Entry>::ConstIterator endentries = dentries.constEnd(); - for (QList<Entry>::ConstIterator it = dentries.constBegin(); it != endentries; ++it) { - info += (*it).debugInfo(); + const QList<Entry> dentries = entries(); + for (const auto &entry : dentries) { + info += entry.debugInfo(); } info += QLatin1String("### FeedDocument end ################\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/atom/entry.cpp new/syndication-5.92.0/src/atom/entry.cpp --- old/syndication-5.91.0/src/atom/entry.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/atom/entry.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -47,52 +47,40 @@ QList<Person> list; if (!a.isEmpty()) { - QList<QDomElement>::ConstIterator it = a.constBegin(); - QList<QDomElement>::ConstIterator end = a.constEnd(); list.reserve(a.count()); - for (; it != end; ++it) { - list.append(Person(*it)); - } + std::transform(a.cbegin(), a.cend(), std::back_inserter(list), [](const QDomElement &element) { + return Person(element); + }); } else { list = source().authors(); } - if (!list.isEmpty()) { - return list; - } - - return m_feedAuthors; + return !list.isEmpty() ? list : m_feedAuthors; } QList<Person> Entry::contributors() const { - QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("contributor")); + const QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("contributor")); QList<Person> list; - - QList<QDomElement>::ConstIterator it = a.constBegin(); - QList<QDomElement>::ConstIterator end = a.constEnd(); list.reserve(a.count()); - for (; it != end; ++it) { - list.append(Person(*it)); - } + std::transform(a.cbegin(), a.cend(), std::back_inserter(list), [](const QDomElement &element) { + return Person(element); + }); return list; } QList<Category> Entry::categories() const { - QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("category")); + const QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("category")); QList<Category> list; list.reserve(a.count()); - QList<QDomElement>::ConstIterator it = a.constBegin(); - QList<QDomElement>::ConstIterator end = a.constEnd(); - - for (; it != end; ++it) { - list.append(Category(*it)); - } + std::transform(a.cbegin(), a.cend(), std::back_inserter(list), [](const QDomElement &element) { + return Category(element); + }); return list; } @@ -104,16 +92,13 @@ QList<Link> Entry::links() const { - QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("link")); + const QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("link")); QList<Link> list; list.reserve(a.count()); - QList<QDomElement>::ConstIterator it = a.constBegin(); - QList<QDomElement>::ConstIterator end = a.constEnd(); - - for (; it != end; ++it) { - list.append(Link(*it)); - } + std::transform(a.cbegin(), a.cend(), std::back_inserter(list), [](const QDomElement &element) { + return Link(element); + }); return list; } @@ -221,32 +206,28 @@ info += QLatin1String("published: #") + dpublished + QLatin1String("#\n"); } - QList<Link> dlinks = links(); - QList<Link>::ConstIterator endlinks = dlinks.constEnd(); - for (QList<Link>::ConstIterator it = dlinks.constBegin(); it != endlinks; ++it) { - info += (*it).debugInfo(); + const QList<Link> dlinks = links(); + for (const auto &link : dlinks) { + info += link.debugInfo(); } - QList<Category> dcats = categories(); - QList<Category>::ConstIterator endcats = dcats.constEnd(); - for (QList<Category>::ConstIterator it = dcats.constBegin(); it != endcats; ++it) { - info += (*it).debugInfo(); + const QList<Category> dcats = categories(); + for (const auto &cat : dcats) { + info += cat.debugInfo(); } info += QLatin1String("### Authors: ###################\n"); - QList<Person> dauthors = authors(); - QList<Person>::ConstIterator endauthors = dauthors.constEnd(); - for (QList<Person>::ConstIterator it = dauthors.constBegin(); it != endauthors; ++it) { - info += (*it).debugInfo(); + const QList<Person> dauthors = authors(); + for (const auto &author : dauthors) { + info += author.debugInfo(); } info += QLatin1String("### Contributors: ###################\n"); - QList<Person> dcontri = contributors(); - QList<Person>::ConstIterator endcontri = dcontri.constEnd(); - for (QList<Person>::ConstIterator it = dcontri.constBegin(); it != endcontri; ++it) { - info += (*it).debugInfo(); + const QList<Person> dcontri = contributors(); + for (const auto &person : dcontri) { + info += person.debugInfo(); } if (!source().isNull()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/atom/source.cpp new/syndication-5.92.0/src/atom/source.cpp --- old/syndication-5.91.0/src/atom/source.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/atom/source.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -36,15 +36,13 @@ QList<Person> Source::authors() const { const QList<QDomElement> a = elementsByTagNameNS(atom1Namespace(), QStringLiteral("author")); + QList<Person> list; list.reserve(a.count()); - QList<QDomElement>::ConstIterator it = a.constBegin(); - QList<QDomElement>::ConstIterator end = a.constEnd(); - - for (; it != end; ++it) { - list.append(Person(*it)); - } + std::transform(a.cbegin(), a.cend(), std::back_inserter(list), [](const QDomElement &element) { + return Person(element); + }); return list; } @@ -55,12 +53,9 @@ QList<Person> list; list.reserve(a.count()); - QList<QDomElement>::ConstIterator it = a.constBegin(); - QList<QDomElement>::ConstIterator end = a.constEnd(); - - for (; it != end; ++it) { - list.append(Person(*it)); - } + std::transform(a.cbegin(), a.cend(), std::back_inserter(list), [](const QDomElement &element) { + return Person(element); + }); return list; } @@ -71,12 +66,9 @@ QList<Category> list; list.reserve(a.count()); - QList<QDomElement>::ConstIterator it = a.constBegin(); - QList<QDomElement>::ConstIterator end = a.constEnd(); - - for (; it != end; ++it) { - list.append(Category(*it)); - } + std::transform(a.cbegin(), a.cend(), std::back_inserter(list), [](const QDomElement &element) { + return Category(element); + }); return list; } @@ -102,12 +94,9 @@ QList<Link> list; list.reserve(a.count()); - QList<QDomElement>::ConstIterator it = a.constBegin(); - QList<QDomElement>::ConstIterator end = a.constEnd(); - - for (; it != end; ++it) { - list.append(Link(*it)); - } + std::transform(a.cbegin(), a.cend(), std::back_inserter(list), [](const QDomElement &element) { + return Link(element); + }); return list; } @@ -169,32 +158,28 @@ info += QLatin1String("updated: #") + dupdated + QLatin1String("#\n"); } - QList<Link> dlinks = links(); - QList<Link>::ConstIterator endlinks = dlinks.constEnd(); - for (QList<Link>::ConstIterator it = dlinks.constBegin(); it != endlinks; ++it) { - info += (*it).debugInfo(); + const QList<Link> dlinks = links(); + for (const auto &link : dlinks) { + info += link.debugInfo(); } - QList<Category> dcats = categories(); - QList<Category>::ConstIterator endcats = dcats.constEnd(); - for (QList<Category>::ConstIterator it = dcats.constBegin(); it != endcats; ++it) { - info += (*it).debugInfo(); + const QList<Category> dcats = categories(); + for (const auto &cat : dcats) { + info += cat.debugInfo(); } info += QLatin1String("### Authors: ###################\n"); - QList<Person> dauthors = authors(); - QList<Person>::ConstIterator endauthors = dauthors.constEnd(); - for (QList<Person>::ConstIterator it = dauthors.constBegin(); it != endauthors; ++it) { - info += (*it).debugInfo(); + const QList<Person> dauthors = authors(); + for (const auto &author : dauthors) { + info += author.debugInfo(); } info += QLatin1String("### Contributors: ###################\n"); - QList<Person> dcontri = contributors(); - QList<Person>::ConstIterator endcontri = dcontri.constEnd(); - for (QList<Person>::ConstIterator it = dcontri.constBegin(); it != endcontri; ++it) { - info += (*it).debugInfo(); + const QList<Person> dcontri = contributors(); + for (const auto &person : dcontri) { + info += person.debugInfo(); } info += QLatin1String("### Source end ################\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/feed.cpp new/syndication-5.92.0/src/feed.cpp --- old/syndication-5.91.0/src/feed.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/feed.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -49,20 +49,14 @@ info += QLatin1String("language: #") + dlanguage + QLatin1String("#\n"); } - QList<PersonPtr> dauthors = authors(); - QList<PersonPtr>::ConstIterator itp = dauthors.constBegin(); - QList<PersonPtr>::ConstIterator endp = dauthors.constEnd(); - - for (; itp != endp; ++itp) { - info += (*itp)->debugInfo(); + const QList<PersonPtr> dauthors = authors(); + for (const auto &author : dauthors) { + info += author->debugInfo(); } - QList<CategoryPtr> dcategories = categories(); - QList<CategoryPtr>::ConstIterator itc = dcategories.constBegin(); - QList<CategoryPtr>::ConstIterator endc = dcategories.constEnd(); - - for (; itc != endc; ++itc) { - info += (*itc)->debugInfo(); + const QList<CategoryPtr> dcategories = categories(); + for (const auto &catPtr : dcategories) { + info += catPtr->debugInfo(); } ImagePtr dimage = image(); @@ -77,12 +71,10 @@ info += dicon->debugInfo(); } - QList<ItemPtr> ditems = items(); - QList<ItemPtr>::ConstIterator it = ditems.constBegin(); - QList<ItemPtr>::ConstIterator end = ditems.constEnd(); + const QList<ItemPtr> ditems = items(); - for (; it != end; ++it) { - info += (*it)->debugInfo(); + for (const auto &item : ditems) { + info += item->debugInfo(); } info += QLatin1String("# Feed end ########################\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/item.cpp new/syndication-5.92.0/src/item.cpp --- old/syndication-5.91.0/src/item.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/item.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -63,28 +63,19 @@ info += QLatin1String("language: #") + dlanguage + QLatin1String("#\n"); } - QList<PersonPtr> dauthors = authors(); - QList<PersonPtr>::ConstIterator itp = dauthors.constBegin(); - QList<PersonPtr>::ConstIterator endp = dauthors.constEnd(); - - for (; itp != endp; ++itp) { - info += (*itp)->debugInfo(); + const QList<PersonPtr> dauthors = authors(); + for (const auto &author : dauthors) { + info += author->debugInfo(); } - QList<CategoryPtr> dcategories = categories(); - QList<CategoryPtr>::ConstIterator itc = dcategories.constBegin(); - QList<CategoryPtr>::ConstIterator endc = dcategories.constEnd(); - - for (; itc != endc; ++itc) { - info += (*itc)->debugInfo(); + const QList<CategoryPtr> dcategories = categories(); + for (const auto &cat : dcategories) { + info += cat->debugInfo(); } - QList<EnclosurePtr> denclosures = enclosures(); - QList<EnclosurePtr>::ConstIterator ite = denclosures.constBegin(); - QList<EnclosurePtr>::ConstIterator ende = denclosures.constEnd(); - - for (; ite != ende; ++ite) { - info += (*ite)->debugInfo(); + const QList<EnclosurePtr> denclosures = enclosures(); + for (const auto &e : denclosures) { + info += e->debugInfo(); } int dcommentsCount = commentsCount(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/loaderutil.cpp new/syndication-5.92.0/src/loaderutil.cpp --- old/syndication-5.91.0/src/loaderutil.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/loaderutil.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -63,15 +63,12 @@ } } - QUrl testURL; - // loop through, prefer feeds on same host - QStringList::const_iterator end(feeds.constEnd()); - for (QStringList::const_iterator it = feeds.constBegin(); it != end; ++it) { - testURL = QUrl(*it); - if (testURL.host() == host) { - s2 = *it; - break; - } + // Prefer feeds on same host + auto it = std::find_if(feeds.cbegin(), feeds.cend(), [&host](const QString &s) { + return QUrl(s).host() == host; + }); + if (it != feeds.cend()) { + s2 = *it; } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/mapper/feedatomimpl.cpp new/syndication-5.92.0/src/mapper/feedatomimpl.cpp --- old/syndication-5.91.0/src/mapper/feedatomimpl.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/mapper/feedatomimpl.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -34,32 +34,27 @@ QList<Syndication::ItemPtr> FeedAtomImpl::items() const { + const QList<Syndication::Atom::Entry> entries = m_doc->entries(); + QList<ItemPtr> items; - QList<Syndication::Atom::Entry> entries = m_doc->entries(); - QList<Syndication::Atom::Entry>::ConstIterator it = entries.constBegin(); - QList<Syndication::Atom::Entry>::ConstIterator end = entries.constEnd(); items.reserve(entries.count()); - for (; it != end; ++it) { - ItemAtomImplPtr item(new ItemAtomImpl(*it)); - items.append(item); - } + std::transform(entries.cbegin(), entries.cend(), std::back_inserter(items), [](const Syndication::Atom::Entry &entry) { + return ItemAtomImplPtr(new ItemAtomImpl(entry)); + }); return items; } QList<Syndication::CategoryPtr> FeedAtomImpl::categories() const { + const QList<Syndication::Atom::Category> entries = m_doc->categories(); QList<CategoryPtr> categories; - QList<Syndication::Atom::Category> entries = m_doc->categories(); - QList<Syndication::Atom::Category>::ConstIterator it = entries.constBegin(); - QList<Syndication::Atom::Category>::ConstIterator end = entries.constEnd(); categories.reserve(entries.count()); - for (; it != end; ++it) { - CategoryAtomImplPtr item(new CategoryAtomImpl(*it)); - categories.append(item); - } + std::transform(entries.cbegin(), entries.cend(), std::back_inserter(categories), [](const Syndication::Atom::Category &entry) { + return CategoryAtomImplPtr(new CategoryAtomImpl(entry)); + }); return categories; } @@ -71,19 +66,13 @@ QString FeedAtomImpl::link() const { - QList<Syndication::Atom::Link> links = m_doc->links(); - QList<Syndication::Atom::Link>::ConstIterator it = links.constBegin(); - QList<Syndication::Atom::Link>::ConstIterator end = links.constEnd(); - + const QList<Syndication::Atom::Link> links = m_doc->links(); // return first link where rel="alternate" // TODO: if there are multiple "alternate" links, find other criteria to choose one of them - for (; it != end; ++it) { - if ((*it).rel() == QLatin1String("alternate")) { - return (*it).href(); - } - } - - return QString(); + auto it = std::find_if(links.cbegin(), links.cend(), [](const Syndication::Atom::Link &link) { + return link.rel() == QLatin1String("alternate"); + }); + return it != links.cend() ? it->href() : QString{}; } QString FeedAtomImpl::description() const @@ -93,26 +82,14 @@ QList<PersonPtr> FeedAtomImpl::authors() const { - QList<Syndication::Atom::Person> atomps = m_doc->authors(); - QList<Syndication::Atom::Person> contributorAtoms = m_doc->contributors(); - QList<Syndication::Atom::Person>::ConstIterator it = atomps.constBegin(); - QList<Syndication::Atom::Person>::ConstIterator end = atomps.constEnd(); + const QList<Syndication::Atom::Person> people = m_doc->authors() + m_doc->contributors(); QList<PersonPtr> list; - list.reserve(atomps.count() + contributorAtoms.count()); + list.reserve(people.size()); - for (; it != end; ++it) { - PersonImplPtr ptr(new PersonImpl((*it).name(), (*it).uri(), (*it).email())); - list.append(ptr); - } - - it = contributorAtoms.constBegin(); - end = contributorAtoms.constEnd(); - - for (; it != end; ++it) { - PersonImplPtr ptr(new PersonImpl((*it).name(), (*it).uri(), (*it).email())); - list.append(ptr); - } + std::transform(people.cbegin(), people.cend(), std::back_inserter(list), [](const Syndication::Atom::Person &person) { + return PersonImplPtr(new PersonImpl(person.name(), person.uri(), person.email())); + }); return list; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/mapper/feedrdfimpl.cpp new/syndication-5.92.0/src/mapper/feedrdfimpl.cpp --- old/syndication-5.91.0/src/mapper/feedrdfimpl.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/mapper/feedrdfimpl.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -35,16 +35,14 @@ QList<Syndication::ItemPtr> FeedRDFImpl::items() const { + const QList<Syndication::RDF::Item> entries = m_doc->items(); + QList<ItemPtr> items; - QList<Syndication::RDF::Item> entries = m_doc->items(); - QList<Syndication::RDF::Item>::ConstIterator it = entries.constBegin(); - QList<Syndication::RDF::Item>::ConstIterator end = entries.constEnd(); items.reserve(entries.count()); - for (; it != end; ++it) { - ItemRDFImplPtr item(new ItemRDFImpl(*it)); - items.append(item); - } + std::transform(entries.cbegin(), entries.cend(), std::back_inserter(items), [](const Syndication::RDF::Item &entry) { + return ItemRDFImplPtr(new ItemRDFImpl(entry)); + }); return items; } @@ -72,15 +70,13 @@ QList<PersonPtr> FeedRDFImpl::authors() const { - QList<PersonPtr> list; + const QStringList people = m_doc->dc().creators() + m_doc->dc().contributors(); - QStringList people = m_doc->dc().creators(); - people += m_doc->dc().contributors(); - QStringList::ConstIterator it = people.constBegin(); - QStringList::ConstIterator end = people.constEnd(); + QList<PersonPtr> list; + list.reserve(people.size()); - for (; it != end; ++it) { - PersonPtr ptr = personFromString(*it); + for (const auto &person : people) { + PersonPtr ptr = personFromString(person); if (!ptr->isNull()) { list.append(ptr); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/mapper/feedrss2impl.cpp new/syndication-5.92.0/src/mapper/feedrss2impl.cpp --- old/syndication-5.91.0/src/mapper/feedrss2impl.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/mapper/feedrss2impl.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -32,32 +32,28 @@ QList<Syndication::ItemPtr> FeedRSS2Impl::items() const { + const QList<Syndication::RSS2::Item> entries = m_doc->items(); + QList<ItemPtr> items; - QList<Syndication::RSS2::Item> entries = m_doc->items(); - QList<Syndication::RSS2::Item>::ConstIterator it = entries.constBegin(); - QList<Syndication::RSS2::Item>::ConstIterator end = entries.constEnd(); items.reserve(entries.count()); - for (; it != end; ++it) { - ItemRSS2ImplPtr item(new ItemRSS2Impl(*it)); - items.append(item); - } + std::transform(entries.cbegin(), entries.cend(), std::back_inserter(items), [](const Syndication::RSS2::Item &entry) { + return ItemRSS2ImplPtr(new ItemRSS2Impl(entry)); + }); return items; } QList<Syndication::CategoryPtr> FeedRSS2Impl::categories() const { + const QList<Syndication::RSS2::Category> entries = m_doc->categories(); + QList<CategoryPtr> categories; - QList<Syndication::RSS2::Category> entries = m_doc->categories(); - QList<Syndication::RSS2::Category>::ConstIterator it = entries.constBegin(); - QList<Syndication::RSS2::Category>::ConstIterator end = entries.constEnd(); categories.reserve(entries.count()); - for (; it != end; ++it) { - CategoryRSS2ImplPtr item(new CategoryRSS2Impl(*it)); - categories.append(item); - } + std::transform(entries.cbegin(), entries.cend(), std::back_inserter(categories), [](const Syndication::RSS2::Category &entry) { + return CategoryRSS2ImplPtr(new CategoryRSS2Impl(entry)); + }); return categories; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/mapper/itematomimpl.cpp new/syndication-5.92.0/src/mapper/itematomimpl.cpp --- old/syndication-5.91.0/src/mapper/itematomimpl.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/mapper/itematomimpl.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -42,18 +42,13 @@ QString ItemAtomImpl::link() const { - QList<Syndication::Atom::Link> links = m_entry.links(); - QList<Syndication::Atom::Link>::ConstIterator it = links.constBegin(); - QList<Syndication::Atom::Link>::ConstIterator end = links.constEnd(); + const QList<Syndication::Atom::Link> links = m_entry.links(); // return first link where rel="alternate" - for (; it != end; ++it) { - if ((*it).rel() == QLatin1String("alternate")) { - return (*it).href(); - } - } - - return QString(); + auto it = std::find_if(links.cbegin(), links.cend(), [](const Syndication::Atom::Link &link) { + return link.rel() == QLatin1String("alternate"); + }); + return it != links.cend() ? it->href() : QString{}; } QString ItemAtomImpl::description() const @@ -73,26 +68,14 @@ QList<PersonPtr> ItemAtomImpl::authors() const { - QList<Syndication::Atom::Person> atomps = m_entry.authors(); - QList<Syndication::Atom::Person> contributorAtoms = m_entry.contributors(); - QList<Syndication::Atom::Person>::ConstIterator it = atomps.constBegin(); - QList<Syndication::Atom::Person>::ConstIterator end = atomps.constEnd(); + const QList<Syndication::Atom::Person> people = m_entry.authors() + m_entry.contributors(); QList<PersonPtr> list; - list.reserve(atomps.count() + contributorAtoms.count()); + list.reserve(people.size()); - for (; it != end; ++it) { - PersonImplPtr ptr(new PersonImpl((*it).name(), (*it).uri(), (*it).email())); - list.append(ptr); - } - - it = contributorAtoms.constBegin(); - end = contributorAtoms.constEnd(); - - for (; it != end; ++it) { - PersonImplPtr ptr(new PersonImpl((*it).name(), (*it).uri(), (*it).email())); - list.append(ptr); - } + std::transform(people.cbegin(), people.cend(), std::back_inserter(list), [](const Syndication::Atom::Person &person) { + return PersonImplPtr(new PersonImpl(person.name(), person.uri(), person.email())); + }); return list; } @@ -136,13 +119,11 @@ { QList<Syndication::EnclosurePtr> list; - QList<Syndication::Atom::Link> links = m_entry.links(); - QList<Syndication::Atom::Link>::ConstIterator it = links.constBegin(); - QList<Syndication::Atom::Link>::ConstIterator end = links.constEnd(); - - for (; it != end; ++it) { - if ((*it).rel() == QLatin1String("enclosure")) { - list.append(EnclosureAtomImplPtr(new EnclosureAtomImpl(*it))); + const QList<Syndication::Atom::Link> links = m_entry.links(); + + for (const auto &link : links) { + if (link.rel() == QLatin1String("enclosure")) { + list.append(EnclosureAtomImplPtr(new EnclosureAtomImpl(link))); } } @@ -151,17 +132,14 @@ QList<Syndication::CategoryPtr> ItemAtomImpl::categories() const { - QList<Syndication::CategoryPtr> list; + const QList<Syndication::Atom::Category> cats = m_entry.categories(); - QList<Syndication::Atom::Category> cats = m_entry.categories(); - QList<Syndication::Atom::Category>::ConstIterator it = cats.constBegin(); - QList<Syndication::Atom::Category>::ConstIterator end = cats.constEnd(); + QList<Syndication::CategoryPtr> list; list.reserve(cats.count()); - for (; it != end; ++it) { - CategoryAtomImplPtr impl(new CategoryAtomImpl(*it)); - list.append(impl); - } + std::transform(cats.cbegin(), cats.cend(), std::back_inserter(list), [](const Syndication::Atom::Category &c) { + return CategoryAtomImplPtr(new CategoryAtomImpl(c)); + }); return list; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/mapper/itemrdfimpl.cpp new/syndication-5.92.0/src/mapper/itemrdfimpl.cpp --- old/syndication-5.91.0/src/mapper/itemrdfimpl.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/mapper/itemrdfimpl.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -57,13 +57,10 @@ { QList<PersonPtr> list; - QStringList people = m_item.dc().creators(); - people += m_item.dc().contributors(); - QStringList::ConstIterator it = people.constBegin(); - QStringList::ConstIterator end = people.constEnd(); + const QStringList people = m_item.dc().creators() + m_item.dc().contributors(); - for (; it != end; ++it) { - PersonPtr ptr = personFromString(*it); + for (const auto &person : people) { + PersonPtr ptr = personFromString(person); if (!ptr->isNull()) { list.append(ptr); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/mapper/itemrss2impl.cpp new/syndication-5.92.0/src/mapper/itemrss2impl.cpp --- old/syndication-5.91.0/src/mapper/itemrss2impl.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/mapper/itemrss2impl.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -102,30 +102,28 @@ QList<Syndication::EnclosurePtr> ItemRSS2Impl::enclosures() const { - QList<Syndication::EnclosurePtr> list; - const QList<Syndication::RSS2::Enclosure> encs = m_item.enclosures(); + + QList<Syndication::EnclosurePtr> list; list.reserve(encs.size()); - for (auto it = encs.cbegin(); it != encs.cend(); ++it) { - EnclosureRSS2ImplPtr impl(new EnclosureRSS2Impl(m_item, *it)); - list.append(impl); - } + std::transform(encs.cbegin(), encs.cend(), std::back_inserter(list), [this](const Syndication::RSS2::Enclosure &e) { + return EnclosureRSS2ImplPtr(new EnclosureRSS2Impl(m_item, e)); + }); return list; } QList<Syndication::CategoryPtr> ItemRSS2Impl::categories() const { - QList<Syndication::CategoryPtr> list; - const QList<Syndication::RSS2::Category> cats = m_item.categories(); + + QList<Syndication::CategoryPtr> list; list.reserve(cats.size()); - for (auto it = cats.cbegin(), end = cats.cend(); it != end; ++it) { - CategoryRSS2ImplPtr impl(new CategoryRSS2Impl(*it)); - list.append(impl); - } + std::transform(cats.cbegin(), cats.cend(), std::back_inserter(list), [](const Syndication::RSS2::Category &c) { + return CategoryRSS2ImplPtr(new CategoryRSS2Impl(c)); + }); return list; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/rdf/document.cpp new/syndication-5.92.0/src/rdf/document.cpp --- old/syndication-5.91.0/src/rdf/document.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/rdf/document.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -231,15 +231,14 @@ return; } - int nmax = litems.size() < 10 ? litems.size() : 10; // we check a maximum of 10 items + const int nmax = std::min<int>(litems.size(), 10); // we check a maximum of 10 items int i = 0; - QList<Item>::ConstIterator it = litems.constBegin(); - - while (i < nmax) { - titles += (*it).originalTitle(); - ++it; - ++i; + for (const auto &item : litems) { + if (i++ >= nmax) { + break; + } + titles += item.originalTitle(); } d->itemTitleContainsMarkup = stringContainsMarkup(titles); @@ -261,15 +260,14 @@ return; } - int nmax = litems.size() < 10 ? litems.size() : 10; // we check a maximum of 10 items + const int nmax = std::min<int>(litems.size(), 10); // we check a maximum of 10 items int i = 0; - QList<Item>::ConstIterator it = litems.constBegin(); - - while (i < nmax) { - desc += (*it).originalDescription(); - ++it; - ++i; + for (const auto &item : litems) { + if (i++ >= nmax) { + break; + } + desc += item.originalDescription(); } d->itemDescriptionContainsMarkup = stringContainsMarkup(desc); @@ -299,11 +297,9 @@ info += input.debugInfo(); } - QList<Item> itlist = items(); - QList<Item>::ConstIterator it = itlist.constBegin(); - QList<Item>::ConstIterator end = itlist.constEnd(); - for (; it != end; ++it) { - info += (*it).debugInfo(); + const QList<Item> itlist = items(); + for (const auto &item : itlist) { + info += item.debugInfo(); } info += QLatin1String("### Document end ################\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/rdf/model.cpp new/syndication-5.92.0/src/rdf/model.cpp --- old/syndication-5.91.0/src/rdf/model.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/rdf/model.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -183,17 +183,11 @@ return false; } - QList<StatementPtr> stmts = stmtsBySubject[resource->uri()]; - QList<StatementPtr>::ConstIterator it = stmts.constBegin(); - QList<StatementPtr>::ConstIterator end = stmts.constEnd(); - - for (; it != end; ++it) { - if (*((*it)->predicate()) == *property) { - return true; - } - } + const QList<StatementPtr> &stmts = stmtsBySubject[resource->uri()]; - return false; + return std::any_of(stmts.cbegin(), stmts.cend(), [&property](const StatementPtr &p) { + return *(p->predicate()) == *property; + }); } StatementPtr Model::resourceProperty(const Resource *resource, PropertyPtr property) const @@ -203,17 +197,11 @@ StatementPtr Model::ModelPrivate::resourceProperty(const Resource *resource, PropertyPtr property) const { - QList<StatementPtr> stmts = stmtsBySubject[resource->uri()]; - QList<StatementPtr>::ConstIterator it = stmts.constBegin(); - QList<StatementPtr>::ConstIterator end = stmts.constEnd(); - - for (; it != end; ++it) { - if (*((*it)->predicate()) == *property) { - return *it; - } - } - - return nullStatement; + const QList<StatementPtr> &stmts = stmtsBySubject[resource->uri()]; + auto it = std::find_if(stmts.cbegin(), stmts.cend(), [&property](const StatementPtr &p) { + return *(p->predicate()) == *property; + }); + return it != stmts.cend() ? *it : nullStatement; } QList<StatementPtr> Model::resourceProperties(const Resource *resource, PropertyPtr property) const @@ -224,13 +212,11 @@ QList<StatementPtr> Model::ModelPrivate::resourceProperties(const Resource *resource, PropertyPtr property) const { QList<StatementPtr> res; - QList<StatementPtr> stmts = stmtsBySubject[resource->uri()]; - QList<StatementPtr>::ConstIterator it = stmts.constBegin(); - QList<StatementPtr>::ConstIterator end = stmts.constEnd(); - - for (; it != end; ++it) { - if (*((*it)->predicate()) == *property) { - res.append(*it); + + const QList<StatementPtr> &stmts = stmtsBySubject[resource->uri()]; + for (const auto &p : stmts) { + if (*(p->predicate()) == *property) { + res.append(p); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/rdf/parser.cpp new/syndication-5.92.0/src/rdf/parser.cpp --- old/syndication-5.91.0/src/rdf/parser.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/rdf/parser.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -119,14 +119,10 @@ // map statement predicates to RSS 1.0 - QList<StatementPtr> statements = model.statements(); - QList<StatementPtr>::ConstIterator it = statements.constBegin(); - QList<StatementPtr>::ConstIterator end = statements.constEnd(); + const QList<StatementPtr> &statements = model.statements(); - for (; it != end; ++it) { - StatementPtr stmt = *it; - - QString predUri = stmt->predicate()->uri(); + for (const auto &stmt : statements) { + const QString predUri = stmt->predicate()->uri(); if (uris09.contains(predUri)) { model.addStatement(stmt->subject(), hash[predUri], stmt->object()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/rss2/document.cpp new/syndication-5.92.0/src/rss2/document.cpp --- old/syndication-5.91.0/src/rss2/document.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/rss2/document.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -160,15 +160,14 @@ QList<Category> Document::categories() const { - QList<Category> categories; + const QList<QDomElement> catNodes = elementsByTagNameNS(QString(), QStringLiteral("category")); - QList<QDomElement> catNodes = elementsByTagNameNS(QString(), QStringLiteral("category")); + QList<Category> categories; categories.reserve(catNodes.count()); - QList<QDomElement>::ConstIterator it = catNodes.constBegin(); - QList<QDomElement>::ConstIterator end(catNodes.constEnd()); - for (; it != end; ++it) { - categories.append(Category(*it)); - } + + std::transform(catNodes.cbegin(), catNodes.cend(), std::back_inserter(categories), [](const QDomElement &element) { + return Category(element); + }); return categories; } @@ -222,11 +221,9 @@ if (!skipHoursNode.isNull()) { ElementWrapper skipHoursWrapper(skipHoursNode); bool ok = false; - QList<QDomElement> hours = skipHoursWrapper.elementsByTagNameNS(QString(), QStringLiteral("hour")); - QList<QDomElement>::ConstIterator it = hours.constBegin(); - const QList<QDomElement>::ConstIterator end(hours.constEnd()); - for (; it != end; ++it) { - int h = (*it).text().toInt(&ok); + const QList<QDomElement> hours = skipHoursWrapper.elementsByTagNameNS(QString(), QStringLiteral("hour")); + for (const auto &element : hours) { + const int h = element.text().toInt(&ok); if (ok) { skipHours.insert(h); } @@ -242,21 +239,28 @@ QDomElement skipDaysNode = firstElementByTagNameNS(QString(), QStringLiteral("skipDays")); if (!skipDaysNode.isNull()) { ElementWrapper skipDaysWrapper(skipDaysNode); - QHash<QString, DayOfWeek> weekDays; - - weekDays[QStringLiteral("Monday")] = Monday; - weekDays[QStringLiteral("Tuesday")] = Tuesday; - weekDays[QStringLiteral("Wednesday")] = Wednesday; - weekDays[QStringLiteral("Thursday")] = Thursday; - weekDays[QStringLiteral("Friday")] = Friday; - weekDays[QStringLiteral("Saturday")] = Saturday; - weekDays[QStringLiteral("Sunday")] = Sunday; - - QList<QDomElement> days = skipDaysWrapper.elementsByTagNameNS(QString(), QStringLiteral("day")); - const QList<QDomElement>::ConstIterator daysEnd(days.constEnd()); - for (QList<QDomElement>::ConstIterator it = days.constBegin(); it != daysEnd; ++it) { - if (weekDays.contains((*it).text())) { - skipDays.insert(weekDays[(*it).text()]); + struct DayInfo { + QLatin1String name; + DayOfWeek enumValue; + }; + static const std::vector<DayInfo> weekDays = { + {QLatin1String("Monday"), Monday}, + {QLatin1String("Tuesday"), Tuesday}, + {QLatin1String("Wednesday"), Wednesday}, + {QLatin1String("Thursday"), Thursday}, + {QLatin1String("Friday"), Friday}, + {QLatin1String("Saturday"), Saturday}, + {QLatin1String("Sunday"), Sunday}, + }; + + const QList<QDomElement> days = skipDaysWrapper.elementsByTagNameNS(QString(), QStringLiteral("day")); + for (const auto &element : days) { + const QString day = element.text(); + auto it = std::find_if(weekDays.cbegin(), weekDays.cend(), [&day](const DayInfo &info) { + return info.name == day; + }); + if (it != weekDays.cend()) { + skipDays.insert(it->enumValue); } } } @@ -266,17 +270,16 @@ QList<Item> Document::items() const { - QList<Item> items; + const QList<QDomElement> itemNodes = elementsByTagNameNS(QString(), QStringLiteral("item")); - QList<QDomElement> itemNodes = elementsByTagNameNS(QString(), QStringLiteral("item")); + QList<Item> items; + items.reserve(itemNodes.count()); DocumentPtr doccpy(new Document(*this)); - items.reserve(itemNodes.count()); - const QList<QDomElement>::ConstIterator end(itemNodes.constEnd()); - for (QList<QDomElement>::ConstIterator it = itemNodes.constBegin(); it != end; ++it) { - items.append(Item(*it, doccpy)); - } + std::transform(itemNodes.cbegin(), itemNodes.cend(), std::back_inserter(items), [&doccpy](const QDomElement &element) { + return Item(element, doccpy); + }); return items; } @@ -371,16 +374,15 @@ info += image().debugInfo(); } - QList<Category> cats = categories(); + const QList<Category> cats = categories(); + + for (const auto &c : cats) { + info += c.debugInfo(); + } - const QList<Category>::ConstIterator end(cats.constEnd()); - for (QList<Category>::ConstIterator it = cats.constBegin(); it != end; ++it) { - info += (*it).debugInfo(); - } - QList<Item> litems = items(); - const QList<Item>::ConstIterator itEnd(litems.constEnd()); - for (QList<Item>::ConstIterator it = litems.constBegin(); it != itEnd; ++it) { - info += (*it).debugInfo(); + const QList<Item> litems = items(); + for (const auto &item : litems) { + info += item.debugInfo(); } info += QLatin1String("### Document end ################\n"); return info; @@ -400,15 +402,14 @@ QDomElement titleEl = (*litems.begin()).firstElementByTagNameNS(QString(), QStringLiteral("title")); d->itemTitleIsCDATA = titleEl.firstChild().isCDATASection(); - int nmax = litems.size() < 10 ? litems.size() : 10; // we check a maximum of 10 items + const int nmax = std::min<int>(litems.size(), 10); // we check a maximum of 10 items int i = 0; - QList<Item>::ConstIterator it = litems.constBegin(); - - while (i < nmax) { - titles += (*it).originalTitle(); - ++it; - ++i; + for (const auto &item : litems) { + if (i++ >= nmax) { + break; + } + titles += item.originalTitle(); } d->itemTitleContainsMarkup = stringContainsMarkup(titles); @@ -437,15 +438,14 @@ QDomElement descEl = (*litems.begin()).firstElementByTagNameNS(QString(), QStringLiteral("description")); d->itemDescriptionIsCDATA = descEl.firstChild().isCDATASection(); - int nmax = litems.size() < 10 ? litems.size() : 10; // we check a maximum of 10 items + const int nmax = std::min<int>(litems.size(), 10); // we check a maximum of 10 items int i = 0; - QList<Item>::ConstIterator it = litems.constBegin(); - - while (i < nmax) { - desc += (*it).originalDescription(); - ++it; - ++i; + for (const auto &item : litems) { + if (i++ >= nmax) { + break; + } + desc += item.originalDescription(); } d->itemDescriptionContainsMarkup = stringContainsMarkup(desc); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syndication-5.91.0/src/rss2/item.cpp new/syndication-5.92.0/src/rss2/item.cpp --- old/syndication-5.91.0/src/rss2/item.cpp 2022-02-05 16:20:19.000000000 +0100 +++ new/syndication-5.92.0/src/rss2/item.cpp 2022-03-05 12:21:18.000000000 +0100 @@ -130,16 +130,15 @@ QList<Category> Item::categories() const { - QList<QDomElement> cats = elementsByTagNameNS(QString(), QStringLiteral("category")); + const QList<QDomElement> cats = elementsByTagNameNS(QString(), QStringLiteral("category")); QList<Category> categories; categories.reserve(cats.count()); - QList<QDomElement>::ConstIterator it = cats.constBegin(); - const QList<QDomElement>::ConstIterator end(cats.constEnd()); - for (; it != end; ++it) { - categories.append(Category(*it)); - } + std::transform(cats.cbegin(), cats.cend(), std::back_inserter(categories), [](const QDomElement &element) { + return Category(element); + }); + return categories; } @@ -161,16 +160,15 @@ QList<Enclosure> Item::enclosures() const { - QList<QDomElement> encs = elementsByTagNameNS(QString(), QStringLiteral("enclosure")); + const QList<QDomElement> encs = elementsByTagNameNS(QString(), QStringLiteral("enclosure")); QList<Enclosure> enclosures; enclosures.reserve(encs.count()); - QList<QDomElement>::ConstIterator it = encs.constBegin(); - QList<QDomElement>::ConstIterator end(encs.constEnd()); - for (; it != end; ++it) { - enclosures.append(Enclosure(*it)); - } + std::transform(encs.cbegin(), encs.cend(), std::back_inserter(enclosures), [](const QDomElement &element) { + return Enclosure(element); + }); + return enclosures; } @@ -257,15 +255,14 @@ info += source().debugInfo(); } - QList<Category> cats = categories(); - const QList<Category>::ConstIterator endCategories(cats.constEnd()); - for (QList<Category>::ConstIterator it = cats.constBegin(); it != endCategories; ++it) { - info += (*it).debugInfo(); - } - QList<Enclosure> encs = enclosures(); - const QList<Enclosure>::ConstIterator endEnclosures(encs.constEnd()); - for (QList<Enclosure>::ConstIterator it = encs.constBegin(); it != endEnclosures; ++it) { - info += (*it).debugInfo(); + const QList<Category> cats = categories(); + for (const auto &c : cats) { + info += c.debugInfo(); + } + + const QList<Enclosure> encs = enclosures(); + for (const auto &e : encs) { + info += e.debugInfo(); } info += QLatin1String("### Item end ################\n");
