bugfix [#22847] 18+ char Name in Edit Strip causes errors when duplicating strips
authorCampbell Barton <ideasman42@gmail.com>
Wed, 14 Jul 2010 12:16:23 +0000 (12:16 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 14 Jul 2010 12:16:23 +0000 (12:16 +0000)
source/blender/blenkernel/intern/sequencer.c

index e8f8c2f3c3b32e79bbe09e979410ab45527a604a..d97e6151a132b34bff4e3951fb5eb928f6215bdd 100644 (file)
@@ -795,7 +795,7 @@ static void seqbase_unique_name(ListBase *seqbasep, SeqUniqueInfo *sui)
        Sequence *seq;
        for(seq=seqbasep->first; seq; seq= seq->next) {
                if (sui->seq != seq && strcmp(sui->name_dest, seq->name+2)==0) {
-                       sprintf(sui->name_dest, "%.18s.%03d",  sui->name_src, sui->count++);
+                       sprintf(sui->name_dest, "%.17s.%03d",  sui->name_src, sui->count++); /*24 - 2 for prefix, -1 for \0 */
                        sui->match= 1; /* be sure to re-scan */
                }
        }
@@ -816,12 +816,17 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq)
        strcpy(sui.name_src, seq->name+2);
        strcpy(sui.name_dest, seq->name+2);
 
+       sui.count= 1;
+       sui.match= 1; /* assume the worst to start the loop */
+
        /* Strip off the suffix */
-       if ((dot=strrchr(sui.name_src, '.')))
+       if ((dot=strrchr(sui.name_src, '.'))) {
                *dot= '\0';
+               dot++;
 
-       sui.count= 1;
-       sui.match= 1; /* assume the worst to start the loop */
+               if(*dot)
+                       sui.count= atoi(dot) + 1;
+       }
 
        while(sui.match) {
                sui.match= 0;