mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 12:27:21 +00:00
Better escaping.
This commit is contained in:
parent
6f95eec905
commit
122a6b7e28
@ -1000,7 +1000,9 @@ string escape(const char *src) {
|
|||||||
if (*src == '\\')
|
if (*src == '\\')
|
||||||
dst += "\\\\";
|
dst += "\\\\";
|
||||||
else if (*src == '"')
|
else if (*src == '"')
|
||||||
dst += '2'; // Yes, this IS a trick ;)
|
dst += "\\2"; // Yes, this IS a trick ;)
|
||||||
|
else if (*src == ' ')
|
||||||
|
dst += "\\s";
|
||||||
else
|
else
|
||||||
dst += *src;
|
dst += *src;
|
||||||
src++;
|
src++;
|
||||||
@ -1018,10 +1020,12 @@ string unescape(const char *src) {
|
|||||||
if (*src == '\\') {
|
if (*src == '\\') {
|
||||||
if (*next_char == 0) // This is an error...
|
if (*next_char == 0) // This is an error...
|
||||||
dst += '\\';
|
dst += '\\';
|
||||||
else if (*next_char == '2') {
|
else {
|
||||||
|
if (*next_char == '2')
|
||||||
dst += '"';
|
dst += '"';
|
||||||
src++;
|
else if (*next_char == 's')
|
||||||
} else {
|
dst += ' ';
|
||||||
|
else
|
||||||
dst += *next_char;
|
dst += *next_char;
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user