[pywin32-checkins] pywin32/Pythonwin win32ui.h, 1.8, 1.9 win32virt.cpp, 1.7, 1.8
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-12-06 00:35:27
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20707/Pythonwin Modified Files: win32ui.h win32virt.cpp Log Message: Remove plain 'char *' and 'WCHAR *' retval helpers as they make memory management with auto unicode conversions impossible. Index: win32ui.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ui.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** win32ui.h 13 Nov 2008 04:04:50 -0000 1.8 --- win32ui.h 6 Dec 2008 00:35:20 -0000 1.9 *************** *** 314,319 **** BOOL retval( PyObject* &ret ); BOOL retval( CREATESTRUCT &cs ); ! BOOL retval( char * &ret ); ! BOOL retval( WCHAR *&ret ); BOOL retval( CString &ret ); BOOL retval( MSG *msg); --- 314,320 ---- BOOL retval( PyObject* &ret ); BOOL retval( CREATESTRUCT &cs ); ! // Note the lack of 'char *' or 'WCHAR *' support - this makes it ! // too hard for memory management when converting between strings and ! // unicode. Use the CString one instead. BOOL retval( CString &ret ); BOOL retval( MSG *msg); Index: win32virt.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32virt.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** win32virt.cpp 13 Nov 2008 04:04:50 -0000 1.7 --- win32virt.cpp 6 Dec 2008 00:35:20 -0000 1.8 *************** *** 545,580 **** } - BOOL CVirtualHelper::retval( char *&ret ) - { - ASSERT(retVal); - if (!retVal) - return FALSE; // failed - assume didnt work in non debug - if (retVal==Py_None) { - ret = NULL; - return TRUE; - } - CEnterLeavePython _celp; - ret = PyString_AsString(retVal); - if (ret == NULL) { - gui_print_error(); - return FALSE; - } - return TRUE; - } - - BOOL CVirtualHelper::retval(WCHAR *&ret ) - { - ASSERT(retVal); - if (!retVal) - return FALSE; // failed - assume didnt work in non debug - CEnterLeavePython _celp; - // ??? This leaks memory, but this overload is not actually used anywhere ??? - if (!PyWinObject_AsWCHAR(retVal, &ret, TRUE)){ - gui_print_error(); - return FALSE; - } - return TRUE; - } - BOOL CVirtualHelper::retval( CString &ret ) { --- 545,548 ---- |