diff options
Diffstat (limited to 'source/blender/python/generic')
-rw-r--r-- | source/blender/python/generic/bgl.c | 44 | ||||
-rw-r--r-- | source/blender/python/generic/bl_math_py_api.c | 16 | ||||
-rw-r--r-- | source/blender/python/generic/blf_py_api.c | 16 | ||||
-rw-r--r-- | source/blender/python/generic/idprop_py_api.c | 38 | ||||
-rw-r--r-- | source/blender/python/generic/imbuf_py_api.c | 32 |
5 files changed, 73 insertions, 73 deletions
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index a03e0ab31eb..fe64b247d43 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -417,11 +417,11 @@ static PyObject *Method_ShaderSource(PyObject *self, PyObject *args); /* Buffer sequence methods */ -static int Buffer_len(Buffer *self); -static PyObject *Buffer_item(Buffer *self, int i); -static PyObject *Buffer_slice(Buffer *self, int begin, int end); -static int Buffer_ass_item(Buffer *self, int i, PyObject *v); -static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq); +static Py_ssize_t Buffer_len(Buffer *self); +static PyObject *Buffer_item(Buffer *self, Py_ssize_t i); +static PyObject *Buffer_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end); +static int Buffer_ass_item(Buffer *self, Py_ssize_t i, PyObject *v); +static int Buffer_ass_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end, PyObject *seq); static PyObject *Buffer_subscript(Buffer *self, PyObject *item); static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value); @@ -794,12 +794,12 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject /* Buffer sequence methods */ -static int Buffer_len(Buffer *self) +static Py_ssize_t Buffer_len(Buffer *self) { return self->dimensions[0]; } -static PyObject *Buffer_item(Buffer *self, int i) +static PyObject *Buffer_item(Buffer *self, Py_ssize_t i) { if (i >= self->dimensions[0] || i < 0) { PyErr_SetString(PyExc_IndexError, "array index out of range"); @@ -837,10 +837,9 @@ static PyObject *Buffer_item(Buffer *self, int i) return NULL; } -static PyObject *Buffer_slice(Buffer *self, int begin, int end) +static PyObject *Buffer_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end) { PyObject *list; - int count; if (begin < 0) { begin = 0; @@ -854,13 +853,13 @@ static PyObject *Buffer_slice(Buffer *self, int begin, int end) list = PyList_New(end - begin); - for (count = begin; count < end; count++) { + for (Py_ssize_t count = begin; count < end; count++) { PyList_SET_ITEM(list, count - begin, Buffer_item(self, count)); } return list; } -static int Buffer_ass_item(Buffer *self, int i, PyObject *v) +static int Buffer_ass_item(Buffer *self, Py_ssize_t i, PyObject *v) { if (i >= self->dimensions[0] || i < 0) { PyErr_SetString(PyExc_IndexError, "array assignment index out of range"); @@ -895,10 +894,11 @@ static int Buffer_ass_item(Buffer *self, int i, PyObject *v) } } -static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq) +static int Buffer_ass_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end, PyObject *seq) { PyObject *item; - int count, err = 0; + int err = 0; + Py_ssize_t count; if (begin < 0) { begin = 0; @@ -918,7 +918,7 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq) return -1; } - /* re-use count var */ + /* Re-use count variable. */ if ((count = PySequence_Size(seq)) != (end - begin)) { PyErr_Format(PyExc_TypeError, "buffer[:] = value, size mismatch in assignment. " @@ -1376,14 +1376,14 @@ BGL_Wrap(TexImage3DMultisample, static struct PyModuleDef BGL_module_def = { PyModuleDef_HEAD_INIT, - "bgl", /* m_name */ - NULL, /* m_doc */ - 0, /* m_size */ - NULL, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "bgl", + /*m_doc*/ NULL, + /*m_size*/ 0, + /*m_methods*/ NULL, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; static void py_module_dict_add_int(PyObject *dict, const char *name, int value) diff --git a/source/blender/python/generic/bl_math_py_api.c b/source/blender/python/generic/bl_math_py_api.c index 19958a99df9..47a1687d20b 100644 --- a/source/blender/python/generic/bl_math_py_api.c +++ b/source/blender/python/generic/bl_math_py_api.c @@ -129,14 +129,14 @@ static PyMethodDef M_bl_math_methods[] = { static struct PyModuleDef M_bl_math_module_def = { PyModuleDef_HEAD_INIT, - "bl_math", /* m_name */ - M_bl_math_doc, /* m_doc */ - 0, /* m_size */ - M_bl_math_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "bl_math", + /*m_doc*/ M_bl_math_doc, + /*m_size*/ 0, + /*m_methods*/ M_bl_math_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyMODINIT_FUNC BPyInit_bl_math(void) diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c index 979a581463e..2b7c5ed7e55 100644 --- a/source/blender/python/generic/blf_py_api.c +++ b/source/blender/python/generic/blf_py_api.c @@ -466,14 +466,14 @@ static PyMethodDef BLF_methods[] = { PyDoc_STRVAR(BLF_doc, "This module provides access to Blender's text drawing functions."); static struct PyModuleDef BLF_module_def = { PyModuleDef_HEAD_INIT, - "blf", /* m_name */ - BLF_doc, /* m_doc */ - 0, /* m_size */ - BLF_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "blf", + /*m_doc*/ BLF_doc, + /*m_size*/ 0, + /*m_methods*/ BLF_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_blf(void) diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index a5599a3622e..9a6568355af 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -1695,12 +1695,12 @@ static PyMethodDef BPy_IDArray_methods[] = { {NULL, NULL, 0, NULL}, }; -static int BPy_IDArray_Len(BPy_IDArray *self) +static Py_ssize_t BPy_IDArray_Len(BPy_IDArray *self) { return self->prop->len; } -static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index) +static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, Py_ssize_t index) { if (index < 0 || index >= self->prop->len) { PyErr_SetString(PyExc_IndexError, "index out of range!"); @@ -1722,7 +1722,7 @@ static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index) return NULL; } -static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value) +static int BPy_IDArray_SetItem(BPy_IDArray *self, Py_ssize_t index, PyObject *value) { if (index < 0 || index >= self->prop->len) { PyErr_SetString(PyExc_RuntimeError, "index out of range!"); @@ -2092,14 +2092,14 @@ static PyObject *BPy_IDGroup_ViewItems_CreatePyObject(BPy_IDProperty *group) static struct PyModuleDef IDProp_types_module_def = { PyModuleDef_HEAD_INIT, - "idprop.types", /* m_name */ - NULL, /* m_doc */ - 0, /* m_size */ - NULL, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "idprop.types", + /*m_doc*/ NULL, + /*m_size*/ 0, + /*m_methods*/ NULL, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; static PyObject *BPyInit_idprop_types(void) @@ -2141,14 +2141,14 @@ PyDoc_STRVAR(IDProp_module_doc, "This module provides access id property types (currently mainly for docs)."); static struct PyModuleDef IDProp_module_def = { PyModuleDef_HEAD_INIT, - "idprop", /* m_name */ - IDProp_module_doc, /* m_doc */ - 0, /* m_size */ - IDProp_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "idprop", + /*m_doc*/ IDProp_module_doc, + /*m_size*/ 0, + /*m_methods*/ IDProp_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_idprop(void) diff --git a/source/blender/python/generic/imbuf_py_api.c b/source/blender/python/generic/imbuf_py_api.c index c6a817fa01c..77d450d496e 100644 --- a/source/blender/python/generic/imbuf_py_api.c +++ b/source/blender/python/generic/imbuf_py_api.c @@ -557,14 +557,14 @@ PyDoc_STRVAR(IMB_doc, ":class:`bpy.types.Image` data-block context.\n"); static struct PyModuleDef IMB_module_def = { PyModuleDef_HEAD_INIT, - "imbuf", /* m_name */ - IMB_doc, /* m_doc */ - 0, /* m_size */ - IMB_methods, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "imbuf", + /*m_doc*/ IMB_doc, + /*m_size*/ 0, + /*m_methods*/ IMB_methods, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_imbuf(void) @@ -601,14 +601,14 @@ PyDoc_STRVAR(IMB_types_doc, static struct PyModuleDef IMB_types_module_def = { PyModuleDef_HEAD_INIT, - "imbuf.types", /* m_name */ - IMB_types_doc, /* m_doc */ - 0, /* m_size */ - NULL, /* m_methods */ - NULL, /* m_slots */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + /*m_name*/ "imbuf.types", + /*m_doc*/ IMB_types_doc, + /*m_size*/ 0, + /*m_methods*/ NULL, + /*m_slots*/ NULL, + /*m_traverse*/ NULL, + /*m_clear*/ NULL, + /*m_free*/ NULL, }; PyObject *BPyInit_imbuf_types(void) |