diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-05 15:36:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-05 15:36:15 +0400 |
commit | 37026b12ec1047dd5f4637ad281f108a7963af83 (patch) | |
tree | b45d0b945f84dff6181fe26a464ddbfe0d127f6a /source/blender/editors | |
parent | 36fc4e15f69f4150812408b32a9052017590eb8b (diff) |
Code cleanup: use bool for static methods
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 12 | ||||
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 10 | ||||
-rw-r--r-- | source/blender/editors/physics/physics_fluid.c | 4 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_stats.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_buttons.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_relationships.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 4 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 2 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_smart_stitch.c | 8 |
16 files changed, 39 insertions, 41 deletions
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)) |