Changed JsonSink to match Arduino's Print class

This commit is contained in:
Benoît Blanchon
2014-07-01 13:15:50 +02:00
parent 69d682ce81
commit a57220debc
9 changed files with 77 additions and 91 deletions

View File

@ -5,23 +5,11 @@
#include "StringBuilder.h"
void StringBuilder::append(const char* s)
size_t StringBuilder::append(char c)
{
char* tail = buffer + length;
while (*s && length<capacity)
{
buffer[length++] = *s++;
}
buffer[length] = 0;
}
void StringBuilder::append(char c)
{
if (length >= capacity) return;
if (length >= capacity) return 0;
buffer[length++] = c;
buffer[length] = 0;
return 1;
}