[ctypes-commit] ctypes/source callproc.c,1.119,1.120
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2004-12-02 19:12:51
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5914 Modified Files: callproc.c Log Message: More refactoring Index: callproc.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callproc.c,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** callproc.c 2 Dec 2004 19:02:44 -0000 1.119 --- callproc.c 2 Dec 2004 19:12:28 -0000 1.120 *************** *** 703,712 **** * Convert the C value in result into an instance described by restype */ ! static PyObject *GetResult(PyObject *restype, ffi_type *ffi_type, union result *result) { StgDictObject *dict; if (restype == NULL) { ! return getentry("i")->getfunc(&result->l, sizeof(int)); } --- 703,712 ---- * Convert the C value in result into an instance described by restype */ ! static PyObject *GetResult(PyObject *restype, ffi_type *ffi_type, void *result) { StgDictObject *dict; if (restype == NULL) { ! return getentry("i")->getfunc(result, sizeof(int)); } *************** *** 749,766 **** switch (dict->size) { case 1: ! c = (char)result->l; retval = dict->getfunc(&c, dict->size); break; case SIZEOF_SHORT: ! s = (short)result->l; retval = dict->getfunc(&s, dict->size); break; case SIZEOF_INT: ! i = (int)result->l; retval = dict->getfunc(&i, dict->size); break; #if (SIZEOF_LONG != SIZEOF_INT) case SIZEOF_LONG: ! l = (long)result->l; retval = dict->getfunc(&l, dict->size); break; --- 749,766 ---- switch (dict->size) { case 1: ! c = (char)*(long *)result; retval = dict->getfunc(&c, dict->size); break; case SIZEOF_SHORT: ! s = (short)*(long *)result; retval = dict->getfunc(&s, dict->size); break; case SIZEOF_INT: ! i = (int)*(long *)result; retval = dict->getfunc(&i, dict->size); break; #if (SIZEOF_LONG != SIZEOF_INT) case SIZEOF_LONG: ! l = (long)*(long *)result; retval = dict->getfunc(&l, dict->size); break; *************** *** 784,788 **** if (PyCallable_Check(restype)) return PyObject_CallFunction(restype, "i", ! result->i); PyErr_SetString(PyExc_TypeError, "Bug: cannot convert result"); --- 784,788 ---- if (PyCallable_Check(restype)) return PyObject_CallFunction(restype, "i", ! *(int *)result); PyErr_SetString(PyExc_TypeError, "Bug: cannot convert result"); |