[Bf-blender-cvs] [4d46fac65d9] master: Cleanup: use count or num instead of nbr

Campbell Barton noreply at git.blender.org
Fri Mar 25 02:12:51 CET 2022


Commit: 4d46fac65d9946382c4be5b3842660e77468f00b
Author: Campbell Barton
Date:   Fri Mar 25 12:04:20 2022 +1100
Branches: master
https://developer.blender.org/rB4d46fac65d9946382c4be5b3842660e77468f00b

Cleanup: use count or num instead of nbr

Follow conventions from T85728.

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

M	source/blender/blenfont/intern/blf_thumbs.c
M	source/blender/blenkernel/BKE_scene.h
M	source/blender/blenkernel/intern/appdir.c
M	source/blender/blenkernel/intern/image.cc
M	source/blender/blenkernel/intern/mesh_mapping.c
M	source/blender/blenkernel/intern/mesh_normals.cc
M	source/blender/blenkernel/intern/mesh_validate.cc
M	source/blender/blenkernel/intern/particle_system.c
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenkernel/intern/studiolight.c
M	source/blender/blenlib/BLI_math_statistics.h
M	source/blender/blenlib/BLI_math_vector.h
M	source/blender/blenlib/intern/BLI_filelist.c
M	source/blender/blenlib/intern/fileops.c
M	source/blender/blenlib/intern/math_statistics.c
M	source/blender/blenlib/intern/math_vector.c
M	source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
M	source/blender/blenlib/tests/performance/BLI_task_performance_test.cc
M	source/blender/bmesh/intern/bmesh_mesh_normals.c
M	source/blender/compositor/intern/COM_Debug.cc
M	source/blender/draw/engines/eevee/eevee_shadows_cascade.c
M	source/blender/editors/asset/intern/asset_indexer.cc
M	source/blender/editors/gpencil/gpencil_convert.c
M	source/blender/editors/interface/interface.c
M	source/blender/editors/interface/interface_draw.c
M	source/blender/editors/space_file/filelist.c
M	source/blender/editors/space_file/fsmenu.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/modifiers/intern/MOD_skin.c
M	source/blender/sequencer/intern/disk_cache.c

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

