diff options
| author | David A. Mellis <d.mellis@arduino.cc> | 2010-08-28 10:23:54 +0000 | 
|---|---|---|
| committer | David A. Mellis <d.mellis@arduino.cc> | 2010-08-28 10:23:54 +0000 | 
| commit | 4bbd4f7448907ed0133ef737fc694751f9f97ea3 (patch) | |
| tree | dd2455545cc79ad5b09c598f7fdbb0d4f4e4b4b4 /cores/arduino/WString.h | |
| parent | 1362ca26c198082235f71192861656385a1eab20 (diff) | |
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.
Diffstat (limited to 'cores/arduino/WString.h')
| -rw-r--r-- | cores/arduino/WString.h | 4 | 
1 files changed, 2 insertions, 2 deletions
| 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 ); | 
