Merge pull request #107406 from Ivorforce/ip-to-string-explicit
Core: Remove implicit conversions from `IPAddress` to `String`, to avoid accidental conversions
This commit is contained in:
commit
d9cd011e2f
@ -259,7 +259,7 @@ PackedStringArray IP::_get_local_addresses() const {
|
|||||||
List<IPAddress> ip_addresses;
|
List<IPAddress> ip_addresses;
|
||||||
get_local_addresses(&ip_addresses);
|
get_local_addresses(&ip_addresses);
|
||||||
for (const IPAddress &E : ip_addresses) {
|
for (const IPAddress &E : ip_addresses) {
|
||||||
addresses.push_back(E);
|
addresses.push_back(String(E));
|
||||||
}
|
}
|
||||||
|
|
||||||
return addresses;
|
return addresses;
|
||||||
|
@ -89,7 +89,7 @@ public:
|
|||||||
const uint8_t *get_ipv6() const;
|
const uint8_t *get_ipv6() const;
|
||||||
void set_ipv6(const uint8_t *p_buf);
|
void set_ipv6(const uint8_t *p_buf);
|
||||||
|
|
||||||
operator String() const;
|
explicit operator String() const;
|
||||||
IPAddress(const String &p_string);
|
IPAddress(const String &p_string);
|
||||||
IPAddress(uint32_t p_a, uint32_t p_b, uint32_t p_c, uint32_t p_d, bool is_v6 = false);
|
IPAddress(uint32_t p_a, uint32_t p_b, uint32_t p_c, uint32_t p_d, bool is_v6 = false);
|
||||||
IPAddress() { clear(); }
|
IPAddress() { clear(); }
|
||||||
|
@ -68,7 +68,7 @@ Error PacketPeerUDP::leave_multicast_group(IPAddress p_multi_address, const Stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
String PacketPeerUDP::_get_packet_ip() const {
|
String PacketPeerUDP::_get_packet_ip() const {
|
||||||
return get_packet_address();
|
return String(get_packet_address());
|
||||||
}
|
}
|
||||||
|
|
||||||
Error PacketPeerUDP::_set_dest_address(const String &p_address, int p_port) {
|
Error PacketPeerUDP::_set_dest_address(const String &p_address, int p_port) {
|
||||||
|
@ -821,7 +821,7 @@ struct VariantInternalAccessor<const T *> {
|
|||||||
template <>
|
template <>
|
||||||
struct VariantInternalAccessor<IPAddress> {
|
struct VariantInternalAccessor<IPAddress> {
|
||||||
static _FORCE_INLINE_ IPAddress get(const Variant *v) { return IPAddress(*VariantInternal::get_string(v)); }
|
static _FORCE_INLINE_ IPAddress get(const Variant *v) { return IPAddress(*VariantInternal::get_string(v)); }
|
||||||
static _FORCE_INLINE_ void set(Variant *v, IPAddress p_value) { *VariantInternal::get_string(v) = p_value; }
|
static _FORCE_INLINE_ void set(Variant *v, IPAddress p_value) { *VariantInternal::get_string(v) = String(p_value); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
@ -1386,12 +1386,12 @@ void EditorSettings::setup_network() {
|
|||||||
}
|
}
|
||||||
// Select current IP (found)
|
// Select current IP (found)
|
||||||
if (ip == current) {
|
if (ip == current) {
|
||||||
selected = ip;
|
selected = String(ip);
|
||||||
}
|
}
|
||||||
if (!hint.is_empty()) {
|
if (!hint.is_empty()) {
|
||||||
hint += ",";
|
hint += ",";
|
||||||
}
|
}
|
||||||
hint += ip;
|
hint += String(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add hints with valid IP addresses to remote_host property.
|
// Add hints with valid IP addresses to remote_host property.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user