diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index b7723478c26..e59a9ac65ad 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -238,7 +238,7 @@ extern bool GHOST_ValidWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandl * This window is invalid after full screen has been ended. */ extern GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle, - GHOST_DisplaySetting *setting, + const GHOST_DisplaySetting *setting, const bool stereoVisual); /** @@ -429,7 +429,7 @@ void GHOST_GetCursorGrabState(GHOST_WindowHandle windowhandle, extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle, GHOST_TGrabCursorMode mode, GHOST_TAxisFlag wrap_axis, - int bounds[4], + const int bounds[4], const int mouse_ungrab_xy[2]); /*************************************************************************************** diff --git a/intern/ghost/intern/GHOST_C-api.cc b/intern/ghost/intern/GHOST_C-api.cc index 45e14347118..063489b3f41 100644 --- a/intern/ghost/intern/GHOST_C-api.cc +++ b/intern/ghost/intern/GHOST_C-api.cc @@ -216,7 +216,7 @@ bool GHOST_ValidWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windo } GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle, - GHOST_DisplaySetting *setting, + const GHOST_DisplaySetting *setting, const bool stereoVisual) { GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; @@ -409,7 +409,7 @@ GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle, GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle, GHOST_TGrabCursorMode mode, GHOST_TAxisFlag wrap_axis, - int bounds[4], + const int bounds[4], const int mouse_ungrab_xy[2]) { GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; @@ -781,7 +781,7 @@ int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle) void GHOST_GetRectangle( GHOST_RectangleHandle rectanglehandle, int32_t *l, int32_t *t, int32_t *r, int32_t *b) { - GHOST_Rect *rect = (GHOST_Rect *)rectanglehandle; + const GHOST_Rect *rect = (GHOST_Rect *)rectanglehandle; *l = rect->m_l; *t = rect->m_t; diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.cc b/intern/ghost/intern/GHOST_DisplayManagerX11.cc index 4f28662091b..39d453d0fe7 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerX11.cc +++ b/intern/ghost/intern/GHOST_DisplayManagerX11.cc @@ -67,7 +67,7 @@ GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplaySettings(uint8_t display, /* from SDL2 */ #ifdef WITH_X11_XF86VMODE -static int calculate_rate(XF86VidModeModeInfo *info) +static int calculate_rate(const XF86VidModeModeInfo *info) { return (info->htotal && info->vtotal) ? (1000 * info->dotclock / (info->htotal * info->vtotal)) : 0; diff --git a/intern/ghost/intern/GHOST_NDOFManager.cc b/intern/ghost/intern/GHOST_NDOFManager.cc index ac3e6d7bcfd..413bfec75f7 100644 --- a/intern/ghost/intern/GHOST_NDOFManager.cc +++ b/intern/ghost/intern/GHOST_NDOFManager.cc @@ -527,14 +527,14 @@ void GHOST_NDOFManager::setDeadZone(float dz) CLOG_INFO(LOG, 2, "dead zone set to %.2f%s", dz, (dz > 0.5f) ? " (unexpectedly high)" : ""); } -static bool atHomePosition(GHOST_TEventNDOFMotionData *ndof) +static bool atHomePosition(const GHOST_TEventNDOFMotionData *ndof) { #define HOME(foo) (ndof->foo == 0.0f) return HOME(tx) && HOME(ty) && HOME(tz) && HOME(rx) && HOME(ry) && HOME(rz); #undef HOME } -static bool nearHomePosition(GHOST_TEventNDOFMotionData *ndof, float threshold) +static bool nearHomePosition(const GHOST_TEventNDOFMotionData *ndof, float threshold) { if (threshold == 0.0f) { return atHomePosition(ndof); diff --git a/source/blender/blenkernel/BKE_gpencil_legacy.h b/source/blender/blenkernel/BKE_gpencil_legacy.h index fbb8fe570a9..1918ea14711 100644 --- a/source/blender/blenkernel/BKE_gpencil_legacy.h +++ b/source/blender/blenkernel/BKE_gpencil_legacy.h @@ -461,7 +461,7 @@ void BKE_gpencil_layer_mask_cleanup_all_layers(struct bGPdata *gpd); void BKE_gpencil_layer_frames_sort(struct bGPDlayer *gpl, bool *r_has_duplicate_frames); struct bGPDlayer *BKE_gpencil_layer_get_by_name(struct bGPdata *gpd, - char *name, + const char *name, int first_if_not_found); /* Brush */ diff --git a/source/blender/blenkernel/BKE_lib_query.h b/source/blender/blenkernel/BKE_lib_query.h index 2fd5735bbbb..dd12b498935 100644 --- a/source/blender/blenkernel/BKE_lib_query.h +++ b/source/blender/blenkernel/BKE_lib_query.h @@ -193,11 +193,11 @@ typedef struct LibraryForeachIDData LibraryForeachIDData; * Check whether current iteration over ID usages should be stopped or not. * \return true if the iteration should be stopped, false otherwise. */ -bool BKE_lib_query_foreachid_iter_stop(struct LibraryForeachIDData *data); +bool BKE_lib_query_foreachid_iter_stop(const struct LibraryForeachIDData *data); void BKE_lib_query_foreachid_process(struct LibraryForeachIDData *data, struct ID **id_pp, int cb_flag); -int BKE_lib_query_foreachid_process_flags_get(struct LibraryForeachIDData *data); +int BKE_lib_query_foreachid_process_flags_get(const struct LibraryForeachIDData *data); int BKE_lib_query_foreachid_process_callback_flag_override(struct LibraryForeachIDData *data, int cb_flag, bool do_replace); diff --git a/source/blender/blenkernel/intern/curve_deform.c b/source/blender/blenkernel/intern/curve_deform.c index 456f5919db1..b2e51871122 100644 --- a/source/blender/blenkernel/intern/curve_deform.c +++ b/source/blender/blenkernel/intern/curve_deform.c @@ -89,7 +89,7 @@ static bool calc_curve_deform( } } else { - CurveCache *cc = ob_curve->runtime.curve_cache; + const CurveCache *cc = ob_curve->runtime.curve_cache; float totdist = BKE_anim_path_get_length(cc); if (LIKELY(totdist > FLT_EPSILON)) { fac = -(co[index] - cd->dmax[index]) / totdist; @@ -111,7 +111,7 @@ static bool calc_curve_deform( } } else { - CurveCache *cc = ob_curve->runtime.curve_cache; + const CurveCache *cc = ob_curve->runtime.curve_cache; float totdist = BKE_anim_path_get_length(cc); if (LIKELY(totdist > FLT_EPSILON)) { fac = +(co[index] - cd->dmin[index]) / totdist; diff --git a/source/blender/blenkernel/intern/gpencil_legacy.c b/source/blender/blenkernel/intern/gpencil_legacy.c index 8d58ed8bcc8..dedb1e0e229 100644 --- a/source/blender/blenkernel/intern/gpencil_legacy.c +++ b/source/blender/blenkernel/intern/gpencil_legacy.c @@ -1573,7 +1573,7 @@ bGPDlayer *BKE_gpencil_layer_active_get(bGPdata *gpd) return NULL; } -bGPDlayer *BKE_gpencil_layer_get_by_name(bGPdata *gpd, char *name, int first_if_not_found) +bGPDlayer *BKE_gpencil_layer_get_by_name(bGPdata *gpd, const char *name, int first_if_not_found) { bGPDlayer *gpl; diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c index afafdb08f42..fde97ecca5c 100644 --- a/source/blender/blenkernel/intern/lib_query.c +++ b/source/blender/blenkernel/intern/lib_query.c @@ -61,7 +61,7 @@ typedef struct LibraryForeachIDData { BLI_LINKSTACK_DECLARE(ids_todo, ID *); } LibraryForeachIDData; -bool BKE_lib_query_foreachid_iter_stop(LibraryForeachIDData *data) +bool BKE_lib_query_foreachid_iter_stop(const LibraryForeachIDData *data) { return (data->status & IDWALK_STOP) != 0; } @@ -107,7 +107,7 @@ void BKE_lib_query_foreachid_process(LibraryForeachIDData *data, ID **id_pp, int } } -int BKE_lib_query_foreachid_process_flags_get(LibraryForeachIDData *data) +int BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data) { return data->flag; } diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c index c244f1fbd12..714e76b1c94 100644 --- a/source/blender/blenkernel/intern/particle_child.c +++ b/source/blender/blenkernel/intern/particle_child.c @@ -568,7 +568,7 @@ static float do_clump_level(float result[3], float clumpfac, float clumppow, float pa_clump, - CurveMapping *clumpcurve) + const CurveMapping *clumpcurve) { float clump = 0.0f; @@ -610,7 +610,7 @@ float do_clump(ParticleKey *state, float pa_clump, bool use_clump_noise, float clump_noise_size, - CurveMapping *clumpcurve) + const CurveMapping *clumpcurve) { float clump; @@ -726,7 +726,7 @@ static void twist_get_axis(const ParticleChildModifierContext *modifier_ctx, } } -static float BKE_curvemapping_integrate_clamped(CurveMapping *curve, +static float BKE_curvemapping_integrate_clamped(const CurveMapping *curve, float start, float end, float step) diff --git a/source/blender/blenkernel/particle_private.h b/source/blender/blenkernel/particle_private.h index 47f77ab0320..5b9263f236e 100644 --- a/source/blender/blenkernel/particle_private.h +++ b/source/blender/blenkernel/particle_private.h @@ -49,7 +49,7 @@ float do_clump(ParticleKey *state, float pa_clump, bool use_clump_noise, float clump_noise_size, - struct CurveMapping *clumpcurve); + const struct CurveMapping *clumpcurve); void do_child_modifiers(const ParticleChildModifierContext *modifier_ctx, float mat[4][4], ParticleKey *state, diff --git a/source/blender/blenlib/BLI_hash_md5.h b/source/blender/blenlib/BLI_hash_md5.h index 8acb3355853..eaebcc53a61 100644 --- a/source/blender/blenlib/BLI_hash_md5.h +++ b/source/blender/blenlib/BLI_hash_md5.h @@ -26,7 +26,7 @@ void *BLI_hash_md5_buffer(const char *buffer, size_t len, void *resblock); */ int BLI_hash_md5_stream(FILE *stream, void *resblock); -char *BLI_hash_md5_to_hexdigest(void *resblock, char r_hex_digest[33]); +char *BLI_hash_md5_to_hexdigest(const void *resblock, char r_hex_digest[33]); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h index 493326f1983..bddc03b1922 100644 --- a/source/blender/blenlib/BLI_string_utf8.h +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -168,7 +168,7 @@ size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, size_t dst_maxncpy) ATTR_NONNULL(1, 2); size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__restrict src_c, - size_t dst_maxncpy) ATTR_NONNULL(1, 2); + size_t dst_w_maxncpy) ATTR_NONNULL(1, 2); /** * Count columns that character/string occupies (based on `wcwidth.co`). diff --git a/source/blender/blenlib/intern/hash_md5.c b/source/blender/blenlib/intern/hash_md5.c index 19bc60cf0e6..821a11abd78 100644 --- a/source/blender/blenlib/intern/hash_md5.c +++ b/source/blender/blenlib/intern/hash_md5.c @@ -379,7 +379,7 @@ void *BLI_hash_md5_buffer(const char *buffer, size_t len, void *resblock) return md5_read_ctx(&ctx, resblock); } -char *BLI_hash_md5_to_hexdigest(void *resblock, char r_hex_digest[33]) +char *BLI_hash_md5_to_hexdigest(const void *resblock, char r_hex_digest[33]) { static const char hex_map[17] = "0123456789abcdef"; const unsigned char *p; diff --git a/source/blender/blenlib/intern/polyfill_2d.c b/source/blender/blenlib/intern/polyfill_2d.c index 8c0a43a03ea..d0078e8f404 100644 --- a/source/blender/blenlib/intern/polyfill_2d.c +++ b/source/blender/blenlib/intern/polyfill_2d.c @@ -144,7 +144,7 @@ typedef struct PolyIndex { /* based on libgdx 2013-11-28, apache 2.0 licensed */ -static void pf_coord_sign_calc(PolyFill *pf, PolyIndex *pi); +static void pf_coord_sign_calc(const PolyFill *pf, PolyIndex *pi); static PolyIndex *pf_ear_tip_find(PolyFill *pf #ifdef USE_CLIP_EVEN @@ -576,7 +576,7 @@ static void pf_triangulate(PolyFill *pf) /** * \return CONCAVE, TANGENTIAL or CONVEX */ -static void pf_coord_sign_calc(PolyFill *pf, PolyIndex *pi) +static void pf_coord_sign_calc(const PolyFill *pf, PolyIndex *pi) { /* localize */ const float(*coords)[2] = pf->coords; diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index b2e11b8ec72..968f3c9a7b7 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -108,7 +108,7 @@ static eV3DProjStatus ed_view3d_project__internal(const ARegion *region, BLI_assert((flag & V3D_PROJ_TEST_ALL) == flag); if (flag & V3D_PROJ_TEST_CLIP_BB) { - RegionView3D *rv3d = region->regiondata; + const RegionView3D *rv3d = region->regiondata; if (rv3d->rflag & RV3D_CLIPPING) { if (ED_view3d_clipping_test(rv3d, co, is_local)) { return V3D_PROJ_RET_CLIP_BB; @@ -326,7 +326,7 @@ static void view3d_win_to_ray_segment(const struct Depsgraph *depsgraph, float r_ray_start[3], float r_ray_end[3]) { - RegionView3D *rv3d = region->regiondata; + const RegionView3D *rv3d = region->regiondata; float _ray_co[3], _ray_dir[3], start_offset, end_offset; if (!r_ray_co) { diff --git a/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_util.c b/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_util.c index e800eaeeaf1..a5a0e7e1fcc 100644 --- a/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_util.c +++ b/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_util.c @@ -141,7 +141,7 @@ bool is_stroke_affected_by_modifier(Object *ob, return true; } -float get_modifier_point_weight(MDeformVert *dvert, bool inverse, int def_nr) +float get_modifier_point_weight(const MDeformVert *dvert, bool inverse, int def_nr) { float weight = 1.0f; diff --git a/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_util.h b/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_util.h index 249788ec420..f9e6a131cdd 100644 --- a/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_util.h +++ b/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_util.h @@ -36,7 +36,7 @@ bool is_stroke_affected_by_modifier(struct Object *ob, /** * Verify if valid vertex group *and return weight. */ -float get_modifier_point_weight(struct MDeformVert *dvert, bool inverse, int def_nr); +float get_modifier_point_weight(const struct MDeformVert *dvert, bool inverse, int def_nr); /** * Generic bake function for deformStroke. */ diff --git a/source/blender/imbuf/intern/readimage.cc b/source/blender/imbuf/intern/readimage.cc index 355d5da2a35..bb3d7604019 100644 --- a/source/blender/imbuf/intern/readimage.cc +++ b/source/blender/imbuf/intern/readimage.cc @@ -33,7 +33,7 @@ static void imb_handle_alpha(ImBuf *ibuf, int flags, char colorspace[IM_MAX_SPACE], - char effective_colorspace[IM_MAX_SPACE]) + const char effective_colorspace[IM_MAX_SPACE]) { if (colorspace) { if (ibuf->byte_buffer.data != nullptr && ibuf->float_buffer.data == nullptr) { diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index b42422be640..923ad24cc1b 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -677,7 +677,7 @@ static void rna_def_depsgraph(BlenderRNA *brna) PropertyRNA *parm; PropertyRNA *prop; - static EnumPropertyItem enum_depsgraph_mode_items[] = { + static const EnumPropertyItem enum_depsgraph_mode_items[] = { {DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Viewport non-rendered mode"}, {DAG_EVAL_RENDER, "RENDER", 0, "Render", "Render"}, {0, NULL, 0, NULL, NULL}, diff --git a/source/blender/makesrna/intern/rna_light.c b/source/blender/makesrna/intern/rna_light.c index 6b4ab2e64b4..83068acb23c 100644 --- a/source/blender/makesrna/intern/rna_light.c +++ b/source/blender/makesrna/intern/rna_light.c @@ -107,7 +107,7 @@ static void rna_def_light(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static float default_color[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + static const float default_color[4] = {1.0f, 1.0f, 1.0f, 1.0f}; srna = RNA_def_struct(brna, "Light", "ID"); RNA_def_struct_sdna(srna, "Light"); diff --git a/source/blender/python/intern/bpy_msgbus.c b/source/blender/python/intern/bpy_msgbus.c index af724b8f618..ef1bf3c5ac2 100644 --- a/source/blender/python/intern/bpy_msgbus.c +++ b/source/blender/python/intern/bpy_msgbus.c @@ -224,7 +224,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject *UNUSED(self), PyObject *args IS_PERSISTENT = (1 << 0), }; PyObject *py_options = NULL; - EnumPropertyItem py_options_enum[] = { + const EnumPropertyItem py_options_enum[] = { {IS_PERSISTENT, "PERSISTENT", 0, ""}, {0, NULL, 0, NULL, NULL}, }; diff --git a/source/blender/render/intern/texture_image.c b/source/blender/render/intern/texture_image.c index 9807a45ae4e..5d69bbe1d37 100644 --- a/source/blender/render/intern/texture_image.c +++ b/source/blender/render/intern/texture_image.c @@ -407,7 +407,7 @@ static void clipy_rctf_swap(rctf *stack, short *count, float y1, float y2) } } -static float square_rctf(rctf *rf) +static float square_rctf(const rctf *rf) { float x, y; @@ -461,7 +461,7 @@ static float clipy_rctf(rctf *rf, float y1, float y2) return 1.0; } -static void boxsampleclip(ImBuf *ibuf, rctf *rf, TexResult *texres) +static void boxsampleclip(ImBuf *ibuf, const rctf *rf, TexResult *texres) { /* Sample box, is clipped already, and minx etc. have been set at ibuf size. * Enlarge with anti-aliased edges of the pixels. */ @@ -881,8 +881,13 @@ static void feline_eval(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata } #undef EWA_MAXIDX -static void alpha_clip_aniso( - ImBuf *ibuf, float minx, float miny, float maxx, float maxy, int extflag, TexResult *texres) +static void alpha_clip_aniso(const ImBuf *ibuf, + float minx, + float miny, + float maxx, + float maxy, + int extflag, + TexResult *texres) { float alphaclip; rctf rf;