[Bf-blender-cvs] [c07eaa3384d] master: Cleanup: argument naming, redundant NULL checks

Campbell Barton noreply at git.blender.org
Wed Oct 2 23:40:49 CEST 2019


Commit: c07eaa3384dfe90bc2671a9bb3be2b77ad33297d
Author: Campbell Barton
Date:   Thu Oct 3 07:31:24 2019 +1000
Branches: master
https://developer.blender.org/rBc07eaa3384dfe90bc2671a9bb3be2b77ad33297d

Cleanup: argument naming, redundant NULL checks

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

M	source/blender/blenkernel/BKE_editmesh_bvh.h
M	source/blender/blenkernel/BKE_image.h
M	source/blender/blenkernel/intern/cloth.c
M	source/blender/blenkernel/intern/paint.c
M	source/blender/blenkernel/intern/subdiv_ccg.c
M	source/blender/blenkernel/intern/text.c
M	source/blender/blenlib/BLI_math_geom.h
M	source/blender/blenloader/intern/versioning_250.c
M	source/blender/blenloader/intern/versioning_legacy.c
M	source/blender/draw/engines/workbench/workbench_studiolight.c
M	source/blender/editors/animation/keyframes_draw.c
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/resources.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/editors/transform/transform_generics.c
M	source/blender/makesrna/intern/rna_main_api.c

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

diff --git a/source/blender/blenkernel/BKE_editmesh_bvh.h b/source/blender/blenkernel/BKE_editmesh_bvh.h
index e86408076cd..7c8a9452023 100644
--- a/source/blender/blenkernel/BKE_editmesh_bvh.h
+++ b/source/blender/blenkernel/BKE_editmesh_bvh.h
@@ -72,8 +72,8 @@ struct BMFace *BKE_bmbvh_ray_cast_filter(BMBVHTree *tree,
                                          float *r_dist,
                                          float r_hitout[3],
                                          float r_cagehit[3],
-                                         BMBVHTree_FaceFilter filter,
-                                         void *filter_cb);
+                                         BMBVHTree_FaceFilter filter_cb,
+                                         void *filter_userdata);
 
 /* find a vert closest to co in a sphere of radius dist_max */
 struct BMVert *BKE_bmbvh_find_vert_closest(BMBVHTree *tree,
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index 234b74eece3..82c831ae8e0 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -309,11 +309,11 @@ void BKE_image_get_aspect(struct Image *image, float *aspx, float *aspy);
 /* image_gen.c */
 void BKE_image_buf_fill_color(
     unsigned char *rect, float *rect_float, int width, int height, const float color[4]);
-void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int height, int width);
+void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int width, int height);
 void BKE_image_buf_fill_checker_color(unsigned char *rect,
                                       float *rect_float,
-                                      int height,
-                                      int width);
+                                      int width,
+                                      int height);
 
 /* Cycles hookup */
 unsigned char *BKE_image_get_pixels_for_frame(struct Image *image, int frame);
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 63d58f7e32e..463cbd4f378 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -772,7 +772,7 @@ static int cloth_from_object(
     clmd->clothObject->old_solver_type = 255;
     clmd->clothObject->edgeset = NULL;
   }
-  else if (!clmd->clothObject) {
+  else {
     modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject");
     return 0;
   }
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 983127372ca..143b8debce7 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -224,7 +224,6 @@ const EnumPropertyItem *BKE_paint_get_tool_enum_from_paintmode(ePaintMode mode)
       return rna_enum_brush_image_tool_items;
     case PAINT_MODE_SCULPT_UV:
       return rna_enum_brush_uv_sculpt_tool_items;
-      return NULL;
     case PAINT_MODE_GPENCIL:
       return rna_enum_brush_gpencil_types_items;
     case PAINT_MODE_INVALID:
diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c
index 471cca53900..9ae0841bc82 100644
--- a/source/blender/blenkernel/intern/subdiv_ccg.c
+++ b/source/blender/blenkernel/intern/subdiv_ccg.c
@@ -593,7 +593,7 @@ Mesh *BKE_subdiv_to_ccg_mesh(Subdiv *subdiv,
   BKE_subdiv_stats_begin(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_CCG);
   if (!BKE_subdiv_eval_update_from_mesh(subdiv, coarse_mesh, NULL)) {
     if (coarse_mesh->totpoly) {
-      return false;
+      return NULL;
     }
   }
   BKE_subdiv_stats_end(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_CCG);
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 83be64e84c9..6b8e33e3a01 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -352,7 +352,7 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const
 
   buffer = BLI_file_read_text_as_mem(filepath_abs, 0, &buffer_len);
   if (buffer == NULL) {
-    return false;
+    return NULL;
   }
 
   ta = BKE_libblock_alloc(bmain, ID_TXT, BLI_path_basename(filepath_abs), 0);
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 87517ebe060..eec5d214473 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -97,10 +97,10 @@ bool is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3],
 bool is_quad_convex_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2]);
 bool is_poly_convex_v2(const float verts[][2], unsigned int nr);
 int is_quad_flip_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]);
