Skip to content

Commit 2170b89

Browse files
committed
Fix some F-string support in WString
1 parent 97b47cc commit 2170b89

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

WString.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ String::String(const String &value)
3838
*this = value;
3939
}
4040

41+
String::String(const __FlashStringHelper *str)
42+
{
43+
init();
44+
const char *cstr = reinterpret_cast<const char*>(str);
45+
if (cstr) copy(cstr, strlen(cstr));
46+
}
47+
4148
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
4249
String::String(String &&rval)
4350
{

WString.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ class String
8080
// marked as invalid ("if (s)" will be false).
8181
String & operator = (const String &rhs);
8282
String & operator = (const char *cstr);
83-
String & operator = (const __FlashStringHelper *str);
83+
String & operator = (const __FlashStringHelper *str) {
84+
return operator=(reinterpret_cast<const char*>(str));
85+
}
8486
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
8587
String & operator = (String &&rval);
8688
String & operator = (StringSumHelper &&rval);

0 commit comments

Comments
 (0)