[pywin32-checkins] pywin32/win32/src PyWinTypesmodule.cpp, 1.49, 1.50
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2009-02-03 05:16:50
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23500/win32/src Modified Files: PyWinTypesmodule.cpp Log Message: Have UnicodeFromRaw use PyWinObject_AsReadBuffer() so it works with memory views. Index: PyWinTypesmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** PyWinTypesmodule.cpp 26 Jan 2009 00:12:35 -0000 1.49 --- PyWinTypesmodule.cpp 3 Feb 2009 05:16:44 -0000 1.50 *************** *** 379,389 **** static PyObject *PyWin_NewUnicodeFromRaw(PyObject *self, PyObject *args) { ! const char * value; ! unsigned int numBytes; ! // @pyparm string|str||The string containing the binary data. ! if (!PyArg_ParseTuple(args, "s#", &value, &numBytes)) return NULL; ! return PyWinObject_FromOLECHAR( (OLECHAR *)value, numBytes/sizeof(OLECHAR) ); } --- 379,392 ---- static PyObject *PyWin_NewUnicodeFromRaw(PyObject *self, PyObject *args) { ! PyObject *ob; ! // @pyparm string/buffer|str||The string containing the binary data. ! if (!PyArg_ParseTuple(args, "O", &ob)) return NULL; ! void *buf; ! DWORD nbytes; ! if (!PyWinObject_AsReadBuffer(ob, &buf, &nbytes, FALSE)) ! return NULL; ! return PyWinObject_FromWCHAR((WCHAR *)buf, nbytes/sizeof(OLECHAR) ); } |