Clear the open minors: lost marking and overrun logging, form teardown guard, line breaks and ERANGE in config, probe strength
The E-1608 source marks every restart as lost and logs each overrun; its form stops touching siblings after the chooser destroys them; the link skips command id 0, retries a full-buffer discover send and ignores a zero-length scan read. Session files escape \n and \r; get_int and get_double reject out-of-range values; the UDPS port spin reports changes; a skipped source panel says why on stderr. The E-1608 probe now checks the signal names and the reconnect itself. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
6245811699
commit
87822ed4f5
9 files changed
+95
-18
No files matched your search
+20
-6
@@ -55,12 +55,23 @@ namespace {
|
||||
std::string toml_escape(const std::string& s) {
|
||||
std::string out = "\"";
|
||||
for (char c : s) {
|
||||
if (c == '"' || c == '\\') out.push_back('\\');
|
||||
out.push_back(c);
|
||||
// The file is read line by line, so a raw newline in a value would end the line early.
|
||||
if (c == '\n') {
|
||||
out += "\\n";
|
||||
} else if (c == '\r') {
|
||||
out += "\\r";
|
||||
} else {
|
||||
if (c == '"' || c == '\\') out.push_back('\\');
|
||||
out.push_back(c);
|
||||
}
|
||||
}
|
||||
return out + "\"";
|
||||
}
|
||||
|
||||
/// The character an escape `\x` stands for: `\n` and `\r` are the two line breaks, anything else
|
||||
/// (the quote, the backslash) stands for itself.
|
||||
char unescaped(char c) { return c == 'n' ? '\n' : c == 'r' ? '\r' : c; }
|
||||
|
||||
bool unescape(std::string& s) {
|
||||
std::string out;
|
||||
for (std::size_t i = 0; i < s.size(); ++i) {
|
||||
@@ -69,8 +80,8 @@ bool unescape(std::string& s) {
|
||||
continue;
|
||||
}
|
||||
if (++i >= s.size()) return false;
|
||||
if (s[i] == '"' || s[i] == '\\') {
|
||||
out.push_back(s[i]);
|
||||
if (s[i] == '"' || s[i] == '\\' || s[i] == 'n' || s[i] == 'r') {
|
||||
out.push_back(unescaped(s[i]));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -472,8 +483,11 @@ bool load_layout(const std::string& path, LayoutState& out) {
|
||||
std::string s = v.substr(1, v.size() - 2);
|
||||
std::string out;
|
||||
for (std::size_t i = 0; i < s.size(); ++i) {
|
||||
if (s[i] == '\\' && i + 1 < s.size()) ++i;
|
||||
out.push_back(s[i]);
|
||||
if (s[i] == '\\' && i + 1 < s.size()) {
|
||||
out.push_back(unescaped(s[++i]));
|
||||
} else {
|
||||
out.push_back(s[i]);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user