diff options
author | Hans Goudey <h.goudey@me.com> | 2022-11-11 04:14:48 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-11-11 04:41:13 +0300 |
commit | 9465b109af0b70244a36f9e68493e316d9f8b56f (patch) | |
tree | c4d933bf09f8313071556063156538ec3356b24c /source/blender/python/gpu/gpu_py_buffer.c | |
parent | 026d21a225521670c6b5083da9da61227da69e65 (diff) | |
parent | ca1642cd0c5cdf634fe2022c955d93983de95934 (diff) |
Merge branch 'master' into refactor-mesh-position-genericrefactor-mesh-position-generic
Diffstat (limited to 'source/blender/python/gpu/gpu_py_buffer.c')
-rw-r--r-- | source/blender/python/gpu/gpu_py_buffer.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/source/blender/python/gpu/gpu_py_buffer.c b/source/blender/python/gpu/gpu_py_buffer.c index 30a434f8667..51bda9b4941 100644 --- a/source/blender/python/gpu/gpu_py_buffer.c +++ b/source/blender/python/gpu/gpu_py_buffer.c @@ -159,7 +159,7 @@ static BPyGPUBuffer *pygpu_buffer_make_from_data(PyObject *parent, return buffer; } -static PyObject *pygpu_buffer__sq_item(BPyGPUBuffer *self, int i) +static PyObject *pygpu_buffer__sq_item(BPyGPUBuffer *self, Py_ssize_t i) { if (i >= self->shape[0] || i < 0) { PyErr_SetString(PyExc_IndexError, "array index out of range"); @@ -200,10 +200,10 @@ static PyObject *pygpu_buffer__sq_item(BPyGPUBuffer *self, int i) static PyObject *pygpu_buffer_to_list(BPyGPUBuffer *self) { - int i, len = self->shape[0]; + const Py_ssize_t len = self->shape[0]; PyObject *list = PyList_New(len); - for (i = 0; i < len; i++) { + for (Py_ssize_t i = 0; i < len; i++) { PyList_SET_ITEM(list, i, pygpu_buffer__sq_item(self, i)); } @@ -313,7 +313,7 @@ static PyObject *pygpu_buffer__tp_repr(BPyGPUBuffer *self) return repr; } -static int pygpu_buffer__sq_ass_item(BPyGPUBuffer *self, int i, PyObject *v); +static int pygpu_buffer__sq_ass_item(BPyGPUBuffer *self, Py_ssize_t i, PyObject *v); static int pygpu_buffer_ass_slice(BPyGPUBuffer *self, Py_ssize_t begin, @@ -430,7 +430,7 @@ static int pygpu_buffer__tp_is_gc(BPyGPUBuffer *self) /* BPyGPUBuffer sequence methods */ -static int pygpu_buffer__sq_length(BPyGPUBuffer *self) +static Py_ssize_t pygpu_buffer__sq_length(BPyGPUBuffer *self) { return self->shape[0]; } @@ -458,7 +458,7 @@ static PyObject *pygpu_buffer_slice(BPyGPUBuffer *self, Py_ssize_t begin, Py_ssi return list; } -static int pygpu_buffer__sq_ass_item(BPyGPUBuffer *self, int i, PyObject *v) +static int pygpu_buffer__sq_ass_item(BPyGPUBuffer *self, Py_ssize_t i, PyObject *v) { if (i >= self->shape[0] || i < 0) { PyErr_SetString(PyExc_IndexError, "array assignment index out of range"); @@ -579,22 +579,22 @@ static PyGetSetDef pygpu_buffer_getseters[] = { }; static PySequenceMethods pygpu_buffer__tp_as_sequence = { - (lenfunc)pygpu_buffer__sq_length, /* sq_length */ - (binaryfunc)NULL, /* sq_concat */ - (ssizeargfunc)NULL, /* sq_repeat */ - (ssizeargfunc)pygpu_buffer__sq_item, /* sq_item */ - (ssizessizeargfunc)NULL, /* sq_slice, deprecated, handled in pygpu_buffer__sq_item */ - (ssizeobjargproc)pygpu_buffer__sq_ass_item, /* sq_ass_item */ - (ssizessizeobjargproc)NULL, /* sq_ass_slice, deprecated handled in pygpu_buffer__sq_ass_item */ - (objobjproc)NULL, /* sq_contains */ - (binaryfunc)NULL, /* sq_inplace_concat */ - (ssizeargfunc)NULL, /* sq_inplace_repeat */ + /*sq_length*/ (lenfunc)pygpu_buffer__sq_length, + /*sq_concat*/ NULL, + /*sq_repeat*/ NULL, + /*sq_item*/ (ssizeargfunc)pygpu_buffer__sq_item, + /*was_sq_slice*/ NULL, /* DEPRECATED. Handled by #pygpu_buffer__sq_item. */ + /*sq_ass_item*/ (ssizeobjargproc)pygpu_buffer__sq_ass_item, + /*was_sq_ass_slice*/ NULL, /* DEPRECATED. Handled by #pygpu_buffer__sq_ass_item. */ + /*sq_contains*/ NULL, + /*sq_inplace_concat*/ NULL, + /*sq_inplace_repeat*/ NULL, }; static PyMappingMethods pygpu_buffer__tp_as_mapping = { - (lenfunc)pygpu_buffer__sq_length, - (binaryfunc)pygpu_buffer__mp_subscript, - (objobjargproc)pygpu_buffer__mp_ass_subscript, + /*mp_len*/ (lenfunc)pygpu_buffer__sq_length, + /*mp_subscript*/ (binaryfunc)pygpu_buffer__mp_subscript, + /*mp_ass_subscript*/ (objobjargproc)pygpu_buffer__mp_ass_subscript, }; #ifdef PYGPU_BUFFER_PROTOCOL @@ -648,8 +648,8 @@ static void pygpu_buffer__bf_releasebuffer(PyObject *UNUSED(exporter), Py_buffer } static PyBufferProcs pygpu_buffer__tp_as_buffer = { - (getbufferproc)pygpu_buffer__bf_getbuffer, - (releasebufferproc)pygpu_buffer__bf_releasebuffer, + /*bf_getbuffer*/ (getbufferproc)pygpu_buffer__bf_getbuffer, + /*bf_releasebuffer*/ (releasebufferproc)pygpu_buffer__bf_releasebuffer, }; #endif |