From 725973485a909c2b732c58bd49d06a75edd52f7e Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 13 Jul 2020 11:27:09 +0200 Subject: [PATCH] Clang Tidy: enable readability-non-const-parameter warning Clang Tidy reported a couple of false positives. I disabled those `NOLINTNEXTLINE`. Differential Revision: https://developer.blender.org/D8199 --- .clang-tidy | 1 - source/blender/blenkernel/BKE_appdir.h | 2 +- source/blender/blenkernel/BKE_curve.h | 2 +- source/blender/blenkernel/BKE_deform.h | 2 +- source/blender/blenkernel/BKE_fcurve.h | 2 +- source/blender/blenkernel/BKE_fluid.h | 8 ++-- source/blender/blenkernel/BKE_mesh.h | 4 +- source/blender/blenkernel/BKE_mesh_mapping.h | 2 +- source/blender/blenkernel/BKE_object_deform.h | 2 +- source/blender/blenkernel/BKE_pbvh.h | 2 +- source/blender/blenkernel/BKE_pointcache.h | 4 +- source/blender/blenkernel/intern/appdir.c | 2 +- source/blender/blenkernel/intern/cloth.c | 2 +- source/blender/blenkernel/intern/curve.c | 40 +++++++++++----- .../blender/blenkernel/intern/data_transfer.c | 2 +- source/blender/blenkernel/intern/deform.c | 4 +- .../blender/blenkernel/intern/dynamicpaint.c | 32 +++++++------ source/blender/blenkernel/intern/fcurve.c | 2 +- source/blender/blenkernel/intern/fluid.c | 16 +++---- .../blender/blenkernel/intern/gpencil_geom.c | 2 +- source/blender/blenkernel/intern/key.c | 10 +++- source/blender/blenkernel/intern/mask.c | 2 +- .../blenkernel/intern/mask_rasterize.c | 4 +- .../blender/blenkernel/intern/mesh_evaluate.c | 4 +- .../blender/blenkernel/intern/mesh_mapping.c | 2 +- source/blender/blenkernel/intern/mesh_remap.c | 2 +- source/blender/blenkernel/intern/multires.c | 2 +- .../blenkernel/intern/multires_unsubdivide.c | 2 +- .../blender/blenkernel/intern/object_deform.c | 2 +- source/blender/blenkernel/intern/ocean.c | 8 ++-- .../blenkernel/intern/particle_distribute.c | 2 +- source/blender/blenkernel/intern/pbvh.c | 2 +- source/blender/blenkernel/intern/pointcache.c | 46 +++++++++++++------ source/blender/blenkernel/intern/seqeffects.c | 6 +-- .../blender/blenkernel/intern/seqmodifier.c | 6 +-- source/blender/blenkernel/intern/sequencer.c | 2 +- source/blender/blenlib/BLI_fileops.h | 2 +- source/blender/blenlib/BLI_math_color.h | 8 +++- source/blender/blenlib/BLI_math_matrix.h | 2 +- source/blender/blenlib/BLI_rand.h | 6 +-- source/blender/blenlib/BLI_voxel.h | 11 +++-- source/blender/blenlib/intern/delaunay_2d.c | 6 +-- source/blender/blenlib/intern/math_color.c | 8 +++- source/blender/blenlib/intern/math_matrix.c | 2 +- source/blender/blenlib/intern/noise.c | 4 +- source/blender/blenlib/intern/rand.cc | 6 +-- source/blender/blenlib/intern/storage.c | 2 +- source/blender/blenlib/intern/system.c | 6 ++- source/blender/blenlib/intern/voronoi_2d.c | 2 +- source/blender/blenlib/intern/voxel.c | 13 ++++-- .../blender/bmesh/tools/bmesh_region_match.c | 4 +- .../COM_DoubleEdgeMaskOperation.cpp | 28 +++++------ .../operations/COM_GlareFogGlowOperation.cpp | 2 +- .../operations/COM_VectorBlurOperation.cpp | 2 +- .../draw/engines/eevee/eevee_materials.c | 4 +- .../draw/engines/eevee/eevee_private.h | 4 +- .../engines/eevee/eevee_temporal_sampling.c | 2 +- .../draw/engines/overlay/overlay_armature.c | 2 +- .../draw/engines/overlay/overlay_extra.c | 2 +- source/blender/draw/intern/DRW_render.h | 2 +- source/blender/draw/intern/draw_manager.c | 2 +- source/blender/draw/intern/draw_manager.h | 2 +- .../blender/draw/intern/draw_manager_data.c | 2 +- .../blender/draw/intern/draw_manager_shader.c | 11 +++-- .../blender/editors/animation/anim_markers.c | 2 +- .../blender/editors/armature/meshlaplacian.c | 4 +- .../blender/editors/armature/meshlaplacian.h | 2 +- .../blender/editors/gpencil/gpencil_utils.c | 6 +-- .../editors/gpencil/gpencil_vertex_paint.c | 2 +- .../blender/editors/include/ED_fileselect.h | 2 +- source/blender/editors/include/ED_gpencil.h | 2 +- source/blender/editors/include/ED_image.h | 4 +- source/blender/editors/include/ED_node.h | 2 +- source/blender/editors/include/ED_view3d.h | 4 +- source/blender/editors/include/UI_interface.h | 2 +- source/blender/editors/interface/interface.c | 2 +- .../editors/lattice/editlattice_select.c | 2 +- source/blender/editors/mask/mask_add.c | 2 +- source/blender/editors/mesh/editmesh_utils.c | 2 +- .../editors/sculpt_paint/paint_cursor.c | 16 +++++-- .../editors/sculpt_paint/paint_image_2d.c | 6 +-- .../sculpt_paint/paint_vertex_color_ops.c | 2 +- .../editors/sculpt_paint/sculpt_cloth.c | 17 ++++--- source/blender/editors/space_clip/clip_ops.c | 2 + .../editors/space_clip/tracking_ops_track.c | 8 +++- .../editors/space_clip/tracking_select.c | 4 +- source/blender/editors/space_file/filelist.c | 2 +- source/blender/editors/space_file/filesel.c | 2 +- source/blender/editors/space_file/fsmenu.c | 11 +++-- .../editors/space_image/image_buttons.c | 8 +++- .../blender/editors/space_image/image_draw.c | 8 ++-- source/blender/editors/space_node/node_edit.c | 7 ++- source/blender/editors/space_node/node_view.c | 2 +- .../space_sequencer/sequencer_scopes.c | 4 +- .../editors/space_view3d/view3d_select.c | 2 +- .../editors/space_view3d/view3d_utils.c | 9 ++-- .../editors/transform/transform_snap_object.c | 20 ++++---- .../editors/uvedit/uvedit_parametrizer.c | 10 ++-- source/blender/editors/uvedit/uvedit_select.c | 2 +- .../editors/uvedit/uvedit_smart_stitch.c | 2 +- .../blender_interface/BlenderFileLoader.cpp | 2 +- .../blender_interface/BlenderFileLoader.h | 2 +- .../intern/scene_graph/SceneHash.cpp | 2 +- .../freestyle/intern/scene_graph/SceneHash.h | 2 +- .../intern/view_map/CulledOccluderSource.cpp | 2 +- .../intern/view_map/ViewMapBuilder.cpp | 2 +- source/blender/gpu/GPU_buffers.h | 2 +- source/blender/gpu/GPU_material.h | 4 +- source/blender/gpu/intern/gpu_buffers.c | 4 +- source/blender/gpu/intern/gpu_material.c | 4 +- source/blender/imbuf/IMB_imbuf.h | 4 +- source/blender/imbuf/intern/colormanagement.c | 2 +- source/blender/imbuf/intern/dds/BlockDXT.cpp | 4 +- source/blender/imbuf/intern/dds/BlockDXT.h | 4 +- source/blender/imbuf/intern/filter.c | 2 +- source/blender/imbuf/intern/imageprocess.c | 2 +- source/blender/imbuf/intern/indexer.c | 4 +- source/blender/imbuf/intern/iris.c | 4 +- source/blender/imbuf/intern/radiance_hdr.c | 5 +- source/blender/imbuf/intern/tiff.c | 14 +++++- .../io/alembic/exporter/abc_export_capi.cc | 7 ++- source/blender/io/avi/intern/avi_mjpeg.c | 13 ++++-- source/blender/io/avi/intern/avi_mjpeg.h | 5 +- source/blender/io/avi/intern/avi_rgb.c | 5 +- source/blender/io/avi/intern/avi_rgb.h | 5 +- source/blender/io/collada/MeshImporter.cpp | 2 +- source/blender/io/collada/MeshImporter.h | 2 +- source/blender/io/collada/TransformWriter.cpp | 6 +-- source/blender/io/collada/TransformWriter.h | 5 +- source/blender/io/collada/collada_utils.cpp | 2 +- source/blender/io/collada/collada_utils.h | 2 +- source/blender/io/usd/intern/usd_capi.cc | 7 ++- .../makesrna/intern/rna_access_internal.h | 4 +- source/blender/modifiers/intern/MOD_explode.c | 12 ++--- .../nodes/shader/nodes/node_shader_tex_sky.c | 4 +- source/blender/physics/intern/hair_volume.cpp | 2 +- .../blender/physics/intern/implicit_blender.c | 8 ++-- source/blender/python/generic/bgl.c | 2 +- source/blender/python/intern/bpy_capi_utils.h | 2 +- source/blender/python/intern/bpy_interface.c | 2 +- .../python/mathutils/mathutils_geometry.c | 6 +-- .../render/intern/source/multires_bake.c | 7 ++- source/blender/windowmanager/WM_api.h | 7 ++- source/blender/windowmanager/intern/wm_jobs.c | 4 +- 144 files changed, 460 insertions(+), 298 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index df5fc05bfd1..ad8a89cab87 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -14,7 +14,6 @@ Checks: > -readability-else-after-return, -readability-inconsistent-declaration-parameter-name, - -readability-non-const-parameter, -readability-redundant-preprocessor, -readability-function-size, -readability-function-size, diff --git a/source/blender/blenkernel/BKE_appdir.h b/source/blender/blenkernel/BKE_appdir.h index e49fc260810..7e2aaf291c5 100644 --- a/source/blender/blenkernel/BKE_appdir.h +++ b/source/blender/blenkernel/BKE_appdir.h @@ -51,7 +51,7 @@ const char *BKE_appdir_program_path(void); const char *BKE_appdir_program_dir(void); /* Return OS fonts directory. */ -bool BKE_appdir_font_folder_default(char *dir); +bool BKE_appdir_font_folder_default(const char *dir); /* find python executable */ bool BKE_appdir_program_python_search(char *fullpath, diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index d32ab474229..ca41e51984b 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -140,7 +140,7 @@ void BKE_curve_nurbs_vert_coords_apply(struct ListBase *lb, float (*BKE_curve_nurbs_key_vert_coords_alloc(struct ListBase *lb, float *key, int *r_vert_len))[3]; -void BKE_curve_nurbs_key_vert_tilts_apply(struct ListBase *lb, float *key); +void BKE_curve_nurbs_key_vert_tilts_apply(struct ListBase *lb, const float *key); void BKE_curve_editNurb_keyIndex_delCV(struct GHash *keyindex, const void *cv); void BKE_curve_editNurb_keyIndex_free(struct GHash **keyindex); diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index 04b85aebb39..f59e796c98c 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -111,7 +111,7 @@ void BKE_defvert_sync_mapped(struct MDeformVert *dvert_dst, const int *flip_map, const int flip_map_len, const bool use_ensure); -void BKE_defvert_remap(struct MDeformVert *dvert, int *map, const int map_len); +void BKE_defvert_remap(struct MDeformVert *dvert, const int *map, const int map_len); void BKE_defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len); void BKE_defvert_flip_merged(struct MDeformVert *dvert, const int *flip_map, diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index c3a597e29b9..ddd0cc286ab 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -271,7 +271,7 @@ void testhandles_fcurve(struct FCurve *fcu, eBezTriple_Flag sel_flag, const bool void sort_time_fcurve(struct FCurve *fcu); short test_time_fcurve(struct FCurve *fcu); -void correct_bezpart(float v1[2], float v2[2], float v3[2], float v4[2]); +void correct_bezpart(const float v1[2], float v2[2], float v3[2], const float v4[2]); /* -------- Evaluation -------- */ diff --git a/source/blender/blenkernel/BKE_fluid.h b/source/blender/blenkernel/BKE_fluid.h index c958afb212e..2392263181d 100644 --- a/source/blender/blenkernel/BKE_fluid.h +++ b/source/blender/blenkernel/BKE_fluid.h @@ -37,7 +37,7 @@ struct Main; struct Scene; typedef float (*BKE_Fluid_BresenhamFn)( - float *result, float *input, int res[3], int *pixel, float *tRay, float correct); + float *result, const float *input, int res[3], int *pixel, float *tRay, float correct); struct Mesh *BKE_fluid_modifier_do(struct FluidModifierData *fmd, struct Depsgraph *depsgraph, @@ -56,9 +56,9 @@ bool BKE_fluid_reallocate_fluid(struct FluidDomainSettings *fds, int res[3], int void BKE_fluid_reallocate_copy_fluid(struct FluidDomainSettings *fds, int o_res[3], int n_res[3], - int o_min[3], - int n_min[3], - int o_max[3], + const int o_min[3], + const int n_min[3], + const int o_max[3], int o_shift[3], int n_shift[3]); void BKE_fluid_cache_free_all(struct FluidDomainSettings *fds, struct Object *ob); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 7d989bfcf69..b2510be656e 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -513,13 +513,13 @@ void BKE_mesh_loops_to_mface_corners(struct CustomData *fdata, void BKE_mesh_loops_to_tessdata(struct CustomData *fdata, struct CustomData *ldata, struct MFace *mface, - int *polyindices, + const int *polyindices, unsigned int (*loopindices)[4], const int num_faces); void BKE_mesh_tangent_loops_to_tessdata(struct CustomData *fdata, struct CustomData *ldata, struct MFace *mface, - int *polyindices, + const int *polyindices, unsigned int (*loopindices)[4], const int num_faces, const char *layer_name); diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h b/source/blender/blenkernel/BKE_mesh_mapping.h index 9864cc4d28d..5ad5238bbb5 100644 --- a/source/blender/blenkernel/BKE_mesh_mapping.h +++ b/source/blender/blenkernel/BKE_mesh_mapping.h @@ -199,7 +199,7 @@ void BKE_mesh_loop_islands_clear(MeshIslandStore *island_store); void BKE_mesh_loop_islands_free(MeshIslandStore *island_store); void BKE_mesh_loop_islands_add(MeshIslandStore *islands, const int item_num, - int *item_indices, + const int *item_indices, const int num_island_items, int *island_item_indices, const int num_innercut_items, diff --git a/source/blender/blenkernel/BKE_object_deform.h b/source/blender/blenkernel/BKE_object_deform.h index 410cb862aa7..e4813aa2288 100644 --- a/source/blender/blenkernel/BKE_object_deform.h +++ b/source/blender/blenkernel/BKE_object_deform.h @@ -33,7 +33,7 @@ struct Object; struct bDeformGroup; /* General vgroup operations */ -void BKE_object_defgroup_remap_update_users(struct Object *ob, int *map); +void BKE_object_defgroup_remap_update_users(struct Object *ob, const int *map); bool BKE_object_defgroup_array_get(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot); diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index f5e2ea51927..da9280148fd 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -224,7 +224,7 @@ void BKE_pbvh_bounding_box(const PBVH *pbvh, float min[3], float max[3]); unsigned int **BKE_pbvh_grid_hidden(const PBVH *pbvh); int BKE_pbvh_count_grid_quads(BLI_bitmap **grid_hidden, - int *grid_indices, + const int *grid_indices, int totgrid, int gridsize); diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index f919a31c165..a9abe2d0f6d 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -147,7 +147,7 @@ typedef struct PTCacheID { /* copies point data to cache data */ int (*write_point)(int index, void *calldata, void **data, int cfra); /* copies cache cata to point data */ - void (*read_point)(int index, void *calldata, void **data, float cfra, float *old_data); + void (*read_point)(int index, void *calldata, void **data, float cfra, const float *old_data); /* interpolated between previously read point data and cache data */ void (*interpolate_point)(int index, void *calldata, @@ -155,7 +155,7 @@ typedef struct PTCacheID { float cfra, float cfra1, float cfra2, - float *old_data); + const float *old_data); /* copies point data to cache data */ int (*write_stream)(PTCacheFile *pf, void *calldata); diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c index 58337bcf488..b6f219d7351 100644 --- a/source/blender/blenkernel/intern/appdir.c +++ b/source/blender/blenkernel/intern/appdir.c @@ -1019,7 +1019,7 @@ void BKE_tempdir_session_purge(void) } /* Gets a good default directory for fonts */ -bool BKE_appdir_font_folder_default(char *dir) +bool BKE_appdir_font_folder_default(const char *dir) { bool success = false; #ifdef WIN32 diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 7c8c1cf6653..f45cd5b679a 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -1037,7 +1037,7 @@ static void cloth_free_errorsprings(Cloth *cloth, } BLI_INLINE void cloth_bend_poly_dir( - ClothVertex *verts, int i, int j, int *inds, int len, float r_dir[3]) + ClothVertex *verts, int i, int j, const int *inds, int len, float r_dir[3]) { float cent[3] = {0}; float fact = 1.0f / len; diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index c894534c504..e9e44ac05e5 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1157,7 +1157,7 @@ void BKE_nurb_knot_calc_v(Nurb *nu) } static void basisNurb( - float t, short order, int pnts, float *knots, float *basis, int *start, int *end) + float t, short order, int pnts, const float *knots, float *basis, int *start, int *end) { float d, e; int i, i1 = 0, i2 = 0, j, orderpluspnts, opp2, o2; @@ -3560,8 +3560,13 @@ static void free_arrays(void *buffer) } /* computes in which direction to change h[i] to satisfy conditions better */ -static float bezier_relax_direction( - float *a, float *b, float *c, float *d, float *h, int i, int count) +static float bezier_relax_direction(const float *a, + const float *b, + const float *c, + const float *d, + const float *h, + int i, + int count) { /* current deviation between sides of the equation */ float state = a[i] * h[(i + count - 1) % count] + b[i] * h[i] + c[i] * h[(i + 1) % count] - d[i]; @@ -3577,8 +3582,15 @@ static void bezier_lock_unknown(float *a, float *b, float *c, float *d, int i, f d[i] = value; } -static void bezier_restore_equation( - float *a, float *b, float *c, float *d, float *a0, float *b0, float *c0, float *d0, int i) +static void bezier_restore_equation(float *a, + float *b, + float *c, + float *d, + const float *a0, + const float *b0, + const float *c0, + const float *d0, + int i) { a[i] = a0[i]; b[i] = b0[i]; @@ -3586,8 +3598,14 @@ static void bezier_restore_equation( d[i] = d0[i]; } -static bool tridiagonal_solve_with_limits( - float *a, float *b, float *c, float *d, float *h, float *hmin, float *hmax, int solve_count) +static bool tridiagonal_solve_with_limits(float *a, + float *b, + float *c, + float *d, + float *h, + const float *hmin, + const float *hmax, + int solve_count) { float *a0, *b0, *c0, *d0; float **arrays[] = {&a0, &b0, &c0, &d0, NULL}; @@ -3726,7 +3744,7 @@ static bool tridiagonal_solve_with_limits( /* clang-format on */ static void bezier_eq_continuous( - float *a, float *b, float *c, float *d, float *dy, float *l, int i) + float *a, float *b, float *c, float *d, const float *dy, const float *l, int i) { a[i] = l[i] * l[i]; b[i] = 2.0f * (l[i] + 1); @@ -3735,7 +3753,7 @@ static void bezier_eq_continuous( } static void bezier_eq_noaccel_right( - float *a, float *b, float *c, float *d, float *dy, float *l, int i) + float *a, float *b, float *c, float *d, const float *dy, const float *l, int i) { a[i] = 0.0f; b[i] = 2.0f; @@ -3744,7 +3762,7 @@ static void bezier_eq_noaccel_right( } static void bezier_eq_noaccel_left( - float *a, float *b, float *c, float *d, float *dy, float *l, int i) + float *a, float *b, float *c, float *d, const float *dy, const float *l, int i) { a[i] = l[i] * l[i]; b[i] = 2.0f * l[i]; @@ -4823,7 +4841,7 @@ float (*BKE_curve_nurbs_key_vert_coords_alloc(ListBase *lb, float *key, int *r_v return cos; } -void BKE_curve_nurbs_key_vert_tilts_apply(ListBase *lb, float *key) +void BKE_curve_nurbs_key_vert_tilts_apply(ListBase *lb, const float *key) { Nurb *nu; int i; diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c index 48e0ee50d43..9bdd80fd668 100644 --- a/source/blender/blenkernel/intern/data_transfer.c +++ b/source/blender/blenkernel/intern/data_transfer.c @@ -562,7 +562,7 @@ static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(ListBase *r_map CustomData *cd_dst, const bool use_dupref_dst, const int tolayers, - bool *use_layers_src, + const bool *use_layers_src, const int num_layers_src, cd_datatransfer_interp interp, void *interp_data) diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index b97935d57f2..98fc5f9a23a 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -249,7 +249,7 @@ void BKE_defvert_sync_mapped(MDeformVert *dvert_dst, /** * be sure all flip_map values are valid */ -void BKE_defvert_remap(MDeformVert *dvert, int *map, const int map_len) +void BKE_defvert_remap(MDeformVert *dvert, const int *map, const int map_len) { MDeformWeight *dw = dvert->dw; unsigned int i; @@ -1184,7 +1184,7 @@ static bool data_transfer_layersmapping_vgroups_multisrc_to_dst(ListBase *r_map, CustomData *cd_dst, const bool UNUSED(use_dupref_dst), const int tolayers, - bool *use_layers_src, + const bool *use_layers_src, const int num_layers_src) { int idx_src; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 2e1fa519284..b9279ace39f 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -588,7 +588,7 @@ static bool boundsIntersectDist(Bounds3D *b1, Bounds3D *b2, const float dist) } /* check whether bounds intersects a point with given radius */ -static bool boundIntersectPoint(Bounds3D *b, float point[3], const float radius) +static bool boundIntersectPoint(Bounds3D *b, const float point[3], const float radius) { if (!b->valid) { return false; @@ -4780,13 +4780,16 @@ static void dynamic_paint_paint_single_point_cb_ex(void *__restrict userdata, } } -static int dynamicPaint_paintSinglePoint(Depsgraph *depsgraph, - DynamicPaintSurface *surface, - float *pointCoord, - DynamicPaintBrushSettings *brush, - Object *brushOb, - Scene *scene, - float timescale) +static int dynamicPaint_paintSinglePoint( + Depsgraph *depsgraph, + DynamicPaintSurface *surface, + /* Cannot be const, because it is assigned to non-const variable. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + float *pointCoord, + DynamicPaintBrushSettings *brush, + Object *brushOb, + Scene *scene, + float timescale) { PaintSurfaceData *sData = surface->data; float brush_radius = brush->paint_distance * surface->radius_scale; @@ -5456,11 +5459,14 @@ static void dynamic_paint_effect_drip_cb(void *__restrict userdata, } } -static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, - float *force, - PaintPoint *prevPoint, - float timescale, - float steps) +static void dynamicPaint_doEffectStep( + DynamicPaintSurface *surface, + /* Cannot be const, because it is assigned to non-const variable. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + float *force, + PaintPoint *prevPoint, + float timescale, + float steps) { PaintSurfaceData *sData = surface->data; diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index bc14f525c2c..746aff1697c 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1277,7 +1277,7 @@ short test_time_fcurve(FCurve *fcu) * than the horizontal distance between (v1-v4). * This is to prevent curve loops. */ -void correct_bezpart(float v1[2], float v2[2], float v3[2], float v4[2]) +void correct_bezpart(const float v1[2], float v2[2], float v3[2], const float v4[2]) { float h1[2], h2[2], len1, len2, len, fac; diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 1f748487841..bcda77e9d44 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -137,9 +137,9 @@ bool BKE_fluid_reallocate_fluid(FluidDomainSettings *fds, int res[3], int free_o void BKE_fluid_reallocate_copy_fluid(FluidDomainSettings *fds, int o_res[3], int n_res[3], - int o_min[3], - int n_min[3], - int o_max[3], + const int o_min[3], + const int n_min[3], + const int o_max[3], int o_shift[3], int n_shift[3]) { @@ -559,7 +559,7 @@ static bool BKE_fluid_modifier_init( // forward declaration static void manta_smoke_calc_transparency(FluidDomainSettings *fds, ViewLayer *view_layer); static float calc_voxel_transp( - float *result, float *input, int res[3], int *pixel, float *t_ray, float correct); + float *result, const float *input, int res[3], int *pixel, float *t_ray, float correct); static void update_distances(int index, float *fesh_distances, BVHTreeFromMesh *tree_data, @@ -594,8 +594,8 @@ static int get_light(ViewLayer *view_layer, float *light) static void clamp_bounds_in_domain(FluidDomainSettings *fds, int min[3], int max[3], - float *min_vel, - float *max_vel, + const float *min_vel, + const float *max_vel, int margin, float dt) { @@ -1830,7 +1830,7 @@ static void sample_mesh(FluidFlowSettings *ffs, float *velocity_map, int index, const int base_res[3], - float flow_center[3], + const float flow_center[3], BVHTreeFromMesh *tree_data, const float ray_start[3], const float *vert_vel, @@ -4196,7 +4196,7 @@ struct Mesh *BKE_fluid_modifier_do( } static float calc_voxel_transp( - float *result, float *input, int res[3], int *pixel, float *t_ray, float correct) + float *result, const float *input, int res[3], int *pixel, float *t_ray, float correct) { const size_t index = manta_get_index(pixel[0], res[0], pixel[1], res[1], pixel[2]); diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c index dfb0fff1239..b92f86d7aea 100644 --- a/source/blender/blenkernel/intern/gpencil_geom.c +++ b/source/blender/blenkernel/intern/gpencil_geom.c @@ -1146,7 +1146,7 @@ void BKE_gpencil_stroke_2d_flat_ref(const bGPDspoint *ref_points, static void gpencil_calc_stroke_fill_uv(const float (*points2d)[2], bGPDstroke *gps, const float minv[2], - float maxv[2], + const float maxv[2], float (*r_uv)[2]) { const float s = sin(gps->uv_rotation); diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index af8ab22e14b..46a41df0391 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -529,7 +529,13 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float t[4], int cycl) return 0; } -static void flerp(int tot, float *in, float *f0, float *f1, float *f2, float *f3, float *t) +static void flerp(int tot, + float *in, + const float *f0, + const float *f1, + const float *f2, + const float *f3, + const float *t) { int a; @@ -538,7 +544,7 @@ static void flerp(int tot, float *in, float *f0, float *f1, float *f2, float *f3 } } -static void rel_flerp(int tot, float *in, float *ref, float *out, float fac) +static void rel_flerp(int tot, float *in, const float *ref, const float *out, float fac) { int a; diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 49c909850de..7e859799a4e 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -624,7 +624,7 @@ void BKE_mask_point_segment_co(MaskSpline *spline, MaskSplinePoint *point, float co, bezt->vec[1], bezt->vec[2], bezt_next->vec[0], bezt_next->vec[1], u); } -BLI_INLINE void orthogonal_direction_get(float vec[2], float result[2]) +BLI_INLINE void orthogonal_direction_get(const float vec[2], float result[2]) { result[0] = -vec[1]; result[1] = vec[0]; diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index 412ccd3ab39..7f98266becc 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -1256,7 +1256,7 @@ static float maskrasterize_layer_z_depth_quad( return w[2] + w[3]; /* we can make this assumption for small speedup */ } -static float maskrasterize_layer_isect(unsigned int *face, +static float maskrasterize_layer_isect(const unsigned int *face, float (*cos)[3], const float dist_orig, const float xy[2]) @@ -1489,6 +1489,8 @@ static void maskrasterize_buffer_cb(void *__restrict userdata, void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, const unsigned int width, const unsigned int height, + /* Cannot be const, because it is assigned to non-const variable. + * NOLINTNEXTLINE: readability-non-const-parameter. */ float *buffer) { const float x_inv = 1.0f / (float)width; diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index b298a6a2787..49957b584ad 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -2888,7 +2888,7 @@ void BKE_mesh_loops_to_mface_corners( void BKE_mesh_loops_to_tessdata(CustomData *fdata, CustomData *ldata, MFace *mface, - int *polyindices, + const int *polyindices, unsigned int (*loopindices)[4], const int num_faces) { @@ -2981,7 +2981,7 @@ void BKE_mesh_loops_to_tessdata(CustomData *fdata, void BKE_mesh_tangent_loops_to_tessdata(CustomData *fdata, CustomData *ldata, MFace *mface, - int *polyindices, + const int *polyindices, unsigned int (*loopindices)[4], const int num_faces, const char *layer_name) diff --git a/source/blender/blenkernel/intern/mesh_mapping.c b/source/blender/blenkernel/intern/mesh_mapping.c index 4ed9b31dbb5..686f58a0ceb 100644 --- a/source/blender/blenkernel/intern/mesh_mapping.c +++ b/source/blender/blenkernel/intern/mesh_mapping.c @@ -953,7 +953,7 @@ void BKE_mesh_loop_islands_free(MeshIslandStore *island_store) void BKE_mesh_loop_islands_add(MeshIslandStore *island_store, const int item_num, - int *items_indices, + const int *items_indices, const int num_island_items, int *island_item_indices, const int num_innercut_items, diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c index 404d6a581ae..a4991675d2d 100644 --- a/source/blender/blenkernel/intern/mesh_remap.c +++ b/source/blender/blenkernel/intern/mesh_remap.c @@ -1071,7 +1071,7 @@ static void mesh_island_to_astar_graph_edge_process(MeshIslandStore *islands, BLI_bitmap *done_edges, MeshElemMap *edge_to_poly_map, const bool is_edge_innercut, - int *poly_island_index_map, + const int *poly_island_index_map, float (*poly_centers)[3], unsigned char *poly_status) { diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 7e78be6d66e..71d49dd1c19 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -175,7 +175,7 @@ static BLI_bitmap *multires_mdisps_upsample_hidden(BLI_bitmap *lo_hidden, return subd; } -static BLI_bitmap *multires_mdisps_downsample_hidden(BLI_bitmap *old_hidden, +static BLI_bitmap *multires_mdisps_downsample_hidden(const BLI_bitmap *old_hidden, int old_level, int new_level) { diff --git a/source/blender/blenkernel/intern/multires_unsubdivide.c b/source/blender/blenkernel/intern/multires_unsubdivide.c index 6bd7b6b6a98..fa1a53f946e 100644 --- a/source/blender/blenkernel/intern/multires_unsubdivide.c +++ b/source/blender/blenkernel/intern/multires_unsubdivide.c @@ -80,7 +80,7 @@ /** * Used to check if a vertex is in a disconnected element ID. */ -static bool is_vertex_in_id(BMVert *v, int *elem_id, int elem) +static bool is_vertex_in_id(BMVert *v, const int *elem_id, int elem) { const int v_index = BM_elem_index_get(v); return elem_id[v_index] == elem; diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c index 6ca1442497a..51ec89cf77d 100644 --- a/source/blender/blenkernel/intern/object_deform.c +++ b/source/blender/blenkernel/intern/object_deform.c @@ -68,7 +68,7 @@ static Lattice *object_defgroup_lattice_get(ID *id) * * \param map: an array mapping old indices to new indices. */ -void BKE_object_defgroup_remap_update_users(Object *ob, int *map) +void BKE_object_defgroup_remap_update_users(Object *ob, const int *map) { ModifierData *md; ParticleSystem *psys; diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index 609c5c1e580..f94ef946851 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -147,19 +147,19 @@ static void init_complex(fftw_complex cmpl, float real, float image) cmpl[1] = image; } -static void add_comlex_c(fftw_complex res, fftw_complex cmpl1, fftw_complex cmpl2) +static void add_comlex_c(fftw_complex res, const fftw_complex cmpl1, const fftw_complex cmpl2) { res[0] = cmpl1[0] + cmpl2[0]; res[1] = cmpl1[1] + cmpl2[1]; } -static void mul_complex_f(fftw_complex res, fftw_complex cmpl, float f) +static void mul_complex_f(fftw_complex res, const fftw_complex cmpl, float f) { res[0] = cmpl[0] * (double)f; res[1] = cmpl[1] * (double)f; } -static void mul_complex_c(fftw_complex res, fftw_complex cmpl1, fftw_complex cmpl2) +static void mul_complex_c(fftw_complex res, const fftw_complex cmpl1, const fftw_complex cmpl2) { fftwf_complex temp; temp[0] = cmpl1[0] * cmpl2[0] - cmpl1[1] * cmpl2[1]; @@ -178,7 +178,7 @@ static float image_c(fftw_complex cmpl) return cmpl[1]; } -static void conj_complex(fftw_complex res, fftw_complex cmpl1) +static void conj_complex(fftw_complex res, const fftw_complex cmpl1) { res[0] = cmpl1[0]; res[1] = -cmpl1[1]; diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c index 7b9b2484dbe..e0dccd4d14a 100644 --- a/source/blender/blenkernel/intern/particle_distribute.c +++ b/source/blender/blenkernel/intern/particle_distribute.c @@ -433,7 +433,7 @@ static void psys_uv_to_w(float u, float v, int quad, float *w) } /* Find the index in "sum" array before "value" is crossed. */ -static int distribute_binary_search(float *sum, int n, float value) +static int distribute_binary_search(const float *sum, int n, float value) { int mid, low = 0, high = n - 1; diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 870a1f3d673..67988427bd2 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -358,7 +358,7 @@ static void update_vb(PBVH *pbvh, PBVHNode *node, BBC *prim_bbc, int offset, int /* Returns the number of visible quads in the nodes' grids. */ int BKE_pbvh_count_grid_quads(BLI_bitmap **grid_hidden, - int *grid_indices, + const int *grid_indices, int totgrid, int gridsize) { diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index ce5402551b6..9a9d8dc215b 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -206,7 +206,7 @@ static int ptcache_softbody_write(int index, void *soft_v, void **data, int UNUS return 1; } static void ptcache_softbody_read( - int index, void *soft_v, void **data, float UNUSED(cfra), float *old_data) + int index, void *soft_v, void **data, float UNUSED(cfra), const float *old_data) { SoftBody *soft = soft_v; BodyPoint *bp = soft->bpoint + index; @@ -220,8 +220,13 @@ static void ptcache_softbody_read( PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, 0, bp->vec); } } -static void ptcache_softbody_interpolate( - int index, void *soft_v, void **data, float cfra, float cfra1, float cfra2, float *old_data) +static void ptcache_softbody_interpolate(int index, + void *soft_v, + void **data, + float cfra, + float cfra1, + float cfra2, + const float *old_data) { SoftBody *soft = soft_v; BodyPoint *bp = soft->bpoint + index; @@ -316,7 +321,7 @@ static int ptcache_particle_write(int index, void *psys_v, void **data, int cfra return 1 + (pa->state.time >= pa->time && pa->prev_state.time <= pa->time); } static void ptcache_particle_read( - int index, void *psys_v, void **data, float cfra, float *old_data) + int index, void *psys_v, void **data, float cfra, const float *old_data) { ParticleSystem *psys = psys_v; ParticleData *pa; @@ -383,8 +388,13 @@ static void ptcache_particle_read( unit_qt(pa->state.rot); } } -static void ptcache_particle_interpolate( - int index, void *psys_v, void **data, float cfra, float cfra1, float cfra2, float *old_data) +static void ptcache_particle_interpolate(int index, + void *psys_v, + void **data, + float cfra, + float cfra1, + float cfra2, + const float *old_data) { ParticleSystem *psys = psys_v; ParticleData *pa; @@ -528,7 +538,7 @@ static int ptcache_cloth_write(int index, void *cloth_v, void **data, int UNUSED return 1; } static void ptcache_cloth_read( - int index, void *cloth_v, void **data, float UNUSED(cfra), float *old_data) + int index, void *cloth_v, void **data, float UNUSED(cfra), const float *old_data) { ClothModifierData *clmd = cloth_v; Cloth *cloth = clmd->clothObject; @@ -545,8 +555,13 @@ static void ptcache_cloth_read( PTCACHE_DATA_TO(data, BPHYS_DATA_XCONST, 0, vert->xconst); } } -static void ptcache_cloth_interpolate( - int index, void *cloth_v, void **data, float cfra, float cfra1, float cfra2, float *old_data) +static void ptcache_cloth_interpolate(int index, + void *cloth_v, + void **data, + float cfra, + float cfra1, + float cfra2, + const float *old_data) { ClothModifierData *clmd = cloth_v; Cloth *cloth = clmd->clothObject; @@ -1509,7 +1524,7 @@ static int ptcache_rigidbody_write(int index, void *rb_v, void **data, int UNUSE return 1; } static void ptcache_rigidbody_read( - int index, void *rb_v, void **data, float UNUSED(cfra), float *old_data) + int index, void *rb_v, void **data, float UNUSED(cfra), const float *old_data) { RigidBodyWorld *rbw = rb_v; Object *ob = NULL; @@ -1534,8 +1549,13 @@ static void ptcache_rigidbody_read( } } } -static void ptcache_rigidbody_interpolate( - int index, void *rb_v, void **data, float cfra, float cfra1, float cfra2, float *old_data) +static void ptcache_rigidbody_interpolate(int index, + void *rb_v, + void **data, + float cfra, + float cfra1, + float cfra2, + const float *old_data) { RigidBodyWorld *rbw = rb_v; Object *ob = NULL; @@ -1887,7 +1907,7 @@ static int ptcache_sim_particle_write(int index, void *state_v, void **data, int return 1; } static void ptcache_sim_particle_read( - int index, void *state_v, void **data, float UNUSED(cfra), float *UNUSED(old_data)) + int index, void *state_v, void **data, float UNUSED(cfra), const float *UNUSED(old_data)) { ParticleSimulationState *state = (ParticleSimulationState *)state_v; diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index de233a8d473..4a2ad88bb28 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -2668,7 +2668,7 @@ static void RVAddBitmaps_float(float *a, float *b, float *c, int width, int heig } static void RVIsolateHighlights_float( - float *in, float *out, int width, int height, float threshold, float boost, float clamp) + const float *in, float *out, int width, int height, float threshold, float boost, float clamp) { int x, y, index; float intensity; @@ -3423,7 +3423,7 @@ static void do_gaussian_blur_effect_byte_x(Sequence *seq, int y, int frame_width, int UNUSED(frame_height), - unsigned char *rect, + const unsigned char *rect, unsigned char *out) { #define INDEX(_x, _y) (((_y) * (x) + (_x)) * 4) @@ -3473,7 +3473,7 @@ static void do_gaussian_blur_effect_byte_y(Sequence *seq, int y, int UNUSED(frame_width), int frame_height, - unsigned char *rect, + const unsigned char *rect, unsigned char *out) { #define INDEX(_x, _y) (((_y) * (x) + (_x)) * 4) diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c index 604cbf476a8..cdbb2108333 100644 --- a/source/blender/blenkernel/intern/seqmodifier.c +++ b/source/blender/blenkernel/intern/seqmodifier.c @@ -331,7 +331,7 @@ static void curves_apply_threaded(int width, unsigned char *rect, float *rect_float, unsigned char *mask_rect, - float *mask_rect_float, + const float *mask_rect_float, void *data_v) { CurveMapping *curve_mapping = (CurveMapping *)data_v; @@ -556,7 +556,7 @@ static void brightcontrast_apply_threaded(int width, unsigned char *rect, float *rect_float, unsigned char *mask_rect, - float *mask_rect_float, + const float *mask_rect_float, void *data_v) { BrightContrastThreadData *data = (BrightContrastThreadData *)data_v; @@ -658,7 +658,7 @@ static void maskmodifier_apply_threaded(int width, unsigned char *rect, float *rect_float, unsigned char *mask_rect, - float *mask_rect_float, + const float *mask_rect_float, void *UNUSED(data_v)) { int x, y; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 01d2176ba30..bde94f366b9 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -2390,7 +2390,7 @@ static void color_balance_byte_float(StripColorBalance *cb_, static void color_balance_float_float(StripColorBalance *cb_, float *rect_float, - float *mask_rect_float, + const float *mask_rect_float, int width, int height, float mul) diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index fe4600b9121..35bb34f7837 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -147,7 +147,7 @@ int BLI_access(const char *filename, int mode) ATTR_WARN_UNUSED_RESULT ATTR_NONN bool BLI_file_is_writable(const char *file) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); bool BLI_file_touch(const char *file) ATTR_NONNULL(); -bool BLI_file_alias_target(char *target, const char *filepath); +bool BLI_file_alias_target(const char *target, const char *filepath); #if 0 /* UNUSED */ int BLI_file_gzip(const char *from, const char *to) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index ba95da4092e..48f8e7d31d9 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -148,8 +148,12 @@ void blackbody_temperature_to_rgb_table(float *r_table, int width, float min, fl /********* lift/gamma/gain / ASC-CDL conversion ***********/ -void lift_gamma_gain_to_asc_cdl( - float *lift, float *gamma, float *gain, float *offset, float *slope, float *power); +void lift_gamma_gain_to_asc_cdl(const float *lift, + const float *gamma, + const float *gain, + float *offset, + float *slope, + float *power); #if BLI_MATH_DO_INLINE # include "intern/math_color_inline.c" diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index 2d11797bc34..33fcd750aee 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -64,7 +64,7 @@ void swap_m3m3(float A[3][3], float B[3][3]); void swap_m4m4(float A[4][4], float B[4][4]); /* Build index shuffle matrix */ -void shuffle_m4(float R[4][4], int index[4]); +void shuffle_m4(float R[4][4], const int index[4]); /******************************** Arithmetic *********************************/ diff --git a/source/blender/blenlib/BLI_rand.h b/source/blender/blenlib/BLI_rand.h index ae78ea3af16..c55bbd26db5 100644 --- a/source/blender/blenlib/BLI_rand.h +++ b/source/blender/blenlib/BLI_rand.h @@ -105,12 +105,12 @@ int BLI_rng_thread_rand(RNG_THREAD_ARRAY *rngarr, int thread) ATTR_WARN_UNUSED_R /** Return the _n_th number of the given low-discrepancy sequence. */ void BLI_halton_1d(unsigned int prime, double offset, int n, double *r); -void BLI_halton_2d(unsigned int prime[2], double offset[2], int n, double *r); -void BLI_halton_3d(unsigned int prime[3], double offset[3], int n, double *r); +void BLI_halton_2d(const unsigned int prime[2], double offset[2], int n, double *r); +void BLI_halton_3d(const unsigned int prime[3], double offset[3], int n, double *r); void BLI_hammersley_1d(unsigned int n, double *r); /** Return the whole low-discrepancy sequence up to _n_. */ -void BLI_halton_2d_sequence(unsigned int prime[2], double offset[2], int n, double *r); +void BLI_halton_2d_sequence(const unsigned int prime[2], double offset[2], int n, double *r); void BLI_hammersley_2d_sequence(unsigned int n, double *r); #ifdef __cplusplus diff --git a/source/blender/blenlib/BLI_voxel.h b/source/blender/blenlib/BLI_voxel.h index 220ab9b3705..82854c57928 100644 --- a/source/blender/blenlib/BLI_voxel.h +++ b/source/blender/blenlib/BLI_voxel.h @@ -35,10 +35,13 @@ extern "C" { (int64_t)(z) * (int64_t)(res)[0] * (int64_t)(res)[1]) /* all input coordinates must be in bounding box 0.0 - 1.0 */ -float BLI_voxel_sample_nearest(float *data, const int res[3], const float co[3]); -float BLI_voxel_sample_trilinear(float *data, const int res[3], const float co[3]); -float BLI_voxel_sample_triquadratic(float *data, const int res[3], const float co[3]); -float BLI_voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline); +float BLI_voxel_sample_nearest(const float *data, const int res[3], const float co[3]); +float BLI_voxel_sample_trilinear(const float *data, const int res[3], const float co[3]); +float BLI_voxel_sample_triquadratic(const float *data, const int res[3], const float co[3]); +float BLI_voxel_sample_tricubic(const float *data, + const int res[3], + const float co[3], + int bspline); #ifdef __cplusplus } diff --git a/source/blender/blenlib/intern/delaunay_2d.c b/source/blender/blenlib/intern/delaunay_2d.c index ad6d824be9b..5f663dcb2e1 100644 --- a/source/blender/blenlib/intern/delaunay_2d.c +++ b/source/blender/blenlib/intern/delaunay_2d.c @@ -4320,7 +4320,7 @@ static void exactinit(void) */ static int fast_expansion_sum_zeroelim( - int elen, double *e, int flen, double *f, double *h) /* h cannot be e or f. */ + int elen, const double *e, int flen, const double *f, double *h) /* h cannot be e or f. */ { double Q; INEXACT double Qnew; @@ -4405,7 +4405,7 @@ static int fast_expansion_sum_zeroelim( */ static int scale_expansion_zeroelim(int elen, - double *e, + const double *e, double b, double *h) /* e and h cannot be the same. */ { @@ -4451,7 +4451,7 @@ static int scale_expansion_zeroelim(int elen, * See either version of my paper for details. */ -static double estimate(int elen, double *e) +static double estimate(int elen, const double *e) { double Q; int eindex; diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index 625849c01df..651a062e3d5 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -503,8 +503,12 @@ int constrain_rgb(float *r, float *g, float *b) /* ********************** lift/gamma/gain / ASC-CDL conversion ********************************* */ -void lift_gamma_gain_to_asc_cdl( - float *lift, float *gamma, float *gain, float *offset, float *slope, float *power) +void lift_gamma_gain_to_asc_cdl(const float *lift, + const float *gamma, + const float *gain, + float *offset, + float *slope, + float *power) { int c; for (c = 0; c < 3; c++) { diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 92cfd09f191..fadd7d83444 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -248,7 +248,7 @@ void swap_m4m4(float m1[4][4], float m2[4][4]) } } -void shuffle_m4(float R[4][4], int index[4]) +void shuffle_m4(float R[4][4], const int index[4]) { zero_m4(R); for (int k = 0; k < 4; k++) { diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 42b5ba28f5a..1ae1c91a3bd 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -27,7 +27,7 @@ #include "BLI_noise.h" /* local */ -static float noise3_perlin(float vec[3]); +static float noise3_perlin(const float vec[3]); // static float turbulence_perlin(const float point[3], float lofreq, float hifreq); // static float turbulencep(float noisesize, float x, float y, float z, int nr); @@ -779,7 +779,7 @@ static const float g_perlin_data_v3[512 + 2][3] = { } \ (void)0 -static float noise3_perlin(float vec[3]) +static float noise3_perlin(const float vec[3]) { const char *p = g_perlin_data_ub; const float(*g)[3] = g_perlin_data_v3; diff --git a/source/blender/blenlib/intern/rand.cc b/source/blender/blenlib/intern/rand.cc index 3dbe33764a9..279682ea171 100644 --- a/source/blender/blenlib/intern/rand.cc +++ b/source/blender/blenlib/intern/rand.cc @@ -302,7 +302,7 @@ void BLI_halton_1d(unsigned int prime, double offset, int n, double *r) } } -void BLI_halton_2d(unsigned int prime[2], double offset[2], int n, double *r) +void BLI_halton_2d(const unsigned int prime[2], double offset[2], int n, double *r) { const double invprimes[2] = {1.0 / (double)prime[0], 1.0 / (double)prime[1]}; @@ -315,7 +315,7 @@ void BLI_halton_2d(unsigned int prime[2], double offset[2], int n, double *r) } } -void BLI_halton_3d(unsigned int prime[3], double offset[3], int n, double *r) +void BLI_halton_3d(const unsigned int prime[3], double offset[3], int n, double *r) { const double invprimes[3] = { 1.0 / (double)prime[0], 1.0 / (double)prime[1], 1.0 / (double)prime[2]}; @@ -329,7 +329,7 @@ void BLI_halton_3d(unsigned int prime[3], double offset[3], int n, double *r) } } -void BLI_halton_2d_sequence(unsigned int prime[2], double offset[2], int n, double *r) +void BLI_halton_2d_sequence(const unsigned int prime[2], double offset[2], int n, double *r) { const double invprimes[2] = {1.0 / (double)prime[0], 1.0 / (double)prime[1]}; diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 96a7445462d..e3a2b6b4992 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -290,7 +290,7 @@ eFileAttributes BLI_file_attributes(const char *path) /* Return alias/shortcut file target. Apple version is defined in storage_apple.mm */ #ifndef __APPLE__ -bool BLI_file_alias_target(char target[FILE_MAXDIR], const char *filepath) +bool BLI_file_alias_target(const char target[FILE_MAXDIR], const char *filepath) { # ifdef WIN32 if (!BLI_path_extension_check(filepath, ".lnk")) { diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c index 53db49aa59c..20edbb97561 100644 --- a/source/blender/blenlib/intern/system.c +++ b/source/blender/blenlib/intern/system.c @@ -111,7 +111,11 @@ void BLI_system_backtrace(FILE *fp) /* NOTE: The code for CPU brand string is adopted from Cycles. */ #if !defined(_WIN32) || defined(FREE_WINDOWS) -static void __cpuid(int data[4], int selector) +static void __cpuid( + /* Cannot be const, because it is modified below. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + int data[4], + int selector) { # if defined(__x86_64__) asm("cpuid" : "=a"(data[0]), "=b"(data[1]), "=c"(data[2]), "=d"(data[3]) : "a"(selector)); diff --git a/source/blender/blenlib/intern/voronoi_2d.c b/source/blender/blenlib/intern/voronoi_2d.c index 59270c58341..bc11a2c7a1c 100644 --- a/source/blender/blenlib/intern/voronoi_2d.c +++ b/source/blender/blenlib/intern/voronoi_2d.c @@ -213,7 +213,7 @@ static void voronoiParabola_setRight(VoronoiParabola *parabola, VoronoiParabola right->parent = parabola; } -static float voronoi_getY(VoronoiProcess *process, float p[2], float x) +static float voronoi_getY(VoronoiProcess *process, const float p[2], float x) { float ly = process->current_y; diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c index c7c794957c2..2c8eb9f5a13 100644 --- a/source/blender/blenlib/intern/voxel.c +++ b/source/blender/blenlib/intern/voxel.c @@ -26,7 +26,7 @@ #include "BLI_strict_flags.h" -BLI_INLINE float D(float *data, const int res[3], int x, int y, int z) +BLI_INLINE float D(const float *data, const int res[3], int x, int y, int z) { CLAMP(x, 0, res[0] - 1); CLAMP(y, 0, res[1] - 1); @@ -36,7 +36,7 @@ BLI_INLINE float D(float *data, const int res[3], int x, int y, int z) /* *** nearest neighbor *** */ /* input coordinates must be in bounding box 0.0 - 1.0 */ -float BLI_voxel_sample_nearest(float *data, const int res[3], const float co[3]) +float BLI_voxel_sample_nearest(const float *data, const int res[3], const float co[3]) { int xi, yi, zi; @@ -65,7 +65,7 @@ BLI_INLINE int64_t _clamp(int a, int b, int c) return (a < b) ? b : ((a > c) ? c : a); } -float BLI_voxel_sample_trilinear(float *data, const int res[3], const float co[3]) +float BLI_voxel_sample_trilinear(const float *data, const int res[3], const float co[3]) { if (data) { @@ -106,7 +106,7 @@ float BLI_voxel_sample_trilinear(float *data, const int res[3], const float co[3 return 0.f; } -float BLI_voxel_sample_triquadratic(float *data, const int res[3], const float co[3]) +float BLI_voxel_sample_triquadratic(const float *data, const int res[3], const float co[3]) { if (data) { @@ -161,7 +161,10 @@ float BLI_voxel_sample_triquadratic(float *data, const int res[3], const float c return 0.f; } -float BLI_voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline) +float BLI_voxel_sample_tricubic(const float *data, + const int res[3], + const float co[3], + int bspline) { if (data) { diff --git a/source/blender/bmesh/tools/bmesh_region_match.c b/source/blender/bmesh/tools/bmesh_region_match.c index 8de23b696bf..d222ea214c4 100644 --- a/source/blender/bmesh/tools/bmesh_region_match.c +++ b/source/blender/bmesh/tools/bmesh_region_match.c @@ -1299,7 +1299,9 @@ static UUIDFashMatch *bm_vert_fasthash_create(BMesh *bm, const uint depth) return id_curr; } -static void bm_vert_fasthash_edge_order(UUIDFashMatch *fm, const BMEdge *e, UUIDFashMatch e_fm[2]) +static void bm_vert_fasthash_edge_order(const UUIDFashMatch *fm, + const BMEdge *e, + UUIDFashMatch e_fm[2]) { e_fm[0] = fm[BM_elem_index_get(e->v1)]; e_fm[1] = fm[BM_elem_index_get(e->v2)]; diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp index ae6f49bffcd..84f7fe2d225 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp @@ -26,8 +26,8 @@ // this part has been copied from the double edge mask static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, - unsigned int *limask, - unsigned int *lomask, + const unsigned int *limask, + const unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) @@ -196,8 +196,8 @@ static void do_adjacentKeepBorders(unsigned int t, static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, - unsigned int *limask, - unsigned int *lomask, + const unsigned int *limask, + const unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) @@ -417,8 +417,8 @@ static void do_adjacentBleedBorders(unsigned int t, static void do_allKeepBorders(unsigned int t, unsigned int rw, - unsigned int *limask, - unsigned int *lomask, + const unsigned int *limask, + const unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) @@ -579,8 +579,8 @@ static void do_allKeepBorders(unsigned int t, static void do_allBleedBorders(unsigned int t, unsigned int rw, - unsigned int *limask, - unsigned int *lomask, + const unsigned int *limask, + const unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) @@ -793,8 +793,8 @@ static void do_allBleedBorders(unsigned int t, static void do_allEdgeDetection(unsigned int t, unsigned int rw, - unsigned int *limask, - unsigned int *lomask, + const unsigned int *limask, + const unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, @@ -863,8 +863,8 @@ static void do_allEdgeDetection(unsigned int t, static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, - unsigned int *limask, - unsigned int *lomask, + const unsigned int *limask, + const unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, @@ -935,7 +935,7 @@ static void do_adjacentEdgeDetection(unsigned int t, static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, - unsigned int *lres, + const unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, @@ -1060,7 +1060,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, static void do_fillGradientBuffer(unsigned int rw, float *res, - unsigned short *gbuf, + const unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp index b43b94af06a..0087c720ac0 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp @@ -198,7 +198,7 @@ static void FHT2D( //------------------------------------------------------------------------------ /* 2D convolution calc, d1 *= d2, M/N - > log2 of width/height */ -static void fht_convolve(fREAL *d1, fREAL *d2, unsigned int M, unsigned int N) +static void fht_convolve(fREAL *d1, const fREAL *d2, unsigned int M, unsigned int N) { fREAL a, b; unsigned int i, j, k, L, mj, mL; diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp index 56caa68fd35..56e0ab9b93f 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp @@ -514,7 +514,7 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove) /* we make this into 3 points, center point is (0, 0) */ /* and offset the center point just enough to make curve go through midpoint */ -static void quad_bezier_2d(float *result, float *v1, float *v2, float *ipodata) +static void quad_bezier_2d(float *result, const float *v1, const float *v2, const float *ipodata) { float p1[2], p2[2], p3[2]; diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 8c17ecd3905..143945b637a 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -114,8 +114,8 @@ void EEVEE_material_bind_resources(DRWShadingGroup *shgrp, GPUMaterial *gpumat, EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, - int *ssr_id, - float *refract_depth, + const int *ssr_id, + const float *refract_depth, bool use_ssrefraction, bool use_alpha_blend) { diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index 3edb649768c..1b1355fdecd 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -1012,8 +1012,8 @@ void EEVEE_material_bind_resources(DRWShadingGroup *shgrp, struct GPUMaterial *gpumat, EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, - int *ssr_id, - float *refract_depth, + const int *ssr_id, + const float *refract_depth, bool use_ssrefraction, bool use_alpha_blend); /* eevee_lights.c */ diff --git a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c index 714481c39f1..87ded7ef7ca 100644 --- a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c +++ b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c @@ -96,7 +96,7 @@ static void invert_cdf(const float cdf[FILTER_CDF_TABLE_SIZE], } /* Evaluate a discrete function table with linear interpolation. */ -static float eval_table(float *table, float x) +static float eval_table(const float *table, float x) { CLAMP(x, 0.0f, 1.0f); x = x * (FILTER_CDF_TABLE_SIZE - 1); diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c index 7ccb5d5a753..daf83e11e17 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.c +++ b/source/blender/draw/engines/overlay/overlay_armature.c @@ -2118,7 +2118,7 @@ static void armature_context_setup(ArmatureDrawContext *ctx, const bool do_envelope_dist, const bool is_edit_mode, const bool is_pose_mode, - float *const_color) + const float *const_color) { const bool is_object_mode = !do_envelope_dist; const bool is_xray = (ob->dtx & OB_DRAWXRAY) != 0 || (pd->armature.do_pose_xray && is_pose_mode); diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c index c0407345729..f096c9657c7 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.c +++ b/source/blender/draw/engines/overlay/overlay_extra.c @@ -1356,7 +1356,7 @@ static void OVERLAY_volume_extra(OVERLAY_ExtraCallBuffers *cb, Object *ob, ModifierData *md, Scene *scene, - float *color) + const float *color) { FluidModifierData *fmd = (FluidModifierData *)md; FluidDomainSettings *fds = fmd->domain; diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 555043ab408..1ab5ec18f65 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -623,7 +623,7 @@ void DRW_render_object_iter(void *vedata, struct RenderEngine *engine, struct Depsgraph *depsgraph)); void DRW_render_instance_buffer_finish(void); -void DRW_render_viewport_size_set(int size[2]); +void DRW_render_viewport_size_set(const int size[2]); void DRW_custom_pipeline(DrawEngineType *draw_engine_type, struct Depsgraph *depsgraph, diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 3e42c4cdb23..5359f649d6b 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -369,7 +369,7 @@ void DRW_engine_viewport_data_size_get( } /* WARNING: only use for custom pipeline. 99% of the time, you don't want to use this. */ -void DRW_render_viewport_size_set(int size[2]) +void DRW_render_viewport_size_set(const int size[2]) { DST.size[0] = size[0]; DST.size[1] = size[1]; diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index 31a2dd7f0fe..ab87760942c 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -583,7 +583,7 @@ void drw_state_set(DRWState state); void drw_debug_draw(void); void drw_debug_init(void); -eDRWCommandType command_type_get(uint64_t *command_type_bits, int index); +eDRWCommandType command_type_get(const uint64_t *command_type_bits, int index); void drw_batch_cache_validate(Object *ob); void drw_batch_cache_generate_requested(struct Object *ob); diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index 3d83b918757..52238d2ffa4 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -623,7 +623,7 @@ static void command_type_set(uint64_t *command_type_bits, int index, eDRWCommand command_type_bits[index / 16] |= ((uint64_t)type) << ((index % 16) * 4); } -eDRWCommandType command_type_get(uint64_t *command_type_bits, int index) +eDRWCommandType command_type_get(const uint64_t *command_type_bits, int index) { return ((command_type_bits[index / 16] >> ((index % 16) * 4)) & 0xF); } diff --git a/source/blender/draw/intern/draw_manager_shader.c b/source/blender/draw/intern/draw_manager_shader.c index 6304b707cb9..592b030c45e 100644 --- a/source/blender/draw/intern/draw_manager_shader.c +++ b/source/blender/draw/intern/draw_manager_shader.c @@ -91,10 +91,13 @@ static void drw_deferred_shader_queue_free(ListBase *queue) } } -static void drw_deferred_shader_compilation_exec(void *custom_data, - short *stop, - short *do_update, - float *progress) +static void drw_deferred_shader_compilation_exec( + void *custom_data, + /* Cannot be const, this function implements wm_jobs_start_callback. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + short *stop, + short *do_update, + float *progress) { DRWShaderCompiler *comp = (DRWShaderCompiler *)custom_data; void *gl_context = comp->gl_context; diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index d823b976a47..bcdbf4c74f0 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -540,7 +540,7 @@ static void draw_markers_background(rctf *rect) immUnbindProgram(); } -static bool marker_is_in_frame_range(TimeMarker *marker, int frame_range[2]) +static bool marker_is_in_frame_range(TimeMarker *marker, const int frame_range[2]) { if (marker->frame < frame_range[0]) { return false; diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 23fb6c0ab27..11066595e2e 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -655,7 +655,7 @@ void heat_bone_weighting(Object *ob, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], - int *selected, + const int *selected, const char **err_str) { LaplacianSystem *sys; @@ -1236,7 +1236,7 @@ static float meshdeform_boundary_phi(const MeshDeformBind *mdb, } static float meshdeform_interp_w(MeshDeformBind *mdb, - float *gridvec, + const float *gridvec, float *UNUSED(vec), int UNUSED(cagevert)) { diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h index ef4759eab4a..0a9e6e878e4 100644 --- a/source/blender/editors/armature/meshlaplacian.h +++ b/source/blender/editors/armature/meshlaplacian.h @@ -56,7 +56,7 @@ void heat_bone_weighting(struct Object *ob, struct bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], - int *selected, + const int *selected, const char **error); #ifdef RIGID_DEFORM diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index dd5e16a9d9b..a695d2e4cf2 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -2245,7 +2245,7 @@ static void gpencil_copy_points( } static void gpencil_insert_point( - bGPDstroke *gps, bGPDspoint *a_pt, bGPDspoint *b_pt, const float co_a[3], float co_b[3]) + bGPDstroke *gps, bGPDspoint *a_pt, bGPDspoint *b_pt, const float co_a[3], const float co_b[3]) { bGPDspoint *temp_points; int totnewpoints, oldtotpoints; @@ -2764,7 +2764,7 @@ void ED_gpencil_init_random_settings(Brush *brush, } static void gpencil_sbuffer_vertex_color_random( - bGPdata *gpd, Brush *brush, tGPspoint *tpt, float random_color[3], float pen_pressure) + bGPdata *gpd, Brush *brush, tGPspoint *tpt, const float random_color[3], float pen_pressure) { BrushGpencilSettings *brush_settings = brush->gpencil_settings; if (brush_settings->flag & GP_BRUSH_GROUP_RANDOM) { @@ -2895,7 +2895,7 @@ void ED_gpencil_sbuffer_vertex_color_set(Depsgraph *depsgraph, /* Check if the stroke collides with brush. */ bool ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc, bGPDstroke *gps, - float mouse[2], + const float mouse[2], const int radius, const float diff_mat[4][4]) { diff --git a/source/blender/editors/gpencil/gpencil_vertex_paint.c b/source/blender/editors/gpencil/gpencil_vertex_paint.c index 5f8ff228d4d..c36bc4388d7 100644 --- a/source/blender/editors/gpencil/gpencil_vertex_paint.c +++ b/source/blender/editors/gpencil/gpencil_vertex_paint.c @@ -348,7 +348,7 @@ static void gpencil_grid_cell_average_color_idx_get(tGP_BrushVertexpaintData *gs } } -static int gpencil_grid_cell_index_get(tGP_BrushVertexpaintData *gso, int pc[2]) +static int gpencil_grid_cell_index_get(tGP_BrushVertexpaintData *gso, const int pc[2]) { float bottom[2], top[2]; diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index a523e924e54..8a239559627 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -106,7 +106,7 @@ struct FileSelectParams *ED_fileselect_get_params(struct SpaceFile *sfile); short ED_fileselect_set_params(struct SpaceFile *sfile); void ED_fileselect_set_params_from_userdef(struct SpaceFile *sfile); void ED_fileselect_params_to_userdef(struct SpaceFile *sfile, - int temp_win_size[], + const int temp_win_size[], const bool is_maximized); void ED_fileselect_reset_params(struct SpaceFile *sfile); diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index f961f835f12..64276706759 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -351,7 +351,7 @@ void ED_gpencil_init_random_settings(struct Brush *brush, bool ED_gpencil_stroke_check_collision(struct GP_SpaceConversion *gsc, struct bGPDstroke *gps, - float mouse[2], + const float mouse[2], const int radius, const float diff_mat[4][4]); bool ED_gpencil_stroke_point_is_inside(struct bGPDstroke *gps, diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index a8476e3d1ca..e8343fbbc19 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -125,8 +125,8 @@ void ED_image_draw_info(struct Scene *scene, const unsigned char cp[4], const float fp[4], const float linearcol[4], - int *zp, - float *zpf); + const int *zp, + const float *zpf); bool ED_space_image_show_cache(struct SpaceImage *sima); diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index 47ccc0788c2..382902cd2de 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -121,7 +121,7 @@ void ED_operatormacros_node(void); bool ED_space_node_color_sample(struct Main *bmain, struct SpaceNode *snode, struct ARegion *region, - int mval[2], + const int mval[2], float r_col[3]); #ifdef __cplusplus diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 5e706856738..f8a4884c594 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -150,7 +150,7 @@ void ED_view3d_cursor3d_update(struct bContext *C, struct Camera *ED_view3d_camera_data_get(struct View3D *v3d, struct RegionView3D *rv3d); void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], const float dist); -void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], float *dist); +void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], const float *dist); void ED_view3d_from_object( const struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens); @@ -502,7 +502,7 @@ bool ED_view3d_autodist_simple(struct ARegion *region, const int mval[2], float mouse_worldloc[3], int margin, - float *force_depth); + const float *force_depth); bool ED_view3d_autodist_depth(struct ARegion *region, const int mval[2], int margin, float *depth); bool ED_view3d_autodist_depth_seg(struct ARegion *region, const int mval_sta[2], diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index d93e8809ed2..7ce74a87ea0 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -1506,7 +1506,7 @@ uiBut *uiDefHotKeyevtButS(uiBlock *block, short width, short height, short *keypoin, - short *modkeypoin, + const short *modkeypoin, const char *tip); uiBut *uiDefSearchBut(uiBlock *block, diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index f4207d83e11..ca89c5f606f 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -6262,7 +6262,7 @@ uiBut *uiDefHotKeyevtButS(uiBlock *block, short width, short height, short *keypoin, - short *modkeypoin, + const short *modkeypoin, const char *tip) { uiBut *but = ui_def_but(block, diff --git a/source/blender/editors/lattice/editlattice_select.c b/source/blender/editors/lattice/editlattice_select.c index 0b62934d190..49cf4779496 100644 --- a/source/blender/editors/lattice/editlattice_select.c +++ b/source/blender/editors/lattice/editlattice_select.c @@ -268,7 +268,7 @@ void LATTICE_OT_select_mirror(wmOperatorType *ot) * \{ */ static bool lattice_test_bitmap_uvw( - Lattice *lt, BLI_bitmap *selpoints, int u, int v, int w, const bool selected) + Lattice *lt, const BLI_bitmap *selpoints, int u, int v, int w, const bool selected) { if ((u < 0 || u >= lt->pntsu) || (v < 0 || v >= lt->pntsv) || (w < 0 || w >= lt->pntsw)) { return false; diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c index b7fd661d8e6..c19a5b8ef68 100644 --- a/source/blender/editors/mask/mask_add.c +++ b/source/blender/editors/mask/mask_add.c @@ -439,7 +439,7 @@ static bool add_vertex_new(const bContext *C, Mask *mask, MaskLayer *mask_layer, /* Convert coordinate from normalized space to pixel one. * TODO(sergey): Make the function more generally available. */ static void mask_point_make_pixel_space(bContext *C, - float point_normalized[2], + const float point_normalized[2], float point_pixel[2]) { ScrArea *area = CTX_wm_area(C); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index b60e0074512..2f0969402ef 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1029,7 +1029,7 @@ bool EDBM_vert_color_check(BMEditMesh *em) /** \name Mirror Cache API * \{ */ -static BMVert *cache_mirr_intptr_as_bmvert(intptr_t *index_lookup, int index) +static BMVert *cache_mirr_intptr_as_bmvert(const intptr_t *index_lookup, int index) { intptr_t eve_i = index_lookup[index]; return (eve_i == -1) ? NULL : (BMVert *)eve_i; diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 892aea6048f..be7b824fc3e 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -875,8 +875,12 @@ static bool paint_draw_alpha_overlay(UnifiedPaintSettings *ups, return alpha_overlay_active; } -BLI_INLINE void draw_tri_point( - uint pos, const float sel_col[4], float pivot_col[4], float *co, float width, bool selected) +BLI_INLINE void draw_tri_point(uint pos, + const float sel_col[4], + const float pivot_col[4], + float *co, + float width, + bool selected) { immUniformColor4fv(selected ? sel_col : pivot_col); @@ -905,8 +909,12 @@ BLI_INLINE void draw_tri_point( immEnd(); } -BLI_INLINE void draw_rect_point( - uint pos, const float sel_col[4], float handle_col[4], float *co, float width, bool selected) +BLI_INLINE void draw_rect_point(uint pos, + const float sel_col[4], + const float handle_col[4], + const float *co, + float width, + bool selected) { immUniformColor4fv(selected ? sel_col : handle_col); diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 16ccfaf8286..a7f09390a3d 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -257,7 +257,7 @@ static ushort *brush_painter_mask_ibuf_new(BrushPainter *painter, const int size /* update rectangular section of the brush image */ static void brush_painter_mask_imbuf_update(BrushPainter *painter, ImagePaintTile *tile, - ushort *tex_mask_old, + const ushort *tex_mask_old, int origx, int origy, int w, @@ -1052,7 +1052,7 @@ static void paint_2d_lift_soften(ImagePaintState *s, ImagePaintTile *tile, ImBuf *ibuf, ImBuf *ibufb, - int *pos, + const int *pos, const short paint_tile) { bool sharpen = (tile->cache.invert ^ ((s->brush->flag & BRUSH_DIR_IN) != 0)); @@ -1255,7 +1255,7 @@ static void paint_2d_lift_smear(ImBuf *ibuf, ImBuf *ibufb, int *pos, short paint } } -static ImBuf *paint_2d_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos) +static ImBuf *paint_2d_lift_clone(ImBuf *ibuf, ImBuf *ibufb, const int *pos) { /* note: allocImbuf returns zero'd memory, so regions outside image will * have zero alpha, and hence not be blended onto the image */ diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c index 048f11c92d7..d05b1673c9a 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c @@ -206,7 +206,7 @@ void PAINT_OT_vertex_color_from_weight(wmOperatorType *ot) /** \name Smooth Vertex Colors Operator * \{ */ -static void vertex_color_smooth_looptag(Mesh *me, bool *mlooptag) +static void vertex_color_smooth_looptag(Mesh *me, const bool *mlooptag) { const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0; const MPoly *mp; diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c index 6ca45ee0fb8..6a2137b6626 100644 --- a/source/blender/editors/sculpt_paint/sculpt_cloth.c +++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c @@ -437,13 +437,16 @@ static void do_cloth_brush_solve_simulation_task_cb_ex( BKE_pbvh_vertex_iter_end; } -static void cloth_brush_build_nodes_constraints(Sculpt *sd, - Object *ob, - PBVHNode **nodes, - int totnode, - SculptClothSimulation *cloth_sim, - float initial_location[3], - const float radius) +static void cloth_brush_build_nodes_constraints( + Sculpt *sd, + Object *ob, + PBVHNode **nodes, + int totnode, + SculptClothSimulation *cloth_sim, + /* Cannot be const, because it is assigned to a non-const variable. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + float initial_location[3], + const float radius) { Brush *brush = BKE_paint_brush(&sd->paint); diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index a69601316ef..9da75ab7e3c 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -1403,6 +1403,8 @@ static void do_sequence_proxy(void *pjv, int build_count, int *build_undistort_sizes, int build_undistort_count, + /* Cannot be const, because it is assigned to a non-const variable. + * NOLINTNEXTLINE: readability-non-const-parameter. */ short *stop, short *do_update, float *progress) diff --git a/source/blender/editors/space_clip/tracking_ops_track.c b/source/blender/editors/space_clip/tracking_ops_track.c index cec7b371457..afbca48bd45 100644 --- a/source/blender/editors/space_clip/tracking_ops_track.c +++ b/source/blender/editors/space_clip/tracking_ops_track.c @@ -214,7 +214,13 @@ static bool track_markers_initjob(bContext *C, TrackMarkersJob *tmj, bool backwa return true; } -static void track_markers_startjob(void *tmv, short *stop, short *do_update, float *progress) +static void track_markers_startjob( + void *tmv, + /* Cannot be const, this function implements wm_jobs_start_callback. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + short *stop, + short *do_update, + float *progress) { TrackMarkersJob *tmj = (TrackMarkersJob *)tmv; int framenr = tmj->sfra; diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c index 81cc858c69f..b6f9ca9589f 100644 --- a/source/blender/editors/space_clip/tracking_select.c +++ b/source/blender/editors/space_clip/tracking_select.c @@ -731,7 +731,9 @@ void CLIP_OT_select_lasso(wmOperatorType *ot) /********************** circle select operator *********************/ -static int point_inside_ellipse(float point[2], float offset[2], float ellipse[2]) +static int point_inside_ellipse(const float point[2], + const float offset[2], + const float ellipse[2]) { /* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */ float x, y; diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index cb785495ad5..5d0db9eaa2e 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -2809,7 +2809,7 @@ static void filelist_readjob_main_recursive(Main *bmain, FileList *filelist) static void filelist_readjob_do(const bool do_lib, FileList *filelist, const char *main_name, - short *stop, + const short *stop, short *do_update, float *progress, ThreadMutex *lock) diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index e6c40dce9c8..88c8c6b2939 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -374,7 +374,7 @@ void ED_fileselect_set_params_from_userdef(SpaceFile *sfile) * pass its size here so we can store that in the preferences. Otherwise NULL. */ void ED_fileselect_params_to_userdef(SpaceFile *sfile, - int temp_win_size[2], + const int temp_win_size[2], const bool is_maximized) { UserDef_FileSpaceData *sfile_udata_new = &U.file_space_data; diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index d1f26dd37c9..4b329ab4524 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -1129,10 +1129,13 @@ int fsmenu_get_active_indices(struct FSMenu *fsmenu, enum FSMenuCategory categor * before being defined as unreachable by the OS, we need to validate the bookmarks in an async * job... */ -static void fsmenu_bookmark_validate_job_startjob(void *fsmenuv, - short *stop, - short *do_update, - float *UNUSED(progress)) +static void fsmenu_bookmark_validate_job_startjob( + void *fsmenuv, + /* Cannot be const, this function implements wm_jobs_start_callback. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + short *stop, + short *do_update, + float *UNUSED(progress)) { FSMenu *fsmenu = fsmenuv; diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 24ec2393b69..1f8dd7cfe44 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -572,8 +572,12 @@ static void image_multiview_cb(bContext *C, void *rnd_pt, void *UNUSED(arg_v)) WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL); } -static void uiblock_layer_pass_buttons( - uiLayout *layout, Image *image, RenderResult *rr, ImageUser *iuser, int w, short *render_slot) +static void uiblock_layer_pass_buttons(uiLayout *layout, + Image *image, + RenderResult *rr, + ImageUser *iuser, + int w, + const short *render_slot) { struct ImageUI_Data rnd_pt_local, *rnd_pt = NULL; uiBlock *block = uiLayoutGetBlock(layout); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 9040ca5e79c..a7fa7709c51 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -150,8 +150,8 @@ void ED_image_draw_info(Scene *scene, const uchar cp[4], const float fp[4], const float linearcol[4], - int *zp, - float *zpf) + const int *zp, + const float *zpf) { rcti color_rect; char str[256]; @@ -463,7 +463,7 @@ void ED_image_draw_info(Scene *scene, /* image drawing */ static void sima_draw_zbuf_pixels( - float x1, float y1, int rectx, int recty, int *rect, float zoomx, float zoomy) + float x1, float y1, int rectx, int recty, const int *rect, float zoomx, float zoomy) { float red[4] = {1.0f, 0.0f, 0.0f, 0.0f}; @@ -489,7 +489,7 @@ static void sima_draw_zbuffloat_pixels(Scene *scene, float y1, int rectx, int recty, - float *rect_float, + const float *rect_float, float zoomx, float zoomy) { diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 11d87148713..7af64e75656 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -238,7 +238,12 @@ static void compo_progressjob(void *cjv, float progress) } /* only this runs inside thread */ -static void compo_startjob(void *cjv, short *stop, short *do_update, float *progress) +static void compo_startjob(void *cjv, + /* Cannot be const, this function implements wm_jobs_start_callback. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + short *stop, + short *do_update, + float *progress) { CompoJob *cj = cjv; bNodeTree *ntree = cj->localtree; diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index b1dbe3bc506..b376c6b29cf 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -419,7 +419,7 @@ static void sample_draw(const bContext *C, ARegion *region, void *arg_info) * And here we've got recursion in the comments tips... */ bool ED_space_node_color_sample( - Main *bmain, SpaceNode *snode, ARegion *region, int mval[2], float r_col[3]) + Main *bmain, SpaceNode *snode, ARegion *region, const int mval[2], float r_col[3]) { void *lock; Image *ima; diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index a20d9a2942c..80b1c7a5194 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -50,14 +50,14 @@ static void rgb_to_yuv_normalized(const float rgb[3], float yuv[3]) yuv[2] += 0.5f; } -static void scope_put_pixel(uchar *table, uchar *pos) +static void scope_put_pixel(const uchar *table, uchar *pos) { uchar newval = table[*pos]; pos[0] = pos[1] = pos[2] = newval; pos[3] = 255; } -static void scope_put_pixel_single(uchar *table, uchar *pos, int col) +static void scope_put_pixel_single(const uchar *table, uchar *pos, int col) { char newval = table[pos[col]]; pos[col] = newval; diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index b7d857fb172..fc763d91e3d 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1572,7 +1572,7 @@ void VIEW3D_OT_select_menu(wmOperatorType *ot) static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, - uint *buffer, + const uint *buffer, int hits, const int mval[2], bool extend, diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index d3e509fe96b..0d121b23c71 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -1028,8 +1028,11 @@ void ED_view3d_autodist_init(Depsgraph *depsgraph, ARegion *region, View3D *v3d, } /* no 4x4 sampling, run #ED_view3d_autodist_init first */ -bool ED_view3d_autodist_simple( - ARegion *region, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth) +bool ED_view3d_autodist_simple(ARegion *region, + const int mval[2], + float mouse_worldloc[3], + int margin, + const float *force_depth) { float depth; @@ -1458,7 +1461,7 @@ bool ED_view3d_lock(RegionView3D *rv3d) * \param quat: The view rotation, quaternion normally from RegionView3D.viewquat. * \param dist: The view distance from ofs, normally from RegionView3D.dist. */ -void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], float *dist) +void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], const float *dist) { float nmat[3][3]; diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 3af176f5aef..6dbf80ed4b9 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -1106,11 +1106,13 @@ static bool raycastObjects(SnapObjectContext *sctx, const float ray_start[3], const float ray_dir[3], /* read/write args */ - float *ray_depth, + /* Parameters below cannot be const, because they are assigned to a + * non-const variable (readability-non-const-parameter). */ + float *ray_depth /* NOLINT */, /* return args */ - float r_loc[3], - float r_no[3], - int *r_index, + float r_loc[3] /* NOLINT */, + float r_no[3] /* NOLINT */, + int *r_index /* NOLINT */, Object **r_ob, float r_obmat[4][4], ListBase *r_hit_list) @@ -2789,11 +2791,13 @@ static short snapObjectsRay(SnapObjectContext *sctx, SnapData *snapdata, const struct SnapObjectParams *params, /* read/write args */ - float *dist_px, + /* Parameters below cannot be const, because they are assigned to a + * non-const variable (readability-non-const-parameter). */ + float *dist_px /* NOLINT */, /* return args */ - float r_loc[3], - float r_no[3], - int *r_index, + float r_loc[3] /* NOLINT */, + float r_no[3] /* NOLINT */, + int *r_index /* NOLINT */, Object **r_ob, float r_obmat[4][4]) { diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 921b96f6023..a4ee9a294fe 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -487,7 +487,7 @@ static void p_chart_uv_scale_xy(PChart *chart, float x, float y) } } -static void p_chart_uv_translate(PChart *chart, float trans[2]) +static void p_chart_uv_translate(PChart *chart, const float trans[2]) { PVert *v; @@ -805,7 +805,7 @@ static PVert *p_vert_copy(PChart *chart, PVert *v) return nv; } -static PEdge *p_edge_lookup(PHandle *handle, PHashKey *vkeys) +static PEdge *p_edge_lookup(PHandle *handle, const PHashKey *vkeys) { PHashKey key = PHASH_edge(vkeys[0], vkeys[1]); PEdge *e = (PEdge *)phash_lookup(handle->hash_edges, key); @@ -1146,14 +1146,14 @@ static PFace *p_face_add(PHandle *handle) static PFace *p_face_add_construct(PHandle *handle, ParamKey key, - ParamKey *vkeys, + const ParamKey *vkeys, float *co[4], float *uv[4], int i1, int i2, int i3, - ParamBool *pin, - ParamBool *select) + const ParamBool *pin, + const ParamBool *select) { PFace *f = p_face_add(handle); PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next; diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c index bae097a09bf..ddb276a663a 100644 --- a/source/blender/editors/uvedit/uvedit_select.c +++ b/source/blender/editors/uvedit/uvedit_select.c @@ -1477,7 +1477,7 @@ void UV_OT_select_all(wmOperatorType *ot) * \{ */ static bool uv_sticky_select( - float *limit, int hitv[], int v, float *hituv[], float *uv, int sticky, int hitlen) + const float *limit, const int hitv[], int v, float *hituv[], float *uv, int sticky, int hitlen) { int i; diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 9e85ee296ff..29e10f03e3c 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -534,7 +534,7 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchStateContainer *ssc, StitchState *state, UVVertAverage *uv_average, - uint *uvfinal_map, + const uint *uvfinal_map, IslandStitchData *island_stitch_data) { BMesh *bm = state->em->bm; diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index 0af57e5d728..e1763514e08 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -222,7 +222,7 @@ void BlenderFileLoader::clipTriangle(int numTris, bool em1, bool em2, bool em3, - int clip[3]) + const int clip[3]) { float *v[3], *n[3]; bool em[3]; diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h index ad6379d5f52..d9387b221f8 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h @@ -128,7 +128,7 @@ class BlenderFileLoader { bool em1, bool em2, bool em3, - int clip[3]); + const int clip[3]); void addTriangle(struct LoaderState *ls, float v1[3], float v2[3], diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp index b5d954664e4..e5f029d28b7 100644 --- a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp +++ b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp @@ -65,7 +65,7 @@ void SceneHash::visitIndexedFaceSet(IndexedFaceSet &ifs) static const int MOD_ADLER = 65521; -void SceneHash::adler32(unsigned char *data, int size) +void SceneHash::adler32(const unsigned char *data, int size) { uint32_t sum1 = _sum & 0xffff; uint32_t sum2 = (_sum >> 16) & 0xffff; diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.h b/source/blender/freestyle/intern/scene_graph/SceneHash.h index 53d1381da60..05c0880f806 100644 --- a/source/blender/freestyle/intern/scene_graph/SceneHash.h +++ b/source/blender/freestyle/intern/scene_graph/SceneHash.h @@ -67,7 +67,7 @@ class SceneHash : public SceneVisitor { } private: - void adler32(unsigned char *data, int size); + void adler32(const unsigned char *data, int size); uint32_t _sum; uint32_t _prevSum; diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp index 2df5ecd0867..cb3a297076a 100644 --- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp +++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp @@ -94,7 +94,7 @@ static inline bool crossesProscenium(real proscenium[4], FEdge *fe) return GeomUtils::intersect2dSeg2dArea(min, max, A, B); } -static inline bool insideProscenium(real proscenium[4], const Vec3r &point) +static inline bool insideProscenium(const real proscenium[4], const Vec3r &point) { return !(point[0] < proscenium[0] || point[0] > proscenium[1] || point[1] < proscenium[2] || point[1] > proscenium[3]); diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index b7de3a5b319..8ac272e92b5 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -1084,7 +1084,7 @@ static inline bool crossesProscenium(real proscenium[4], FEdge *fe) return GeomUtils::intersect2dSeg2dArea(min, max, A, B); } -static inline bool insideProscenium(real proscenium[4], const Vec3r &point) +static inline bool insideProscenium(const real proscenium[4], const Vec3r &point) { return !(point[0] < proscenium[0] || point[0] > proscenium[1] || point[1] < proscenium[2] || point[1] > proscenium[3]); diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h index 41a29a4d45d..c7e74040568 100644 --- a/source/blender/gpu/GPU_buffers.h +++ b/source/blender/gpu/GPU_buffers.h @@ -67,7 +67,7 @@ GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading); void GPU_pbvh_bmesh_buffers_update_free(GPU_PBVH_Buffers *buffers); void GPU_pbvh_grid_buffers_update_free(GPU_PBVH_Buffers *buffers, const struct DMFlagMat *grid_flag_mats, - int *grid_indices); + const int *grid_indices); /* Update mesh buffers without topology changes. Threaded. */ enum { diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index eeb2d2caef2..c372bfaf218 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -169,8 +169,8 @@ void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link); void GPU_material_sss_profile_create(GPUMaterial *material, float radii[3], - short *falloff_type, - float *sharpness); + const short *falloff_type, + const float *sharpness); struct GPUUniformBuffer *GPU_material_sss_profile_get(GPUMaterial *material, int sample_len, struct GPUTexture **tex_profile); diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index bb9720246ca..10d5a860f6a 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -452,7 +452,7 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const MPoly *mpoly, static void gpu_pbvh_grid_fill_index_buffers(GPU_PBVH_Buffers *buffers, SubdivCCG *UNUSED(subdiv_ccg), const int *UNUSED(face_sets), - int *grid_indices, + const int *grid_indices, uint visible_quad_len, int totgrid, int gridsize) @@ -583,7 +583,7 @@ static void gpu_pbvh_grid_fill_index_buffers(GPU_PBVH_Buffers *buffers, void GPU_pbvh_grid_buffers_update_free(GPU_PBVH_Buffers *buffers, const struct DMFlagMat *grid_flag_mats, - int *grid_indices) + const int *grid_indices) { const bool smooth = grid_flag_mats[grid_indices[0]].flag & ME_SMOOTH; diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index d2384b9c065..c65c1046b8f 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -497,8 +497,8 @@ static void compute_sss_translucence_kernel(const GPUSssKernelData *kd, void GPU_material_sss_profile_create(GPUMaterial *material, float radii[3], - short *falloff_type, - float *sharpness) + const short *falloff_type, + const float *sharpness) { copy_v3_v3(material->sss_radii, radii); material->sss_falloff = (falloff_type) ? *falloff_type : 0.0; diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 83ef910d0bb..8fb6c1ba1e1 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -411,7 +411,7 @@ void IMB_free_anim(struct anim *anim); void IMB_filter(struct ImBuf *ibuf); void IMB_mask_filter_extend(char *mask, int width, int height); -void IMB_mask_clear(struct ImBuf *ibuf, char *mask, int val); +void IMB_mask_clear(struct ImBuf *ibuf, const char *mask, int val); void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter); void IMB_makemipmap(struct ImBuf *ibuf, int use_filter); void IMB_remakemipmap(struct ImBuf *ibuf, int use_filter); @@ -599,7 +599,7 @@ void bilinear_interpolation_color_wrap( struct ImBuf *in, unsigned char col[4], float col_float[4], float u, float v); void IMB_alpha_under_color_float(float *rect_float, int x, int y, float backcol[3]); -void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, float backcol[3]); +void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float backcol[3]); void IMB_sampleImageAtLocation( struct ImBuf *ibuf, float x, float y, bool make_linear_rgb, float color[4]); diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 6341706bede..5c9ebbaba21 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -1723,7 +1723,7 @@ static void *do_display_buffer_apply_thread(void *handle_v) } static void display_buffer_apply_threaded(ImBuf *ibuf, - float *buffer, + const float *buffer, unsigned char *byte_buffer, float *display_buffer, unsigned char *display_buffer_byte, diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp index 4397c1febab..9fd6d71e091 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.cpp +++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp @@ -241,7 +241,7 @@ void BlockDXT1::decodeBlockNV5x(ColorBlock *block) const } } -void BlockDXT1::setIndices(int *idx) +void BlockDXT1::setIndices(const int *idx) { indices = 0; for (uint i = 0; i < 16; i++) { @@ -580,7 +580,7 @@ void BlockCTX1::decodeBlock(ColorBlock *block) const } } -void BlockCTX1::setIndices(int *idx) +void BlockCTX1::setIndices(const int *idx) { indices = 0; for (uint i = 0; i < 16; i++) { diff --git a/source/blender/imbuf/intern/dds/BlockDXT.h b/source/blender/imbuf/intern/dds/BlockDXT.h index 16937bce042..57430dbaea2 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.h +++ b/source/blender/imbuf/intern/dds/BlockDXT.h @@ -76,7 +76,7 @@ struct BlockDXT1 { void decodeBlock(ColorBlock *block) const; void decodeBlockNV5x(ColorBlock *block) const; - void setIndices(int *idx); + void setIndices(const int *idx); void flip4(); void flip2(); @@ -289,7 +289,7 @@ struct BlockCTX1 { }; void evaluatePalette(Color32 color_array[4]) const; - void setIndices(int *idx); + void setIndices(const int *idx); void decodeBlock(ColorBlock *block) const; diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index e36088f8eac..d8a5096af71 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -363,7 +363,7 @@ void IMB_mask_filter_extend(char *mask, int width, int height) MEM_freeN(temprect); } -void IMB_mask_clear(ImBuf *ibuf, char *mask, int val) +void IMB_mask_clear(ImBuf *ibuf, const char *mask, int val) { int x, y; if (ibuf->rect_float) { diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index 7ebbd1a7409..bf58f047773 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -456,7 +456,7 @@ void IMB_alpha_under_color_float(float *rect_float, int x, int y, float backcol[ } } -void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, float backcol[3]) +void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float backcol[3]) { size_t a = ((size_t)x) * y; unsigned char *cp = rect; diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 985a8e977ca..7cc31b99077 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -894,7 +894,7 @@ static void index_rebuild_ffmpeg_proc_decoded_frame(FFmpegIndexBuilderContext *c } static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context, - short *stop, + const short *stop, short *do_update, float *progress) { @@ -1090,7 +1090,7 @@ static void index_rebuild_fallback_finish(FallbackIndexBuilderContext *context, } static void index_rebuild_fallback(FallbackIndexBuilderContext *context, - short *stop, + const short *stop, short *do_update, float *progress) { diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index bfcd1ec2cee..2516df22151 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -122,7 +122,7 @@ static int expandrow2( static void interleaverow(uchar *lptr, const uchar *cptr, int z, int n); static void interleaverow2(float *lptr, const uchar *cptr, int z, int n); static int compressrow(uchar *lbuf, uchar *rlebuf, int z, int cnt); -static void lumrow(uchar *rgbptr, uchar *lumptr, int n); +static void lumrow(const uchar *rgbptr, uchar *lumptr, int n); /* * byte order independent read/write of shorts and ints. @@ -900,7 +900,7 @@ static int output_iris(uint *lptr, int xsize, int ysize, int zsize, const char * /* static utility functions for output_iris */ -static void lumrow(uchar *rgbptr, uchar *lumptr, int n) +static void lumrow(const uchar *rgbptr, uchar *lumptr, int n) { lumptr += CHANOFFSET(0); while (n--) { diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 46d07e74ce3..6ed01c73f04 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -176,7 +176,7 @@ static void RGBE2FLOAT(RGBE rgbe, fCOLOR fcol) } /* float color -> rgbe */ -static void FLOAT2RGBE(fCOLOR fcol, RGBE rgbe) +static void FLOAT2RGBE(const fCOLOR fcol, RGBE rgbe) { int e; float d = (fcol[RED] > fcol[GRN]) ? fcol[RED] : fcol[GRN]; @@ -308,7 +308,8 @@ struct ImBuf *imb_loadhdr(const unsigned char *mem, } /* ImBuf write */ -static int fwritecolrs(FILE *file, int width, int channels, unsigned char *ibufscan, float *fpscan) +static int fwritecolrs( + FILE *file, int width, int channels, const unsigned char *ibufscan, const float *fpscan) { int beg, c2, cnt = 0; fCOLOR fcol; diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 309de25db03..20e894fa942 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -81,14 +81,24 @@ typedef struct ImbTIFFMemFile { * Function implementations. * *****************************/ -static void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size) +static void imb_tiff_DummyUnmapProc( + thandle_t fd, + tdata_t base, + /* Cannot be const, because this function implemements TIFFUnmapFileProc. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + toff_t size) { (void)fd; (void)base; (void)size; } -static int imb_tiff_DummyMapProc(thandle_t fd, tdata_t *pbase, toff_t *psize) +static int imb_tiff_DummyMapProc( + thandle_t fd, + tdata_t *pbase, + /* Cannot be const, because this function implemements TIFFMapFileProc. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + toff_t *psize) { (void)fd; (void)pbase; diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc b/source/blender/io/alembic/exporter/abc_export_capi.cc index fbc5b2d5c02..98c551c635c 100644 --- a/source/blender/io/alembic/exporter/abc_export_capi.cc +++ b/source/blender/io/alembic/exporter/abc_export_capi.cc @@ -73,7 +73,12 @@ static void build_depsgraph(Depsgraph *depsgraph, Main *bmain) DEG_graph_build_from_view_layer(depsgraph, bmain, scene, view_layer); } -static void export_startjob(void *customdata, short *stop, short *do_update, float *progress) +static void export_startjob(void *customdata, + /* Cannot be const, this function implements wm_jobs_start_callback. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + short *stop, + short *do_update, + float *progress) { ExportJobData *data = static_cast(customdata); data->was_canceled = false; diff --git a/source/blender/io/avi/intern/avi_mjpeg.c b/source/blender/io/avi/intern/avi_mjpeg.c index 7584649dee2..75059c202e5 100644 --- a/source/blender/io/avi/intern/avi_mjpeg.c +++ b/source/blender/io/avi/intern/avi_mjpeg.c @@ -39,7 +39,9 @@ #include "avi_mjpeg.h" static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, size_t bufsize); -static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, unsigned char *buffer, size_t bufsize); +static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, + const unsigned char *buffer, + size_t bufsize); static size_t numbytes; @@ -381,7 +383,10 @@ static void deinterlace(int odd, unsigned char *to, unsigned char *from, int wid } } -void *avi_converter_from_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, size_t *size) +void *avi_converter_from_mjpeg(AviMovie *movie, + int stream, + unsigned char *buffer, + const size_t *size) { int deint; unsigned char *buf; @@ -553,7 +558,9 @@ static void jpegmemsrcmgr_term_source(j_decompress_ptr dinfo) MEM_freeN(dinfo->src); } -static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, unsigned char *buffer, size_t bufsize) +static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, + const unsigned char *buffer, + size_t bufsize) { dinfo->src = MEM_mallocN(sizeof(*(dinfo->src)), "avi.jpegmemsrcmgr_build"); diff --git a/source/blender/io/avi/intern/avi_mjpeg.h b/source/blender/io/avi/intern/avi_mjpeg.h index 30e46bf1d0c..13153fa41f0 100644 --- a/source/blender/io/avi/intern/avi_mjpeg.h +++ b/source/blender/io/avi/intern/avi_mjpeg.h @@ -24,7 +24,10 @@ #ifndef __AVI_MJPEG_H__ #define __AVI_MJPEG_H__ -void *avi_converter_from_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, size_t *size); +void *avi_converter_from_mjpeg(AviMovie *movie, + int stream, + unsigned char *buffer, + const size_t *size); void *avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, size_t *size); #endif /* __AVI_MJPEG_H__ */ diff --git a/source/blender/io/avi/intern/avi_rgb.c b/source/blender/io/avi/intern/avi_rgb.c index 6f4f33d72d1..44542af96ae 100644 --- a/source/blender/io/avi/intern/avi_rgb.c +++ b/source/blender/io/avi/intern/avi_rgb.c @@ -37,7 +37,10 @@ /* implementation */ -void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, size_t *size) +void *avi_converter_from_avi_rgb(AviMovie *movie, + int stream, + unsigned char *buffer, + const size_t *size) { unsigned char *buf; AviBitmapInfoHeader *bi; diff --git a/source/blender/io/avi/intern/avi_rgb.h b/source/blender/io/avi/intern/avi_rgb.h index 7c8ce590d27..3a37fad94e1 100644 --- a/source/blender/io/avi/intern/avi_rgb.h +++ b/source/blender/io/avi/intern/avi_rgb.h @@ -24,7 +24,10 @@ #ifndef __AVI_RGB_H__ #define __AVI_RGB_H__ -void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, size_t *size); +void *avi_converter_from_avi_rgb(AviMovie *movie, + int stream, + unsigned char *buffer, + const size_t *size); void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, size_t *size); #endif /* __AVI_RGB_H__ */ diff --git a/source/blender/io/collada/MeshImporter.cpp b/source/blender/io/collada/MeshImporter.cpp index 495af60488b..9fbb7324f8f 100644 --- a/source/blender/io/collada/MeshImporter.cpp +++ b/source/blender/io/collada/MeshImporter.cpp @@ -205,7 +205,7 @@ MeshImporter::MeshImporter( } bool MeshImporter::set_poly_indices( - MPoly *mpoly, MLoop *mloop, int loop_index, unsigned int *indices, int loop_count) + MPoly *mpoly, MLoop *mloop, int loop_index, const unsigned int *indices, int loop_count) { mpoly->loopstart = loop_index; mpoly->totloop = loop_count; diff --git a/source/blender/io/collada/MeshImporter.h b/source/blender/io/collada/MeshImporter.h index 2f2a18ff11a..18e56e8f9df 100644 --- a/source/blender/io/collada/MeshImporter.h +++ b/source/blender/io/collada/MeshImporter.h @@ -105,7 +105,7 @@ class MeshImporter : public MeshImporterBase { std::multimap materials_mapped_to_geom; bool set_poly_indices( - MPoly *mpoly, MLoop *mloop, int loop_index, unsigned int *indices, int loop_count); + MPoly *mpoly, MLoop *mloop, int loop_index, const unsigned int *indices, int loop_count); void set_face_uv(MLoopUV *mloopuv, UVDataWrapper &uvs, diff --git a/source/blender/io/collada/TransformWriter.cpp b/source/blender/io/collada/TransformWriter.cpp index 0a66db72cb9..b7455837379 100644 --- a/source/blender/io/collada/TransformWriter.cpp +++ b/source/blender/io/collada/TransformWriter.cpp @@ -129,9 +129,9 @@ void TransformWriter::add_node_transform_identity(COLLADASW::Node &node, } void TransformWriter::add_transform(COLLADASW::Node &node, - float loc[3], - float rot[3], - float scale[3]) + const float loc[3], + const float rot[3], + const float scale[3]) { node.addScale("scale", scale[0], scale[1], scale[2]); node.addRotateZ("rotationZ", RAD2DEGF(rot[2])); diff --git a/source/blender/io/collada/TransformWriter.h b/source/blender/io/collada/TransformWriter.h index 3c71fc9d36e..db8ef3f5ee2 100644 --- a/source/blender/io/collada/TransformWriter.h +++ b/source/blender/io/collada/TransformWriter.h @@ -42,7 +42,10 @@ class TransformWriter { void add_node_transform_identity(COLLADASW::Node &node, BCExportSettings &export_settings); private: - void add_transform(COLLADASW::Node &node, float loc[3], float rot[3], float scale[3]); + void add_transform(COLLADASW::Node &node, + const float loc[3], + const float rot[3], + const float scale[3]); }; #endif diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp index e74808df466..2c54a49198a 100644 --- a/source/blender/io/collada/collada_utils.cpp +++ b/source/blender/io/collada/collada_utils.cpp @@ -603,7 +603,7 @@ float BoneExtended::get_roll() return this->roll; } -void BoneExtended::set_tail(float vec[]) +void BoneExtended::set_tail(const float vec[]) { this->tail[0] = vec[0]; this->tail[1] = vec[1]; diff --git a/source/blender/io/collada/collada_utils.h b/source/blender/io/collada/collada_utils.h index b1ec2c8b81a..11a9376294b 100644 --- a/source/blender/io/collada/collada_utils.h +++ b/source/blender/io/collada/collada_utils.h @@ -343,7 +343,7 @@ class BoneExtended { bool has_roll(); float get_roll(); - void set_tail(float vec[]); + void set_tail(const float vec[]); float *get_tail(); bool has_tail(); diff --git a/source/blender/io/usd/intern/usd_capi.cc b/source/blender/io/usd/intern/usd_capi.cc index 2d3972410a4..98aef62f38e 100644 --- a/source/blender/io/usd/intern/usd_capi.cc +++ b/source/blender/io/usd/intern/usd_capi.cc @@ -59,7 +59,12 @@ struct ExportJobData { bool export_ok; }; -static void export_startjob(void *customdata, short *stop, short *do_update, float *progress) +static void export_startjob(void *customdata, + /* Cannot be const, this function implements wm_jobs_start_callback. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + short *stop, + short *do_update, + float *progress) { ExportJobData *data = static_cast(customdata); data->export_ok = false; diff --git a/source/blender/makesrna/intern/rna_access_internal.h b/source/blender/makesrna/intern/rna_access_internal.h index ecc9386ca77..7d8fff21862 100644 --- a/source/blender/makesrna/intern/rna_access_internal.h +++ b/source/blender/makesrna/intern/rna_access_internal.h @@ -30,8 +30,8 @@ struct PropertyRNAOrID; PropertyRNA *rna_ensure_property(PropertyRNA *prop); void rna_property_rna_or_id_get(PropertyRNA *prop, - PointerRNA *ptr, - PropertyRNAOrID *r_prop_rna_or_id); + PointerRNA *ptr, + PropertyRNAOrID *r_prop_rna_or_id); void rna_idproperty_touch(struct IDProperty *idprop); struct IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name); diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index f6ad25ce282..4e46e135b72 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -254,7 +254,7 @@ static void remap_faces_3_6_9_12(Mesh *mesh, Mesh *split, MFace *mf, int *facepa, - int *vertpa, + const int *vertpa, int i, EdgeHash *eh, int cur, @@ -322,7 +322,7 @@ static void remap_faces_5_10(Mesh *mesh, Mesh *split, MFace *mf, int *facepa, - int *vertpa, + const int *vertpa, int i, EdgeHash *eh, int cur, @@ -378,7 +378,7 @@ static void remap_faces_15(Mesh *mesh, Mesh *split, MFace *mf, int *facepa, - int *vertpa, + const int *vertpa, int i, EdgeHash *eh, int cur, @@ -462,7 +462,7 @@ static void remap_faces_7_11_13_14(Mesh *mesh, Mesh *split, MFace *mf, int *facepa, - int *vertpa, + const int *vertpa, int i, EdgeHash *eh, int cur, @@ -531,7 +531,7 @@ static void remap_faces_19_21_22(Mesh *mesh, Mesh *split, MFace *mf, int *facepa, - int *vertpa, + const int *vertpa, int i, EdgeHash *eh, int cur, @@ -585,7 +585,7 @@ static void remap_faces_23(Mesh *mesh, Mesh *split, MFace *mf, int *facepa, - int *vertpa, + const int *vertpa, int i, EdgeHash *eh, int cur, diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c index 8753bb2c770..d2c4413b862 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c @@ -65,7 +65,7 @@ typedef struct XYZ_to_RGB /* transposed imbuf_xyz_to_rgb, passed as 3x vec3 */ float r[3], g[3], b[3]; } XYZ_to_RGB; -static float sky_perez_function(float *lam, float theta, float gamma) +static float sky_perez_function(const float *lam, float theta, float gamma) { float ctheta = cosf(theta); float cgamma = cosf(gamma); @@ -74,7 +74,7 @@ static float sky_perez_function(float *lam, float theta, float gamma) (1.0 + lam[2] * expf(lam[3] * gamma) + lam[4] * cgamma * cgamma); } -static void sky_precompute_old(SkyModelPreetham *sunsky, float sun_angles[], float turbidity) +static void sky_precompute_old(SkyModelPreetham *sunsky, const float sun_angles[], float turbidity) { float theta = sun_angles[0]; float theta2 = theta * theta; diff --git a/source/blender/physics/intern/hair_volume.cpp b/source/blender/physics/intern/hair_volume.cpp index 6246bf54f75..1764d0a910c 100644 --- a/source/blender/physics/intern/hair_volume.cpp +++ b/source/blender/physics/intern/hair_volume.cpp @@ -303,7 +303,7 @@ void BPH_hair_volume_grid_clear(HairGrid *grid) } } -BLI_INLINE bool hair_grid_point_valid(const float vec[3], float gmin[3], float gmax[3]) +BLI_INLINE bool hair_grid_point_valid(const float vec[3], const float gmin[3], const float gmax[3]) { return !(vec[0] < gmin[0] || vec[1] < gmin[1] || vec[2] < gmin[2] || vec[0] > gmax[0] || vec[1] > gmax[1] || vec[2] > gmax[2]); diff --git a/source/blender/physics/intern/implicit_blender.c b/source/blender/physics/intern/implicit_blender.c index 5ec4c750d5d..54d38f3c10b 100644 --- a/source/blender/physics/intern/implicit_blender.c +++ b/source/blender/physics/intern/implicit_blender.c @@ -90,7 +90,7 @@ typedef struct fmatrix3x3 { /////////////////////////// /* simple vector code */ /* STATUS: verified */ -DO_INLINE void mul_fvector_S(float to[3], float from[3], float scalar) +DO_INLINE void mul_fvector_S(float to[3], const float from[3], float scalar) { to[0] = from[0] * scalar; to[1] = from[1] * scalar; @@ -429,7 +429,7 @@ DO_INLINE void mul_fmatrix_S(float matrix[3][3], float scalar) /* a vector multiplied by a 3x3 matrix */ /* STATUS: verified */ -DO_INLINE void mul_fvector_fmatrix(float *to, float *from, float matrix[3][3]) +DO_INLINE void mul_fvector_fmatrix(float *to, const float *from, float matrix[3][3]) { to[0] = matrix[0][0] * from[0] + matrix[1][0] * from[1] + matrix[2][0] * from[2]; to[1] = matrix[0][1] * from[0] + matrix[1][1] * from[1] + matrix[2][1] * from[2]; @@ -478,7 +478,7 @@ DO_INLINE void muladd_fmatrix_fvector(float to[3], float matrix[3][3], float fro to[2] += dot_v3v3(matrix[2], from); } -DO_INLINE void muladd_fmatrixT_fvector(float to[3], float matrix[3][3], float from[3]) +DO_INLINE void muladd_fmatrixT_fvector(float to[3], float matrix[3][3], const float from[3]) { to[0] += matrix[0][0] * from[0] + matrix[1][0] * from[1] + matrix[2][0] * from[2]; to[1] += matrix[0][1] * from[0] + matrix[1][1] * from[1] + matrix[2][1] * from[2]; @@ -1869,7 +1869,7 @@ bool BPH_mass_spring_force_spring_bending( } } -BLI_INLINE void poly_avg(lfVector *data, int *inds, int len, float r_avg[3]) +BLI_INLINE void poly_avg(lfVector *data, const int *inds, int len, float r_avg[3]) { float fact = 1.0f / (float)len; diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 5471fc25f37..2ad2794c76f 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -487,7 +487,7 @@ static int gl_buffer_type_from_py_buffer(Py_buffer *pybuffer) return -1; /* UNKNOWN */ } -static bool compare_dimensions(int ndim, int *dim1, Py_ssize_t *dim2) +static bool compare_dimensions(int ndim, const int *dim1, const Py_ssize_t *dim2) { for (int i = 0; i < ndim; i++) { if (dim1[i] != dim2[i]) { diff --git a/source/blender/python/intern/bpy_capi_utils.h b/source/blender/python/intern/bpy_capi_utils.h index fe086b61097..97344ce1326 100644 --- a/source/blender/python/intern/bpy_capi_utils.h +++ b/source/blender/python/intern/bpy_capi_utils.h @@ -48,6 +48,6 @@ struct bContext *BPy_GetContext(void); void BPy_SetContext(struct bContext *C); extern void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate); -extern void bpy_context_clear(struct bContext *C, PyGILState_STATE *gilstate); +extern void bpy_context_clear(struct bContext *C, const PyGILState_STATE *gilstate); #endif /* __BPY_CAPI_UTILS_H__ */ diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 6da1715b02d..be5a92309f2 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -136,7 +136,7 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate) } /* context should be used but not now because it causes some bugs */ -void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate) +void bpy_context_clear(bContext *UNUSED(C), const PyGILState_STATE *gilstate) { py_call_level--; diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 59c0021e0f3..93dbac32c19 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -1537,9 +1537,9 @@ static PyObject *M_Geometry_convex_hull_2d(PyObject *UNUSED(self), PyObject *poi * to fill values, with start_table and len_table giving the start index * and length of the toplevel_len sub-lists. */ -static PyObject *list_of_lists_from_arrays(int *array, - int *start_table, - int *len_table, +static PyObject *list_of_lists_from_arrays(const int *array, + const int *start_table, + const int *len_table, int toplevel_len) { PyObject *ret, *sublist; diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c index 7c301f7d591..b30821a1b73 100644 --- a/source/blender/render/intern/source/multires_bake.c +++ b/source/blender/render/intern/source/multires_bake.c @@ -1319,8 +1319,11 @@ static void bake_ibuf_filter(ImBuf *ibuf, char *mask, const int filter) } } -static void bake_ibuf_normalize_displacement( - ImBuf *ibuf, float *displacement, char *mask, float displacement_min, float displacement_max) +static void bake_ibuf_normalize_displacement(ImBuf *ibuf, + const float *displacement, + const char *mask, + float displacement_min, + float displacement_max) { int i; const float *current_displacement = displacement; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 482589e2ccb..3d4c84805f9 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -744,8 +744,13 @@ void *WM_jobs_customdata_get(struct wmJob *); void WM_jobs_customdata_set(struct wmJob *, void *customdata, void (*free)(void *)); void WM_jobs_timer(struct wmJob *, double timestep, unsigned int note, unsigned int endnote); void WM_jobs_delay_start(struct wmJob *, double delay_time); + +typedef void (*wm_jobs_start_callback)(void *custom_data, + short *stop, + short *do_update, + float *progress); void WM_jobs_callbacks(struct wmJob *, - void (*startjob)(void *, short *, short *, float *), + wm_jobs_start_callback startjob, void (*initjob)(void *), void (*update)(void *), void (*endjob)(void *)); diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index c10f03f3dab..87a19d832c9 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -86,7 +86,7 @@ struct wmJob { * This performs the actual parallel work. * Executed in worker thread(s). */ - void (*startjob)(void *, short *stop, short *do_update, float *progress); + wm_jobs_start_callback startjob; /** * Called if thread defines so (see `do_update` flag), and max once per timer step. * Executed in main thread. @@ -378,7 +378,7 @@ void WM_jobs_delay_start(wmJob *wm_job, double delay_time) } void WM_jobs_callbacks(wmJob *wm_job, - void (*startjob)(void *, short *, short *, float *), + wm_jobs_start_callback startjob, void (*initjob)(void *), void (*update)(void *), void (*endjob)(void *))