Fix bone "auto-name by axis" failure to clip long names
Failure to clip automatic-names meant named could end with a "." for e.g.
Error in [0] meant the clipped text was copied then
immediately overwritten.
[0]: 354e6b9c18
This commit is contained in:
parent
3221766820
commit
07e2bd443e
|
@ -813,11 +813,9 @@ bool bone_autoside_name(
|
|||
}
|
||||
}
|
||||
|
||||
if ((MAXBONENAME - len) < strlen(extension) + 1) { /* add 1 for the '.' */
|
||||
strncpy(name, basename, len - strlen(extension));
|
||||
}
|
||||
|
||||
BLI_snprintf(name, MAXBONENAME, "%s.%s", basename, extension);
|
||||
/* Subtract 1 from #MAXBONENAME for the null byte. Add 1 to the extension for the '.' */
|
||||
const int basename_maxlen = (MAXBONENAME - 1) - (1 + strlen(extension));
|
||||
BLI_snprintf(name, MAXBONENAME, "%.*s.%s", basename_maxlen, basename, extension);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue