Cleanup: avoid nullptr casts to access a struct members size
This commit is contained in:
@@ -526,7 +526,7 @@ void BKE_workspace_tool_id_replace_table(struct WorkSpace *workspace,
|
||||
int replace_table_num)
|
||||
{
|
||||
const size_t idname_prefix_len = idname_prefix_skip ? strlen(idname_prefix_skip) : 0;
|
||||
const size_t idname_suffix_len = sizeof(((bToolRef *)nullptr)->idname) - idname_prefix_len;
|
||||
const size_t idname_suffix_len = sizeof(bToolRef::idname) - idname_prefix_len;
|
||||
|
||||
LISTBASE_FOREACH (bToolRef *, tref, &workspace->tools) {
|
||||
if (!(tref->space_type == space_type && tref->mode == mode)) {
|
||||
|
||||
@@ -1169,7 +1169,7 @@ void SCENE_OT_view_layer_add_lightgroup(wmOperatorType *ot)
|
||||
ot->prop = RNA_def_string(ot->srna,
|
||||
"name",
|
||||
nullptr,
|
||||
sizeof(((ViewLayerLightgroup *)nullptr)->name),
|
||||
sizeof(ViewLayerLightgroup::name),
|
||||
"Name",
|
||||
"Name of newly created lightgroup");
|
||||
}
|
||||
|
||||
@@ -2076,13 +2076,13 @@ static void outliner_buttons(const bContext *C,
|
||||
/* If we add support to rename Sequence, need change this. */
|
||||
|
||||
if (tselem->type == TSE_EBONE) {
|
||||
len = sizeof(((EditBone *)nullptr)->name);
|
||||
len = sizeof(EditBone::name);
|
||||
}
|
||||
else if (tselem->type == TSE_MODIFIER) {
|
||||
len = sizeof(((ModifierData *)nullptr)->name);
|
||||
len = sizeof(ModifierData::name);
|
||||
}
|
||||
else if (tselem->id && GS(tselem->id->name) == ID_LI) {
|
||||
len = sizeof(((Library *)nullptr)->filepath);
|
||||
len = sizeof(Library::filepath);
|
||||
}
|
||||
else {
|
||||
len = MAX_ID_NAME - 2;
|
||||
|
||||
@@ -1634,7 +1634,7 @@ static void outliner_filter_tree(SpaceOutliner *space_outliner,
|
||||
const Scene *scene,
|
||||
ViewLayer *view_layer)
|
||||
{
|
||||
char search_buff[sizeof(((struct SpaceOutliner *)nullptr)->search_string) + 2];
|
||||
char search_buff[sizeof(SpaceOutliner::search_string) + 2];
|
||||
char *search_string;
|
||||
|
||||
const int exclude_filter = outliner_exclude_filter_get(space_outliner);
|
||||
|
||||
@@ -824,7 +824,7 @@ static void imb_exr_insert_view_name(char *name_full, const char *passname, cons
|
||||
BLI_assert(!ELEM(name_full, passname, viewname));
|
||||
|
||||
if (viewname == nullptr || viewname[0] == '\0') {
|
||||
BLI_strncpy(name_full, passname, sizeof(((ExrChannel *)nullptr)->name));
|
||||
BLI_strncpy(name_full, passname, sizeof(ExrChannel::name));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1012,7 +1012,7 @@ void ArmatureImporter::get_rna_path_for_joint(COLLADAFW::Node *node,
|
||||
char *joint_path,
|
||||
size_t count)
|
||||
{
|
||||
char bone_name_esc[sizeof(((Bone *)nullptr)->name) * 2];
|
||||
char bone_name_esc[sizeof(Bone::name) * 2];
|
||||
BLI_str_escape(bone_name_esc, bc_get_joint_name(node), sizeof(bone_name_esc));
|
||||
BLI_snprintf(joint_path, count, "pose.bones[\"%s\"]", bone_name_esc);
|
||||
}
|
||||
|
||||
@@ -769,7 +769,7 @@ void bc_enable_fcurves(bAction *act, char *bone_name)
|
||||
char prefix[200];
|
||||
|
||||
if (bone_name) {
|
||||
char bone_name_esc[sizeof(((Bone *)nullptr)->name) * 2];
|
||||
char bone_name_esc[sizeof(Bone::name) * 2];
|
||||
BLI_str_escape(bone_name_esc, bone_name, sizeof(bone_name_esc));
|
||||
BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone_name_esc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user