From b2a95f9eeef5cc34111707c7af50eef512a07035 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Sun, 23 Apr 2023 14:58:57 +0200 Subject: [PATCH] qc14n.h: general cleanup - Add missing includes - Use std::all_of, that also fixes a narrowing conversion warning (qsizetype). Change-Id: I0f7f4b91bda4c187b8f8094e3039079c43fbf478 Reviewed-by: Thiago Macieira --- .../corelib/serialization/qxmlstream/qc14n.h | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tests/auto/corelib/serialization/qxmlstream/qc14n.h b/tests/auto/corelib/serialization/qxmlstream/qc14n.h index 0a06f0185d..803fe06c70 100644 --- a/tests/auto/corelib/serialization/qxmlstream/qc14n.h +++ b/tests/auto/corelib/serialization/qxmlstream/qc14n.h @@ -1,10 +1,11 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -QT_FORWARD_DECLARE_CLASS(QIODevice) -QT_FORWARD_DECLARE_CLASS(QString) - +#include #include +#include + +#include class QC14N { @@ -93,18 +94,11 @@ bool QC14N::isAttributesEqual(const QXmlStreamReader &r1, const QXmlStreamAttributes &attrs1 = r1.attributes(); const QXmlStreamAttributes &attrs2 = r2.attributes(); - const int len = attrs1.size(); - - if(len != attrs2.size()) + if (attrs1.size() != attrs2.size()) return false; - for(int i = 0; i < len; ++i) - { - if(!attrs2.contains(attrs1.at(i))) - return false; - } - - return true; + auto existsInOtherList = [&attrs2](const auto &attr) { return attrs2.contains(attr); }; + return std::all_of(attrs1.cbegin(), attrs1.cend(), existsInOtherList); } bool QC14N::isDifferent(const QXmlStreamReader &r1,