[Bf-blender-cvs] [357acd1d505] master: Cleanup: pass arguments as const

Campbell Barton noreply at git.blender.org
Mon Oct 4 04:19:39 CEST 2021


Commit: 357acd1d5053b2ff9c8a09b9b6ad2e170c10b875
Author: Campbell Barton
Date:   Mon Oct 4 13:12:40 2021 +1100
Branches: master
https://developer.blender.org/rB357acd1d5053b2ff9c8a09b9b6ad2e170c10b875

Cleanup: pass arguments as const

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

M	intern/mikktspace/mikktspace.c
M	source/blender/blenlib/BLI_math_geom.h
M	source/blender/blenlib/BLI_math_vector.h
M	source/blender/blenlib/intern/math_geom_inline.c
M	source/blender/blenlib/intern/math_vector_inline.c
M	source/blender/datatoc/datatoc_icon.c
M	source/blender/editors/space_outliner/tree/tree_display.hh
M	source/blender/editors/space_outliner/tree/tree_display_libraries.cc
M	source/blender/editors/space_outliner/tree/tree_display_override_library.cc
M	source/blender/editors/space_outliner/tree/tree_element.cc
M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_constraints.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h

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

diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c
index 96e8d433e30..b4596dc35ad 100644
--- a/intern/mikktspace/mikktspace.c
+++ b/intern/mikktspace/mikktspace.c
@@ -1112,7 +1112,7 @@ static tbool AssignRecur(const int piTriListIn[],
 
 static tbool CompareSubGroups(const SSubGroup *pg1, const SSubGroup *pg2);
 static void QuickSort(int *pSortBuffer, int iLeft, int iRight, unsigned int uSeed);
-static STSpace EvalTspace(int face_indices[],
+static STSpace EvalTspace(const int face_indices[],
                           const int iFaces,
                           const int piTriListIn[],
                           const STriInfo pTriInfos[],
@@ -1292,7 +1292,7 @@ static tbool GenerateTSpaces(STSpace psTspace[],
   return TTRUE;
 }
 
-static STSpace EvalTspace(int face_indices[],
+static STSpace EvalTspace(const int face_indices[],
                           const int iFaces,
                           const int piTriListIn[],
                           const STriInfo pTriInfos[],
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/s

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list