Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/fill/fillmodule.c
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-10-30 13:28:26 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-10-30 13:28:26 (GMT)
commit122c067f12f853ad8dfe55d997cc046493419e9d (patch)
tree6caafdbd589fcd829752a9c9eb39fbbca273db64 /fill/fillmodule.c
parent929a4f333b4a41dd96598afc8bae3effd0cc9de9 (diff)
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 <gonzalo@laptop.org>
Diffstat (limited to 'fill/fillmodule.c')
-rw-r--r--fill/fillmodule.c10
1 files changed, 5 insertions, 5 deletions
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);