Skip to content

Commit

Permalink
Change 0 or NULL to nullptr in pointer contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
ejvr committed Apr 11, 2022
1 parent a5c001d commit bccae56
Show file tree
Hide file tree
Showing 23 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions examples/qmqtt/client/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Publisher : public QMQTT::Client
public:
explicit Publisher(const QHostAddress& host = EXAMPLE_HOST,
const quint16 port = EXAMPLE_PORT,
QObject* parent = NULL)
QObject* parent = nullptr)
: QMQTT::Client(host, port, parent)
, _number(0)
{
Expand Down Expand Up @@ -88,7 +88,7 @@ class Subscriber : public QMQTT::Client
public:
explicit Subscriber(const QHostAddress& host = EXAMPLE_HOST,
const quint16 port = EXAMPLE_PORT,
QObject* parent = NULL)
QObject* parent = nullptr)
: QMQTT::Client(host, port, parent)
, _qout(stdout)
{
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ QMQTT::Client::Client(const QString& url,
{
Q_D(Client);
#ifndef QT_NO_SSL
d->init(url, origin, version, NULL, ignoreSelfSigned);
d->init(url, origin, version, nullptr, ignoreSelfSigned);
#else
Q_UNUSED(ignoreSelfSigned)
d->init(url, origin, version);
Expand Down
12 changes: 6 additions & 6 deletions src/mqtt/qmqtt_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ class Q_MQTT_EXPORT Client : public QObject
public:
Client(const QHostAddress& host = QHostAddress::LocalHost,
const quint16 port = 1883,
QObject* parent = NULL);
QObject* parent = nullptr);

#ifndef QT_NO_SSL
Client(const QString& hostName,
const quint16 port,
const QSslConfiguration& config,
const bool ignoreSelfSigned=false,
QObject* parent = NULL);
QObject* parent = nullptr);
#endif // QT_NO_SSL

// This function is provided for backward compatibility with older versions of QMQTT.
Expand All @@ -165,31 +165,31 @@ class Q_MQTT_EXPORT Client : public QObject
const quint16 port,
const bool ssl,
const bool ignoreSelfSigned,
QObject* parent = NULL);
QObject* parent = nullptr);

#ifdef QT_WEBSOCKETS_LIB
// Create a connection over websockets
Client(const QString& url,
const QString& origin,
QWebSocketProtocol::Version version,
bool ignoreSelfSigned = false,
QObject* parent = NULL);
QObject* parent = nullptr);

#ifndef QT_NO_SSL
Client(const QString& url,
const QString& origin,
QWebSocketProtocol::Version version,
const QSslConfiguration& config,
const bool ignoreSelfSigned = false,
QObject* parent = NULL);
QObject* parent = nullptr);
#endif // QT_NO_SSL
#endif // QT_WEBSOCKETS_LIB

// for testing purposes only
Client(NetworkInterface* network,
const QHostAddress& host = QHostAddress::LocalHost,
const quint16 port = 1883,
QObject* parent = NULL);
QObject* parent = nullptr);

virtual ~Client();

Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_client_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void QMQTT::ClientPrivate::init(const QHostAddress& host, const quint16 port, Ne
Q_Q(Client);
_host = host;
_port = port;
if(network == NULL)
if(network == nullptr)
{
init(new Network(q));
}
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_client_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ClientPrivate
ClientPrivate(Client* qq_ptr);
~ClientPrivate();

void init(const QHostAddress& host, const quint16 port, NetworkInterface* network = NULL);
void init(const QHostAddress& host, const quint16 port, NetworkInterface* network = nullptr);
#ifndef QT_NO_SSL
void init(const QString& hostName, const quint16 port, const QSslConfiguration& config,
const bool ignoreSelfSigned=false);
Expand Down
10 changes: 5 additions & 5 deletions src/mqtt/qmqtt_network_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,23 @@ class Network : public NetworkInterface
Q_OBJECT

public:
Network(QObject* parent = NULL);
Network(QObject* parent = nullptr);
#ifndef QT_NO_SSL
Network(const QSslConfiguration& config, QObject* parent = NULL);
Network(const QSslConfiguration& config, QObject* parent = nullptr);
#endif // QT_NO_SSL
#ifdef QT_WEBSOCKETS_LIB
#ifndef QT_NO_SSL
Network(const QString& origin,
QWebSocketProtocol::Version version,
const QSslConfiguration* sslConfig,
QObject* parent = NULL);
QObject* parent = nullptr);
#endif // QT_NO_SSL
Network(const QString& origin,
QWebSocketProtocol::Version version,
QObject* parent = NULL);
QObject* parent = nullptr);
#endif // QT_WEBSOCKETS_LIB
Network(SocketInterface* socketInterface, TimerInterface* timerInterface,
QObject* parent = NULL);
QObject* parent = nullptr);
~Network();

