From f3e78a4a2920665b45b964049db3ebed9b8f1dc7 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Sat, 24 May 2014 00:13:07 +0200 Subject: Backported Print class from ide-1.5.x branch Close #1951 --- cores/arduino/Print.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'cores/arduino/Print.cpp') diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp index 53961ec..5df5630 100755 --- a/cores/arduino/Print.cpp +++ b/cores/arduino/Print.cpp @@ -41,7 +41,7 @@ size_t Print::write(const uint8_t *buffer, size_t size) size_t Print::print(const __FlashStringHelper *ifsh) { - const char PROGMEM *p = (const char PROGMEM *)ifsh; + PGM_P p = reinterpret_cast(ifsh); size_t n = 0; while (1) { unsigned char c = pgm_read_byte(p++); @@ -53,11 +53,7 @@ size_t Print::print(const __FlashStringHelper *ifsh) size_t Print::print(const String &s) { - size_t n = 0; - for (uint16_t i = 0; i < s.length(); i++) { - n += write(s[i]); - } - return n; + return write(s.c_str(), s.length()); } size_t Print::print(const char str[]) -- cgit v1.2.3-18-g5258