From 7d690dcc1bf3d93ebb2542a4b5029523f20a3798 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 19 Aug 2019 11:21:00 +0200 Subject: [PATCH] Gain a little code space on WebSend response Gain a little code space on WebSend response --- sonoff/xdrv_01_webserver.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index 535c19d47..2d42815d4 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -2401,10 +2401,11 @@ int WebSend(char *buffer) if (http_code == HTTP_CODE_OK || http_code == HTTP_CODE_MOVED_PERMANENTLY) { #ifdef USE_WEBSEND_RESPONSE // Return received data to the user - Adds 900+ bytes to the code - String result = http.getString(); // File found at server - may need lot of ram or trigger out of memory! + const char* read = http.getString().c_str(); // File found at server - may need lot of ram or trigger out of memory! uint32_t j = 0; - for (uint32_t i = 0; i < result.length(); i++) { - char text = result.charAt(i); + char text = '.'; + while (text != '\0') { + text = *read++; if (text > 31) { // Remove control characters like linefeed mqtt_data[j++] = text; if (j == sizeof(mqtt_data) -2) { break; }