提交 54b1b8b1 编写于 作者: V Victor Tseng 提交者: Me No Dev

const correctness (#89)

make IPAddress.toString() const method, it doesn't modify anything
within the class.
上级 d8e74f2c
...@@ -72,7 +72,7 @@ size_t IPAddress::printTo(Print& p) const ...@@ -72,7 +72,7 @@ size_t IPAddress::printTo(Print& p) const
return n; return n;
} }
String IPAddress::toString() String IPAddress::toString() const
{ {
char szRet[16]; char szRet[16];
sprintf(szRet,"%u.%u.%u.%u", _address.bytes[0], _address.bytes[1], _address.bytes[2], _address.bytes[3]); 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) ...@@ -119,4 +119,4 @@ bool IPAddress::fromString(const char *address)
} }
_address.bytes[3] = acc; _address.bytes[3] = acc;
return true; return true;
} }
\ No newline at end of file
...@@ -81,7 +81,7 @@ public: ...@@ -81,7 +81,7 @@ public:
IPAddress& operator=(uint32_t address); IPAddress& operator=(uint32_t address);
virtual size_t printTo(Print& p) const; virtual size_t printTo(Print& p) const;
String toString(); String toString() const;
friend class EthernetClass; friend class EthernetClass;
friend class UDP; friend class UDP;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册