forked from bartvdbraak/blender
own commit to fix a naming bug caused a new bug.
This commit is contained in:
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);
|
left_len= splitIDname(name, left, &nr);
|
||||||
|
|
||||||
/* if new name will be too long, truncate it */
|
/* if new name will be too long, truncate it */
|
||||||
if(nr>999 && strlen(left)>16) left[16]= 0;
|
if(nr > 999 && left_len > 16) {
|
||||||
else if(strlen(left)>17) left[17]= 0;
|
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) {
|
for(idtest= lb->first; idtest; idtest= idtest->next) {
|
||||||
if( (id != idtest) &&
|
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 */
|
/* 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 */
|
/* this would overflow name buffer */
|
||||||
left[16] = 0;
|
left[16] = 0;
|
||||||
strcpy( name, left );
|
/* left_len = 16; */ /* for now this isnt used again */
|
||||||
|
memcpy(name, left, sizeof(char) * 16);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* this format specifier is from hell... */
|
/* this format specifier is from hell... */
|
||||||
|
Loading…
Reference in New Issue
Block a user