mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +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,11 +1020,13 @@ 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 {
|
||||||
dst += '"';
|
if (*next_char == '2')
|
||||||
src++;
|
dst += '"';
|
||||||
} else {
|
else if (*next_char == 's')
|
||||||
dst += *next_char;
|
dst += ' ';
|
||||||
|
else
|
||||||
|
dst += *next_char;
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
Loading…
Reference in New Issue
Block a user