Skip to content

Commit

Permalink
Fix cpp string literal when next character is between [0-F] (#16245)
Browse files Browse the repository at this point in the history
* Allow all characters with excape hex to be listeral string in C++

* Generated Code.
  • Loading branch information
Josh V [Apple] authored and pull[bot] committed Oct 30, 2023
1 parent 9c4d81f commit 1434422
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 45 deletions.
9 changes: 3 additions & 6 deletions src/app/zap-templates/common/ClusterTestGeneration.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,12 +734,9 @@ function octetStringEscapedForCLiteral(value)
// Escape control characters, things outside the ASCII range, and single
// quotes (because that's our string terminator).
return value.replace(/\p{Control}|\P{ASCII}|"/gu, ch => {
let code = ch.charCodeAt(0);
code = code.toString(16);
if (code.length == 1) {
code = "0" + code;
}
return "\\x" + code;
var code = ch.charCodeAt(0).toString(8)
return "\\" +
"0".repeat(3 - code.length) + code;
});
}

Expand Down
20 changes: 10 additions & 10 deletions src/darwin/Framework/CHIPTests/CHIPClustersTests.m

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1434422

Please sign in to comment.