QtNetwork: port away from Java-style iterators

They are going to be deprecated.

Change-Id: Ib021aad108dc021df76ae21d1db6c8a1a734893d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Marc Mutz 2019-05-19 23:31:41 +02:00
parent eeffdef1d7
commit 0efc6a88b6

View File

@ -229,13 +229,12 @@ QSctpSocket *QSctpServer::nextPendingDatagramConnection()
{
Q_D(QSctpServer);
QMutableListIterator<QTcpSocket *> i(d->pendingConnections);
while (i.hasNext()) {
QSctpSocket *socket = qobject_cast<QSctpSocket *>(i.next());
for (auto it = d->pendingConnections.begin(), end = d->pendingConnections.end(); it != end; ++it) {
QSctpSocket *socket = qobject_cast<QSctpSocket *>(*it);
Q_ASSERT(socket);
if (socket->isInDatagramMode()) {
i.remove();
d->pendingConnections.erase(it);
Q_ASSERT(d->socketEngine);
d->socketEngine->setReadNotificationEnabled(true);
return socket;