Skip to content

Commit 0488337

Browse files
author
blue-2357
committed
const correctness (#89)
make IPAddress.toString() const method, it doesn't modify anything within the class.
1 parent 5aa6b72 commit 0488337

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: cores/esp32/IPAddress.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ size_t IPAddress::printTo(Print& p) const
7272
return n;
7373
}
7474

75-
String IPAddress::toString()
75+
String IPAddress::toString() const
7676
{
7777
char szRet[16];
7878
sprintf(szRet,"%u.%u.%u.%u", _address.bytes[0], _address.bytes[1], _address.bytes[2], _address.bytes[3]);
@@ -119,4 +119,4 @@ bool IPAddress::fromString(const char *address)
119119
}
120120
_address.bytes[3] = acc;
121121
return true;
122-
}
122+
}

Diff for: cores/esp32/IPAddress.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class IPAddress: public Printable
8181
IPAddress& operator=(uint32_t address);
8282

8383
virtual size_t printTo(Print& p) const;
84-
String toString();
84+
String toString() const;
8585

8686
friend class EthernetClass;
8787
friend class UDP;

0 commit comments

Comments
 (0)