From 054cec404b1b9852892613acf18bf0fbd4ff2e16 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 26 Aug 2022 15:57:43 +1000 Subject: Cleanup: use booleans --- source/blender/blenkernel/BKE_sound.h | 2 +- source/blender/blenkernel/intern/sound.c | 4 ++-- .../editors/space_sequencer/sequencer_edit.c | 4 ++-- source/blender/editors/uvedit/uvedit_select.c | 14 +++++++------- .../blender/imbuf/intern/openexr/openexr_api.cpp | 2 +- source/blender/makesrna/intern/rna_sequencer_api.c | 2 +- source/blender/python/BPY_extern.h | 2 +- source/blender/python/intern/stubs.c | 2 +- source/blender/sequencer/SEQ_edit.h | 8 ++++---- source/blender/sequencer/SEQ_select.h | 6 +++--- source/blender/sequencer/intern/strip_edit.c | 22 +++++++++++----------- source/blender/sequencer/intern/strip_select.c | 6 +++--- .../windowmanager/intern/wm_event_system.cc | 4 ++-- source/blender/windowmanager/intern/wm_window.c | 4 ++-- 14 files changed, 41 insertions(+), 41 deletions(-) (limited to 'source') 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 we go over full meta tree to update muted state, * since sound is played outside of evaluating the imbufs. */ for (seq = seqbasep->first; seq; seq = seq->next) { - int seqmute = (mute || SEQ_render_is_muted(channels, seq)); + bool seqmute = (mute || SEQ_render_is_muted(channels, seq)); if (seq->type == SEQ_TYPE_META) { /* if this is the current meta sequence, unmute because * all sequences above this were set to mute */ if (seq == metaseq) { - seqmute = 0; + seqmute = false; } seq_update_muting_recursive(&seq->channels, &seq->seqbase, metaseq, seqmute); @@ -126,10 +126,10 @@ void SEQ_edit_update_muting(Editing *ed) MetaStack *ms = ed->metastack.last; if (ms) { - seq_update_muting_recursive(&ed->channels, &ed->seqbase, ms->parseq, 1); + seq_update_muting_recursive(&ed->channels, &ed->seqbase, ms->parseq, true); } else { - seq_update_muting_recursive(&ed->channels, &ed->seqbase, NULL, 0); + seq_update_muting_recursive(&ed->channels, &ed->seqbase, NULL, false); } } } diff --git a/source/blender/sequencer/intern/strip_select.c b/source/blender/sequencer/intern/strip_select.c index 69b4ce1f7c7..1a4ad4d997e 100644 --- a/source/blender/sequencer/intern/strip_select.c +++ b/source/blender/sequencer/intern/strip_select.c @@ -37,14 +37,14 @@ void SEQ_select_active_set(Scene *scene, Sequence *seq) ed->act_seq = seq; } -int SEQ_select_active_get_pair(Scene *scene, Sequence **r_seq_act, Sequence **r_seq_other) +bool SEQ_select_active_get_pair(Scene *scene, Sequence **r_seq_act, Sequence **r_seq_other) { Editing *ed = SEQ_editing_get(scene); *r_seq_act = SEQ_select_active_get(scene); if (*r_seq_act == NULL) { - return 0; + return false; } Sequence *seq; @@ -54,7 +54,7 @@ int SEQ_select_active_get_pair(Scene *scene, Sequence **r_seq_act, Sequence **r_ for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT && (seq != (*r_seq_act))) { if (*r_seq_other) { - return 0; + return false; } *r_seq_other = seq; diff --git a/source/blender/windowmanager/intern/wm_event_system.cc b/source/blender/windowmanager/intern/wm_event_system.cc index 6ed1cb03a77..d6368e73f5a 100644 --- a/source/blender/windowmanager/intern/wm_event_system.cc +++ b/source/blender/windowmanager/intern/wm_event_system.cc @@ -671,7 +671,7 @@ void wm_event_do_notifiers(bContext *C) wm_test_autorun_warning(C); } -static int wm_event_always_pass(const wmEvent *event) +static bool wm_event_always_pass(const wmEvent *event) { /* Some events we always pass on, to ensure proper communication. */ return ISTIMER(event->type) || (event->type == WINDEACTIVATE); @@ -2754,7 +2754,7 @@ static int wm_handler_fileselect_call(bContext *C, return wm_handler_fileselect_do(C, handlers, handler, event->val); } -static int wm_action_not_handled(int action) +static bool wm_action_not_handled(int action) { return action == WM_HANDLER_CONTINUE || action == (WM_HANDLER_BREAK | WM_HANDLER_MODAL); } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index cb8a3670676..661db1b62e7 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -970,8 +970,8 @@ typedef enum { OS = 'C', } modifierKeyType; -/* check if specified modifier key type is pressed */ -static int query_qual(modifierKeyType qual) +/** Check if specified modifier key type is pressed. */ +static bool query_qual(modifierKeyType qual) { GHOST_TModifierKey left, right; switch (qual) { -- cgit v1.2.3