Cleanup: avoid casting away 'const'
Copy into a non-const variable before assignment to avoid casts that remove `const`.
This commit is contained in:
@@ -224,13 +224,14 @@ TreeElementRNAArrayElement::TreeElementRNAArrayElement(TreeElement &legacy_te,
|
||||
char c = RNA_property_array_item_char(TreeElementRNAArrayElement::get_property_rna(), index);
|
||||
|
||||
const size_t name_size = sizeof(char[20]);
|
||||
legacy_te_.name = MEM_calloc_arrayN<char>(name_size, "OutlinerRNAArrayName");
|
||||
char *name = MEM_calloc_arrayN<char>(name_size, "OutlinerRNAArrayName");
|
||||
if (c) {
|
||||
BLI_snprintf_utf8((char *)legacy_te_.name, name_size, " %c", c);
|
||||
BLI_snprintf_utf8(name, name_size, " %c", c);
|
||||
}
|
||||
else {
|
||||
BLI_snprintf_utf8((char *)legacy_te_.name, name_size, " %d", index + 1);
|
||||
BLI_snprintf_utf8(name, name_size, " %d", index + 1);
|
||||
}
|
||||
legacy_te_.name = name;
|
||||
legacy_te_.flag |= TE_FREE_NAME;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user