aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2011-09-07 18:41:05 -0400
committerDavid A. Mellis <d.mellis@arduino.cc>2011-09-07 18:41:05 -0400
commit8b13206e655cd9c1123d842cab1fdd0afd6edc8b (patch)
tree7bc160ae231726989f023ccc6a5fe84d685e4c42
parent3c66dc1b8d1de4b93fce7f447901559591976a26 (diff)
Making Print::write(char *) non-virtual.
http://code.google.com/p/arduino/issues/detail?id=607
-rw-r--r--cores/arduino/Client.h1
-rwxr-xr-xcores/arduino/Print.cpp10
-rwxr-xr-xcores/arduino/Print.h2
-rw-r--r--cores/arduino/Server.h2
-rw-r--r--cores/arduino/Udp.h2
5 files changed, 2 insertions, 15 deletions
diff --git a/cores/arduino/Client.h b/cores/arduino/Client.h
index ed9e9b4..ea13483 100644
--- a/cores/arduino/Client.h
+++ b/cores/arduino/Client.h
@@ -10,7 +10,6 @@ public:
virtual int connect(IPAddress ip, uint16_t port) =0;
virtual int connect(const char *host, uint16_t port) =0;
virtual size_t write(uint8_t) =0;
- virtual size_t write(const char *str) =0;
virtual size_t write(const uint8_t *buf, size_t size) =0;
virtual int available() = 0;
virtual int read() = 0;
diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp
index 8190d4f..500de8c 100755
--- a/cores/arduino/Print.cpp
+++ b/cores/arduino/Print.cpp
@@ -30,16 +30,6 @@
// Public Methods //////////////////////////////////////////////////////////////
/* default implementation: may be overridden */
-size_t Print::write(const char *str)
-{
- size_t n = 0;
- while (*str) {
- n += write(*str++);
- }
- return n;
-}
-
-/* default implementation: may be overridden */
size_t Print::write(const uint8_t *buffer, size_t size)
{
size_t n = 0;
diff --git a/cores/arduino/Print.h b/cores/arduino/Print.h
index 8530b03..1af6b72 100755
--- a/cores/arduino/Print.h
+++ b/cores/arduino/Print.h
@@ -46,7 +46,7 @@ class Print
void clearWriteError() { setWriteError(0); }
virtual size_t write(uint8_t) = 0;
- virtual size_t write(const char *str);
+ size_t write(const char *str) { return write((const uint8_t *)str, strlen(str)); }
virtual size_t write(const uint8_t *buffer, size_t size);
size_t print(const __FlashStringHelper *);
diff --git a/cores/arduino/Server.h b/cores/arduino/Server.h
index edab726..9674c76 100644
--- a/cores/arduino/Server.h
+++ b/cores/arduino/Server.h
@@ -1,7 +1,7 @@
#ifndef server_h
#define server_h
-class Server {
+class Server : public Print {
public:
virtual void begin() =0;
};
diff --git a/cores/arduino/Udp.h b/cores/arduino/Udp.h
index 1fb9cd3..dc5644b 100644
--- a/cores/arduino/Udp.h
+++ b/cores/arduino/Udp.h
@@ -57,8 +57,6 @@ public:
virtual int endPacket() =0;
// Write a single byte into the packet
virtual size_t write(uint8_t) =0;
- // Write a string of characters into the packet
- virtual size_t write(const char *str) =0;
// Write size bytes from buffer into the packet
virtual size_t write(const uint8_t *buffer, size_t size) =0;