Qt6: Port QtCoap to QStringView

And fix some warnings.

Task-number: QTBUG-84319
Change-Id: I17e887f5b68c0a75e861d186cfed9ea2afd24021
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
This commit is contained in:
Sona Kurazyan 2020-06-10 14:23:19 +02:00
parent 12d9af1cd1
commit 9a490bda44
1 changed files with 4 additions and 4 deletions

View File

@ -434,16 +434,16 @@ bool QCoapInternalRequest::addUriOptions(QUrl uri, const QUrl &proxyUri)
// 8. Add path segments to options
const auto path = uri.path();
const auto listPath = path.splitRef('/');
for (const QStringRef &pathPart : listPath) {
const auto listPath = QStringView{path}.split(QLatin1Char('/'));
for (auto pathPart : listPath) {
if (!pathPart.isEmpty())
addOption(QCoapOption(QCoapOption::UriPath, pathPart.toString()));
}
// 9. Add queries to options
QString query = uri.query();
const auto listQuery = query.splitRef('&');
for (const QStringRef &queryElement : listQuery) {
const auto listQuery = QStringView{query}.split(QLatin1Char('&'));
for (auto queryElement : listQuery) {
if (!queryElement.isEmpty())
addOption(QCoapOption(QCoapOption::UriQuery, queryElement.toString()));
}