Cleanup: suppress UBSAN undefined behavior warnings
This commit is contained in:
@@ -135,10 +135,10 @@ static void curve_to_displist(const Curve *cu,
|
||||
|
||||
const int resolution = (for_render && cu->resolu_ren != 0) ? cu->resolu_ren : nu->resolu;
|
||||
const bool is_cyclic = nu->flagu & CU_NURB_CYCLIC;
|
||||
const BezTriple *bezt_first = &nu->bezt[0];
|
||||
const BezTriple *bezt_last = &nu->bezt[nu->pntsu - 1];
|
||||
|
||||
if (nu->type == CU_BEZIER) {
|
||||
const BezTriple *bezt_first = &nu->bezt[0];
|
||||
const BezTriple *bezt_last = &nu->bezt[nu->pntsu - 1];
|
||||
int samples_len = 0;
|
||||
for (int i = 1; i < nu->pntsu; i++) {
|
||||
const BezTriple *prevbezt = &nu->bezt[i - 1];
|
||||
|
||||
@@ -58,7 +58,6 @@ LatticeDeformData *BKE_lattice_deform_data_create(const Object *oblatt, const Ob
|
||||
{
|
||||
/* we make an array with all differences */
|
||||
Lattice *lt = BKE_object_get_lattice(oblatt);
|
||||
BPoint *bp;
|
||||
DispList *dl = oblatt->runtime.curve_cache ?
|
||||
BKE_displist_find(&oblatt->runtime.curve_cache->disp, DL_VERTS) :
|
||||
nullptr;
|
||||
@@ -70,8 +69,8 @@ LatticeDeformData *BKE_lattice_deform_data_create(const Object *oblatt, const Ob
|
||||
float *lattice_weights = nullptr;
|
||||
float latmat[4][4];
|
||||
LatticeDeformData *lattice_deform_data;
|
||||
|
||||
bp = lt->def;
|
||||
/* May be null. */
|
||||
BPoint *bp = lt->def;
|
||||
|
||||
const int32_t num_points = lt->pntsu * lt->pntsv * lt->pntsw;
|
||||
/* We allocate one additional float for SSE2 optimizations. Without this
|
||||
@@ -113,7 +112,7 @@ LatticeDeformData *BKE_lattice_deform_data_create(const Object *oblatt, const Ob
|
||||
|
||||
for (w = 0, fw = lt->fw; w < lt->pntsw; w++, fw += lt->dw) {
|
||||
for (v = 0, fv = lt->fv; v < lt->pntsv; v++, fv += lt->dv) {
|
||||
for (u = 0, fu = lt->fu; u < lt->pntsu; u++, bp++, co += 3, fp += 3, fu += lt->du) {
|
||||
for (u = 0, fu = lt->fu; u < lt->pntsu; u++, co += 3, fp += 3, fu += lt->du) {
|
||||
if (dl) {
|
||||
fp[0] = co[0] - fu;
|
||||
fp[1] = co[1] - fv;
|
||||
@@ -123,6 +122,7 @@ LatticeDeformData *BKE_lattice_deform_data_create(const Object *oblatt, const Ob
|
||||
fp[0] = bp->vec[0] - fu;
|
||||
fp[1] = bp->vec[1] - fv;
|
||||
fp[2] = bp->vec[2] - fw;
|
||||
bp++;
|
||||
}
|
||||
|
||||
mul_mat3_m4_v3(imat, fp);
|
||||
|
||||
@@ -948,9 +948,10 @@ TEST(string, StrJoin_Truncate)
|
||||
EXPECT_STREQ(buffer, "");
|
||||
}
|
||||
{ /* Empty array. */
|
||||
string_join_array_test_truncate(nullptr, 0, buffer);
|
||||
const char *strings[] = {"a"};
|
||||
string_join_array_test_truncate(strings, 0, buffer);
|
||||
EXPECT_STREQ(buffer, "");
|
||||
string_join_array_with_sep_char_test_truncate(nullptr, 0, buffer);
|
||||
string_join_array_with_sep_char_test_truncate(strings, 0, buffer);
|
||||
EXPECT_STREQ(buffer, "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
|
||||
gz->flag |= eWM_GizmoFlag(flag);
|
||||
}
|
||||
else {
|
||||
gz->flag &= eWM_GizmoFlag(~flag);
|
||||
gz->flag &= ~eWM_GizmoFlag(flag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1354,7 +1354,7 @@ void WM_gizmoconfig_update(Main *bmain)
|
||||
LISTBASE_FOREACH (wmGizmoMapType *, gzmap_type, &gizmomaptypes) {
|
||||
const uchar type_update_all = WM_GIZMOMAPTYPE_UPDATE_INIT | WM_GIZMOMAPTYPE_KEYMAP_INIT;
|
||||
if (gzmap_type->type_update_flag & type_update_all) {
|
||||
gzmap_type->type_update_flag &= eWM_GizmoFlagMapTypeUpdateFlag(~type_update_all);
|
||||
gzmap_type->type_update_flag &= ~eWM_GizmoFlagMapTypeUpdateFlag(type_update_all);
|
||||
LISTBASE_FOREACH (wmGizmoGroupTypeRef *, gzgt_ref, &gzmap_type->grouptype_refs) {
|
||||
if (gzgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_KEYMAP_INIT) {
|
||||
WM_gizmomaptype_group_init_runtime_keymap(bmain, gzgt_ref->type);
|
||||
|
||||
Reference in New Issue
Block a user