[Bf-blender-cvs] [33a74941c5f] master: Cleanup: Editors, Clang-Tidy else-after-return fixes

Sybren A. Stüvel noreply at git.blender.org
Fri Jul 3 17:43:28 CEST 2020


Commit: 33a74941c5fd4efb6eefcaace3315d3e2b65681f
Author: Sybren A. Stüvel
Date:   Fri Jul 3 17:30:31 2020 +0200
Branches: master
https://developer.blender.org/rB33a74941c5fd4efb6eefcaace3315d3e2b65681f

Cleanup: Editors, Clang-Tidy else-after-return fixes

This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/editors` module.

No functional changes.

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

M	source/blender/editors/curve/editcurve.c
M	source/blender/editors/curve/editcurve_query.c
M	source/blender/editors/curve/editcurve_select.c
M	source/blender/editors/curve/editfont.c
M	source/blender/editors/gizmo_library/gizmo_library_utils.c
M	source/blender/editors/io/io_collada.c
M	source/blender/editors/lattice/editlattice_select.c
M	source/blender/editors/mask/mask_add.c
M	source/blender/editors/mask/mask_ops.c
M	source/blender/editors/mask/mask_select.c
M	source/blender/editors/mask/mask_shapekey.c
M	source/blender/editors/physics/particle_edit.c
M	source/blender/editors/physics/rigidbody_constraint.c
M	source/blender/editors/physics/rigidbody_object.c
M	source/blender/editors/render/render_internal.c
M	source/blender/editors/render/render_opengl.c
M	source/blender/editors/render/render_shading.c
M	source/blender/editors/render/render_view.c
M	source/blender/editors/scene/scene_edit.c
M	source/blender/editors/space_action/action_data.c
M	source/blender/editors/space_action/action_edit.c
M	source/blender/editors/space_buttons/buttons_context.c
M	source/blender/editors/space_buttons/buttons_ops.c
M	source/blender/editors/space_console/console_ops.c
M	source/blender/editors/space_file/file_ops.c
M	source/blender/editors/space_file/filelist.c
M	source/blender/editors/space_file/filesel.c
M	source/blender/editors/space_file/fsmenu.c
M	source/blender/editors/space_graph/graph_draw.c
M	source/blender/editors/space_graph/graph_edit.c
M	source/blender/editors/space_graph/graph_select.c
M	source/blender/editors/space_image/image_buttons.c
M	source/blender/editors/space_image/image_ops.c
M	source/blender/editors/space_info/info_draw.c
M	source/blender/editors/space_info/textview.c
M	source/blender/editors/space_nla/nla_channels.c
M	source/blender/editors/space_nla/nla_edit.c
M	source/blender/editors/undo/ed_undo.c
M	source/blender/editors/util/ed_util.c
M	source/blender/editors/util/numinput.c

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

diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index a39c8261b32..38ab917ba72 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -2436,12 +2436,12 @@ static void adduplicateflagNurb(
                       /* actvert in cyclicu selection */
                       break;
                     }
-                    else if (calc_duplicate_actvert(editnurb,
-                                                    newnurb,
-                                                    cu,
-                                                    starta,
-                                                    starta + newu,
-                                                    cu->actvert - starta + b * newnu->pntsu)) {
+                    if (calc_duplicate_actvert(editnurb,
+                                               newnurb,
+                                               cu,
+                                               starta,
+                                               starta + newu,
+                                               cu->actvert - starta + b * newnu->pntsu)) {
                       /* actvert in 'current' iteration selection */
                       break;
                     }
@@ -4544,15 +4544,13 @@ static int make_segment_exec(bContext *C, wmOperator *op)
         if (nu_select_num > 1) {
           break;
         }
-        else {
-          /* only 1 selected, not first or last, a little complex, but intuitive */
-          if (nu->pntsv == 1) {
-            if ((nu->bp->f1 & SELECT) || (nu->bp[nu->pntsu - 1].f1 & SELECT)) {
-              /* pass */
-            }
-            else {
-              break;
-            }
+        /* only 1 selected, not first or last, a little complex, but intuitive */
+        if (nu->pntsv == 1) {
+          if ((nu->bp->f1 & SELECT) || (nu->bp[nu->pntsu - 1].f1 & SELECT)) {
+            /* pass */
+          }
+          else {
+            break;
           }
         }
       }
@@ -5593,9 +5591,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
 
     return OPERATOR_FINISHED;
   }
-  else {
-    return OPERATOR_CANCELLED;
-  }
+  return OPERATOR_CANCELLED;
 }
 
 static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -6517,9 +6513,7 @@ static int curve_delete_exec(bContext *C, wmOperator *op)
   if (changed_multi) {
     return OPERATOR_FINISHED;
   }
-  else {
-    return OPERATOR_CANCELLED;
-  }
+  return OPERATOR_CANCELLED;
 }
 
 static const EnumPropertyItem curve_delete_type_items[] = {
diff --git a/source/blender/editors/curve/editcurve_query.c b/source/blender/editors/curve/editcurve_query.c
index 132f7e58e71..774065b06ff 100644
--- a/source/blender/editors/curve/editcurve_query.c
+++ b/source/blender/editors/curve/editcurve_query.c
@@ -191,7 +191,8 @@ void ED_curve_nurb_vert_selected_find(
             *r_bezt = NULL;
             return;
           }
-          else if (*r_bezt || *r_bp) {
+
+          if (*r_bezt || *r_bp) {
             *r_bp = NULL;
             *r_bezt = NULL;
           }
@@ -214,7 +215,8 @@ void ED_curve_nurb_vert_selected_find(
             *r_nu = NULL;
             return;
           }
-          else if (*r_bezt || *r_bp) {
+
+          if (*r_bezt || *r_bp) {
             *r_bp = NULL;
             *r_bezt = NULL;
           }
diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c
index 73f970876b1..b60eb258916 100644
--- a/source/blender/editors/curve/editcurve_select.c
+++ b/source/blender/editors/curve/editcurve_select.c
@@ -66,12 +66,11 @@ bool select_beztriple(BezTriple *bezt, bool selstatus, short flag, eVisible_Type
       bezt->f3 |= flag;
       return true;
     }
-    else { /* deselects */
-      bezt->f1 &= ~flag;
-      bezt->f2 &= ~flag;
-      bezt->f3 &= ~flag;
-      return true;
-    }
+    /* deselects */
+    bezt->f1 &= ~flag;
+    bezt->f2 &= ~flag;
+    bezt->f3 &= ~flag;
+    return true;
   }
 
   return false;
@@ -85,10 +84,8 @@ bool select_bpoint(BPoint *bp, bool selstatus, short flag, bool hidden)
       bp->f1 |= flag;
       return true;
     }
-    else {
-      bp->f1 &= ~flag;
-      return true;
-    }
+    bp->f1 &= ~flag;
+    return true;
   }
 
   return false;
@@ -99,9 +96,7 @@ static bool swap_selection_beztriple(BezTriple *bezt)
   if (bezt->f2 & SELECT) {
     return select_beztriple(bezt, DESELECT, SELECT, VISIBLE);
   }
-  else {
-    return select_beztriple(bezt, SELECT, SELECT, VISIBLE);
-  }
+  return select_beztriple(bezt, SELECT, SELECT, VISIBLE);
 }
 
 static bool swap_selection_bpoint(BPoint *bp)
@@ -109,9 +104,7 @@ static bool swap_selection_bpoint(BPoint *bp)
   if (bp->f1 & SELECT) {
     return select_bpoint(bp, DESELECT, SELECT, VISIBLE);
   }
-  else {
-    return select_bpoint(bp, SELECT, SELECT, VISIBLE);
-  }
+  return select_bpoint(bp, SELECT, SELECT, VISIBLE);
 }
 
 bool ED_curve_nurb_select_check(View3D *v3d, Nurb *nu)
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 1bbd4b4a5bc..b759277572c 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -373,9 +373,7 @@ static wchar_t findaccent(wchar_t char1, uint code)
   if (new) {
     return new;
   }
-  else {
-    return char1;
-  }
+  return char1;
 }
 
 static int insert_into_textbuf(Object *obedit, uintptr_t c)
@@ -403,9 +401,7 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c)
 
     return 1;
   }
-  else {
-    return 0;
-  }
+  return 0;
 }
 
 static void text_update_edited(bContext *C, Object *obedit, int mode)
@@ -887,9 +883,7 @@ static int font_select_all_exec(bContext *C, wmOperator *UNUSED(op))
 
     return OPERATOR_FINISHED;
   }
-  else {
-    return OPERATOR_CANCELLED;
-  }
+  return OPERATOR_CANCELLED;
 }
 
 void FONT_OT_select_all(wmOperatorType *ot)
@@ -1015,10 +1009,9 @@ static bool paste_selection(Object *obedit, ReportList *reports)
   if (font_paste_wchar(obedit, text_buf, len, info_buf)) {
     return true;
   }
-  else {
-    BKE_report(reports, RPT_WARNING, "Text too long");
-    return false;
-  }
+
+  BKE_report(reports, RPT_WARNING, "Text too long");
+  return false;
 }
 
 static int paste_text_exec(bContext *C, wmOperator *op)
@@ -1347,9 +1340,7 @@ static int change_spacing_exec(bContext *C, wmOperator *op)
 
     return OPERATOR_FINISHED;
   }
-  else {
-    return OPERATOR_CANCELLED;
-  }
+  return OPERATOR_CANCELLED;
 }
 
 void FONT_OT_change_spacing(wmOperatorType *ot)
@@ -1688,9 +1679,8 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event)
     if ((alt || ctrl || shift) == 0) {
       return OPERATOR_PASS_THROUGH;
     }
-    else {
-      ascii = 9;
-    }
+
+    ascii = 9;
   }
 
   if (event_type == EVT_BACKSPACEKEY) {
@@ -2290,9 +2280,7 @@ bool ED_curve_editfont_select_pick(
     }
     return true;
   }
-  else {
-    return false;
-  }
+  return false;
 }
 
 /** \} */
diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c
index 3902c112796..847f3e3916c 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_utils.c
+++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c
@@ -211,14 +211,13 @@ bool gizmo_window_project_2d(bContext *C,
     }
     return false;
   }
-  else {
-    float co[3] = {mval[0], mval[1], 0.0f};
-    float imat[4][4];
-    invert_m4_m4(imat, mat);
-    mul_m4_v3(imat, co);
-    copy_v2_v2(r_co, co);
-    return true;
-  }
+
+  float co[3] = {mval[0], mval[1], 0.0f};
+  float imat[4][4];
+  invert_m4_m4(imat, mat);
+  mul_m4_v3(imat, co);
+  copy_v2_v2(r_co, co);
+  return true;
 }
 
 bool gizmo_window_project_3d(
@@ -245,12 +244,11 @@ bool gizmo_window_project_3d(
     mul_m4_v3(mat, r_co);
     return true;
   }
-  else {
-    float co[3] = {mval[0], mval[1], 0.0f};
-    float imat[4][4];
-    invert_m4_m4(imat, mat);
-    mul_m4_v3(imat, co);
-    copy_v2_v2(r_co, co);
-    return true;
-  }
+
+  float co[3] = {mval[0], mval[1], 0.0f};
+  float imat[4][4];
+  invert_m4_m4(imat, mat);
+  mul_m4_v3(imat, co);
+  copy_v2_v2(r_co, co);
+  return true;
 }
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index c1a4492994a..94636848d91 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -253,16 +253,15 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
     BKE_report(op->reports, RPT_WARNING, "No objects selected -- Created empty export file");
     return OPERATOR_CANCELLED;
   }
-  else if (export_count < 0) {
+  if (export_count < 0) {
     BKE_report(op->reports, RPT_WARNING, "Error during export (see Console)");
     return OPERATOR_CANCELLED;
   }
-  else {
-    char buff[100];
-    sprintf(buff, "Exported %d Objects", export_count);
-    BKE_report(op->reports, RPT_INFO, buff);
-    return OPERATOR_FINISHED;
-  }
+
+  char buff[100];
+  sprintf(buff, "Exported %d Objects", export_count);
+  BKE_report(op->reports, RPT_INFO, buff);
+  return OPERATOR_FINISHED;
 }
 
 static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
@@ -803,10 +802,9 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
     DEG_id_tag_update(&CTX_data_scene(C)->id, ID_RECALC_BASE_FLAGS);
     return OPERATOR_FINISHED;
   }
-  else {
-    BKE_report(op->reports, RPT_ERROR, "Parsing errors in Document (see Blender Console)");
-    return OPERATOR_CANCELLED;
-  }
+
+  BKE_report(op->reports, RPT_ERROR, "Parsing errors in Document (see Blender Console)");
+  return OPERATOR_CANCELLED;
 }
 
 static void uiCollada_importSettings(uiLayout *layout, PointerRNA *imfptr)
diff --git a/source/blender/editors/lattice/editlattice_select.c b/source/blender/editors/lattice/editlattice_select.c
index 8751a289b9c..0b62934d190 100644
--- a/source/blender/editors/lattice/editlattice_select.c
+++ b/source/blender/editors/lattice/editlattice_select.c
@@ -273,13 +273,12 @@ static bool lattice_test_bitmap_uvw(
   if ((u < 0 || u >= lt->pntsu) || (v < 0 || v >= lt->pntsv) ||

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list