mirror of
https://github.com/qt/qtmqtt.git
synced 2026-10-25 16:16:26 +00:00
Fix some compiler warnings in the MQTT WebsocketSubscription Example
Fix some warnings that were reported by the MSVC compiler with the Wall setting: - use static_cast for signed/unsigned conversion - use QString::fromUtf8 instead of the QByteArray constructor Pick-to: 6.5 Task-number: QTBUG-110893 Change-Id: Ic982d3c16feb1ebcef729b4dfd023cc3b5017fec Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This commit is contained in:
parent
15df42c95d
commit
84e3561bf8
@ -17,7 +17,7 @@ WebSocketIODevice::WebSocketIODevice(QObject *parent)
|
||||
bool WebSocketIODevice::open(QIODevice::OpenMode mode)
|
||||
{
|
||||
QWebSocketHandshakeOptions options;
|
||||
options.setSubprotocols({m_protocol});
|
||||
options.setSubprotocols(QStringList{ QString::fromUtf8(m_protocol) });
|
||||
|
||||
m_socket.open(m_url, options);
|
||||
|
||||
@ -33,7 +33,7 @@ void WebSocketIODevice::close()
|
||||
qint64 WebSocketIODevice::readData(char *data, qint64 maxlen)
|
||||
{
|
||||
qint64 bytesToRead = qMin(maxlen, (qint64)m_buffer.size());
|
||||
memcpy(data, m_buffer.constData(), bytesToRead);
|
||||
memcpy(data, m_buffer.constData(), static_cast<size_t>(bytesToRead));
|
||||
m_buffer = m_buffer.right(m_buffer.size() - bytesToRead);
|
||||
return bytesToRead;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user