Skip to content

Commit

Permalink
Fix double quotes escape (SoftFever#1397 SoftFever#1435 SoftFever#1946
Browse files Browse the repository at this point in the history
  • Loading branch information
Noisyfox committed Sep 4, 2023
1 parent e97ab55 commit 21b41ab
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/libslic3r/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace Slic3r {
//static const std::string CONFIG_INHERITS_KEY = "inherits";
//static const std::string CONFIG_INSTANT_KEY = "instantiation";

// Escape \n, \r and backslash
// Escape double quotes, \n, \r and backslash
std::string escape_string_cstyle(const std::string &str)
{
// Allocate a buffer twice the input string length,
Expand All @@ -58,9 +58,9 @@ std::string escape_string_cstyle(const std::string &str)
} else if (c == '\n') {
(*outptr ++) = '\\';
(*outptr ++) = 'n';
} else if (c == '\\') {
(*outptr ++) = '\\';
(*outptr ++) = '\\';
} else if (c == '\\' || c == '"') {
(*outptr++) = '\\';
(*outptr++) = c;
} else
(*outptr ++) = c;
}
Expand Down Expand Up @@ -117,7 +117,7 @@ std::string escape_strings_cstyle(const std::vector<std::string> &strs)
return std::string(out.data(), outptr - out.data());
}

// Unescape \n, \r and backslash
// Unescape double quotes, \n, \r and backslash
bool unescape_string_cstyle(const std::string &str, std::string &str_out)
{
std::vector<char> out(str.size(), 0);
Expand Down

0 comments on commit 21b41ab

Please sign in to comment.