void sendFrame(const Frame &frame);
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_networkinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Q_MQTT_EXPORT NetworkInterface : public QObject
{
Q_OBJECT
public:
explicit NetworkInterface(QObject* parent = NULL) : QObject(parent) {}
explicit NetworkInterface(QObject* parent = nullptr) : QObject(parent) {}
virtual ~NetworkInterface() {}

virtual void sendFrame(const Frame& frame) = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_router.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Q_MQTT_EXPORT Router : public QObject
{
Q_OBJECT
public:
explicit Router(Client *parent = 0);
explicit Router(Client *parent = nullptr);

RouteSubscription *subscribe(const QString &route);
Client *client() const;
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_routesubscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private Q_SLOTS:
private:
friend class Router;

explicit RouteSubscription(Router *parent = 0);
explicit RouteSubscription(Router *parent = nullptr);
void setRoute(const QString &route);

QPointer<Client> _client;
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_socket_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Socket : public SocketInterface
{
Q_OBJECT
public:
explicit Socket(QObject* parent = NULL);
explicit Socket(QObject* parent = nullptr);
virtual ~Socket();

virtual QIODevice *ioDevice();
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_socketinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Q_MQTT_EXPORT SocketInterface : public QObject
{
Q_OBJECT
public:
explicit SocketInterface(QObject* parent = NULL) : QObject(parent) {}
explicit SocketInterface(QObject* parent = nullptr) : QObject(parent) {}
virtual ~SocketInterface() {}

virtual QIODevice* ioDevice() = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_ssl_socket_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class SslSocket : public SocketInterface
{
Q_OBJECT
public:
explicit SslSocket(const QSslConfiguration& config, QObject* parent = NULL);
explicit SslSocket(const QSslConfiguration& config, QObject* parent = nullptr);
virtual ~SslSocket();

virtual QIODevice *ioDevice();
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_timer_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Timer : public TimerInterface
{
Q_OBJECT
public:
explicit Timer(QObject *parent = 0);
explicit Timer(QObject *parent = nullptr);
virtual ~Timer();

bool isSingleShot() const;
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_timerinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Q_MQTT_EXPORT TimerInterface : public QObject
{
Q_OBJECT
public:
explicit TimerInterface(QObject* parent = NULL) : QObject(parent) {}
explicit TimerInterface(QObject* parent = nullptr) : QObject(parent) {}
virtual ~TimerInterface() {}

virtual bool isSingleShot() const = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_websocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ QMQTT::WebSocket::WebSocket(const QString& origin,
, _ioDevice(new WebSocketIODevice(_socket, this))
{
initialize();
if (sslConfig != NULL)
if (sslConfig != nullptr)
_socket->setSslConfiguration(*sslConfig);
connect(_socket, &QWebSocket::sslErrors, this, &WebSocket::sslErrors);
}
Expand Down
4 changes: 2 additions & 2 deletions src/mqtt/qmqtt_websocket_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ class WebSocket : public SocketInterface
WebSocket(const QString& origin,
QWebSocketProtocol::Version version,
const QSslConfiguration* sslConfig,
QObject* parent = NULL);
QObject* parent = nullptr);
#endif // QT_NO_SSL

WebSocket(const QString& origin,
QWebSocketProtocol::Version version,
QObject* parent = NULL);
QObject* parent = nullptr);

virtual ~WebSocket();

Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/qmqtt_websocketiodevice_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class WebSocketIODevice : public QIODevice
{
Q_OBJECT
public:
explicit WebSocketIODevice(QWebSocket *socket, QObject *parent = NULL);
explicit WebSocketIODevice(QWebSocket *socket, QObject *parent = nullptr);

bool connectToHost(const QNetworkRequest &request);

Expand Down
10 changes: 5 additions & 5 deletions tests/gtest/tests/customprinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void CustomPrinter::OnTestCaseStart(const TestCase& test_case)
qout << "[----------] "
<< (test_case.test_to_run_count() == 1 ? "test" : "tests")
<< " from " << test_case.name();
if(NULL == test_case.type_param())
if(nullptr == test_case.type_param())
{
qout << endl;
}
Expand Down Expand Up @@ -88,18 +88,18 @@ void CustomPrinter::OnTestEnd(const TestInfo& test_info)
PrintTestName(test_info.test_case_name(), test_info.name());
if (test_info.result()->Failed())
{
if (NULL != test_info.type_param() || NULL != test_info.value_param())
if (nullptr != test_info.type_param() || nullptr != test_info.value_param())
{
qout << ", where ";
if (NULL != test_info.type_param())
if (nullptr != test_info.type_param())
{
qout << "TypeParam = " << test_info.type_param();
if (NULL != test_info.value_param())
if (nullptr != test_info.value_param())
{
qout << " and ";
}
}
if (NULL != test_info.value_param())
if (nullptr != test_info.value_param())
{
qout << "GetParam() = " << test_info.value_param();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/gtest/tests/routedmessagetests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private slots:
};

RoutedMessageTests::RoutedMessageTests()
: _uut(NULL)
: _uut(nullptr)
{
}

Expand Down
4 changes: 2 additions & 2 deletions tests/gtest/tests/routertests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private slots:
};

RouterTests::RouterTests()
: _uut(NULL)
: _uut(nullptr)
{
}

Expand All @@ -46,7 +46,7 @@ void RouterTests::cleanup()
void RouterTests::subscribe_Test()
{
// QMQTT::RouteSubscription* subscription = _uut->subscribe("route");
// QVERIFY(NULL != subscription);
// QVERIFY(nullptr != subscription);
// QCOMPARE(subscription->route(), QString("route"));
}

Expand Down
2 changes: 1 addition & 1 deletion tests/gtest/tests/routesubscriptiontests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private slots:
};

RouteSubscriptionTests::RouteSubscriptionTests()
: _uut(NULL)
: _uut(nullptr)
{
}

Expand Down
2 changes: 1 addition & 1 deletion tests/gtest/tests/socketmock.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class SocketMock : public QMQTT::SocketInterface
{
public:
SocketMock(QObject* parent = NULL)
SocketMock(QObject* parent = nullptr)
: QMQTT::SocketInterface (parent)
, mockIoDevice(new IODeviceMock)
{
Expand Down
8 changes: 4 additions & 4 deletions tests/gtest/tests/tcpserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <QTcpSocket>

TcpServer::TcpServer(const QHostAddress host, const quint16 port)
: _socket(NULL)
: _socket(nullptr)
{
connect(this, &QTcpServer::newConnection, this, &TcpServer::on_newConnection);
listen(host, port);
Expand All @@ -15,16 +15,16 @@ TcpServer::~TcpServer()

void TcpServer::on_newConnection()
{
if(NULL != _socket)
if(nullptr != _socket)
{
disconnect(_socket, &QTcpSocket::readyRead, this, &TcpServer::on_readyRead);
_socket->disconnectFromHost();
_socket->deleteLater();
_socket = NULL;
_socket = nullptr;
_data.clear();
}
_socket = nextPendingConnection();
if(NULL != _socket)
if(nullptr != _socket)
{
connect(_socket, &QTcpSocket::readyRead, this, &TcpServer::on_readyRead);
}
Expand Down

0 comments on commit bccae56

Please sign in to comment.