From 357acd1d5053b2ff9c8a09b9b6ad2e170c10b875 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Oct 2021 13:12:40 +1100 Subject: Cleanup: pass arguments as const --- source/blender/blenlib/BLI_math_geom.h | 2 +- source/blender/blenlib/BLI_math_vector.h | 2 +- source/blender/blenlib/intern/math_geom_inline.c | 2 +- source/blender/blenlib/intern/math_vector_inline.c | 2 +- source/blender/datatoc/datatoc_icon.c | 2 +- source/blender/editors/space_outliner/tree/tree_display.hh | 4 ++-- .../editors/space_outliner/tree/tree_display_libraries.cc | 2 +- .../space_outliner/tree/tree_display_override_library.cc | 2 +- source/blender/editors/space_outliner/tree/tree_element.cc | 9 +++++---- source/blender/editors/transform/transform.h | 6 +++--- source/blender/editors/transform/transform_constraints.c | 12 ++++++------ source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c | 2 +- source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h | 2 +- 13 files changed, 25 insertions(+), 24 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index bcda25ca533..fa9a30467ac 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -781,7 +781,7 @@ MINLINE void add_sh_shsh(float r[9], const float a[9], const float b[9]); MINLINE float dot_shsh(const float a[9], const float b[9]); MINLINE float eval_shv3(float r[9], const float v[3]); -MINLINE float diffuse_shv3(float r[9], const float v[3]); +MINLINE float diffuse_shv3(const float r[9], const float v[3]); MINLINE void vec_fac_to_sh(float r[9], const float v[3], const float f); MINLINE void madd_sh_shfl(float r[9], const float sh[9], const float f); diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 860ba14a3ed..62fd4a835ef 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -214,7 +214,7 @@ MINLINE void cross_v3_v3v3_db(double r[3], const double a[3], const double b[3]) MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const float v_curr[3]); -MINLINE void star_m3_v3(float rmat[3][3], float a[3]); +MINLINE void star_m3_v3(float rmat[3][3], const float a[3]); /*********************************** Length **********************************/ diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c index 1757b0dd525..857cbfbde9c 100644 --- a/source/blender/blenlib/intern/math_geom_inline.c +++ b/source/blender/blenlib/intern/math_geom_inline.c @@ -99,7 +99,7 @@ MINLINE float dot_shsh(const float a[9], const float b[9]) return r; } -MINLINE float diffuse_shv3(float sh[9], const float v[3]) +MINLINE float diffuse_shv3(const float sh[9], const float v[3]) { /* See formula (13) in: * "An Efficient Representation for Irradiance Environment Maps" */ diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index ddfdaffb706..8be066bb0e9 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -991,7 +991,7 @@ MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const f n[2] += (v_prev[0] - v_curr[0]) * (v_prev[1] + v_curr[1]); } -MINLINE void star_m3_v3(float rmat[3][3], float a[3]) +MINLINE void star_m3_v3(float rmat[3][3], const float a[3]) { rmat[0][0] = rmat[1][1] = rmat[2][2] = 0.0; rmat[0][1] = -a[2]; diff --git a/source/blender/datatoc/datatoc_icon.c b/source/blender/datatoc/datatoc_icon.c index 8a0c7175fee..b4ee1c6d4c9 100644 --- a/source/blender/datatoc/datatoc_icon.c +++ b/source/blender/datatoc/datatoc_icon.c @@ -245,7 +245,7 @@ static struct IconInfo *icon_merge_context_info_for_icon_head(struct IconMergeCo static void icon_merge_context_register_icon(struct IconMergeContext *context, const char *file_name, - struct IconHead *icon_head) + const struct IconHead *icon_head) { context->read_icons = realloc(context->read_icons, sizeof(struct IconInfo) * (context->num_read_icons + 1)); diff --git a/source/blender/editors/space_outliner/tree/tree_display.hh b/source/blender/editors/space_outliner/tree/tree_display.hh index 96af8258010..8aaf396888f 100644 --- a/source/blender/editors/space_outliner/tree/tree_display.hh +++ b/source/blender/editors/space_outliner/tree/tree_display.hh @@ -106,7 +106,7 @@ class TreeDisplayLibraries final : public AbstractTreeDisplay { private: TreeElement *add_library_contents(Main &, ListBase &, Library *) const; - bool library_id_filter_poll(Library *lib, ID *id) const; + bool library_id_filter_poll(const Library *lib, ID *id) const; short id_filter_get() const; }; @@ -124,7 +124,7 @@ class TreeDisplayOverrideLibrary final : public AbstractTreeDisplay { private: TreeElement *add_library_contents(Main &, ListBase &, Library *) const; - bool override_library_id_filter_poll(Library *lib, ID *id) const; + bool override_library_id_filter_poll(const Library *lib, ID *id) const; short id_filter_get() const; }; diff --git a/source/blender/editors/space_outliner/tree/tree_display_libraries.cc b/source/blender/editors/space_outliner/tree/tree_display_libraries.cc index c6b700318dd..371813cfb3f 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_libraries.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_libraries.cc @@ -186,7 +186,7 @@ short TreeDisplayLibraries::id_filter_get() const return 0; } -bool TreeDisplayLibraries::library_id_filter_poll(Library *lib, ID *id) const +bool TreeDisplayLibraries::library_id_filter_poll(const Library *lib, ID *id) const { if (id->lib != lib) { return false; diff --git a/source/blender/editors/space_outliner/tree/tree_display_override_library.cc b/source/blender/editors/space_outliner/tree/tree_display_override_library.cc index a17bf174a74..0e4636db69d 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_override_library.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_override_library.cc @@ -186,7 +186,7 @@ short TreeDisplayOverrideLibrary::id_filter_get() const return 0; } -bool TreeDisplayOverrideLibrary::override_library_id_filter_poll(Library *lib, ID *id) const +bool TreeDisplayOverrideLibrary::override_library_id_filter_poll(const Library *lib, ID *id) const { if (id->lib != lib) { return false; diff --git a/source/blender/editors/space_outliner/tree/tree_element.cc b/source/blender/editors/space_outliner/tree/tree_element.cc index 113d421ed91..36da7fe1944 100644 --- a/source/blender/editors/space_outliner/tree/tree_element.cc +++ b/source/blender/editors/space_outliner/tree/tree_element.cc @@ -91,7 +91,8 @@ static void tree_element_free(AbstractTreeElement **tree_element) *tree_element = nullptr; } -static void tree_element_expand(AbstractTreeElement &tree_element, SpaceOutliner &space_outliner) +static void tree_element_expand(const AbstractTreeElement &tree_element, + SpaceOutliner &space_outliner) { /* Most types can just expand. IDs optionally expand (hence the poll) and do additional, common * expanding. Could be done nicer, we could request a small "expander" helper object from the @@ -107,7 +108,7 @@ static void tree_element_expand(AbstractTreeElement &tree_element, SpaceOutliner * Needed for types that still expand in C, but need to execute the same post-expand logic. Can be * removed once all ID types expand entirely using the new design. */ -static void tree_element_post_expand_only(AbstractTreeElement &tree_element, +static void tree_element_post_expand_only(const AbstractTreeElement &tree_element, SpaceOutliner &space_outliner) { tree_element.postExpand(space_outliner); @@ -116,8 +117,8 @@ static void tree_element_post_expand_only(AbstractTreeElement &tree_element, * Needed for types that still expand in C, to poll if they should expand in current context. Can * be removed once all ID types expand entirely using the new design. */ -static bool tree_element_expand_poll(AbstractTreeElement &tree_element, - SpaceOutliner &space_outliner) +static bool tree_element_expand_poll(const AbstractTreeElement &tree_element, + const SpaceOutliner &space_outliner) { return tree_element.expandPoll(space_outliner); } diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 7f4e533ccd7..1be46c03f85 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -365,18 +365,18 @@ typedef struct TransCon { * The last three parameters are pointers to the in/out/printable vectors. */ void (*applyVec)(const struct TransInfo *t, const struct TransDataContainer *tc, - struct TransData *td, + const struct TransData *td, const float in[3], float r_out[3]); /** Apply function pointer for size transformation. */ void (*applySize)(const struct TransInfo *t, const struct TransDataContainer *tc, - struct TransData *td, + const struct TransData *td, float r_smat[3][3]); /** Apply function pointer for rotation transformation */ void (*applyRot)(const struct TransInfo *t, const struct TransDataContainer *tc, - struct TransData *td, + const struct TransData *td, float r_axis[3], float *r_angle); } TransCon; diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 7135395ee2d..e2ad89e0dbc 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -393,7 +393,7 @@ static void planeProjection(const TransInfo *t, const float in[3], float out[3]) */ static void applyAxisConstraintVec(const TransInfo *t, const TransDataContainer *UNUSED(tc), - TransData *td, + const TransData *td, const float in[3], float out[3]) { @@ -477,7 +477,7 @@ static void applyAxisConstraintVec(const TransInfo *t, */ static void applyObjectConstraintVec(const TransInfo *t, const TransDataContainer *tc, - TransData *td, + const TransData *td, const float in[3], float out[3]) { @@ -502,7 +502,7 @@ static void applyObjectConstraintVec(const TransInfo *t, */ static void applyAxisConstraintSize(const TransInfo *t, const TransDataContainer *UNUSED(tc), - TransData *td, + const TransData *td, float r_smat[3][3]) { if (!td && t->con.mode & CON_APPLY) { @@ -528,7 +528,7 @@ static void applyAxisConstraintSize(const TransInfo *t, */ static void applyObjectConstraintSize(const TransInfo *t, const TransDataContainer *tc, - TransData *td, + const TransData *td, float r_smat[3][3]) { if (td && t->con.mode & CON_APPLY) { @@ -603,7 +603,7 @@ static void constraints_rotation_impl(const TransInfo *t, */ static void applyAxisConstraintRot(const TransInfo *t, const TransDataContainer *UNUSED(tc), - TransData *td, + const TransData *td, float r_axis[3], float *r_angle) { @@ -627,7 +627,7 @@ static void applyAxisConstraintRot(const TransInfo *t, */ static void applyObjectConstraintRot(const TransInfo *t, const TransDataContainer *tc, - TransData *td, + const TransData *td, float r_axis[3], float *r_angle) { diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c index df78ac8110e..595a0c1cc5e 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c @@ -73,7 +73,7 @@ void gpencil_modifier_type_init(GpencilModifierTypeInfo *types[]) /* verify if valid layer, material and pass index */ bool is_stroke_affected_by_modifier(Object *ob, char *mlayername, - Material *material, + const Material *material, const int mpassindex, const int gpl_passindex, const int minpoints, diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h index 30e54f44499..2878ad4c73a 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h @@ -31,7 +31,7 @@ struct bGPDstroke; bool is_stroke_affected_by_modifier(struct Object *ob, char *mlayername, - struct Material *material, + const struct Material *material, const int mpassindex, const int gpl_passindex, const int minpoints, -- cgit v1.2.3