diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-10-08 16:35:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-10-08 16:35:58 +0400 |
commit | 98a4ae8562cb7a74b97a3e37b7d29be05e485500 (patch) | |
tree | 3880ba7c06e78654d6d387a6b0aebd4c1a00b678 /source | |
parent | b0bb5cc6b2215fdad34b1ff8a1ce7c34a5a2bdc3 (diff) |
use booleans in BKE_nurb_handles_autocalc and BMO_op_vinitf
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 10 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operators.c | 31 |
2 files changed, 21 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 2d1245a6213..e255732d3fb 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -3176,7 +3176,7 @@ void BKE_nurb_handles_autocalc(Nurb *nu, int flag) const float eps_sq = eps * eps; BezTriple *bezt2, *bezt1, *bezt0; - int i, align, leftsmall, rightsmall; + int i; if (nu == NULL || nu->bezt == NULL) return; @@ -3187,7 +3187,7 @@ void BKE_nurb_handles_autocalc(Nurb *nu, int flag) i = nu->pntsu; while (i--) { - align = leftsmall = rightsmall = 0; + bool align = false, leftsmall = false, rightsmall = false; /* left handle: */ if (flag == 0 || (bezt1->f1 & flag) ) { @@ -3195,12 +3195,12 @@ void BKE_nurb_handles_autocalc(Nurb *nu, int flag) /* distance too short: vectorhandle */ if (len_squared_v3v3(bezt1->vec[1], bezt0->vec[1]) < eps_sq) { bezt1->h1 = HD_VECT; - leftsmall = 1; + leftsmall = true; } else { /* aligned handle? */ if (dist_to_line_v2(bezt1->vec[1], bezt1->vec[0], bezt1->vec[2]) < eps) { - align = 1; + align = true; bezt1->h1 = HD_ALIGN; } /* or vector handle? */ @@ -3214,7 +3214,7 @@ void BKE_nurb_handles_autocalc(Nurb *nu, int flag) /* distance too short: vectorhandle */ if (len_squared_v3v3(bezt1->vec[1], bezt2->vec[1]) < eps_sq) { bezt1->h2 = HD_VECT; - rightsmall = 1; + rightsmall = true; } else { /* aligned handle? */ diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 284ff3e759c..611ee4d03b8 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -1639,9 +1639,9 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, // BMOpDefine *def; char *opname, *ofmt, *fmt; char slot_name[64] = {0}; - int i /*, n = strlen(fmt) */, stop /*, slot_code = -1 */, type, state; + int i, type; + bool noslot, state; char htype; - int noslot = 0; /* basic useful info to help find where bmop formatting strings fail */ @@ -1662,7 +1662,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, i = strcspn(fmt, " "); opname = fmt; - if (!opname[i]) noslot = 1; + noslot = (opname[i] == '\0'); opname[i] = '\0'; fmt += i + (noslot ? 0 : 1); @@ -1679,7 +1679,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, // def = bmo_opdefines[i]; i = 0; - state = 1; /* 0: not inside slot_code name, 1: inside slot_code name */ + state = true; /* false: not inside slot_code name, true: inside slot_code name */ while (*fmt) { if (state) { @@ -1705,7 +1705,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, BLI_strncpy(slot_name, fmt, sizeof(slot_name)); - state = 0; + state = false; fmt += i; } else { @@ -1726,13 +1726,13 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, else GOTO_ERROR("matrix size was not 3 or 4"); BMO_slot_mat_set(op, op->slots_in, slot_name, va_arg(vlist, void *), size); - state = 1; + state = true; break; } case 'v': { BMO_slot_vec_set(op->slots_in, slot_name, va_arg(vlist, float *)); - state = 1; + state = true; break; } case 'e': /* single vert/edge/face */ @@ -1742,7 +1742,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, BMO_slot_buffer_from_single(op, slot, ele); - state = 1; + state = true; break; } case 's': @@ -1761,20 +1761,20 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, BMO_slot_copy(op_other, slots_out, slot_name_other, op, slots_in, slot_name); } - state = 1; + state = true; break; } case 'i': BMO_slot_int_set(op->slots_in, slot_name, va_arg(vlist, int)); - state = 1; + state = true; break; case 'b': BMO_slot_bool_set(op->slots_in, slot_name, va_arg(vlist, int)); - state = 1; + state = true; break; case 'p': BMO_slot_ptr_set(op->slots_in, slot_name, va_arg(vlist, void *)); - state = 1; + state = true; break; case 'f': case 'F': @@ -1787,15 +1787,16 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, BMO_slot_float_set(op->slots_in, slot_name, va_arg(vlist, double)); } else { + bool stop = false; + htype = 0; - stop = 0; while (1) { switch (NEXT_CHAR(fmt)) { case 'f': htype |= BM_FACE; break; case 'e': htype |= BM_EDGE; break; case 'v': htype |= BM_VERT; break; default: - stop = 1; + stop = true; break; } if (stop) { @@ -1822,7 +1823,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, } } - state = 1; + state = true; break; default: fprintf(stderr, |