Skip to content

Commit c2e9860

Browse files
committed
Merge remote-tracking branch 'matthijs/ide-1.5.x-ipaddress-const' into ide-1.5.x
2 parents 63e33be + dde1a75 commit c2e9860

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

build/shared/revisions.txt

+1
Original file line numberDiff line numberDiff 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

2021
ARDUINO 1.5.5-r2 BETA 2014.01.10
2122

hardware/arduino/avr/cores/arduino/IPAddress.cpp

+1-1
Original file line numberDiff line numberDiff 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
}

hardware/arduino/avr/cores/arduino/IPAddress.h

+3-3
Original file line numberDiff line numberDiff 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]; };

hardware/arduino/sam/cores/arduino/IPAddress.cpp

+1-1
Original file line numberDiff line numberDiff 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
}

hardware/arduino/sam/cores/arduino/IPAddress.h

+3-3
Original file line numberDiff line numberDiff 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]; };

0 commit comments

Comments
 (0)