From 46b0ada9a941607de0a2df80bf7f58d3a959ff57 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 9 Jan 2014 19:39:07 +0100 Subject: Make some operators in IPAddress const These functions do not modify the IPAddress object, but were not marked as const. This meant that you could not do: void set_ip(const IPAddress& ip) { uint32_t copy = ip; } Since calling operator uint32_t() on ip would discard the constness of the reference. --- cores/arduino/IPAddress.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cores/arduino/IPAddress.cpp') diff --git a/cores/arduino/IPAddress.cpp b/cores/arduino/IPAddress.cpp index fe3deb7..f698f2a 100644 --- a/cores/arduino/IPAddress.cpp +++ b/cores/arduino/IPAddress.cpp @@ -37,7 +37,7 @@ IPAddress& IPAddress::operator=(uint32_t address) return *this; } -bool IPAddress::operator==(const uint8_t* addr) +bool IPAddress::operator==(const uint8_t* addr) const { return memcmp(addr, _address, sizeof(_address)) == 0; } -- cgit v1.2.3-18-g5258