diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2018-08-22 14:08:18 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2018-08-24 05:44:21 +0000 |
commit | fcf1f30d5fc541a15f0dd4df40a1869630aa3478 (patch) | |
tree | 3310037c3740b939e72fb51efdb066f2c64536b5 /src/imports | |
parent | 89e92af7948cde05bbb07a082835344f3f3adb4e (diff) |
Code cleanup: Use nullptr wherever possible
Change-Id: I7dd2d055c8d667f049d7cb2c371619137bf76030
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/imports')
5 files changed, 19 insertions, 22 deletions
diff --git a/src/imports/bluetooth/plugin.cpp b/src/imports/bluetooth/plugin.cpp index 1e9737c6..7c0712a1 100644 --- a/src/imports/bluetooth/plugin.cpp +++ b/src/imports/bluetooth/plugin.cpp @@ -52,7 +52,7 @@ class QBluetoothQmlPlugin : public QQmlExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QBluetoothQmlPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { } + QBluetoothQmlPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { } void registerTypes(const char *uri) { // @uri QtBluetooth diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp index fc1accbd..6b2f32f3 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp +++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp @@ -96,8 +96,7 @@ class QDeclarativeBluetoothDiscoveryModelPrivate { public: QDeclarativeBluetoothDiscoveryModelPrivate() - : m_serviceAgent(0), - m_deviceAgent(0), + : m_error(QDeclarativeBluetoothDiscoveryModel::NoError), m_discoveryMode(QDeclarativeBluetoothDiscoveryModel::MinimalServiceDiscovery), m_running(false), @@ -119,8 +118,8 @@ public: qDeleteAll(m_services); } - QBluetoothServiceDiscoveryAgent *m_serviceAgent; - QBluetoothDeviceDiscoveryAgent *m_deviceAgent; + QBluetoothServiceDiscoveryAgent *m_serviceAgent = nullptr; + QBluetoothDeviceDiscoveryAgent *m_deviceAgent = nullptr; QDeclarativeBluetoothDiscoveryModel::Error m_error; QList<QDeclarativeBluetoothService *> m_services; @@ -331,7 +330,7 @@ void QDeclarativeBluetoothDiscoveryModel::serviceDiscovered(const QBluetoothServ //qDebug() << "service discovered"; QDeclarativeBluetoothService *bs = new QDeclarativeBluetoothService(service, this); - QDeclarativeBluetoothService *current = 0; + QDeclarativeBluetoothService *current = nullptr; for (int i = 0; i < d->m_services.count(); i++) { current = d->m_services.at(i); if (bs->deviceAddress() == current->deviceAddress() diff --git a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp index 48c9da9a..3c176752 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp +++ b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp @@ -87,9 +87,7 @@ class QDeclarativeBluetoothServicePrivate { public: QDeclarativeBluetoothServicePrivate() - : m_componentComplete(false), - m_service(0), - m_server(0) + : m_componentComplete(false) { } @@ -100,9 +98,9 @@ public: } bool m_componentComplete; - QBluetoothServiceInfo *m_service; + QBluetoothServiceInfo *m_service = nullptr; QDeclarativeBluetoothService::Protocol m_protocol; - QBluetoothServer *m_server; + QBluetoothServer *m_server = nullptr; }; QDeclarativeBluetoothService::QDeclarativeBluetoothService(QObject *parent) : @@ -275,7 +273,7 @@ void QDeclarativeBluetoothService::setRegistered(bool registered) } delete d->m_server; - d->m_server = 0; + d->m_server = nullptr; if (!registered) { d->m_service->unregisterService(); @@ -354,14 +352,14 @@ QDeclarativeBluetoothSocket *QDeclarativeBluetoothService::nextClient() if (server) { if (server->hasPendingConnections()) { QBluetoothSocket *socket = server->nextPendingConnection(); - return new QDeclarativeBluetoothSocket(socket, this, 0); + return new QDeclarativeBluetoothSocket(socket, this, nullptr); } else { qCWarning(QT_BT_QML) << "Socket has no pending connection, failing"; - return 0; + return nullptr; } } - return 0; + return nullptr; } void QDeclarativeBluetoothService::assignNextClient(QDeclarativeBluetoothSocket *dbs) diff --git a/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp b/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp index 07de35bc..0deb82a5 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp +++ b/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp @@ -79,7 +79,7 @@ class QDeclarativeBluetoothSocketPrivate { public: QDeclarativeBluetoothSocketPrivate(QDeclarativeBluetoothSocket *bs) - : m_dbs(bs), m_service(0), m_socket(0), + : m_dbs(bs), m_error(QDeclarativeBluetoothSocket::NoError), m_state(QDeclarativeBluetoothSocket::NoServiceSet), m_componentCompleted(false), @@ -125,8 +125,8 @@ public: } QDeclarativeBluetoothSocket *m_dbs; - QDeclarativeBluetoothService *m_service; - QBluetoothSocket *m_socket; + QDeclarativeBluetoothService *m_service = nullptr; + QBluetoothSocket *m_socket = nullptr; QDeclarativeBluetoothSocket::Error m_error; QDeclarativeBluetoothSocket::SocketState m_state; bool m_componentCompleted; @@ -269,7 +269,7 @@ void QDeclarativeBluetoothSocket::socket_connected() void QDeclarativeBluetoothSocket::socket_disconnected() { d->m_socket->deleteLater(); - d->m_socket = 0; + d->m_socket = nullptr; emit connectedChanged(); } diff --git a/src/imports/bluetooth/qdeclarativebluetoothsocket_p.h b/src/imports/bluetooth/qdeclarativebluetoothsocket_p.h index e5092d2c..2c17b4b1 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothsocket_p.h +++ b/src/imports/bluetooth/qdeclarativebluetoothsocket_p.h @@ -98,11 +98,11 @@ public: }; Q_ENUM(SocketState) - explicit QDeclarativeBluetoothSocket(QObject *parent = 0); + explicit QDeclarativeBluetoothSocket(QObject *parent = nullptr); explicit QDeclarativeBluetoothSocket(QDeclarativeBluetoothService *service, - QObject *parent = 0); + QObject *parent = nullptr); explicit QDeclarativeBluetoothSocket(QBluetoothSocket *socket, QDeclarativeBluetoothService *service, - QObject *paprent = 0); + QObject *paprent = nullptr); ~QDeclarativeBluetoothSocket(); QDeclarativeBluetoothService *service(); |