diff options
author | Jean-Luc Peurière <jlp@nerim.net> | 2006-12-03 23:27:59 +0300 |
---|---|---|
committer | Jean-Luc Peurière <jlp@nerim.net> | 2006-12-03 23:27:59 +0300 |
commit | d7aaa84dd96bbf30307ee25a2c4d5a22bff8b378 (patch) | |
tree | 86469eed44dd62f6a985696daa81eb18aba0259d /source/gameengine | |
parent | 13d466fe77d394531fe2512c7c62223de778a624 (diff) |
Fix for getting gcc compile GE with Py 2.5
PYobject type has changed
Usual C++ pickyness about implicit casts
debug made with erwin. thanks
Note to python mainteners :
even if it compiles there is a *Huge* list of warnings about deprecated
and incompatible pointers in api2.2. this should be corrected
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Expressions/ListValue.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index cd16377b5e3..bbf58a8a06e 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -23,12 +23,16 @@ #include <config.h> #endif -int listvalue_bufferlen(PyObject* list) +#if ((PY_MAJOR_VERSION == 2) &&(PY_MINOR_VERSION < 5)) +#define Py_ssize_t int +#endif + +Py_ssize_t listvalue_bufferlen(PyObject* list) { - return ( ((CListValue*)list)->GetCount()); + return (Py_ssize_t)( ((CListValue*)list)->GetCount()); } -PyObject* listvalue_buffer_item(PyObject* list,int index) +PyObject* listvalue_buffer_item(PyObject* list,Py_ssize_t index) { if (index >= 0 && index < ((CListValue*) list)->GetCount()) { @@ -68,7 +72,7 @@ PyObject* listvalue_mapping_subscript(PyObject* list,PyObject* pyindex) /* just slice it into a python list... */ -PyObject* listvalue_buffer_slice(PyObject* list,int ilow, int ihigh) +PyObject* listvalue_buffer_slice(PyObject* list,Py_ssize_t ilow, Py_ssize_t ihigh) { int i, j; PyListObject *newlist; @@ -162,23 +166,23 @@ listvalue_buffer_concat(PyObject * self, PyObject * other) -static PySequenceMethods listvalue_as_sequence = { - (inquiry)listvalue_bufferlen,//(inquiry)buffer_length, /*sq_length*/ - (binaryfunc)listvalue_buffer_concat, /*sq_concat*/ - 0,//(intargfunc)buffer_repeat, /*sq_repeat*/ - (intargfunc)listvalue_buffer_item, /*sq_item*/ - (intintargfunc)listvalue_buffer_slice, /*sq_slice*/ - 0,//(intobjargproc)buffer_ass_item, /*sq_ass_item*/ - 0,//(intintobjargproc)buffer_ass_slice, /*sq_ass_slice*/ +static PySequenceMethods listvalue_as_sequence = { + listvalue_bufferlen,//(inquiry)buffer_length, /*sq_length*/ + listvalue_buffer_concat, /*sq_concat*/ + NULL, /*sq_repeat*/ + listvalue_buffer_item, /*sq_item*/ + listvalue_buffer_slice, /*sq_slice*/ + NULL, /*sq_ass_item*/ + NULL /*sq_ass_slice*/ }; /* Is this one used ? */ -static PyMappingMethods instance_as_mapping = { - (inquiry)listvalue_bufferlen, /*mp_length*/ - (binaryfunc)listvalue_mapping_subscript, /*mp_subscript*/ - 0,//(objobjargproc)instance_ass_subscript, /*mp_ass_subscript*/ +static PyMappingMethods instance_as_mapping = { + listvalue_bufferlen, /*mp_length*/ + listvalue_mapping_subscript, /*mp_subscript*/ + NULL /*mp_ass_subscript*/ }; |