[Bf-blender-cvs] [054cec404b1] master: Cleanup: use booleans

Campbell Barton noreply at git.blender.org
Fri Aug 26 07:59:14 CEST 2022


Commit: 054cec404b1b9852892613acf18bf0fbd4ff2e16
Author: Campbell Barton
Date:   Fri Aug 26 15:57:43 2022 +1000
Branches: master
https://developer.blender.org/rB054cec404b1b9852892613acf18bf0fbd4ff2e16

Cleanup: use booleans

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

M	source/blender/blenkernel/BKE_sound.h
M	source/blender/blenkernel/intern/sound.c
M	source/blender/editors/space_sequencer/sequencer_edit.c
M	source/blender/editors/uvedit/uvedit_select.c
M	source/blender/imbuf/intern/openexr/openexr_api.cpp
M	source/blender/makesrna/intern/rna_sequencer_api.c
M	source/blender/python/BPY_extern.h
M	source/blender/python/intern/stubs.c
M	source/blender/sequencer/SEQ_edit.h
M	source/blender/sequencer/SEQ_select.h
M	source/blender/sequencer/intern/strip_edit.c
M	source/blender/sequencer/intern/strip_select.c
M	source/blender/windowmanager/intern/wm_event_system.cc
M	source/blender/windowmanager/intern/wm_window.c

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

diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index 9965b6f1351..11c37a74a54 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -134,7 +134,7 @@ void *BKE_sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *s
 
 void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle);
 
-void BKE_sound_mute_scene_sound(void *handle, char mute);
+void BKE_sound_mute_scene_sound(void *handle, bool mute);
 
 void BKE_sound_move_scene_sound(const struct Scene *scene,
                                 void *handle,
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index f459b5a82ac..bb0e7a4dd6b 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -756,7 +756,7 @@ void BKE_sound_remove_scene_sound(Scene *scene, void *handle)
   AUD_Sequence_remove(scene->sound_scene, handle);
 }
 
-void BKE_sound_mute_scene_sound(void *handle, char mute)
+void BKE_sound_mute_scene_sound(void *handle, bool mute)
 {
   AUD_SequenceEntry_setMuted(handle, mute);
 }
