diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-06-18 03:02:51 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-06-18 03:02:51 +0200 |
commit | 96ca884fcaa1865cee7f4e125c891ca184dac0f4 (patch) | |
tree | cf3dc16371a4f29a75b3b3325722f71b1629202c | |
parent | 9a389ca1cc21c97c44f1dc94757cf64cf82fa38f (diff) | |
parent | 9272983e464713df9b768291d531c2d687345d74 (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: Iba4ae61f3f701c9a11674a25ef81fc7220445e17
-rw-r--r-- | src/coap/qcoapinternalmessage.cpp | 10 | ||||
-rw-r--r-- | src/coap/qcoapinternalmessage_p.h | 2 | ||||
-rw-r--r-- | src/coap/qcoapinternalreply.cpp | 9 | ||||
-rw-r--r-- | src/coap/qcoapinternalreply_p.h | 3 | ||||
-rw-r--r-- | src/coap/qcoapprotocol.cpp | 8 | ||||
-rw-r--r-- | tests/auto/qcoapclient/tst_qcoapclient.cpp | 24 |
6 files changed, 17 insertions, 39 deletions
diff --git a/src/coap/qcoapinternalmessage.cpp b/src/coap/qcoapinternalmessage.cpp index 59f63ba..fe4a34c 100644 --- a/src/coap/qcoapinternalmessage.cpp +++ b/src/coap/qcoapinternalmessage.cpp @@ -90,16 +90,6 @@ QCoapInternalMessage::QCoapInternalMessage(const QCoapMessage &message, QObject /*! \internal - - Constructs a copy of \a other and sets \a parent as the parent object. -*/ -QCoapInternalMessage::QCoapInternalMessage(const QCoapInternalMessage &other, QObject *parent) : - QObject(*new QCoapInternalMessagePrivate(*other.d_func()), parent) -{ -} - -/*! - \internal Constructs a new QCoapInternalMessage with \a dd as the d_ptr. This constructor must be used when subclassing internally the QCoapInternalMessage class. diff --git a/src/coap/qcoapinternalmessage_p.h b/src/coap/qcoapinternalmessage_p.h index 8ed1309..d6a08af 100644 --- a/src/coap/qcoapinternalmessage_p.h +++ b/src/coap/qcoapinternalmessage_p.h @@ -54,7 +54,6 @@ class Q_AUTOTEST_EXPORT QCoapInternalMessage : public QObject public: explicit QCoapInternalMessage(QObject *parent = nullptr); explicit QCoapInternalMessage(const QCoapMessage &message, QObject *parent = nullptr); - QCoapInternalMessage(const QCoapInternalMessage &other, QObject *parent = nullptr); virtual ~QCoapInternalMessage() {} void addOption(QCoapOption::OptionName name, const QByteArray &value); @@ -84,7 +83,6 @@ class Q_AUTOTEST_EXPORT QCoapInternalMessagePrivate : public QObjectPrivate { public: QCoapInternalMessagePrivate() = default; - QCoapInternalMessagePrivate(const QCoapInternalMessagePrivate &other) = default; ~QCoapInternalMessagePrivate(); QCoapMessage message; diff --git a/src/coap/qcoapinternalreply.cpp b/src/coap/qcoapinternalreply.cpp index b795046..2e7495c 100644 --- a/src/coap/qcoapinternalreply.cpp +++ b/src/coap/qcoapinternalreply.cpp @@ -58,15 +58,6 @@ QCoapInternalReply::QCoapInternalReply(QObject *parent) : /*! \internal - Constructs a copy of \a other with \a parent as the parent obect. -*/ -QCoapInternalReply::QCoapInternalReply(const QCoapInternalReply &other, QObject *parent) : - QCoapInternalMessage(*new QCoapInternalReplyPrivate(*other.d_func()), parent) -{ -} - -/*! - \internal Creates a QCoapInternalReply from the CoAP \a reply frame. For more details, refer to section diff --git a/src/coap/qcoapinternalreply_p.h b/src/coap/qcoapinternalreply_p.h index f144b47..4e9d60b 100644 --- a/src/coap/qcoapinternalreply_p.h +++ b/src/coap/qcoapinternalreply_p.h @@ -55,7 +55,6 @@ class Q_AUTOTEST_EXPORT QCoapInternalReply : public QCoapInternalMessage Q_OBJECT public: explicit QCoapInternalReply(QObject *parent = nullptr); - QCoapInternalReply(const QCoapInternalReply &other, QObject *parent = nullptr); static QCoapInternalReply *createFromFrame(const QByteArray &frame, QObject *parent = nullptr); void appendData(const QByteArray &data); @@ -84,6 +83,4 @@ public: QT_END_NAMESPACE -Q_DECLARE_METATYPE(QCoapInternalReply) - #endif // QCOAPINTERNALREPLY_H diff --git a/src/coap/qcoapprotocol.cpp b/src/coap/qcoapprotocol.cpp index 3a6f3ca..30ee188 100644 --- a/src/coap/qcoapprotocol.cpp +++ b/src/coap/qcoapprotocol.cpp @@ -383,8 +383,8 @@ void QCoapProtocolPrivate::onFrameReceived(const QByteArray &data, const QHostAd } // Send next block, ask for next block, or process the final reply - if (reply->hasMoreBlocksToSend()) { - request->setToSendBlock(reply->nextBlockToSend(), blockSize); + if (reply->hasMoreBlocksToSend() && reply->nextBlockToSend() >= 0) { + request->setToSendBlock(static_cast<uint>(reply->nextBlockToSend()), blockSize); request->setMessageId(generateUniqueMessageId()); sendRequest(request); } else if (reply->hasMoreBlocksToReceive()) { @@ -954,7 +954,9 @@ quint16 QCoapProtocol::blockSize() const */ uint QCoapProtocol::maximumTransmitSpan() const { - return static_cast<uint>(ackTimeout() * (1u << (maximumRetransmitCount() - 1)) * ackRandomFactor()); + return static_cast<uint>(ackTimeout() + * ((1u << maximumRetransmitCount()) - 1) + * ackRandomFactor()); } /*! diff --git a/tests/auto/qcoapclient/tst_qcoapclient.cpp b/tests/auto/qcoapclient/tst_qcoapclient.cpp index 20f1cab..5ca695c 100644 --- a/tests/auto/qcoapclient/tst_qcoapclient.cpp +++ b/tests/auto/qcoapclient/tst_qcoapclient.cpp @@ -224,7 +224,7 @@ void tst_QCoapClient::incorrectUrls() else if (qstrcmp(QTest::currentDataTag(), "discover") == 0) reply.reset(client.discover(url)); else { - QString error = QLatin1Literal("Unrecognized method '") + QTest::currentDataTag() + "'"; + QString error = QLatin1String("Unrecognized method '") + QTest::currentDataTag() + "'"; QFAIL(qPrintable(error)); } @@ -275,7 +275,7 @@ void tst_QCoapClient::methods() else if (qstrncmp(QTest::currentDataTag(), "delete", 6) == 0) reply.reset(client.deleteResource(request)); else { - QString error = QLatin1Literal("Unrecognized method '") + QTest::currentDataTag() + "'"; + QString error = QLatin1String("Unrecognized method '") + QTest::currentDataTag() + "'"; QFAIL(qPrintable(error)); } @@ -303,7 +303,7 @@ void tst_QCoapClient::methods() QVERIFY(replyData.isEmpty()); QCOMPARE(reply->responseCode(), QtCoap::ResponseCode::Deleted); } else { - QString error = QLatin1Literal("Unrecognized method '") + QTest::currentDataTag() + "'"; + QString error = QLatin1String("Unrecognized method '") + QTest::currentDataTag() + "'"; QFAIL(qPrintable(error)); } } @@ -362,7 +362,7 @@ void tst_QCoapClient::setBlockSize() QFETCH(int, blockSizeExpected); QCoapClientForTests client; - client.setBlockSize(blockSizeSet); + client.setBlockSize(static_cast<quint16>(blockSizeSet)); QEventLoop eventLoop; QTimer::singleShot(1000, &eventLoop, &QEventLoop::quit); @@ -483,19 +483,19 @@ void tst_QCoapClient::socketError() } void tst_QCoapClient::timeout_data() { - QTest::addColumn<int>("timeout"); - QTest::addColumn<int>("maximumRetransmitCount"); + QTest::addColumn<uint>("timeout"); + QTest::addColumn<uint>("maximumRetransmitCount"); - QTest::newRow("2000/0") << 2000 << 0; - QTest::newRow("2000/2") << 2000 << 2; - QTest::newRow("4000/0") << 4000 << 0; + QTest::newRow("2000/0") << 2000u << 0u; + QTest::newRow("2000/2") << 2000u << 2u; + QTest::newRow("4000/0") << 4000u << 0u; } void tst_QCoapClient::timeout() { #ifdef QT_BUILD_INTERNAL - QFETCH(int, timeout); - QFETCH(int, maximumRetransmitCount); + QFETCH(uint, timeout); + QFETCH(uint, maximumRetransmitCount); QCoapClientForTests client; // Trigger a network timeout @@ -514,7 +514,7 @@ void tst_QCoapClient::timeout() QSignalSpy spyReplyFinished(reply.data(), &QCoapReply::finished); // Check timeout upper limit - int transmissions = maximumRetransmitCount + 1; + uint transmissions = maximumRetransmitCount + 1; // 10% Precision expected at least, plus timer precision QTRY_COMPARE_WITH_TIMEOUT(spyReplyError.count(), 1, static_cast<int>( |