diff --git a/src/_C004.ino b/src/_C004.ino index 54cbfff56..4583894f8 100644 --- a/src/_C004.ino +++ b/src/_C004.ino @@ -124,7 +124,7 @@ bool do_process_c004_delay_queue(int controller_number, const C004_queue_element String postStr = do_create_http_request( hostName, F("POST"), F("/update"), // uri - F(""), // auth_header + EMPTY_STRING, // auth_header F("Content-Type: application/x-www-form-urlencoded\r\n"), postDataStr.length()); diff --git a/src/_C007.ino b/src/_C007.ino index 3cd69456c..56a1bdab0 100644 --- a/src/_C007.ino +++ b/src/_C007.ino @@ -99,13 +99,13 @@ bool do_process_c007_delay_queue(int controller_number, const C007_queue_element url += F("&json="); for (byte i = 0; i < element.valueCount; ++i) { - url += (i == 0) ? F("{") : F(","); + url += (i == 0) ? '{' : ','; url += F("field"); url += element.idx + i; - url += ":"; + url += ':'; url += element.txt[i]; } - url += "}"; + url += '}'; url += F("&apikey="); url += getControllerPass(element.controller_idx, ControllerSettings); // "0UDNN17RW6XAS2E5" // api key diff --git a/src/_C011.ino b/src/_C011.ino index bd96c3b06..01fe19eeb 100644 --- a/src/_C011.ino +++ b/src/_C011.ino @@ -294,8 +294,8 @@ void DeleteNotNeededValues(String& s, byte numberOfValuesWanted) if (i < numberOfValuesWanted) { // yes, so just remove the tokens - s.replace(startToken, F("")); - s.replace(endToken, F("")); + s.replace(startToken, EMPTY_STRING); + s.replace(endToken, EMPTY_STRING); } else { @@ -308,7 +308,7 @@ void DeleteNotNeededValues(String& s, byte numberOfValuesWanted) String p = s.substring(startIndex, endIndex + 4); // remove the whole string including tokens - s.replace(p, F("")); + s.replace(p, EMPTY_STRING); // find next ones startIndex = s.indexOf(startToken); diff --git a/src/_C015.ino b/src/_C015.ino index abb7f85ab..f73748acc 100644 --- a/src/_C015.ino +++ b/src/_C015.ino @@ -184,7 +184,7 @@ bool CPlugin_015(CPlugin::Function function, struct EventStruct *event, String& if (!isvalid) { // send empty string to Blynk in case of error - formattedValue = F(""); + formattedValue = EMPTY_STRING; } String valueName = ExtraTaskSettings.TaskDeviceValueNames[x]; diff --git a/src/_N001_Email.ino b/src/_N001_Email.ino index bc55490f6..e14f1b568 100644 --- a/src/_N001_Email.ino +++ b/src/_N001_Email.ino @@ -119,10 +119,10 @@ boolean NPlugin_001_send(const NotificationSettingsStruct& notificationsettings, mailheader.replace(F("$emailfrom"), notificationsettings.Sender); } else { String senderName = email_address.substring(0, pos_less); - senderName.replace(F("\""), F("")); // Remove quotes + senderName.replace(F("\""), EMPTY_STRING); // Remove quotes String address = email_address.substring(pos_less + 1); - address.replace(F("<"), F("")); - address.replace(F(">"), F("")); + address.replace(F("<"), EMPTY_STRING); + address.replace(F(">"), EMPTY_STRING); address.trim(); senderName.trim(); mailheader.replace(F("$nodename"), senderName); @@ -139,7 +139,7 @@ boolean NPlugin_001_send(const NotificationSettingsStruct& notificationsettings, // Wait for Client to Start Sending // The MTA Exchange while (true) { - if (!NPlugin_001_MTA(client, F(""), F("220 "))) break; + if (!NPlugin_001_MTA(client, EMPTY_STRING, F("220 "))) break; if (!NPlugin_001_MTA(client, String(F("EHLO ")) + notificationsettings.Domain, F("250 "))) break; if (!NPlugin_001_Auth(client, notificationsettings.User, notificationsettings.Pass)) break; if (!NPlugin_001_MTA(client, String(F("MAIL FROM:<")) + notificationsettings.Sender + ">", F("250 "))) break; diff --git a/src/_P022_PCA9685.ino b/src/_P022_PCA9685.ino index e733e1e07..ca0fb1267 100644 --- a/src/_P022_PCA9685.ino +++ b/src/_P022_PCA9685.ino @@ -193,8 +193,8 @@ boolean Plugin_022(byte function, struct EventStruct *event, String& string) { LoadTaskSettings(event->TaskIndex); String name = line.substring(0, dotPos); - name.replace(F("["), F("")); - name.replace(F("]"), F("")); + name.replace(F("["), EMPTY_STRING); + name.replace(F("]"), EMPTY_STRING); if (name.equalsIgnoreCase(getTaskDeviceName(event->TaskIndex))) { line = line.substring(dotPos + 1); diff --git a/src/_P050_TCS34725.ino b/src/_P050_TCS34725.ino index 9b0523f7e..d913a4736 100644 --- a/src/_P050_TCS34725.ino +++ b/src/_P050_TCS34725.ino @@ -417,7 +417,7 @@ boolean Plugin_050(byte function, struct EventStruct *event, String& string) RuleEvent += String((float)b / t * sRGBFactor, 4); break; default: - RuleEvent = F(""); + RuleEvent = EMPTY_STRING; break; } if (RuleEvent.length() != 0) { @@ -453,7 +453,7 @@ boolean Plugin_050(byte function, struct EventStruct *event, String& string) RuleEvent += c; break; default: - RuleEvent = F(""); + RuleEvent = EMPTY_STRING; break; } if (RuleEvent.length() != 0) { diff --git a/src/_P062_MPR121_KeyPad.ino b/src/_P062_MPR121_KeyPad.ino index 19366c496..bdc24147f 100644 --- a/src/_P062_MPR121_KeyPad.ino +++ b/src/_P062_MPR121_KeyPad.ino @@ -120,8 +120,8 @@ boolean Plugin_062(byte function, struct EventStruct *event, String& string) } P062_data->loadTouchObjects(event->TaskIndex); - addRowLabel(F("Object"), F("")); - html_table(F(""), false); // Sub-table + addRowLabel(F("Object")); + html_table(EMPTY_STRING, false); // Sub-table html_table_header(F(" # ")); html_table_header(F("Touch (0..255)")); html_table_header(F("Release (0..255)")); diff --git a/src/_P073_7DGT.ino b/src/_P073_7DGT.ino index 241399fa0..37c6c7065 100644 --- a/src/_P073_7DGT.ino +++ b/src/_P073_7DGT.ino @@ -94,7 +94,7 @@ struct P073_data_struct : public PluginTaskData_base { #endif // P073_7DBIN_COMMAND #ifdef P073_SCROLL_TEXT , txtScrolling(false), scrollCount(0), scrollPos(0), scrollFull(false) - , _scrollSpeed(0), _textToScroll(F("")) + , _scrollSpeed(0) #endif // P073_SCROLL_TEXT { ClearBuffer(); @@ -353,7 +353,7 @@ struct P073_data_struct : public PluginTaskData_base { } void setTextToScroll(const String& text) { - _textToScroll = F(""); + _textToScroll = EMPTY_STRING; if (text.length() > 0) { int bufToFill = getBufferLength(displayModel); _textToScroll.reserve(text.length() + bufToFill + (scrollFull ? bufToFill : 0)); @@ -1473,7 +1473,7 @@ bool p073_plugin_write_7dbin(struct EventStruct *event, const String& text) { #endif // P073_SCROLL_TEXT if (data.length() > 0) { #ifdef P073_SCROLL_TEXT - P073_data->setTextToScroll(F("")); // Clear any scrolling text + P073_data->setTextToScroll(EMPTY_STRING); // Clear any scrolling text if (P073_data->txtScrolling && data.length() > bufLen) { P073_data->setBinaryData(data); } else diff --git a/src/_P079_Wemos_Motorshield.ino b/src/_P079_Wemos_Motorshield.ino index c4e4a7ded..157b99af5 100644 --- a/src/_P079_Wemos_Motorshield.ino +++ b/src/_P079_Wemos_Motorshield.ino @@ -178,7 +178,7 @@ boolean Plugin_079(byte function, struct EventStruct *event, String& string) } - if (getTaskDeviceName(event->TaskIndex) == F("")) { // Check to see if user entered device name. + if (getTaskDeviceName(event->TaskIndex).length() == 0) { // Check to see if user entered device name. switch (Plugin_079_MotorShield_type) { case P079_BoardType::WemosMotorshield: safe_strncpy(ExtraTaskSettings.TaskDeviceName, F(PLUGIN_DEF_NAME1_079), sizeof(ExtraTaskSettings.TaskDeviceName)); // Name missing, populate default name. diff --git a/src/_P081_Cron.ino b/src/_P081_Cron.ino index c873a358f..e8a2062e9 100644 --- a/src/_P081_Cron.ino +++ b/src/_P081_Cron.ino @@ -225,7 +225,7 @@ boolean Plugin_081(byte function, struct EventStruct *event, String& string) log = SaveCustomTaskSettings(event->TaskIndex, (byte *)&expression_c, PLUGIN_081_EXPRESSION_SIZE); } - if (log != F("")) + if (log.length() > 0) { addLog(LOG_LEVEL_ERROR, String(PSTR(PLUGIN_NAME_081)) + F(": Saving ") + log); } diff --git a/src/_P087_SerialProxy.ino b/src/_P087_SerialProxy.ino index 4562af89d..016d94f1d 100644 --- a/src/_P087_SerialProxy.ino +++ b/src/_P087_SerialProxy.ino @@ -331,17 +331,17 @@ void P087_html_show_matchForms(struct EventStruct *event) { case 1: { // Comparator - String options[2]; + const __FlashStringHelper * options[2]; options[P087_Filter_Comp::Equal] = F("=="); options[P087_Filter_Comp::NotEqual] = F("!="); int optionValues[2] = { P087_Filter_Comp::Equal, P087_Filter_Comp::NotEqual }; - addSelector(id, 2, options, optionValues, NULL, comparator, false, F("")); + addSelector(id, 2, options, optionValues, NULL, comparator, false, EMPTY_STRING); break; } case 2: { // Compare with - addTextBox(id, filter, 32, false, false, F(""), F("")); + addTextBox(id, filter, 32, false, false, EMPTY_STRING, EMPTY_STRING); break; } } diff --git a/src/_P093_MitsubishiHP.ino b/src/_P093_MitsubishiHP.ino index 5af80c7f8..268b2677e 100644 --- a/src/_P093_MitsubishiHP.ino +++ b/src/_P093_MitsubishiHP.ino @@ -655,7 +655,7 @@ private: static void dumpPacket(const uint8_t* packet, size_t length, String& result) { for (size_t idx = 0; idx < length; ++idx) { - result += formatToHex(packet[idx], F("")); + result += formatToHex(packet[idx], EMPTY_STRING); result += ' '; } } diff --git a/src/_P094_CULReader.ino b/src/_P094_CULReader.ino index 13e384e9d..e3b9ebfb4 100644 --- a/src/_P094_CULReader.ino +++ b/src/_P094_CULReader.ino @@ -405,7 +405,7 @@ void P094_html_show_matchForms(struct EventStruct *event) { options[i] = P094_data_struct::P094_FilterValueType_toString(filterValueType); optionValues[i] = filterValueType; } - addSelector(id, P094_FILTER_VALUE_Type_NR_ELEMENTS, options, optionValues, NULL, capture, false, true, F("")); + addSelector(id, P094_FILTER_VALUE_Type_NR_ELEMENTS, options, optionValues, NULL, capture, false, true, EMPTY_STRING); } break; @@ -427,13 +427,13 @@ void P094_html_show_matchForms(struct EventStruct *event) { options[i] = P094_data_struct::P094_FilterComp_toString(enumValue); optionValues[i] = enumValue; } - addSelector(id, P094_FILTER_COMP_NR_ELEMENTS, options, optionValues, NULL, comparator, false, true, F("")); + addSelector(id, P094_FILTER_COMP_NR_ELEMENTS, options, optionValues, NULL, comparator, false, true, EMPTY_STRING); break; } case 3: { // Compare with - addTextBox(id, filter, 8, false, false, F(""), F("")); + addTextBox(id, filter, 8, false, false, EMPTY_STRING, EMPTY_STRING); break; } } diff --git a/src/_P095_ILI9341.ino b/src/_P095_ILI9341.ino index e682e0546..bf6a4b359 100644 --- a/src/_P095_ILI9341.ino +++ b/src/_P095_ILI9341.ino @@ -276,8 +276,8 @@ boolean Plugin_095(byte function, struct EventStruct *event, String& string) String tmpString = String(string); String arguments = String(string); - String command = F(""); - String subcommand = F(""); + String command; + String subcommand; int argIndex = arguments.indexOf(','); if (argIndex) diff --git a/src/_P096_eInk.ino b/src/_P096_eInk.ino index 7210164fc..bb55c2f9d 100644 --- a/src/_P096_eInk.ino +++ b/src/_P096_eInk.ino @@ -300,8 +300,8 @@ boolean Plugin_096(byte function, struct EventStruct *event, String& string) #endif String arguments = String(string); - String command = F(""); - String subcommand = F(""); + String command; + String subcommand; int argIndex = arguments.indexOf(','); if (argIndex) diff --git a/src/_P099_XPT2046Touch.ino b/src/_P099_XPT2046Touch.ino index a78d5bb3f..5bfb8850e 100644 --- a/src/_P099_XPT2046Touch.ino +++ b/src/_P099_XPT2046Touch.ino @@ -211,8 +211,8 @@ boolean Plugin_099(byte function, struct EventStruct *event, String& string) } if (tbUseCalibration) { - addRowLabel(F("Calibration"), F("")); - html_table(F(""), false); // Sub-table + addRowLabel(F("Calibration")); + html_table(EMPTY_STRING, false); // Sub-table html_table_header(F("")); html_table_header(F("x")); html_table_header(F("y")); @@ -256,8 +256,8 @@ boolean Plugin_099(byte function, struct EventStruct *event, String& string) } if (P099_CONFIG_OBJECTCOUNT > -1) { - addRowLabel(F("Object"), F("")); - html_table(F(""), false); // Sub-table + addRowLabel(F("Object")); + html_table(EMPTY_STRING, false); // Sub-table html_table_header(F(" # ")); html_table_header(F("Objectname")); html_table_header(F("Top-left x")); @@ -275,7 +275,7 @@ boolean Plugin_099(byte function, struct EventStruct *event, String& string) addTextBox(getPluginCustomArgName(objectNr), String(P099_data->StoredSettings.TouchObjects[objectNr].objectname), P099_MaxObjectNameLength - 1, - false, false, F(""), F("")); + false, false, EMPTY_STRING, EMPTY_STRING); html_TD(); addNumericBox(getPluginCustomArgName(objectNr + 100), P099_data->StoredSettings.TouchObjects[objectNr].top_left.x, 0, 65535); html_TD(); @@ -420,9 +420,9 @@ boolean Plugin_099(byte function, struct EventStruct *event, String& string) case PLUGIN_WRITE: { - String command = F(""); - String subcommand = F(""); - String arguments = F(""); + String command; + String subcommand; + String arguments; arguments.reserve(24); int argIndex = string.indexOf(','); diff --git a/src/_P112_AS7265x.ino b/src/_P112_AS7265x.ino index 82f666b28..9de8926aa 100644 --- a/src/_P112_AS7265x.ino +++ b/src/_P112_AS7265x.ino @@ -146,7 +146,7 @@ boolean Plugin_112(byte function, struct EventStruct *event, String& string) optionValuesMode3[1] = AS7265X_INDICATOR_CURRENT_LIMIT_2MA; optionValuesMode3[2] = AS7265X_INDICATOR_CURRENT_LIMIT_4MA; optionValuesMode3[3] = AS7265X_INDICATOR_CURRENT_LIMIT_8MA; - addFormSelector(F(""), F("p112_BlueStatusLEDCurrentLimit"), 4, optionsMode3, optionValuesMode3, choiceMode3); + addFormSelector(EMPTY_STRING, F("p112_BlueStatusLEDCurrentLimit"), 4, optionsMode3, optionValuesMode3, choiceMode3); } addHtml(F(" Current Limit")); addFormNote(F("Activate Status LEDs only for debugging purpose.")); diff --git a/src/_Plugin_Helper.cpp b/src/_Plugin_Helper.cpp index f6cb8dace..abfbf43a1 100644 --- a/src/_Plugin_Helper.cpp +++ b/src/_Plugin_Helper.cpp @@ -96,7 +96,7 @@ void pluginWebformShowValue(taskIndex_t taskIndex, byte varNr, const String& lab } void pluginWebformShowValue(const String& valName, const String& value, bool addBR) { - pluginWebformShowValue(valName, F(""), value, F(""), addBR); + pluginWebformShowValue(valName, EMPTY_STRING, value, EMPTY_STRING, addBR); } void pluginWebformShowValue(const String& valName, const String& valName_id, const String& value, const String& value_id, bool addBR) { diff --git a/src/src/DataStructs/Web_StreamingBuffer.cpp b/src/src/DataStructs/Web_StreamingBuffer.cpp index cc0a469d4..dadaaec3e 100644 --- a/src/src/DataStructs/Web_StreamingBuffer.cpp +++ b/src/src/DataStructs/Web_StreamingBuffer.cpp @@ -122,7 +122,7 @@ void Web_StreamingBuffer::checkFull(void) { } void Web_StreamingBuffer::startStream() { - startStream(false, F("")); + startStream(false, EMPTY_STRING); } void Web_StreamingBuffer::startStream(const String& origin) { @@ -261,7 +261,7 @@ void Web_StreamingBuffer::sendHeaderBlocking(bool json, const String& origin) { if (json) { web_server.sendHeader(F("Access-Control-Allow-Origin"), "*"); } - web_server.send(200, json ? F("application/json") : F("text/html"), F("")); + web_server.send(200, json ? F("application/json") : F("text/html"), EMPTY_STRING); #else // if defined(ESP8266) && defined(ARDUINO_ESP8266_RELEASE_2_3_0) unsigned int timeout = 0; const uint32_t freeBeforeSend = ESP.getFreeHeap(); @@ -276,7 +276,7 @@ void Web_StreamingBuffer::sendHeaderBlocking(bool json, const String& origin) { if (origin.length() > 0) { web_server.sendHeader(F("Access-Control-Allow-Origin"), origin); } - web_server.send(200, json ? F("application/json") : F("text/html"), F("")); + web_server.send(200, json ? F("application/json") : F("text/html"), EMPTY_STRING); // dont wait on 2.3.0. Memory returns just too slow. while ((ESP.getFreeHeap() < freeBeforeSend) && diff --git a/src/src/ESPEasyCore/ESPEasyRules.cpp b/src/src/ESPEasyCore/ESPEasyRules.cpp index d3dbac239..eb0c1f05e 100644 --- a/src/src/ESPEasyCore/ESPEasyRules.cpp +++ b/src/src/ESPEasyCore/ESPEasyRules.cpp @@ -171,7 +171,7 @@ void rulesProcessing(const String& event) { \*********************************************************************************************/ String rulesProcessingFile(const String& fileName, const String& event) { if (!Settings.UseRules || !fileExists(fileName)) { - return F(""); + return EMPTY_STRING; } #ifndef BUILD_NO_RAM_TRACKER checkRAM(F("rulesProcessingFile")); @@ -192,7 +192,7 @@ String rulesProcessingFile(const String& fileName, const String& event) { if (nestingLevel > RULES_MAX_NESTING_LEVEL) { addLog(LOG_LEVEL_ERROR, F("EVENT: Error: Nesting level exceeded!")); nestingLevel--; - return F(""); + return EMPTY_STRING; } fs::File f = tryOpenFile(fileName, "r+"); @@ -252,7 +252,7 @@ String rulesProcessingFile(const String& fileName, const String& event) { } // Prepare for new line - line = F(""); + line = EMPTY_STRING; line.reserve(longestLineSize); firstNonSpaceRead = false; commentFound = false; @@ -302,7 +302,7 @@ String rulesProcessingFile(const String& fileName, const String& event) { #ifndef BUILD_NO_RAM_TRACKER checkRAM(F("rulesProcessingFile2")); #endif // ifndef BUILD_NO_RAM_TRACKER - return F(""); + return EMPTY_STRING; } /********************************************************************************************\ @@ -737,7 +737,7 @@ void parseCompleteNonCommentLine(String& line, const String& event, String eventTrigger; - action = F(""); + action = EMPTY_STRING; if (!codeBlock) // do not check "on" rules if a block of actions is to be // processed @@ -948,8 +948,8 @@ bool ruleMatch(const String& event, const String& rule) { tmpRule.trim(); // Ignore escape char - tmpRule.replace(F("["), F("")); - tmpRule.replace(F("]"), F("")); + tmpRule.replace(F("["), EMPTY_STRING); + tmpRule.replace(F("]"), EMPTY_STRING); if (tmpEvent.equalsIgnoreCase(tmpRule)) { return true; diff --git a/src/src/Globals/Plugins.cpp b/src/src/Globals/Plugins.cpp index 01917daa2..1a45f51b0 100644 --- a/src/src/Globals/Plugins.cpp +++ b/src/src/Globals/Plugins.cpp @@ -412,8 +412,8 @@ bool PluginCall(byte Function, struct EventStruct *event, String& str) dotPos = arg0.indexOf('.'); if (dotPos > -1) { String thisTaskName = command.substring(0, dotPos); // Extract taskname prefix - thisTaskName.replace(F("["), F("")); // Remove the optional square brackets - thisTaskName.replace(F("]"), F("")); + thisTaskName.replace(F("["), EMPTY_STRING); // Remove the optional square brackets + thisTaskName.replace(F("]"), EMPTY_STRING); if (thisTaskName.length() > 0) { // Second precondition taskIndex_t thisTask = findTaskIndexByName(thisTaskName); if (!validTaskIndex(thisTask)) { // Taskname not found or invalid, check for a task number? diff --git a/src/src/Helpers/Dallas1WireHelper.cpp b/src/src/Helpers/Dallas1WireHelper.cpp index b4d033900..c3080e777 100644 --- a/src/src/Helpers/Dallas1WireHelper.cpp +++ b/src/src/Helpers/Dallas1WireHelper.cpp @@ -154,7 +154,7 @@ void Dallas_addr_selector_webform_load(taskIndex_t TaskIndex, int8_t gpio_pin_rx } addRowLabel(rowLabel); addSelector_Head(id); - addSelector_Item(F("- None -"), -1, false, false, F("")); // Empty choice + addSelector_Item(F("- None -"), -1, false, false, EMPTY_STRING); // Empty choice uint8_t tmpAddress[8]; // get currently saved address @@ -171,7 +171,7 @@ void Dallas_addr_selector_webform_load(taskIndex_t TaskIndex, int8_t gpio_pin_rx } bool selected = (memcmp(tmpAddress, savedAddress, 8) == 0) ? true : false; - addSelector_Item(option, index, selected, false, F("")); + addSelector_Item(option, index, selected, false, EMPTY_STRING); } addSelector_Foot(); } diff --git a/src/src/Helpers/Networking.cpp b/src/src/Helpers/Networking.cpp index 92a716a57..41601ad78 100644 --- a/src/src/Helpers/Networking.cpp +++ b/src/src/Helpers/Networking.cpp @@ -350,7 +350,7 @@ String formatUnitToIPAddress(byte unit, byte formatCode) { switch (formatCode) { case 1: // Return empty string { - return F(""); + return EMPTY_STRING; } case 2: // Return "0" { @@ -1166,7 +1166,7 @@ String splitURL(const String& fullURL, String& host, uint16_t& port, String& fil bool downloadFile(const String& url, String file_save) { String error; - return downloadFile(url, file_save, F(""), F(""), error); + return downloadFile(url, file_save, EMPTY_STRING, EMPTY_STRING, error); } bool downloadFile(const String& url, String file_save, const String& user, const String& pass, String& error) { diff --git a/src/src/Helpers/StringConverter.cpp b/src/src/Helpers/StringConverter.cpp index 437cac41e..38e1497ec 100644 --- a/src/src/Helpers/StringConverter.cpp +++ b/src/src/Helpers/StringConverter.cpp @@ -167,7 +167,7 @@ String formatToHex(unsigned long value) { String formatHumanReadable(unsigned long value, unsigned long factor) { String result = formatHumanReadable(value, factor, 2); - result.replace(F(".00"), F("")); + result.replace(F(".00"), EMPTY_STRING); return result; } @@ -216,7 +216,7 @@ String formatToHex_decimal(unsigned long value, unsigned long factor) { return result; } -String boolToString(bool value) { +const __FlashStringHelper * boolToString(bool value) { return value ? F("true") : F("false"); } @@ -224,7 +224,7 @@ String boolToString(bool value) { Typical string replace functions. \*********************************************************************************************/ void removeExtraNewLine(String& line) { - while (line.endsWith("\r\n\r\n")) { + while (line.endsWith(F("\r\n\r\n"))) { line.remove(line.length() - 2); } } @@ -237,7 +237,7 @@ void addNewLine(String& line) { Format a value to the set number of decimals \*********************************************************************************************/ String doFormatUserVar(struct EventStruct *event, byte rel_index, bool mustCheck, bool& isvalid) { - if (event == nullptr) return F(""); + if (event == nullptr) return EMPTY_STRING; isvalid = true; const deviceIndex_t DeviceIndex = getDeviceIndex_from_TaskIndex(event->TaskIndex); @@ -278,7 +278,7 @@ String doFormatUserVar(struct EventStruct *event, byte rel_index, bool mustCheck addLog(LOG_LEVEL_ERROR, log); } #endif // ifndef BUILD_NO_DEBUG - return F(""); + return EMPTY_STRING; } switch (sensorType) { @@ -522,7 +522,7 @@ String parseStringKeepCase(const String& string, byte indexFind, char separator) String result; if (!GetArgv(string.c_str(), result, indexFind, separator)) { - return F(""); + return EMPTY_STRING; } result.trim(); return stripQuotes(result); @@ -558,7 +558,7 @@ String parseStringToEndKeepCase(const String& string, byte indexFind, char separ } if (!hasArgument || (pos_begin < 0)) { - return F(""); + return EMPTY_STRING; } String result = string.substring(pos_begin, pos_end); @@ -575,7 +575,7 @@ String tolerantParseStringKeepCase(const String& string, byte indexFind, char se } // escapes special characters in strings for use in html-forms -bool htmlEscapeChar(char c, String& escaped) +bool htmlEscapeChar(char c, const __FlashStringHelper * escaped) { switch (c) { @@ -591,10 +591,10 @@ bool htmlEscapeChar(char c, String& escaped) void htmlEscape(String& html, char c) { - String repl; + const __FlashStringHelper * repl = F(""); if (htmlEscapeChar(c, repl)) { - html.replace(String(c), repl); + html.replace(String(c), String(repl)); } } @@ -784,7 +784,7 @@ void parseSingleControllerVariable(String & s, LoadTaskSettings(event->TaskIndex); repl(F("%valname%"), ExtraTaskSettings.TaskDeviceValueNames[taskValueIndex], s, useURLencode); } else { - repl(F("%valname%"), F(""), s, useURLencode); + repl(F("%valname%"), EMPTY_STRING, s, useURLencode); } } @@ -825,7 +825,7 @@ void parseEventVariables(String& s, struct EventStruct *event, bool useURLencode LoadTaskSettings(event->TaskIndex); repl(F("%tskname%"), ExtraTaskSettings.TaskDeviceName, s, useURLencode); } else { - repl(F("%tskname%"), F(""), s, useURLencode); + repl(F("%tskname%"), EMPTY_STRING, s, useURLencode); } const bool vname_found = s.indexOf(F("%vname")) != -1; @@ -839,7 +839,7 @@ void parseEventVariables(String& s, struct EventStruct *event, bool useURLencode if (validTaskIndex(event->TaskIndex)) { repl(vname, ExtraTaskSettings.TaskDeviceValueNames[i], s, useURLencode); } else { - repl(vname, F(""), s, useURLencode); + repl(vname, EMPTY_STRING, s, useURLencode); } } } @@ -950,7 +950,7 @@ void parseStandardConversions(String& s, bool useURLencode) { SMART_CONV(F("%c_m2dh%"), minutesToDayHour(data.arg1)) SMART_CONV(F("%c_m2dhm%"), minutesToDayHourMinute(data.arg1)) SMART_CONV(F("%c_s2dhms%"), secondsToDayHourMinuteSecond(data.arg1)) - SMART_CONV(F("%c_2hex%"), formatToHex(data.arg1, F(""))) + SMART_CONV(F("%c_2hex%"), formatToHex(data.arg1, EMPTY_STRING)) #undef SMART_CONV // Conversions with 2 parameters diff --git a/src/src/Helpers/StringConverter.h b/src/src/Helpers/StringConverter.h index 6393d44a4..d4d69cc62 100644 --- a/src/src/Helpers/StringConverter.h +++ b/src/src/Helpers/StringConverter.h @@ -78,7 +78,7 @@ String formatToHex_decimal(unsigned long value); String formatToHex_decimal(unsigned long value, unsigned long factor); -String boolToString(bool value); +const __FlashStringHelper * boolToString(bool value); /*********************************************************************************************\ Typical string replace functions. @@ -190,7 +190,7 @@ String tolerantParseStringKeepCase(const String& string, // escapes special characters in strings for use in html-forms bool htmlEscapeChar(char c, - String& escaped); + const __FlashStringHelper * escaped); void htmlEscape(String& html, char c); diff --git a/src/src/Helpers/StringProvider.h b/src/src/Helpers/StringProvider.h index 5f51f0140..f2edfb598 100644 --- a/src/src/Helpers/StringProvider.h +++ b/src/src/Helpers/StringProvider.h @@ -3,6 +3,9 @@ #include "../../ESPEasy_common.h" + + + struct LabelType; // enum LabelType::Enum : short; diff --git a/src/src/Helpers/_CPlugin_DomoticzHelper.cpp b/src/src/Helpers/_CPlugin_DomoticzHelper.cpp index e6894abc1..075a417f8 100644 --- a/src/src/Helpers/_CPlugin_DomoticzHelper.cpp +++ b/src/src/Helpers/_CPlugin_DomoticzHelper.cpp @@ -254,7 +254,7 @@ String serializeDomoticzJson(struct EventStruct *event) json += to_json_object_value(F("RSSI"), String(mapRSSItoDomoticz())); # if FEATURE_ADC_VCC json += ','; - json += to_json_object_value(F("Battery"), mapVccToDomoticz()); + json += to_json_object_value(F("Battery"), String(mapVccToDomoticz())); # endif // if FEATURE_ADC_VCC const Sensor_VType sensorType = event->getSensorType(); diff --git a/src/src/Helpers/_CPlugin_Helper.cpp b/src/src/Helpers/_CPlugin_Helper.cpp index b3b2e5294..b0872e08a 100644 --- a/src/src/Helpers/_CPlugin_Helper.cpp +++ b/src/src/Helpers/_CPlugin_Helper.cpp @@ -197,8 +197,8 @@ String do_create_http_request( const String& hostportString, const String& method, const String& uri) { return do_create_http_request(hostportString, method, uri, - F(""), // auth_header - F(""), // additional_options + EMPTY_STRING, // auth_header + EMPTY_STRING, // additional_options -1 // content_length ); } @@ -213,8 +213,8 @@ String do_create_http_request( defaultport ? ControllerSettings.getHost() : ControllerSettings.getHostPortString(), method, uri, - F(""), // auth_header - F(""), // additional_options + EMPTY_STRING, // auth_header + EMPTY_STRING, // additional_options content_length); } @@ -229,7 +229,7 @@ String create_http_request_auth( method, uri, get_auth_header(controller_index, ControllerSettings), - F(""), // additional_options + EMPTY_STRING, // additional_options content_length); } diff --git a/src/src/Helpers/_CPlugin_Helper_webform.cpp b/src/src/Helpers/_CPlugin_Helper_webform.cpp index acc9da5db..d6d963bc4 100644 --- a/src/src/Helpers/_CPlugin_Helper_webform.cpp +++ b/src/src/Helpers/_CPlugin_Helper_webform.cpp @@ -83,7 +83,7 @@ String getControllerParameterName(protocolIndex_t ProtocolInde if (!displayName) { // Change name to lower case and remove spaces to make it an internal name. name.toLowerCase(); - name.replace(F(" "), F("")); + name.replace(F(" "), EMPTY_STRING); } return name; } diff --git a/src/src/Helpers/_Plugin_Helper_serial.cpp b/src/src/Helpers/_Plugin_Helper_serial.cpp index 5e0d97879..951be2e89 100644 --- a/src/src/Helpers/_Plugin_Helper_serial.cpp +++ b/src/src/Helpers/_Plugin_Helper_serial.cpp @@ -113,7 +113,7 @@ void serialHelper_addI2CuartSelectors(int address, int channel) { { String id = F("i2cuart_addr"); addRowLabel_tr_id(F("I2C Address"), id); - do_addSelector_Head(id, F(""), F(""), false); + do_addSelector_Head(id, EMPTY_STRING, EMPTY_STRING, false); if ((address < SC16IS752_I2C_BASE_ADDR) || (address >= (SC16IS752_I2C_BASE_ADDR + SC16IS752_I2C_ADDRESSES))) { // selected address is not in range @@ -129,7 +129,7 @@ void serialHelper_addI2CuartSelectors(int address, int channel) { option += F(" (datasheet: "); option += formatToHex(addr * 2); option += ')'; - addSelector_Item(option, addr, addr == address, false, F("")); + addSelector_Item(option, addr, addr == address, false, EMPTY_STRING); } addSelector_Foot(); } @@ -307,7 +307,7 @@ void serialHelper_serialconfig_webformLoad(struct EventStruct *event, byte curre String id = F("serConf"); addRowLabel_tr_id(F("Serial Config"), id); - do_addSelector_Head(id, F(""), F(""), false); + do_addSelector_Head(id, EMPTY_STRING, EMPTY_STRING, false); if (currentSelection == 0) { // Must truncate it to 1 byte, since ESP32 uses a 32-bit value. We add these high bits later for ESP32. @@ -336,7 +336,7 @@ void serialHelper_serialconfig_webformLoad(struct EventStruct *event, byte curre case 1: value += 0x10; break; case 2: value += 0x30; break; } - addSelector_Item(label, value, value == currentSelection, false, F("")); + addSelector_Item(label, value, value == currentSelection, false, EMPTY_STRING); } } } diff --git a/src/src/PluginStructs/P094_data_struct.cpp b/src/src/PluginStructs/P094_data_struct.cpp index 3f0aa8926..c37378104 100644 --- a/src/src/PluginStructs/P094_data_struct.cpp +++ b/src/src/PluginStructs/P094_data_struct.cpp @@ -3,10 +3,9 @@ // Needed also here for PlatformIO's library finder as the .h file // is in a directory which is excluded in the src_filter #include -#include - #ifdef USES_P094 +#include #include "../Globals/ESPEasy_time.h" #include "../Helpers/StringConverter.h" diff --git a/src/src/WebServer/ControllerPage.cpp b/src/src/WebServer/ControllerPage.cpp index 85992e189..f8adadb8a 100644 --- a/src/src/WebServer/ControllerPage.cpp +++ b/src/src/WebServer/ControllerPage.cpp @@ -191,8 +191,8 @@ void handle_controllers_ShowAllControllersTable() { html_table_class_multirow(); html_TR(); - html_table_header(F(""), 70); - html_table_header(F("Nr"), 50); + html_table_header(F(""), 70); + html_table_header(F("Nr"), 50); html_table_header(F("Enabled"), 100); html_table_header(F("Protocol")); html_table_header(F("Host")); @@ -277,7 +277,7 @@ void handle_controllers_ControllerSettingsPage(controllerIndex_t controllerindex addRowLabel(F("Protocol")); byte choice = Settings.Protocol[controllerindex]; addSelector_Head_reloadOnChange(F("protocol")); - addSelector_Item(F("- Standalone -"), 0, false, false, F("")); + addSelector_Item(F("- Standalone -"), 0, false, false, EMPTY_STRING); for (byte x = 0; x <= protocolCount; x++) { diff --git a/src/src/WebServer/CustomPage.cpp b/src/src/WebServer/CustomPage.cpp index 9e111cd62..e0173533c 100644 --- a/src/src/WebServer/CustomPage.cpp +++ b/src/src/WebServer/CustomPage.cpp @@ -97,7 +97,7 @@ boolean handle_custom(String path) { else { name += Settings.Name; } - addSelector_Item(name, it->first, choice == it->first, false, F("")); + addSelector_Item(name, it->first, choice == it->first, false, EMPTY_STRING); } } addSelector_Foot(); diff --git a/src/src/WebServer/DevicesPage.cpp b/src/src/WebServer/DevicesPage.cpp index c56dcf6fb..1aec95853 100644 --- a/src/src/WebServer/DevicesPage.cpp +++ b/src/src/WebServer/DevicesPage.cpp @@ -199,7 +199,7 @@ void addDeviceSelect(const String& name, int choice) String deviceName; addSelector_Head_reloadOnChange(name); - addSelector_Item(F("- None -"), 0, false, false, F("")); + addSelector_Item(F("- None -"), 0, false, false, EMPTY_STRING); for (byte x = 0; x <= deviceCount; x++) { @@ -1104,8 +1104,8 @@ void devicePage_show_I2C_config(taskIndex_t taskIndex) } if (multipleMuxPorts) { - addRowLabel(F("Select connections"), F("")); - html_table(F(""), false); // Sub-table + addRowLabel(F("Select connections"), EMPTY_STRING); + html_table(EMPTY_STRING, false); // Sub-table html_table_header(F("Channel")); html_table_header(F("Enable")); html_table_header(F("Channel")); diff --git a/src/src/WebServer/HTML_wrappers.cpp b/src/src/WebServer/HTML_wrappers.cpp index 133d279bf..352240d13 100644 --- a/src/src/WebServer/HTML_wrappers.cpp +++ b/src/src/WebServer/HTML_wrappers.cpp @@ -153,7 +153,7 @@ void html_table_header(const __FlashStringHelper * label, int width) { } void html_table_header(const String& label, int width) { - html_table_header(label, F(""), F(""), width); + html_table_header(label, EMPTY_STRING, EMPTY_STRING, width); } void html_table_header(const __FlashStringHelper * label, const __FlashStringHelper * helpButton, int width) { @@ -161,15 +161,15 @@ void html_table_header(const __FlashStringHelper * label, const __FlashStringHel } void html_table_header(const String& label, const __FlashStringHelper * helpButton, int width) { - html_table_header(label, helpButton, F(""), width); + html_table_header(label, helpButton, EMPTY_STRING, width); } void html_table_header(const __FlashStringHelper * label, const String& helpButton, int width) { - html_table_header(label, helpButton, F(""), width); + html_table_header(label, helpButton, EMPTY_STRING, width); } void html_table_header(const String& label, const String& helpButton, int width) { - html_table_header(label, helpButton, F(""), width); + html_table_header(label, helpButton, EMPTY_STRING, width); } void html_table_header(const __FlashStringHelper * label, const __FlashStringHelper * helpButton, const String& rtdHelpButton, int width) { @@ -226,7 +226,7 @@ void html_end_form() { } void html_add_button_prefix() { - html_add_button_prefix(F(""), true); + html_add_button_prefix(EMPTY_STRING, true); } void html_add_button_prefix(const String& classes, bool enabled) { @@ -249,7 +249,7 @@ void html_add_button_prefix(const String& classes, bool enabled) { } void html_add_wide_button_prefix() { - html_add_wide_button_prefix(F(""), true); + html_add_wide_button_prefix(EMPTY_STRING, true); } void html_add_wide_button_prefix(const String& classes, bool enabled) { @@ -397,11 +397,11 @@ void addHtmlLink(const String& htmlclass, const String& url, const String& label } void addHtmlDiv(const String& htmlclass) { - addHtmlDiv(htmlclass, F("")); + addHtmlDiv(htmlclass, EMPTY_STRING); } void addHtmlDiv(const String& htmlclass, const String& content) { - addHtmlDiv(htmlclass, content, F("")); + addHtmlDiv(htmlclass, content, EMPTY_STRING); } void addHtmlDiv(const String& htmlclass, const String& content, const String& id) { diff --git a/src/src/WebServer/Log.cpp b/src/src/WebServer/Log.cpp index 7820fb5d0..748cfe8fb 100644 --- a/src/src/WebServer/Log.cpp +++ b/src/src/WebServer/Log.cpp @@ -27,7 +27,7 @@ void handle_log() { #ifdef WEBSERVER_LOG addHtml(F("Log")); - addCopyButton(F("copyText"), F(""), F("Copy log to clipboard")); + addCopyButton(F("copyText"), EMPTY_STRING, F("Copy log to clipboard")); addHtml(F("
Logging:
")); addHtml(F("Autoscroll: ")); addCheckBox(F("autoscroll"), true); diff --git a/src/src/WebServer/Markup.cpp b/src/src/WebServer/Markup.cpp index a084f9b80..dbae3c55c 100644 --- a/src/src/WebServer/Markup.cpp +++ b/src/src/WebServer/Markup.cpp @@ -72,7 +72,7 @@ void addSelector(const String& id, { addSelector_Head_reloadOnChange(id, classname, !enabled); } else { - do_addSelector_Head(id, classname, F(""), !enabled); + do_addSelector_Head(id, classname, EMPTY_STRING, !enabled); } addSelector_options(optionCount, options, indices, attr, selectedIndex); addSelector_Foot(); @@ -93,7 +93,7 @@ void addSelector(const String& id, { addSelector_Head_reloadOnChange(id, classname, !enabled); } else { - do_addSelector_Head(id, classname, F(""), !enabled); + do_addSelector_Head(id, classname, EMPTY_STRING, !enabled); } addSelector_options(optionCount, options, indices, attr, selectedIndex); addSelector_Foot(); @@ -144,7 +144,7 @@ void addSelector_options(int optionCount, const String options[], const int indi } void addSelector_Head(const String& id) { - do_addSelector_Head(id, F("wide"), F(""), false); + do_addSelector_Head(id, F("wide"), EMPTY_STRING, false); } void addSelector_Head_reloadOnChange(const String& id) { @@ -363,12 +363,12 @@ void addTableSeparator(const String& label, int colspan, int h_size, const Strin void addFormHeader(const __FlashStringHelper * header) { html_TR(); - html_table_header(header, F(""), F(""), 225); + html_table_header(header, EMPTY_STRING, EMPTY_STRING, 225); html_table_header(F("")); } void addFormHeader(const String& header, const String& helpButton) { - addFormHeader(header, helpButton, F("")); + addFormHeader(header, helpButton, EMPTY_STRING); } void addFormHeader(const String& header, const String& helpButton, const String& rtdHelpButton) diff --git a/src/src/WebServer/Markup_Buttons.cpp b/src/src/WebServer/Markup_Buttons.cpp index eda5104f2..ab4e871ac 100644 --- a/src/src/WebServer/Markup_Buttons.cpp +++ b/src/src/WebServer/Markup_Buttons.cpp @@ -7,7 +7,7 @@ void addButton(const __FlashStringHelper * url, const __FlashStringHelper * label) { - addButton(url, label, F("")); + addButton(url, label, EMPTY_STRING); } void addButton(const __FlashStringHelper * url, const __FlashStringHelper * label, const __FlashStringHelper * classes, bool enabled) @@ -21,7 +21,7 @@ void addButton(const __FlashStringHelper * url, const __FlashStringHelper * labe void addButton(const String& url, const String& label) { - addButton(url, label, F("")); + addButton(url, label, EMPTY_STRING); } void addButton(const String& url, const String& label, const String& classes, bool enabled) @@ -35,7 +35,7 @@ void addButton(const String& url, const String& label, const String& classes, bo void addButtonWithSvg(const String& url, const String& label) { - addButtonWithSvg(url, label, F(""), false); + addButtonWithSvg(url, label, EMPTY_STRING, false); } void addButtonWithSvg(const String& url, const String& label, const String& svgPath, bool needConfirm) { @@ -74,7 +74,7 @@ void addSaveButton(const String& url, const String& label) { #ifdef BUILD_MINIMAL_OTA addButtonWithSvg(url, label - , F("") + , EMPTY_STRING , false); #else // ifdef BUILD_MINIMAL_OTA addButtonWithSvg(url, @@ -91,7 +91,7 @@ void addDeleteButton(const String& url, const String& label) { #ifdef BUILD_MINIMAL_OTA addButtonWithSvg(url, label - , F("") + , EMPTY_STRING , true); #else // ifdef BUILD_MINIMAL_OTA addButtonWithSvg(url, @@ -105,7 +105,7 @@ void addDeleteButton(const String& url, const String& label) } void addWideButton(const __FlashStringHelper * url, const __FlashStringHelper * label) { - html_add_wide_button_prefix(F(""), true); + html_add_wide_button_prefix(EMPTY_STRING, true); addHtml(url); addHtml("'>"); addHtml(label); @@ -113,7 +113,7 @@ void addWideButton(const __FlashStringHelper * url, const __FlashStringHelper * } void addWideButton(const String& url, const String& label) { - addWideButton(url, label, F(""), true); + addWideButton(url, label, EMPTY_STRING, true); } void addWideButton(const String& url, const String& label, const String& classes) { @@ -141,7 +141,7 @@ void addSubmitButton(const __FlashStringHelper * value, const __FlashStringHelpe } void addSubmitButton(const String& value, const String& name) { - addSubmitButton(value, name, F("")); + addSubmitButton(value, name, EMPTY_STRING); } void addSubmitButton(const __FlashStringHelper * value, const __FlashStringHelper * name, const __FlashStringHelper * classes) diff --git a/src/src/WebServer/Markup_Forms.cpp b/src/src/WebServer/Markup_Forms.cpp index ce2eedd70..da6f32265 100644 --- a/src/src/WebServer/Markup_Forms.cpp +++ b/src/src/WebServer/Markup_Forms.cpp @@ -31,7 +31,7 @@ void addFormSeparator(int clspan) // ******************************************************************************** void addFormNote(const __FlashStringHelper * text) { - addRowLabel_tr_id(F(""), F("")); + addRowLabel_tr_id(EMPTY_STRING, EMPTY_STRING); addHtml(F("
'); @@ -42,7 +42,7 @@ void addFormNote(const __FlashStringHelper * text) void addFormNote(const String& text, const String& id) { - addRowLabel_tr_id(F(""), id); + addRowLabel_tr_id(EMPTY_STRING, id); addHtmlDiv(F("note"), String(F("Note: ")) + text); } @@ -177,7 +177,7 @@ void addFormIPBox(const String& label, const String& id, const byte ip[4]) addHtmlAttribute(F("class"), F("wide")); addHtmlAttribute(F("type"), F("text")); addHtmlAttribute(F("name"), id); - addHtmlAttribute(F("value"), (empty_IP) ? F("") : formatIP(ip)); + addHtmlAttribute(F("value"), (empty_IP) ? EMPTY_STRING : formatIP(ip)); addHtml('>'); } @@ -209,7 +209,7 @@ void addFormPinSelectI2C(const String& label, const String& id, int choice) void addFormSelectorI2C(const String& id, int addressCount, const int addresses[], int selectedIndex) { addRowLabel_tr_id(F("I2C Address"), id); - do_addSelector_Head(id, F(""), F(""), false); + do_addSelector_Head(id, EMPTY_STRING, EMPTY_STRING, false); for (byte x = 0; x < addressCount; x++) { @@ -218,7 +218,7 @@ void addFormSelectorI2C(const String& id, int addressCount, const int addresses[ if (x == 0) { option += F(" - (default)"); } - addSelector_Item(option, addresses[x], addresses[x] == selectedIndex, false, F("")); + addSelector_Item(option, addresses[x], addresses[x] == selectedIndex, false, EMPTY_STRING); } addSelector_Foot(); } @@ -291,7 +291,7 @@ void addFormSelector_script(const String& label, const String& onChangeCall) { addRowLabel_tr_id(label, id); - do_addSelector_Head(id, F(""), onChangeCall, false); + do_addSelector_Head(id, EMPTY_STRING, onChangeCall, false); addSelector_options(optionCount, options, indices, attr, selectedIndex); addSelector_Foot(); } diff --git a/src/src/WebServer/NotificationPage.cpp b/src/src/WebServer/NotificationPage.cpp index b3d9c9ade..d3810ddbe 100644 --- a/src/src/WebServer/NotificationPage.cpp +++ b/src/src/WebServer/NotificationPage.cpp @@ -157,7 +157,7 @@ void handle_notifications() { addRowLabel(F("Notification")); byte choice = Settings.Notification[notificationindex]; addSelector_Head_reloadOnChange(F("notification")); - addSelector_Item(F("- None -"), 0, false, false, F("")); + addSelector_Item(F("- None -"), 0, false, false, EMPTY_STRING); for (byte x = 0; x <= notificationCount; x++) { diff --git a/src/src/WebServer/Rules.cpp b/src/src/WebServer/Rules.cpp index 8e3b64b1f..b13ac8b1d 100644 --- a/src/src/WebServer/Rules.cpp +++ b/src/src/WebServer/Rules.cpp @@ -91,7 +91,7 @@ void handle_rules() { html_TR_TD(); html_end_form(); addHtml(F("")); - addHtmlDiv(F(""), F("Saved!"), F("toastmessage")); + addHtmlDiv(EMPTY_STRING, F("Saved!"), F("toastmessage")); addButton(fileName, F("Download to file")); html_end_table(); @@ -356,7 +356,7 @@ void handle_rules_delete() { if (removed) { web_server.sendHeader(F("Location"), F("/rules"), true); - web_server.send(302, F("text/plain"), F("")); + web_server.send(302, F("text/plain"), EMPTY_STRING); } else { @@ -472,7 +472,7 @@ bool handle_rules_edit(String originalUri, bool isAddNew) { if (isAddNew) { web_server.sendHeader(F("Location"), F("/rules"), true); - web_server.send(302, F("text/plain"), F("")); + web_server.send(302, F("text/plain"), EMPTY_STRING); return true; } } @@ -594,7 +594,7 @@ bool Rule_Download(const String& path) void Goto_Rules_Root() { web_server.sendHeader(F("Location"), F("/rules"), true); - web_server.send(302, F("text/plain"), F("")); + web_server.send(302, F("text/plain"), EMPTY_STRING); } bool EnumerateFileAndDirectory(String & rootPath diff --git a/src/src/WebServer/SetupPage.cpp b/src/src/WebServer/SetupPage.cpp index d0555e374..6ecd4f658 100644 --- a/src/src/WebServer/SetupPage.cpp +++ b/src/src/WebServer/SetupPage.cpp @@ -359,7 +359,7 @@ void handle_setup_scan_and_show(const String& ssid, const String& other, const S html_TR_TD(); html_TD(); html_BR(); - addSubmitButton(F("Connect"), F("")); + addSubmitButton(F("Connect"), EMPTY_STRING); html_end_table(); } diff --git a/src/src/WebServer/ToolsPage.cpp b/src/src/WebServer/ToolsPage.cpp index cc863330e..7bbd5f6a3 100644 --- a/src/src/WebServer/ToolsPage.cpp +++ b/src/src/WebServer/ToolsPage.cpp @@ -134,7 +134,7 @@ void handle_tools() { bool otaEnabled = OTA_possible(maxSketchSize, use2step); addFormSubHeader(F("Firmware")); html_TR_TD_height(30); - addWideButton(F("update"), F("Update Firmware"), F(""), otaEnabled); + addWideButton(F("update"), F("Update Firmware"), EMPTY_STRING, otaEnabled); addHelpButton(F("EasyOTA")); html_TD(); addHtml(F("Load a new firmware ")); diff --git a/src/src/WebServer/WebServer.cpp b/src/src/WebServer/WebServer.cpp index 2e320ec4d..e99722a15 100644 --- a/src/src/WebServer/WebServer.cpp +++ b/src/src/WebServer/WebServer.cpp @@ -234,12 +234,12 @@ size_t streamFile_htmlEscape(const String& fileName) if (f) { - String escaped; - while (f.available()) { char c = (char)f.read(); + const __FlashStringHelper * escaped = F(""); + if (htmlEscapeChar(c, escaped)) { addHtml(escaped); } else { @@ -268,7 +268,7 @@ bool captivePortal() { } #endif web_server.sendHeader(F("Location"), redirectURL, true); - web_server.send(302, F("text/plain"), F("")); // Empty content inhibits Content-length header so we have to close the socket ourselves. + web_server.send(302, F("text/plain"), EMPTY_STRING); // Empty content inhibits Content-length header so we have to close the socket ourselves. web_server.client().stop(); // Stop is needed because we sent no content length return true; }