Cleanup: avoid casting away 'const'

Copy into a non-const variable before assignment to avoid casts that
remove `const`.
This commit is contained in:
Campbell Barton
2025-07-27 17:04:15 +10:00
parent b8897d3f6e
commit 37a2effab7

View File

@@ -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;
}