diff --git a/teensy/IPAddress.h b/teensy/IPAddress.h index 3640f5639..4afc62e3f 100644 --- a/teensy/IPAddress.h +++ b/teensy/IPAddress.h @@ -63,8 +63,8 @@ class IPAddress : public Printable { bool operator==(const uint8_t* addr); // Overloaded index operator to allow getting and setting individual octets of the address - uint8_t operator[](int index) const { return _address.bytes[index]; }; - uint8_t& operator[](int index) { return _address.bytes[index]; }; + uint8_t& operator[](const size_t index) { return _address.bytes[index]; } + const uint8_t& operator[](const size_t index) const { return _address.bytes[index]; } // Overloaded copy operators to allow initialisation of IPAddress objects from other types IPAddress& operator=(const uint8_t *address); diff --git a/teensy3/IPAddress.h b/teensy3/IPAddress.h index c71ea0427..4631593d7 100644 --- a/teensy3/IPAddress.h +++ b/teensy3/IPAddress.h @@ -94,12 +94,12 @@ class IPAddress : public Printable { } // Overloaded index operator to allow getting and setting individual octets of the address - uint8_t operator[](int index) const { + uint8_t& operator[](const size_t index) { return _address.bytes[index]; - }; - uint8_t& operator[](int index) { + } + const uint8_t& operator[](const size_t index) const { return _address.bytes[index]; - }; + } // Overloaded copy operators to allow initialisation of IPAddress objects from other types IPAddress& operator=(const uint8_t *address) { diff --git a/teensy4/IPAddress.h b/teensy4/IPAddress.h index c71ea0427..4631593d7 100644 --- a/teensy4/IPAddress.h +++ b/teensy4/IPAddress.h @@ -94,12 +94,12 @@ class IPAddress : public Printable { } // Overloaded index operator to allow getting and setting individual octets of the address - uint8_t operator[](int index) const { + uint8_t& operator[](const size_t index) { return _address.bytes[index]; - }; - uint8_t& operator[](int index) { + } + const uint8_t& operator[](const size_t index) const { return _address.bytes[index]; - }; + } // Overloaded copy operators to allow initialisation of IPAddress objects from other types IPAddress& operator=(const uint8_t *address) {