Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-07-21 12:16:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-07-21 12:16:37 +0400
commit7db1d6556d2aefcf4e5e787477b7cd22104e15ac (patch)
treeb1cf518de6a88886e9566aae62dec168d2a96f20 /source/blender/python
parent3ec1daaa77f20e1aeaae30b5beab675659e873f2 (diff)
code cleanup: add break statements in switch ()'s, (even at the last case).
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops_call.c1
-rw-r--r--source/blender/python/intern/bpy_rna.c46
-rw-r--r--source/blender/python/intern/bpy_rna_array.c3
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c3
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c5
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c3
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c12
8 files changed, 48 insertions, 29 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c
index 7ac4dd5d0b7..6c7fc686cc0 100644
--- a/source/blender/python/bmesh/bmesh_py_ops_call.c
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.c
@@ -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 */
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 76e64ebba6e..008a7e7f944 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -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 */
-
- if BPY_REPLACEMENT_STRING("bl_idname", bpy_intern_str___name__)
- else if BPY_REPLACEMENT_STRING("bl_description", bpy_intern_str___doc__)
+ 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 (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
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index b8907e797ef..bb40a21eed9 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -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;
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index ae5b381cf59..9c3edec108a 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -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;
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index 517fd9045e5..6bb3031f0a3 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -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;
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index 26793139227..d471cd05a2b 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -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;
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index a3f6b3f7c79..b0b818faaa0 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -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;
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index ab83a11e797..8509c46b395 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -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)); }