[Informixdb-cvs] informixdb/ext _informixdb.ec,1.72,1.73
Brought to you by:
chaese,
f-apolloner
From: Carsten H. <ch...@us...> - 2006-09-23 15:55:57
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv985/ext Modified Files: _informixdb.ec Log Message: Necessary changes for Python 2.5 compatibility Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** _informixdb.ec 22 Sep 2006 00:12:09 -0000 1.72 --- _informixdb.ec 23 Sep 2006 15:55:43 -0000 1.73 *************** *** 2,6 **** * Copyright (c) 1997 by IV DocEye AB * Copyright (c) 1999 by Stephen J. Turner ! * Copyright (c) 2005 by Carsten Haese * * By obtaining, using, and/or copying this software and/or its --- 2,6 ---- * Copyright (c) 1997 by IV DocEye AB * Copyright (c) 1999 by Stephen J. Turner ! * Copyright (c) 2006 by Carsten Haese * * By obtaining, using, and/or copying this software and/or its *************** *** 40,43 **** --- 40,49 ---- #undef loc_t + /* Make sure that we can use Py_ssize_t the way Python 2.5 expects us to + while remaining compatible with older Python versions. */ + #if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #endif + #define _da_free(x) free(x) #define _loc_free(x) free(x) *************** *** 1186,1190 **** { char *buf; ! int n; loc_t *loc; --- 1192,1196 ---- { char *buf; ! Py_ssize_t n; loc_t *loc; *************** *** 1195,1205 **** loc = (loc_t*) malloc(sizeof(loc_t)); loc->loc_loctype = LOCMEMORY; ! loc->loc_buffer = malloc(n); ! loc->loc_bufsize = n; ! loc->loc_size = n; loc->loc_oflags = 0; loc->loc_mflags = 0; loc->loc_indicator = 0; ! memcpy(loc->loc_buffer, buf, n); var->sqldata = (char *) loc; --- 1201,1211 ---- loc = (loc_t*) malloc(sizeof(loc_t)); loc->loc_loctype = LOCMEMORY; ! loc->loc_buffer = malloc((int)n); ! loc->loc_bufsize = (int)n; ! loc->loc_size = (int)n; loc->loc_oflags = 0; loc->loc_mflags = 0; loc->loc_indicator = 0; ! memcpy(loc->loc_buffer, buf, (int)n); var->sqldata = (char *) loc; *************** *** 1475,1479 **** { struct sqlvar_struct *var = cur->daIn.sqlvar; ! int n_vars = vars ? PyObject_Length(vars) : 0; int i; int maxp=0; --- 1481,1485 ---- { struct sqlvar_struct *var = cur->daIn.sqlvar; ! int n_vars = vars ? (int)PyObject_Length(vars) : 0; int i; int maxp=0; *************** *** 2159,2163 **** PyObject *buffer; char *b_mem; ! int b_len; loc_t *l = (loc_t*)data; --- 2165,2169 ---- PyObject *buffer; char *b_mem; ! Py_ssize_t b_len; loc_t *l = (loc_t*)data; *************** *** 2170,2174 **** } ! memcpy(b_mem, l->loc_buffer, b_len); return buffer; } /* case SQLTEXT */ --- 2176,2180 ---- } ! memcpy(b_mem, l->loc_buffer, (int)b_len); return buffer; } /* case SQLTEXT */ *************** *** 2261,2265 **** Py_INCREF(self); PyTuple_SET_ITEM(a, 0, (PyObject*)self); ! for (i = 0; i < PyTuple_Size(args); ++i) { PyObject *o = PyTuple_GetItem(args, i); Py_INCREF(o); --- 2267,2271 ---- Py_INCREF(self); PyTuple_SET_ITEM(a, 0, (PyObject*)self); ! for (i = 0; i < (int)PyTuple_Size(args); ++i) { PyObject *o = PyTuple_GetItem(args, i); Py_INCREF(o); *************** *** 2284,2288 **** PyTuple_SET_ITEM(a, 0, (PyObject*)self); PyTuple_SET_ITEM(a, 1, PyInt_FromLong(1)); ! for (i = 0; i < PyTuple_Size(args); ++i) { PyObject *o = PyTuple_GetItem(args, i); Py_INCREF(o); --- 2290,2294 ---- PyTuple_SET_ITEM(a, 0, (PyObject*)self); PyTuple_SET_ITEM(a, 1, PyInt_FromLong(1)); ! for (i = 0; i < (int)PyTuple_Size(args); ++i) { PyObject *o = PyTuple_GetItem(args, i); Py_INCREF(o); *************** *** 2761,2765 **** } ! p_count = PySequence_Length(params); p_str = malloc(p_count * 2); --- 2767,2771 ---- } ! p_count = (int)PySequence_Length(params); p_str = malloc(p_count * 2); *************** *** 2929,2933 **** f = PyString_FromString("%s: %s\n"); ! for (i = 0; i < PyList_Size(diags); ++i) { PyObject* d = PyList_GetItem(diags, i); a = Py_BuildValue("(OO)", PyDict_GetItemString(d, "sqlstate"), --- 2935,2939 ---- f = PyString_FromString("%s: %s\n"); ! for (i = 0; i < (int)PyList_Size(diags); ++i) { PyObject* d = PyList_GetItem(diags, i); a = Py_BuildValue("(OO)", PyDict_GetItemString(d, "sqlstate"), |