X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1d99702e4b41ed8b4110325e3dd9d710b5d32562..b854b7b82e033d1dbd9d300402df50ec5e1e8b74:/utils/wxPython/src/libpy.c diff --git a/utils/wxPython/src/libpy.c b/utils/wxPython/src/libpy.c index 59aa8fae2f..5841d40a50 100644 --- a/utils/wxPython/src/libpy.c +++ b/utils/wxPython/src/libpy.c @@ -81,7 +81,7 @@ swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) /* -------------------------------------------------------------------- swig_varlink_getattr - + This function gets the value of a variable and returns it as a PyObject. In our case, we'll be looking at the datatype and converting into a number or string @@ -128,17 +128,17 @@ swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) statichere PyTypeObject varlinktype = { /* PyObject_HEAD_INIT(&PyType_Type) Note : This doesn't work on some machines */ - PyObject_HEAD_INIT(0) + PyObject_HEAD_INIT(0) 0, "varlink", /* Type name */ sizeof(swig_varlinkobject), /* Basic size */ 0, /* Itemsize */ - 0, /* Deallocator */ + 0, /* Deallocator */ (printfunc) swig_varlink_print, /* Print */ (getattrfunc) swig_varlink_getattr, /* get attr */ (setattrfunc) swig_varlink_setattr, /* Set attr */ 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ + (reprfunc) swig_varlink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_mapping*/ 0, /* tp_hash */ @@ -169,7 +169,7 @@ SWIG_addvarlink(PyObject *p, char *name, { swig_varlinkobject *v; v= (swig_varlinkobject *) p; - + if (v->nvars >= v->maxvars -1) { v->maxvars = 2*v->maxvars; v->vars = (swig_globalvar **) realloc(v->vars,v->maxvars*sizeof(swig_globalvar *)); @@ -216,7 +216,7 @@ static SwigPtrType *SwigPtrTable = 0; /* Table containing pointer equivalences /* Cached values */ #define SWIG_CACHESIZE 8 #define SWIG_CACHEMASK 0x7 -static SwigCacheType SwigCache[SWIG_CACHESIZE]; +static SwigCacheType SwigCache[SWIG_CACHESIZE]; static int SwigCacheIndex = 0; static int SwigLastCache = 0; @@ -228,13 +228,13 @@ static int swigsort(const void *data1, const void *data2) { } /* Register a new datatype with the type-checker */ -SWIGSTATICRUNTIME(void) +SWIGSTATICRUNTIME(void) SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) { int i; SwigPtrType *t = 0,*t1; /* Allocate the pointer table if necessary */ - if (!SwigPtrTable) { + if (!SwigPtrTable) { SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType)); } @@ -269,17 +269,17 @@ SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) { t1->name = newtype; t1->len = strlen(t1->name); t1->cast = cast; - t1->next = 0; - t->next = t1; + t1->next = 0; + t->next = t1; SwigPtrSort = 0; } /* Make a pointer value string */ -SWIGSTATICRUNTIME(void) +SWIGSTATICRUNTIME(void) SWIG_MakePtr(char *c, const void *ptr, char *type) { static char hex[17] = "0123456789abcdef"; unsigned long p, s; - char result[24], *r; + char result[24], *r; r = result; p = (unsigned long) ptr; if (p > 0) { @@ -298,7 +298,7 @@ SWIG_MakePtr(char *c, const void *ptr, char *type) { } /* Function for getting a pointer value */ -SWIGSTATICRUNTIME(char *) +SWIGSTATICRUNTIME(char *) SWIG_GetPtr(char *c, void **ptr, char *t) { unsigned long p; @@ -323,14 +323,14 @@ SWIG_GetPtr(char *c, void **ptr, char *t) else if ((d >= 'a') && (d <= 'f')) p = (p << 4) + (d - ('a'-10)); else - break; + break; c++; } *ptr = (void *) p; if ((!t) || (strcmp(t,c)==0)) return (char *) 0; if (!SwigPtrSort) { - qsort((void *) SwigPtrTable, SwigPtrN, sizeof(SwigPtrType), swigsort); + qsort((void *) SwigPtrTable, SwigPtrN, sizeof(SwigPtrType), swigsort); for (i = 0; i < 256; i++) SwigStart[i] = SwigPtrN; for (i = SwigPtrN-1; i >= 0; i--) SwigStart[(int) (SwigPtrTable[i].name[1])] = i; for (i = 255; i >= 1; i--) { @@ -388,7 +388,7 @@ SWIG_GetPtr(char *c, void **ptr, char *t) start++; } return c; -} +} /* New object-based GetPointer function. This uses the Python abstract * object interface to automatically dereference the 'this' attribute @@ -399,8 +399,8 @@ SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type) { PyObject *sobj = obj; char *str; if (!PyString_Check(obj)) { - sobj = PyObject_GetAttrString(obj,"this"); - if (!sobj) return ""; + if (!PyInstance_Check(obj) || !(sobj = PyObject_GetAttrString(obj,"this"))) + return ""; } str = PyString_AsString(sobj); return SWIG_GetPtr(str,ptr,type);