From 164fbb1f630ee386e84f3c21dff942fce72cdebb Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Tue, 25 Jul 2017 10:42:30 +0200 Subject: Fix potential QT_ASCII_CAST_WARN Uses the QLatin1String instead of comparing a QString and c-string. Change-Id: I86ed4da24894ae3f665150017b9db0185b0502fd Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/webgl/qwebglhttpserver.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms/webgl/qwebglhttpserver.cpp') 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()); -- cgit v1.2.3