diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2016-08-02 14:51:56 +0300 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2016-08-03 06:21:47 +0000 |
commit | 733c4de36e71fa58dc444a181d725bfa46699a16 (patch) | |
tree | 0879ae3c0c165d9fb5ccebf750ce01abec0ad03c /tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp | |
parent | c0637c02980a20343f877a24869ec539d05e4546 (diff) |
Fix some syntax issues in SCTP implementation
Change-Id: I718fd060e313d544a5470fa20183db04ef89b1ca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp')
-rw-r--r-- | tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp b/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp index 70297f8cc4..fc976fbd0d 100644 --- a/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp +++ b/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp @@ -118,13 +118,13 @@ void tst_QSctpSocket::constructing() char c; QCOMPARE(socket.getChar(&c), false); - QCOMPARE((int) socket.bytesAvailable(), 0); + QCOMPARE(socket.bytesAvailable(), Q_INT64_C(0)); QCOMPARE(socket.canReadLine(), false); QCOMPARE(socket.readLine(), QByteArray()); - QCOMPARE(socket.socketDescriptor(), (qintptr)-1); - QCOMPARE((int) socket.localPort(), 0); + QCOMPARE(socket.socketDescriptor(), qintptr(-1)); + QCOMPARE(int(socket.localPort()), 0); QVERIFY(socket.localAddress() == QHostAddress()); - QCOMPARE((int) socket.peerPort(), 0); + QCOMPARE(int(socket.peerPort()), 0); QVERIFY(socket.peerAddress() == QHostAddress()); QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError); QCOMPARE(socket.errorString(), QString("Unknown error")); @@ -139,11 +139,11 @@ void tst_QSctpSocket::bind_data() // iterate all interfaces, add all addresses on them as test data QList<QNetworkInterface> interfaces = QNetworkInterface::allInterfaces(); - foreach (const QNetworkInterface &interface, interfaces) { + for (const QNetworkInterface &interface : interfaces) { if (!interface.isValid()) continue; - foreach (const QNetworkAddressEntry &entry, interface.addressEntries()) { + for (const QNetworkAddressEntry &entry : interface.addressEntries()) { if (entry.ip().isInSubnet(QHostAddress::parseSubnet("fe80::/10")) || entry.ip().isInSubnet(QHostAddress::parseSubnet("169.254/16"))) continue; // link-local bind will fail, at least on Linux, so skip it. @@ -178,11 +178,10 @@ void tst_QSctpSocket::bind() QSctpSocket socket; qDebug() << "Binding " << addr; - if (successExpected) { + if (successExpected) QVERIFY2(socket.bind(addr), qPrintable(socket.errorString())); - } else { + else QVERIFY(!socket.bind(addr)); - } QCOMPARE(socket.localAddress(), expectedLocalAddress); } @@ -191,9 +190,9 @@ void tst_QSctpSocket::bind() void tst_QSctpSocket::setInvalidSocketDescriptor() { QSctpSocket socket; - QCOMPARE(socket.socketDescriptor(), (qintptr)INVALID_SOCKET); + QCOMPARE(socket.socketDescriptor(), qintptr(INVALID_SOCKET)); QVERIFY(!socket.setSocketDescriptor(-5, QAbstractSocket::UnconnectedState)); - QCOMPARE(socket.socketDescriptor(), (qintptr)INVALID_SOCKET); + QCOMPARE(socket.socketDescriptor(), qintptr(INVALID_SOCKET)); QCOMPARE(socket.error(), QAbstractSocket::UnsupportedSocketOperationError); } @@ -211,7 +210,7 @@ void tst_QSctpSocket::setSocketDescriptor() QVERIFY(sock != INVALID_SOCKET); QSctpSocket socket; QVERIFY(socket.setSocketDescriptor(sock, QAbstractSocket::UnconnectedState)); - QCOMPARE(socket.socketDescriptor(), (qintptr)sock); + QCOMPARE(socket.socketDescriptor(), qintptr(sock)); QCOMPARE(socket.readChannelCount(), 0); QCOMPARE(socket.writeChannelCount(), 0); @@ -237,7 +236,7 @@ void tst_QSctpSocket::socketDescriptor() QVERIFY(server.listen()); - QCOMPARE(socket.socketDescriptor(), (qintptr)INVALID_SOCKET); + QCOMPARE(socket.socketDescriptor(), qintptr(INVALID_SOCKET)); socket.connectToHost(QHostAddress::LocalHost, server.serverPort()); QVERIFY(server.waitForNewConnection(3000)); if (socket.state() != QAbstractSocket::ConnectedState) { |