[pywin32-checkins] pywin32/com/win32com/src/extensions PyILockBytes.cpp, 1.2, 1.3
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2007-07-02 03:19:53
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7542/com/win32com/src/extensions Modified Files: PyILockBytes.cpp Log Message: A couple 's#' fixes Index: PyILockBytes.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyILockBytes.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyILockBytes.cpp 19 Nov 1999 04:03:23 -0000 1.2 --- PyILockBytes.cpp 2 Jul 2007 03:19:53 -0000 1.3 *************** *** 64,76 **** // @pyparm <o ULARGE_INTEGER>|ulOffset||Offset to write at. // @pyparm string|data||Data to write ! PyObject *obulOffset; ! char *pv; ULONG cb; ! if ( !PyArg_ParseTuple(args, "Os#:WriteAt", &obulOffset, &pv, &cb) ) return NULL; ULARGE_INTEGER ulOffset; ! BOOL bPythonIsHappy = TRUE; ! if (!PyWinObject_AsULARGE_INTEGER(obulOffset, &ulOffset)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) return NULL; ULONG pcbWritten; PY_INTERFACE_PRECALL; --- 64,77 ---- // @pyparm <o ULARGE_INTEGER>|ulOffset||Offset to write at. // @pyparm string|data||Data to write ! PyObject *obulOffset, *obpv; ! void *pv; ULONG cb; ! if ( !PyArg_ParseTuple(args, "OO:WriteAt", &obulOffset, &obpv)) return NULL; ULARGE_INTEGER ulOffset; ! if (!PyWinObject_AsULARGE_INTEGER(obulOffset, &ulOffset)) ! return NULL; ! if (!PyWinObject_AsReadBuffer(obpv, &pv, &cb, FALSE)) ! return NULL; ULONG pcbWritten; PY_INTERFACE_PRECALL; *************** *** 81,86 **** // @rdesc The result is the number of bytes actually written. ! PyObject *pyretval = Py_BuildValue("i", pcbWritten); ! return pyretval; } --- 82,86 ---- // @rdesc The result is the number of bytes actually written. ! return PyLong_FromUnsignedLong(pcbWritten); } *************** *** 277,283 **** PY_GATEWAY_METHOD; PyObject *obulOffset = PyWinObject_FromULARGE_INTEGER(ulOffset); PyObject *result; ! HRESULT hr=InvokeViaPolicy("WriteAt", &result, "Os#", obulOffset, (char *)pv, cb); Py_XDECREF(obulOffset); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params --- 277,285 ---- PY_GATEWAY_METHOD; PyObject *obulOffset = PyWinObject_FromULARGE_INTEGER(ulOffset); + PyObject *obbuf = PyString_FromStringAndSize((char *)pv, cb); PyObject *result; ! HRESULT hr=InvokeViaPolicy("WriteAt", &result, "OO", obulOffset, obbuf); Py_XDECREF(obulOffset); + Py_XDECREF(obbuf); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params |