Skip to content

Commit eca04ba

Browse files
committed
Remove __FlashStringHelper from ESP32, it's not needed - all the files using it are different from their ESP8266 counterparts anyway.
1 parent 0d84018 commit eca04ba

File tree

5 files changed

+2
-90
lines changed

5 files changed

+2
-90
lines changed

Diff for: cores/esp32/Print.cpp

-12
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ size_t Print::printf(const char *format, ...)
7474
return len;
7575
}
7676

77-
size_t Print::print(const __FlashStringHelper *ifsh)
78-
{
79-
return print(reinterpret_cast<const char *>(ifsh));
80-
}
81-
8277
size_t Print::print(const String &s)
8378
{
8479
return write(s.c_str(), s.length());
@@ -152,13 +147,6 @@ size_t Print::print(double n, int digits)
152147
return printFloat(n, digits);
153148
}
154149

155-
size_t Print::println(const __FlashStringHelper *ifsh)
156-
{
157-
size_t n = print(ifsh);
158-
n += println();
159-
return n;
160-
}
161-
162150
size_t Print::print(const Printable& x)
163151
{
164152
return x.printTo(*this);

Diff for: cores/esp32/Print.h

-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ class Print
7878
// default to zero, meaning "a single write may block"
7979
// should be overriden by subclasses with buffering
8080
virtual int availableForWrite() { return 0; }
81-
size_t print(const __FlashStringHelper *);
8281
size_t print(const String &);
8382
size_t print(const char[]);
8483
size_t print(char);
@@ -93,7 +92,6 @@ class Print
9392
size_t print(const Printable&);
9493
size_t print(struct tm * timeinfo, const char * format = NULL);
9594

96-
size_t println(const __FlashStringHelper *);
9795
size_t println(const String &s);
9896
size_t println(const char[]);
9997
size_t println(char);

Diff for: cores/esp32/WString.cpp

-46
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ String::String(const String &value) {
4747
*this = value;
4848
}
4949

50-
String::String(const __FlashStringHelper *pstr) {
51-
init();
52-
*this = pstr; // see operator =
53-
}
54-
5550
#ifdef __GXX_EXPERIMENTAL_CXX0X__
5651
String::String(String &&rval) {
5752
init();
@@ -235,16 +230,6 @@ String & String::copy(const char *cstr, unsigned int length) {
235230
return *this;
236231
}
237232

238-
String & String::copy(const __FlashStringHelper *pstr, unsigned int length) {
239-
if (!reserve(length)) {
240-
invalidate();
241-
return *this;
242-
}
243-
memcpy_P(wbuffer(), (PGM_P)pstr, length + 1); // We know wbuffer() cannot ever be in PROGMEM, so memcpy safe here
244-
setLen(length);
245-
return *this;
246-
}
247-
248233
#ifdef __GXX_EXPERIMENTAL_CXX0X__
249234
void String::move(String &rhs) {
250235
if(buffer()) {
@@ -308,15 +293,6 @@ String & String::operator =(const char *cstr) {
308293
return *this;
309294
}
310295

311-
String & String::operator =(const __FlashStringHelper *pstr) {
312-
if(pstr)
313-
copy(pstr, strlen_P((PGM_P)pstr));
314-
else
315-
invalidate();
316-
317-
return *this;
318-
}
319-
320296
/*********************************************/
321297
/* concat */
322298
/*********************************************/
@@ -424,20 +400,6 @@ bool String::concat(double num) {
424400
return concat(string, strlen(string));
425401
}
426402

427-
bool String::concat(const __FlashStringHelper * str) {
428-
if (!str)
429-
return false;
430-
int length = strlen_P((PGM_P)str);
431-
if (length == 0)
432-
return true;
433-
unsigned int newlen = len() + length;
434-
if (!reserve(newlen))
435-
return false;
436-
memcpy_P(wbuffer() + len(), (PGM_P)str, length + 1);
437-
setLen(newlen);
438-
return true;
439-
}
440-
441403
/*********************************************/
442404
/* Concatenate */
443405
/*********************************************/
@@ -526,14 +488,6 @@ StringSumHelper & operator +(const StringSumHelper &lhs, unsigned long long num)
526488
return a;
527489
}
528490

529-
StringSumHelper & operator + (const StringSumHelper &lhs, const __FlashStringHelper *rhs)
530-
{
531-
StringSumHelper &a = const_cast<StringSumHelper&>(lhs);
532-
if (!a.concat(rhs))
533-
a.invalidate();
534-
return a;
535-
}
536-
537491
/*********************************************/
538492
/* Comparison */
539493
/*********************************************/

Diff for: cores/esp32/WString.h

+2-29
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@
3131
#include <ctype.h>
3232

3333

34-
// an abstract class used as a means to proide a unique pointer type
35-
// but really has no body
36-
class __FlashStringHelper;
37-
#define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
38-
#define F(string_literal) (FPSTR(PSTR(string_literal)))
34+
#define FPSTR(pstr_pointer) (pstr_pointer)
35+
#define F(string_literal) (string_literal)
3936

4037
// An inherited class for holding the result of a concatenation. These
4138
// result objects are assumed to be writable by subsequent concatenations.
@@ -62,7 +59,6 @@ class String {
6259
String(const uint8_t *cstr, unsigned int length) : String((const char*)cstr, length) {}
6360
#endif
6461
String(const String &str);
65-
String(const __FlashStringHelper *str);
6662
#ifdef __GXX_EXPERIMENTAL_CXX0X__
6763
String(String &&rval);
6864
String(StringSumHelper &&rval);
@@ -103,7 +99,6 @@ class String {
10399
// marked as invalid ("if (s)" will be false).
104100
String & operator =(const String &rhs);
105101
String & operator =(const char *cstr);
106-
String & operator = (const __FlashStringHelper *str);
107102
#ifdef __GXX_EXPERIMENTAL_CXX0X__
108103
String & operator =(String &&rval);
109104
String & operator =(StringSumHelper &&rval);
@@ -128,7 +123,6 @@ class String {
128123
bool concat(double num);
129124
bool concat(long long num);
130125
bool concat(unsigned long long num);
131-
bool concat(const __FlashStringHelper * str);
132126

133127
// if there's not enough memory for the concatenated value, the string
134128
// will be left unchanged (but this isn't signalled in any way)
@@ -180,10 +174,6 @@ class String {
180174
concat(num);
181175
return (*this);
182176
}
183-
String & operator += (const __FlashStringHelper *str){
184-
concat(str);
185-
return (*this);
186-
}
187177

188178
friend StringSumHelper & operator +(const StringSumHelper &lhs, const String &rhs);
189179
friend StringSumHelper & operator +(const StringSumHelper &lhs, const char *cstr);
@@ -195,7 +185,6 @@ class String {
195185
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned long num);
196186
friend StringSumHelper & operator +(const StringSumHelper &lhs, float num);
197187
friend StringSumHelper & operator +(const StringSumHelper &lhs, double num);
198-
friend StringSumHelper & operator +(const StringSumHelper &lhs, const __FlashStringHelper *rhs);
199188
friend StringSumHelper & operator +(const StringSumHelper &lhs, long long num);
200189
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned long long num);
201190

@@ -228,17 +217,11 @@ class String {
228217
bool startsWith(const char *prefix) const {
229218
return this->startsWith(String(prefix));
230219
}
231-
bool startsWith(const __FlashStringHelper *prefix) const {
232-
return this->startsWith(String(prefix));
233-
}
234220
bool startsWith(const String &prefix, unsigned int offset) const;
235221
bool endsWith(const String &suffix) const;
236222
bool endsWith(const char *suffix) const {
237223
return this->endsWith(String(suffix));
238224
}
239-
bool endsWith(const __FlashStringHelper * suffix) const {
240-
return this->endsWith(String(suffix));
241-
}
242225

243226
// character access
244227
char charAt(unsigned int index) const;
@@ -275,18 +258,9 @@ class String {
275258
void replace(const char *find, const String &replace) {
276259
this->replace(String(find), replace);
277260
}
278-
void replace(const __FlashStringHelper *find, const String &replace) {
279-
this->replace(String(find), replace);
280-
}
281261
void replace(const char *find, const char *replace) {
282262
this->replace(String(find), String(replace));
283263
}
284-
void replace(const __FlashStringHelper *find, const char *replace) {
285-
this->replace(String(find), String(replace));
286-
}
287-
void replace(const __FlashStringHelper *find, const __FlashStringHelper *replace) {
288-
this->replace(String(find), String(replace));
289-
}
290264
void remove(unsigned int index);
291265
void remove(unsigned int index, unsigned int count);
292266
void toLowerCase(void);
@@ -350,7 +324,6 @@ class String {
350324

351325
// copy and move
352326
String & copy(const char *cstr, unsigned int length);
353-
String & copy(const __FlashStringHelper *pstr, unsigned int length);
354327
#ifdef __GXX_EXPERIMENTAL_CXX0X__
355328
void move(String &rhs);
356329
#endif

Diff for: libraries/WebServer/src/Uri.h

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class Uri {
1212
public:
1313
Uri(const char *uri) : _uri(uri) {}
1414
Uri(const String &uri) : _uri(uri) {}
15-
Uri(const __FlashStringHelper *uri) : _uri(String(uri)) {}
1615
virtual ~Uri() {}
1716

1817
virtual Uri* clone() const {

0 commit comments

Comments
 (0)