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>2021-09-04 07:22:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-09-04 09:59:54 +0300
commite6194e735791b42feb51e810a4910a41d999d3bf (patch)
tree95889982ba8c6bc88f5bdfb2eded77159d81ca89 /source/blender/io/collada
parent716682365c6bcc1b5f757232ce1d2499b0d062a9 (diff)
RNA: support extracting names from paths without allocating memory
Support extracting identifiers RNA paths into fixed size buffer since the maximum size of the identifier is known all cases. - Add BLI_str_unescape_ex to support limiting the destination buffer. - Add BLI_str_quoted_substr to copy values into a fixed size buffer.
Diffstat (limited to 'source/blender/io/collada')
-rw-r--r--source/blender/io/collada/BCAnimationCurve.cpp5
-rw-r--r--source/blender/io/collada/BCAnimationSampler.cpp5
2 files changed, 4 insertions, 6 deletions
diff --git a/source/blender/io/collada/BCAnimationCurve.cpp b/source/blender/io/collada/BCAnimationCurve.cpp
index 82d8b6e9ff3..005197c9027 100644
--- a/source/blender/io/collada/BCAnimationCurve.cpp
+++ b/source/blender/io/collada/BCAnimationCurve.cpp
@@ -173,10 +173,9 @@ std::string BCAnimationCurve::get_animation_name(Object *ob) const
name = "";
}
else {
- char *boneName = BLI_str_quoted_substrN(fcurve->rna_path, "pose.bones[");
- if (boneName) {
+ char boneName[MAXBONENAME];
+ if (BLI_str_quoted_substr(fcurve->rna_path, "pose.bones[", boneName, sizeof(boneName))) {
name = id_name(ob) + "_" + std::string(boneName);
- MEM_freeN(boneName);
}
else {
name = "";
diff --git a/source/blender/io/collada/BCAnimationSampler.cpp b/source/blender/io/collada/BCAnimationSampler.cpp
index d2bde193c0a..953af5adffc 100644
--- a/source/blender/io/collada/BCAnimationSampler.cpp
+++ b/source/blender/io/collada/BCAnimationSampler.cpp
@@ -447,10 +447,9 @@ void BCAnimationSampler::initialize_curves(BCAnimationCurveMap &curves, Object *
for (; fcu; fcu = fcu->next) {
object_type = BC_ANIMATION_TYPE_OBJECT;
if (ob->type == OB_ARMATURE) {
- char *boneName = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
- if (boneName) {
+ char boneName[MAXBONENAME];
+ if (BLI_str_quoted_substr(fcu->rna_path, "pose.bones[", boneName, sizeof(boneName))) {
object_type = BC_ANIMATION_TYPE_BONE;
- MEM_freeN(boneName);
}
}