Mark the whole repo with QT_NO_URL_CAST_FROM_STRING

Pick-to: 6.11
Change-Id: Ic4457f2151822e7bf2d6e4463b15f2835f860cbd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Ahmad Samir 2025-11-17 13:56:36 +02:00
parent ba86f5ba99
commit 0861fb612a
5 changed files with 11 additions and 8 deletions

View File

@ -4,4 +4,5 @@ set(QT_EXTRA_INTERNAL_TARGET_DEFINES
"QT_NO_CONTEXTLESS_CONNECT=1"
"QT_NO_FOREACH=1"
"QT_NO_QASCONST=1"
"QT_NO_URL_CAST_FROM_STRING=1"
)

View File

@ -10,6 +10,8 @@
#include <QtCore/qloggingcategory.h>
#include <QtCore/QDebug>
using namespace Qt::StringLiterals;
QT_BEGIN_NAMESPACE
namespace {
@ -259,7 +261,7 @@ QUrl QCoapRequestPrivate::adjustedUrl(const QUrl &url, bool secure)
if (url.host().isEmpty() && url.isRelative()) {
// In some cases host address is mistaken for part of the relative path,
// prepending the scheme fixes this.
finalizedUrl = url.toString().prepend(scheme + QLatin1String("://"));
finalizedUrl = QUrl{scheme + "://"_L1 + url.toString()};
} else if (url.scheme().isEmpty()) {
finalizedUrl.setScheme(scheme);
}

View File

@ -217,9 +217,9 @@ public slots:
void tst_QCoapClient::initTestCase()
{
#if defined(COAP_TEST_SERVER_IP) || defined(QT_TEST_SERVER)
QVERIFY2(waitForHost(testServerHost()), "Failed to connect to Californium plugtest server.");
QVERIFY2(waitForHost(QUrl{testServerHost()}), "Failed to connect to Californium plugtest server.");
#if QT_CONFIG(dtls)
QVERIFY2(waitForHost(timeServerUrl(), QtCoap::SecurityMode::Certificate),
QVERIFY2(waitForHost(QUrl{timeServerUrl()}, QtCoap::SecurityMode::Certificate),
"Failed to connect to FreeCoAP sample time server.");
#endif
#endif

View File

@ -235,7 +235,7 @@ void tst_QCoapInternalRequest::urlOptions()
QFETCH(QString, url);
QFETCH(QList<QCoapOption>, options);
const QCoapRequest request(url);
const QCoapRequest request(QUrl{url});
const QCoapInternalRequest internalRequest(request);
auto requestOptions = internalRequest.message()->options();
@ -264,7 +264,7 @@ void tst_QCoapInternalRequest::invalidUrls_data()
void tst_QCoapInternalRequest::invalidUrls()
{
QFETCH(QString, url);
const QCoapRequest request(url);
const QCoapRequest request(QUrl{url});
const QCoapInternalRequest internalRequest(request);
QVERIFY(!internalRequest.isValid());
@ -288,7 +288,7 @@ void tst_QCoapInternalRequest::isMulticast()
QFETCH(QString, url);
QFETCH(bool, result);
const QCoapRequest request(url);
const QCoapRequest request(QUrl{url});
const QCoapInternalRequest internalRequest(request);
QCOMPARE(internalRequest.isMulticast(), result);
}

View File

@ -50,7 +50,7 @@ public:
void tst_QCoapQUdpConnection::initTestCase()
{
#if defined(COAP_TEST_SERVER_IP) || defined(QT_TEST_SERVER)
QVERIFY2(waitForHost(testServerHost()), "Failed to connect to Californium plugtest server.");
QVERIFY2(waitForHost(QUrl{testServerHost()}), "Failed to connect to Californium plugtest server.");
#endif
}
@ -164,7 +164,7 @@ void tst_QCoapQUdpConnection::sendRequest()
QSignalSpy spyConnectionReadyRead(&connection, &QCoapQUdpConnection::readyRead);
QCoapRequest request =
QCoapRequestPrivate::createRequest(QCoapRequest(protocol + host + path), method);
QCoapRequestPrivate::createRequest(QCoapRequest(QUrl{protocol + host + path}), method);
request.setMessageId(24806);
request.setToken(QByteArray("abcd"));
QVERIFY(connection.socket() != nullptr);