Skip to content

Commit 7ac9755

Browse files
committed
Making Print::write(char *) non-virtual.
http://code.google.com/p/arduino/issues/detail?id=607
1 parent ef0f8b9 commit 7ac9755

File tree

5 files changed

+2
-15
lines changed

5 files changed

+2
-15
lines changed

hardware/arduino/cores/arduino/Client.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ class Client : public Stream {
1010
virtual int connect(IPAddress ip, uint16_t port) =0;
1111
virtual int connect(const char *host, uint16_t port) =0;
1212
virtual size_t write(uint8_t) =0;
13-
virtual size_t write(const char *str) =0;
1413
virtual size_t write(const uint8_t *buf, size_t size) =0;
1514
virtual int available() = 0;
1615
virtual int read() = 0;

hardware/arduino/cores/arduino/Print.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@
2929

3030
// Public Methods //////////////////////////////////////////////////////////////
3131

32-
/* default implementation: may be overridden */
33-
size_t Print::write(const char *str)
34-
{
35-
size_t n = 0;
36-
while (*str) {
37-
n += write(*str++);
38-
}
39-
return n;
40-
}
41-
4232
/* default implementation: may be overridden */
4333
size_t Print::write(const uint8_t *buffer, size_t size)
4434
{

hardware/arduino/cores/arduino/Print.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Print
4646
void clearWriteError() { setWriteError(0); }
4747

4848
virtual size_t write(uint8_t) = 0;
49-
virtual size_t write(const char *str);
49+
size_t write(const char *str) { return write((const uint8_t *)str, strlen(str)); }
5050
virtual size_t write(const uint8_t *buffer, size_t size);
5151

5252
size_t print(const __FlashStringHelper *);

hardware/arduino/cores/arduino/Server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef server_h
22
#define server_h
33

4-
class Server {
4+
class Server : public Print {
55
public:
66
virtual void begin() =0;
77
};

hardware/arduino/cores/arduino/Udp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ class UDP : public Stream {
5757
virtual int endPacket() =0;
5858
// Write a single byte into the packet
5959
virtual size_t write(uint8_t) =0;
60-
// Write a string of characters into the packet
61-
virtual size_t write(const char *str) =0;
6260
// Write size bytes from buffer into the packet
6361
virtual size_t write(const uint8_t *buffer, size_t size) =0;
6462

0 commit comments

Comments
 (0)