own commit to fix a naming bug caused a new bug.

This commit is contained in:
Campbell Barton 2010-08-22 07:11:40 +00:00
parent 4ca9a7e9c1
commit 6e141b7331

@ -1094,8 +1094,14 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
left_len= splitIDname(name, left, &nr);
/* if new name will be too long, truncate it */
if(nr>999 && strlen(left)>16) left[16]= 0;
else if(strlen(left)>17) left[17]= 0;
if(nr > 999 && left_len > 16) {
left[16]= 0;
left_len= 16;
}
else if(left_len > 17) {
left[17]= 0;
left_len= 17;
}
for(idtest= lb->first; idtest; idtest= idtest->next) {
if( (id != idtest) &&
@ -1136,10 +1142,11 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
/* otherwise just continue and use a number suffix */
}
if(nr > 999 && strlen(left) > 16) {
if(nr > 999 && left_len > 16) {
/* this would overflow name buffer */
left[16] = 0;
strcpy( name, left );
/* left_len = 16; */ /* for now this isnt used again */
memcpy(name, left, sizeof(char) * 16);
continue;
}
/* this format specifier is from hell... */