From 37026b12ec1047dd5f4637ad281f108a7963af83 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 5 Feb 2014 22:36:15 +1100 Subject: Code cleanup: use bool for static methods --- source/blender/avi/intern/avi.c | 2 +- source/blender/blenkernel/BKE_dynamicpaint.h | 4 ++-- source/blender/blenkernel/BKE_lattice.h | 2 +- source/blender/blenkernel/intern/customdata.c | 2 +- source/blender/blenkernel/intern/dynamicpaint.c | 6 +++--- source/blender/blenkernel/intern/editderivedmesh.c | 4 +--- source/blender/blenkernel/intern/lattice.c | 8 ++++---- source/blender/blenkernel/intern/material.c | 2 +- source/blender/blenkernel/intern/nla.c | 2 +- source/blender/blenkernel/intern/object.c | 2 +- source/blender/blenkernel/intern/pbvh_bmesh.c | 2 +- source/blender/blenkernel/intern/sequencer.c | 6 +++--- source/blender/blenkernel/intern/text.c | 2 +- source/blender/blenkernel/intern/unit.c | 2 +- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/bmesh/intern/bmesh_interp.c | 4 ++-- source/blender/bmesh/operators/bmo_hull.c | 2 +- source/blender/bmesh/operators/bmo_smooth_laplacian.c | 4 ++-- source/blender/editors/animation/anim_channels_edit.c | 12 ++++++------ source/blender/editors/curve/editcurve.c | 2 +- source/blender/editors/mask/mask_ops.c | 2 +- source/blender/editors/physics/particle_edit.c | 10 +++++----- source/blender/editors/physics/physics_fluid.c | 4 ++-- source/blender/editors/screen/area.c | 2 +- source/blender/editors/screen/screen_ops.c | 2 +- source/blender/editors/sculpt_paint/sculpt.c | 10 +++++----- source/blender/editors/space_clip/tracking_ops.c | 2 +- source/blender/editors/space_file/filelist.c | 14 ++++++-------- source/blender/editors/space_info/info_stats.c | 2 +- source/blender/editors/space_node/node_buttons.c | 2 +- source/blender/editors/space_node/node_relationships.c | 2 +- source/blender/editors/space_sequencer/sequencer_edit.c | 4 ++-- source/blender/editors/transform/transform_generics.c | 2 +- source/blender/editors/uvedit/uvedit_smart_stitch.c | 8 ++++---- .../freestyle/intern/blender_interface/FRS_freestyle.cpp | 2 +- source/blender/imbuf/intern/openexr/openexr_api.cpp | 4 ++-- source/blender/render/intern/raytrace/rayobject_octree.cpp | 2 +- source/blender/windowmanager/intern/wm_draw.c | 6 +++--- source/blender/windowmanager/intern/wm_event_system.c | 2 +- source/blender/windowmanager/intern/wm_keymap.c | 4 ++-- 40 files changed, 77 insertions(+), 81 deletions(-) diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index 7bfe84ebfa7..a423c874adf 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -141,7 +141,7 @@ static int fcc_get_stream(int fcc) return 10 * (fccs[0] - '0') + (fccs[1] - '0'); } -static int fcc_is_data(int fcc) +static bool fcc_is_data(int fcc) { char fccs[4]; diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h index 579da194798..a8e152fd301 100644 --- a/source/blender/blenkernel/BKE_dynamicpaint.h +++ b/source/blender/blenkernel/BKE_dynamicpaint.h @@ -68,10 +68,10 @@ struct DerivedMesh *dynamicPaint_Modifier_do(struct DynamicPaintModifierData *pm void dynamicPaint_Modifier_free(struct DynamicPaintModifierData *pmd); void dynamicPaint_Modifier_copy(struct DynamicPaintModifierData *pmd, struct DynamicPaintModifierData *tsmd); -int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene); +bool dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene); struct DynamicPaintSurface *dynamicPaint_createNewSurface(struct DynamicPaintCanvasSettings *canvas, struct Scene *scene); void dynamicPaint_clearSurface(struct Scene *scene, struct DynamicPaintSurface *surface); -int dynamicPaint_resetSurface(struct Scene *scene, struct DynamicPaintSurface *surface); +bool dynamicPaint_resetSurface(struct Scene *scene, struct DynamicPaintSurface *surface); void dynamicPaint_freeSurface(struct DynamicPaintSurface *surface); void dynamicPaint_freeCanvas(struct DynamicPaintModifierData *pmd); void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd); diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index ba45df73590..c7e9fe54814 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -58,7 +58,7 @@ __attribute__((warn_unused_result)) void calc_latt_deform(struct LatticeDeformData *lattice_deform_data, float co[3], float weight); void end_latt_deform(struct LatticeDeformData *lattice_deform_data); -int object_deform_mball(struct Object *ob, struct ListBase *dispbase); +bool object_deform_mball(struct Object *ob, struct ListBase *dispbase); void outside_lattice(struct Lattice *lt); void curve_deform_verts(struct Object *cuOb, struct Object *target, diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 1ccef2bbe74..e5565e8c6bd 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1282,7 +1282,7 @@ void CustomData_update_typemap(CustomData *data) /* currently only used in BLI_assert */ #ifndef NDEBUG -static int customdata_typemap_is_valid(const CustomData *data) +static bool customdata_typemap_is_valid(const CustomData *data) { CustomData data_copy = *data; CustomData_update_typemap(&data_copy); diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 98cac2f4721..817b81a6db3 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1101,7 +1101,7 @@ DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSettings *c /* * Initialize modifier data */ -int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene) +bool dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene) { if (pmd) { if (type == MOD_DYNAMICPAINT_TYPE_CANVAS) { @@ -1628,7 +1628,7 @@ void dynamicPaint_clearSurface(Scene *scene, DynamicPaintSurface *surface) } /* completely (re)initializes surface (only for point cache types)*/ -int dynamicPaint_resetSurface(Scene *scene, DynamicPaintSurface *surface) +bool dynamicPaint_resetSurface(Scene *scene, DynamicPaintSurface *surface) { int numOfPoints = dynamicPaint_surfaceNumOfPoints(surface); /* free existing data */ @@ -1655,7 +1655,7 @@ int dynamicPaint_resetSurface(Scene *scene, DynamicPaintSurface *surface) } /* make sure allocated surface size matches current requirements */ -static int dynamicPaint_checkSurfaceData(Scene *scene, DynamicPaintSurface *surface) +static bool dynamicPaint_checkSurfaceData(Scene *scene, DynamicPaintSurface *surface) { if (!surface->data || ((dynamicPaint_surfaceNumOfPoints(surface) != surface->data->total_points))) { return dynamicPaint_resetSurface(scene, surface); diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index c3538b141b5..308838c3b8f 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -1205,7 +1205,7 @@ static int emDM_getNumPolys(DerivedMesh *dm) return bmdm->em->bm->totface; } -static int bmvert_to_mvert(BMesh *bm, BMVert *ev, MVert *r_vert) +static void bmvert_to_mvert(BMesh *bm, BMVert *ev, MVert *r_vert) { float *f; @@ -1218,8 +1218,6 @@ static int bmvert_to_mvert(BMesh *bm, BMVert *ev, MVert *r_vert) if ((f = CustomData_bmesh_get(&bm->vdata, ev->head.data, CD_BWEIGHT))) { r_vert->bweight = (unsigned char)((*f) * 255.0f); } - - return 1; } static void emDM_getVert(DerivedMesh *dm, int index, MVert *r_vert) diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index dfab5a0bb26..f7d394563ae 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -563,7 +563,7 @@ static void init_curve_deform(Object *par, Object *ob, CurveDeform *cd) * * returns OK: 1/0 */ -static int where_on_path_deform(Object *ob, float ctime, float vec[4], float dir[3], float quat[4], float *radius) +static bool where_on_path_deform(Object *ob, float ctime, float vec[4], float dir[3], float quat[4], float *radius) { BevList *bl; float ctime1; @@ -614,8 +614,8 @@ static int where_on_path_deform(Object *ob, float ctime, float vec[4], float dir /* co: local coord, result local too */ /* returns quaternion for rotation, using cd->no_rot_axis */ /* axis is using another define!!! */ -static int calc_curve_deform(Object *par, float co[3], - const short axis, CurveDeform *cd, float quat_r[4]) +static bool calc_curve_deform(Object *par, float co[3], + const short axis, CurveDeform *cd, float quat_r[4]) { Curve *cu = par->data; float fac, loc[4], dir[3], new_quat[4], radius; @@ -921,7 +921,7 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm, end_latt_deform(lattice_deform_data); } -int object_deform_mball(Object *ob, ListBase *dispbase) +bool object_deform_mball(Object *ob, ListBase *dispbase) { if (ob->parent && ob->parent->type == OB_LATTICE && ob->partype == PARSKEL) { DispList *dl; diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index e91b1c5424a..1cae95e99b3 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1113,7 +1113,7 @@ void end_render_materials(Main *bmain) end_render_material(ma); } -static int material_in_nodetree(bNodeTree *ntree, Material *mat) +static bool material_in_nodetree(bNodeTree *ntree, Material *mat) { bNode *node; diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index b2b20f82757..56796756ab5 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1189,7 +1189,7 @@ void BKE_nlastrip_recalculate_bounds(NlaStrip *strip) /* Is the given NLA-strip the first one to occur for the given AnimData block */ // TODO: make this an api method if necesary, but need to add prefix first -static short nlastrip_is_first(AnimData *adt, NlaStrip *strip) +static bool nlastrip_is_first(AnimData *adt, NlaStrip *strip) { NlaTrack *nlt; NlaStrip *ns; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 1c4984986df..9ed76c505c0 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2292,7 +2292,7 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[4 } } -static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4]) +static bool where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4]) { float *fp1, *fp2; float fac1, fac2; diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index 3596ad981f6..0176d2055cd 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -494,7 +494,7 @@ typedef struct { int cd_vert_mask_offset; } EdgeQueueContext; -static int edge_queue_tri_in_sphere(const EdgeQueue *q, BMFace *f) +static bool edge_queue_tri_in_sphere(const EdgeQueue *q, BMFace *f) { BMVert *v_tri[3]; float c[3]; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 58d4a2acf33..675c7dcea95 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1185,7 +1185,7 @@ int BKE_sequencer_evaluate_frame(Scene *scene, int cfra) return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra); } -static int video_seq_is_rendered(Sequence *seq) +static bool video_seq_is_rendered(Sequence *seq) { return (seq && !(seq->flag & SEQ_MUTE) && seq->type != SEQ_TYPE_SOUND_RAM); } @@ -2815,9 +2815,9 @@ static ImBuf *seq_render_strip(const SeqRenderData *context, Sequence *seq, floa /*********************** strip stack rendering functions *************************/ -static int seq_must_swap_input_in_blend_mode(Sequence *seq) +static bool seq_must_swap_input_in_blend_mode(Sequence *seq) { - int swap_input = FALSE; + bool swap_input = FALSE; /* bad hack, to fix crazy input ordering of * those two effects */ diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 7fea20a14e2..829354ce662 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1540,7 +1540,7 @@ void txt_insert_buf(Text *text, const char *in_buffer) /* Undo functions */ /******************/ -static int max_undo_test(Text *text, int x) +static bool max_undo_test(Text *text, int x) { while (text->undo_pos + x >= text->undo_len) { if (text->undo_len * 2 > TXT_MAX_UNDO) { diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index ed32750e402..00c51f5b52d 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -498,7 +498,7 @@ static const char *unit_find_str(const char *str, const char *substr) */ /* not too strict, (- = * /) are most common */ -static int ch_is_op(char op) +static bool ch_is_op(char op) { switch (op) { case '+': diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ad1fd3a302c..883e03b6a3d 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -8691,7 +8691,7 @@ void BLO_expand_main(void *fdhandle, Main *mainvar) /* ***************************** */ -static int object_in_any_scene(Main *mainvar, Object *ob) +static bool object_in_any_scene(Main *mainvar, Object *ob) { Scene *sce; diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 182826b58bf..2afb9c9cdee 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -355,8 +355,8 @@ static void mdisp_axis_from_quad(float v1[3], float v2[3], float UNUSED(v3[3]), /* tl is loop to project onto, l is loop whose internal displacement, co, is being * projected. x and y are location in loop's mdisps grid of point co. */ -static int mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float p[3], float *x, float *y, - int res, float axis_x[3], float axis_y[3]) +static bool mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float p[3], float *x, float *y, + int res, float axis_x[3], float axis_y[3]) { float v1[3], v2[3], c[3], v3[3], v4[3], e1[3], e2[3]; float eps = FLT_EPSILON * 4000; diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c index 1737e27c84a..0a86a84d55b 100644 --- a/source/blender/bmesh/operators/bmo_hull.c +++ b/source/blender/bmesh/operators/bmo_hull.c @@ -535,7 +535,7 @@ static void hull_from_bullet(BMesh *bm, BMOperator *op, } /* Check that there are at least three vertices in the input */ -static int hull_num_input_verts_is_ok(BMOperator *op) +static bool hull_num_input_verts_is_ok(BMOperator *op) { BMOIter oiter; BMVert *v; diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c index c36c7467b89..e6321341950 100644 --- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c +++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c @@ -67,7 +67,7 @@ struct BLaplacianSystem { typedef struct BLaplacianSystem LaplacianSystem; static float cotan_weight(float *v1, float *v2, float *v3); -static int vert_is_boundary(BMVert *v); +static bool vert_is_boundary(BMVert *v); static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, int a_numVerts); static void init_laplacian_matrix(LaplacianSystem *sys); static void delete_laplacian_system(LaplacianSystem *sys); @@ -392,7 +392,7 @@ static float cotan_weight(float *v1, float *v2, float *v3) return dot_v3v3(a, b) / clen; } -static int vert_is_boundary(BMVert *v) +static bool vert_is_boundary(BMVert *v) { BMEdge *ed; BMFace *f; diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 6b8c01965f7..7630754db1a 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -659,7 +659,7 @@ typedef enum eReorderIslandFlag { /* Rearrange Methods --------------------------------------------- */ -static short rearrange_island_ok(tReorderChannelIsland *island) +static bool rearrange_island_ok(tReorderChannelIsland *island) { /* island must not be untouchable */ if (island->flag & REORDER_ISLAND_UNTOUCHABLE) @@ -671,7 +671,7 @@ static short rearrange_island_ok(tReorderChannelIsland *island) /* ............................. */ -static short rearrange_island_top(ListBase *list, tReorderChannelIsland *island) +static bool rearrange_island_top(ListBase *list, tReorderChannelIsland *island) { if (rearrange_island_ok(island)) { /* remove from current position */ @@ -686,7 +686,7 @@ static short rearrange_island_top(ListBase *list, tReorderChannelIsland *island) return 0; } -static short rearrange_island_up(ListBase *list, tReorderChannelIsland *island) +static bool rearrange_island_up(ListBase *list, tReorderChannelIsland *island) { if (rearrange_island_ok(island)) { /* moving up = moving before the previous island, otherwise we're in the same place */ @@ -706,7 +706,7 @@ static short rearrange_island_up(ListBase *list, tReorderChannelIsland *island) return 0; } -static short rearrange_island_down(ListBase *list, tReorderChannelIsland *island) +static bool rearrange_island_down(ListBase *list, tReorderChannelIsland *island) { if (rearrange_island_ok(island)) { /* moving down = moving after the next island, otherwise we're in the same place */ @@ -730,7 +730,7 @@ static short rearrange_island_down(ListBase *list, tReorderChannelIsland *island return 0; } -static short rearrange_island_bottom(ListBase *list, tReorderChannelIsland *island) +static bool rearrange_island_bottom(ListBase *list, tReorderChannelIsland *island) { if (rearrange_island_ok(island)) { tReorderChannelIsland *last = list->last; @@ -762,7 +762,7 @@ static short rearrange_island_bottom(ListBase *list, tReorderChannelIsland *isla * < island: island to be moved * > return[0]: whether operation was a success */ -typedef short (*AnimChanRearrangeFp)(ListBase *list, tReorderChannelIsland *island); +typedef bool (*AnimChanRearrangeFp)(ListBase *list, tReorderChannelIsland *island); /* get rearranging function, given 'rearrange' mode */ static AnimChanRearrangeFp rearrange_get_mode_func(short mode) diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 8d9e4737481..3c32f2a9eea 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -988,7 +988,7 @@ static void calc_shapeKeys(Object *obedit) /* ********************* Amimation data *************** */ -static int curve_is_animated(Curve *cu) +static bool curve_is_animated(Curve *cu) { AnimData *ad = BKE_animdata_from_id(&cu->id); diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 2f7ffd92f90..aea004438f4 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -437,7 +437,7 @@ typedef struct SlidePointData { short initial_feather, overall_feather; } SlidePointData; -static int slide_point_check_initial_feather(MaskSpline *spline) +static bool slide_point_check_initial_feather(MaskSpline *spline) { int i; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 4b2eb694cc7..5288589b6f4 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -415,7 +415,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data) /*************************** selection utilities *******************************/ -static int key_test_depth(PEData *data, const float co[3], const int screen_co[2]) +static bool key_test_depth(PEData *data, const float co[3], const int screen_co[2]) { View3D *v3d= data->vc.v3d; ViewDepths *vd = data->vc.rv3d->depths; @@ -453,7 +453,7 @@ static int key_test_depth(PEData *data, const float co[3], const int screen_co[2 return 1; } -static int key_inside_circle(PEData *data, float rad, const float co[3], float *distance) +static bool key_inside_circle(PEData *data, float rad, const float co[3], float *distance) { float dx, dy, dist; int screen_co[2]; @@ -480,7 +480,7 @@ static int key_inside_circle(PEData *data, float rad, const float co[3], float * return 0; } -static int key_inside_rect(PEData *data, const float co[3]) +static bool key_inside_rect(PEData *data, const float co[3]) { int screen_co[2]; @@ -497,7 +497,7 @@ static int key_inside_rect(PEData *data, const float co[3]) return 0; } -static int key_inside_test(PEData *data, const float co[3]) +static bool key_inside_test(PEData *data, const float co[3]) { if (data->mval) return key_inside_circle(data, data->rad, co, NULL); @@ -505,7 +505,7 @@ static int key_inside_test(PEData *data, const float co[3]) return key_inside_rect(data, co); } -static int point_is_selected(PTCacheEditPoint *point) +static bool point_is_selected(PTCacheEditPoint *point) { KEY_K; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index b2c780cfdbf..cab4ed6e8b5 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -133,7 +133,7 @@ static float get_fluid_size_m(Scene *scene, Object *domainob, FluidsimSettings * } } -static int fluid_is_animated_mesh(FluidsimSettings *fss) +static bool fluid_is_animated_mesh(FluidsimSettings *fss) { return ((fss->type == OB_FLUIDSIM_CONTROL) || fss->domainNovecgen); } @@ -496,7 +496,7 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length) float *verts=NULL; int *tris=NULL; int numVerts=0, numTris=0; - int deform = fluid_is_animated_mesh(fluidmd->fss); + bool deform = fluid_is_animated_mesh(fluidmd->fss); elbeemMesh fsmesh; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 3bec60008e6..b5607b42956 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -913,7 +913,7 @@ static void region_overlap_fix(ScrArea *sa, ARegion *ar) } /* overlapping regions only in the following restricted cases */ -static int region_is_overlap(wmWindow *win, ScrArea *sa, ARegion *ar) +static bool region_is_overlap(wmWindow *win, ScrArea *sa, ARegion *ar) { if (U.uiflag2 & USER_REGION_OVERLAP) { if (WM_is_draw_triple(win)) { diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 53a1f4fc8ca..fcedf78c874 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2217,7 +2217,7 @@ static void SCREEN_OT_marker_jump(wmOperatorType *ot) /* ************** switch screen operator ***************************** */ -static int screen_set_is_ok(bScreen *screen, bScreen *screen_prev) +static bool screen_set_is_ok(bScreen *screen, bScreen *screen_prev) { return ((screen->winid == 0) && (screen->full == 0) && diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 74792d19607..5ef0e500681 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -587,7 +587,7 @@ BLI_INLINE bool sculpt_brush_test_clipping(SculptBrushTest *test, const float co return (rv3d && (ED_view3d_clipping_test(rv3d, co, true))); } -static int sculpt_brush_test(SculptBrushTest *test, const float co[3]) +static bool sculpt_brush_test(SculptBrushTest *test, const float co[3]) { float distsq = len_squared_v3v3(co, test->location); @@ -603,7 +603,7 @@ static int sculpt_brush_test(SculptBrushTest *test, const float co[3]) } } -static int sculpt_brush_test_sq(SculptBrushTest *test, const float co[3]) +static bool sculpt_brush_test_sq(SculptBrushTest *test, const float co[3]) { float distsq = len_squared_v3v3(co, test->location); @@ -619,7 +619,7 @@ static int sculpt_brush_test_sq(SculptBrushTest *test, const float co[3]) } } -static int sculpt_brush_test_fast(SculptBrushTest *test, float co[3]) +static bool sculpt_brush_test_fast(SculptBrushTest *test, float co[3]) { if (sculpt_brush_test_clipping(test, co)) { return 0; @@ -627,7 +627,7 @@ static int sculpt_brush_test_fast(SculptBrushTest *test, float co[3]) return len_squared_v3v3(co, test->location) <= test->radius_squared; } -static int sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float local[4][4]) +static bool sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float local[4][4]) { float side = M_SQRT1_2; float local_co[3]; @@ -680,7 +680,7 @@ static float frontface(Brush *br, const float sculpt_normal[3], #if 0 -static int sculpt_brush_test_cyl(SculptBrushTest *test, float co[3], float location[3], float an[3]) +static bool sculpt_brush_test_cyl(SculptBrushTest *test, float co[3], float location[3], float an[3]) { if (sculpt_brush_test_fast(test, co)) { float t1[3], t2[3], t3[3], dist; diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 1ff8bac67d2..68bdcd7dffe 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1101,7 +1101,7 @@ typedef struct TrackMarkersJob { struct bScreen *screen; } TrackMarkersJob; -static int track_markers_testbreak(void) +static bool track_markers_testbreak(void) { return G.is_break; } diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 249ab3ef2c1..6ea5638b8f0 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -745,19 +745,17 @@ void filelist_setfilter_types(struct FileList *filelist, const char *filter_glob } /* would recognize .blend as well */ -static int file_is_blend_backup(const char *str) +static bool file_is_blend_backup(const char *str) { - short a, b; - int retval = 0; - - a = strlen(str); - b = 7; - + const size_t a = strlen(str); + size_t b = 7; + bool retval = 0; + if (a == 0 || b >= a) { /* pass */ } else { - char *loc; + const char *loc; if (a > b + 1) b++; diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index 4babda08898..1fd47219463 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -328,7 +328,7 @@ static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats) } } -static int stats_is_object_dynamic_topology_sculpt(Object *ob) +static bool stats_is_object_dynamic_topology_sculpt(Object *ob) { return (ob && (ob->mode & OB_MODE_SCULPT) && ob->sculpt && ob->sculpt->bm); diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 53b373e728e..035287c0411 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -100,7 +100,7 @@ static int node_tree_interface_poll(const bContext *C, PanelType *UNUSED(pt)) return (snode && snode->edittree && (snode->edittree->inputs.first || snode->edittree->outputs.first)); } -static int node_tree_find_active_socket(bNodeTree *ntree, bNodeSocket **r_sock, int *r_in_out) +static bool node_tree_find_active_socket(bNodeTree *ntree, bNodeSocket **r_sock, int *r_in_out) { bNodeSocket *sock; for (sock = ntree->inputs.first; sock; sock = sock->next) { diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index 4f9af022639..31a9ec70660 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -78,7 +78,7 @@ static int sort_nodes_locx(void *a, void *b) return 0; } -static int socket_is_available(bNodeTree *UNUSED(ntree), bNodeSocket *sock, const bool allow_used) +static bool socket_is_available(bNodeTree *UNUSED(ntree), bNodeSocket *sock, const bool allow_used) { if (nodeSocketIsHidden(sock)) return 0; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index c360987bd1f..c032ecf6f8d 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -419,12 +419,12 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[ } -static int seq_is_parent(Sequence *par, Sequence *seq) +static bool seq_is_parent(Sequence *par, Sequence *seq) { return ((par->seq1 == seq) || (par->seq2 == seq) || (par->seq3 == seq)); } -static int seq_is_predecessor(Sequence *pred, Sequence *seq) +static bool seq_is_predecessor(Sequence *pred, Sequence *seq) { if (!pred) return 0; if (pred == seq) return 0; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index b1885787db7..2f6756366e3 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -306,7 +306,7 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer) } } -static int fcu_test_selected(FCurve *fcu) +static bool fcu_test_selected(FCurve *fcu) { BezTriple *bezt = fcu->bezt; unsigned int i; diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index f60972abdcb..a3fee693ad7 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -304,7 +304,7 @@ static void stitch_uv_rotate(float mat[2][2], float medianPoint[2], float uv[2], } /* check if two uvelements are stitchable. This should only operate on -different- separate UvElements */ -static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_iter, StitchState *state) +static bool stitch_check_uvs_stitchable(UvElement *element, UvElement *element_iter, StitchState *state) { BMesh *bm = state->em->bm; float limit; @@ -339,7 +339,7 @@ static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_it } } -static int stitch_check_edges_stitchable(UvEdge *edge, UvEdge *edge_iter, StitchState *state) +static bool stitch_check_edges_stitchable(UvEdge *edge, UvEdge *edge_iter, StitchState *state) { BMesh *bm = state->em->bm; float limit; @@ -381,7 +381,7 @@ static int stitch_check_edges_stitchable(UvEdge *edge, UvEdge *edge_iter, Stitch } } -static int stitch_check_uvs_state_stitchable(UvElement *element, UvElement *element_iter, StitchState *state) +static bool stitch_check_uvs_state_stitchable(UvElement *element, UvElement *element_iter, StitchState *state) { if ((state->snap_islands && element->island == element_iter->island) || (!state->midpoints && element->island == element_iter->island)) @@ -393,7 +393,7 @@ static int stitch_check_uvs_state_stitchable(UvElement *element, UvElement *elem } -static int stitch_check_edges_state_stitchable(UvEdge *edge, UvEdge *edge_iter, StitchState *state) +static bool stitch_check_edges_state_stitchable(UvEdge *edge, UvEdge *edge_iter, StitchState *state) { if ((state->snap_islands && edge->element->island == edge_iter->element->island) || (!state->midpoints && edge->element->island == edge_iter->element->island)) diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 4cd879e5952..b592c1152b1 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -66,7 +66,7 @@ extern "C" { #define DEFAULT_DKR_EPSILON 0.0f // Freestyle configuration -static short freestyle_is_initialized = 0; +static bool freestyle_is_initialized = false; static Config::Path *pathconfig = NULL; static Controller *controller = NULL; static AppView *view = NULL; diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 9fa69194ded..6acd5154561 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -1130,7 +1130,7 @@ static int exr_has_alpha(InputFile *file) return !(file->header().channels().findChannel("A") == NULL); } -static int exr_is_multilayer(InputFile *file) +static bool exr_is_multilayer(InputFile *file) { const StringAttribute *comments = file->header().findTypedAttribute("BlenderMultiChannel"); const ChannelList &channels = file->header().channels(); @@ -1174,7 +1174,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags, char try { Mem_IStream *membuf = new Mem_IStream(mem, size); - int is_multi; + bool is_multi; file = new InputFile(*membuf); Box2i dw = file->header().dataWindow(); diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp index 2f668ba62d0..6182d066f68 100644 --- a/source/blender/render/intern/raytrace/rayobject_octree.cpp +++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp @@ -223,7 +223,7 @@ static Node *addnode(Octree *oc) return oc->adrnode[index] + (oc->nodecount & 4095); } -static int face_in_node(RayFace *face, short x, short y, short z, float rtf[4][3]) +static bool face_in_node(RayFace *face, short x, short y, short z, float rtf[4][3]) { static float nor[3], d; float fx, fy, fz; diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index f390ef13667..b7b606552e3 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -119,10 +119,10 @@ static void wm_area_mark_invalid_backbuf(ScrArea *sa) ((View3D *)sa->spacedata.first)->flag |= V3D_INVALID_BACKBUF; } -static int wm_area_test_invalid_backbuf(ScrArea *sa) +static bool wm_area_test_invalid_backbuf(ScrArea *sa) { if (sa->spacetype == SPACE_VIEW3D) - return (((View3D *)sa->spacedata.first)->flag & V3D_INVALID_BACKBUF); + return (((View3D *)sa->spacedata.first)->flag & V3D_INVALID_BACKBUF) != 0; else return 1; } @@ -706,7 +706,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win) /****************** main update call **********************/ /* quick test to prevent changing window drawable */ -static int wm_draw_update_test_window(wmWindow *win) +static bool wm_draw_update_test_window(wmWindow *win) { ScrArea *sa; ARegion *ar; diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 3fc4fe8e9ef..b220954b5b9 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -146,7 +146,7 @@ void wm_event_init_from_window(wmWindow *win, wmEvent *event) /* ********************* notifiers, listeners *************** */ -static int wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, void *reference) +static bool wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, void *reference) { wmNotifier *note; diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index c925a20c9d5..c13d1dca0c4 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -1167,7 +1167,7 @@ void WM_keyconfig_update_operatortype(void) wm_keymap_update_flag |= WM_KEYMAP_UPDATE_OPERATORTYPE; } -static int wm_keymap_test_and_clear_update(wmKeyMap *km) +static bool wm_keymap_test_and_clear_update(wmKeyMap *km) { wmKeyMapItem *kmi; int update; @@ -1180,7 +1180,7 @@ static int wm_keymap_test_and_clear_update(wmKeyMap *km) kmi->flag &= ~KMI_UPDATE; } - return update; + return (update != 0); } static wmKeyMap *wm_keymap_preset(wmWindowManager *wm, wmKeyMap *km) -- cgit v1.2.3