[pywin32-checkins] pywin32/win32/src PyIID.cpp,1.8.2.1,1.8.2.2
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-10-03 04:21:32
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20398/win32/src Modified Files: Tag: py3k PyIID.cpp Log Message: Simplify PyIID::str() Index: PyIID.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyIID.cpp,v retrieving revision 1.8.2.1 retrieving revision 1.8.2.2 diff -C2 -d -r1.8.2.1 -r1.8.2.2 *** PyIID.cpp 29 Aug 2008 04:59:25 -0000 1.8.2.1 --- PyIID.cpp 3 Oct 2008 04:21:29 -0000 1.8.2.2 *************** *** 104,124 **** } ! PyObject *PyWinStringObject_FromIID(const IID &riid) ! { ! OLECHAR oleRes[128]; ! if (StringFromGUID2(riid, oleRes, sizeof(oleRes))==0) { ! // Should never happen - 128 should be heaps big enough. ! PyErr_SetString(PyExc_ValueError, "The string is too long"); ! return NULL; ! } ! char *szResult; ! if (!PyWin_WCHAR_AsString(oleRes, (DWORD)-1, &szResult)) ! return NULL; ! PyObject *rc = PyString_FromString(szResult); ! PyWinObject_FreeString(szResult); ! return rc; ! } ! ! PyObject *PyWinUnicodeObject_FromIID(const IID &riid) { OLECHAR oleRes[128]; --- 104,108 ---- } ! PyObject *PyWinCoreString_FromIID(const IID &riid) { OLECHAR oleRes[128]; *************** *** 128,132 **** return NULL; } ! return PyWinObject_FromOLECHAR(oleRes); } --- 112,116 ---- return NULL; } ! return PyWinCoreString_FromString(oleRes); } *************** *** 298,306 **** PyObject *PyIID::str(void) { ! #if (PY_VERSION_HEX < 0x03000000) ! return PyWinStringObject_FromIID(m_iid); ! #else ! return PyWinUnicodeObject_FromIID(m_iid); ! #endif } --- 282,286 ---- PyObject *PyIID::str(void) { ! return PyWinCoreString_FromIID(m_iid); } *************** *** 309,315 **** OLECHAR oleRes[128]; StringFromGUID2(m_iid, oleRes, sizeof(oleRes)); ! TCHAR buf[128]; ! wsprintf(buf, _T("IID('%ws')"), oleRes); ! return PyWinObject_FromTCHAR(buf); } --- 289,295 ---- OLECHAR oleRes[128]; StringFromGUID2(m_iid, oleRes, sizeof(oleRes)); ! WCHAR buf[128]; ! wsprintfW(buf, L"IID('%ws')", oleRes); ! return PyWinCoreString_FromString(buf); } |