[Bf-blender-cvs] [f68cfd6bb07] master: Cleanup: replace C-style casts with functional casts for numeric types

Campbell Barton noreply at git.blender.org
Sun Sep 25 12:18:04 CEST 2022


Commit: f68cfd6bb078482c4a779a6e26a56e2734edb5b8
Author: Campbell Barton
Date:   Sun Sep 25 18:33:28 2022 +1000
Branches: master
https://developer.blender.org/rBf68cfd6bb078482c4a779a6e26a56e2734edb5b8

Cleanup: replace C-style casts with functional casts for numeric types

===================================================================

M	intern/ghost/intern/GHOST_DisplayManager.cpp
M	intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
M	intern/ghost/intern/GHOST_DisplayManagerX11.cpp
M	intern/ghost/intern/GHOST_EventManager.cpp
M	intern/ghost/intern/GHOST_NDOFManager.cpp
M	intern/ghost/intern/GHOST_SystemSDL.cpp
M	intern/ghost/intern/GHOST_SystemWayland.cpp
M	intern/ghost/intern/GHOST_SystemX11.cpp
M	intern/ghost/intern/GHOST_TimerManager.cpp
M	intern/ghost/intern/GHOST_WindowSDL.cpp
M	intern/ghost/intern/GHOST_WindowX11.cpp
M	intern/guardedalloc/intern/leak_detector.cc
M	intern/sky/source/sky_model.cpp
M	source/blender/blendthumb/src/blender_thumbnailer.cc
M	source/blender/blendthumb/src/blendthumb_extract.cc
M	source/blender/blenkernel/intern/attribute.cc
M	source/blender/blenkernel/intern/brush.cc
M	source/blender/blenkernel/intern/curve.cc
M	source/blender/blenkernel/intern/curveprofile.cc
M	source/blender/blenkernel/intern/customdata.cc
M	source/blender/blenkernel/intern/displist.cc
M	source/blender/blenkernel/intern/editmesh_tangent.cc
M	source/blender/blenkernel/intern/gpencil_geom.cc
M	source/blender/blenkernel/intern/icons.cc
M	source/blender/blenkernel/intern/image.cc
M	source/blender/blenkernel/intern/image_gpu.cc
M	source/blender/blenkernel/intern/main_namemap.cc
M	source/blender/blenkernel/intern/mball.cc
M	source/blender/blenkernel/intern/mesh.cc
M	source/blender/blenkernel/intern/mesh_convert.cc
M	source/blender/blenkernel/intern/mesh_evaluate.cc
M	source/blender/blenkernel/intern/mesh_fair.cc
M	source/blender/blenkernel/intern/mesh_legacy_convert.cc
M	source/blender/blenkernel/intern/mesh_mapping.cc
M	source/blender/blenkernel/intern/mesh_merge_customdata.cc
M	source/blender/blenkernel/intern/mesh_normals.cc
M	source/blender/blenkernel/intern/mesh_remesh_voxel.cc
M	source/blender/blenkernel/intern/mesh_tangent.cc
M	source/blender/blenkernel/intern/mesh_tessellate.cc
M	source/blender/blenkernel/intern/mesh_validate.cc
M	source/blender/blenkernel/intern/node.cc
M	source/blender/blenkernel/intern/node_tree_update.cc
M	source/blender/blenkernel/intern/object_dupli.cc
M	source/blender/blenkernel/intern/paint.cc
M	source/blender/blenkernel/intern/pbvh.cc
M	source/blender/blenkernel/intern/scene.cc
M	source/blender/blenkernel/intern/subdiv_mesh.cc
M	source/blender/blenkernel/intern/type_conversions.cc
M	source/blender/blenkernel/intern/volume.cc
M	source/blender/blenlib/intern/dot_export.cc
M	source/blender/blenlib/intern/math_boolean.cc
M	source/blender/blenlib/intern/noise.cc
M	source/blender/blenlib/intern/rand.cc
M	source/blender/blenlib/intern/string_search.cc
M	source/blender/blenlib/intern/threads.cc
M	source/blender/blenlib/tests/BLI_edgehash_test.cc
M	source/blender/blenlib/tests/BLI_generic_array_test.cc
M	source/blender/blenlib/tests/BLI_heap_simple_test.cc
M	source/blender/blenlib/tests/BLI_heap_test.cc
M	source/blender/blenlib/tests/BLI_kdopbvh_test.cc
M	source/blender/blenlib/tests/BLI_linear_allocator_test.cc
M	source/blender/blenlib/tests/BLI_math_color_test.cc
M	source/blender/blenlib/tests/BLI_math_rotation_test.cc
M	source/blender/blenlib/tests/BLI_path_util_test.cc
M	source/blender/blenlib/tests/BLI_polyfill_2d_test.cc
M	source/blender/blenlib/tests/BLI_string_utf8_test.cc
M	source/blender/blenlib/tests/BLI_virtual_array_test.cc
M	source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
M	source/blender/blenlib/tests/performance/BLI_task_performance_test.cc
M	source/blender/blenloader/intern/readfile.cc
M	source/blender/blenloader/intern/undofile.cc
M	source/blender/blenloader/intern/versioning_300.cc
M	source/blender/blenloader/intern/writefile.cc
M	source/blender/bmesh/intern/bmesh_query_uv.cc
M	source/blender/compositor/intern/COM_ChunkOrderHotspot.cc
M	source/blender/compositor/intern/COM_ExecutionGroup.cc
M	source/blender/compositor/intern/COM_MemoryBuffer.cc
M	source/blender/compositor/intern/COM_OpenCLDevice.cc
M	source/blender/compositor/intern/COM_compositor.cc
M	source/blender/compositor/nodes/COM_CropNode.cc
M	source/blender/compositor/nodes/COM_MapUVNode.cc
M	source/blender/compositor/nodes/COM_MaskNode.cc
M	source/blender/compositor/nodes/COM_SceneTimeNode.cc
M	source/blender/compositor/nodes/COM_TimeNode.cc
M	source/blender/compositor/operations/COM_BlurBaseOperation.cc
M	source/blender/compositor/operations/COM_BokehImageOperation.cc
M	source/blender/compositor/operations/COM_BoxMaskOperation.cc
M	source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cc
M	source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc
M	source/blender/compositor/operations/COM_CryptomatteOperation.cc
M	source/blender/compositor/operations/COM_DenoiseOperation.cc
M	source/blender/compositor/operations/COM_DespeckleOperation.cc
M	source/blender/compositor/operations/COM_DilateErodeOperation.cc
M	source/blender/compositor/operations/COM_DirectionalBlurOperation.cc
M	source/blender/compositor/operations/COM_DisplaceOperation.cc
M	source/blender/compositor/operations/COM_EllipseMaskOperation.cc
M	source/blender/compositor/operations/COM_FlipOperation.cc
M	source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.cc
M	source/blender/compositor/operations/COM_GaussianBlurBaseOperation.cc
M	source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc
M	source/blender/compositor/operations/COM_GlareFogGlowOperation.cc
M	source/blender/compositor/operations/COM_GlareGhostOperation.cc
M	source/blender/compositor/operations/COM_GlareStreaksOperation.cc
M	source/blender/compositor/operations/COM_KeyingBlurOperation.cc
M	source/blender/compositor/operations/COM_KeyingClipOperation.cc
M	source/blender/compositor/operations/COM_KeyingScreenOperation.cc
M	source/blender/compositor/operations/COM_MapUVOperation.cc
M	source/blender/compositor/operations/COM_MaskOperation.cc
M	source/blender/compositor/operations/COM_MovieDistortionOperation.cc
M	source/blender/compositor/operations/COM_MultilayerImageOperation.cc
M	source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc
M	source/blender/compositor/operations/COM_PlaneTrackOperation.cc
M	source/blender/compositor/operations/COM_PreviewOperation.cc
M	source/blender/compositor/operations/COM_RenderLayersProg.cc
M	source/blender/compositor/operations/COM_RotateOperation.cc
M	source/blender/compositor/operations/COM_SMAAOperation.cc
M	source/blender/compositor/operations/COM_ScaleOperation.cc
M	source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc
M	source/blender/compositor/operations/COM_SunBeamsOperation.cc
M	source/blender/compositor/operations/COM_TonemapOperation.cc
M	source/blender/compositor/operations/COM_TransformOperation.cc
M	source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc
M	source/blender/compositor/operations/COM_VectorBlurOperation.cc
M	source/blender/compositor/operations/COM_ViewerOperation.cc
M	source/blender/depsgraph/intern/builder/deg_builder_cache.cc
M	source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
M	source/blender/depsgraph/intern/depsgraph_debug.cc
M	source/blender/depsgraph/intern/eval/deg_eval_flush.cc
M	source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc
M	source/blender/draw/engines/eevee_next/eevee_film.cc
M	source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc
M	source/blender/draw/engines/eevee_next/eevee_sampling.cc
M	source/blender/draw/engines/eevee_next/eevee_velocity.cc
M	source/blender/draw/engines/eevee_next/eevee_view.cc
M	source/blender/draw/engines/overlay/overlay_armature.cc
M	source/blender/draw/engines/overlay/overlay_edit_uv.cc
M	source/blender/draw/engines/overlay/overlay_engine.cc
M	source/blender/draw/engines/overlay/overlay_grid.cc
M	source/blender/draw/engines/overlay/overlay_image.cc
M	source/blender/draw/engines/overlay/overlay_metaball.cc
M	source/blender/draw/engines/overlay/overlay_motion_path.cc
M	source/blender/draw/engines/overlay/overlay_outline.cc
M	source/blender/draw/intern/draw_cache_extract_mesh.cc
M	source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
M	source/blender/draw/intern/draw_cache_impl_subdivision.cc
M	source/blender/draw/intern/draw_command.cc
M	source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc
M	source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc
M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc
M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_angle.cc
M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc
M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc
M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc
M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc
M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_uv.cc
M	source/blender/editors/asset/intern/asset_ops.cc
M	source/blender/editors/curves/intern/curves_add.cc
M	source/blender/editors/curves/intern/curves_ops.cc
M	source/blender/editors/gpencil/gpencil_bake_animation.cc
M	source/blender/editors/gpencil/gpencil_mesh.cc
M	source/blender/editors/interface/interface.cc
M	source/blender/editors/interface/interface_dropboxes.cc
M	source/blender/editors/interface/interface_panel.cc
M	source/blender/editors/interface/interface_query.cc
M	source/blender/editors/interface/interface_region_color_picker.cc
M	source/blender/editors/interface/interface_region_popover.cc
M	source/blender/editors/interface/interface_region_search.cc
M	source/blender/editors/interface/interface_region_tooltip.cc
M	source/blender/editors/interface/interface_style.cc
M	source/blender/editors/interface/interface_template_list.cc
M	source/blender/editors/interface/interface_template_search_menu.cc
M	source/blender/editors/interface/interface_utils.cc
M	source/blender/editors/interface/view2d.cc
M	source/blender/editors/interface/view2d_draw.cc
M	source/blender/editors/interface/view2d_edge_pan.cc
M	source/blender/editors/interface/view2d_ops.cc
M	source/blender/editors/interface/views/grid_view.cc
M	source/blender/editors/mesh/editface.cc
M	source/blender/editors/mesh/mesh_data.cc
M	source/blender/editors/mesh/meshtools.cc
M	source/blender/editors/object/object_add.cc
M	source/blender/editors/object/object_modifier.cc
M	source/blender/editors/object/object_remesh.cc
M	source/blender/editors/object/object_transform.cc
M	source/blender/editors/render/render_preview.cc
M	source/blender/editors/render/render_shading.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_density.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
M	source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc
M	source/blender/editors/sculpt_paint/paint_vertex.cc
M	source/blender/editors/sculpt_paint/sculpt_automasking.cc
M	source/blender/editors/sculpt_paint/sculpt_face_set.cc
M	source/blender/editors/space_file/filelist.cc
M	source/blender/editors/space_node/drawnode.cc
M	source/blender/editors/space_node/node_draw.cc
M	source/blender/editors/space_node/node_edit.cc
M	source/blender/editors/space_node/node_gizmo.cc
M	source/blender/editors/space_node/node_relationships.cc
M	source/blender/editors/space_node/node_select.cc
M	source/blender/editors/space_node/node_view.cc
M	source/blender/editors/space_node/space_node.cc
M	source/blender/editors/space_outliner/outliner_draw.cc
M	source/blender/editors/space_outliner/outliner_edit.cc
M	source/blender/editors/space_outliner/outliner_tools.cc
M	source/blender/editors/space_spreadsheet/spreadsheet_layout.cc
M	source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc
M	source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc
M	source/blender/editors/space_view3d/space_view3d.cc
M	source/blender/editors/space_view3d/view3d_select.cc
M	source/blender/editors/transform/transform_snap_object.cc
M	source/blender/editors/uvedit/uvedit_islands.cc
M	source/blender/freestyle/intern/application/AppCanvas.cpp
M	source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
M	source/blender/freestyle/intern/geometry/Bezier.cpp
M	source/blender/freestyle/intern/geometry/GeomCleaner.cpp
M	source/blender/freestyle/intern/geometry/Grid.cpp
M	source/blender/freestyle/intern/geometry/Noise.cpp
M	source/blender/freestyle/intern/image/GaussianFilter.cpp
M	source/blender/freestyle/intern/image/ImagePyramid.cpp
M	source/blender/freestyle/intern/python/BPy_Interface1D.cpp
M	source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
M	source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp
M	source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
M	source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
M	source/blender/freestyle/intern/stroke/Stroke.cpp
M	source/blender/freestyle/intern/stroke/StrokeRep.cpp
M	source/blender/freestyle/intern/system/PseudoNoise.cpp
M	source/blender/freestyle/intern/system/RandGen.cpp
M	source/blender/freestyle/intern/view_map/BoxGrid.cpp
M	source/blender/freestyle/intern/view_map/SphericalGrid.cpp
M	source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
M	source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
M	source/blender/freestyle/intern/winged_edge/WXEdge.cpp
M	source/blender/functions/intern/multi_function_builder.cc
M	source/blender/functions/intern/multi_function_procedure_executor.cc
M	source/blender/functions/tests/FN_multi_function_test.cc
M	source/blender/geometry/intern/add_curves_on_mesh.cc
M	source/blender/geometry/intern/mesh_merge_by_distance.cc
M	source/blender/geometry/intern/realize_instances.cc
M	source/blender/geometry/intern/set_curve_type.cc
M	source/blender/geometry/intern/trim_curves.cc
M	source/blender/geometry/intern/uv_parametrizer.cc
M	source/blender/gpu/intern/gpu_codegen.cc
M	source/blender/gpu/intern/gpu_index_buffer.cc
M	source/blender/gpu/intern/gpu_matrix.cc
M	source/blender/gpu/intern/gpu_shader_log.cc
M	source/blender/gpu/intern/gpu_state.cc
M	source/blender/gpu/opengl/gl_context.cc
M	source/blender/gpu/opengl/gl_framebuffer.cc
M	source/blender/gpu/opengl/gl_shader.cc
M	source/blender/gpu/opengl/gl_shader_interface.cc
M	source/blender/gpu/opengl/gl_vertex_array.cc
M	source/blender/ikplugin/intern/itasc_plugin.cpp
M	source/blender/imbuf/intern/oiio/openimageio_api.cpp
M	source/blender/imbuf/intern/openexr/openexr_api.cpp
M	source/blender/imbuf/intern/transform.cc
M	source/blender/io/collada/AnimationImporter.cpp
M	source/blender/io/collada/BCAnimationCurve.cpp
M	source/blender/io/collada/BCMath.cpp
M	source/blender/io/collada/CameraExporter.cpp
M	source/blender/io/collada/DocumentImporter.cpp
M	source/blender/io/collada/ExtraTags.cpp
M	source/blender/io/collada/GeometryExporter.cpp
M	source/blender/io/collada/MeshImporter.cpp
M	source/blender/io/collada/TransformReader.cpp
M	source/blender/io/collada/collada_internal.cpp
M	source/blender/io/collada/collada_utils.cpp
M	source/blender/io/gpencil/intern/gpencil_io_base.cc
M	source/blender/io/gpencil/intern/gpencil_io_import_base.cc
M	source/blender/io/gpencil/intern/gpencil_io_import_svg.cc
M	source/blender/io/usd/intern/usd_reader_curve.cc
M	source/blender/io/usd/intern/usd_reader_light.cc
M	source/blender/io/usd/intern/usd_reader_nurbs.cc
M	source/blender/io/usd/intern/usd_writer_volume.cc
M	source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
M	source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc
M	source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
M	source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
M	source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
M	source/blender/io/wavefront_obj/tests/obj_mtl_parser_tests.cc
M	source/blender/modifiers/intern/MOD_meshsequencecache.cc
M	source/blender/modifiers/intern/MOD_nodes.cc
M	source/blender/nodes/function/nodes/node_fn_float_to_int.cc
M	source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc
M	source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc
M	source/blender/nodes/geometry/nodes/node_geo_image_texture.cc
M	source/blender/nodes/geometry/nodes/node_geo_input_scene_time.cc
M	source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
M	source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
M	source/blender/nodes/intern/geometry_nodes_log.cc
M	source/blender/nodes/intern/node_socket.cc
M	source/blender/nodes/shader/node_shader_tree.cc
M	source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc
M	source/blender/nodes/shader/nodes/node_shader_tex_brick.cc
M	source/blender/nodes/shader/nodes/node_shader_tex_checker.cc
M	source/blender/nodes/shader/nodes/node_shader_tex_sky.cc
M	source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc
M	source/blender/python/gpu/gpu_py_shader_create_info.cc
M	source/blender/render/intern/engine.cc
M	source/blender/render/intern/initrender.cc
M	source/blender/render/intern/pipeline.cc
M	source/blender/render/intern/render_result.cc
M	source/blender/render/intern/texture_margin.cc
M	source/blender/simulation/intern/hair_volume.cpp
M	source/blender/windowmanager/intern/wm_event_system.cc