diff --git a/source/blender/blenfont/intern/blf_thumbs.c b/source/blender/blenfont/intern/blf_thumbs.c
index e57ed9abffd..0e265fb7553 100644
--- a/source/blender/blenfont/intern/blf_thumbs.c
+++ b/source/blender/blenfont/intern/blf_thumbs.c
@@ -73,7 +73,7 @@ void BLF_thumb_preview(const char *filepath,
   for (int i = 0; i < draw_str_lines; i++) {
     const char *draw_str_i18n = i18n_draw_str[i] != NULL ? i18n_draw_str[i] : draw_str[i];
     const size_t draw_str_i18n_len = strlen(draw_str_i18n);
-    int draw_str_i18n_nbr = 0;
+    int draw_str_i18_count = 0;
 
     CLAMP_MIN(font_size_curr, font_size_min);
     if (!blf_font_size(font, (float)font_size_curr, dpi)) {
@@ -91,8 +91,8 @@ void BLF_thumb_preview(const char *filepath,
      * since many fonts will then show nothing but ugly 'missing char' in their preview).
      * Does not handle all cases, but much better than nothing.
      */
-    if (blf_font_count_missing_chars(font, draw_str_i18n, draw_str_i18n_len, &draw_str_i18n_nbr) >
-        (draw_str_i18n_nbr / 2)) {
+    if (blf_font_count_missing_chars(font, draw_str_i18n, draw_str_i18n_len, &draw_str_i18_count) >
+        (draw_str_i18_count / 2)) {
       blf_font_draw_buffer(font, draw_str[i], strlen(draw_str[i]), NULL);
     }
     else {
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index 8c50a89ec90..a6402a1e8a1 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -225,7 +225,7 @@ bool BKE_scene_remove_render_view(struct Scene *scene, struct SceneRenderView *s
 /* Render profile. */
 
 int get_render_subsurf_level(const struct RenderData *r, int lvl, bool for_render);
-int get_render_child_particle_number(const struct RenderData *r, int num, bool for_render);
+int get_render_child_particle_number(const struct RenderData *r, int child_num, bool for_render);
 
 bool BKE_scene_use_shading_nodes_custom(struct Scene *scene);
 bool BKE_scene_use_spherical_stereo(struct Scene *scene);
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index b0393ed723d..8d3649fef08 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -1022,16 +1022,16 @@ void BKE_appdir_app_templates(ListBase *templates)
       continue;
     }
 
-    struct direntry *dir;
-    uint totfile = BLI_filelist_dir_contents(subdir, &dir);
-    for (int f = 0; f < totfile; f++) {
-      if (!FILENAME_IS_CURRPAR(dir[f].relname) && S_ISDIR(dir[f].type)) {
-        char *template = BLI_strdup(dir[f].relname);
+    struct direntry *dirs;
+    const uint dir_num = BLI_filelist_dir_contents(subdir, &dirs);
+    for (int f = 0; f < dir_num; f++) {
+      if (!FILENAME_IS_CURRPAR(dirs[f].relname) && S_ISDIR(dirs[f].type)) {
+        char *template = BLI_strdup(dirs[f].relname);
         BLI_addtail(templates, BLI_genericNodeN(template));
       }
     }
 
-    BLI_filelist_free(dir, totfile);
+    BLI_filelist_free(dirs, dir_num);
   }
 }
 
diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc
index c4f8677d199..b65f3416f0f 100644
--- a/source/blender/blenkernel/intern/image.cc
+++ b/source/blender/blenkernel/intern/image.cc
@@ -3113,14 +3113,15 @@ bool BKE_image_get_tile_info(char *filepath, ListBase *tiles, int *tile_start, i
   int max_udim = 0;
   int id;
 
-  struct direntry *dir;
-  uint totfile = BLI_filelist_dir_contents(dirname, &dir);
-  for (int i = 0; i < totfile; i++) {
-    if (!(dir[i].type & S_IFREG)) {
+  struct direntry *dirs;
+  const uint dirs_num = BLI_filelist_dir_contents(dirname, &dirs);
+  for (int i = 0; i < dirs_num; i++) {
+    if (!(dirs[i].type & S_IFREG)) {
       continue;
     }
 
-    if (!BKE_image_get_tile_number_from_filepath(dir[i].relname, udim_pattern, tile_format, &id)) {
+    if (!BKE_image_get_tile_number_from_filepath(
+            dirs[i].relname, udim_pattern, tile_format, &id)) {
       continue;
     }
 
@@ -3133,7 +3134,7 @@ bool BKE_image_get_tile_info(char *filepath, ListBase *tiles, int *tile_start, i
     min_udim = min_ii(min_udim, id);
     max_udim = max_ii(max_udim, id);
   }
-  BLI_filelist_free(dir, totfile);
+  BLI_filelist_free(dirs, dirs_num);
   MEM_SAFE_FREE(udim_pattern);
 
   if (is_udim && min_udim <= IMA_UDIM_MAX) {
@@ -3350,15 +3351,15 @@ bool BKE_image_tile_filepath_exists(const char *filepath)
   char *udim_pattern = BKE_image_get_tile_strformat(filepath, &tile_format);
 
   bool found = false;
-  struct direntry *dir;
-  uint totfile = BLI_filelist_dir_contents(dirname, &dir);
-  for (int i = 0; i < totfile; i++) {
-    if (!(dir[i].type & S_IFREG)) {
+  struct direntry *dirs;
+  const uint dirs_num = BLI_filelist_dir_contents(dirname, &dirs);
+  for (int i = 0; i < dirs_num; i++) {
+    if (!(dirs[i].type & S_IFREG)) {
       continue;
     }
 
     int id;
-    if (!BKE_image_get_tile_number_from_filepath(dir[i].path, udim_pattern, tile_format, &id)) {
+    if (!BKE_image_get_tile_number_from_filepath(dirs[i].path, udim_pattern, tile_format, &id)) {
       continue;
     }
 
@@ -3369,7 +3370,7 @@ bool BKE_image_tile_filepath_exists(const char *filepath)
     found = true;
     break;
   }
-  BLI_filelist_free(dir, totfile);
+  BLI_filelist_free(dirs, dirs_num);
   MEM_SAFE_FREE(udim_pattern);
 
   return found;
diff --git a/source/blender/blenkernel/intern/mesh_mapping.c b/source/blender/blenkernel/intern/mesh_mapping.c
index e9c26c80141..9c4098e2db6 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.c
+++ b/source/blender/blenkernel/intern/mesh_mapping.c
@@ -561,7 +561,7 @@ void BKE_mesh_origindex_map_create_looptri(MeshElemMap **r_map,
 typedef bool (*MeshRemap_CheckIslandBoundary)(const struct MPoly *mpoly,
                                               const struct MLoop *mloop,
                                               const struct MEdge *medge,
-                                              const int nbr_edge_users,
+                                              const int edge_user_count,
                                               const struct MPoly *mpoly_array,
                                               const struct MeshElemMap *edge_poly_map,
                                               void *user_data);
@@ -764,14 +764,14 @@ static void poly_edge_loop_islands_calc(const MEdge *medge,
 static bool poly_is_island_boundary_smooth_cb(const MPoly *mp,
                                               const MLoop *UNUSED(ml),
                                               const MEdge *me,
-                                              const int nbr_edge_users,
+                                              const int edge_user_count,
                                               const MPoly *mpoly_array,
                                               const MeshElemMap *edge_poly_map,
                                               void *UNUSED(user_data))
 {
   /* Edge is sharp if one of its polys is flat, or edge itself is sharp,
    * or edge is not used by exactly two polygons. */
-  if ((mp->flag & ME_SMOOTH) && !(me->flag & ME_SHARP) && (nbr_edge_users == 2)) {
+  if ((mp->flag & ME_SMOOTH) && !(me->flag & ME_SHARP) && (edge_user_count == 2)) {
     /* In that case, edge appears to be smooth, but we need to check its other poly too. */
     const MPoly *mp_other = (mp == &mpoly_array[edge_poly_map->indices[0]]) ?
                                 &mpoly_array[edge_poly_map->indices[1]] :
@@ -935,7 +935,7 @@ typedef struct MeshCheckIslandBoundaryUv {
 static bool mesh_check_island_boundary_uv(const MPoly *UNUSED(mp),
                                           const MLoop *ml,
                                           const MEdge *me,
-                                          const int UNUSED(nbr_edge_users),
+                                          const int UNUSED(edge_user_count),
                                           const MPoly *UNUSED(mpoly_array),
                                           const MeshElemMap *UNUSED(edge_poly_map),
                                           void *user_data)
diff --git a/source/blender/blenkernel/intern/mesh_normals.cc b/source/blender/blenkernel/intern/mesh_normals.cc
index 7633a3155ba..4448bedb57a 100644
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@ -613,19 +613,19 @@ void BKE_lnor_space_define(MLoopNorSpace *lnor_space,
   /* Compute ref alpha, average angle of all available edge vectors to lnor. */
   if (edge_vectors) {
     float alpha = 0.0f;
-    int nbr = 0;
+    int count = 0;
     while (!BLI_stack_is_empty(edge_vectors)) {
       const float *vec = (const float *)BLI_stack_peek(edge_vectors);
       alpha += saacosf(dot_v3v3(vec, lnor));
       BLI_stack_discard(edge_vectors);
-      nbr++;
+      count++;
     }
-    /* NOTE: In theory, this could be `nbr > 2`,
+    /* NOTE: In theory, this could be `count > 2`,
      * but there is one case where we only have two edges for two loops:
      * a smooth vertex with only two edges and two faces (our Monkey's nose has that, e.g.).
      */
-    BLI_assert(nbr >= 2); /* This piece of code shall only be called for more than one loop. */
-    lnor_space->ref_alpha = alpha / (float)nbr;
+    BLI_assert(count >= 2); /* This piece of code shall only be called for more than one loop. */
+    lnor_space->ref_alpha = alpha / (float)count;
   }
   else {
     lnor_space->ref_alpha = (saacosf(dot_v3v3(vec_ref, lnor)) +
@@ -1134,7 +1134,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
   /* We validate clnors data on the fly - cheapest way to do! */
   int clnors_avg[2] = {0, 0};
   short(*clnor_ref)[2] = nullptr;
-  int clnors_nbr = 0;
+  int clnors_count = 0;
   bool clnors_invalid = false;
 
   /* Temp loop normal stack. */
@@ -1194,7 +1194,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
       if (clnors_data) {
         /* Accumulate all clnors, if they are not all equal we have to fix that! */
         short(*clnor)[2] = &clnors_data[mlfan_vert_index];
-        if (clnors_nbr) {
+        if (clnors_count) {
       

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list