From 4bbd4f7448907ed0133ef737fc694751f9f97ea3 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Sat, 28 Aug 2010 10:23:54 +0000 Subject: Changing String::toCharArray() and getBytes() to accept a buffer, rather than return one. That way they don't expose the internal representation of the String class, allowing future optimization. Thanks to Paul Stoffregen. --- cores/arduino/WString.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cores/arduino/WString.h') diff --git a/cores/arduino/WString.h b/cores/arduino/WString.h index eede8ae..fb87c52 100644 --- a/cores/arduino/WString.h +++ b/cores/arduino/WString.h @@ -76,8 +76,8 @@ class String String toLowerCase( ) const; String toUpperCase( ) const; String trim( ) const; - const unsigned char *getBytes() const { return (unsigned char*)_buffer; } - const char* toCharArray() const { return _buffer; } + void getBytes(unsigned char *buf, unsigned int bufsize); + void toCharArray(char *buf, unsigned int bufsize); const String& concat( const String &str ); String replace( char oldChar, char newChar ); String replace( const String& match, const String& replace ); -- cgit v1.2.3-18-g5258