aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/Print.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cores/arduino/Print.cpp')
-rw-r--r--cores/arduino/Print.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp
index 782d50b..bc97c85 100644
--- a/cores/arduino/Print.cpp
+++ b/cores/arduino/Print.cpp
@@ -17,6 +17,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Modified 23 November 2006 by David A. Mellis
+ Modified 03 August 2015 by Chuck Todd
*/
#include <stdlib.h>
@@ -34,7 +35,8 @@ size_t Print::write(const uint8_t *buffer, size_t size)
{
size_t n = 0;
while (size--) {
- n += write(*buffer++);
+ if (write(*buffer++)) n++;
+ else break;
}
return n;
}
@@ -46,7 +48,8 @@ size_t Print::print(const __FlashStringHelper *ifsh)
while (1) {
unsigned char c = pgm_read_byte(p++);
if (c == 0) break;
- n += write(c);
+ if (write(c)) n++;
+ else break;
}
return n;
}