RNA: use BLI_str_unescape utility for parsing escaped strings

This commit is contained in:
Campbell Barton 2020-12-10 14:02:02 +11:00
parent 82e1b65d91
commit 2f86518ac0
1 changed files with 3 additions and 16 deletions

View File

@ -4959,7 +4959,7 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int
const char *p;
char *buf;
char quote = '\0';
int i, j, len, escape;
int len, escape;
len = 0;
@ -5034,21 +5034,8 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int
/* copy string, taking into account escaped ] */
if (bracket) {
for (p = *path, i = 0, j = 0; i < len; i++, p++) {
if (*p == '\\') {
if (*(p + 1) == '\\') {
/* Un-escape pairs of back-slashes into a single back-slash. */
p++;
i += 1;
}
else if (*(p + 1) == quote) {
continue;
}
}
buf[j++] = *p;
}
buf[j] = 0;
BLI_str_unescape(buf, *path, len);
p = (*path) + len;
}
else {
memcpy(buf, *path, sizeof(char) * len);