From c589ae6bcf46033323f6eb3280f91776cf39f083 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Wed, 16 Mar 2016 04:37:49 -0700 Subject: [PATCH] Change return type of PyPath_Flatten to Py_ssize_t to match PyObject_Length --- _imaging.c | 20 ++++++++++---------- path.c | 18 +++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/_imaging.c b/_imaging.c index 1077f0b57..68102b611 100644 --- a/_imaging.c +++ b/_imaging.c @@ -2366,7 +2366,7 @@ _draw_dealloc(ImagingDrawObject* self) PyObject_Del(self); } -extern int PyPath_Flatten(PyObject* data, double **xy); +extern Py_ssize_t PyPath_Flatten(PyObject* data, double **xy); static PyObject* _draw_ink(ImagingDrawObject* self, PyObject* args) @@ -2387,7 +2387,7 @@ static PyObject* _draw_arc(ImagingDrawObject* self, PyObject* args) { double* xy; - int n; + Py_ssize_t n; PyObject* data; int ink; @@ -2423,7 +2423,7 @@ static PyObject* _draw_bitmap(ImagingDrawObject* self, PyObject* args) { double *xy; - int n; + Py_ssize_t n; PyObject *data; ImagingObject* bitmap; @@ -2459,7 +2459,7 @@ static PyObject* _draw_chord(ImagingDrawObject* self, PyObject* args) { double* xy; - int n; + Py_ssize_t n; PyObject* data; int ink, fill; @@ -2495,7 +2495,7 @@ static PyObject* _draw_ellipse(ImagingDrawObject* self, PyObject* args) { double* xy; - int n; + Py_ssize_t n; PyObject* data; int ink; @@ -2546,7 +2546,7 @@ static PyObject* _draw_lines(ImagingDrawObject* self, PyObject* args) { double *xy; - int i, n; + Py_ssize_t i, n; PyObject *data; int ink; @@ -2614,7 +2614,7 @@ static PyObject* _draw_points(ImagingDrawObject* self, PyObject* args) { double *xy; - int i, n; + Py_ssize_t i, n; PyObject *data; int ink; @@ -2676,7 +2676,7 @@ static PyObject* _draw_pieslice(ImagingDrawObject* self, PyObject* args) { double* xy; - int n; + Py_ssize_t n; PyObject* data; int ink, fill; @@ -2712,7 +2712,7 @@ _draw_polygon(ImagingDrawObject* self, PyObject* args) { double *xy; int *ixy; - int n, i; + Py_ssize_t n, i; PyObject* data; int ink; @@ -2756,7 +2756,7 @@ static PyObject* _draw_rectangle(ImagingDrawObject* self, PyObject* args) { double* xy; - int n; + Py_ssize_t n; PyObject* data; int ink; diff --git a/path.c b/path.c index a96c360cd..cf451e03a 100644 --- a/path.c +++ b/path.c @@ -107,10 +107,10 @@ path_dealloc(PyPathObject* path) #define PyPath_Check(op) (Py_TYPE(op) == &PyPathType) -int +Py_ssize_t PyPath_Flatten(PyObject* data, double **pxy) { - int i, j, n; + Py_ssize_t i, j, n; double *xy; if (PyPath_Check(data)) { @@ -283,7 +283,7 @@ path_compact(PyPathObject* self, PyObject* args) /* Simple-minded method to shorten path. A point is removed if the city block distance to the previous point is less than the given distance */ - int i, j; + Py_ssize_t i, j; double *xy; double cityblock = 2.0; @@ -331,7 +331,7 @@ static PyObject* path_getbbox(PyPathObject* self, PyObject* args) { /* Find bounding box */ - int i; + Py_ssize_t i; double *xy; double x0, y0, x1, y1; @@ -358,7 +358,7 @@ path_getbbox(PyPathObject* self, PyObject* args) } static PyObject* -path_getitem(PyPathObject* self, int i) +path_getitem(PyPathObject* self, Py_ssize_t i) { if (i < 0) i = self->count + i; @@ -398,7 +398,7 @@ static PyObject* path_map(PyPathObject* self, PyObject* args) { /* Map coordinate set through function */ - int i; + Py_ssize_t i; double *xy; PyObject* function; @@ -426,7 +426,7 @@ path_map(PyPathObject* self, PyObject* args) } static int -path_setitem(PyPathObject* self, int i, PyObject* op) +path_setitem(PyPathObject* self, Py_ssize_t i, PyObject* op) { double* xy; @@ -454,7 +454,7 @@ static PyObject* path_tolist(PyPathObject* self, PyObject* args) { PyObject *list; - int i; + Py_ssize_t i; int flat = 0; if (!PyArg_ParseTuple(args, "|i:tolist", &flat)) @@ -491,7 +491,7 @@ static PyObject* path_transform(PyPathObject* self, PyObject* args) { /* Apply affine transform to coordinate set */ - int i; + Py_ssize_t i; double *xy; double a, b, c, d, e, f;