rna_SequenceElements_pop --> use memcpy instead of strcpy

This commit is contained in:
Dan Eicher
2012-06-08 22:05:26 +00:00
parent 2f5612ba33
commit a8e0011c96

View File

@@ -339,7 +339,6 @@ static StripElem *rna_SequenceElements_push(ID *id, Sequence *seq, const char *f
static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports, int index) static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports, int index)
{ {
int i;
Scene *scene = (Scene *)id; Scene *scene = (Scene *)id;
StripElem *new_seq, *se; StripElem *new_seq, *se;
@@ -361,12 +360,12 @@ static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports,
new_seq = MEM_callocN(sizeof(StripElem) * (seq->len - 1), "SequenceElements_pop"); new_seq = MEM_callocN(sizeof(StripElem) * (seq->len - 1), "SequenceElements_pop");
seq->len--; seq->len--;
/* TODO - simply use 2 memcpy calls */ se = seq->strip->stripdata;
for (i = 0, se = seq->strip->stripdata; i < seq->len; i++, se++) { if (index > 0)
if (i == index) memcpy(new_seq, se, sizeof(StripElem) * index);
se++;
BLI_strncpy(new_seq[i].name, se->name, sizeof(se->name)); if (index < seq->len)
} memcpy(&new_seq[index], &se[index + 1], sizeof(StripElem) * (seq->len - index));
MEM_freeN(seq->strip->stripdata); MEM_freeN(seq->strip->stripdata);
seq->strip->stripdata = new_seq; seq->strip->stripdata = new_seq;