[pywin32-checkins] pywin32/com/win32comext/shell/src PyIShellBrowser.cpp, 1.7, 1.8
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2007-02-20 10:10:24
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17845/com/win32comext/shell/src Modified Files: PyIShellBrowser.cpp Log Message: Use PyWinObject_AsPARAM for WPARAM/LPARAM Index: PyIShellBrowser.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellBrowser.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyIShellBrowser.cpp 27 Jan 2007 20:09:20 -0000 1.7 --- PyIShellBrowser.cpp 20 Feb 2007 10:10:23 -0000 1.8 *************** *** 261,297 **** } - // Little helper stolen from win32gui - // Need to change win32gui also, or move this function into pywintypes - static BOOL make_param(PyObject *ob, WPARAM *pparam) - { - if (ob==NULL || ob==Py_None){ - *pparam=NULL; - return TRUE; - } - #ifdef UNICODE - #define TCHAR_DESC "Unicode" - if (PyUnicode_Check(ob)){ - *pparam = (WPARAM)PyUnicode_AS_UNICODE(ob); - return TRUE; - } - #else - #define TCHAR_DESC "String" - if (PyString_Check(ob)){ - *pparam = (WPARAM)PyString_AS_STRING(ob); - return TRUE; - } - #endif - *pparam=(WPARAM)PyLong_AsVoidPtr(ob); - if ((*pparam!=NULL) || !PyErr_Occurred()) - return TRUE; - - PyErr_Clear(); - PyBufferProcs *pb = ob->ob_type->tp_as_buffer; - if (pb != NULL && pb->bf_getreadbuffer) - return pb->bf_getreadbuffer(ob,0,(VOID **)pparam)!=-1; - PyErr_SetString(PyExc_TypeError, "Must be a" TCHAR_DESC ", int, or buffer object"); - return FALSE; - } - // @pymethod int|PyIShellBrowser|SendControlMsg|Sends a control msg to browser's toolbar or status bar PyObject *PyIShellBrowser::SendControlMsg(PyObject *self, PyObject *args) --- 261,264 ---- *************** *** 311,318 **** WPARAM wParam; LPARAM lParam; ! if (!make_param(obwparam, &wParam)) return NULL; // WPARAM and LPARAM are defined as UINT_PTR and LONG_PTR, so they can't be used interchangeably without a cast ! if (!make_param(oblparam, (WPARAM *)&lParam)) return NULL; --- 278,285 ---- WPARAM wParam; LPARAM lParam; ! if (!PyWinObject_AsPARAM(obwparam, &wParam)) return NULL; // WPARAM and LPARAM are defined as UINT_PTR and LONG_PTR, so they can't be used interchangeably without a cast ! if (!PyWinObject_AsPARAM(oblparam, (WPARAM *)&lParam)) return NULL; |