Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.5.2
-
None
Description
In "qmqttclient.cpp":
QMqttClientPrivate::QMqttClientPrivate(QMqttClient *c) : QObjectPrivate() { m_client = c; m_clientId = QUuid::createUuid().toString(); m_clientId.remove(QLatin1Char('{')); m_clientId.remove(QLatin1Char('}')); m_clientId.remove(QLatin1Char('-')); m_clientId.resize(23); #ifdef QT_BUILD_INTERNAL // Some test servers require a username token if (qEnvironmentVariableIsSet("QT_MQTT_TEST_USERNAME")) m_username = qEnvironmentVariable("QT_MQTT_TEST_USERNAME"); if (qEnvironmentVariableIsSet("QT_MQTT_TEST_PASSWORD")) m_password = qEnvironmentVariable("QT_MQTT_TEST_PASSWORD"); if (qEnvironmentVariableIsSet("QT_MQTT_TEST_CLIENTID")) m_clientId = qEnvironmentVariable("QT_MQTT_TEST_CLIENTID"); #endif }
m_clientId = QUuid::createUuid().toString(); m_clientId.remove(QLatin1Char('{')); m_clientId.remove(QLatin1Char('}')); m_clientId.remove(QLatin1Char('-'));
I think these 4 lines can be replaced by one:
m_clientId = QUuid::createUuid().toString(QUuid::Id128);
The same codes otherwhere can be improved like above.