Skip to content

Commit

Permalink
Merge pull request #502 from bdring/Devt
Browse files Browse the repository at this point in the history
Devt
  • Loading branch information
bdring authored Jun 21, 2022
2 parents 59aed88 + 141814f commit d7189a0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
2 changes: 1 addition & 1 deletion FluidNC/src/ProcessSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ Error settings_execute_line(char* line, Channel& out, WebUI::AuthenticationLevel

char* value;
if (*line++ == '[') { // [ESPxxx] form
value = strrchr(line, ']');
value = strchr(line, ']');
if (!value) {
// Missing ] is an error in this form
return Error::InvalidStatement;
Expand Down
10 changes: 7 additions & 3 deletions FluidNC/src/Report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,15 @@ void report_feedback_message(Message message) { // ok to send to all channels

const char* radio =
#if defined(ENABLE_WIFI) || defined(ENABLE_BLUETOOTH)
# ifdef ENABLE_WIFI
# if defined(ENABLE_WIFI) && defined(ENABLE_BLUETOOTH)
"wifi+bt";
# else
# ifdef ENABLE_WIFI
"wifi";
# endif
# ifdef ENABLE_BLUETOOTH
# endif
# ifdef ENABLE_BLUETOOTH
"bt";
# endif
# endif
#else
"noradio";
Expand Down
31 changes: 30 additions & 1 deletion FluidNC/src/WebUI/JSONEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,36 @@ namespace WebUI {
// Private function to add a name enclosed with quotes.
void JSONencoder::quoted(const char* s) {
add('"');
stream << s;
char c;
while ((c = *s++) != '\0') {
// Escape JSON special characters
switch (c) {
case '\b':
stream << "\\b";
break;
case '\n':
stream << "\\n";
break;
case '\f':
stream << "\\f";
break;
case '\r':
stream << "\\r";
break;
case '\t':
stream << "\\t";
break;
case '"':
stream << "\\\"";
break;
case '\\':
stream << "\\\\";
break;
default:
stream << c;
break;
}
}
add('"');
}

Expand Down

0 comments on commit d7189a0

Please sign in to comment.