summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/bluez
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2018-08-22 14:08:18 +0200
committerAlex Blasche <alexander.blasche@qt.io>2018-08-24 05:44:21 +0000
commitfcf1f30d5fc541a15f0dd4df40a1869630aa3478 (patch)
tree3310037c3740b939e72fb51efdb066f2c64536b5 /src/bluetooth/bluez
parent89e92af7948cde05bbb07a082835344f3f3adb4e (diff)
Code cleanup: Use nullptr wherever possible
Change-Id: I7dd2d055c8d667f049d7cb2c371619137bf76030 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/bluetooth/bluez')
-rw-r--r--src/bluetooth/bluez/bluez5_helper.cpp14
-rw-r--r--src/bluetooth/bluez/bluez5_helper_p.h2
-rw-r--r--src/bluetooth/bluez/hcimanager.cpp6
-rw-r--r--src/bluetooth/bluez/hcimanager_p.h4
-rw-r--r--src/bluetooth/bluez/remotedevicemanager_p.h2
5 files changed, 14 insertions, 14 deletions
diff --git a/src/bluetooth/bluez/bluez5_helper.cpp b/src/bluetooth/bluez/bluez5_helper.cpp
index 2beb533c..bacdfe3c 100644
--- a/src/bluetooth/bluez/bluez5_helper.cpp
+++ b/src/bluetooth/bluez/bluez5_helper.cpp
@@ -120,8 +120,8 @@ bool mandatoryHciIoctlsAvailable()
}
// check HCIGETDEVLIST & HCIGETDEVLIST
- struct hci_dev_req *devRequest = 0;
- struct hci_dev_list_req *devRequestList = 0;
+ struct hci_dev_req *devRequest = nullptr;
+ struct hci_dev_list_req *devRequestList = nullptr;
struct hci_dev_info devInfo;
const int devListSize = sizeof(struct hci_dev_list_req)
+ HCI_MAX_DEV * sizeof(struct hci_dev_req);
@@ -282,18 +282,18 @@ QVersionNumber bluetoothdVersion()
struct AdapterData
{
public:
- AdapterData() : reference(1), wasListeningAlready(false), propteryListener(0) {}
+ AdapterData() : reference(1), wasListeningAlready(false) {}
int reference;
bool wasListeningAlready;
- OrgFreedesktopDBusPropertiesInterface *propteryListener;
+ OrgFreedesktopDBusPropertiesInterface *propteryListener = nullptr;
};
class QtBluezDiscoveryManagerPrivate
{
public:
QMap<QString, AdapterData *> references;
- OrgFreedesktopDBusObjectManagerInterface *manager;
+ OrgFreedesktopDBusObjectManagerInterface *manager = nullptr;
};
Q_GLOBAL_STATIC(QtBluezDiscoveryManager, discoveryManager)
@@ -355,7 +355,7 @@ QtBluezDiscoveryManager *QtBluezDiscoveryManager::instance()
return discoveryManager();
Q_ASSERT(false);
- return 0;
+ return nullptr;
}
bool QtBluezDiscoveryManager::registerDiscoveryInterest(const QString &adapterPath)
@@ -491,7 +491,7 @@ void QtBluezDiscoveryManager::removeAdapterFromMonitoring(const QString &dbusPat
If \a ok is false the lookup was aborted due to a dbus error and this function
returns an empty string.
*/
-QString findAdapterForAddress(const QBluetoothAddress &wantedAddress, bool *ok = 0)
+QString findAdapterForAddress(const QBluetoothAddress &wantedAddress, bool *ok = nullptr)
{
OrgFreedesktopDBusObjectManagerInterface manager(QStringLiteral("org.bluez"),
QStringLiteral("/"),
diff --git a/src/bluetooth/bluez/bluez5_helper_p.h b/src/bluetooth/bluez/bluez5_helper_p.h
index 1747f249..0db6f29f 100644
--- a/src/bluetooth/bluez/bluez5_helper_p.h
+++ b/src/bluetooth/bluez/bluez5_helper_p.h
@@ -80,7 +80,7 @@ class QtBluezDiscoveryManager : public QObject
{
Q_OBJECT
public:
- QtBluezDiscoveryManager(QObject* parent = 0);
+ QtBluezDiscoveryManager(QObject* parent = nullptr);
~QtBluezDiscoveryManager();
static QtBluezDiscoveryManager *instance();
diff --git a/src/bluetooth/bluez/hcimanager.cpp b/src/bluetooth/bluez/hcimanager.cpp
index bdb74ae0..2a7c9060 100644
--- a/src/bluetooth/bluez/hcimanager.cpp
+++ b/src/bluetooth/bluez/hcimanager.cpp
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(QT_BT_BLUEZ)
HciManager::HciManager(const QBluetoothAddress& deviceAdapter, QObject *parent) :
- QObject(parent), hciSocket(-1), hciDev(-1), notifier(0)
+ QObject(parent), hciSocket(-1), hciDev(-1)
{
hciSocket = ::socket(AF_BLUETOOTH, SOCK_RAW | SOCK_CLOEXEC, BTPROTO_HCI);
if (hciSocket < 0) {
@@ -114,8 +114,8 @@ int HciManager::hciForAddress(const QBluetoothAddress &deviceAdapter)
bdaddr_t adapter;
convertAddress(deviceAdapter.toUInt64(), adapter.b);
- struct hci_dev_req *devRequest = 0;
- struct hci_dev_list_req *devRequestList = 0;
+ struct hci_dev_req *devRequest = nullptr;
+ struct hci_dev_list_req *devRequestList = nullptr;
struct hci_dev_info devInfo;
const int devListSize = sizeof(struct hci_dev_list_req)
+ HCI_MAX_DEV * sizeof(struct hci_dev_req);
diff --git a/src/bluetooth/bluez/hcimanager_p.h b/src/bluetooth/bluez/hcimanager_p.h
index 3127a747..15b8791e 100644
--- a/src/bluetooth/bluez/hcimanager_p.h
+++ b/src/bluetooth/bluez/hcimanager_p.h
@@ -72,7 +72,7 @@ public:
LeMetaEvent = 0x3e,
};
- explicit HciManager(const QBluetoothAddress &deviceAdapter, QObject *parent = 0);
+ explicit HciManager(const QBluetoothAddress &deviceAdapter, QObject *parent = nullptr);
~HciManager();
bool isValid() const;
@@ -109,7 +109,7 @@ private:
int hciSocket;
int hciDev;
quint8 sigPacketIdentifier = 0;
- QSocketNotifier *notifier;
+ QSocketNotifier *notifier = nullptr;
QSet<HciManager::HciEvent> runningEvents;
};
diff --git a/src/bluetooth/bluez/remotedevicemanager_p.h b/src/bluetooth/bluez/remotedevicemanager_p.h
index a6af8f44..d177d74e 100644
--- a/src/bluetooth/bluez/remotedevicemanager_p.h
+++ b/src/bluetooth/bluez/remotedevicemanager_p.h
@@ -73,7 +73,7 @@ public:
JobDisconnectDevice,
};
- explicit RemoteDeviceManager(const QBluetoothAddress& localAddress, QObject *parent = 0);
+ explicit RemoteDeviceManager(const QBluetoothAddress& localAddress, QObject *parent = nullptr);
bool isJobInProgress() const { return jobInProgress; }
bool scheduleJob(JobType job, const QVector<QBluetoothAddress>& remoteDevices);