mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
IPAddress: allow misaligned source in constructor (#5421)
This commit is contained in:
parent
ca3678f7c1
commit
31bee50102
@ -22,6 +22,11 @@
|
||||
#include <Print.h>
|
||||
#include <StreamString.h>
|
||||
|
||||
IPAddress::IPAddress(const IPAddress& from)
|
||||
{
|
||||
ip_addr_copy(_ip, from._ip);
|
||||
}
|
||||
|
||||
IPAddress::IPAddress() {
|
||||
_ip = *IP_ANY_TYPE; // lwIP's v4-or-v6 generic address
|
||||
}
|
||||
@ -45,7 +50,10 @@ void IPAddress::ctor32(uint32_t address) {
|
||||
|
||||
IPAddress::IPAddress(const uint8_t *address) {
|
||||
setV4();
|
||||
v4() = *reinterpret_cast<const uint32_t*>(address);
|
||||
(*this)[0] = address[0];
|
||||
(*this)[1] = address[1];
|
||||
(*this)[2] = address[2];
|
||||
(*this)[3] = address[3];
|
||||
}
|
||||
|
||||
bool IPAddress::fromString(const char *address) {
|
||||
|
@ -72,6 +72,7 @@ class IPAddress: public Printable {
|
||||
public:
|
||||
// Constructors
|
||||
IPAddress();
|
||||
IPAddress(const IPAddress& from);
|
||||
IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet);
|
||||
IPAddress(uint32_t address) { ctor32(address); }
|
||||
IPAddress(u32_t address) { ctor32(address); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user