Replace NULL with nullptr
This commit is contained in:
@ -50,7 +50,7 @@ bool EMWSServer::has_peer(int p_id) const {
|
||||
}
|
||||
|
||||
Ref<WebSocketPeer> EMWSServer::get_peer(int p_id) const {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Vector<String> EMWSServer::get_protocols() const {
|
||||
|
||||
@ -63,7 +63,7 @@ public:
|
||||
ERR_FAIL_COND_V(p_info && _packets.space_left() < 1, ERR_OUT_OF_MEMORY);
|
||||
#endif
|
||||
|
||||
// If p_info is NULL, only the payload is written
|
||||
// If p_info is nullptr, only the payload is written
|
||||
if (p_info) {
|
||||
_Packet p;
|
||||
p.size = p_size;
|
||||
@ -71,7 +71,7 @@ public:
|
||||
_packets.write(p);
|
||||
}
|
||||
|
||||
// If p_payload is NULL, only the packet information is written.
|
||||
// If p_payload is nullptr, only the packet information is written.
|
||||
if (p_payload) {
|
||||
_payload.write((const uint8_t *)p_payload, p_size);
|
||||
}
|
||||
|
||||
@ -56,13 +56,13 @@ public:\
|
||||
static CNAME *create() {\
|
||||
\
|
||||
if (!_create)\
|
||||
return NULL;\
|
||||
return nullptr;\
|
||||
return _create();\
|
||||
}\
|
||||
protected:\
|
||||
|
||||
#define GDCINULL(CNAME) \
|
||||
CNAME *(*CNAME::_create)() = NULL;
|
||||
CNAME *(*CNAME::_create)() = nullptr;
|
||||
|
||||
#define GDCIIMPL(IMPNAME, CNAME) \
|
||||
public:\
|
||||
|
||||
@ -42,7 +42,7 @@ WebSocketMultiplayerPeer::WebSocketMultiplayerPeer() {
|
||||
_current_packet.source = 0;
|
||||
_current_packet.destination = 0;
|
||||
_current_packet.size = 0;
|
||||
_current_packet.data = NULL;
|
||||
_current_packet.data = nullptr;
|
||||
}
|
||||
|
||||
WebSocketMultiplayerPeer::~WebSocketMultiplayerPeer() {
|
||||
@ -74,12 +74,12 @@ int WebSocketMultiplayerPeer::_gen_unique_id() const {
|
||||
void WebSocketMultiplayerPeer::_clear() {
|
||||
|
||||
_peer_map.clear();
|
||||
if (_current_packet.data != NULL)
|
||||
if (_current_packet.data != nullptr)
|
||||
memfree(_current_packet.data);
|
||||
|
||||
for (List<Packet>::Element *E = _incoming_packets.front(); E; E = E->next()) {
|
||||
memfree(E->get().data);
|
||||
E->get().data = NULL;
|
||||
E->get().data = nullptr;
|
||||
}
|
||||
|
||||
_incoming_packets.clear();
|
||||
@ -109,9 +109,9 @@ Error WebSocketMultiplayerPeer::get_packet(const uint8_t **r_buffer, int &r_buff
|
||||
|
||||
r_buffer_size = 0;
|
||||
|
||||
if (_current_packet.data != NULL) {
|
||||
if (_current_packet.data != nullptr) {
|
||||
memfree(_current_packet.data);
|
||||
_current_packet.data = NULL;
|
||||
_current_packet.data = nullptr;
|
||||
}
|
||||
|
||||
_current_packet = _incoming_packets.front()->get();
|
||||
|
||||
@ -279,7 +279,7 @@ void WSLClient::poll() {
|
||||
|
||||
Ref<WebSocketPeer> WSLClient::get_peer(int p_peer_id) const {
|
||||
|
||||
ERR_FAIL_COND_V(p_peer_id != 1, NULL);
|
||||
ERR_FAIL_COND_V(p_peer_id != 1, nullptr);
|
||||
|
||||
return _peer;
|
||||
}
|
||||
@ -298,7 +298,7 @@ NetworkedMultiplayerPeer::ConnectionStatus WSLClient::get_connection_status() co
|
||||
void WSLClient::disconnect_from_host(int p_code, String p_reason) {
|
||||
|
||||
_peer->close(p_code, p_reason);
|
||||
_connection = Ref<StreamPeer>(NULL);
|
||||
_connection = Ref<StreamPeer>(nullptr);
|
||||
_tcp = Ref<StreamPeerTCP>(memnew(StreamPeerTCP));
|
||||
|
||||
_key = "";
|
||||
|
||||
@ -69,7 +69,7 @@ void WSLPeer::_wsl_destroy(struct PeerData **p_data) {
|
||||
}
|
||||
wslay_event_context_free(data->ctx);
|
||||
memdelete(data);
|
||||
*p_data = NULL;
|
||||
*p_data = nullptr;
|
||||
}
|
||||
|
||||
bool WSLPeer::_wsl_poll(struct PeerData *p_data) {
|
||||
@ -163,9 +163,9 @@ wslay_event_callbacks wsl_callbacks = {
|
||||
wsl_recv_callback,
|
||||
wsl_send_callback,
|
||||
wsl_genmask_callback,
|
||||
NULL, /* on_frame_recv_start_callback */
|
||||
NULL, /* on_frame_recv_callback */
|
||||
NULL, /* on_frame_recv_end_callback */
|
||||
nullptr, /* on_frame_recv_start_callback */
|
||||
nullptr, /* on_frame_recv_callback */
|
||||
nullptr, /* on_frame_recv_end_callback */
|
||||
wsl_msg_recv_callback
|
||||
};
|
||||
|
||||
@ -199,8 +199,8 @@ Error WSLPeer::parse_message(const wslay_event_on_msg_recv_arg *arg) {
|
||||
}
|
||||
|
||||
void WSLPeer::make_context(PeerData *p_data, unsigned int p_in_buf_size, unsigned int p_in_pkt_size, unsigned int p_out_buf_size, unsigned int p_out_pkt_size) {
|
||||
ERR_FAIL_COND(_data != NULL);
|
||||
ERR_FAIL_COND(p_data == NULL);
|
||||
ERR_FAIL_COND(_data != nullptr);
|
||||
ERR_FAIL_COND(p_data == nullptr);
|
||||
|
||||
_in_buffer.resize(p_in_pkt_size, p_in_buf_size);
|
||||
_packet_buffer.resize((1 << MAX(p_in_buf_size, p_out_buf_size)));
|
||||
@ -229,7 +229,7 @@ void WSLPeer::poll() {
|
||||
return;
|
||||
|
||||
if (_wsl_poll(_data)) {
|
||||
_data = NULL;
|
||||
_data = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ bool WSLPeer::was_string_packet() const {
|
||||
|
||||
bool WSLPeer::is_connected_to_host() const {
|
||||
|
||||
return _data != NULL;
|
||||
return _data != nullptr;
|
||||
}
|
||||
|
||||
void WSLPeer::close_now() {
|
||||
@ -330,7 +330,7 @@ void WSLPeer::invalidate() {
|
||||
}
|
||||
|
||||
WSLPeer::WSLPeer() {
|
||||
_data = NULL;
|
||||
_data = nullptr;
|
||||
_is_string = 0;
|
||||
close_code = -1;
|
||||
write_mode = WRITE_MODE_BINARY;
|
||||
@ -341,7 +341,7 @@ WSLPeer::~WSLPeer() {
|
||||
close();
|
||||
invalidate();
|
||||
_wsl_destroy(&_data);
|
||||
_data = NULL;
|
||||
_data = nullptr;
|
||||
}
|
||||
|
||||
#endif // JAVASCRIPT_ENABLED
|
||||
|
||||
@ -67,10 +67,10 @@ public:
|
||||
valid = false;
|
||||
is_server = false;
|
||||
id = 1;
|
||||
ctx = NULL;
|
||||
obj = NULL;
|
||||
ctx = nullptr;
|
||||
obj = nullptr;
|
||||
closing = false;
|
||||
peer = NULL;
|
||||
peer = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -265,7 +265,7 @@ bool WSLServer::has_peer(int p_id) const {
|
||||
}
|
||||
|
||||
Ref<WebSocketPeer> WSLServer::get_peer(int p_id) const {
|
||||
ERR_FAIL_COND_V(!has_peer(p_id), NULL);
|
||||
ERR_FAIL_COND_V(!has_peer(p_id), nullptr);
|
||||
return _peer_map[p_id];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user