Set addr type when copy from ip4_addr_t (#5583)

This commit is contained in:
Jimmy Hedman 2023-10-23 08:41:16 +02:00 committed by Jesse Hills
parent c47f8fc02c
commit f018fde369
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A

View file

@ -34,7 +34,12 @@ struct IPAddress {
} }
IPAddress(const ip_addr_t *other_ip) { ip_addr_copy(ip_addr_, *other_ip); } IPAddress(const ip_addr_t *other_ip) { ip_addr_copy(ip_addr_, *other_ip); }
IPAddress(const std::string &in_address) { ipaddr_aton(in_address.c_str(), &ip_addr_); } IPAddress(const std::string &in_address) { ipaddr_aton(in_address.c_str(), &ip_addr_); }
IPAddress(ip4_addr_t *other_ip) { memcpy((void *) &ip_addr_, (void *) other_ip, sizeof(ip4_addr_t)); } IPAddress(ip4_addr_t *other_ip) {
memcpy((void *) &ip_addr_, (void *) other_ip, sizeof(ip4_addr_t));
#if USE_ESP32
ip_addr_.type = IPADDR_TYPE_V4;
#endif
}
#if USE_ARDUINO #if USE_ARDUINO
IPAddress(const arduino_ns::IPAddress &other_ip) { ip_addr_set_ip4_u32(&ip_addr_, other_ip); } IPAddress(const arduino_ns::IPAddress &other_ip) { ip_addr_set_ip4_u32(&ip_addr_, other_ip); }
#endif #endif