From 3d8f5f7c917e529be7140c9243eac691ec6419d5 Mon Sep 17 00:00:00 2001 Message-Id: <3d8f5f7c917e529be7140c9243eac691ec6419d5.1716442471.git.mdw@distorted.org.uk> From: Mark Wooding Date: Mon, 12 Sep 2016 00:14:16 +0100 Subject: [PATCH] Further fixing to use `Py_ssize_t' in place of int. Organization: Straylight/Edgeware From: Mark Wooding This addresses the remaining compiler warnings when building for 64-bit targets. --- buffer.c | 8 ++++---- catacomb-python.h | 2 +- util.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/buffer.c b/buffer.c index 507e6b8..6569516 100644 --- a/buffer.c +++ b/buffer.c @@ -77,10 +77,10 @@ static void buf_pydealloc(PyObject *me) FREEOBJ(me); } -static int rbuf_pysegcount(PyObject *me, int *nn) +static Py_ssize_t rbuf_pysegcount(PyObject *me, Py_ssize_t *nn) { if (nn) *nn = BSZ(BUF_B(me)); return (1); } -static int rbuf_pyreadbuf(PyObject *me, int seg, void **q) +static Py_ssize_t rbuf_pyreadbuf(PyObject *me, Py_ssize_t seg, void **q) { assert(seg == 0); *q = BCUR(BUF_B(me)); return (BLEFT(BUF_B(me))); } static PyObject *rbmeth_skip(PyObject *me, PyObject *arg) @@ -367,10 +367,10 @@ end: return ((PyObject *)me); } -static int wbuf_pysegcount(PyObject *me, int *nn) +static Py_ssize_t wbuf_pysegcount(PyObject *me, Py_ssize_t *nn) { if (nn) *nn = BLEN(BUF_B(me)); return (1); } -static int wbuf_pyreadbuf(PyObject *me, int seg, void **q) +static Py_ssize_t wbuf_pyreadbuf(PyObject *me, Py_ssize_t seg, void **q) { assert(seg == 0); *q = BBASE(BUF_B(me)); return (BLEN(BUF_B(me))); } static PyObject *wbmeth_zero(PyObject *me, PyObject *arg) diff --git a/catacomb-python.h b/catacomb-python.h index b287450..a379e1d 100644 --- a/catacomb-python.h +++ b/catacomb-python.h @@ -282,7 +282,7 @@ extern PyMethodDef *donemethods(void); GMAP_DOMETHODS(GMAP_METHDECL, GMAP_KWMETHDECL) #define GMAP_ROMETHODS GMAP_DOROMETHODS(GMAP_METH, GMAP_KWMETH) #define GMAP_METHODS GMAP_DOMETHODS(GMAP_METH, GMAP_KWMETH) -extern int gmap_pysize(PyObject *); +extern Py_ssize_t gmap_pysize(PyObject *); extern PySequenceMethods gmap_pysequence; extern PyMethodDef gmap_pymethods[]; diff --git a/util.c b/util.c index 8a0c06c..ed56e99 100644 --- a/util.c +++ b/util.c @@ -413,7 +413,7 @@ PySequenceMethods gmap_pysequence = { 0 /* @sq_inplace_repeat@ */ }; -int gmap_pysize(PyObject *me) +Py_ssize_t gmap_pysize(PyObject *me) { PyObject *i = 0, *x = 0; int rc = -1; -- [mdw]