code cleanup: add break statements in switch ()'s, (even at the last case).
This commit is contained in:
@@ -507,6 +507,7 @@ static int bpy_slot_from_py(BMesh *bm, BMOperator *bmop, BMOpSlot *slot, PyObjec
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/* fall-through */
|
||||
}
|
||||
default:
|
||||
/* TODO --- many others */
|
||||
|
@@ -704,6 +704,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
|
||||
ret = col_cb; /* return the color instead */
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -776,7 +777,8 @@ static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
|
||||
|
||||
switch (op) {
|
||||
case Py_NE:
|
||||
ok = !ok; /* pass through */
|
||||
ok = !ok;
|
||||
/* fall-through */
|
||||
case Py_EQ:
|
||||
res = ok ? Py_False : Py_True;
|
||||
break;
|
||||
@@ -805,7 +807,8 @@ static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
|
||||
|
||||
switch (op) {
|
||||
case Py_NE:
|
||||
ok = !ok; /* pass through */
|
||||
ok = !ok;
|
||||
/* fall-through */
|
||||
case Py_EQ:
|
||||
res = ok ? Py_False : Py_True;
|
||||
break;
|
||||
@@ -2380,6 +2383,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
|
||||
PyErr_SetString(PyExc_TypeError, "not an array type");
|
||||
Py_DECREF(tuple);
|
||||
tuple = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return tuple;
|
||||
@@ -2719,6 +2723,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
|
||||
default:
|
||||
PyErr_SetString(PyExc_TypeError, "not an array type");
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
Py_DECREF(value);
|
||||
@@ -3588,6 +3593,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
|
||||
"bpy_struct: Context type invalid %d, can't get \"%.200s\" from context",
|
||||
newtype, name);
|
||||
ret = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (done == -1) { /* found but not set */
|
||||
@@ -4863,13 +4869,13 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
|
||||
ret = Matrix_CreatePyObject(data, 3, 3, Py_NEW, NULL);
|
||||
break;
|
||||
}
|
||||
/* pass through */
|
||||
/* fall-through */
|
||||
#endif
|
||||
default:
|
||||
ret = PyTuple_New(len);
|
||||
for (a = 0; a < len; a++)
|
||||
PyTuple_SET_ITEM(ret, a, PyFloat_FromDouble(((float *)data)[a]));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -7001,21 +7007,23 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
|
||||
/* Sneaky workaround to use the class name as the bl_idname */
|
||||
|
||||
#define BPY_REPLACEMENT_STRING(rna_attr, py_attr) \
|
||||
(STREQ(identifier, rna_attr)) { \
|
||||
item = PyObject_GetAttr(py_class, py_attr); \
|
||||
if (item && item != Py_None) { \
|
||||
if (pyrna_py_to_prop(dummyptr, prop, NULL, \
|
||||
item, "validating class:") != 0) \
|
||||
{ \
|
||||
Py_DECREF(item); \
|
||||
return -1; \
|
||||
} \
|
||||
} \
|
||||
Py_XDECREF(item); \
|
||||
} /* intentionally allow else here */
|
||||
else if (STREQ(identifier, rna_attr)) { \
|
||||
if ((item = PyObject_GetAttr(py_class, py_attr))) { \
|
||||
if (item != Py_None) { \
|
||||
if (pyrna_py_to_prop(dummyptr, prop, NULL, \
|
||||
item, "validating class:") != 0) \
|
||||
{ \
|
||||
Py_DECREF(item); \
|
||||
return -1; \
|
||||
} \
|
||||
} \
|
||||
Py_DECREF(item); \
|
||||
} \
|
||||
} /* intentionally allow else here */
|
||||
|
||||
if BPY_REPLACEMENT_STRING("bl_idname", bpy_intern_str___name__)
|
||||
else if BPY_REPLACEMENT_STRING("bl_description", bpy_intern_str___doc__)
|
||||
if (false) {} /* needed for macro */
|
||||
BPY_REPLACEMENT_STRING("bl_idname", bpy_intern_str___name__)
|
||||
BPY_REPLACEMENT_STRING("bl_description", bpy_intern_str___doc__)
|
||||
|
||||
#undef BPY_REPLACEMENT_STRING
|
||||
|
||||
|
@@ -580,6 +580,7 @@ int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data,
|
||||
default:
|
||||
PyErr_SetString(PyExc_TypeError, "not an array type");
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -605,6 +606,7 @@ int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, in
|
||||
default:
|
||||
PyErr_SetString(PyExc_TypeError, "not an array type");
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -627,6 +629,7 @@ PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index)
|
||||
default:
|
||||
PyErr_SetString(PyExc_TypeError, "not an array type");
|
||||
item = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
return item;
|
||||
|
@@ -170,7 +170,8 @@ static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op)
|
||||
|
||||
switch (op) {
|
||||
case Py_NE:
|
||||
ok = !ok; /* pass through */
|
||||
ok = !ok;
|
||||
/* fall-through */
|
||||
case Py_EQ:
|
||||
res = ok ? Py_False : Py_True;
|
||||
break;
|
||||
|
@@ -64,7 +64,7 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
case 2:
|
||||
if ((order = euler_order_from_string(order_str, "mathutils.Euler()")) == -1)
|
||||
return NULL;
|
||||
/* intentionally pass through */
|
||||
/* fall-through */
|
||||
case 1:
|
||||
if (mathutils_array_parse(eul, EULER_SIZE, EULER_SIZE, seq, "mathutils.Euler()") == -1)
|
||||
return NULL;
|
||||
@@ -356,7 +356,8 @@ static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op)
|
||||
|
||||
switch (op) {
|
||||
case Py_NE:
|
||||
ok = !ok; /* pass through */
|
||||
ok = !ok;
|
||||
/* fall-through */
|
||||
case Py_EQ:
|
||||
res = ok ? Py_False : Py_True;
|
||||
break;
|
||||
|
@@ -371,6 +371,7 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1752,7 +1753,8 @@ static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op)
|
||||
|
||||
switch (op) {
|
||||
case Py_NE:
|
||||
ok = !ok; /* pass through */
|
||||
ok = !ok;
|
||||
/* fall-through */
|
||||
case Py_EQ:
|
||||
res = ok ? Py_False : Py_True;
|
||||
break;
|
||||
|
@@ -529,7 +529,8 @@ static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
|
||||
|
||||
switch (op) {
|
||||
case Py_NE:
|
||||
ok = !ok; /* pass through */
|
||||
ok = !ok;
|
||||
/* fall-through */
|
||||
case Py_EQ:
|
||||
res = ok ? Py_False : Py_True;
|
||||
break;
|
||||
|
@@ -720,8 +720,8 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
short use_a = TRUE;
|
||||
short use_b = TRUE;
|
||||
bool use_a = true;
|
||||
bool use_b = true;
|
||||
float lambda;
|
||||
|
||||
PyObject *ret = PyTuple_New(2);
|
||||
@@ -729,15 +729,16 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
|
||||
switch (isect_line_sphere_v3(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) {
|
||||
case 1:
|
||||
if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
|
||||
use_b = FALSE;
|
||||
use_b = false;
|
||||
break;
|
||||
case 2:
|
||||
if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
|
||||
if (!(!clip || (((lambda = line_point_factor_v3(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE;
|
||||
break;
|
||||
default:
|
||||
use_a = FALSE;
|
||||
use_b = FALSE;
|
||||
use_a = false;
|
||||
use_b = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 3, Py_NEW, NULL)); }
|
||||
@@ -811,6 +812,7 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO
|
||||
default:
|
||||
use_a = false;
|
||||
use_b = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 2, Py_NEW, NULL)); }
|
||||
|
Reference in New Issue
Block a user