Code cleanup: Use nullptr wherever possible

Change-Id: I7dd2d055c8d667f049d7cb2c371619137bf76030
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Alex Blasche 2018-08-22 14:08:18 +02:00
parent 89e92af794
commit fcf1f30d5f
50 changed files with 171 additions and 196 deletions

View File

@ -65,7 +65,7 @@ class AndroidBroadcastReceiver: public QObject
{
Q_OBJECT
public:
AndroidBroadcastReceiver(QObject* parent = 0);
AndroidBroadcastReceiver(QObject* parent = nullptr);
virtual ~AndroidBroadcastReceiver();
void addAction(const QAndroidJniObject &filter);

View File

@ -63,7 +63,7 @@ class DeviceDiscoveryBroadcastReceiver : public AndroidBroadcastReceiver
{
Q_OBJECT
public:
DeviceDiscoveryBroadcastReceiver(QObject* parent = 0);
DeviceDiscoveryBroadcastReceiver(QObject* parent = nullptr);
virtual void onReceive(JNIEnv *env, jobject context, jobject intent);
virtual void onReceiveLeScan(JNIEnv *env, jobject jBluetoothDevice, jint rssi,
jbyteArray scanRecord);

View File

@ -61,7 +61,7 @@ class LocalDeviceBroadcastReceiver : public AndroidBroadcastReceiver
{
Q_OBJECT
public:
explicit LocalDeviceBroadcastReceiver(QObject *parent = 0);
explicit LocalDeviceBroadcastReceiver(QObject *parent = nullptr);
virtual ~LocalDeviceBroadcastReceiver() {}
virtual void onReceive(JNIEnv *env, jobject context, jobject intent);
virtual void onReceiveLeScan(JNIEnv *, jobject, jint, jbyteArray) {}

View File

@ -69,7 +69,7 @@ class LowEnergyNotificationHub : public QObject
Q_OBJECT
public:
explicit LowEnergyNotificationHub(const QBluetoothAddress &remote, bool isPeripheral,
QObject *parent = 0);
QObject *parent = nullptr);
~LowEnergyNotificationHub();
static void lowEnergy_connectionChange(JNIEnv*, jobject, jlong qtObject,

View File

@ -62,7 +62,7 @@ class ServerAcceptanceThread : public QObject
{
Q_OBJECT
public:
explicit ServerAcceptanceThread(QObject *parent = 0);
explicit ServerAcceptanceThread(QObject *parent = nullptr);
~ServerAcceptanceThread();
void setServiceDetails(const QBluetoothUuid &uuid, const QString &serviceName,
QBluetooth::SecurityFlags securityFlags);

View File

@ -64,7 +64,7 @@ class ServiceDiscoveryBroadcastReceiver : public AndroidBroadcastReceiver
{
Q_OBJECT
public:
ServiceDiscoveryBroadcastReceiver(QObject* parent = 0);
ServiceDiscoveryBroadcastReceiver(QObject* parent = nullptr);
virtual void onReceive(JNIEnv *env, jobject context, jobject intent);
virtual void onReceiveLeScan(JNIEnv *, jobject, jint, jbyteArray) {}

View File

@ -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("/"),

View File

@ -80,7 +80,7 @@ class QtBluezDiscoveryManager : public QObject
{
Q_OBJECT
public:
QtBluezDiscoveryManager(QObject* parent = 0);
QtBluezDiscoveryManager(QObject* parent = nullptr);
~QtBluezDiscoveryManager();
static QtBluezDiscoveryManager *instance();

View File

@ -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);

View File

@ -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;
};

View File

@ -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);

View File

@ -123,7 +123,7 @@ quint64 LeCmacCalculator::calculateMac(const QByteArray &message, const quint128
private:
int m_socket;
};
SocketWrapper cryptoSocket(accept(m_baseSocket, nullptr, 0));
SocketWrapper cryptoSocket(accept(m_baseSocket, nullptr, nullptr));
if (cryptoSocket.value() == -1) {
qCWarning(QT_BT_BLUEZ) << "accept() failed for crypto socket:" << strerror(errno);
return 0;

View File

@ -63,11 +63,6 @@ QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate(
m_adapterAddress(deviceAdapter),
pendingCancel(false),
pendingStart(false),
manager(0),
adapter(0),
managerBluez5(0),
adapterBluez5(0),
discoveryTimer(0),
useExtendedDiscovery(false),
lowEnergySearchTimeout(-1), // remains -1 on BlueZ 4 -> timeout not supported
q_ptr(parent)
@ -174,12 +169,12 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent
if (propertiesReply.isError()) {
errorString = propertiesReply.error().message();
delete adapter;
adapter = 0;
adapter = nullptr;
qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << "ERROR: " << errorString;
lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
Q_Q(QBluetoothDeviceDiscoveryAgent);
delete adapter;
adapter = 0;
adapter = nullptr;
emit q->error(lastError);
return;
}
@ -189,7 +184,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent
lastError = QBluetoothDeviceDiscoveryAgent::PoweredOffError;
errorString = QBluetoothDeviceDiscoveryAgent::tr("Device is powered off");
delete adapter;
adapter = 0;
adapter = nullptr;
emit q->error(lastError);
return;
}
@ -218,7 +213,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent
discoveryReply.waitForFinished();
if (discoveryReply.isError()) {
delete adapter;
adapter = 0;
adapter = nullptr;
errorString = discoveryReply.error().message();
lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
Q_Q(QBluetoothDeviceDiscoveryAgent);
@ -251,7 +246,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startBluez5(QBluetoothDeviceDiscover
lastError = QBluetoothDeviceDiscoveryAgent::PoweredOffError;
errorString = QBluetoothDeviceDiscoveryAgent::tr("Device is powered off");
delete adapterBluez5;
adapterBluez5 = 0;
adapterBluez5 = nullptr;
emit q->error(lastError);
return;
}
@ -276,7 +271,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startBluez5(QBluetoothDeviceDiscover
errorString = QBluetoothDeviceDiscoveryAgent::tr("One or more device discovery methods "
"are not supported on this platform");
delete adapterBluez5;
adapterBluez5 = 0;
adapterBluez5 = nullptr;
emit q->error(lastError);
return;
} else if (filterReply.error().type() != QDBusError::UnknownMethod) {
@ -493,13 +488,13 @@ void QBluetoothDeviceDiscoveryAgentPrivate::_q_propertyChanged(const QString &na
Q_Q(QBluetoothDeviceDiscoveryAgent);
if (pendingCancel && !pendingStart) {
adapter->deleteLater();
adapter = 0;
adapter = nullptr;
pendingCancel = false;
emit q->canceled();
} else if (pendingStart) {
adapter->deleteLater();
adapter = 0;
adapter = nullptr;
pendingStart = false;
pendingCancel = false;
@ -523,7 +518,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::_q_propertyChanged(const QString &na
QDBusPendingReply<> reply = adapter->StopDiscovery();
reply.waitForFinished();
adapter->deleteLater();
adapter = 0;
adapter = nullptr;
emit q->finished();
}
} else {
@ -538,7 +533,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::_q_extendedDeviceDiscoveryTimeout()
if (adapter) {
adapter->deleteLater();
adapter = 0;
adapter = nullptr;
}
if (isActive()) {
Q_Q(QBluetoothDeviceDiscoveryAgent);
@ -575,7 +570,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::_q_discoveryFinished()
propertyMonitors.clear();
delete adapterBluez5;
adapterBluez5 = 0;
adapterBluez5 = nullptr;
if (pendingCancel && !pendingStart) {
pendingCancel = false;
@ -608,7 +603,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::_q_discoveryInterrupted(const QStrin
// does this automatically when emitting discoveryInterrupted(QString) signal
delete adapterBluez5;
adapterBluez5 = 0;
adapterBluez5 = nullptr;
errorString = QBluetoothDeviceDiscoveryAgent::tr("Bluetooth adapter error");
lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;

View File

@ -150,11 +150,11 @@ private:
QBluetoothAddress m_adapterAddress;
bool pendingCancel;
bool pendingStart;
OrgBluezManagerInterface *manager;
OrgBluezAdapterInterface *adapter;
OrgFreedesktopDBusObjectManagerInterface *managerBluez5;
OrgBluezAdapter1Interface *adapterBluez5;
QTimer *discoveryTimer;
OrgBluezManagerInterface *manager = nullptr;
OrgBluezAdapterInterface *adapter = nullptr;
OrgFreedesktopDBusObjectManagerInterface *managerBluez5 = nullptr;
OrgBluezAdapter1Interface *adapterBluez5 = nullptr;
QTimer *discoveryTimer = nullptr;
QList<OrgFreedesktopDBusPropertiesInterface *> propertyMonitors;
void deviceFoundBluez5(const QString& devicePath);

View File

@ -275,12 +275,12 @@ static inline OrgBluezDeviceInterface *getDevice(const QBluetoothAddress &addres
QBluetoothLocalDevicePrivate *d_ptr)
{
if (!d_ptr || !d_ptr->adapter)
return 0;
return nullptr;
QDBusPendingReply<QDBusObjectPath> reply = d_ptr->adapter->FindDevice(address.toString());
reply.waitForFinished();
if (reply.isError()) {
qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "reply failed" << reply.error();
return 0;
return nullptr;
}
QDBusObjectPath path = reply.value();
@ -311,7 +311,7 @@ void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pai
QDBusPendingReply<> cancelReply = d_ptr->pairingTarget->CancelPairing();
cancelReply.waitForFinished();
delete d_ptr->pairingTarget;
d_ptr->pairingTarget = 0;
d_ptr->pairingTarget = nullptr;
}
}
@ -446,7 +446,7 @@ void QBluetoothLocalDevicePrivate::requestPairingBluez5(const QBluetoothAddress
if (pairingTarget) {
delete pairingTarget;
pairingTarget = 0;
pairingTarget = nullptr;
}
// pairing implies that the device was found
@ -567,7 +567,7 @@ void QBluetoothLocalDevicePrivate::processPairingBluez5(const QString &objectPat
pairingTarget->setTrusted(false);
delete pairingTarget;
pairingTarget = 0;
pairingTarget = nullptr;
emit q->pairingFinished(targetAddress, target);
@ -655,17 +655,8 @@ QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(
QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(QBluetoothLocalDevice *q,
QBluetoothAddress address) :
adapter(0),
adapterBluez5(0),
adapterProperties(0),
managerBluez5(0),
agent(0),
manager(0),
localAddress(address),
pairingTarget(0),
pairingDiscoveryTimer(0),
pendingHostModeChange(-1),
msgConnection(0),
q_ptr(q)
{
registerQBluetoothLocalDeviceMetaType();
@ -700,7 +691,7 @@ void QBluetoothLocalDevicePrivate::connectDeviceChanges()
if (reply.isError())
return;
OrgFreedesktopDBusPropertiesInterface *monitor = 0;
OrgFreedesktopDBusPropertiesInterface *monitor = nullptr;
ManagedObjectList managedObjectList = reply.value();
for (ManagedObjectList::const_iterator it = managedObjectList.constBegin(); it != managedObjectList.constEnd(); ++it) {
@ -973,14 +964,14 @@ void QBluetoothLocalDevicePrivate::InterfacesRemoved(const QDBusObjectPath &obje
qCDebug(QT_BT_BLUEZ) << "Adapter" << adapterBluez5->path() << "was removed";
// current adapter was removed -> invalidate the instance
delete adapterBluez5;
adapterBluez5 = 0;
adapterBluez5 = nullptr;
managerBluez5->deleteLater();
managerBluez5 = 0;
managerBluez5 = nullptr;
delete adapterProperties;
adapterProperties = 0;
adapterProperties = nullptr;
delete pairingTarget;
pairingTarget = 0;
pairingTarget = nullptr;
// turn off connectivity monitoring
qDeleteAll(deviceChangeMonitors);
@ -1007,19 +998,19 @@ void QBluetoothLocalDevicePrivate::adapterRemoved(const QDBusObjectPath &deviceP
<< "was removed. Invalidating object.";
// the current adapter was removed
delete adapter;
adapter = 0;
adapter = nullptr;
manager->deleteLater();
manager = 0;
manager = nullptr;
// stop all pairing related activities
if (agent) {
QDBusConnection::systemBus().unregisterObject(agent_path);
delete agent;
agent = 0;
agent = nullptr;
}
delete msgConnection;
msgConnection = 0;
msgConnection = nullptr;
// stop all connectivity monitoring
qDeleteAll(devices);
@ -1162,7 +1153,7 @@ void QBluetoothLocalDevice::pairingConfirmation(bool confirmation)
d_ptr->msgConnection->send(error);
}
delete d_ptr->msgConnection;
d_ptr->msgConnection = 0;
d_ptr->msgConnection = nullptr;
}
QString QBluetoothLocalDevicePrivate::RequestPinCode(const QDBusObjectPath &in0)
@ -1235,7 +1226,7 @@ void QBluetoothLocalDevicePrivate::pairingCompleted(QDBusPendingCallWatcher *wat
pairingTarget->setTrusted(false);
delete pairingTarget;
pairingTarget = 0;
pairingTarget = nullptr;
emit q->pairingFinished(targetAddress, pairing);
}

View File

@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) :
QObject(parent),
d_ptr(0)
d_ptr(nullptr)
{
#if !defined(QT_IOS_BLUETOOTH) && !defined(QT_WINRT_BLUETOOTH)
printDummyWarning();
@ -59,7 +59,7 @@ QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) :
QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &, QObject *parent) :
QObject(parent),
d_ptr(0)
d_ptr(nullptr)
{
registerQBluetoothLocalDeviceMetaType();
}

View File

@ -140,13 +140,13 @@ public:
QSet<OrgBluezDeviceInterface *> devices;
QSet<QBluetoothAddress> connectedDevicesSet;
OrgBluezAdapterInterface *adapter; //Bluez 4
OrgBluezAdapter1Interface *adapterBluez5; //Bluez 5
OrgFreedesktopDBusPropertiesInterface *adapterProperties; //Bluez 5
OrgFreedesktopDBusObjectManagerInterface *managerBluez5; //Bluez 5
OrgBluezAdapterInterface *adapter = nullptr; //Bluez 4
OrgBluezAdapter1Interface *adapterBluez5 = nullptr; //Bluez 5
OrgFreedesktopDBusPropertiesInterface *adapterProperties = nullptr; //Bluez 5
OrgFreedesktopDBusObjectManagerInterface *managerBluez5 = nullptr; //Bluez 5
QMap<QString, OrgFreedesktopDBusPropertiesInterface *> deviceChangeMonitors; //Bluez 5
OrgBluezAgentAdaptor *agent;
OrgBluezManagerInterface *manager;
OrgBluezAgentAdaptor *agent = nullptr;
OrgBluezManagerInterface *manager = nullptr;
QList<QBluetoothAddress> connectedDevices() const;
@ -154,8 +154,8 @@ public:
QBluetoothAddress localAddress;
QBluetoothAddress address;
QBluetoothLocalDevice::Pairing pairing;
OrgBluezDevice1Interface *pairingTarget;
QTimer *pairingDiscoveryTimer;
OrgBluezDevice1Interface *pairingTarget = nullptr;
QTimer *pairingDiscoveryTimer = nullptr;
QBluetoothLocalDevice::HostMode currentMode;
int pendingHostModeChange;
@ -199,7 +199,7 @@ private:
void connectDeviceChanges();
QDBusMessage msgConfirmation;
QDBusConnection *msgConnection;
QDBusConnection *msgConnection = nullptr;
QString deviceAdapterPath;
QBluetoothLocalDevice *q_ptr;

View File

@ -70,7 +70,7 @@ QBluetoothServerPrivate::~QBluetoothServerPrivate()
__fakeServerPorts.remove(this);
thread->deleteLater();
thread = 0;
thread = nullptr;
}
bool QBluetoothServerPrivate::initiateActiveListening(
@ -254,7 +254,7 @@ QBluetoothSocket *QBluetoothServer::nextPendingConnection()
bool success = newSocket->d_ptr->setSocketDescriptor(socket, d->serverType);
if (!success) {
delete newSocket;
newSocket = 0;
newSocket = nullptr;
}
return newSocket;

View File

@ -68,7 +68,7 @@ QBluetoothSocket *QBluetoothServerPrivate::createSocketForServer(
QBluetoothServerPrivate::QBluetoothServerPrivate(QBluetoothServiceInfo::Protocol sType)
: maxPendingConnections(1), securityFlags(QBluetooth::Authorization), serverType(sType),
m_lastError(QBluetoothServer::NoError), socketNotifier(0)
m_lastError(QBluetoothServer::NoError)
{
if (sType == QBluetoothServiceInfo::RfcommProtocol)
socket = createSocketForServer(QBluetoothServiceInfo::RfcommProtocol);
@ -147,7 +147,7 @@ void QBluetoothServer::close()
Q_D(QBluetoothServer);
delete d->socketNotifier;
d->socketNotifier = 0;
d->socketNotifier = nullptr;
d->socket->close();
}
@ -239,7 +239,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port)
}
}
d->setSocketSecurityLevel(d->securityFlags, 0);
d->setSocketSecurityLevel(d->securityFlags, nullptr);
if (::listen(sock, d->maxPendingConnections) < 0) {
d->m_lastError = InputOutputError;
@ -282,7 +282,7 @@ QBluetoothSocket *QBluetoothServer::nextPendingConnection()
Q_D(QBluetoothServer);
if (!hasPendingConnections())
return 0;
return nullptr;
int pending;
if (d->serverType == QBluetoothServiceInfo::RfcommProtocol) {
@ -311,7 +311,7 @@ QBluetoothSocket *QBluetoothServer::nextPendingConnection()
d->socketNotifier->setEnabled(true);
}
return 0;
return nullptr;
}
QBluetoothAddress QBluetoothServer::serverAddress() const

View File

@ -89,7 +89,7 @@ bool QBluetoothServer::hasPendingConnections() const
QBluetoothSocket *QBluetoothServer::nextPendingConnection()
{
return 0;
return nullptr;
}
QBluetoothAddress QBluetoothServer::serverAddress() const

View File

@ -115,7 +115,7 @@ protected:
private:
QBluetoothServer::Error m_lastError;
#if QT_CONFIG(bluez)
QSocketNotifier *socketNotifier;
QSocketNotifier *socketNotifier = nullptr;
#elif defined(QT_ANDROID_BLUETOOTH)
ServerAcceptanceThread *thread;
QString m_serviceName;

View File

@ -238,7 +238,7 @@ QBluetoothSocket *QBluetoothServer::nextPendingConnection()
bool success = newSocket->d_ptr->setSocketDescriptor(socket, d->serverType);
if (!success) {
delete newSocket;
newSocket = 0;
newSocket = nullptr;
}
return newSocket;

View File

@ -459,7 +459,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::stopDeviceDiscovery()
deviceDiscoveryAgent->stop();
delete deviceDiscoveryAgent;
deviceDiscoveryAgent = 0;
deviceDiscoveryAgent = nullptr;
setDiscoveryState(Inactive);
@ -484,7 +484,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_deviceDiscoveryFinished()
}
delete deviceDiscoveryAgent;
deviceDiscoveryAgent = 0;
deviceDiscoveryAgent = nullptr;
startServiceDiscovery();
}
@ -510,7 +510,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_deviceDiscoveryError(QBluetoothD
deviceDiscoveryAgent->stop();
delete deviceDiscoveryAgent;
deviceDiscoveryAgent = 0;
deviceDiscoveryAgent = nullptr;
setDiscoveryState(Inactive);
Q_Q(QBluetoothServiceDiscoveryAgent);

View File

@ -56,9 +56,9 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_ANDROID)
QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(
QBluetoothServiceDiscoveryAgent *qp, const QBluetoothAddress &/*deviceAdapter*/)
: error(QBluetoothServiceDiscoveryAgent::NoError),
state(Inactive), deviceDiscoveryAgent(0),
state(Inactive),
mode(QBluetoothServiceDiscoveryAgent::MinimalDiscovery),
singleDevice(false), receiver(0), localDeviceReceiver(0),
singleDevice(false),
q_ptr(qp)
{
@ -213,7 +213,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &addr
//kill receiver to limit load of signals
receiver->unregisterReceiver();
receiver->deleteLater();
receiver = 0;
receiver = nullptr;
qCWarning(QT_BT_ANDROID) << "Cannot start dynamic fetch.";
_q_serviceDiscoveryFinished();
}
@ -228,7 +228,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::stop()
//kill receiver to limit load of signals
receiver->unregisterReceiver();
receiver->deleteLater();
receiver = 0;
receiver = nullptr;
Q_Q(QBluetoothServiceDiscoveryAgent);
emit q->canceled();
@ -443,7 +443,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_fetchUuidsTimeout()
//kill receiver to limit load of signals
receiver->unregisterReceiver();
receiver->deleteLater();
receiver = 0;
receiver = nullptr;
_q_serviceDiscoveryFinished();
}
@ -460,7 +460,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_hostModeStateChanged(QBluetoothL
//kill receiver to limit load of signals
receiver->unregisterReceiver();
receiver->deleteLater();
receiver = 0;
receiver = nullptr;
Q_Q(QBluetoothServiceDiscoveryAgent);
emit q->error(error);

View File

@ -60,9 +60,8 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_BLUEZ)
QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(
QBluetoothServiceDiscoveryAgent *qp, const QBluetoothAddress &deviceAdapter)
: error(QBluetoothServiceDiscoveryAgent::NoError), m_deviceAdapterAddress(deviceAdapter), state(Inactive), deviceDiscoveryAgent(0),
: error(QBluetoothServiceDiscoveryAgent::NoError), m_deviceAdapterAddress(deviceAdapter), state(Inactive),
mode(QBluetoothServiceDiscoveryAgent::MinimalDiscovery), singleDevice(false),
manager(0), managerBluez5(0), adapter(0), device(0), sdpScannerProcess(0),
q_ptr(qp)
{
if (isBluez5()) {
@ -333,12 +332,12 @@ void QBluetoothServiceDiscoveryAgentPrivate::stop()
reply.waitForFinished();
device->deleteLater();
device = 0;
device = nullptr;
Q_ASSERT(!adapter);
} else if (adapter) {
//we are waiting for _q_createdDevice() slot to be called
adapter->deleteLater();
adapter = 0;
adapter = nullptr;
Q_ASSERT(!device);
}
@ -378,7 +377,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_foundDevice(QDBusPendingCallWatc
if (deviceObjectPath.error().name() != QStringLiteral("org.bluez.Error.DoesNotExist")) {
qCDebug(QT_BT_BLUEZ) << "Find device failed Error: " << error << deviceObjectPath.error().name();
delete adapter;
adapter = 0;
adapter = nullptr;
if (singleDevice) {
error = QBluetoothServiceDiscoveryAgent::InputOutputError;
errorString = QBluetoothServiceDiscoveryAgent::tr("Unable to access device");
@ -419,7 +418,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_createdDevice(QDBusPendingCallWa
if (deviceObjectPath.error().name() != QLatin1String("org.bluez.Error.AlreadyExists")) {
qCDebug(QT_BT_BLUEZ) << "Create device failed Error: " << error << deviceObjectPath.error().name();
delete adapter;
adapter = 0;
adapter = nullptr;
if (singleDevice) {
error = QBluetoothServiceDiscoveryAgent::InputOutputError;
errorString = QBluetoothServiceDiscoveryAgent::tr("Unable to access device");
@ -442,7 +441,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::discoverServices(const QString &dev
deviceObjectPath,
QDBusConnection::systemBus());
delete adapter;
adapter = 0;
adapter = nullptr;
QVariantMap deviceProperties;
QString classType;
@ -469,7 +468,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::discoverServices(const QString &dev
if (classType.isEmpty()) { //is BLE device or device properties above not retrievable
qCDebug(QT_BT_BLUEZ) << "Discovered BLE-only device. Normal service discovery skipped.";
delete device;
device = 0;
device = nullptr;
const QStringList deviceUuids = deviceProperties.value(QStringLiteral("UUIDs")).toStringList();
for (int i = 0; i < deviceUuids.size(); i++) {
@ -555,7 +554,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_discoveredServices(QDBusPendingC
emit q->error(error);
}
delete device;
device = 0;
device = nullptr;
_q_serviceDiscoveryFinished();
return;
}
@ -606,7 +605,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_discoveredServices(QDBusPendingC
watcher->deleteLater();
delete device;
device = 0;
device = nullptr;
_q_serviceDiscoveryFinished();
}
@ -625,7 +624,7 @@ QBluetoothServiceInfo QBluetoothServiceDiscoveryAgentPrivate::parseServiceXml(
if (xml.tokenType() == QXmlStreamReader::StartElement &&
xml.name() == QLatin1String("attribute")) {
quint16 attributeId =
xml.attributes().value(QLatin1String("id")).toString().toUShort(0, 0);
xml.attributes().value(QLatin1String("id")).toString().toUShort(nullptr, 0);
if (xml.readNextStartElement()) {
const QVariant value = readAttributeValue(xml);
@ -748,19 +747,19 @@ QVariant QBluetoothServiceDiscoveryAgentPrivate::readAttributeValue(QXmlStreamRe
xml.skipCurrentElement();
return value == QLatin1String("true");
} else if (xml.name() == QLatin1String("uint8")) {
quint8 value = xml.attributes().value(QStringLiteral("value")).toString().toUShort(0, 0);
quint8 value = xml.attributes().value(QStringLiteral("value")).toString().toUShort(nullptr, 0);
xml.skipCurrentElement();
return value;
} else if (xml.name() == QLatin1String("uint16")) {
quint16 value = xml.attributes().value(QStringLiteral("value")).toString().toUShort(0, 0);
quint16 value = xml.attributes().value(QStringLiteral("value")).toString().toUShort(nullptr, 0);
xml.skipCurrentElement();
return value;
} else if (xml.name() == QLatin1String("uint32")) {
quint32 value = xml.attributes().value(QStringLiteral("value")).toString().toUInt(0, 0);
quint32 value = xml.attributes().value(QStringLiteral("value")).toString().toUInt(nullptr, 0);
xml.skipCurrentElement();
return value;
} else if (xml.name() == QLatin1String("uint64")) {
quint64 value = xml.attributes().value(QStringLiteral("value")).toString().toULongLong(0, 0);
quint64 value = xml.attributes().value(QStringLiteral("value")).toString().toULongLong(nullptr, 0);
xml.skipCurrentElement();
return value;
} else if (xml.name() == QLatin1String("uuid")) {
@ -768,10 +767,10 @@ QVariant QBluetoothServiceDiscoveryAgentPrivate::readAttributeValue(QXmlStreamRe
const QString value = xml.attributes().value(QStringLiteral("value")).toString();
if (value.startsWith(QStringLiteral("0x"))) {
if (value.length() == 6) {
quint16 v = value.toUShort(0, 0);
quint16 v = value.toUShort(nullptr, 0);
uuid = QBluetoothUuid(v);
} else if (value.length() == 10) {
quint32 v = value.toUInt(0, 0);
quint32 v = value.toUInt(nullptr, 0);
uuid = QBluetoothUuid(v);
}
} else {

View File

@ -49,7 +49,6 @@ QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(
QBluetoothServiceDiscoveryAgent *qp, const QBluetoothAddress &deviceAdapter)
: error(QBluetoothServiceDiscoveryAgent::NoError),
state(Inactive),
deviceDiscoveryAgent(0),
mode(QBluetoothServiceDiscoveryAgent::MinimalDiscovery),
singleDevice(false),
q_ptr(qp)

View File

@ -178,23 +178,23 @@ private:
DiscoveryState state;
QList<QBluetoothUuid> uuidFilter;
QBluetoothDeviceDiscoveryAgent *deviceDiscoveryAgent;
QBluetoothDeviceDiscoveryAgent *deviceDiscoveryAgent = nullptr;
QBluetoothServiceDiscoveryAgent::DiscoveryMode mode;
bool singleDevice;
#if QT_CONFIG(bluez)
QString foundHostAdapterPath;
OrgBluezManagerInterface *manager;
OrgFreedesktopDBusObjectManagerInterface *managerBluez5;
OrgBluezAdapterInterface *adapter;
OrgBluezDeviceInterface *device;
QProcess *sdpScannerProcess;
OrgBluezManagerInterface *manager = nullptr;
OrgFreedesktopDBusObjectManagerInterface *managerBluez5 = nullptr;
OrgBluezAdapterInterface *adapter = nullptr;
OrgBluezDeviceInterface *device = nullptr;
QProcess *sdpScannerProcess = nullptr;
#endif
#ifdef QT_ANDROID_BLUETOOTH
ServiceDiscoveryBroadcastReceiver *receiver;
LocalDeviceBroadcastReceiver *localDeviceReceiver;
ServiceDiscoveryBroadcastReceiver *receiver = nullptr;
LocalDeviceBroadcastReceiver *localDeviceReceiver = nullptr;
QAndroidJniObject btAdapter;
QMap<QBluetoothAddress,QPair<QBluetoothDeviceInfo,QList<QBluetoothUuid> > > sdpCache;

View File

@ -480,7 +480,6 @@ QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(
QBluetoothServiceDiscoveryAgent *qp, const QBluetoothAddress &deviceAdapter)
: error(QBluetoothServiceDiscoveryAgent::NoError),
state(Inactive),
deviceDiscoveryAgent(0),
mode(QBluetoothServiceDiscoveryAgent::MinimalDiscovery),
singleDevice(false),
q_ptr(qp)

View File

@ -175,7 +175,7 @@ static void writeAttribute(QXmlStreamWriter *stream, const QVariant &attribute)
}
QBluetoothServiceInfoPrivate::QBluetoothServiceInfoPrivate()
: service(0), serviceBluez5(0), serviceRecord(0), registered(false)
: serviceRecord(0), registered(false)
{
if (isBluez5()) {
serviceBluez5 = new OrgBluezProfileManager1Interface(

View File

@ -107,8 +107,8 @@ private:
#if QT_CONFIG(bluez)
bool ensureSdpConnection(const QBluetoothAddress &localAdapter = QBluetoothAddress());
OrgBluezServiceInterface *service;
OrgBluezProfileManager1Interface *serviceBluez5;
OrgBluezServiceInterface *service = nullptr;
OrgBluezProfileManager1Interface *serviceBluez5 = nullptr;
quint32 serviceRecord;
QBluetoothAddress currentLocalAdapter;
QString profilePath;

View File

@ -325,7 +325,7 @@ QBluetoothSocket::QBluetoothSocket(QBluetoothSocketBasePrivate *dPrivate,
QBluetoothSocket::~QBluetoothSocket()
{
delete d_ptr;
d_ptr = 0;
d_ptr = nullptr;
}
/*!
@ -636,7 +636,7 @@ void QBluetoothSocket::serviceDiscovered(const QBluetoothServiceInfo &service)
if (service.protocolServiceMultiplexer() > 0 || service.serverChannel() > 0) {
connectToService(service, d->openMode);
d->discoveryAgent->deleteLater();
d->discoveryAgent = 0;
d->discoveryAgent = nullptr;
} else {
qCDebug(QT_BT) << "Could not find port/psm for potential remote service";
}
@ -652,7 +652,7 @@ void QBluetoothSocket::discoveryFinished()
setSocketError(ServiceNotFoundError);
setSocketState(QBluetoothSocket::UnconnectedState);
d->discoveryAgent->deleteLater();
d->discoveryAgent = 0;
d->discoveryAgent = nullptr;
}
}
@ -667,7 +667,7 @@ void QBluetoothSocket::abort()
if (state() == ServiceLookupState && d->discoveryAgent) {
d->discoveryAgent->disconnect();
d->discoveryAgent->stop();
d->discoveryAgent = 0;
d->discoveryAgent = nullptr;
}
setSocketState(ClosingState);
@ -745,7 +745,7 @@ void QBluetoothSocket::close()
if (state() == ServiceLookupState && d->discoveryAgent) {
d->discoveryAgent->disconnect();
d->discoveryAgent->stop();
d->discoveryAgent = 0;
d->discoveryAgent = nullptr;
}
setSocketState(ClosingState);

View File

@ -401,9 +401,9 @@ void QBluetoothSocketPrivateBluez::_q_readNotify()
void QBluetoothSocketPrivateBluez::abort()
{
delete readNotifier;
readNotifier = 0;
readNotifier = nullptr;
delete connectWriteNotifier;
connectWriteNotifier = 0;
connectWriteNotifier = nullptr;
// We don't transition through Closing for abort, so
// we don't call disconnectFromService or
@ -669,9 +669,9 @@ bool QBluetoothSocketPrivateBluez::setSocketDescriptor(int socketDescriptor, QBl
{
Q_Q(QBluetoothSocket);
delete readNotifier;
readNotifier = 0;
readNotifier = nullptr;
delete connectWriteNotifier;
connectWriteNotifier = 0;
connectWriteNotifier = nullptr;
socketType = socketType_;
socket = socketDescriptor;

View File

@ -206,7 +206,6 @@ void QBluetoothTransferReply::setRequest(const QBluetoothTransferRequest &reques
*/
QBluetoothTransferReplyPrivate::QBluetoothTransferReplyPrivate()
: m_manager(0)
{
}

View File

@ -68,8 +68,7 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_BLUEZ)
QBluetoothTransferReplyBluez::QBluetoothTransferReplyBluez(QIODevice *input, const QBluetoothTransferRequest &request,
QBluetoothTransferManager *parent)
: QBluetoothTransferReply(parent),
m_client(0), m_agent(0), m_clientBluez(0), m_objectPushBluez(0),
m_tempfile(0), m_source(input),
m_source(input),
m_running(false), m_finished(false), m_size(0),
m_error(QBluetoothTransferReply::NoError), m_errorStr(), m_transfer_path()
{
@ -198,7 +197,7 @@ void QBluetoothTransferReplyBluez::cleanupSession()
qCWarning(QT_BT_BLUEZ) << "Abort: Cannot remove obex session";
delete m_objectPushBluez;
m_objectPushBluez = 0;
m_objectPushBluez = nullptr;
}
void QBluetoothTransferReplyBluez::copyDone()

View File

@ -72,7 +72,7 @@ class Q_BLUETOOTH_EXPORT QBluetoothTransferReplyBluez : public QBluetoothTransfe
public:
explicit QBluetoothTransferReplyBluez(QIODevice *input, const QBluetoothTransferRequest &request,
QBluetoothTransferManager *parent = 0);
QBluetoothTransferManager *parent = nullptr);
~QBluetoothTransferReplyBluez();
bool isFinished() const;
@ -87,14 +87,14 @@ private slots:
private:
void startOPP(const QString &filename);
OrgOpenobexClientInterface *m_client;
AgentAdaptor *m_agent;
OrgBluezObexClient1Interface *m_clientBluez;
OrgBluezObexObjectPush1Interface *m_objectPushBluez;
OrgOpenobexClientInterface *m_client = nullptr;
AgentAdaptor *m_agent = nullptr;
OrgBluezObexClient1Interface *m_clientBluez = nullptr;
OrgBluezObexObjectPush1Interface *m_objectPushBluez = nullptr;
QTemporaryFile *m_tempfile;
QIODevice *m_source;
QTemporaryFile *m_tempfile = nullptr;
QIODevice *m_source = nullptr;
bool m_running;
bool m_finished;

View File

@ -60,7 +60,7 @@ class Q_BLUETOOTH_EXPORT QBluetoothTransferReplyPrivate
public:
QBluetoothTransferReplyPrivate();
QBluetoothTransferManager *m_manager;
QBluetoothTransferManager *m_manager = nullptr;
QBluetoothTransferRequest m_request;
};

View File

@ -104,7 +104,7 @@ struct QLowEnergyCharacteristicPrivate
\sa isValid()
*/
QLowEnergyCharacteristic::QLowEnergyCharacteristic():
d_ptr(0), data(0)
d_ptr(nullptr)
{
}
@ -116,7 +116,7 @@ QLowEnergyCharacteristic::QLowEnergyCharacteristic():
upon write.
*/
QLowEnergyCharacteristic::QLowEnergyCharacteristic(const QLowEnergyCharacteristic &other):
d_ptr(other.d_ptr), data(0)
d_ptr(other.d_ptr)
{
if (other.data) {
data = new QLowEnergyCharacteristicPrivate();
@ -241,7 +241,7 @@ QLowEnergyCharacteristic &QLowEnergyCharacteristic::operator=(const QLowEnergyCh
if (!other.data) {
if (data) {
delete data;
data = 0;
data = nullptr;
}
} else {
if (!data)

View File

@ -103,7 +103,7 @@ protected:
friend class QLowEnergyControllerPrivateCommon;
friend class QLowEnergyControllerPrivateOSX;
friend class QLowEnergyControllerPrivateWinRT;
QLowEnergyCharacteristicPrivate *data;
QLowEnergyCharacteristicPrivate *data = nullptr;
QLowEnergyCharacteristic(QSharedPointer<QLowEnergyServicePrivate> p,
QLowEnergyHandle handle);
};

View File

@ -271,13 +271,10 @@ template<> void putDataAndIncrement(const QByteArray &value, char *&dst)
QLowEnergyControllerPrivateBluez::QLowEnergyControllerPrivateBluez()
: QLowEnergyControllerPrivate(),
l2cpSocket(0), requestPending(false),
requestPending(false),
mtuSize(ATT_DEFAULT_LE_MTU),
securityLevelValue(-1),
encryptionChangePending(false),
hciManager(0),
advertiser(0),
serverSocketNotifier(0)
encryptionChangePending(false)
{
registerQLowEnergyControllerMetaType();
qRegisterMetaType<QList<QLowEnergyHandle> >();

View File

@ -134,7 +134,7 @@ public:
private:
quint16 connectionHandle = 0;
QBluetoothSocket *l2cpSocket;
QBluetoothSocket *l2cpSocket = nullptr;
struct Request {
quint8 command;
QByteArray payload;
@ -198,9 +198,9 @@ private:
bool encryptionChangePending;
bool receivedMtuExchangeRequest = false;
HciManager *hciManager;
QLeAdvertiser *advertiser;
QSocketNotifier *serverSocketNotifier;
HciManager *hciManager = nullptr;
QLeAdvertiser *advertiser = nullptr;
QSocketNotifier *serverSocketNotifier = nullptr;
QTimer *requestTimer = nullptr;
RemoteDeviceManager* device1Manager = nullptr;

View File

@ -256,7 +256,7 @@ quint16 QLowEnergyControllerPrivate::updateValueOfDescriptor(
void QLowEnergyControllerPrivate::invalidateServices()
{
for (QSharedPointer<QLowEnergyServicePrivate> service : serviceList.values()) {
service->setController(0);
service->setController(nullptr);
service->setState(QLowEnergyService::InvalidService);
}

View File

@ -77,7 +77,7 @@ struct QLowEnergyDescriptorPrivate
of this class is always invalid.
*/
QLowEnergyDescriptor::QLowEnergyDescriptor():
d_ptr(0), data(0)
d_ptr(nullptr)
{
}
@ -88,7 +88,7 @@ QLowEnergyDescriptor::QLowEnergyDescriptor():
upon write.
*/
QLowEnergyDescriptor::QLowEnergyDescriptor(const QLowEnergyDescriptor &other):
d_ptr(other.d_ptr), data(0)
d_ptr(other.d_ptr)
{
if (other.data) {
data = new QLowEnergyDescriptorPrivate();
@ -131,7 +131,7 @@ QLowEnergyDescriptor &QLowEnergyDescriptor::operator=(const QLowEnergyDescriptor
if (!other.data) {
if (data) {
delete data;
data = 0;
data = nullptr;
}
} else {
if (!data)

View File

@ -85,7 +85,7 @@ protected:
friend class QLowEnergyControllerPrivateCommon;
friend class QLowEnergyControllerPrivateOSX;
friend class QLowEnergyControllerPrivateWinRT;
QLowEnergyDescriptorPrivate *data;
QLowEnergyDescriptorPrivate *data = nullptr;
QLowEnergyDescriptor(QSharedPointer<QLowEnergyServicePrivate> p,
QLowEnergyHandle charHandle,

View File

@ -69,7 +69,7 @@ class QLowEnergyServicePrivate : public QObject
{
Q_OBJECT
public:
explicit QLowEnergyServicePrivate(QObject *parent = 0);
explicit QLowEnergyServicePrivate(QObject *parent = nullptr);
~QLowEnergyServicePrivate();
struct DescData {

View File

@ -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

View File

@ -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()

View File

@ -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)

View File

@ -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();
}

View File

@ -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();

View File

@ -365,21 +365,21 @@ int main(int argc, char **argv)
uint32_t attributeRange = 0x0000ffff; //all attributes
sdp_list_t *attributes;
attributes = sdp_list_append(0, &attributeRange);
attributes = sdp_list_append(nullptr, &attributeRange);
sdp_list_t *sdpResults, *sdpIter;
sdp_list_t *totalResults = NULL;
sdp_list_t *totalResults = nullptr;
sdp_list_t* serviceFilter;
for (uint i = 0; i < uuids.size(); ++i) {
serviceFilter = sdp_list_append(0, &uuids[i]);
serviceFilter = sdp_list_append(nullptr, &uuids[i]);
result = sdp_service_search_attr_req(session, serviceFilter,
SDP_ATTR_REQ_RANGE,
attributes, &sdpResults);
sdp_list_free(serviceFilter, 0);
sdp_list_free(serviceFilter, nullptr);
if (result != 0) {
fprintf(stderr, "sdp_service_search_attr_req failed\n");
sdp_list_free(attributes, 0);
sdp_list_free(attributes, nullptr);
sdp_close(session);
return RETURN_SDP_ERROR;
}
@ -398,7 +398,7 @@ int main(int argc, char **argv)
while (sdpIter->next) // skip to end of list
sdpIter = sdpIter->next;
}
sdp_list_free(attributes, 0);
sdp_list_free(attributes, nullptr);
// start XML generation from the front
sdpResults = totalResults;