summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-06-12 14:34:58 -0700
committerThiago Macieira <thiago.macieira@intel.com>2017-06-30 05:59:42 +0000
commit7761bb88000c19d2f5bfb1182f5c5ddf7dae6c5a (patch)
tree3aa56238a75adb55c768ab9abea81beee8f6138f /src/bluetooth/qbluetoothlocaldevice_bluez.cpp
parent9ecd4d7bb7eb17babdb85762a197968f0f85a5e7 (diff)
Use QRandomGenerator instead of q?rand
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothlocaldevice_bluez.cpp')
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_bluez.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
index c8c5ffbf..0982573e 100644
--- a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include <QtCore/QLoggingCategory>
+#include <QtCore/QRandomGenerator>
#include <QtDBus/QDBusContext>
#include "qbluetoothlocaldevice.h"
@@ -798,9 +799,8 @@ void QBluetoothLocalDevicePrivate::initializeAdapter()
connect(adapter, SIGNAL(PropertyChanged(QString, QDBusVariant)),
SLOT(PropertyChanged(QString, QDBusVariant)));
- qsrand(QTime::currentTime().msec());
agent_path = agentPath;
- agent_path.append(QString::fromLatin1("/%1").arg(qrand()));
+ agent_path.append(QString::fromLatin1("/%1").arg(QRandomGenerator::get32()));
}
}
@@ -1164,7 +1164,7 @@ QString QBluetoothLocalDevicePrivate::RequestPinCode(const QDBusObjectPath &in0)
Q_Q(QBluetoothLocalDevice);
qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << in0.path();
// seeded in constructor, 6 digit pin
- QString pin = QString::fromLatin1("%1").arg(qrand() % 1000000);
+ QString pin = QString::fromLatin1("%1").arg(QRandomGenerator::bounded(1000000));
pin = QString::fromLatin1("%1").arg(pin, 6, QLatin1Char('0'));
emit q->pairingDisplayPinCode(address, pin);
@@ -1276,7 +1276,7 @@ uint QBluetoothLocalDevicePrivate::RequestPasskey(const QDBusObjectPath &in0)
{
Q_UNUSED(in0);
qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO;
- return (qrand() % 1000000);
+ return (QRandomGenerator::bounded(1000000));
}
// Bluez 4