[Bf-blender-cvs] [2f86518ac08] master: RNA: use BLI_str_unescape utility for parsing escaped strings
Campbell Barton
noreply at git.blender.org
Thu Dec 10 07:03:55 CET 2020
Commit: 2f86518ac085dde77977912b3cfcadd2bbd41080
Author: Campbell Barton
Date: Thu Dec 10 14:02:02 2020 +1100
Branches: master
https://developer.blender.org/rB2f86518ac085dde77977912b3cfcadd2bbd41080
RNA: use BLI_str_unescape utility for parsing escaped strings
===================================================================
M source/blender/makesrna/intern/rna_access.c
===================================================================
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 94d839a7c30..80e9d15bb28 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -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);
More information about the Bf-blender-cvs
mailing list