diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-26 10:38:25 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-26 10:58:36 +0300 |
commit | 333e41eac6daf60c6aa9df0496a39c57d74b9c87 (patch) | |
tree | 5986e980fd64bc4ef1c3dda125a0f9dca4bab2c8 /source/blender/editors | |
parent | 0210c4df1793799a09a35e44be286dfca88769dc (diff) |
Cleanup: replace C-style casts with functional casts for numeric types
Use function style casts in C++ headers & source.
Diffstat (limited to 'source/blender/editors')
5 files changed, 6 insertions, 7 deletions
diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc index 7e5556adcc9..403cb0116d2 100644 --- a/source/blender/editors/interface/interface.cc +++ b/source/blender/editors/interface/interface.cc @@ -3659,10 +3659,10 @@ static void ui_but_build_drawstr_float(uiBut *but, double value) /* Change negative zero to regular zero, without altering anything else. */ value += +0.0f; - if (value == (double)FLT_MAX) { + if (value == double(FLT_MAX)) { STR_CONCAT(but->drawstr, slen, "inf"); } - else if (value == (double)-FLT_MAX) { + else if (value == double(-FLT_MAX)) { STR_CONCAT(but->drawstr, slen, "-inf"); } else if (subtype == PROP_PERCENTAGE) { diff --git a/source/blender/editors/interface/interface_region_tooltip.cc b/source/blender/editors/interface/interface_region_tooltip.cc index 74985c50cc1..3ded613c6f3 100644 --- a/source/blender/editors/interface/interface_region_tooltip.cc +++ b/source/blender/editors/interface/interface_region_tooltip.cc @@ -1396,8 +1396,7 @@ ARegion *UI_tooltip_create_from_gizmo(bContext *C, wmGizmo *gz) { wmWindow *win = CTX_wm_window(C); const float aspect = 1.0f; - float init_position[2] = {static_cast<float>(win->eventstate->xy[0]), - static_cast<float>(win->eventstate->xy[1])}; + float init_position[2] = {float(win->eventstate->xy[0]), float(win->eventstate->xy[1])}; uiTooltipData *data = ui_tooltip_data_from_gizmo(C, gz); if (data == nullptr) { diff --git a/source/blender/editors/object/object_transform.cc b/source/blender/editors/object/object_transform.cc index 680cf1c94cd..8ba460b1c6d 100644 --- a/source/blender/editors/object/object_transform.cc +++ b/source/blender/editors/object/object_transform.cc @@ -1866,7 +1866,7 @@ struct XFormAxisData { static void object_transform_axis_target_calc_depth_init(XFormAxisData *xfd, const int mval[2]) { float view_co_a[3], view_co_b[3]; - const float2 mval_fl = {static_cast<float>(mval[0]), static_cast<float>(mval[1])}; + const float2 mval_fl = {float(mval[0]), float(mval[1])}; ED_view3d_win_to_ray(xfd->vc.region, mval_fl, view_co_a, view_co_b); add_v3_v3(view_co_b, view_co_a); float center[3] = {0.0f}; diff --git a/source/blender/editors/sculpt_paint/paint_image.cc b/source/blender/editors/sculpt_paint/paint_image.cc index e849fd95084..619002a1bea 100644 --- a/source/blender/editors/sculpt_paint/paint_image.cc +++ b/source/blender/editors/sculpt_paint/paint_image.cc @@ -980,7 +980,7 @@ void ED_imapaint_bucket_fill(struct bContext *C, ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_2D); - const float mouse_init[2] = {static_cast<float>(mouse[0]), static_cast<float>(mouse[1])}; + const float mouse_init[2] = {float(mouse[0]), float(mouse[1])}; paint_2d_bucket_fill(C, color, nullptr, mouse_init, nullptr, nullptr); ED_image_undo_push_end(); diff --git a/source/blender/editors/space_view3d/view3d_select.cc b/source/blender/editors/space_view3d/view3d_select.cc index f38b22fce4d..687c2b7d591 100644 --- a/source/blender/editors/space_view3d/view3d_select.cc +++ b/source/blender/editors/space_view3d/view3d_select.cc @@ -4667,7 +4667,7 @@ static bool object_circle_select(ViewContext *vc, View3D *v3d = vc->v3d; const float radius_squared = rad * rad; - const float mval_fl[2] = {static_cast<float>(mval[0]), static_cast<float>(mval[1])}; + const float mval_fl[2] = {float(mval[0]), float(mval[1])}; bool changed = false; if (SEL_OP_USE_PRE_DESELECT(sel_op)) { |