@@ -1346,7 +1346,7 @@ void *BKE_sound_add_scene_sound_defaults(Scene *UNUSED(scene), Sequence *UNUSED(
 void BKE_sound_remove_scene_sound(Scene *UNUSED(scene), void *UNUSED(handle))
 {
 }
-void BKE_sound_mute_scene_sound(void *UNUSED(handle), char UNUSED(mute))
+void BKE_sound_mute_scene_sound(void *UNUSED(handle), bool UNUSED(mute))
 {
 }
 void BKE_sound_move_scene_sound(const Scene *UNUSED(scene),
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 9313e45a1d4..7f23df4c94f 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2637,12 +2637,12 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
   Sequence *seq_other;
   const char *error_msg;
 
-  if (SEQ_select_active_get_pair(scene, &seq_act, &seq_other) == 0) {
+  if (SEQ_select_active_get_pair(scene, &seq_act, &seq_other) == false) {
     BKE_report(op->reports, RPT_ERROR, "Please select two strips");
     return OPERATOR_CANCELLED;
   }
 
-  if (SEQ_edit_sequence_swap(scene, seq_act, seq_other, &error_msg) == 0) {
+  if (SEQ_edit_sequence_swap(scene, seq_act, seq_other, &error_msg) == false) {
     BKE_report(op->reports, RPT_ERROR, error_msg);
     return OPERATOR_CANCELLED;
   }
diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c
index 8fc97dbe0ce..cecf0ff7914 100644
--- a/source/blender/editors/uvedit/uvedit_select.c
+++ b/source/blender/editors/uvedit/uvedit_select.c
@@ -3712,9 +3712,9 @@ void UV_OT_select_box(wmOperatorType *ot)
 /** \name Circle Select Operator
  * \{ */
 
-static int uv_circle_select_is_point_inside(const float uv[2],
-                                            const float offset[2],
-                                            const float ellipse[2])
+static bool uv_circle_select_is_point_inside(const float uv[2],
+                                             const float offset[2],
+                                             const float ellipse[2])
 {
   /* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
   const float co[2] = {
@@ -3724,10 +3724,10 @@ static int uv_circle_select_is_point_inside(const float uv[2],
   return len_squared_v2(co) < 1.0f;
 }
 
-static int uv_circle_select_is_edge_inside(const float uv_a[2],
-                                           const float uv_b[2],
-                                           const float offset[2],
-                                           const float ellipse[2])
+static bool uv_circle_select_is_edge_inside(const float uv_a[2],
+                                            const float uv_b[2],
+                                            const float offset[2],
+                                            const float ellipse[2])
 {
   /* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
   const float co_a[2] = {
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 0414fa1268d..eb6ce5df794 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -2008,7 +2008,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem,
       printf("Error: can't process EXR multilayer file\n");
     }
     else {
-      const int is_alpha = exr_has_alpha(*file);
+      const bool is_alpha = exr_has_alpha(*file);
 
       ibuf = IMB_allocImBuf(width, height, is_alpha ? 32 : 24, 0);
       ibuf->flags |= exr_is_half_float(*file) ? IB_halffloat : 0;
diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c
index aab6174cab2..ae241c11522 100644
--- a/source/blender/makesrna/intern/rna_sequencer_api.c
+++ b/source/blender/makesrna/intern/rna_sequencer_api.c
@@ -63,7 +63,7 @@ static void rna_Sequence_swap_internal(ID *id,
   const char *error_msg;
   Scene *scene = (Scene *)id;
 
-  if (SEQ_edit_sequence_swap(scene, seq_self, seq_other, &error_msg) == 0) {
+  if (SEQ_edit_sequence_swap(scene, seq_self, seq_other, &error_msg) == false) {
     BKE_report(reports, RPT_ERROR, error_msg);
   }
 }
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index 8075e4ecd22..aecefa97423 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -34,7 +34,7 @@ void BPY_pyconstraint_exec(struct bPythonConstraint *con,
 //  void BPY_pyconstraint_settings(void *arg1, void *arg2);
 void BPY_pyconstraint_target(struct bPythonConstraint *con, struct bConstraintTarget *ct);
 void BPY_pyconstraint_update(struct Object *owner, struct bConstraint *con);
-int BPY_is_pyconstraint(struct Text *text);
+bool BPY_is_pyconstraint(struct Text *text);
 //  void BPY_free_pyconstraint_links(struct Text *text);
 
 /* global interpreter lock */
diff --git a/source/blender/python/intern/stubs.c b/source/blender/python/intern/stubs.c
index c29f9188eea..f860bdc36ee 100644
--- a/source/blender/python/intern/stubs.c
+++ b/source/blender/python/intern/stubs.c
@@ -25,7 +25,7 @@ void BPY_pyconstraint_exec(struct bPythonConstraint *con,
 void BPY_pyconstraint_target(struct bPythonConstraint *con, struct bConstraintTarget *ct)
 {
 }
-int BPY_is_pyconstraint(struct Text *text)
+bool BPY_is_pyconstraint(struct Text *text)
 {
   return 0;
 }
diff --git a/source/blender/sequencer/SEQ_edit.h b/source/blender/sequencer/SEQ_edit.h
index ff9c387e527..afe35d20c2b 100644
--- a/source/blender/sequencer/SEQ_edit.h
+++ b/source/blender/sequencer/SEQ_edit.h
@@ -16,10 +16,10 @@ struct Main;
 struct Scene;
 struct Sequence;
 
-int SEQ_edit_sequence_swap(struct Scene *scene,
-                           struct Sequence *seq_a,
-                           struct Sequence *seq_b,
-                           const char **error_str);
+bool SEQ_edit_sequence_swap(struct Scene *scene,
+                            struct Sequence *seq_a,
+                            struct Sequence *seq_b,
+                            const char **error_str);
 /**
  * Move sequence to seqbase.
  *
diff --git a/source/blender/sequencer/SEQ_select.h b/source/blender/sequencer/SEQ_select.h
index 92fb508372e..52d0bcc120e 100644
--- a/source/blender/sequencer/SEQ_select.h
+++ b/source/blender/sequencer/SEQ_select.h
@@ -15,9 +15,9 @@ struct Scene;
 struct Sequence;
 
 struct Sequence *SEQ_select_active_get(struct Scene *scene);
-int SEQ_select_active_get_pair(struct Scene *scene,
-                               struct Sequence **r_seq_act,
-                               struct Sequence **r_seq_other);
+bool SEQ_select_active_get_pair(struct Scene *scene,
+                                struct Sequence **r_seq_act,
+                                struct Sequence **r_seq_other);
 void SEQ_select_active_set(struct Scene *scene, struct Sequence *seq);
 
 #ifdef __cplusplus
diff --git a/source/blender/sequencer/intern/strip_edit.c b/source/blender/sequencer/intern/strip_edit.c
index 726205d18d3..c35138b280a 100644
--- a/source/blender/sequencer/intern/strip_edit.c
+++ b/source/blender/sequencer/intern/strip_edit.c
@@ -37,32 +37,32 @@
 #include "SEQ_transform.h"
 #include "SEQ_utils.h"
 
-int SEQ_edit_sequence_swap(Scene *scene, Sequence *seq_a, Sequence *seq_b, const char **error_str)
+bool SEQ_edit_sequence_swap(Scene *scene, Sequence *seq_a, Sequence *seq_b, const char **error_str)
 {
   char name[sizeof(seq_a->name)];
 
   if (SEQ_time_strip_length_get(scene, seq_a) != SEQ_time_strip_length_get(scene, seq_b)) {
     *error_str = N_("Strips must be the same length");
-    return 0;
+    return false;
   }
 
   /* type checking, could be more advanced but disallow sound vs non-sound copy */
   if (seq_a->type != seq_b->type) {
     if (seq_a->type == SEQ_TYPE_SOUND_RAM || seq_b->type == SEQ_TYPE_SOUND_RAM) {
       *error_str = N_("Strips were not compatible");
-      return 0;
+      return false;
     }
 
     /* disallow effects to swap with non-effects strips */
     if ((seq_a->type & SEQ_TYPE_EFFECT) != (seq_b->type & SEQ_TYPE_EFFECT)) {
       *error_str = N_("Strips were not compatible");
-      return 0;
+      return false;
     }
 
     if ((seq_a->type & SEQ_TYPE_EFFECT) && (seq_b->type & SEQ_TYPE_EFFECT)) {
       if (SEQ_effect_get_num_inputs(seq_a->type) != SEQ_effect_get_num_inputs(seq_b->type)) {
         *error_str = N_("Strips must have the same number of inputs");
-        return 0;
+        return false;
       }
     }
   }
@@ -87,26 +87,26 @@ int SEQ_edit_sequence_swap(Scene *scene, Sequence *seq_a, Sequence *seq_b, const
   seq_time_effect_range_set(scene, seq_a);
   seq_time_effect_range_set(scene, seq_b);
 
-  return 1;
+  return true;
 }
 
 static void seq_update_muting_recursive(ListBase *channels,
                                         ListBase *seqbasep,
                                         Sequence *metaseq,
-                                        int mute)
+                                        const bool mute)
 {
   Sequence *seq;
 
   /* For sound 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list