===================================================================

diff --git a/intern/ghost/intern/GHOST_DisplayManager.cpp b/intern/ghost/intern/GHOST_DisplayManager.cpp
index fa15d05232d..55f4b29e009 100644
--- a/intern/ghost/intern/GHOST_DisplayManager.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManager.cpp
@@ -70,7 +70,7 @@ GHOST_TSuccess GHOST_DisplayManager::getDisplaySetting(uint8_t display,
   uint8_t numDisplays;
   success = getNumDisplays(numDisplays);
   if (success == GHOST_kSuccess) {
-    if (display < numDisplays && ((uint8_t)index < m_settings[display].size())) {
+    if (display < numDisplays && (uint8_t(index) < m_settings[display].size())) {
       setting = m_settings[display][index];
     }
     else {
@@ -101,14 +101,14 @@ GHOST_TSuccess GHOST_DisplayManager::findMatch(uint8_t display,
                "GHOST_DisplayManager::findMatch(): m_settingsInitialized=false");
 
   int criteria[4] = {
-      (int)setting.xPixels, (int)setting.yPixels, (int)setting.bpp, (int)setting.frequency};
+      int(setting.xPixels), int(setting.yPixels), int(setting.bpp), int(setting.frequency)};
   int capabilities[4];
   double field, score;
   double best = 1e12; /* A big number. */
   int found = 0;
 
   /* Look at all the display modes. */
-  for (int i = 0; (i < (int)m_settings[display].size()); i++) {
+  for (int i = 0; (i < int(m_settings[display].size())); i++) {
     /* Store the capabilities of the display device. */
     capabilities[0] = m_settings[display][i].xPixels;
     capabilities[1] = m_settings[display][i].yPixels;
diff --git a/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp b/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
index a2fe6a41fb4..eed437adc6c 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
@@ -109,7 +109,7 @@ GHOST_TSuccess GHOST_DisplayManagerSDL::setCurrentDisplaySetting(
 
       SDL_GetDisplayMode(display, i, &mode);
 
-      if ((int)setting.xPixels > mode.w || (int)setting.yPixels > mode.h) {
+      if (int(setting.xPixels) > mode.w || int(setting.yPixels) > mode.h) {
         continue;
       }
 
diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
index ab4a77cd660..53189c6551b 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
@@ -185,8 +185,8 @@ GHOST_TSuccess GHOST_DisplayManagerX11::setCurrentDisplaySetting(
           }
         }
         else {
-          if (abs(calculate_rate(vidmodes[i]) - (int)setting.frequency) <
-              abs(calculate_rate(vidmodes[best_fit]) - (int)setting.frequency)) {
+          if (abs(calculate_rate(vidmodes[i]) - int(setting.frequency)) <
+              abs(calculate_rate(vidmodes[best_fit]) - int(setting.frequency))) {
             best_fit = i;
           }
         }
diff --git a/intern/ghost/intern/GHOST_EventManager.cpp b/intern/ghost/intern/GHOST_EventManager.cpp
index 670631e4e16..184052aa6ab 100644
--- a/intern/ghost/intern/GHOST_EventManager.cpp
+++ b/intern/ghost/intern/GHOST_EventManager.cpp
@@ -31,7 +31,7 @@ GHOST_EventManager::~GHOST_EventManager()
 
 uint32_t GHOST_EventManager::getNumEvents()
 {
-  return (uint32_t)m_events.size();
+  return uint32_t(m_events.size());
 }
 
 uint32_t GHOST_EventManager::getNumEvents(GHOST_TEventType type)
diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp
index 746e3532b03..0945f542803 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManager.cpp
@@ -257,7 +257,7 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
   }
 
   if (m_buttonMask == 0) {
-    m_buttonMask = (int)~(UINT_MAX << m_buttonCount);
+    m_buttonMask = int(~(UINT_MAX << m_buttonCount));
   }
 
 #ifdef DEBUG_NDOF_BUTTONS
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp
index 76770e735fa..ad5c4dc85fb 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.cpp
+++ b/intern/ghost/intern/GHOST_SystemSDL.cpp
@@ -413,7 +413,7 @@ static char convert_keyboard_event_to_ascii(const SDL_KeyboardEvent &sdl_sub_evt
       }
     }
   }
-  return (char)sym;
+  return char(sym);
 }
 
 /**
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index dd82d435397..4082cab4ccd 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -910,7 +910,7 @@ static wl_buffer *ghost_wl_buffer_create_for_image(struct wl_shm *shm,
         wl_shm_pool_destroy(pool);
         if (buffer) {
           *r_buffer_data = buffer_data;
-          *r_buffer_data_size = (size_t)buffer_size;
+          *r_buffer_data_size = size_t(buffer_size);
         }
         else {
           /* Highly unlikely. */
@@ -1991,7 +1991,7 @@ static void tablet_tool_handle_pressure(void *data,
                                         struct zwp_tablet_tool_v2 * /*zwp_tablet_tool_v2*/,
                                         const uint32_t pressure)
 {
-  const float pressure_unit = (float)pressure / 65535;
+  const float pressure_unit = float(pressure) / 65535;
   CLOG_INFO(LOG, 2, "pressure (%.4f)", pressure_unit);
 
   GWL_TabletTool *tablet_tool = static_cast<GWL_TabletTool *>(data);
@@ -2012,8 +2012,8 @@ static void tablet_tool_handle_tilt(void *data,
 {
   /* Map degrees to `-1.0..1.0`. */
   const float tilt_unit[2] = {
-      (float)(wl_fixed_to_double(tilt_x) / 90.0),
-      (float)(wl_fixed_to_double(tilt_y) / 90.0),
+      float(wl_fixed_to_double(tilt_x) / 90.0),
+      float(wl_fixed_to_double(tilt_y) / 90.0),
   };
   CLOG_INFO(LOG, 2, "tilt (x=%.4f, y=%.4f)", UNPACK2(tilt_unit));
   GWL_TabletTool *tablet_tool = static_cast<GWL_TabletTool *>(data);
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 08ac0edb7ec..a383710256a 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -715,7 +715,7 @@ bool GHOST_SystemX11::processEvents(bool waitForEvent)
                   XK_Super_R,
               };
 
-              for (int i = 0; i < (int)ARRAY_SIZE(modifiers); i++) {
+              for (int i = 0; i < int(ARRAY_SIZE(modifiers)); i++) {
                 KeyCode kc = XKeysymToKeycode(m_display, modifiers[i]);
                 if (kc != 0 && ((xevent.xkeymap.key_vector[kc >> 3] >> (kc & 7)) & 1) != 0) {
                   pushEvent(new GHOST_EventKey(getMilliSeconds(),
@@ -845,14 +845,14 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
       }
       else {
         if (m_keycode_last_repeat_key == xke->keycode) {
-          m_keycode_last_repeat_key = (uint)-1;
+          m_keycode_last_repeat_key = uint(-1);
         }
       }
     }
   }
   else if (xe->type == EnterNotify) {
     /* We can't tell how the key state changed, clear it to avoid stuck keys. */
-    m_keycode_last_repeat_key = (uint)-1;
+    m_keycode_last_repeat_key = uint(-1);
   }
 
 #ifdef USE_XINPUT_HOTPLUG
@@ -1193,7 +1193,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
         int i = 0;
         while (true) {
           /* Search character boundary. */
-          if ((uchar)utf8_buf[i++] > 0x7f) {
+          if (uchar(utf8_buf[i++]) > 0x7f) {
             for (; i < len; ++i) {
               c = utf8_buf[i];
               if (c < 0x80 || c > 0xbf) {
@@ -1523,7 +1523,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
      ((void)(val = data->axis_data[axis - axis_first]), true))
 
           if (AXIS_VALUE_GET(2, axis_value)) {
-            window->GetTabletData().Pressure = axis_value / ((float)xtablet.PressureLevels);
+            window->GetTabletData().Pressure = axis_value / float(xtablet.PressureLevels);
           }
 
           /* NOTE(@broken): the (short) cast and the & 0xffff is bizarre and unexplained anywhere,
@@ -1535,12 +1535,12 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
            * I don't think we need to cast to short here, but do not have a device to check this.
            */
           if (AXIS_VALUE_GET(3, axis_value)) {
-            window->GetTabletData().Xtilt = (short)(axis_value & 0xffff) /
-                                            ((float)xtablet.XtiltLevels);
+            window->GetTabletData().Xtilt = short(axis_value & 0xffff) /
+                                            float(xtablet.XtiltLevels);
           }
           if (AXIS_VALUE_GET(4, axis_value)) {
-            window->GetTabletData().Ytilt = (short)(axis_value & 0xffff) /
-                                            ((float)xtablet.YtiltLevels);
+            window->GetTabletData().Ytilt = short(axis_value & 0xffff) /
+                                            float(xtablet.YtiltLevels);
           }
 
 #  undef AXIS_VALUE_GET
@@ -1897,7 +1897,7 @@ static GHOST_TKey ghost_key_from_keysym(const KeySym key)
 
 #undef GXMAP
 
-#define MAKE_ID(a, b, c, d) ((int)(d) << 24 | (int)(c) << 16 | (b) << 8 | (a))
+#define MAKE_ID(a, b, c, d) (int(d) << 24 | int(c) << 16 | (b) << 8 | (a))
 
 static GHOST_TKey ghost_key_from_keycode(const XkbDescPtr xkb_descr, const KeyCode keycode)
 {
@@ -2020,7 +2020,7 @@ void GHOST_SystemX11::getClipboard_xcout(const XEvent *evt,
                          win,
                          m_atom.XCLIP_OUT,
                          0,
-                         (long)pty_size,
+                         long(pty_size),
                          False,
                          AnyPropertyType,
                          &pty_type,
@@ -2106,7 +2106,7 @@ void GHOST_SystemX11::getClipboard_xcout(const XEvent *evt,
                          win,
                          m_atom.XCLIP_OUT,
                          0,
-                         (long)pty_size,
+                         long(pty_size),
                          False,
                          AnyPropertyType,
                          &pty_type,
@@ -2363,10 +2363,10 @@ class DialogData {
   bool isInsideButton(XEvent &e, uint button_num)
   {
     return (
-        (e.xmotion.y > (int)(height - padding_y - button_height)) &&
-        (e.xmotion.y < (int)(height - padding_y)) &&
-        (e.xmotion.x > (int)(width - (padding_x + button_width) * button_

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list