From a15b3c4d111613993eca23d5f99600c2052469e7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 11 Apr 2014 11:25:41 +1000 Subject: Code cleanup: use bool --- source/blender/blenfont/intern/blf_font.c | 2 +- source/blender/blenkernel/BKE_animsys.h | 10 +- source/blender/blenkernel/BKE_constraint.h | 10 +- source/blender/blenkernel/BKE_nla.h | 20 ++-- source/blender/blenkernel/intern/anim_sys.c | 32 +++--- source/blender/blenkernel/intern/constraint.c | 108 ++++++++++----------- source/blender/blenkernel/intern/fcurve.c | 2 +- source/blender/blenkernel/intern/lattice.c | 2 +- source/blender/blenkernel/intern/library_query.c | 2 +- source/blender/blenkernel/intern/mball.c | 3 +- source/blender/blenkernel/intern/mesh_validate.c | 6 +- source/blender/blenkernel/intern/nla.c | 28 +++--- source/blender/blenkernel/intern/object.c | 2 +- source/blender/blenkernel/intern/pbvh_bmesh.c | 2 +- source/blender/blenkernel/intern/pbvh_intern.h | 2 +- source/blender/blenkernel/intern/smoke.c | 19 ++-- source/blender/blenkernel/intern/text.c | 3 +- source/blender/blenlib/intern/scanfill_utils.c | 2 +- source/blender/blenloader/intern/readfile.c | 8 +- source/blender/bmesh/operators/bmo_edgenet.c | 2 +- .../blender/editors/animation/anim_channels_edit.c | 10 +- source/blender/editors/animation/anim_draw.c | 2 +- source/blender/editors/animation/fmodifier_ui.c | 8 +- source/blender/editors/animation/keyframes_edit.c | 1 + source/blender/editors/armature/pose_edit.c | 2 +- source/blender/editors/armature/pose_lib.c | 2 +- source/blender/editors/curve/editcurve.c | 10 +- source/blender/editors/curve/editfont.c | 4 +- source/blender/editors/include/ED_anim_api.h | 8 +- source/blender/editors/interface/interface.c | 4 +- source/blender/editors/interface/interface_draw.c | 3 +- source/blender/editors/mask/mask_ops.c | 2 +- source/blender/editors/mask/mask_select.c | 2 +- source/blender/editors/mesh/editmesh_select.c | 4 +- source/blender/editors/mesh/editmesh_tools.c | 4 +- source/blender/editors/mesh/meshtools.c | 4 +- source/blender/editors/metaball/mball_edit.c | 2 +- source/blender/editors/object/object_add.c | 8 +- source/blender/editors/object/object_edit.c | 6 +- source/blender/editors/object/object_group.c | 2 +- source/blender/editors/object/object_hook.c | 2 +- source/blender/editors/object/object_transform.c | 8 +- source/blender/editors/render/render_opengl.c | 4 +- source/blender/editors/render/render_preview.c | 4 +- source/blender/editors/render/render_update.c | 2 +- source/blender/editors/sculpt_paint/paint_image.c | 2 +- source/blender/editors/sculpt_paint/paint_utils.c | 2 +- source/blender/editors/sculpt_paint/sculpt.c | 10 +- source/blender/editors/sculpt_paint/sculpt_undo.c | 4 +- source/blender/editors/space_clip/tracking_ops.c | 5 +- source/blender/editors/space_console/console_ops.c | 2 +- source/blender/editors/space_file/file_ops.c | 6 +- source/blender/editors/space_graph/graph_edit.c | 2 +- source/blender/editors/space_image/image_buttons.c | 2 +- source/blender/editors/space_image/image_ops.c | 2 +- source/blender/editors/space_logic/logic_window.c | 2 +- source/blender/editors/space_nla/nla_edit.c | 13 +-- source/blender/editors/space_node/node_edit.c | 6 +- source/blender/editors/space_node/node_group.c | 6 +- .../editors/space_node/node_relationships.c | 4 +- source/blender/editors/space_node/node_view.c | 2 +- .../editors/space_sequencer/sequencer_add.c | 2 +- .../editors/space_sequencer/sequencer_draw.c | 2 +- .../editors/space_sequencer/sequencer_edit.c | 2 +- .../editors/space_sequencer/sequencer_select.c | 2 +- source/blender/editors/space_text/text_ops.c | 2 +- source/blender/editors/space_view3d/view3d_ruler.c | 2 +- .../blender/editors/space_view3d/view3d_select.c | 2 +- source/blender/editors/space_view3d/view3d_snap.c | 2 +- source/blender/editors/transform/transform.c | 21 ++-- .../editors/transform/transform_conversions.c | 2 +- .../editors/transform/transform_manipulator.c | 2 +- .../editors/transform/transform_orientations.c | 2 +- source/blender/editors/uvedit/uvedit_ops.c | 2 +- source/blender/gpu/GPU_material.h | 4 +- source/blender/gpu/intern/gpu_draw.c | 4 +- source/blender/imbuf/IMB_imbuf.h | 2 +- source/blender/imbuf/intern/divers.c | 2 +- source/blender/imbuf/intern/filter.c | 4 +- source/blender/imbuf/intern/targa.c | 6 +- source/blender/makesrna/intern/makesrna.c | 2 +- source/blender/python/intern/bpy_rna_array.c | 2 +- .../blender/render/intern/source/convertblender.c | 2 +- 83 files changed, 266 insertions(+), 250 deletions(-) (limited to 'source') diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 324d20b2703..a06f4a2c6d9 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -150,7 +150,7 @@ static void blf_font_ensure_ascii_table(FontBLF *font) #define BLF_KERNING_VARS(_font, _has_kerning, _kern_mode) \ - const short _has_kerning = FT_HAS_KERNING((_font)->face); \ + const bool _has_kerning = FT_HAS_KERNING((_font)->face); \ const FT_UInt _kern_mode = (_has_kerning == 0) ? 0 : \ (((_font)->flags & BLF_KERNING_DEFAULT) ? \ ft_kerning_default : FT_KERNING_UNFITTED) \ diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index a0ec6c7757f..80d2750fe82 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -48,7 +48,7 @@ struct AnimMapper; /* AnimData API */ /* Check if the given ID-block can have AnimData */ -short id_type_can_have_animdata(struct ID *id); +bool id_type_can_have_animdata(struct ID *id); /* Get AnimData from the given ID-block */ struct AnimData *BKE_animdata_from_id(struct ID *id); @@ -57,7 +57,7 @@ struct AnimData *BKE_animdata_from_id(struct ID *id); struct AnimData *BKE_id_add_animdata(struct ID *id); /* Set active action used by AnimData from the given ID-block */ -short BKE_animdata_set_action(struct ReportList *reports, struct ID *id, struct bAction *act); +bool BKE_animdata_set_action(struct ReportList *reports, struct ID *id, struct bAction *act); /* Free AnimData */ void BKE_free_animdata(struct ID *id); @@ -66,7 +66,7 @@ void BKE_free_animdata(struct ID *id); struct AnimData *BKE_copy_animdata(struct AnimData *adt, const bool do_action); /* Copy AnimData */ -int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from, const bool do_action); +bool BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from, const bool do_action); /* Copy AnimData Actions */ void BKE_copy_animdata_id_action(struct ID *id); @@ -106,12 +106,12 @@ void BKE_keyingsets_free(struct ListBase *list); /* Fix all the paths for the the given ID + Action */ void BKE_action_fix_paths_rename(struct ID *owner_id, struct bAction *act, const char *prefix, const char *oldName, - const char *newName, int oldSubscript, int newSubscript, int verify_paths); + const char *newName, int oldSubscript, int newSubscript, bool verify_paths); /* Fix all the paths for the given ID+AnimData */ void BKE_animdata_fix_paths_rename(struct ID *owner_id, struct AnimData *adt, struct ID *ref_id, const char *prefix, const char *oldName, const char *newName, int oldSubscript, int newSubscript, - int verify_paths); + bool verify_paths); /* Fix all the paths for the entire database... */ void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const char *oldName, const char *newName); diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index 8a9d3589a4f..2aee502a71e 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -62,7 +62,7 @@ typedef struct bConstraintOb { /* ---------------------------------------------------------------------------- */ /* Callback format for performing operations on ID-pointers for Constraints */ -typedef void (*ConstraintIDFunc)(struct bConstraint *con, struct ID **idpoin, short isReference, void *userdata); +typedef void (*ConstraintIDFunc)(struct bConstraint *con, struct ID **idpoin, bool is_reference, void *userdata); /* ....... */ @@ -98,7 +98,7 @@ typedef struct bConstraintTypeInfo { /* for multi-target constraints: return that list; otherwise make a temporary list (returns number of targets) */ int (*get_constraint_targets)(struct bConstraint *con, struct ListBase *list); /* for single-target constraints only: flush data back to source data, and the free memory used */ - void (*flush_constraint_targets)(struct bConstraint *con, struct ListBase *list, short nocopy); + void (*flush_constraint_targets)(struct bConstraint *con, struct ListBase *list, bool no_copy); /* evaluation */ /* set the ct->matrix for the given constraint target (at the given ctime) */ @@ -136,12 +136,12 @@ struct bConstraint *BKE_constraints_findByName(struct ListBase *list, const char struct bConstraint *BKE_add_ob_constraint(struct Object *ob, const char *name, short type); struct bConstraint *BKE_add_pose_constraint(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type); -int BKE_remove_constraint(ListBase *list, struct bConstraint *con); -void BKE_remove_constraints_type(ListBase *list, short type, short last_only); +bool BKE_remove_constraint(ListBase *list, struct bConstraint *con); +void BKE_remove_constraints_type(ListBase *list, short type, bool last_only); /* Constraints + Proxies function prototypes */ void BKE_extract_proxylocal_constraints(struct ListBase *dst, struct ListBase *src); -short BKE_proxylocked_constraints_owner(struct Object *ob, struct bPoseChannel *pchan); +bool BKE_proxylocked_constraints_owner(struct Object *ob, struct bPoseChannel *pchan); /* Constraint Evaluation function prototypes */ struct bConstraintOb *BKE_constraints_make_evalob(struct Scene *scene, struct Object *ob, void *subdata, short datatype); diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h index 344797dd15a..7823efc3bae 100644 --- a/source/blender/blenkernel/BKE_nla.h +++ b/source/blender/blenkernel/BKE_nla.h @@ -62,13 +62,13 @@ struct NlaStrip *add_nla_soundstrip(struct Scene *scene, struct Speaker *spk); bool BKE_nlastrips_has_space(ListBase *strips, float start, float end); void BKE_nlastrips_sort_strips(ListBase *strips); -short BKE_nlastrips_add_strip(ListBase *strips, struct NlaStrip *strip); +bool BKE_nlastrips_add_strip(ListBase *strips, struct NlaStrip *strip); -void BKE_nlastrips_make_metas(ListBase *strips, short temp); -void BKE_nlastrips_clear_metas(ListBase *strips, short onlySel, short onlyTemp); +void BKE_nlastrips_make_metas(ListBase *strips, bool is_temp); +void BKE_nlastrips_clear_metas(ListBase *strips, bool only_sel, bool only_temp); void BKE_nlastrips_clear_metastrip(ListBase *strips, struct NlaStrip *strip); -short BKE_nlameta_add_strip(struct NlaStrip *mstrip, struct NlaStrip *strip); +bool BKE_nlameta_add_strip(struct NlaStrip *mstrip, struct NlaStrip *strip); void BKE_nlameta_flush_transforms(struct NlaStrip *mstrip); /* ............ */ @@ -81,24 +81,24 @@ void BKE_nlatrack_solo_toggle(struct AnimData *adt, struct NlaTrack *nlt); bool BKE_nlatrack_has_space(struct NlaTrack *nlt, float start, float end); void BKE_nlatrack_sort_strips(struct NlaTrack *nlt); -short BKE_nlatrack_add_strip(struct NlaTrack *nlt, struct NlaStrip *strip); +bool BKE_nlatrack_add_strip(struct NlaTrack *nlt, struct NlaStrip *strip); -short BKE_nlatrack_get_bounds(struct NlaTrack *nlt, float bounds[2]); +bool BKE_nlatrack_get_bounds(struct NlaTrack *nlt, float bounds[2]); /* ............ */ struct NlaStrip *BKE_nlastrip_find_active(struct NlaTrack *nlt); void BKE_nlastrip_set_active(struct AnimData *adt, struct NlaStrip *strip); -short BKE_nlastrip_within_bounds(struct NlaStrip *strip, float min, float max); +bool BKE_nlastrip_within_bounds(struct NlaStrip *strip, float min, float max); void BKE_nlastrip_recalculate_bounds(struct NlaStrip *strip); void BKE_nlastrip_validate_name(struct AnimData *adt, struct NlaStrip *strip); /* ............ */ -short BKE_nlatrack_has_animated_strips(struct NlaTrack *nlt); -short BKE_nlatracks_have_animated_strips(ListBase *tracks); +bool BKE_nlatrack_has_animated_strips(struct NlaTrack *nlt); +bool BKE_nlatracks_have_animated_strips(ListBase *tracks); void BKE_nlastrip_validate_fcurves(struct NlaStrip *strip); void BKE_nla_validate_state(struct AnimData *adt); @@ -107,7 +107,7 @@ void BKE_nla_validate_state(struct AnimData *adt); void BKE_nla_action_pushdown(struct AnimData *adt); -short BKE_nla_tweakmode_enter(struct AnimData *adt); +bool BKE_nla_tweakmode_enter(struct AnimData *adt); void BKE_nla_tweakmode_exit(struct AnimData *adt); /* ----------------------------- */ diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 8692ff2767d..8542bd65933 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -74,7 +74,7 @@ /* Getter/Setter -------------------------------------------- */ /* Check if ID can have AnimData */ -short id_type_can_have_animdata(ID *id) +bool id_type_can_have_animdata(ID *id) { /* sanity check */ if (id == NULL) @@ -157,10 +157,10 @@ AnimData *BKE_id_add_animdata(ID *id) /* Action Setter --------------------------------------- */ /* Called when user tries to change the active action of an AnimData block (via RNA, Outliner, etc.) */ -short BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act) +bool BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act) { AnimData *adt = BKE_animdata_from_id(id); - short ok = 0; + bool ok = false; /* animdata validity check */ if (adt == NULL) { @@ -279,7 +279,7 @@ AnimData *BKE_copy_animdata(AnimData *adt, const bool do_action) return dadt; } -int BKE_copy_animdata_id(ID *id_to, ID *id_from, const bool do_action) +bool BKE_copy_animdata_id(ID *id_to, ID *id_from, const bool do_action) { AnimData *adt; @@ -567,7 +567,7 @@ static bool check_rna_path_is_valid(ID *owner_id, const char *path) /* Check if some given RNA Path needs fixing - free the given path and set a new one as appropriate * NOTE: we assume that oldName and newName have [" "] padding around them */ -static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName, char *oldpath, int verify_paths) +static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName, char *oldpath, bool verify_paths) { char *prefixPtr = strstr(oldpath, prefix); char *oldNamePtr = strstr(oldpath, oldName); @@ -626,7 +626,7 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o /* Check RNA-Paths for a list of F-Curves */ static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName, - const char *oldKey, const char *newKey, ListBase *curves, int verify_paths) + const char *oldKey, const char *newKey, ListBase *curves, bool verify_paths) { FCurve *fcu; @@ -654,7 +654,7 @@ static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char /* Check RNA-Paths for a list of Drivers */ static void drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix, const char *oldName, const char *newName, - const char *oldKey, const char *newKey, ListBase *curves, int verify_paths) + const char *oldKey, const char *newKey, ListBase *curves, bool verify_paths) { FCurve *fcu; @@ -695,7 +695,7 @@ static void drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix /* Fix all RNA-Paths for Actions linked to NLA Strips */ static void nlastrips_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName, - const char *oldKey, const char *newKey, ListBase *strips, int verify_paths) + const char *oldKey, const char *newKey, ListBase *strips, bool verify_paths) { NlaStrip *strip; @@ -720,7 +720,7 @@ static void nlastrips_path_rename_fix(ID *owner_id, const char *prefix, const ch * i.e. pose.bones["Bone"] */ void BKE_action_fix_paths_rename(ID *owner_id, bAction *act, const char *prefix, const char *oldName, - const char *newName, int oldSubscript, int newSubscript, int verify_paths) + const char *newName, int oldSubscript, int newSubscript, bool verify_paths) { char *oldN, *newN; @@ -759,7 +759,7 @@ void BKE_action_fix_paths_rename(ID *owner_id, bAction *act, const char *prefix, * i.e. pose.bones["Bone"] */ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, const char *prefix, const char *oldName, - const char *newName, int oldSubscript, int newSubscript, int verify_paths) + const char *newName, int oldSubscript, int newSubscript, bool verify_paths) { NlaTrack *nlt; char *oldN, *newN; @@ -1259,7 +1259,7 @@ void BKE_keyingsets_free(ListBase *list) * - path: original path string (as stored in F-Curve data) * - dst: destination string to write data to */ -static short animsys_remap_path(AnimMapper *UNUSED(remap), char *path, char **dst) +static bool animsys_remap_path(AnimMapper *UNUSED(remap), char *path, char **dst) { /* is there a valid remapping table to use? */ #if 0 @@ -1279,7 +1279,7 @@ static short animsys_remap_path(AnimMapper *UNUSED(remap), char *path, char **ds #define ANIMSYS_FLOAT_AS_BOOL(value) ((value) > ((1.0f - FLT_EPSILON))) /* Write the given value to a setting using RNA, and return success */ -static short animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_index, float value) +static bool animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_index, float value) { PropertyRNA *prop; PointerRNA new_ptr; @@ -1409,11 +1409,11 @@ static short animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_in } /* Simple replacement based data-setting of the FCurve using RNA */ -static short animsys_execute_fcurve(PointerRNA *ptr, AnimMapper *remap, FCurve *fcu) +static bool animsys_execute_fcurve(PointerRNA *ptr, AnimMapper *remap, FCurve *fcu) { char *path = NULL; - short free_path = 0; - short ok = 0; + bool free_path = false; + bool ok = false; /* get path, remapped as appropriate to work in its new environment */ free_path = animsys_remap_path(remap, fcu->rna_path, &path); @@ -1463,7 +1463,7 @@ static void animsys_evaluate_drivers(PointerRNA *ptr, AnimData *adt, float ctime */ for (fcu = adt->drivers.first; fcu; fcu = fcu->next) { ChannelDriver *driver = fcu->driver; - short ok = 0; + bool ok = false; /* check if this driver's curve should be skipped */ if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) == 0) { diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 2b486f64b61..694474d5656 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -665,11 +665,11 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo * (Hopefully all compilers will be happy with the lines with just a space on them. Those are * really just to help this code easier to read) */ -#define SINGLETARGET_FLUSH_TARS(con, datatar, datasubtarget, ct, list, nocopy) \ +#define SINGLETARGET_FLUSH_TARS(con, datatar, datasubtarget, ct, list, no_copy) \ { \ if (ct) { \ bConstraintTarget *ctn = ct->next; \ - if (nocopy == 0) { \ + if (no_copy == 0) { \ datatar = ct->tar; \ BLI_strncpy(datasubtarget, ct->subtarget, sizeof(datasubtarget)); \ con->tarspace = (char)ct->space; \ @@ -686,11 +686,11 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo * (Hopefully all compilers will be happy with the lines with just a space on them. Those are * really just to help this code easier to read) */ -#define SINGLETARGETNS_FLUSH_TARS(con, datatar, ct, list, nocopy) \ +#define SINGLETARGETNS_FLUSH_TARS(con, datatar, ct, list, no_copy) \ { \ if (ct) { \ bConstraintTarget *ctn = ct->next; \ - if (nocopy == 0) { \ + if (no_copy == 0) { \ datatar = ct->tar; \ con->tarspace = (char)ct->space; \ } \ @@ -735,14 +735,14 @@ static int childof_get_tars(bConstraint *con, ListBase *list) return 0; } -static void childof_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void childof_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bChildOfConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -870,14 +870,14 @@ static int trackto_get_tars(bConstraint *con, ListBase *list) return 0; } -static void trackto_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void trackto_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bTrackToConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -1052,15 +1052,15 @@ static int kinematic_get_tars(bConstraint *con, ListBase *list) return 0; } -static void kinematic_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void kinematic_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bKinematicConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); - SINGLETARGET_FLUSH_TARS(con, data->poletar, data->polesubtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); + SINGLETARGET_FLUSH_TARS(con, data->poletar, data->polesubtarget, ct, list, no_copy); } } @@ -1140,14 +1140,14 @@ static int followpath_get_tars(bConstraint *con, ListBase *list) return 0; } -static void followpath_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void followpath_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bFollowPathConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy); + SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy); } } @@ -1488,14 +1488,14 @@ static int loclike_get_tars(bConstraint *con, ListBase *list) return 0; } -static void loclike_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void loclike_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bLocateLikeConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -1578,14 +1578,14 @@ static int rotlike_get_tars(bConstraint *con, ListBase *list) return 0; } -static void rotlike_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void rotlike_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bRotateLikeConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -1690,14 +1690,14 @@ static int sizelike_get_tars(bConstraint *con, ListBase *list) return 0; } -static void sizelike_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void sizelike_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bSizeLikeConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -1779,14 +1779,14 @@ static int translike_get_tars(bConstraint *con, ListBase *list) return 0; } -static void translike_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void translike_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bTransLikeConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -2038,14 +2038,14 @@ static int actcon_get_tars(bConstraint *con, ListBase *list) return 0; } -static void actcon_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void actcon_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bActionConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -2202,14 +2202,14 @@ static int locktrack_get_tars(bConstraint *con, ListBase *list) return 0; } -static void locktrack_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void locktrack_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bLockTrackConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -2509,14 +2509,14 @@ static int distlimit_get_tars(bConstraint *con, ListBase *list) return 0; } -static void distlimit_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void distlimit_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bDistLimitConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -2636,14 +2636,14 @@ static int stretchto_get_tars(bConstraint *con, ListBase *list) return 0; } -static void stretchto_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void stretchto_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bStretchToConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -2808,14 +2808,14 @@ static int minmax_get_tars(bConstraint *con, ListBase *list) return 0; } -static void minmax_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void minmax_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bMinMaxConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -2951,14 +2951,14 @@ static int rbj_get_tars(bConstraint *con, ListBase *list) return 0; } -static void rbj_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void rbj_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bRigidBodyJointConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy); + SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy); } } @@ -3002,14 +3002,14 @@ static int clampto_get_tars(bConstraint *con, ListBase *list) return 0; } -static void clampto_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void clampto_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bClampToConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy); + SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy); } } @@ -3182,14 +3182,14 @@ static int transform_get_tars(bConstraint *con, ListBase *list) return 0; } -static void transform_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void transform_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bTransformConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -3329,13 +3329,13 @@ static int shrinkwrap_get_tars(bConstraint *con, ListBase *list) } -static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bShrinkwrapConstraint *data = con->data; bConstraintTarget *ct = list->first; - SINGLETARGETNS_FLUSH_TARS(con, data->target, ct, list, nocopy); + SINGLETARGETNS_FLUSH_TARS(con, data->target, ct, list, no_copy); } } @@ -3512,14 +3512,14 @@ static int damptrack_get_tars(bConstraint *con, ListBase *list) return 0; } -static void damptrack_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void damptrack_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bDampTrackConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -3657,14 +3657,14 @@ static int splineik_get_tars(bConstraint *con, ListBase *list) return 0; } -static void splineik_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void splineik_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bSplineIKConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy); + SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy); } } @@ -3725,14 +3725,14 @@ static int pivotcon_get_tars(bConstraint *con, ListBase *list) return 0; } -static void pivotcon_flush_tars(bConstraint *con, ListBase *list, short nocopy) +static void pivotcon_flush_tars(bConstraint *con, ListBase *list, bool no_copy) { if (con && list) { bPivotConstraint *data = con->data; bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } } @@ -4277,9 +4277,9 @@ bConstraintTypeInfo *BKE_constraint_get_typeinfo(bConstraint *con) /* ---------- Data Management ------- */ /* helper function for BKE_free_constraint_data() - unlinks references */ -static void con_unlink_refs_cb(bConstraint *UNUSED(con), ID **idpoin, short isReference, void *UNUSED(userData)) +static void con_unlink_refs_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *UNUSED(userData)) { - if (*idpoin && isReference) + if (*idpoin && is_reference) id_us_min(*idpoin); } @@ -4322,7 +4322,7 @@ void BKE_free_constraints(ListBase *list) /* Remove the specified constraint from the given constraint stack */ -int BKE_remove_constraint(ListBase *list, bConstraint *con) +bool BKE_remove_constraint(ListBase *list, bConstraint *con) { if (con) { BKE_free_constraint_data(con); @@ -4334,7 +4334,7 @@ int BKE_remove_constraint(ListBase *list, bConstraint *con) } /* Remove all the constraints of the specified type from the given constraint stack */ -void BKE_remove_constraints_type(ListBase *list, short type, short last_only) +void BKE_remove_constraints_type(ListBase *list, short type, bool last_only) { bConstraint *con, *conp; @@ -4460,7 +4460,7 @@ bConstraint *BKE_add_ob_constraint(Object *ob, const char *name, short type) /* ......... */ /* helper for BKE_relink_constraints() - call ID_NEW() on every ID reference the constraint has */ -static void con_relink_id_cb(bConstraint *UNUSED(con), ID **idpoin, short UNUSED(isReference), void *UNUSED(userdata)) +static void con_relink_id_cb(bConstraint *UNUSED(con), ID **idpoin, bool UNUSED(is_reference), void *UNUSED(userdata)) { /* ID_NEW() expects a struct with inline "id" member as first * since we've got the actual ID block, let's just inline this @@ -4498,17 +4498,17 @@ void BKE_id_loop_constraints(ListBase *conlist, ConstraintIDFunc func, void *use /* ......... */ /* helper for BKE_copy_constraints(), to be used for making sure that ID's are valid */ -static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, short UNUSED(isReference), void *UNUSED(userData)) +static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, bool UNUSED(is_reference), void *UNUSED(userData)) { if (*idpoin && (*idpoin)->lib) id_lib_extern(*idpoin); } /* helper for BKE_copy_constraints(), to be used for making sure that usercounts of copied ID's are fixed up */ -static void con_fix_copied_refs_cb(bConstraint *UNUSED(con), ID **idpoin, short isReference, void *UNUSED(userData)) +static void con_fix_copied_refs_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *UNUSED(userData)) { /* increment usercount if this is a reference type */ - if ((*idpoin) && (isReference)) + if ((*idpoin) && (is_reference)) id_us_plus(*idpoin); } @@ -4605,7 +4605,7 @@ void BKE_extract_proxylocal_constraints(ListBase *dst, ListBase *src) } /* Returns if the owner of the constraint is proxy-protected */ -short BKE_proxylocked_constraints_owner(Object *ob, bPoseChannel *pchan) +bool BKE_proxylocked_constraints_owner(Object *ob, bPoseChannel *pchan) { /* Currently, constraints can only be on object or bone level */ if (ob && ob->proxy) { diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 1810e41a39c..0f3a2a668bf 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -882,7 +882,7 @@ void testhandles_fcurve(FCurve *fcu, const bool use_handle) */ void sort_time_fcurve(FCurve *fcu) { - short ok = 1; + bool ok = true; /* keep adjusting order of beztriples until nothing moves (bubble-sort) */ while (ok) { diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 55abd4b3f6c..c2760b811d5 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -314,7 +314,7 @@ void BKE_lattice_make_local(Lattice *lt) { Main *bmain = G.main; Object *ob; - int is_local = false, is_lib = false; + bool is_local = false, is_lib = false; /* - only lib users: do nothing * - only local users: set flag diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index abc3a762372..4787dbb0701 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -104,7 +104,7 @@ static void library_foreach_modifiersForeachIDLink(void *user_data, Object *UNUS } static void library_foreach_constraintObjectLooper(bConstraint *UNUSED(con), ID **id_pointer, - short UNUSED(isReference), void *user_data) + bool UNUSED(is_reference), void *user_data) { LibraryForeachIDData *data = (LibraryForeachIDData *) user_data; FOREACH_CALLBACK_INVOKE_ID_PP(data->self_id, id_pointer, data->flag, data->callback, data->user_data, IDWALK_NOP); diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 9efd0dee19a..fc6f9149841 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -356,7 +356,8 @@ void BKE_mball_texspace_calc(Object *ob) DispList *dl; BoundBox *bb; float *data, min[3], max[3] /*, loc[3], size[3] */; - int tot, do_it = false; + int tot; + bool do_it = false; if (ob->bb == NULL) ob->bb = MEM_callocN(sizeof(BoundBox), "mb boundbox"); bb = ob->bb; diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 848483d2877..e80433580b0 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -283,7 +283,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh, } for (i = 0, me = medges; i < totedge; i++, me++) { - int remove = false; + bool remove = false; if (me->v1 == me->v2) { PRINT_ERR("\tEdge %u: has matching verts, both %u\n", i, me->v1); remove = do_fixes; @@ -336,7 +336,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh, PRINT_ERR("No Polys, only tesselated Faces\n"); for (i = 0, mf = mfaces, sf = sort_faces; i < totface; i++, mf++) { - int remove = false; + bool remove = false; int fidx; unsigned int fv[4]; @@ -411,7 +411,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh, sf++; for (i = 1; i < totsortface; i++, sf++) { - int remove = false; + bool remove = false; /* on a valid mesh, code below will never run */ if (memcmp(sf->es, sf_prev->es, sizeof(sf_prev->es)) == 0) { diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 06a12bdade1..d251a8599b1 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -626,10 +626,10 @@ void BKE_nlastrips_sort_strips(ListBase *strips) /* Add the given NLA-Strip to the given list of strips, assuming that it * isn't currently a member of another list */ -short BKE_nlastrips_add_strip(ListBase *strips, NlaStrip *strip) +bool BKE_nlastrips_add_strip(ListBase *strips, NlaStrip *strip) { NlaStrip *ns; - short not_added = 1; + bool not_added = true; /* sanity checks */ if (ELEM(NULL, strips, strip)) @@ -664,7 +664,7 @@ short BKE_nlastrips_add_strip(ListBase *strips, NlaStrip *strip) * contained within 'Meta-Strips' which act as strips which contain strips. * temp: are the meta-strips to be created 'temporary' ones used for transforms? */ -void BKE_nlastrips_make_metas(ListBase *strips, short temp) +void BKE_nlastrips_make_metas(ListBase *strips, bool is_temp) { NlaStrip *mstrip = NULL; NlaStrip *strip, *stripn; @@ -689,7 +689,7 @@ void BKE_nlastrips_make_metas(ListBase *strips, short temp) mstrip->flag = NLASTRIP_FLAG_SELECT; /* set temp flag if appropriate (i.e. for transform-type editing) */ - if (temp) + if (is_temp) mstrip->flag |= NLASTRIP_FLAG_TEMP_META; /* set default repeat/scale values to prevent warnings */ @@ -741,7 +741,7 @@ void BKE_nlastrips_clear_metastrip(ListBase *strips, NlaStrip *strip) * sel: only consider selected meta-strips, otherwise all meta-strips are removed * onlyTemp: only remove the 'temporary' meta-strips used for transforms */ -void BKE_nlastrips_clear_metas(ListBase *strips, short onlySel, short onlyTemp) +void BKE_nlastrips_clear_metas(ListBase *strips, bool only_sel, bool only_temp) { NlaStrip *strip, *stripn; @@ -756,8 +756,8 @@ void BKE_nlastrips_clear_metas(ListBase *strips, short onlySel, short onlyTemp) /* check if strip is a meta-strip */ if (strip->type == NLASTRIP_TYPE_META) { /* if check if selection and 'temporary-only' considerations are met */ - if ((onlySel == 0) || (strip->flag & NLASTRIP_FLAG_SELECT)) { - if ((!onlyTemp) || (strip->flag & NLASTRIP_FLAG_TEMP_META)) { + if ((!only_sel) || (strip->flag & NLASTRIP_FLAG_SELECT)) { + if ((!only_temp) || (strip->flag & NLASTRIP_FLAG_TEMP_META)) { BKE_nlastrips_clear_metastrip(strips, strip); } } @@ -768,7 +768,7 @@ void BKE_nlastrips_clear_metas(ListBase *strips, short onlySel, short onlyTemp) /* Add the given NLA-Strip to the given Meta-Strip, assuming that the * strip isn't attached to any list of strips */ -short BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip) +bool BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip) { /* sanity checks */ if (ELEM(NULL, mstrip, strip)) @@ -1002,7 +1002,7 @@ void BKE_nlatrack_sort_strips(NlaTrack *nlt) /* Add the given NLA-Strip to the given NLA-Track, assuming that it * isn't currently attached to another one */ -short BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip) +bool BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip) { /* sanity checks */ if (ELEM(NULL, nlt, strip)) @@ -1015,7 +1015,7 @@ short BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip) /* Get the extents of the given NLA-Track including gaps between strips, * returning whether this succeeded or not */ -short BKE_nlatrack_get_bounds(NlaTrack *nlt, float bounds[2]) +bool BKE_nlatrack_get_bounds(NlaTrack *nlt, float bounds[2]) { NlaStrip *strip; @@ -1085,7 +1085,7 @@ void BKE_nlastrip_set_active(AnimData *adt, NlaStrip *strip) /* Does the given NLA-strip fall within the given bounds (times)? */ -short BKE_nlastrip_within_bounds(NlaStrip *strip, float min, float max) +bool BKE_nlastrip_within_bounds(NlaStrip *strip, float min, float max) { const float stripLen = (strip) ? strip->end - strip->start : 0.0f; const float boundsLen = fabsf(max - min); @@ -1220,7 +1220,7 @@ static bool nlastrip_is_first(AnimData *adt, NlaStrip *strip) /* Animated Strips ------------------------------------------- */ /* Check if the given NLA-Track has any strips with own F-Curves */ -short BKE_nlatrack_has_animated_strips(NlaTrack *nlt) +bool BKE_nlatrack_has_animated_strips(NlaTrack *nlt) { NlaStrip *strip; @@ -1239,7 +1239,7 @@ short BKE_nlatrack_has_animated_strips(NlaTrack *nlt) } /* Check if given NLA-Tracks have any strips with own F-Curves */ -short BKE_nlatracks_have_animated_strips(ListBase *tracks) +bool BKE_nlatracks_have_animated_strips(ListBase *tracks) { NlaTrack *nlt; @@ -1567,7 +1567,7 @@ void BKE_nla_action_pushdown(AnimData *adt) /* Find the active strip + track combo, and set them up as the tweaking track, * and return if successful or not. */ -short BKE_nla_tweakmode_enter(AnimData *adt) +bool BKE_nla_tweakmode_enter(AnimData *adt) { NlaTrack *nlt, *activeTrack = NULL; NlaStrip *strip, *activeStrip = NULL; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 71b3e83f9de..cae46199285 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2217,7 +2217,7 @@ static void ob_get_parent_matrix(Scene *scene, Object *ob, Object *par, float pa { float tmat[4][4]; float vec[3]; - int ok; + bool ok; switch (ob->partype & PARTYPE) { case PAROBJECT: diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index 24969c1a07a..9547ac9fc81 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -1024,7 +1024,7 @@ static bool pbvh_bmesh_collapse_short_edges(EdgeQueueContext *eq_ctx, bool pbvh_bmesh_node_raycast(PBVHNode *node, const float ray_start[3], const float ray_normal[3], float *dist, - int use_original) + bool use_original) { bool hit = false; diff --git a/source/blender/blenkernel/intern/pbvh_intern.h b/source/blender/blenkernel/intern/pbvh_intern.h index 361f7c6cfde..46f7a9b7b56 100644 --- a/source/blender/blenkernel/intern/pbvh_intern.h +++ b/source/blender/blenkernel/intern/pbvh_intern.h @@ -184,7 +184,7 @@ void pbvh_update_BB_redraw(PBVH *bvh, PBVHNode **nodes, int totnode, int flag); bool pbvh_bmesh_node_raycast( PBVHNode *node, const float ray_start[3], const float ray_normal[3], float *dist, - int use_original); + bool use_original); void pbvh_bmesh_normals_update(PBVHNode **nodes, int totnode); diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index f993d74959d..8a912a277ae 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -933,7 +933,7 @@ static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds, **********************************************************/ /* set "ignore cache" flag for all caches on this object */ -static void object_cacheIgnoreClear(Object *ob, int state) +static void object_cacheIgnoreClear(Object *ob, bool state) { ListBase pidlist; PTCacheID *pid; @@ -951,7 +951,7 @@ static void object_cacheIgnoreClear(Object *ob, int state) BLI_freelistN(&pidlist); } -static int subframe_updateObject(Scene *scene, Object *ob, int update_mesh, int parent_recursion, float frame, bool for_render) +static bool subframe_updateObject(Scene *scene, Object *ob, int update_mesh, int parent_recursion, float frame, bool for_render) { SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke); bConstraint *con; @@ -963,9 +963,9 @@ static int subframe_updateObject(Scene *scene, Object *ob, int update_mesh, int /* if object has parents, update them too */ if (parent_recursion) { int recursion = parent_recursion - 1; - int is_domain = 0; - if (ob->parent) is_domain += subframe_updateObject(scene, ob->parent, 0, recursion, frame, for_render); - if (ob->track) is_domain += subframe_updateObject(scene, ob->track, 0, recursion, frame, for_render); + bool is_domain = false; + if (ob->parent) is_domain |= subframe_updateObject(scene, ob->parent, 0, recursion, frame, for_render); + if (ob->track) is_domain |= subframe_updateObject(scene, ob->track, 0, recursion, frame, for_render); /* skip subframe if object is parented * to vertex of a dynamic paint canvas */ @@ -1073,7 +1073,7 @@ static void clampBoundsInDomain(SmokeDomainSettings *sds, int min[3], int max[3] } } -static void em_allocateData(EmissionMap *em, int use_velocity, int hires_mul) +static void em_allocateData(EmissionMap *em, bool use_velocity, int hires_mul) { int i, res[3]; @@ -1427,8 +1427,11 @@ static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, Smoke } } -static void sample_derivedmesh(SmokeFlowSettings *sfs, MVert *mvert, MTFace *tface, MFace *mface, float *influence_map, float *velocity_map, int index, int base_res[3], float flow_center[3], BVHTreeFromMesh *treeData, float ray_start[3], - float *vert_vel, int has_velocity, int defgrp_index, MDeformVert *dvert, float x, float y, float z) +static void sample_derivedmesh( + SmokeFlowSettings *sfs, MVert *mvert, MTFace *tface, MFace *mface, + float *influence_map, float *velocity_map, int index, int base_res[3], float flow_center[3], + BVHTreeFromMesh *treeData, const float ray_start[3], const float *vert_vel, + bool has_velocity, int defgrp_index, MDeformVert *dvert, float x, float y, float z) { float ray_dir[3] = {1.0f, 0.0f, 0.0f}; BVHTreeRayHit hit = {0}; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 22267c93680..f42663401ee 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2963,7 +2963,8 @@ int txt_setcurr_tab_spaces(Text *text, int space) * 2) within an identifier * 3) after the cursor (text->curc), i.e. when creating space before a function def [#25414] */ - int a, is_indent = 0; + int a; + bool is_indent = false; for (a = 0; (a < text->curc) && (text->curl->line[a] != '\0'); a++) { char ch = text->curl->line[a]; if (ch == '#') { diff --git a/source/blender/blenlib/intern/scanfill_utils.c b/source/blender/blenlib/intern/scanfill_utils.c index 1ece34a0944..828cb3a580b 100644 --- a/source/blender/blenlib/intern/scanfill_utils.c +++ b/source/blender/blenlib/intern/scanfill_utils.c @@ -319,7 +319,7 @@ static bool scanfill_preprocess_self_isect( ScanFillVert *v_prev; ScanFillVert *v_curr; - int inside = false; + bool inside = false; /* first vert */ #if 0 diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index bcbfdc78013..614c04e6231 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2462,7 +2462,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) } FOREACH_NODETREE_END { - int has_old_groups = 0; + bool has_old_groups = false; /* XXX this should actually be part of do_versions, but since we need * finished library linking, it is not possible there. Instead in do_versions * we have set the NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2 flag, so at this point we can do the @@ -2752,12 +2752,12 @@ typedef struct tConstraintLinkData { ID *id; } tConstraintLinkData; /* callback function used to relink constraint ID-links */ -static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, short isReference, void *userdata) +static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *userdata) { tConstraintLinkData *cld= (tConstraintLinkData *)userdata; /* for reference types, we need to increment the usercounts on load... */ - if (isReference) { + if (is_reference) { /* reference type - with usercount */ *idpoin = newlibadr_us(cld->fd, cld->id->lib, *idpoin); } @@ -8208,7 +8208,7 @@ typedef struct tConstraintExpandData { Main *mainvar; } tConstraintExpandData; /* callback function used to expand constraint ID-links */ -static void expand_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, short UNUSED(isReference), void *userdata) +static void expand_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, bool UNUSED(is_reference), void *userdata) { tConstraintExpandData *ced = (tConstraintExpandData *)userdata; expand_doit(ced->fd, ced->mainvar, *idpoin); diff --git a/source/blender/bmesh/operators/bmo_edgenet.c b/source/blender/bmesh/operators/bmo_edgenet.c index de41bc7937d..0c5de590ccf 100644 --- a/source/blender/bmesh/operators/bmo_edgenet.c +++ b/source/blender/bmesh/operators/bmo_edgenet.c @@ -114,7 +114,7 @@ void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op) BLI_array_declare(edges1); BLI_array_declare(edges2); BLI_array_declare(edges); - int ok = 1; + bool ok = true; int i, count; BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK); diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 341e27a12bf..5d97b7be9f7 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -387,7 +387,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s * - setting: type of setting to set * - on: whether the visibility setting has been enabled or disabled */ -void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short on) +void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short mode) { bAnimListElem *ale, *match = NULL; int prevLevel = 0, matchLevel = 0; @@ -437,8 +437,8 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn * - only flush up if the current state is now disabled (negative 'off' state is default) * (otherwise, it's too much work to force the parents to be active too) */ - if ( ((setting == ACHANNEL_SETTING_VISIBLE) && on) || - ((setting != ACHANNEL_SETTING_VISIBLE) && on == 0) ) + if ( ((setting == ACHANNEL_SETTING_VISIBLE) && (mode != ACHANNEL_SETFLAG_CLEAR)) || + ((setting != ACHANNEL_SETTING_VISIBLE) && (mode == ACHANNEL_SETFLAG_CLEAR))) { /* go backwards in the list, until the highest-ranking element (by indention has been covered) */ for (ale = match->prev; ale; ale = ale->prev) { @@ -461,7 +461,7 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn */ if (level < prevLevel) { /* flush the new status... */ - ANIM_channel_setting_set(ac, ale, setting, on); + ANIM_channel_setting_set(ac, ale, setting, mode); /* store this level as the 'old' level now */ prevLevel = level; @@ -502,7 +502,7 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn * flush the new status... */ if (level > matchLevel) - ANIM_channel_setting_set(ac, ale, setting, on); + ANIM_channel_setting_set(ac, ale, setting, mode); /* however, if the level is 'less than or equal to' the channel that was changed, * (i.e. the current channel is as important if not more important than the changed channel) * then we should stop, since we've found the last one of the children we should flush diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index b1789d25b88..af06351d23c 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -223,7 +223,7 @@ static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt) * - restore = whether to map points back to non-mapped time * - only_keys = whether to only adjust the location of the center point of beztriples */ -void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, short restore, short only_keys) +void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, bool restore, bool only_keys) { KeyframeEditData ked = {{NULL}}; KeyframeEditFunc map_cb; diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 48611633592..7ce33e01747 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -705,9 +705,9 @@ void free_fmodifiers_copybuf(void) * assuming that the buffer has been cleared already with free_fmodifiers_copybuf() * - active: only copy the active modifier */ -short ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, short active) +bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active) { - short ok = 1; + bool ok = true; /* sanity checks */ if (ELEM(NULL, modifiers, modifiers->first)) @@ -734,10 +734,10 @@ short ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, short active) /* 'Paste' the F-Modifier(s) from the buffer to the specified list * - replace: free all the existing modifiers to leave only the pasted ones */ -short ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, short replace) +bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace) { FModifier *fcm; - short ok = 0; + bool ok = false; /* sanity checks */ if (modifiers == NULL) diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index e5929d0ad8e..4a160353670 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -428,6 +428,7 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac) */ #define KEYFRAME_OK_CHECKS(check) \ { \ + CHECK_TYPE(ok, short); \ if (check(1)) \ ok |= KEYFRAME_OK_KEY; \ \ diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index b354facb9b3..e004b37a307 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -124,7 +124,7 @@ void ED_armature_exit_posemode(bContext *C, Base *base) /* if a selected or active bone is protected, throw error (oonly if warn == 1) and return 1 */ /* only_selected == 1: the active bone is allowed to be protected */ #if 0 /* UNUSED 2.5 */ -static short pose_has_protected_selected(Object *ob, short warn) +static bool pose_has_protected_selected(Object *ob, short warn) { /* check protection */ if (ob->proxy) { diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index f77a3da06fb..fb510473b11 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -878,7 +878,7 @@ static void poselib_apply_pose(tPoseLib_PreviewData *pld) pchan = BKE_pose_channel_find_name(pose, agrp->name); if (pchan) { - short ok = 0; + bool ok = 0; /* check if this bone should get any animation applied */ if (pld->selcount == 0) { diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 9c0909b67f2..50152b02993 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2971,7 +2971,7 @@ static void select_adjacent_cp(ListBase *editnurb, short next, BezTriple *bezt; BPoint *bp; int a; - short lastsel = false; + bool lastsel = false; if (next == 0) return; @@ -3141,7 +3141,7 @@ void CURVE_OT_de_select_last(wmOperatorType *ot) /******************* de select all operator ***************/ -static short nurb_has_selected_cps(ListBase *editnurb) +static bool nurb_has_selected_cps(ListBase *editnurb) { Nurb *nu; BezTriple *bezt; @@ -4358,7 +4358,7 @@ static int merge_nurb(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); ListBase *editnurb = object_editcurve_get(obedit); NurbSort *nus1, *nus2; - int ok = 1; + bool ok = true; make_selection_list_nurb(editnurb); @@ -4427,7 +4427,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) ListBase *nubase = object_editcurve_get(obedit); Nurb *nu, *nu1 = NULL, *nu2 = NULL; BPoint *bp; - int ok = 0; + bool ok = false; /* int a; */ /* UNUSED */ /* first decide if this is a surface merge! */ @@ -4913,7 +4913,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) BezTriple *bezt, *newbezt = NULL; BPoint *bp, *newbp = NULL; float imat[4][4], temp[3]; - int ok = 0; + bool ok = false; BezTriple *bezt_recalc[3] = {NULL}; invert_m4_m4(imat, obedit->obmat); diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 5c067e80619..de067d68573 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -716,7 +716,7 @@ static EnumPropertyItem style_items[] = { {0, NULL, 0, NULL, NULL} }; -static int set_style(bContext *C, const int style, const int clear) +static int set_style(bContext *C, const int style, const bool clear) { Object *obedit = CTX_data_edit_object(C); Curve *cu = obedit->data; @@ -742,7 +742,7 @@ static int set_style(bContext *C, const int style, const int clear) static int set_style_exec(bContext *C, wmOperator *op) { const int style = RNA_enum_get(op->ptr, "style"); - const int clear = RNA_boolean_get(op->ptr, "clear"); + const bool clear = RNA_boolean_get(op->ptr, "clear"); return set_style(C, style, clear); } diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index dc3fe66cbea..88d5937d220 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -454,7 +454,7 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, * - setting: type of setting to set * - on: whether the visibility setting has been enabled or disabled */ -void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short on); +void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short mode); /* Deselect all animation channels */ @@ -511,12 +511,12 @@ void free_fmodifiers_copybuf(void); * assuming that the buffer has been cleared already with free_fmodifiers_copybuf() * - active: only copy the active modifier */ -short ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, short active); +bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active); /* 'Paste' the F-Modifier(s) from the buffer to the specified list * - replace: free all the existing modifiers to leave only the pasted ones */ -short ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, short replace); +bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace); /* ************************************************* */ /* ASSORTED TOOLS */ @@ -537,7 +537,7 @@ void getcolor_fcurve_rainbow(int cur, int tot, float out[3]); struct AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale); /* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve */ -void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, short restore, short only_keys); +void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, bool restore, bool only_keys); /* ..... */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 8a4233a97b0..7e6e00bbdff 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1264,7 +1264,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block) */ int ui_is_but_push_ex(uiBut *but, double *value) { - int is_push = false; + int is_push = 0; if (but->bit) { const bool state = ELEM3(but->type, TOGN, ICONTOGN, OPTIONN) ? false : true; @@ -1862,7 +1862,7 @@ void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double value, bool pad, int float_precision) { UnitSettings *unit = but->block->unit; - int do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0; + const bool do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0; int unit_type = uiButGetUnitType(but); int precision; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 85c82efc347..8cebc6ad822 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1483,7 +1483,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) { rctf rect; - int ok = 0, width, height; + bool ok = false; + int width, height; GLint scissor[4]; MovieClipScopes *scopes = (MovieClipScopes *)but->poin; diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 00629ab9537..b7e026ca8e3 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -1854,7 +1854,7 @@ static int mask_hide_view_set_exec(bContext *C, wmOperator *op) { Mask *mask = CTX_data_edit_mask(C); MaskLayer *masklay; - const int unselected = RNA_boolean_get(op->ptr, "unselected"); + const bool unselected = RNA_boolean_get(op->ptr, "unselected"); bool changed = false; for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index 56eb8cf626b..a05102310e6 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -699,7 +699,7 @@ static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE MaskSpline *spline; MaskSplinePoint *point = NULL; float co[2]; - int do_select = !RNA_boolean_get(op->ptr, "deselect"); + bool do_select = !RNA_boolean_get(op->ptr, "deselect"); const float threshold = 19; bool changed = false; diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 467b08c266c..61bfbfb4ac9 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -168,7 +168,7 @@ void EDBM_select_mirrored(BMEditMesh *em, bool extend, void EDBM_automerge(Scene *scene, Object *obedit, bool update, const char hflag) { - int ok; + bool ok; BMEditMesh *em = BKE_editmesh_from_object(obedit); ok = BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS, @@ -2092,7 +2092,7 @@ static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE BMVert *eve; BMEdge *e, *eed; BMFace *efa; - int sel = !RNA_boolean_get(op->ptr, "deselect"); + const bool sel = !RNA_boolean_get(op->ptr, "deselect"); int limit; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 68f80087e31..e57f6375a2a 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1285,7 +1285,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) Mesh *me = obedit->data; BMEditMesh *em = BKE_editmesh_from_object(obedit); ModifierData *md; - int mirrx = false, mirry = false, mirrz = false; + bool mirrx = false, mirry = false, mirrz = false; int i, repeat; float clip_dist = 0.0f; bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; @@ -1370,7 +1370,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op) BMEditMesh *em = BKE_editmesh_from_object(obedit); Mesh *me = obedit->data; bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; - int usex = true, usey = true, usez = true, preserve_volume = true; + bool usex = true, usey = true, usez = true, preserve_volume = true; int i, repeat; float lambda_factor; float lambda_border; diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index c1d1c10124e..d252ae20270 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -596,7 +596,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) DerivedMesh *dm = NULL; Key *key = me->key; KeyBlock *kb; - int ok = 0, nonequal_verts = 0; + bool ok = false, nonequal_verts = false; CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { @@ -606,7 +606,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) selme = (Mesh *)base->object->data; if (selme->totvert == me->totvert) - ok++; + ok = true; else nonequal_verts = 1; } diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index a833c530711..dc3ac2ee0ae 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -502,7 +502,7 @@ static int hide_metaelems_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); MetaBall *mb = (MetaBall *)obedit->data; MetaElem *ml; - const int invert = RNA_boolean_get(op->ptr, "unselected") ? SELECT : 0; + const bool invert = RNA_boolean_get(op->ptr, "unselected") ? SELECT : 0; ml = mb->editelems->first; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index e3041d97019..da989ba4f21 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1259,8 +1259,8 @@ static void copy_object_set_idnew(bContext *C, int dupflag) /********************* Make Duplicates Real ************************/ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, - const short use_base_parent, - const short use_hierarchy) + const bool use_base_parent, + const bool use_hierarchy) { Main *bmain = CTX_data_main(C); ListBase *lb; @@ -1410,8 +1410,8 @@ static int object_duplicates_make_real_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - const short use_base_parent = RNA_boolean_get(op->ptr, "use_base_parent"); - const short use_hierarchy = RNA_boolean_get(op->ptr, "use_hierarchy"); + const bool use_base_parent = RNA_boolean_get(op->ptr, "use_base_parent"); + const bool use_hierarchy = RNA_boolean_get(op->ptr, "use_hierarchy"); BKE_main_id_clear_newpoins(bmain); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 7ae54a1a803..5b0bfef6330 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -178,7 +178,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); bool changed = false; - const int unselected = RNA_boolean_get(op->ptr, "unselected"); + const bool unselected = RNA_boolean_get(op->ptr, "unselected"); CTX_DATA_BEGIN(C, Base *, base, visible_bases) { @@ -273,7 +273,7 @@ void OBJECT_OT_hide_render_clear(wmOperatorType *ot) static int object_hide_render_set_exec(bContext *C, wmOperator *op) { - const int unselected = RNA_boolean_get(op->ptr, "unselected"); + const bool unselected = RNA_boolean_get(op->ptr, "unselected"); CTX_DATA_BEGIN(C, Base *, base, visible_bases) { @@ -432,7 +432,7 @@ void ED_object_editmode_enter(bContext *C, int flag) Object *ob; ScrArea *sa = CTX_wm_area(C); View3D *v3d = NULL; - int ok = 0; + bool ok = false; if (scene->id.lib) return; diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index 72d7ffaf2ea..bfaf7f13e61 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -249,7 +249,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op) int single_group_index = RNA_enum_get(op->ptr, "group"); Group *single_group = group_object_active_find_index(ob, single_group_index); Group *group; - int ok = 0; + bool ok = false; if (ob == NULL) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index e67381a1d43..670e2f2d4ac 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -542,7 +542,7 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); Object *obsel = NULL; - const int use_bone = RNA_boolean_get(op->ptr, "use_bone"); + const bool use_bone = RNA_boolean_get(op->ptr, "use_bone"); const int mode = use_bone ? OBJECT_ADDHOOK_SELOB_BONE : OBJECT_ADDHOOK_SELOB; CTX_DATA_BEGIN (C, Object *, ob, selected_objects) diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index b0d3d363c45..3493f6bf778 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -375,7 +375,7 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob) } } -static int apply_objects_internal(bContext *C, ReportList *reports, int apply_loc, int apply_rot, int apply_scale) +static int apply_objects_internal(bContext *C, ReportList *reports, bool apply_loc, bool apply_rot, bool apply_scale) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -647,9 +647,9 @@ void OBJECT_OT_visual_transform_apply(wmOperatorType *ot) static int object_transform_apply_exec(bContext *C, wmOperator *op) { - const int loc = RNA_boolean_get(op->ptr, "location"); - const int rot = RNA_boolean_get(op->ptr, "rotation"); - const int sca = RNA_boolean_get(op->ptr, "scale"); + const bool loc = RNA_boolean_get(op->ptr, "location"); + const bool rot = RNA_boolean_get(op->ptr, "rotation"); + const bool sca = RNA_boolean_get(op->ptr, "scale"); if (loc || rot || sca) { return apply_objects_internal(C, op->reports, loc, rot, sca); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 242ba1f1d67..e095485f68b 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -512,8 +512,8 @@ static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op) ImBuf *ibuf, *ibuf_save = NULL; void *lock; char name[FILE_MAX]; - int ok = 0; - const short view_context = (oglrender->v3d != NULL); + bool ok = false; + const bool view_context = (oglrender->v3d != NULL); Object *camera = NULL; bool is_movie; diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index fdb9b5c04ed..6eb4c5901cd 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -524,7 +524,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre /* new UI convention: draw is in pixel space already. */ /* uses ROUNDBOX button in block to get the rect */ -static int ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, rcti *newrect) +static bool ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, rcti *newrect) { Render *re; RenderResult rres; @@ -532,7 +532,7 @@ static int ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, r int offx = 0; int newx = BLI_rcti_size_x(rect); int newy = BLI_rcti_size_y(rect); - int ok = 0; + bool ok = false; if (!split || first) sprintf(name, "Preview %p", (void *)sa); else sprintf(name, "SecondPreview %p", (void *)sa); diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 81eb11d7138..f82a98a2394 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -366,7 +366,7 @@ static void texture_changed(Main *bmain, Tex *tex) Scene *scene; Object *ob; bNode *node; - int texture_draw = false; + bool texture_draw = false; /* icons */ BKE_icon_changed(BKE_icon_getid(&tex->id)); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 4cf59a575b9..2f4caeeef1b 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -808,7 +808,7 @@ void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings) wmWindow *win; ScrArea *sa; ImagePaintSettings *imapaint = &settings->imapaint; - int enabled = false; + bool enabled = false; for (win = wm->windows.first; win; win = win->next) for (sa = win->screen->areabase.first; sa; sa = sa->next) diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 4c86862fae8..e06ee4c21f9 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -405,7 +405,7 @@ void PAINT_OT_vert_select_ungrouped(wmOperatorType *ot) static int face_select_hide_exec(bContext *C, wmOperator *op) { - const int unselected = RNA_boolean_get(op->ptr, "unselected"); + const bool unselected = RNA_boolean_get(op->ptr, "unselected"); Object *ob = CTX_data_active_object(C); paintface_hide(ob, unselected); ED_region_tag_redraw(CTX_wm_region(C)); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 4608a25cc00..eea7851415c 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4218,9 +4218,9 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, /* Returns true if any of the smoothing modes are active (currently * one of smooth brush, autosmooth, mask smooth, or shift-key * smooth) */ -static int sculpt_any_smooth_mode(const Brush *brush, - StrokeCache *cache, - int stroke_mode) +static bool sculpt_any_smooth_mode(const Brush *brush, + StrokeCache *cache, + int stroke_mode) { return ((stroke_mode == BRUSH_STROKE_SMOOTH) || (cache && cache->alt_smooth) || @@ -4393,8 +4393,8 @@ static int sculpt_brush_stroke_init(bContext *C, wmOperator *op) SculptSession *ss = CTX_data_active_object(C)->sculpt; Brush *brush = BKE_paint_brush(&sd->paint); int mode = RNA_enum_get(op->ptr, "mode"); - int is_smooth = 0; - int need_mask = false; + bool is_smooth; + bool need_mask = false; if (brush->sculpt_tool == SCULPT_TOOL_MASK) { need_mask = true; diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 673e4d90d99..724d093a48f 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -402,8 +402,8 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb) DerivedMesh *dm; SculptSession *ss = ob->sculpt; SculptUndoNode *unode; - int update = false, rebuild = false; - int need_mask = false; + bool update = false, rebuild = false; + bool need_mask = false; for (unode = lb->first; unode; unode = unode->next) { if (strcmp(unode->idname, ob->id.name) == 0) { diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 1c2933b823d..f66e5a74b41 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -3501,9 +3501,10 @@ void CLIP_OT_stabilize_2d_set_rotation(wmOperatorType *ot) /********************** clean tracks operator *********************/ -static int is_track_clean(MovieTrackingTrack *track, int frames, int del) +static bool is_track_clean(MovieTrackingTrack *track, int frames, int del) { - int ok = 1, a, prev = -1, count = 0; + bool ok = true; + int a, prev = -1, count = 0; MovieTrackingMarker *markers = track->markers, *new_markers = NULL; int start_disabled = 0; int markersnr = track->markersnr; diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 213d9d79132..290f4c2e5f2 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -554,7 +554,7 @@ static int console_delete_exec(bContext *C, wmOperator *op) int stride; const short type = RNA_enum_get(op->ptr, "type"); - int done = false; + bool done = false; if (ci->len == 0) { return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 9c11fc712c8..8becb287cf1 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -127,7 +127,7 @@ static void clamp_to_filelist(int numfiles, FileSelection *sel) } } -static FileSelection file_selection_get(bContext *C, const rcti *rect, short fill) +static FileSelection file_selection_get(bContext *C, const rcti *rect, bool fill) { ARegion *ar = CTX_wm_region(C); SpaceFile *sfile = CTX_wm_space_file(C); @@ -155,7 +155,7 @@ static FileSelection file_selection_get(bContext *C, const rcti *rect, short fil return sel; } -static FileSelect file_select_do(bContext *C, int selected_idx, short do_diropen) +static FileSelect file_select_do(bContext *C, int selected_idx, bool do_diropen) { FileSelect retval = FILE_SELECT_NOTHING; SpaceFile *sfile = CTX_wm_space_file(C); @@ -205,7 +205,7 @@ static FileSelect file_select_do(bContext *C, int selected_idx, short do_diropen } -static FileSelect file_select(bContext *C, const rcti *rect, FileSelType select, short fill, short do_diropen) +static FileSelect file_select(bContext *C, const rcti *rect, FileSelType select, bool fill, bool do_diropen) { SpaceFile *sfile = CTX_wm_space_file(C); FileSelect retval = FILE_SELECT_NOTHING; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index c2053c15f95..702f6af4071 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -2320,7 +2320,7 @@ static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op) { bAnimContext ac; bAnimListElem *ale; - short ok = 0; + bool ok = false; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index c7876bb44c4..203b983838f 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -839,7 +839,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man const bool is_render_out = (id && GS(id->name) == ID_SCE); uiLayout *col, *row, *split, *sub; - int show_preview = false; + bool show_preview = false; col = uiLayoutColumn(layout, false); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index c9dda074667..562fb2cf827 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -157,7 +157,7 @@ static int space_image_file_exists_poll(bContext *C) SpaceImage *sima = CTX_wm_space_image(C); ImBuf *ibuf; void *lock; - int ret = false; + bool ret = false; char name[FILE_MAX]; ibuf = ED_space_image_acquire_buffer(sima, &lock); diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 8ed34451b8e..acf5d6a2f55 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -922,7 +922,7 @@ static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_c return block; } -static int is_sensor_linked(uiBlock *block, bSensor *sens) +static bool is_sensor_linked(uiBlock *block, bSensor *sens) { bController *cont; int i; diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 80b1918ff8e..da619ed79bd 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -110,7 +110,7 @@ static int nlaedit_enable_tweakmode_exec(bContext *C, wmOperator *op) ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; - int ok = 0; + bool ok = false; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -131,7 +131,7 @@ static int nlaedit_enable_tweakmode_exec(bContext *C, wmOperator *op) AnimData *adt = ale->data; /* try entering tweakmode if valid */ - ok += BKE_nla_tweakmode_enter(adt); + ok |= BKE_nla_tweakmode_enter(adt); } /* free temp data */ @@ -527,7 +527,7 @@ static int nlaedit_add_transition_exec(bContext *C, wmOperator *op) bAnimListElem *ale; int filter; - int done = false; + bool done = false; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -595,7 +595,7 @@ static int nlaedit_add_transition_exec(bContext *C, wmOperator *op) BKE_nlastrip_validate_name(adt, strip); /* make note of this */ - done++; + done = true; } } @@ -2087,7 +2087,8 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op) bAnimContext ac; ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; - int filter, ok = 0; + int filter; + bool ok = false; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -2111,7 +2112,7 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op) continue; // TODO: when 'active' vs 'all' boolean is added, change last param! - ok += ANIM_fmodifiers_copy_to_buf(&strip->modifiers, 0); + ok |= ANIM_fmodifiers_copy_to_buf(&strip->modifiers, 0); } } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 7c5ffa54f92..9e89a192543 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2323,9 +2323,9 @@ static int node_shader_script_update_poll(bContext *C) } /* recursively check for script nodes in groups using this text and update */ -static int node_shader_script_update_text_recursive(RenderEngine *engine, RenderEngineType *type, bNodeTree *ntree, Text *text) +static bool node_shader_script_update_text_recursive(RenderEngine *engine, RenderEngineType *type, bNodeTree *ntree, Text *text) { - int found = false; + bool found = false; bNode *node; ntree->done = true; @@ -2356,7 +2356,7 @@ static int node_shader_script_update_exec(bContext *C, wmOperator *op) bNode *node = NULL; RenderEngine *engine; RenderEngineType *type; - int found = false; + bool found = false; /* setup render engine */ type = RE_engines_find(scene->r.engine); diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index 05348acfae7..14a68bd1674 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -684,7 +684,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, ListBase anim_basepaths = {NULL, NULL}; float min[2], max[2], center[2]; int totselect; - int expose_all = false; + bool expose_all = false; bNode *input_node, *output_node; /* XXX rough guess, not nice but we don't have access to UI constants here ... */ @@ -831,7 +831,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, if (node_group_make_use_node(node, gnode)) { for (sock = node->inputs.first; sock; sock = sock->next) { bNodeSocket *iosock, *input_sock; - int skip = false; + bool skip = false; for (link = ngroup->links.first; link; link = link->next) { if (link->tosock == sock) { skip = true; @@ -852,7 +852,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, for (sock = node->outputs.first; sock; sock = sock->next) { bNodeSocket *iosock, *output_sock; - int skip = false; + bool skip = false; for (link = ngroup->links.first; link; link = link->next) if (link->fromsock == sock) skip = true; diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index 7d9bf4b67f2..e1d66b9f916 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -206,7 +206,7 @@ static void snode_autoconnect(SpaceNode *snode, const bool allow_multiple, const for (nli = nodelist->first; nli; nli = nli->next) { bNode *node_fr, *node_to; bNodeSocket *sock_fr, *sock_to; - int has_selected_inputs = 0; + bool has_selected_inputs = false; if (nli->next == NULL) break; @@ -770,7 +770,7 @@ static int cut_links_exec(bContext *C, wmOperator *op) RNA_END; if (i > 1) { - int found = false; + bool found = false; bNodeLink *link, *next; ED_preview_kill_jobs(C); diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index 90b9c2071de..8946b38653f 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -425,7 +425,7 @@ bool ED_space_node_color_sample(SpaceNode *snode, ARegion *ar, int mval[2], floa Image *ima; ImBuf *ibuf; float fx, fy, bufx, bufy; - int ret = false; + bool ret = false; if (STREQ(snode->tree_idname, ntreeType_Composite->idname) || (snode->flag & SNODE_BACKDRAW) == 0) { /* use viewer image for color sampling only if we're in compositor tree diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index c266563cd6f..18692880ddf 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -893,7 +893,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) /* add color */ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { - short is_type_set = RNA_struct_property_is_set(op->ptr, "type"); + bool is_type_set = RNA_struct_property_is_set(op->ptr, "type"); int type = -1; int prop_flag = SEQPROP_ENDFRAME; diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 9f7f40899b2..fe900b6bcae 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -918,7 +918,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq GLuint last_texid; void *display_buffer; void *cache_handle = NULL; - const int is_imbuf = ED_space_sequencer_check_show_imbuf(sseq); + const bool is_imbuf = ED_space_sequencer_check_show_imbuf(sseq); int format, type; bool glsl_used = false; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index c5f01f88706..8c664a1f423 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -3168,7 +3168,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, false); Sequence *seq = BKE_sequencer_active_get(scene); - const int is_relative_path = RNA_boolean_get(op->ptr, "relative_path"); + const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path"); if (seq->type == SEQ_TYPE_IMAGE) { char directory[FILE_MAX]; diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 9edf8433fca..496be65cf0e 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -952,7 +952,7 @@ static bool select_grouped_type_basic(Editing *ed, Sequence *actseq) { Sequence *seq; bool changed = false; - short is_sound = SEQ_IS_SOUND(actseq); + const bool is_sound = SEQ_IS_SOUND(actseq); SEQP_BEGIN (ed, seq) { diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index b45838e0bac..4d2eea87904 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2845,7 +2845,7 @@ static int text_insert_exec(bContext *C, wmOperator *op) SpaceText *st = CTX_wm_space_text(C); Text *text = CTX_data_edit_text(C); char *str; - int done = false; + bool done = false; size_t i = 0; unsigned int code; diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index 8eb9c9be40b..c7f8abd7fb4 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -222,7 +222,7 @@ static void ruler_item_active_set(RulerInfo *ruler_info, RulerItem *ruler_item) static void ruler_item_as_string(RulerItem *ruler_item, UnitSettings *unit, char *numstr, size_t numstr_size, int prec) { - const int do_split = unit->flag & USER_UNIT_OPT_SPLIT; + const bool do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0; if (ruler_item->flag & RULERITEM_USE_ANGLE) { const float ruler_angle = angle_v3v3v3(ruler_item->co[0], diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 9467eae930f..90a88567996 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1388,7 +1388,7 @@ static bool mouse_select(bContext *C, const int mval[2], Base *base, *startbase = NULL, *basact = NULL, *oldbasact = NULL; bool is_obedit; float dist = ED_view3d_select_dist_px() * 1.3333f; - int retval = false; + bool retval = false; short hits; const float mval_fl[2] = {(float)mval[0], (float)mval[1]}; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 3486e930466..26ebd1ddf63 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -413,7 +413,7 @@ static void bundle_midpoint(Scene *scene, Object *ob, float vec[3]) MovieClip *clip = BKE_object_movieclip_get(scene, ob, false); MovieTracking *tracking; MovieTrackingObject *object; - int ok = 0; + bool ok = false; float min[3], max[3], mat[4][4], pos[3], cammat[4][4] = MAT4_UNITY; if (!clip) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 5a8a84112d5..8b0667a8992 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2584,7 +2584,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) bConstraintTypeInfo *cti = BKE_get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT); bConstraintOb cob; bConstraint *con; - int do_limit = false; + bool do_limit = false; /* Evaluate valid constraints */ for (con = td->con; con; con = con->next) { @@ -4107,7 +4107,8 @@ static void headerTranslation(TransInfo *t, float vec[3], char str[MAX_INFO_LEN] dist = len_v3(vec); if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) { - int i, do_split = t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1 : 0; + const bool do_split = (t->scene->unit.flag & USER_UNIT_OPT_SPLIT) != 0; + int i; for (i = 0; i < 3; i++) { bUnit_AsString(&tvec[NUM_STR_REP_LEN * i], NUM_STR_REP_LEN, dvec[i] * t->scene->unit.scale_length, @@ -4121,13 +4122,18 @@ static void headerTranslation(TransInfo *t, float vec[3], char str[MAX_INFO_LEN] } } - if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) + if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) { + const bool do_split = (t->scene->unit.flag & USER_UNIT_OPT_SPLIT) != 0; bUnit_AsString(distvec, sizeof(distvec), dist * t->scene->unit.scale_length, 4, t->scene->unit.system, - B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, false); - else if (dist > 1e10f || dist < -1e10f) /* prevent string buffer overflow */ + B_UNIT_LENGTH, do_split, false); + } + else if (dist > 1e10f || dist < -1e10f) { + /* prevent string buffer overflow */ BLI_snprintf(distvec, NUM_STR_REP_LEN, "%.4e", dist); - else + } + else { BLI_snprintf(distvec, NUM_STR_REP_LEN, "%.4f", dist); + } if (t->flag & T_AUTOIK) { short chainlen = t->settings->autoik_chainlen; @@ -4571,7 +4577,8 @@ static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) { TransData *td; float ratio; - int i, initial_feather = false; + int i; + bool initial_feather = false; char str[MAX_INFO_LEN]; ratio = t->values[0]; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 455fa45d01b..6f0208175b1 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -6596,7 +6596,7 @@ static void MaskHandleToTransData(MaskSplinePoint *point, eMaskWhichHandle which /*const*/ float parent_inverse_matrix[3][3]) { BezTriple *bezt = &point->bezt; - short is_sel_any = MASKPOINT_ISSEL_ANY(point); + const bool is_sel_any = MASKPOINT_ISSEL_ANY(point); tdm->point = point; copy_m3_m3(tdm->vec, bezt->vec); diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 2fa0b6b320f..08a291860f0 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -505,7 +505,7 @@ int calc_manipulator_stats(const bContext *C) else if (ob && (ob->mode & OB_MODE_POSE)) { bPoseChannel *pchan; int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed - int ok = false; + bool ok = false; if ((ob->lay & v3d->lay) == 0) return 0; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 1338a34749a..87b064acac7 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -858,7 +858,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], bArmature *arm = ob->data; bPoseChannel *pchan; float imat[3][3], mat[3][3]; - int ok = false; + bool ok = false; if (activeOnly && (pchan = BKE_pose_channel_active(ob))) { add_v3_v3(normal, pchan->pose_mat[2]); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index f5dcac7e062..0706ac3278b 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1684,7 +1684,7 @@ typedef struct UVvert { static int uv_remove_doubles_exec(bContext *C, wmOperator *op) { const float threshold = RNA_float_get(op->ptr, "threshold"); - const int use_unselected = RNA_boolean_get(op->ptr, "use_unselected"); + const bool use_unselected = RNA_boolean_get(op->ptr, "use_unselected"); SpaceImage *sima; Scene *scene; diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index 101fd67af2c..bc410cb8369 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -105,8 +105,8 @@ typedef struct GPUNodeStack { const char *name; float vec[4]; struct GPUNodeLink *link; - short hasinput; - short hasoutput; + bool hasinput; + bool hasoutput; short sockettype; } GPUNodeStack; diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index c22c4fbcdf4..97084f7a887 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -261,7 +261,7 @@ void GPU_set_gpu_mipmapping(int gpu_mipmap) static void gpu_generate_mipmap(GLenum target) { - int is_ati = GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY); + const bool is_ati = GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY); int target_enabled = 0; /* work around bug in ATI driver, need to have GL_TEXTURE_2D enabled @@ -1040,7 +1040,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h) /* if color correction is needed, we must update the part that needs updating. */ if (ibuf->rect_float) { float *buffer = MEM_mallocN(w*h*sizeof(float)*4, "temp_texpaint_float_buf"); - int is_data = (ima->tpageflag & IMA_GLBIND_IS_DATA); + bool is_data = (ima->tpageflag & IMA_GLBIND_IS_DATA) != 0; IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h, is_data); if (GPU_check_scaled_image(ibuf, ima, buffer, x, y, w, h)) { diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index c941f1b065e..47f1864bd16 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -379,7 +379,7 @@ void IMB_interlace(struct ImBuf *ibuf); void IMB_rect_from_float(struct ImBuf *ibuf); /* Create char buffer for part of the image, color corrected if necessary, * Changed part will be stored in buffer. This is expected to be used for texture painting updates */ -void IMB_partial_rect_from_float(struct ImBuf *ibuf, float *buffer, int x, int y, int w, int h, int is_data); +void IMB_partial_rect_from_float(struct ImBuf *ibuf, float *buffer, int x, int y, int w, int h, bool is_data); void IMB_float_from_rect(struct ImBuf *ibuf); void IMB_color_to_bw(struct ImBuf *ibuf); void IMB_saturation(struct ImBuf *ibuf, float sat); diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index ef1bc9eaafa..0bd5c5c6ed6 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -565,7 +565,7 @@ void IMB_rect_from_float(ImBuf *ibuf) } /* converts from linear float to sRGB byte for part of the texture, buffer will hold the changed part */ -void IMB_partial_rect_from_float(ImBuf *ibuf, float *buffer, int x, int y, int w, int h, int is_data) +void IMB_partial_rect_from_float(ImBuf *ibuf, float *buffer, int x, int y, int w, int h, bool is_data) { float *rect_float; uchar *rect_byte; diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index d0d7fc2448b..c7491a00a55 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -333,7 +333,7 @@ static int filter_make_index(const int x, const int y, const int w, const int h) else return y * w + x; } -static int check_pixel_assigned(const void *buffer, const char *mask, const int index, const int depth, const int is_float) +static int check_pixel_assigned(const void *buffer, const char *mask, const int index, const int depth, const bool is_float) { int res = 0; @@ -364,7 +364,7 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter) const int depth = 4; /* always 4 channels */ const int chsize = ibuf->rect_float ? sizeof(float) : sizeof(unsigned char); const int bsize = width * height * depth * chsize; - const int is_float = ibuf->rect_float != NULL; + const bool is_float = (ibuf->rect_float != NULL); void *dstbuf = (void *) MEM_dupallocN(ibuf->rect_float ? (void *) ibuf->rect_float : (void *) ibuf->rect); char *dstmask = mask == NULL ? NULL : (char *) MEM_dupallocN(mask); void *srcbuf = ibuf->rect_float ? (void *) ibuf->rect_float : (void *) ibuf->rect; diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index 07c6bb6f84f..2dcb27a05d4 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -117,7 +117,7 @@ static int tga_out4(unsigned int data, FILE *file) return ~EOF; } -static short makebody_tga(ImBuf *ibuf, FILE *file, int (*out)(unsigned int, FILE *)) +static bool makebody_tga(ImBuf *ibuf, FILE *file, int (*out)(unsigned int, FILE *)) { register int last, this; register int copy, bytes; @@ -196,7 +196,7 @@ static short makebody_tga(ImBuf *ibuf, FILE *file, int (*out)(unsigned int, FILE return 1; } -static int dumptarga(struct ImBuf *ibuf, FILE *file) +static bool dumptarga(struct ImBuf *ibuf, FILE *file) { int size; uchar *rect; @@ -253,7 +253,7 @@ int imb_savetarga(struct ImBuf *ibuf, const char *name, int flags) { char buf[20] = {0}; FILE *fildes; - short ok = 0; + bool ok = false; (void)flags; /* unused */ diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 029e25f3e99..35b546b8c12 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2156,7 +2156,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA PropertyType type; const char *funcname, *valstr; const char *ptrstr; - const short has_data = (dfunc->cont.properties.first != NULL); + const bool has_data = (dfunc->cont.properties.first != NULL); int flag, pout, cptr, first; srna = dsrna->srna; diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index bb40a21eed9..f62d42314e2 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -83,7 +83,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[] for (i = 0; i < seq_size; i++) { Py_ssize_t item_seq_size; PyObject *item; - int ok = 1; + bool ok = true; item = PySequence_GetItem(seq, i); if (item == NULL) { diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index e9d3e294b28..4e895a38558 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3360,7 +3360,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) if ( mface->mat_nr==a1 ) { float len; - int reverse_verts = (negative_scale != 0 && do_autosmooth == false); + bool reverse_verts = (negative_scale != 0 && do_autosmooth == false); int rev_tab[] = {reverse_verts==0 ? 0 : 2, 1, reverse_verts==0 ? 2 : 0, 3}; v1= reverse_verts==0 ? mface->v1 : mface->v3; v2= mface->v2; -- cgit v1.2.3