From ba4b88d9d2f1dd03906f445c55f8959e0165505f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 8 Aug 2023 07:37:03 +0200 Subject: [PATCH] QSslSocket manual test: replace QList with const array "Never use a dynamically-sized container for statically-sized data." Port the loop from Q_FOREACH (which can't deal with arrays) to ranged for (which can). Pick-to: 6.6 6.5 Task-number: QTBUG-115839 Change-Id: Ib89d07fb751e3905a230ee5641e2e509e9415bed Reviewed-by: Ivan Solovev --- tests/manual/qsslsocket/main.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/manual/qsslsocket/main.cpp b/tests/manual/qsslsocket/main.cpp index 2894b3c1fa..e7f5e91997 100644 --- a/tests/manual/qsslsocket/main.cpp +++ b/tests/manual/qsslsocket/main.cpp @@ -30,14 +30,15 @@ void tst_QSslSocket::nextProtocolNegotiation_data() QTest::addColumn("expectedProtocol"); QTest::addColumn("expectedStatus"); - QList hosts = QList() - << QStringLiteral("www.google.com") - << QStringLiteral("www.facebook.com") - << QStringLiteral("www.twitter.com") - << QStringLiteral("graph.facebook.com") - << QStringLiteral("api.twitter.com"); + const QString hosts[] = { + QStringLiteral("www.google.com"), + QStringLiteral("www.facebook.com"), + QStringLiteral("www.twitter.com"), + QStringLiteral("graph.facebook.com"), + QStringLiteral("api.twitter.com"), + }; - foreach (QString host, hosts) { + for (const QString &host : hosts) { QByteArray tag = host.toLocal8Bit(); tag.append("-none"); QTest::newRow(tag)