From 122c067f12f853ad8dfe55d997cc046493419e9d Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Tue, 30 Oct 2012 13:28:26 +0000 Subject: Bucket implementation fixed to work in 32bit The last commit worked in 64bit arch but not in 32bit. This fix works only in 32bit, then do not update the binaries already compiled to 64bit. Signed-off-by: Gonzalo Odiard --- (limited to 'fill/fillmodule.c') diff --git a/fill/fillmodule.c b/fill/fillmodule.c index 9a1c0e1..e9b461c 100644 --- a/fill/fillmodule.c +++ b/fill/fillmodule.c @@ -58,28 +58,28 @@ static PyObject* fill(PyObject* self, PyObject* args) return NULL; /* from http://mail.python.org/pipermail/tutor/1999-November/000758.html */ - unsigned int *intarr, arrsize, index; + unsigned long *intarr, arrsize, index; PyObject *item; PyObject *pylist; /* how many elements are in the Python object */ arrsize = PyObject_Length(mylist); /* create a dynamic C array of integers */ - intarr = (int *)malloc(sizeof(int)*arrsize); + intarr = (unsigned long *)malloc(sizeof(unsigned long)*arrsize); for (index = 0; index < arrsize; index++) { /* get the element from the list/tuple */ item = PySequence_GetItem(mylist, index); /* assign to the C array */ - intarr[index] = PyInt_AsUnsignedLongMask(item); + intarr[index] = PyLong_AsUnsignedLong(item); } /* now use intarr and arrsize in you extension */ - //printf("x %u y %u width %u height %u color %u", x, y, width, height, color); + printf("x %u y %u width %u height %u color %u", x, y, width, height, color); floodfill(intarr, x, y, width, height, color); pylist = PyTuple_New(arrsize); for (index = 0; index < arrsize; index++) { - PyTuple_SetItem(pylist, index, PyInt_FromLong(intarr[index])); + PyTuple_SetItem(pylist, index, PyLong_FromUnsignedLong(intarr[index])); } return Py_BuildValue("O", pylist); -- cgit v0.9.1