mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-07 06:01:35 +03:00
Define lwIP's s32/u32 to int (#8560)
* Define lwIP's s32/u32 to int s32/u32 were previously defined as long, but long can be 64 bits in host mode, so this commit reduces valgrind complaints and increase coherency. * some lads like to use `unsigned long` for 32 bits IPv4 addresses * fix lwIP's `sys_now()` return type * fix C declarations * merge upstream (lwip2) update on sys_now() definition * matching lwIP api (2/2) Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
This commit is contained in:
@ -69,7 +69,7 @@ class IPAddress: public Printable {
|
||||
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); }
|
||||
IPAddress(unsigned long address) { ctor32(address); }
|
||||
IPAddress(int address) { ctor32(address); }
|
||||
IPAddress(const uint8_t *address);
|
||||
|
||||
@ -80,16 +80,14 @@ class IPAddress: public Printable {
|
||||
// to a four-byte uint8_t array is expected
|
||||
operator uint32_t() const { return isV4()? v4(): (uint32_t)0; }
|
||||
operator uint32_t() { return isV4()? v4(): (uint32_t)0; }
|
||||
operator u32_t() const { return isV4()? v4(): (u32_t)0; }
|
||||
operator u32_t() { return isV4()? v4(): (u32_t)0; }
|
||||
|
||||
bool isSet () const;
|
||||
operator bool () const { return isSet(); } // <-
|
||||
operator bool () { return isSet(); } // <- both are needed
|
||||
|
||||
// generic IPv4 wrapper to uint32-view like arduino loves to see it
|
||||
const u32_t& v4() const { return ip_2_ip4(&_ip)->addr; } // for raw_address(const)
|
||||
u32_t& v4() { return ip_2_ip4(&_ip)->addr; }
|
||||
const uint32_t& v4() const { return ip_2_ip4(&_ip)->addr; } // for raw_address(const)
|
||||
uint32_t& v4() { return ip_2_ip4(&_ip)->addr; }
|
||||
|
||||
bool operator==(const IPAddress& addr) const {
|
||||
return ip_addr_cmp(&_ip, &addr._ip);
|
||||
@ -100,14 +98,14 @@ class IPAddress: public Printable {
|
||||
bool operator==(uint32_t addr) const {
|
||||
return isV4() && v4() == addr;
|
||||
}
|
||||
bool operator==(u32_t addr) const {
|
||||
return isV4() && v4() == addr;
|
||||
bool operator==(unsigned long addr) const {
|
||||
return isV4() && v4() == (uint32_t)addr;
|
||||
}
|
||||
bool operator!=(uint32_t addr) const {
|
||||
return !(isV4() && v4() == addr);
|
||||
}
|
||||
bool operator!=(u32_t addr) const {
|
||||
return !(isV4() && v4() == addr);
|
||||
bool operator!=(unsigned long addr) const {
|
||||
return isV4() && v4() != (uint32_t)addr;
|
||||
}
|
||||
bool operator==(const uint8_t* addr) const;
|
||||
|
||||
|
Reference in New Issue
Block a user