[pywin32-checkins] pywin32/isapi/src PyFilterObjects.cpp,1.1,1.2
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2004-10-26 01:30:39
|
Update of /cvsroot/pywin32/pywin32/isapi/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21723 Modified Files: PyFilterObjects.cpp Log Message: Allow GetHeader to specify a default value. Index: PyFilterObjects.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyFilterObjects.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyFilterObjects.cpp 6 Oct 2004 05:11:53 -0000 1.1 --- PyFilterObjects.cpp 26 Oct 2004 01:30:30 -0000 1.2 *************** *** 478,483 **** DWORD bufSize = sizeof(buffer) / sizeof(TCHAR); char *name; // @pyparm string|header|| ! if (!PyArg_ParseTuple(args, "s:GetHeader", &name)) return NULL; BOOL ok; --- 478,485 ---- DWORD bufSize = sizeof(buffer) / sizeof(TCHAR); char *name; + PyObject *def = NULL; // @pyparm string|header|| ! // @pyparm object|default||If specified, this will be returned on error. ! if (!PyArg_ParseTuple(args, "s|O:GetHeader", &name, &def)) return NULL; BOOL ok; *************** *** 489,494 **** ok = pp->GetHeader(pfc, name, buffer, &bufSize); Py_END_ALLOW_THREADS ! if (!ok) ! return SetPyHFCError("GetHeader"); return PyString_FromStringAndSize(buffer, bufSize-1); } --- 491,500 ---- ok = pp->GetHeader(pfc, name, buffer, &bufSize); Py_END_ALLOW_THREADS ! if (!ok || bufSize==0) { ! if (def == NULL) ! return SetPyHFCError("GetHeader"); ! Py_INCREF(def); ! return def; ! } return PyString_FromStringAndSize(buffer, bufSize-1); } |