From 5666ec2ec1e026c64cf0bf8b42b1bced4144080b Mon Sep 17 00:00:00 2001 From: Victor Tseng Date: Tue, 13 Sep 2016 00:32:29 +0800 Subject: [PATCH] const-correctness `IPAddress::toString()` it doesn't modify any member variables, should be safe to be const. --- cores/esp8266/IPAddress.cpp | 2 +- cores/esp8266/IPAddress.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/esp8266/IPAddress.cpp b/cores/esp8266/IPAddress.cpp index 93a081eb2..3349c2c5b 100644 --- a/cores/esp8266/IPAddress.cpp +++ b/cores/esp8266/IPAddress.cpp @@ -105,7 +105,7 @@ size_t IPAddress::printTo(Print& p) const { return n; } -String IPAddress::toString() +String IPAddress::toString() const { char szRet[16]; sprintf(szRet,"%u.%u.%u.%u", _address.bytes[0], _address.bytes[1], _address.bytes[2], _address.bytes[3]); diff --git a/cores/esp8266/IPAddress.h b/cores/esp8266/IPAddress.h index 9e7dfe5e2..1d0d3acaf 100644 --- a/cores/esp8266/IPAddress.h +++ b/cores/esp8266/IPAddress.h @@ -77,7 +77,7 @@ class IPAddress: public Printable { IPAddress& operator=(uint32_t address); virtual size_t printTo(Print& p) const; - String toString(); + String toString() const; friend class EthernetClass; friend class UDP;