diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-04-12 04:26:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-04-12 04:26:06 +0300 |
commit | 4a64b36029872034c9c138738010ced47b48e045 (patch) | |
tree | 4880dd52734a808c94cb74f69cc7a58a2855c584 /source | |
parent | a2db16ba58a16be246f7f018ee78918d9c8a8aff (diff) |
Cleanup: use bool
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 16 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/jp2.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_pose.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 4 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_props.c | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 12 | ||||
-rw-r--r-- | source/blender/render/intern/source/bake.c | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/rayshade.c | 4 |
9 files changed, 25 insertions, 25 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 77fc7a83256..9df611b3216 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1390,7 +1390,9 @@ void CURVE_OT_split(wmOperatorType *ot) /* ******************* FLAGS ********************* */ -static short isNurbselUV(Nurb *nu, int *u, int *v, int flag) +static bool isNurbselUV( + const Nurb *nu, int flag, + int *r_u, int *r_v) { /* return (u != -1): 1 row in u-direction selected. U has value between 0-pntsv * return (v != -1): 1 column in v-direction selected. V has value between 0-pntsu @@ -1398,7 +1400,7 @@ static short isNurbselUV(Nurb *nu, int *u, int *v, int flag) BPoint *bp; int a, b, sel; - *u = *v = -1; + *r_u = *r_v = -1; bp = nu->bp; for (b = 0; b < nu->pntsv; b++) { @@ -1407,7 +1409,7 @@ static short isNurbselUV(Nurb *nu, int *u, int *v, int flag) if (bp->f1 & flag) sel++; } if (sel == nu->pntsu) { - if (*u == -1) *u = b; + if (*r_u == -1) *r_u = b; else return 0; } else if (sel > 1) { @@ -1422,7 +1424,7 @@ static short isNurbselUV(Nurb *nu, int *u, int *v, int flag) if (bp->f1 & flag) sel++; } if (sel == nu->pntsv) { - if (*v == -1) *v = a; + if (*r_v == -1) *r_v = a; else return 0; } else if (sel > 1) { @@ -1430,8 +1432,8 @@ static short isNurbselUV(Nurb *nu, int *u, int *v, int flag) } } - if (*u == -1 && *v > -1) return 1; - if (*v == -1 && *u > -1) return 1; + if (*r_u == -1 && *r_v > -1) return 1; + if (*r_v == -1 && *r_u > -1) return 1; return 0; } @@ -1851,7 +1853,7 @@ bool ed_editnurb_extrude_flag(EditNurb *editnurb, const short flag) else { /* which row or column is selected */ - if (isNurbselUV(nu, &u, &v, flag)) { + if (isNurbselUV(nu, flag, &u, &v)) { /* deselect all */ bp = nu->bp; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index bf751bfe74a..4d3712c6e3e 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2979,7 +2979,7 @@ typedef struct DMGradient_userData { const float *sco_end; /* [2] */ float sco_line_div; /* store (1.0f / len_v2v2(sco_start, sco_end)) */ int def_nr; - short is_init; + bool is_init; DMGradient_vertStore *vert_cache; /* only for init */ BLI_bitmap *vert_visit; diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 570ca5ba06e..390f2502ee7 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -63,12 +63,12 @@ enum { DCP_CINEMA4K = 4, }; -static int check_jp2(const unsigned char *mem) /* J2K_CFMT */ +static bool check_jp2(const unsigned char *mem) /* J2K_CFMT */ { return memcmp(JP2_HEAD, mem, sizeof(JP2_HEAD)) ? 0 : 1; } -static int check_j2k(const unsigned char *mem) /* J2K_CFMT */ +static bool check_j2k(const unsigned char *mem) /* J2K_CFMT */ { return memcmp(J2K_HEAD, mem, sizeof(J2K_HEAD)) ? 0 : 1; } @@ -133,7 +133,7 @@ struct ImBuf *imb_jp2_decode(const unsigned char *mem, size_t size, int flags, c unsigned int i, i_next, w, h, planes; unsigned int y; int *r, *g, *b, *a; /* matching 'opj_image_comp.data' type */ - int is_jp2, is_j2k; + bool is_jp2, is_j2k; opj_dparameters_t parameters; /* decompression parameters */ diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index d8f1f944933..5bbc2b49a0d 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -532,7 +532,7 @@ static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int typ static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, PointerRNA *con_ptr) { bConstraint *con = con_ptr->data; - const short is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK); + const bool is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK); Object *ob = (Object *)id; if (BLI_findindex(&pchan->constraints, con) == -1) { diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 94223f7f7da..af63f675398 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -860,7 +860,7 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value) { ImageFormatData *imf = (ImageFormatData *)ptr->data; ID *id = ptr->id.data; - const char is_render = (id && GS(id->name) == ID_SCE); + const bool is_render = (id && GS(id->name) == ID_SCE); /* see note below on why this is */ const char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) | (is_render ? IMA_CHAN_FLAG_BW : 0); @@ -927,7 +927,7 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf( { ImageFormatData *imf = (ImageFormatData *)ptr->data; ID *id = ptr->id.data; - const char is_render = (id && GS(id->name) == ID_SCE); + const bool is_render = (id && GS(id->name) == ID_SCE); /* note, we need to act differently for render * where 'BW' will force grayscale even if the output format writes diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index ce9b3e754ac..bce1d923462 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -1314,7 +1314,7 @@ static int icon_id_from_name(const char *name) return 0; } -static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, int *defvalue, const short is_enum_flag) +static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, int *defvalue, const bool is_enum_flag) { EnumPropertyItem *items; PyObject *item; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 75490a18ab0..33ac58dadb1 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -7363,12 +7363,8 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param PointerRNA funcptr; int err = 0, i, ret_len = 0, arg_count; int flag = RNA_function_flag(func); - const char is_staticmethod = (flag & FUNC_NO_SELF) && !(flag & FUNC_USE_SELF_TYPE); - const char is_classmethod = (flag & FUNC_NO_SELF) && (flag & FUNC_USE_SELF_TYPE); - - /* annoying!, need to check if the screen gets set to NULL which is a - * hint that the file was actually re-loaded. */ - char is_valid_wm; + const bool is_staticmethod = (flag & FUNC_NO_SELF) && !(flag & FUNC_USE_SELF_TYPE); + const bool is_classmethod = (flag & FUNC_NO_SELF) && (flag & FUNC_USE_SELF_TYPE); PropertyRNA *pret_single = NULL; void *retdata_single = NULL; @@ -7395,7 +7391,9 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param if (C == NULL) C = BPy_GetContext(); - is_valid_wm = (CTX_wm_manager(C) != NULL); + /* annoying!, need to check if the screen gets set to NULL which is a + * hint that the file was actually re-loaded. */ + const bool is_valid_wm = (CTX_wm_manager(C) != NULL); bpy_context_set(C, &gilstate); diff --git a/source/blender/render/intern/source/bake.c b/source/blender/render/intern/source/bake.c index b2f8c79c197..31e461b4536 100644 --- a/source/blender/render/intern/source/bake.c +++ b/source/blender/render/intern/source/bake.c @@ -926,7 +926,7 @@ static void *do_bake_thread(void *bs_v) void RE_bake_ibuf_filter(ImBuf *ibuf, char *mask, const int filter) { /* must check before filtering */ - const short is_new_alpha = (ibuf->planes != R_IMF_PLANES_RGBA) && BKE_imbuf_alpha_test(ibuf); + const bool is_new_alpha = (ibuf->planes != R_IMF_PLANES_RGBA) && BKE_imbuf_alpha_test(ibuf); /* Margin */ if (filter) { diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 0f77cd9768d..9aac5ed1f1d 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -184,7 +184,7 @@ void freeraytree(Render *re) #endif } -static int is_raytraceable_vlr(Render *re, VlakRen *vlr) +static bool is_raytraceable_vlr(Render *re, VlakRen *vlr) { /* note: volumetric must be tracable, wire must not */ if ((re->flag & R_BAKE_TRACE) || (vlr->flag & R_TRACEBLE) || (vlr->mat->material_type == MA_TYPE_VOLUME)) @@ -193,7 +193,7 @@ static int is_raytraceable_vlr(Render *re, VlakRen *vlr) return 0; } -static int is_raytraceable(Render *re, ObjectInstanceRen *obi) +static bool is_raytraceable(Render *re, ObjectInstanceRen *obi) { int v; ObjectRen *obr = obi->obr; |