cxxrtl, fmt: escape double quotes in c strings

This commit is contained in:
Robin Ole Heinemann 2024-11-11 18:43:46 +01:00 committed by Catherine
parent 7cfc49791f
commit 8bc4bd8a20
2 changed files with 2 additions and 2 deletions

View File

@ -612,7 +612,7 @@ std::string escape_c_string(const std::string &input)
output.push_back('"');
for (auto c : input) {
if (::isprint(c)) {
if (c == '\\')
if (c == '\\' || c == '"')
output.push_back('\\');
output.push_back(c);
} else {

View File

@ -630,7 +630,7 @@ std::string escape_cxx_string(const std::string &input)
std::string output = "\"";
for (auto c : input) {
if (::isprint(c)) {
if (c == '\\')
if (c == '\\' || c == '"')
output.push_back('\\');
output.push_back(c);
} else {