Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-08-28 13:28:41 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-08-28 13:28:41 +0400
commit852a03a6af6d67da58154b848b45a118eb38cdc0 (patch)
tree135a7420487c987fe7195de4599a340d56b8bc34 /source/blender/makesrna/intern/rna_access.c
parentfa2ba5fbf5848e4d61b697c624af9b9e9456eb20 (diff)
RNA_property_as_string now escapes the string (so operator redo can include strings with ", \n etc), also fixed a bug in string escape length limit.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 88447f6dd77..bc6e17a689d 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -2106,7 +2106,7 @@ char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fi
if(length+1 < fixedlen)
buf= fixedbuf;
else
- buf= MEM_callocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
+ buf= MEM_mallocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
RNA_property_string_get(ptr, prop, buf);
@@ -4271,11 +4271,18 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
break;
case PROP_STRING:
{
- /* string arrays dont exist */
+ char *buf_esc;
char *buf;
- buf = RNA_property_string_get_alloc(ptr, prop, NULL, -1);
- BLI_dynstr_appendf(dynstr, "\"%s\"", buf);
+ int length;
+
+ length= RNA_property_string_length(ptr, prop);
+ buf= MEM_mallocN(sizeof(char)*(length+1), "RNA_property_as_string");
+ buf_esc= MEM_mallocN(sizeof(char)*(length*2+1), "RNA_property_as_string esc");
+ RNA_property_string_get(ptr, prop, buf);
+ BLI_strescape(buf_esc, buf, length*2);
MEM_freeN(buf);
+ BLI_dynstr_appendf(dynstr, "\"%s\"", buf_esc);
+ MEM_freeN(buf_esc);
break;
}
case PROP_ENUM: