From e6194e735791b42feb51e810a4910a41d999d3bf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 4 Sep 2021 14:22:44 +1000 Subject: 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. --- source/blender/editors/animation/anim_deps.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/animation/anim_deps.c') diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 916d4232f03..97679723d84 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -206,16 +206,17 @@ static void animchan_sync_fcurve_scene(bAnimListElem *ale) BLI_assert(GS(owner_id->name) == ID_SCE); Scene *scene = (Scene *)owner_id; FCurve *fcu = (FCurve *)ale->data; + Sequence *seq = NULL; /* Only affect if F-Curve involves sequence_editor.sequences. */ - char *seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all["); - if (seq_name == NULL) { + char seq_name[sizeof(seq->name)]; + if (!BLI_str_quoted_substr(fcu->rna_path, "sequences_all[", seq_name, sizeof(seq_name))) { return; } /* Check if this strip is selected. */ Editing *ed = SEQ_editing_get(scene); - Sequence *seq = SEQ_get_sequence_by_name(ed->seqbasep, seq_name, false); + seq = SEQ_get_sequence_by_name(ed->seqbasep, seq_name, false); MEM_freeN(seq_name); if (seq == NULL) { -- cgit v1.2.3