Fix some warnings in tests
../tst_qfile.cpp: In member function 'void tst_QFile::handle()': ../tst_qfile.cpp:2661:38: warning: ignoring return value of 'ssize_t read(int, void*, size_t)', declared with attribute warn_unused_result [-Wunused-result] tst_qstatictext.cpp:862:58: warning: unused parameter 'textItem' [-Wunused-parameter] ../tst_qtcpsocket.cpp: In member function 'void tst_QTcpSocket::abortiveClose()': ../tst_qtcpsocket.cpp:2254:90: warning: suggest parentheses around assignment used as truth value [-Wparentheses] Test.cpp: In member function 'void My4Socket::read()': Test.cpp:66:20: warning: 'reply' may be used uninitialized in this function [-Wmaybe-uninitialized] ../tst_qlocalsocket.cpp: In lambda function: ../tst_qlocalsocket.cpp:701:51: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] ../tst_qtcpserver.cpp: In member function 'void tst_QTcpServer::linkLocal()': ../tst_qtcpserver.cpp:935:92: warning: suggest parentheses around assignment used as truth value [-Wparentheses] ../tst_qtcpserver.cpp:940:92: warning: suggest parentheses around assignment used as truth value [-Wparentheses] Change-Id: Ic315069768bcb63a6b333c28ac65b0b992b0d43f Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>bb10
parent
277208c169
commit
49cdf51ac9
|
|
@ -2658,7 +2658,8 @@ void tst_QFile::handle()
|
|||
QVERIFY(fd > 2);
|
||||
QCOMPARE(int(file.handle()), fd);
|
||||
char c = '\0';
|
||||
QT_READ(int(file.handle()), &c, 1);
|
||||
const auto readResult = QT_READ(int(file.handle()), &c, 1);
|
||||
QCOMPARE(readResult, static_cast<decltype(readResult)>(1));
|
||||
QCOMPARE(c, '/');
|
||||
|
||||
// test if the QFile and the handle remain in sync
|
||||
|
|
|
|||
|
|
@ -859,7 +859,7 @@ void tst_QStaticText::textDocumentColor()
|
|||
class TestPaintEngine: public QPaintEngine
|
||||
{
|
||||
public:
|
||||
void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE
|
||||
void drawTextItem(const QPointF &p, const QTextItem &) Q_DECL_OVERRIDE
|
||||
{
|
||||
differentVerticalPositions.insert(qRound(p.y()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -698,7 +698,7 @@ void tst_QLocalSocket::simpleCommandProtocol2()
|
|||
|
||||
QObject::connect(localSocketRead, &QLocalSocket::readyRead, [&] {
|
||||
forever {
|
||||
if (localSocketRead->bytesAvailable() < sizeof(qint64))
|
||||
if (localSocketRead->bytesAvailable() < qint64(sizeof(qint64)))
|
||||
return;
|
||||
|
||||
if (blockSize == 0) {
|
||||
|
|
|
|||
|
|
@ -929,15 +929,16 @@ void tst_QTcpServer::linkLocal()
|
|||
|
||||
//each server should have two connections
|
||||
foreach (QTcpServer* server, servers) {
|
||||
QTcpSocket* remote;
|
||||
//qDebug() << "checking for connections" << server->serverAddress() << ":" << server->serverPort();
|
||||
QVERIFY(server->waitForNewConnection(5000));
|
||||
QVERIFY(remote = server->nextPendingConnection());
|
||||
QTcpSocket* remote = server->nextPendingConnection();
|
||||
QVERIFY(remote != nullptr);
|
||||
remote->close();
|
||||
delete remote;
|
||||
if (!server->hasPendingConnections())
|
||||
QVERIFY(server->waitForNewConnection(5000));
|
||||
QVERIFY(remote = server->nextPendingConnection());
|
||||
remote = server->nextPendingConnection();
|
||||
QVERIFY(remote != nullptr);
|
||||
remote->close();
|
||||
delete remote;
|
||||
QVERIFY(!server->hasPendingConnections());
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ void My4Socket::read(void)
|
|||
{
|
||||
QDataStream in(this);
|
||||
|
||||
quint32 num, reply;
|
||||
quint32 num = 0;
|
||||
quint32 reply = 0;
|
||||
|
||||
while (bytesAvailable()) {
|
||||
in >> num;
|
||||
|
|
|
|||
|
|
@ -2251,7 +2251,8 @@ void tst_QTcpSocket::abortiveClose()
|
|||
enterLoop(10);
|
||||
QVERIFY(server.hasPendingConnections());
|
||||
|
||||
QVERIFY(tmpSocket = server.nextPendingConnection());
|
||||
tmpSocket = server.nextPendingConnection();
|
||||
QVERIFY(tmpSocket != nullptr);
|
||||
|
||||
qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError");
|
||||
QSignalSpy readyReadSpy(clientSocket, SIGNAL(readyRead()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue