diff options
author | Jesus Fernandez <jesus.fernandez@qt.io> | 2017-07-25 10:42:30 +0200 |
---|---|---|
committer | Jesus Fernandez <Jesus.Fernandez@qt.io> | 2017-07-25 10:00:56 +0000 |
commit | 164fbb1f630ee386e84f3c21dff942fce72cdebb (patch) | |
tree | b13325e6ca837f4658761ffb1ef637751ac69cf2 | |
parent | be972db0f9ef12ace1aeaac5010e0bf44717e300 (diff) |
Fix potential QT_ASCII_CAST_WARN
Uses the QLatin1String instead of comparing a QString and c-string.
Change-Id: I86ed4da24894ae3f665150017b9db0185b0502fd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r-- | src/plugins/platforms/webgl/qwebglhttpserver.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/platforms/webgl/qwebglhttpserver.cpp b/src/plugins/platforms/webgl/qwebglhttpserver.cpp index cad4431..e932abf 100644 --- a/src/plugins/platforms/webgl/qwebglhttpserver.cpp +++ b/src/plugins/platforms/webgl/qwebglhttpserver.cpp @@ -229,21 +229,21 @@ void QWebGLHttpServer::answerClient(QTcpSocket *socket, const QUrl &url) data; }; - if (path == "/") { + if (path == QLatin1String("/")) { QFile file(QStringLiteral(":/webgl/index.html")); Q_ASSERT(file.exists()); file.open(QIODevice::ReadOnly | QIODevice::Text); Q_ASSERT(file.isOpen()); auto data = file.readAll(); addData(QByteArrayLiteral("text/html; charset=\"utf-8\""), data); - } else if (path == "/clipboard") { + } else if (path == QStringLiteral("/clipboard")) { #ifndef QT_NO_CLIPBOARD auto data = qGuiApp->clipboard()->text().toUtf8(); addData(QByteArrayLiteral("text/html; charset=\"utf-8\""), data); #else qCWarning(lc, "Qt was built without clipboard support"); #endif - } else if (path == "/webqt.js") { + } else if (path == QStringLiteral("/webqt.js")) { QFile file(QStringLiteral(":/webgl/webqt.jsx")); Q_ASSERT(file.exists()); file.open(QIODevice::ReadOnly | QIODevice::Text); @@ -253,14 +253,14 @@ void QWebGLHttpServer::answerClient(QTcpSocket *socket, const QUrl &url) QByteArray data = "var host = \"" + host + "\";\r\nvar port = " + port + ";\r\n"; data += file.readAll(); addData(QByteArrayLiteral("application/javascript"), data); - } else if (path == "/favicon.ico") { + } else if (path == QStringLiteral("/favicon.ico")) { QFile file(QStringLiteral(":/webgl/favicon.ico")); Q_ASSERT(file.exists()); file.open(QIODevice::ReadOnly); Q_ASSERT(file.isOpen()); auto data = file.readAll(); addData(QByteArrayLiteral("image/x-icon"), data); - } else if (path == "/favicon.png") { + } else if (path == QStringLiteral("/favicon.png")) { QBuffer buffer; qGuiApp->windowIcon().pixmap(16, 16).save(&buffer, "png"); addData(QByteArrayLiteral("image/x-icon"), buffer.data()); |