From: Billy G. A. <bal...@us...> - 2005-03-01 21:07:10
|
Update of /cvsroot/pypgsql/pypgsql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25157 Modified Files: libpqmodule.c pgversion.c Log Message: 01MAR2005 bga Implemented most outstanding bug fixes and patches. Index: libpqmodule.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/libpqmodule.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** libpqmodule.c 10 Nov 2003 05:11:00 -0000 1.30 --- libpqmodule.c 1 Mar 2005 21:06:43 -0000 1.31 *************** *** 382,386 **** PyObject *result; ! slen = strlen(sin); sout = (char *)PyMem_Malloc(slen); if (sout == (char *)NULL) --- 382,386 ---- PyObject *result; ! slen = strlen(sin) + 1; sout = (char *)PyMem_Malloc(slen); if (sout == (char *)NULL) *************** *** 791,795 **** } ! PyErr_SetString(PyExc_TypeError, "a string or numeric is requireed"); return (PyObject *)NULL; } --- 791,795 ---- } ! PyErr_SetString(PyExc_TypeError, "a string or numeric is required"); return (PyObject *)NULL; } *************** *** 855,859 **** } ! PyErr_SetString(PyExc_TypeError, "a string or numeric is requireed"); return (PyObject *)NULL; } --- 855,859 ---- } ! PyErr_SetString(PyExc_TypeError, "a string or numeric is required"); return (PyObject *)NULL; } *************** *** 907,911 **** } ! PyErr_SetString(PyExc_TypeError, "a string or numeric is requireed"); return (PyObject *)NULL; } --- 907,911 ---- } ! PyErr_SetString(PyExc_TypeError, "a string or numeric is required"); return (PyObject *)NULL; } Index: pgversion.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgversion.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** pgversion.c 6 Oct 2003 19:40:23 -0000 1.21 --- pgversion.c 1 Mar 2005 21:06:44 -0000 1.22 *************** *** 176,199 **** return 1; errno = 0; *result = strtol(token, &last, 0); - /* Allow for development versions */ - if (pgstricmp(last, "devel") == 0) - return (errno != 0); - - /* Allow for alpha and beta versions */ - if (((*last == 'a') || (*last == 'b')) && isdigit(*(last+1))) - return (errno != 0); - - if ((pgstricmp(last, "alpha") == 0) || - (pgstricmp(last, "beta") == 0)) - return (errno != 0); - - /* Allow for release canidates */ - if ((*last == 'r') && (*(last+1) == 'c') && isdigit(*(last+2))) - return (errno != 0); - return ((errno != 0) || (*last != (char)0)); } --- 176,195 ---- return 1; + /** + * Only process the numeric part of the token, ignoring the + * non-numeric trailing part. This should handle development, + * alpha, beta, etc versions of PostgreSQL + */ + int i; + for (i = 1; token[i] != 0; i++) { + if (!isdigit(token[i])) { + token[i] = 0; + break; + } + } errno = 0; *result = strtol(token, &last, 0); return ((errno != 0) || (*last != (char)0)); } *************** *** 291,299 **** goto new_error; ! token = pg_strtok_r((char *)NULL, ".", &save_ptr); if ((token != (char *)NULL) && (*token != '\0') && ! (parseToken(token, &patch))) goto new_error; ! value = (((major * 100) + minor) * 100) + patch; --- 287,297 ---- goto new_error; ! token = pg_strtok_r((char *)NULL, ".-", &save_ptr); if ((token != (char *)NULL) && (*token != '\0') && ! (parseToken(token, &patch))) ! { goto new_error; ! } ! value = (((major * 100) + minor) * 100) + patch; |