From 54b1b8b1d39bad6edbc2e4359142a98feefb2ab7 Mon Sep 17 00:00:00 2001 From: Victor Tseng Date: Mon, 12 Dec 2016 07:32:55 +0800 Subject: [PATCH] const correctness (#89) make IPAddress.toString() const method, it doesn't modify anything within the class. --- cores/esp32/IPAddress.cpp | 4 ++-- cores/esp32/IPAddress.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cores/esp32/IPAddress.cpp b/cores/esp32/IPAddress.cpp index f932d7bf..cabfdf32 100644 --- a/cores/esp32/IPAddress.cpp +++ b/cores/esp32/IPAddress.cpp @@ -72,7 +72,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]); @@ -119,4 +119,4 @@ bool IPAddress::fromString(const char *address) } _address.bytes[3] = acc; return true; -} \ No newline at end of file +} diff --git a/cores/esp32/IPAddress.h b/cores/esp32/IPAddress.h index 7c48b673..aa1d10ce 100644 --- a/cores/esp32/IPAddress.h +++ b/cores/esp32/IPAddress.h @@ -81,7 +81,7 @@ public: IPAddress& operator=(uint32_t address); virtual size_t printTo(Print& p) const; - String toString(); + String toString() const; friend class EthernetClass; friend class UDP;