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>2013-04-24 00:24:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-04-24 00:24:10 +0400
commit9465ecf63494e069684e6792ac651e80488ce914 (patch)
treebf9c906f82146bae0e67fbd2c0a7dd69bfa85c5e /source/blender/blenkernel/intern/anim_sys.c
parent7dde3551853018147d99e9454abb337384e7a32e (diff)
use string escaping when renaming animation paths - BKE_animdata_fix_paths_rename()
Diffstat (limited to 'source/blender/blenkernel/intern/anim_sys.c')
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index f3d5b838a0d..cdf0c032372 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -38,9 +38,10 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
+#include "BLI_array.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
-#include "BLI_utildefines.h"
#include "BLF_translation.h"
@@ -725,8 +726,15 @@ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, cons
if ((oldName != NULL) && (newName != NULL)) {
/* pad the names with [" "] so that only exact matches are made */
- oldN = BLI_sprintfN("[\"%s\"]", oldName);
- newN = BLI_sprintfN("[\"%s\"]", newName);
+ const size_t name_old_len = strlen(oldName);
+ const size_t name_new_len = strlen(newName);
+ char *name_old_esc = BLI_array_alloca(name_old_esc, (name_old_len * 2) + 1);
+ char *name_new_esc = BLI_array_alloca(name_new_esc, (name_new_len * 2) + 1);
+
+ BLI_strescape(name_old_esc, oldName, (name_old_len * 2) + 1);
+ BLI_strescape(name_new_esc, newName, (name_new_len * 2) + 1);
+ oldN = BLI_sprintfN("[\"%s\"]", name_old_esc);
+ newN = BLI_sprintfN("[\"%s\"]", name_new_esc);
}
else {
oldN = BLI_sprintfN("[%d]", oldSubscript);