diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 10:04:52 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 11:26:27 +0300 |
commit | 891949cbb47143420f4324cb60efc05ef5d70b39 (patch) | |
tree | fe70a45612ae96f9ce1f37378ef5ff035d3127f5 /source/blender/freestyle/intern/python | |
parent | c9e35c2ced92082c86f1ecb9ecd16c6230218c7c (diff) |
Cleanup: use 'u' prefixed integer types for brevity & cast style
To use function style cast '(unsigned char)x' can't be replaced by
'unsigned char(x)'.
Diffstat (limited to 'source/blender/freestyle/intern/python')
19 files changed, 37 insertions, 38 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp index 02ed3f463c7..0701b1c4ef3 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.cpp +++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp @@ -236,7 +236,7 @@ PyObject *BPy_FEdge_from_FEdge(FEdge &fe) return py_fe; } -PyObject *BPy_Nature_from_Nature(unsigned short n) +PyObject *BPy_Nature_from_Nature(ushort n) { PyObject *args = PyTuple_New(1); PyTuple_SET_ITEM(args, 0, PyLong_FromLong(n)); diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp index bd37e84761e..7eccf0403ae 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp @@ -282,7 +282,7 @@ static Mathutils_Callback FrsMaterial_mathutils_cb = { FrsMaterial_mathutils_set_index, }; -static unsigned char FrsMaterial_mathutils_cb_index = -1; +static uchar FrsMaterial_mathutils_cb_index = -1; void FrsMaterial_mathutils_register_callback() { @@ -517,7 +517,7 @@ static PyObject *BPy_FrsMaterial_richcmpr(PyObject *objectA, static Py_hash_t FrsMaterial_hash(PyObject *self) { - return (Py_uhash_t)BLI_hash_mm2((const unsigned char *)self, sizeof(*self), 0); + return (Py_uhash_t)BLI_hash_mm2((const uchar *)self, sizeof(*self), 0); } /*-----------------------BPy_FrsMaterial type definition ------------------------------*/ diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp index 5bdc8ce16e8..218749b2672 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp @@ -121,7 +121,7 @@ static PyObject *FrsNoise_turbulence1(BPy_FrsNoise *self, PyObject *args, PyObje { static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; float f1, f2, f3; - unsigned int i = 4; + uint i = 4; if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|I", (char **)kwlist, &f1, &f2, &f3, &i)) { return nullptr; @@ -150,7 +150,7 @@ static PyObject *FrsNoise_turbulence2(BPy_FrsNoise *self, PyObject *args, PyObje static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; PyObject *obj1; float f2, f3; - unsigned int i = 4; + uint i = 4; Vec2f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i)) { @@ -186,7 +186,7 @@ static PyObject *FrsNoise_turbulence3(BPy_FrsNoise *self, PyObject *args, PyObje static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; PyObject *obj1; float f2, f3; - unsigned int i = 4; + uint i = 4; Vec3f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i)) { diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp index fc7581a93c0..d88d3edecc0 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp @@ -82,8 +82,8 @@ static PyObject *Integrator_integrate(PyObject * /*self*/, PyObject *args, PyObj return PyFloat_FromDouble(res); } if (BPy_UnaryFunction0DUnsigned_Check(obj1)) { - UnaryFunction0D<unsigned int> *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; - unsigned int res = integrate(*fun, it, it_end, t); + UnaryFunction0D<uint> *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; + uint res = integrate(*fun, it, it_end, t); return PyLong_FromLong(res); } diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp index 20fd091c249..1c5e90474ab 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.cpp +++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp @@ -585,7 +585,7 @@ static PyObject *Operators_get_viewedge_from_index(BPy_Operators * /*self*/, PyObject *kwds) { static const char *kwlist[] = {"i", nullptr}; - unsigned int i; + uint i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { return nullptr; @@ -612,7 +612,7 @@ static PyObject *Operators_get_chain_from_index(BPy_Operators * /*self*/, PyObject *kwds) { static const char *kwlist[] = {"i", nullptr}; - unsigned int i; + uint i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { return nullptr; @@ -639,7 +639,7 @@ static PyObject *Operators_get_stroke_from_index(BPy_Operators * /*self*/, PyObject *kwds) { static const char *kwlist[] = {"i", nullptr}; - unsigned int i; + uint i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { return nullptr; diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp index fb72ed0ca62..5e504772786 100644 --- a/source/blender/freestyle/intern/python/BPy_SShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp @@ -224,7 +224,7 @@ static PyObject *SShape_vertices_get(BPy_SShape *self, void *UNUSED(closure)) vector<SVertex *> vertices = self->ss->getVertexList(); vector<SVertex *>::iterator it; PyObject *py_vertices = PyList_New(vertices.size()); - unsigned int i = 0; + uint i = 0; for (it = vertices.begin(); it != vertices.end(); it++) { PyList_SET_ITEM(py_vertices, i++, BPy_SVertex_from_SVertex(*(*it))); @@ -244,7 +244,7 @@ static PyObject *SShape_edges_get(BPy_SShape *self, void *UNUSED(closure)) vector<FEdge *> edges = self->ss->getEdgeList(); vector<FEdge *>::iterator it; PyObject *py_edges = PyList_New(edges.size()); - unsigned int i = 0; + uint i = 0; for (it = edges.begin(); it != edges.end(); it++) { PyList_SET_ITEM(py_edges, i++, Any_BPy_FEdge_from_FEdge(*(*it))); diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp index 7dddf90f2b3..86d7a726883 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp @@ -531,7 +531,7 @@ static Mathutils_Callback StrokeAttribute_mathutils_cb = { StrokeAttribute_mathutils_set_index, }; -static unsigned char StrokeAttribute_mathutils_cb_index = -1; +static uchar StrokeAttribute_mathutils_cb_index = -1; void StrokeAttribute_mathutils_register_callback() { diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp index 806739239de..319058ea719 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp @@ -200,7 +200,7 @@ static PyObject *ViewShape_vertices_get(BPy_ViewShape *self, void *UNUSED(closur vector<ViewVertex *> vertices = self->vs->vertices(); vector<ViewVertex *>::iterator it; PyObject *py_vertices = PyList_New(vertices.size()); - unsigned int i = 0; + uint i = 0; for (it = vertices.begin(); it != vertices.end(); it++) { PyList_SET_ITEM(py_vertices, i++, Any_BPy_ViewVertex_from_ViewVertex(*(*it))); @@ -219,7 +219,7 @@ static int ViewShape_vertices_set(BPy_ViewShape *self, PyObject *value, void *UN } v.reserve(PyList_GET_SIZE(value)); - for (unsigned int i = 0; i < PyList_GET_SIZE(value); i++) { + for (uint i = 0; i < PyList_GET_SIZE(value); i++) { item = PyList_GET_ITEM(value, i); if (BPy_ViewVertex_Check(item)) { v.push_back(((BPy_ViewVertex *)item)->vv); @@ -243,7 +243,7 @@ static PyObject *ViewShape_edges_get(BPy_ViewShape *self, void *UNUSED(closure)) vector<ViewEdge *> edges = self->vs->edges(); vector<ViewEdge *>::iterator it; PyObject *py_edges = PyList_New(edges.size()); - unsigned int i = 0; + uint i = 0; for (it = edges.begin(); it != edges.end(); it++) { PyList_SET_ITEM(py_edges, i++, BPy_ViewEdge_from_ViewEdge(*(*it))); diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index ff59e5b1a10..09202127ad2 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -251,7 +251,7 @@ static Mathutils_Callback SVertex_mathutils_cb = { SVertex_mathutils_set_index, }; -static unsigned char SVertex_mathutils_cb_index = -1; +static uchar SVertex_mathutils_cb_index = -1; void SVertex_mathutils_register_callback() { @@ -338,7 +338,7 @@ static PyObject *SVertex_normals_get(BPy_SVertex *self, void *UNUSED(closure)) set<Vec3r> normals = self->sv->normals(); set<Vec3r>::iterator it; py_normals = PyList_New(normals.size()); - unsigned int i = 0; + uint i = 0; for (it = normals.begin(); it != normals.end(); it++) { Vec3r v(*it); diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp index 1c1d8bf032a..54996067e72 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp @@ -206,7 +206,7 @@ static Mathutils_Callback StrokeVertex_mathutils_cb = { StrokeVertex_mathutils_set_index, }; -static unsigned char StrokeVertex_mathutils_cb_index = -1; +static uchar StrokeVertex_mathutils_cb_index = -1; void StrokeVertex_mathutils_register_callback() { diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp index 57c00ab1b99..1c1136bbae7 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp @@ -378,7 +378,7 @@ static PyObject *Stroke_texture_id_get(BPy_Stroke *self, void *UNUSED(closure)) static int Stroke_texture_id_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp index 840f49ff345..e32910cf53d 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp @@ -178,7 +178,7 @@ static Mathutils_Callback FEdgeSharp_mathutils_cb = { FEdgeSharp_mathutils_set_index, }; -static unsigned char FEdgeSharp_mathutils_cb_index = -1; +static uchar FEdgeSharp_mathutils_cb_index = -1; void FEdgeSharp_mathutils_register_callback() { @@ -250,7 +250,7 @@ static int FEdgeSharp_material_index_right_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } @@ -272,7 +272,7 @@ static int FEdgeSharp_material_index_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp index bf62d5bd31d..93943dcda05 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp @@ -129,7 +129,7 @@ static Mathutils_Callback FEdgeSmooth_mathutils_cb = { FEdgeSmooth_mathutils_set_index, }; -static unsigned char FEdgeSmooth_mathutils_cb_index = -1; +static uchar FEdgeSmooth_mathutils_cb_index = -1; void FEdgeSmooth_mathutils_register_callback() { @@ -173,7 +173,7 @@ static int FEdgeSmooth_material_index_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index be1b9f42ce4..29e1a1d3525 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -64,7 +64,7 @@ static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned *self, if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; } - self->uf0D_unsigned = new UnaryFunction0D<unsigned int>(); + self->uf0D_unsigned = new UnaryFunction0D<uint>(); self->uf0D_unsigned->py_uf0D = (PyObject *)self; return 0; } @@ -93,7 +93,7 @@ static PyObject *UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *s return nullptr; } - if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D<unsigned int>)) { + if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D<uint>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return nullptr; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index 6d17f6debdf..e0aa5af2adb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -106,9 +106,9 @@ static PyObject *UnaryFunction0DVectorViewShape___call__(BPy_UnaryFunction0DVect return nullptr; } - const unsigned int list_len = self->uf0D_vectorviewshape->result.size(); + const uint list_len = self->uf0D_vectorviewshape->result.size(); PyObject *list = PyList_New(list_len); - for (unsigned int i = 0; i < list_len; i++) { + for (uint i = 0; i < list_len; i++) { ViewShape *v = self->uf0D_vectorviewshape->result[i]; PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp index f0435ea1294..3a2c9868014 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp @@ -47,7 +47,7 @@ static int ReadSteerableViewMapPixelF0D___init__(BPy_ReadSteerableViewMapPixelF0 PyObject *kwds) { static const char *kwlist[] = {"orientation", "level", nullptr}; - unsigned int u; + uint u; int i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Ii", (char **)kwlist, &u, &i)) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index e9023d90b42..8929e9e4024 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -74,11 +74,10 @@ static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned *self, } if (!obj) { - self->uf1D_unsigned = new UnaryFunction1D<unsigned int>(); + self->uf1D_unsigned = new UnaryFunction1D<uint>(); } else { - self->uf1D_unsigned = new UnaryFunction1D<unsigned int>( - IntegrationType_from_BPy_IntegrationType(obj)); + self->uf1D_unsigned = new UnaryFunction1D<uint>(IntegrationType_from_BPy_IntegrationType(obj)); } self->uf1D_unsigned->py_uf1D = (PyObject *)self; @@ -109,7 +108,7 @@ static PyObject *UnaryFunction1DUnsigned___call__(BPy_UnaryFunction1DUnsigned *s return nullptr; } - if (typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D<unsigned int>)) { + if (typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D<uint>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return nullptr; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index df504b1cdaa..44f12c9e307 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -136,9 +136,9 @@ static PyObject *UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVect return nullptr; } - const unsigned int list_len = self->uf1D_vectorviewshape->result.size(); + const uint list_len = self->uf1D_vectorviewshape->result.size(); PyObject *list = PyList_New(list_len); - for (unsigned int i = 0; i < list_len; i++) { + for (uint i = 0; i < list_len; i++) { ViewShape *v = self->uf1D_vectorviewshape->result[i]; PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp index c4d4aedc954..b513686524e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp @@ -67,7 +67,7 @@ static int GetDirectionalViewMapDensityF1D___init__(BPy_GetDirectionalViewMapDen { static const char *kwlist[] = {"orientation", "level", "integration_type", "sampling", nullptr}; PyObject *obj = nullptr; - unsigned int u1, u2; + uint u1, u2; float f = 2.0; if (!PyArg_ParseTupleAndKeywords( |