From 95a1400a2ac9de1a29fa305f45b928ce8e3044bd Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Thu, 2 Apr 2020 01:20:12 +0200 Subject: Replace NULL with nullptr --- modules/upnp/upnp.cpp | 24 ++++++++++++------------ modules/upnp/upnp_device.cpp | 8 ++++---- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'modules/upnp') diff --git a/modules/upnp/upnp.cpp b/modules/upnp/upnp.cpp index 5ef7575b0c..856f4188aa 100644 --- a/modules/upnp/upnp.cpp +++ b/modules/upnp/upnp.cpp @@ -54,9 +54,9 @@ int UPNP::discover(int timeout, int ttl, const String &device_filter) { struct UPNPDev *devlist; if (is_common_device(device_filter)) { - devlist = upnpDiscover(timeout, discover_multicast_if.utf8().get_data(), NULL, discover_local_port, discover_ipv6, ttl, &error); + devlist = upnpDiscover(timeout, discover_multicast_if.utf8().get_data(), nullptr, discover_local_port, discover_ipv6, ttl, &error); } else { - devlist = upnpDiscoverAll(timeout, discover_multicast_if.utf8().get_data(), NULL, discover_local_port, discover_ipv6, ttl, &error); + devlist = upnpDiscoverAll(timeout, discover_multicast_if.utf8().get_data(), nullptr, discover_local_port, discover_ipv6, ttl, &error); } if (error != UPNPDISCOVER_SUCCESS) { @@ -133,7 +133,7 @@ void UPNP::parse_igd(Ref dev, UPNPDev *devlist) { parserootdesc(xml, size, &data); free(xml); - xml = 0; + xml = nullptr; GetUPNPUrls(urls, &data, dev->get_description_url().utf8().get_data(), 0); @@ -235,20 +235,20 @@ int UPNP::get_device_count() const { } Ref UPNP::get_device(int index) const { - ERR_FAIL_INDEX_V(index, devices.size(), NULL); + ERR_FAIL_INDEX_V(index, devices.size(), nullptr); return devices.get(index); } void UPNP::add_device(Ref device) { - ERR_FAIL_COND(device == NULL); + ERR_FAIL_COND(device == nullptr); devices.push_back(device); } void UPNP::set_device(int index, Ref device) { ERR_FAIL_INDEX(index, devices.size()); - ERR_FAIL_COND(device == NULL); + ERR_FAIL_COND(device == nullptr); devices.set(index, device); } @@ -264,17 +264,17 @@ void UPNP::clear_devices() { } Ref UPNP::get_gateway() const { - ERR_FAIL_COND_V(devices.size() < 1, NULL); + ERR_FAIL_COND_V(devices.size() < 1, nullptr); for (int i = 0; i < devices.size(); i++) { Ref dev = get_device(i); - if (dev != NULL && dev->is_valid_gateway()) { + if (dev != nullptr && dev->is_valid_gateway()) { return dev; } } - return NULL; + return nullptr; } void UPNP::set_discover_multicast_if(const String &m_if) { @@ -304,7 +304,7 @@ bool UPNP::is_discover_ipv6() const { String UPNP::query_external_address() const { Ref dev = get_gateway(); - if (dev == NULL) { + if (dev == nullptr) { return ""; } @@ -314,7 +314,7 @@ String UPNP::query_external_address() const { int UPNP::add_port_mapping(int port, int port_internal, String desc, String proto, int duration) const { Ref dev = get_gateway(); - if (dev == NULL) { + if (dev == nullptr) { return UPNP_RESULT_NO_GATEWAY; } @@ -326,7 +326,7 @@ int UPNP::add_port_mapping(int port, int port_internal, String desc, String prot int UPNP::delete_port_mapping(int port, String proto) const { Ref dev = get_gateway(); - if (dev == NULL) { + if (dev == nullptr) { return UPNP_RESULT_NO_GATEWAY; } diff --git a/modules/upnp/upnp_device.cpp b/modules/upnp/upnp_device.cpp index 6edfbc2d7d..c21826d14d 100644 --- a/modules/upnp/upnp_device.cpp +++ b/modules/upnp/upnp_device.cpp @@ -65,10 +65,10 @@ int UPNPDevice::add_port_mapping(int port, int port_internal, String desc, Strin itos(port).utf8().get_data(), itos(port_internal).utf8().get_data(), igd_our_addr.utf8().get_data(), - desc.empty() ? 0 : desc.utf8().get_data(), + desc.empty() ? nullptr : desc.utf8().get_data(), proto.utf8().get_data(), - NULL, // Remote host, always NULL as IGDs don't support it - duration > 0 ? itos(duration).utf8().get_data() : 0); + nullptr, // Remote host, always nullptr as IGDs don't support it + duration > 0 ? itos(duration).utf8().get_data() : nullptr); ERR_FAIL_COND_V(i != UPNPCOMMAND_SUCCESS, UPNP::upnp_result(i)); @@ -84,7 +84,7 @@ int UPNPDevice::delete_port_mapping(int port, String proto) const { igd_service_type.utf8().get_data(), itos(port).utf8().get_data(), proto.utf8().get_data(), - NULL // Remote host, always NULL as IGDs don't support it + nullptr // Remote host, always nullptr as IGDs don't support it ); ERR_FAIL_COND_V(i != UPNPCOMMAND_SUCCESS, UPNP::upnp_result(i)); -- cgit v1.2.3