File tree Expand file tree Collapse file tree 5 files changed +9
-8
lines changed Expand file tree Collapse file tree 5 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ ARDUINO 1.5.6 BETA
1616* sam: Optimized delayMicroseconds() (Rob Tillaart) #1121
1717* Optimized Print::print(String&) method, now uses internal string buffer to perform block write
1818* Improved portability of String class (maniacbug) #695
19+ * Make some operators in IPAddress const (Matthijs Kooijman)
1920
2021ARDUINO 1.5.5-r2 BETA 2014.01.10
2122
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ IPAddress& IPAddress::operator=(uint32_t address)
3737 return *this ;
3838}
3939
40- bool IPAddress::operator ==(const uint8_t * addr)
40+ bool IPAddress::operator ==(const uint8_t * addr) const
4141{
4242 return memcmp (addr, _address, sizeof (_address)) == 0 ;
4343}
Original file line number Diff line number Diff line change @@ -49,9 +49,9 @@ class IPAddress : public Printable {
4949
5050 // Overloaded cast operator to allow IPAddress objects to be used where a pointer
5151 // to a four-byte uint8_t array is expected
52- operator uint32_t () { return *((uint32_t *)_address); };
53- bool operator ==(const IPAddress& addr) { return (*((uint32_t *)_address)) == (*((uint32_t *)addr._address )); };
54- bool operator ==(const uint8_t * addr);
52+ operator uint32_t () const { return *((uint32_t *)_address); };
53+ bool operator ==(const IPAddress& addr) const { return (*((uint32_t *)_address)) == (*((uint32_t *)addr._address )); };
54+ bool operator ==(const uint8_t * addr) const ;
5555
5656 // Overloaded index operator to allow getting and setting individual octets of the address
5757 uint8_t operator [](int index) const { return _address[index]; };
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ IPAddress& IPAddress::operator=(uint32_t address)
3737 return *this ;
3838}
3939
40- bool IPAddress::operator ==(const uint8_t * addr)
40+ bool IPAddress::operator ==(const uint8_t * addr) const
4141{
4242 return memcmp (addr, _address, sizeof (_address)) == 0 ;
4343}
Original file line number Diff line number Diff line change @@ -48,9 +48,9 @@ class IPAddress : public Printable {
4848
4949 // Overloaded cast operator to allow IPAddress objects to be used where a pointer
5050 // to a four-byte uint8_t array is expected
51- operator uint32_t () { return *((uint32_t *)_address); };
52- bool operator ==(const IPAddress& addr) { return (*((uint32_t *)_address)) == (*((uint32_t *)addr._address )); };
53- bool operator ==(const uint8_t * addr);
51+ operator uint32_t () const { return *((uint32_t *)_address); };
52+ bool operator ==(const IPAddress& addr) const { return (*((uint32_t *)_address)) == (*((uint32_t *)addr._address )); };
53+ bool operator ==(const uint8_t * addr) const ;
5454
5555 // Overloaded index operator to allow getting and setting individual octets of the address
5656 uint8_t operator [](int index) const { return _address[index]; };
You can’t perform that action at this time.
0 commit comments