-bool is_quad_flip_v3_first_third_fast(const float v0[3],
-                                      const float v1[3],
+bool is_quad_flip_v3_first_third_fast(const float v1[3],
                                       const float v2[3],
-                                      const float v3[3]);
+                                      const float v3[3],
+                                      const float v4[3]);
 
 /********************************* Distance **********************************/
 
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index 72013bc6eed..d8e4f3d97a5 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -1673,15 +1673,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
 
     for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
-      if (scene) {
-        Sequence *seq;
-        SEQ_BEGIN (scene->ed, seq) {
-          if (seq->sat == 0.0f) {
-            seq->sat = 1.0f;
-          }
+      Sequence *seq;
+      SEQ_BEGIN (scene->ed, seq) {
+        if (seq->sat == 0.0f) {
+          seq->sat = 1.0f;
         }
-        SEQ_END;
       }
+      SEQ_END;
     }
 
     /* GSOC 2010 Sculpt - New settings for Brush */
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index 62bd605a2c2..1b30c7371a2 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -1705,19 +1705,17 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
     /* add default radius values to old curve points */
     for (cu = bmain->curves.first; cu; cu = cu->id.next) {
       for (nu = cu->nurb.first; nu; nu = nu->next) {
-        if (nu) {
-          if (nu->bezt) {
-            for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) {
-              if (!bezt->radius) {
-                bezt->radius = 1.0;
-              }
+        if (nu->bezt) {
+          for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) {
+            if (!bezt->radius) {
+              bezt->radius = 1.0;
             }
           }
-          else if (nu->bp) {
-            for (bp = nu->bp, a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
-              if (!bp->radius) {
-                bp->radius = 1.0;
-              }
+        }
+        else if (nu->bp) {
+          for (bp = nu->bp, a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
+            if (!bp->radius) {
+              bp->radius = 1.0;
             }
           }
         }
@@ -2515,17 +2513,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 
     for (cu = bmain->curves.first; cu; cu = cu->id.next) {
       for (nu = cu->nurb.first; nu; nu = nu->next) {
-        if (nu) {
-          nu->radius_interp = 3;
-
-          /* resolu and resolv are now used differently for surfaces
-           * rather than using the resolution to define the entire number of divisions,
-           * use it for the number of divisions per segment
-           */
-          if (nu->pntsv > 1) {
-            nu->resolu = MAX2(1, (int)(((float)nu->resolu / (float)nu->pntsu) + 0.5f));
-            nu->resolv = MAX2(1, (int)(((float)nu->resolv / (float)nu->pntsv) + 0.5f));
-          }
+        nu->radius_interp = 3;
+
+        /* resolu and resolv are now used differently for surfaces
+         * rather than using the resolution to define the entire number of divisions,
+         * use it for the number of divisions per segment
+         */
+        if (nu->pntsv > 1) {
+          nu->resolu = MAX2(1, (int)(((float)nu->resolu / (float)nu->pntsu) + 0.5f));
+          nu->resolv = MAX2(1, (int)(((float)nu->resolv / (float)nu->pntsv) + 0.5f));
         }
       }
     }
diff --git a/source/blender/draw/engines/workbench/workbench_studiolight.c b/source/blender/draw/engines/workbench/workbench_studiolight.c
index ac27ff0b736..941a6741998 100644
--- a/source/blender/draw/engines/workbench/workbench_studiolight.c
+++ b/source/blender/draw/engines/workbench/workbench_studiolight.c
@@ -131,7 +131,7 @@ void studiolight_update_world(WORKBENCH_PrivateData *wpd,
 static void compute_parallel_lines_nor_and_dist(const float v1[2],
                                                 const float v2[2],
                                                 const float v3[2],
-                                                float r_line[2])
+                                                float r_line[4])
 {
   sub_v2_v2v2(r_line, v2, v1);
   /* Find orthogonal vector. */
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index c174ce83bea..479e7192b0e 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -545,8 +545,7 @@ int actkeyblock_get_valid_hold(ActKeyColumn *ac)
     return 0;
   }
 
-  const int hold_mask = (ACTKEYBLOCK_FLAG_ANY_HOLD | ACTKEYBLOCK_FLAG_STATIC_HOLD |
-                         ACTKEYBLOCK_FLAG_ANY_HOLD);
+  const int hold_mask = (ACTKEYBLOCK_FLAG_ANY_HOLD | ACTKEYBLOCK_FLAG_STATIC_HOLD);
   return (ac->block.flag & ~ac->block.conflict) & hold_mask;
 }
 
diff --git a/source/blender/editors/interface/interface_handlers.c b/source

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list