Update of /cvsroot/pywin32/pywin32/Pythonwin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3666
Modified Files:
Win32uiHostGlue.h dibapi.cpp win32ImageList.cpp win32app.cpp
win32bitmap.cpp win32brush.cpp win32cmd.cpp win32control.cpp
win32ctrlList.cpp win32ctrlRichEdit.cpp win32ctrlTree.cpp
win32dc.cpp win32dlg.cpp win32font.cpp win32menu.cpp
win32notify.cpp win32prinfo.cpp win32prop.cpp win32toolbar.cpp
win32ui.h win32uiExt.h win32uimodule.cpp win32util.cpp
win32virt.cpp win32win.cpp win32win.h
Log Message:
Lots of 64bit changes.
Index: win32win.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32win.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** win32win.cpp 24 May 2007 12:50:50 -0000 1.13
--- win32win.cpp 3 Jun 2007 12:35:58 -0000 1.14
***************
*** 54,58 ****
void OnClose()
{ CWnd::OnClose(); }
! UINT OnNcHitTest(CPoint point)
{ return CWnd::OnNcHitTest(point);}
BOOL OnSetCursor( CWnd *pWnd, UINT ht, UINT msg)
--- 54,58 ----
void OnClose()
{ CWnd::OnClose(); }
! LRESULT OnNcHitTest(CPoint point)
{ return CWnd::OnNcHitTest(point);}
BOOL OnSetCursor( CWnd *pWnd, UINT ht, UINT msg)
***************
*** 105,111 ****
CWnd *GetWndPtrFromParam(PyObject *ob, ui_type_CObject &type)
{
! if (PyInt_Check(ob)) {
! HWND hwnd = (HWND)PyInt_AsLong(ob);
! if (!IsWindow(hwnd))
RETURN_ERR(szErrMsgBadHandle);
CWnd *ret = CWnd::FromHandle(hwnd);
--- 105,111 ----
CWnd *GetWndPtrFromParam(PyObject *ob, ui_type_CObject &type)
{
! if (PyInt_Check(ob) || PyLong_Check(ob)) {
! HWND hwnd = 0;
! if (!PyWinObject_AsHANDLE(ob, (HANDLE *)&hwnd) || !IsWindow(hwnd))
RETURN_ERR(szErrMsgBadHandle);
CWnd *ret = CWnd::FromHandle(hwnd);
***************
*** 171,175 ****
{
PyObject *ob;
! int len = PyTuple_Size(args);
if (len<1 || len > 5) {
PyErr_SetString(PyExc_TypeError, "SCROLLINFO tuple has invalid size");
--- 171,175 ----
{
PyObject *ob;
! Py_ssize_t len = PyTuple_Size(args);
if (len<1 || len > 5) {
PyErr_SetString(PyExc_TypeError, "SCROLLINFO tuple has invalid size");
***************
*** 378,384 ****
PyCWnd::CreateWindowFromHandle(PyObject *self, PyObject *args)
{
! int hwnd;
! if (!PyArg_ParseTuple(args, "i:CreateWindowFromHandle",
! &hwnd)) // @pyparm int|hwnd||The window handle.
return NULL;
CWnd *pWnd = CWnd::FromHandle((HWND)hwnd);
--- 378,387 ----
PyCWnd::CreateWindowFromHandle(PyObject *self, PyObject *args)
{
! PyObject *obhwnd;
! if (!PyArg_ParseTuple(args, "O:CreateWindowFromHandle",
! &obhwnd)) // @pyparm int|hwnd||The window handle.
! return NULL;
! HWND hwnd;
! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd))
return NULL;
CWnd *pWnd = CWnd::FromHandle((HWND)hwnd);
***************
*** 554,566 ****
}
! BOOL PyCWnd::check_key_stroke(UINT ch)
{
PyObject *pythonObject;
BOOL bCallBase = TRUE;
if (obKeyStrokeHandler!= NULL)
! bCallBase = Python_callback(obKeyStrokeHandler, (int)ch);
if (bCallBase && pKeyHookList && pKeyHookList->Lookup((WORD)ch, (void *&)pythonObject))
! bCallBase = Python_callback(pythonObject,(int)ch);
return bCallBase;
}
--- 557,569 ----
}
! BOOL PyCWnd::check_key_stroke(WPARAM ch)
{
PyObject *pythonObject;
BOOL bCallBase = TRUE;
if (obKeyStrokeHandler!= NULL)
! bCallBase = Python_callback(obKeyStrokeHandler, ch);
if (bCallBase && pKeyHookList && pKeyHookList->Lookup((WORD)ch, (void *&)pythonObject))
! bCallBase = Python_callback(pythonObject,ch);
return bCallBase;
}
***************
*** 615,619 ****
pSearch = CWnd::FromHandlePermanent(wnd);
// FromHandlePerm is thread specific!
! if (pSearch==NULL && GetWindowLong(wnd, GWLP_WNDPROC)==(LONG)AfxGetAfxWndProc()) {
/*******
--- 618,622 ----
pSearch = CWnd::FromHandlePermanent(wnd);
// FromHandlePerm is thread specific!
! if (pSearch==NULL && GetWindowLongPtr(wnd, GWLP_WNDPROC)==(LONG_PTR)AfxGetAfxWndProc()) {
/*******
***************
*** 788,794 ****
return NULL;
GUI_BGN_SAVE;
! long rc = ((WndHack *)pWnd)->DefWindowProc(message, (WPARAM)wparam, (LPARAM)lparam);
GUI_END_SAVE;
! return Py_BuildValue("l", rc); // @pyseemfc CWnd|DefWindowProc
}
--- 791,797 ----
return NULL;
GUI_BGN_SAVE;
! LRESULT rc = ((WndHack *)pWnd)->DefWindowProc(message, (WPARAM)wparam, (LPARAM)lparam);
GUI_END_SAVE;
! return PyWinObject_FromPARAM(rc); // @pyseemfc CWnd|DefWindowProc
}
***************
*** 860,864 ****
--- 863,871 ----
char buf[MAX_PATH];
GUI_BGN_SAVE;
+ #if _MFC_VER >= 0x0800
+ rc = pWnd->DlgDirSelect( buf, sizeof(buf), nIDListBox);
+ #else
rc = pWnd->DlgDirSelect( buf, nIDListBox);
+ #endif
// @pyseemfc CWnd|DlgDirSelect
GUI_END_SAVE;
***************
*** 883,887 ****
--- 890,898 ----
GUI_BGN_SAVE;
// @pyseemfc CWnd|DlgDirSelectComboBox
+ #if _MFC_VER >= 0x0800
+ rc = pWnd->DlgDirSelectComboBox( buf, sizeof(buf), nIDListBox);
+ #else
rc = pWnd->DlgDirSelectComboBox( buf, nIDListBox);
+ #endif
GUI_END_SAVE;
if (!rc)
***************
*** 1268,1272 ****
HWND hwnd = pWnd->GetSafeHwnd();
GUI_END_SAVE;
! return Py_BuildValue("l", (long)hwnd);
}
--- 1279,1283 ----
HWND hwnd = pWnd->GetSafeHwnd();
GUI_END_SAVE;
! return PyWinLong_FromHANDLE(hwnd);
}
***************
*** 1761,1765 ****
GUI_END_SAVE;
// @pyseemfc CWnd|OnCtlColor
! return Py_BuildValue("i", (int)brush);
}
--- 1772,1776 ----
GUI_END_SAVE;
// @pyseemfc CWnd|OnCtlColor
! return PyWinLong_FromHANDLE(brush);
}
***************
*** 1799,1803 ****
HICON rc = pWnd->OnQueryDragIcon();
GUI_END_SAVE;
! return Py_BuildValue("i", (int)rc);
}
--- 1810,1814 ----
HICON rc = pWnd->OnQueryDragIcon();
GUI_END_SAVE;
! return PyWinLong_FromHANDLE(rc);
}
***************
*** 1863,1867 ****
// return value from the MFC function call, and the value of the
// lResult param. Please see the MFC documentation for more details.
! return Py_BuildValue("ii", rc, (int)res);
RETURN_NONE;
}
--- 1874,1878 ----
// return value from the MFC function call, and the value of the
// lResult param. Please see the MFC documentation for more details.
! return Py_BuildValue("iN", rc, PyWinObject_FromPARAM(res));
RETURN_NONE;
}
***************
*** 2186,2202 ****
PyErr_Clear();
void *p;
! if (!PyArg_ParseTuple(args, "is#",
&message, // @pyparmalt1 int|idMessage||The ID of the message to send.
! &p, &wParam )) // @pyparmalt1 buffer|ob||A buffer whose size is passed in wParam, and address is passed in lParam
return NULL;
lp = (LPARAM)p;
wp = (WPARAM)wParam;
}
! int rc;
GUI_BGN_SAVE;
// @pyseemfc CWnd|SendMessage
rc = pWnd->SendMessage(message, wp, lp);
GUI_END_SAVE;
! return PyInt_FromLong(rc);
}
// @pymethod |PyCWnd|SendMessageToDescendants|Send a message to all descendant windows.
--- 2197,2216 ----
PyErr_Clear();
void *p;
! PyObject *obParam;
! if (!PyArg_ParseTuple(args, "iO",
&message, // @pyparmalt1 int|idMessage||The ID of the message to send.
! &obParam)) // @pyparmalt1 buffer|ob||A buffer whose size is passed in wParam, and address is passed in lParam
! return NULL;
! if (!PyWinObject_AsReadBuffer(obParam, &p, &wParam))
return NULL;
lp = (LPARAM)p;
wp = (WPARAM)wParam;
}
! LRESULT rc;
GUI_BGN_SAVE;
// @pyseemfc CWnd|SendMessage
rc = pWnd->SendMessage(message, wp, lp);
GUI_END_SAVE;
! return PyWinObject_FromPARAM(rc);
}
// @pymethod |PyCWnd|SendMessageToDescendants|Send a message to all descendant windows.
***************
*** 2586,2590 ****
RETURN_ERR("BeginPaint failed");
PyObject *obDC = ui_assoc_object::make (ui_dc_object::type, pTemp)->GetGoodRet();
! PyObject *obRet = Py_BuildValue("O(ii(iiii)iis#)", obDC,
ps.hdc,
ps.fErase,
--- 2600,2604 ----
RETURN_ERR("BeginPaint failed");
PyObject *obDC = ui_assoc_object::make (ui_dc_object::type, pTemp)->GetGoodRet();
! PyObject *obRet = Py_BuildValue("O(ii(iiii)iiN)", obDC,
ps.hdc,
ps.fErase,
***************
*** 2592,2596 ****
ps.fRestore,
ps.fIncUpdate,
! ps.rgbReserved, sizeof(ps.rgbReserved));
Py_XDECREF(obDC);
return obRet;
--- 2606,2610 ----
ps.fRestore,
ps.fIncUpdate,
! PyString_FromStringAndSize((char *)ps.rgbReserved, sizeof(ps.rgbReserved)));
Py_XDECREF(obDC);
return obRet;
***************
*** 2797,2802 ****
// Convert the list of point tuples into an array of POINT structs
! int num = PyList_Size (point_list);
! int i;
POINT * point_array = new POINT[num];
for (i=0; i < num; i++)
--- 2811,2816 ----
// Convert the list of point tuples into an array of POINT structs
! Py_ssize_t num = PyList_Size (point_list);
! Py_ssize_t i;
POINT * point_array = new POINT[num];
for (i=0; i < num; i++)
***************
*** 2835,2839 ****
// can finally call the mfc function.
GUI_BGN_SAVE;
! pWnd->MapWindowPoints(pWndTo,point_array, num);
GUI_END_SAVE;
--- 2849,2853 ----
// can finally call the mfc function.
GUI_BGN_SAVE;
! pWnd->MapWindowPoints(pWndTo,point_array, PyWin_SAFE_DOWNCAST(num, Py_ssize_t, UINT));
GUI_END_SAVE;
***************
*** 2864,2870 ****
// @pyseemfc CWnd|SetTimer
GUI_BGN_SAVE;
! UINT id = pWnd->SetTimer(nIDEvent,nElapse,NULL);
GUI_END_SAVE;
! return Py_BuildValue("i", id);
}
--- 2878,2884 ----
// @pyseemfc CWnd|SetTimer
GUI_BGN_SAVE;
! UINT_PTR id = pWnd->SetTimer(nIDEvent,nElapse,NULL);
GUI_END_SAVE;
! return PyWinObject_FromPARAM(id);
}
***************
*** 2968,2974 ****
return NULL;
GUI_BGN_SAVE;
! UINT rc = ((WndHack *)pWnd)->OnNcHitTest(p);
GUI_END_SAVE;
! return PyInt_FromLong(rc);
}
--- 2982,2988 ----
return NULL;
GUI_BGN_SAVE;
! LRESULT rc = ((WndHack *)pWnd)->OnNcHitTest(p);
GUI_END_SAVE;
! return PyWinObject_FromPARAM(rc);
}
***************
*** 3199,3206 ****
CString csRet;
char *buf = csRet.GetBuffer(40);
! int numMsg = pMessageHookList ? pMessageHookList->GetCount() : 0;
! int numKey = pKeyHookList ? pKeyHookList->GetCount() : 0;
char *hookStr = obKeyStrokeHandler ? " (AllKeys Hook Active)" : "";
! sprintf(buf, ", mh=%d, kh=%d%s", numMsg, numKey, hookStr);
csRet.ReleaseBuffer(-1);
return PyCCmdTarget::repr() + csRet;
--- 3213,3220 ----
CString csRet;
char *buf = csRet.GetBuffer(40);
! UINT_PTR numMsg = pMessageHookList ? pMessageHookList->GetCount() : 0;
! UINT_PTR numKey = pKeyHookList ? pKeyHookList->GetCount() : 0;
char *hookStr = obKeyStrokeHandler ? " (AllKeys Hook Active)" : "";
! sprintf(buf, ", mh=%I, kh=%I%s", numMsg, numKey, hookStr);
csRet.ReleaseBuffer(-1);
return PyCCmdTarget::repr() + csRet;
Index: win32ctrlRichEdit.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ctrlRichEdit.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** win32ctrlRichEdit.cpp 24 May 2007 12:50:50 -0000 1.3
--- win32ctrlRichEdit.cpp 3 Jun 2007 12:35:58 -0000 1.4
***************
*** 101,105 ****
} else {
strcpy((char *)pbBuff, s);
! *pcb = strlen(s);
retval = 0;
}
--- 101,105 ----
} else {
strcpy((char *)pbBuff, s);
! *pcb = PyWin_SAFE_DOWNCAST(strlen(s), size_t, DWORD);
retval = 0;
}
***************
*** 739,743 ****
DOINCREF(method);
EDITSTREAM es;
! es.dwCookie = (DWORD)method;
es.dwError = 0;
es.pfnCallback = PyCRichEditCallbackIn;
--- 739,743 ----
DOINCREF(method);
EDITSTREAM es;
! es.dwCookie = (DWORD_PTR)method;
es.dwError = 0;
es.pfnCallback = PyCRichEditCallbackIn;
***************
*** 769,773 ****
EDITSTREAM es;
DOINCREF(method);
! es.dwCookie = (DWORD)method;
es.dwError = 0;
es.pfnCallback = PyCRichEditCallbackOut;
--- 769,773 ----
EDITSTREAM es;
DOINCREF(method);
! es.dwCookie = (DWORD_PTR)method;
es.dwError = 0;
es.pfnCallback = PyCRichEditCallbackOut;
Index: win32uiExt.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uiExt.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** win32uiExt.h 27 May 2007 12:53:48 -0000 1.11
--- win32uiExt.h 3 Jun 2007 12:35:58 -0000 1.12
***************
*** 186,190 ****
// @xref <om PyCWnd.OnCtlColor>
CVirtualHelper helper( "OnCtlColor", this );
! int hRet;
if (helper.HaveHandler() && helper.call(pDC, pWnd, nCtlColor) &&
helper.retval(hRet))
--- 186,190 ----
// @xref <om PyCWnd.OnCtlColor>
CVirtualHelper helper( "OnCtlColor", this );
! HANDLE hRet;
if (helper.HaveHandler() && helper.call(pDC, pWnd, nCtlColor) &&
helper.retval(hRet))
***************
*** 243,247 ****
if (!helper.HaveHandler())
return T::OnQueryDragIcon();
! int ret;
if (!helper.call())
return NULL;
--- 243,247 ----
if (!helper.HaveHandler())
return T::OnQueryDragIcon();
! HANDLE ret;
if (!helper.call())
return NULL;
***************
*** 861,865 ****
afx_msg LRESULT HandleInitDialog(WPARAM, LPARAM) {
PreInitDialog();
! BOOL result = Default();
CVirtualHelper helper( "HandleInitDialog", this );
BOOL hresult;
--- 861,865 ----
afx_msg LRESULT HandleInitDialog(WPARAM, LPARAM) {
PreInitDialog();
! LRESULT result = Default();
CVirtualHelper helper( "HandleInitDialog", this );
BOOL hresult;
Index: win32dlg.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32dlg.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** win32dlg.cpp 21 Jun 2005 08:05:26 -0000 1.8
--- win32dlg.cpp 3 Jun 2007 12:35:58 -0000 1.9
***************
*** 368,374 ****
HWND hwnd = pWnd->GetSafeHwnd();
DWORD dwStyle = ::GetWindowLong(hwnd, GWL_STYLE);
! DWORD dwCode = ::SendMessage(hwnd, WM_GETDLGCODE, 0, 0L);
! BOOL bRadio = dwCode & DLGC_RADIOBUTTON;
! BOOL bCheck = dwStyle & BS_CHECKBOX;
if (!bRadio && !bCheck)
return set_exchange_error("only radios and checkboxes are supported for button controls", index);
--- 368,374 ----
HWND hwnd = pWnd->GetSafeHwnd();
DWORD dwStyle = ::GetWindowLong(hwnd, GWL_STYLE);
! LRESULT dwCode = ::SendMessage(hwnd, WM_GETDLGCODE, 0, 0L);
! BOOL bRadio = (dwCode & DLGC_RADIOBUTTON) != 0;
! BOOL bCheck = (dwStyle & BS_CHECKBOX) != 0;
if (!bRadio && !bCheck)
return set_exchange_error("only radios and checkboxes are supported for button controls", index);
***************
*** 572,581 ****
Py_INCREF(self); // make sure Python doesnt kill the object while in a modal call.
// really only for the common dialog, and other non CPythonDlg's
! int ret;
GUI_BGN_SAVE;
ret = pDlg->DoModal(); // @pyseemfc CDialog|DoModal
GUI_END_SAVE;
DODECREF(self);
! return Py_BuildValue("i", ret);
// @rdesc The return value from the dialog. This is the value passed to <om PyCDialog.EndDialog>.
}
--- 572,581 ----
Py_INCREF(self); // make sure Python doesnt kill the object while in a modal call.
// really only for the common dialog, and other non CPythonDlg's
! INT_PTR ret;
GUI_BGN_SAVE;
ret = pDlg->DoModal(); // @pyseemfc CDialog|DoModal
GUI_END_SAVE;
DODECREF(self);
! return PyWinObject_FromDWORD_PTR(ret);
// @rdesc The return value from the dialog. This is the value passed to <om PyCDialog.EndDialog>.
}
***************
*** 1068,1071 ****
--- 1068,1082 ----
}
+ #define MAKE_INT_PTR_METH(fnname, mfcName) \
+ static PyObject *fnname( PyObject *self, PyObject *args ) { \
+ CHECK_NO_ARGS2(args,mfcName); \
+ CFontDialog *pDlg = GetFontDialog(self); \
+ if (!pDlg) return NULL; \
+ GUI_BGN_SAVE; \
+ INT_PTR ret = pDlg->mfcName(); \
+ GUI_END_SAVE; \
+ return PyWinObject_FromDWORD_PTR(ret); \
+ }
+
// @pymethod string|PyCFontDialog|GetFaceName|Returns the face name of the selected font.
// @pyseemfc CFontDialog|GetFaceName
***************
*** 1101,1105 ****
// @pymethod int|PyCFontDialog|DoModal|Displays a dialog and allows the user to make a selection.
// @pyseemfc CFontDialog|DoModal
! MAKE_INT_METH(ui_font_dialog_do_modal,DoModal)
// @pymethod int|PyCFontDialog|GetColor|Determines the color of the selected font.
--- 1112,1116 ----
// @pymethod int|PyCFontDialog|DoModal|Displays a dialog and allows the user to make a selection.
// @pyseemfc CFontDialog|DoModal
! MAKE_INT_PTR_METH(ui_font_dialog_do_modal,DoModal)
// @pymethod int|PyCFontDialog|GetColor|Determines the color of the selected font.
***************
*** 1224,1228 ****
// @pymethod int|PyCColorDialog|DoModal|Displays a dialog and allows the user to make a selection.
// @pyseemfc CColorDialog|DoModal
! MAKE_INT_METH(ui_color_dialog_do_modal,DoModal)
// @pymethod int|PyCColorDialog|GetColor|Determines the selected color.
--- 1235,1239 ----
// @pymethod int|PyCColorDialog|DoModal|Displays a dialog and allows the user to make a selection.
// @pyseemfc CColorDialog|DoModal
! MAKE_INT_PTR_METH(ui_color_dialog_do_modal,DoModal)
// @pymethod int|PyCColorDialog|GetColor|Determines the selected color.
***************
*** 1281,1285 ****
if (!PyArg_ParseTuple(args, "O", &obCols))
return NULL;
! int len = PySequence_Length(obCols);
if (PyErr_Occurred() || len <= 0 || len > 16) {
PyErr_Clear();
--- 1292,1296 ----
if (!PyArg_ParseTuple(args, "O", &obCols))
return NULL;
! Py_ssize_t len = PySequence_Length(obCols);
if (PyErr_Occurred() || len <= 0 || len > 16) {
PyErr_Clear();
Index: win32ctrlTree.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ctrlTree.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** win32ctrlTree.cpp 3 Nov 2003 07:35:32 -0000 1.4
--- win32ctrlTree.cpp 3 Jun 2007 12:35:58 -0000 1.5
***************
*** 581,587 ****
if (!pList) return NULL;
GUI_BGN_SAVE;
! long rc = pList->GetItemData(item);
GUI_END_SAVE;
! return PyInt_FromLong(rc);
}
--- 581,587 ----
if (!pList) return NULL;
GUI_BGN_SAVE;
! DWORD_PTR rc = pList->GetItemData(item);
GUI_END_SAVE;
! return PyWinObject_FromDWORD_PTR(rc);
}
Index: win32virt.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32virt.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** win32virt.cpp 24 May 2007 12:50:50 -0000 1.5
--- win32virt.cpp 3 Jun 2007 12:35:58 -0000 1.6
***************
*** 427,431 ****
if (!handler) return FALSE;
CEnterLeavePython _celp;
! PyObject *arglst = Py_BuildValue("iill",nID, nCode, (long)pExtra, (long)pHandlerInfo);
BOOL ret = do_call(arglst);
return ret;
--- 427,431 ----
if (!handler) return FALSE;
CEnterLeavePython _celp;
! PyObject *arglst = Py_BuildValue("iiNN",nID, nCode, PyWinLong_FromVoidPtr(pExtra), PyWinLong_FromVoidPtr(pHandlerInfo));
BOOL ret = do_call(arglst);
return ret;
***************
*** 491,494 ****
--- 491,511 ----
}
+ BOOL CVirtualHelper::retval( HANDLE &ret )
+ {
+ ASSERT(retVal);
+ if (!retVal)
+ return FALSE; // failed - assume didnt work in non debug
+ if (retVal==Py_None) {
+ ret = 0;
+ return TRUE;
+ }
+ CEnterLeavePython _celp;
+ if (!PyWinObject_AsHANDLE(retVal, &ret)) {
+ PyErr_Clear();
+ return FALSE;
+ }
+ return TRUE;
+ }
+
BOOL CVirtualHelper::retval( char *&ret )
{
Index: win32prop.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32prop.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** win32prop.cpp 20 Jan 2004 22:28:57 -0000 1.2
--- win32prop.cpp 3 Jun 2007 12:35:58 -0000 1.3
***************
*** 329,338 ****
Py_INCREF(self); // make sure Python doesnt kill the object while in a modal call.
// really only for the common dialog(!?), and other non CPythonPropSheet's
! int ret;
GUI_BGN_SAVE;
ret = pPS->DoModal();
GUI_END_SAVE;
DODECREF(self);
! return Py_BuildValue("i", ret);
}
--- 329,338 ----
Py_INCREF(self); // make sure Python doesnt kill the object while in a modal call.
// really only for the common dialog(!?), and other non CPythonPropSheet's
! INT_PTR ret;
GUI_BGN_SAVE;
ret = pPS->DoModal();
GUI_END_SAVE;
DODECREF(self);
! return PyWinObject_FromDWORD_PTR(ret);
}
***************
*** 754,758 ****
LRESULT result = pPP->CPropertyPage::OnWizardBack();
GUI_END_SAVE;
! return PyInt_FromLong(result);
}
// @pymethod |PyCPropertyPage|OnWizardNext|Calls the default MFC OnWizardNext handler.
--- 754,758 ----
LRESULT result = pPP->CPropertyPage::OnWizardBack();
GUI_END_SAVE;
! return PyWinObject_FromPARAM(result);
}
// @pymethod |PyCPropertyPage|OnWizardNext|Calls the default MFC OnWizardNext handler.
***************
*** 767,771 ****
LRESULT result = pPP->CPropertyPage::OnWizardNext();
GUI_END_SAVE;
! return PyInt_FromLong(result);
}
// @pymethod |PyCPropertyPage|OnWizardFinish|Calls the default MFC OnWizardFinish handler.
--- 767,771 ----
LRESULT result = pPP->CPropertyPage::OnWizardNext();
GUI_END_SAVE;
! return PyWinObject_FromPARAM(result);
}
// @pymethod |PyCPropertyPage|OnWizardFinish|Calls the default MFC OnWizardFinish handler.
Index: win32notify.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32notify.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** win32notify.cpp 1 Sep 1999 23:33:02 -0000 1.1
--- win32notify.cpp 3 Jun 2007 12:35:58 -0000 1.2
***************
*** 171,176 ****
if (!PyString_Check(ob)) MY_RET_ERR("Expected string object")
char *val = PyString_AsString(ob);
! int slen = strlen(val);
! int copylen = max(bufSize-1, slen);
strncpy( pUse, val, copylen);
pUse[copylen] = '\0';
--- 171,176 ----
if (!PyString_Check(ob)) MY_RET_ERR("Expected string object")
char *val = PyString_AsString(ob);
! ssize_t slen = strlen(val);
! ssize_t copylen = max(bufSize-1, slen);
strncpy( pUse, val, copylen);
pUse[copylen] = '\0';
***************
*** 190,194 ****
if (!PyString_Check(ob)) MY_RET_ERR("Expected string object")
char *szVal = PyString_AsString(ob);
! int slen = strlen(szVal);
mbstowcs( (wchar_t *)pUse, szVal, bufSize );
}
--- 190,194 ----
if (!PyString_Check(ob)) MY_RET_ERR("Expected string object")
char *szVal = PyString_AsString(ob);
! ssize_t slen = strlen(szVal);
mbstowcs( (wchar_t *)pUse, szVal, bufSize );
}
***************
*** 284,288 ****
PyObject *ob2;
if (fmt==NULL)
! ob2 = PyInt_FromLong((int)(pHdr + 1));
else
ob2 = PyNotifyMakeExtraTuple(pHdr, fmt);
--- 284,288 ----
PyObject *ob2;
if (fmt==NULL)
! ob2 = PyWinLong_FromVoidPtr(pHdr + 1);
else
ob2 = PyNotifyMakeExtraTuple(pHdr, fmt);
Index: win32app.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32app.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** win32app.cpp 10 Jan 2006 04:39:43 -0000 1.5
--- win32app.cpp 3 Jun 2007 12:35:57 -0000 1.6
***************
*** 283,287 ****
if (hc==0)
RETURN_API_ERR("LoadCursor");
! return PyInt_FromLong((long)hc);
}
--- 283,287 ----
if (hc==0)
RETURN_API_ERR("LoadCursor");
! return PyWinLong_FromHANDLE(hc);
}
***************
*** 305,309 ****
if (hc==0)
RETURN_API_ERR("LoadStandardCursor");
! return PyInt_FromLong((long)hc);
}
--- 305,309 ----
if (hc==0)
RETURN_API_ERR("LoadStandardCursor");
! return PyWinLong_FromHANDLE(hc);
}
***************
*** 319,323 ****
if (hc==0)
RETURN_API_ERR("LoadOEMCursor");
! return PyInt_FromLong((long)hc);
}
--- 319,323 ----
if (hc==0)
RETURN_API_ERR("LoadOEMCursor");
! return PyWinLong_FromHANDLE(hc);
}
Index: win32font.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32font.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** win32font.cpp 5 Mar 2005 04:57:04 -0000 1.3
--- win32font.cpp 3 Jun 2007 12:35:58 -0000 1.4
***************
*** 71,75 ****
CFont *pFont = PyCFont::GetFont(self);
if (pFont==NULL) return NULL;
! return PyInt_FromLong((long)pFont->GetSafeHandle());
}
--- 71,76 ----
CFont *pFont = PyCFont::GetFont(self);
if (pFont==NULL) return NULL;
! return PyWinLong_FromHANDLE(pFont->GetSafeHandle());
! return PyWinLong_FromHANDLE(pFont->GetSafeHandle());
}
Index: win32ImageList.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ImageList.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** win32ImageList.cpp 2 Apr 2000 00:11:48 -0000 1.2
--- win32ImageList.cpp 3 Jun 2007 12:35:57 -0000 1.3
***************
*** 120,150 ****
PyObject *PyCImageList_Add( PyObject *self, PyObject *args )
{
! HICON hIcon;
! int bmp1, bmp2, mask;
CImageList *pList = PyCImageList::GetImageList(self);
int rc;
if (!pList)
return NULL;
! if (PyArg_ParseTuple(args, "(ii)",
! &bmp1, &bmp2)) {// @pyparm (int,int)|bitmap, bitmapMask||2 Bitmaps to use (primary and mask)
! if (!IsGdiHandleValid((HANDLE)bmp1) || !IsGdiHandleValid((HANDLE)bmp2))
RETURN_ERR("One of the bitmap handles is invalid");
GUI_BGN_SAVE;
! rc = pList->Add(CBitmap::FromHandle((HBITMAP)bmp1), CBitmap::FromHandle((HBITMAP)bmp2));
GUI_END_SAVE;
} else {
PyErr_Clear();
! if (PyArg_ParseTuple(args, "ii",
! &bmp1, // @pyparmalt1 int|bitmap||Bitmap to use
&mask)) { // @pyparmalt1 int|color||Color to use for the mask.
! if (!IsGdiHandleValid((HANDLE)bmp1))
RETURN_ERR("The bitmap handle is invalid");
GUI_BGN_SAVE;
! rc = pList->Add(CBitmap::FromHandle((HBITMAP)bmp1), (COLORREF)mask);
GUI_END_SAVE;
} else {
PyErr_Clear();
! if (PyArg_ParseTuple(args, "i",
! &hIcon)) {// @pyparmalt2 int|hIcon||Handle of an icon to add.
GUI_BGN_SAVE;
rc = pList->Add(hIcon);
--- 120,160 ----
PyObject *PyCImageList_Add( PyObject *self, PyObject *args )
{
! PyObject *obbmp1, *obbmp2;
! int mask;
CImageList *pList = PyCImageList::GetImageList(self);
int rc;
if (!pList)
return NULL;
! if (PyArg_ParseTuple(args, "(OO)",
! &obbmp1, &obbmp2)) {// @pyparm (int,int)|bitmap, bitmapMask||2 Bitmaps to use (primary and mask)
! HBITMAP bmp1, bmp2;
! if (!PyWinObject_AsHANDLE(obbmp1, (HANDLE *)&bmp1) || !PyWinObject_AsHANDLE(obbmp2, (HANDLE *)&bmp2))
! return NULL;
! if (!IsGdiHandleValid(bmp1) || !IsGdiHandleValid(bmp2))
RETURN_ERR("One of the bitmap handles is invalid");
GUI_BGN_SAVE;
! rc = pList->Add(CBitmap::FromHandle(bmp1), CBitmap::FromHandle(bmp2));
GUI_END_SAVE;
} else {
PyErr_Clear();
! HBITMAP bmp1;
! if (PyArg_ParseTuple(args, "Oi",
! &obbmp1, // @pyparmalt1 int|bitmap||Bitmap to use
&mask)) { // @pyparmalt1 int|color||Color to use for the mask.
! if (!PyWinObject_AsHANDLE(obbmp1, (HANDLE *)&bmp1))
! return NULL;
! if (!IsGdiHandleValid(bmp1))
RETURN_ERR("The bitmap handle is invalid");
GUI_BGN_SAVE;
! rc = pList->Add(CBitmap::FromHandle(bmp1), (COLORREF)mask);
GUI_END_SAVE;
} else {
PyErr_Clear();
! PyObject *obIcon;
! if (PyArg_ParseTuple(args, "O",
! &obIcon)) {// @pyparmalt2 int|hIcon||Handle of an icon to add.
! HICON hIcon;
! if (!PyWinObject_AsHANDLE(obIcon, (HANDLE *)&hIcon))
! return NULL;
GUI_BGN_SAVE;
rc = pList->Add(hIcon);
Index: dibapi.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/dibapi.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** dibapi.cpp 1 Sep 1999 23:32:59 -0000 1.1
--- dibapi.cpp 3 Jun 2007 12:35:57 -0000 1.2
***************
*** 600,605 ****
BYTE *lpCopy;
BYTE *lp;
! HANDLE hCopy;
! DWORD dwLen;
if (h == NULL)
--- 600,605 ----
BYTE *lpCopy;
BYTE *lp;
! HANDLE hCopy;
! SIZE_T dwLen;
if (h == NULL)
Index: win32control.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32control.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** win32control.cpp 7 Oct 2004 08:41:17 -0000 1.5
--- win32control.cpp 3 Jun 2007 12:35:57 -0000 1.6
***************
*** 215,221 ****
PyCButton_set_bitmap(PyObject *self, PyObject *args)
{
! int hBitmap;
! if (!PyArg_ParseTuple(args, "i",
! &hBitmap)) // @pyparm int|hBitmap|1|Handle of the new bitmap
return NULL;
CButton *pBut = GetButton(self);
--- 215,224 ----
PyCButton_set_bitmap(PyObject *self, PyObject *args)
{
! PyObject *obBitmap;
! if (!PyArg_ParseTuple(args, "O",
! &obBitmap)) // @pyparm int|hBitmap|1|Handle of the new bitmap
! return NULL;
! HBITMAP hBitmap;
! if (!PyWinObject_AsHANDLE(obBitmap, (HANDLE *)&hBitmap))
return NULL;
CButton *pBut = GetButton(self);
***************
*** 223,229 ****
return NULL;
GUI_BGN_SAVE;
! HBITMAP rc = pBut->SetBitmap((HBITMAP) hBitmap);
GUI_END_SAVE;
! return Py_BuildValue("i", (int)rc);
}
// @pymethod int|PyCButton|GetBitmap|Get the button's bitmap
--- 226,232 ----
return NULL;
GUI_BGN_SAVE;
! HBITMAP rc = pBut->SetBitmap(hBitmap);
GUI_END_SAVE;
! return PyWinLong_FromHANDLE(rc);
}
// @pymethod int|PyCButton|GetBitmap|Get the button's bitmap
***************
*** 238,242 ****
HBITMAP rc = pBut->GetBitmap();
GUI_END_SAVE;
! return Py_BuildValue("i", (int)rc);
}
--- 241,245 ----
HBITMAP rc = pBut->GetBitmap();
GUI_END_SAVE;
! return PyWinLong_FromHANDLE(rc);
}
***************
*** 431,440 ****
if (!pLB) return NULL;
GUI_BGN_SAVE;
! long rc = pLB->GetItemData(item);
GUI_END_SAVE;
! PyObject *ret = PyWin_GetPythonObjectFromLong(rc);
! // inc ref count for return value.
! Py_XINCREF(ret);
! return ret;
}
--- 434,440 ----
if (!pLB) return NULL;
GUI_BGN_SAVE;
! DWORD_PTR rc = pLB->GetItemData(item);
GUI_END_SAVE;
! return PyWinObject_FromDWORD_PTR(rc);
}
***************
*** 737,741 ****
if (data==Py_None) data = NULL;
GUI_BGN_SAVE;
! BOOL ok = pLB->SetItemData(item, (DWORD)data);
GUI_END_SAVE;
if (!ok)
--- 737,741 ----
if (data==Py_None) data = NULL;
GUI_BGN_SAVE;
! BOOL ok = pLB->SetItemData(item, (DWORD_PTR)data);
GUI_END_SAVE;
if (!ok)
***************
*** 788,795 ****
if (!PyList_Check(listOb))
RETURN_TYPE_ERR("Param must be a list object");
! int numChildren = PyList_Size(listOb);
int *pArray = new int[numChildren];
int tabVal;
! for (int child=0;child<numChildren;child++) {
PyObject *obChild = PyList_GetItem(listOb, child );
if (!PyArg_Parse( obChild, "i", &tabVal)) {
--- 788,795 ----
if (!PyList_Check(listOb))
RETURN_TYPE_ERR("Param must be a list object");
! Py_ssize_t numChildren = PyList_Size(listOb);
int *pArray = new int[numChildren];
int tabVal;
! for (Py_ssize_t child=0;child<numChildren;child++) {
PyObject *obChild = PyList_GetItem(listOb, child );
if (!PyArg_Parse( obChild, "i", &tabVal)) {
***************
*** 800,804 ****
}
GUI_BGN_SAVE;
! rc = pLB->SetTabStops( numChildren, pArray );
GUI_END_SAVE;
delete pArray;
--- 800,804 ----
}
GUI_BGN_SAVE;
! rc = pLB->SetTabStops( PyWin_SAFE_DOWNCAST(numChildren, Py_ssize_t, int), pArray );
GUI_END_SAVE;
delete pArray;
***************
*** 1046,1055 ****
if (!pLB) return NULL;
GUI_BGN_SAVE;
! long rc = pLB->GetItemData(item);
GUI_END_SAVE;
! PyObject *ret = PyWin_GetPythonObjectFromLong(rc);
! // inc ref count for return value.
! Py_XINCREF(ret);
! return ret;
}
--- 1046,1052 ----
if (!pLB) return NULL;
GUI_BGN_SAVE;
! DWORD_PTR rc = pLB->GetItemData(item);
GUI_END_SAVE;
! return PyWinObject_FromDWORD_PTR(rc);
}
***************
*** 1225,1229 ****
if (data==Py_None) data = NULL;
GUI_BGN_SAVE;
! BOOL ok = pLB->SetItemData(item, (DWORD)data);
GUI_END_SAVE;
if (!ok)
--- 1222,1226 ----
if (data==Py_None) data = NULL;
GUI_BGN_SAVE;
! BOOL ok = pLB->SetItemData(item, (DWORD_PTR)data);
GUI_END_SAVE;
if (!ok)
***************
*** 2261,2266 ****
PyCStatusBarCtrl_set_parts (PyObject *self, PyObject *args)
{
! int nParts = 0;
! int i;
CStatusBarCtrl *pSB = GetStatusBarCtrl(self);
--- 2258,2263 ----
PyCStatusBarCtrl_set_parts (PyObject *self, PyObject *args)
{
! Py_ssize_t nParts = 0;
! Py_ssize_t i;
CStatusBarCtrl *pSB = GetStatusBarCtrl(self);
***************
*** 2283,2287 ****
GUI_BGN_SAVE;
! pSB->SetParts (nParts, pParts);
GUI_END_SAVE;
--- 2280,2284 ----
GUI_BGN_SAVE;
! pSB->SetParts (PyWin_SAFE_DOWNCAST(nParts, Py_ssize_t, int), pParts);
GUI_END_SAVE;
Index: win32ctrlList.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ctrlList.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** win32ctrlList.cpp 9 Oct 1999 23:41:08 -0000 1.2
--- win32ctrlList.cpp 3 Jun 2007 12:35:58 -0000 1.3
***************
*** 488,492 ****
if (len==0)
RETURN_ERR("GetItemText failed");
! return Py_BuildValue("s#",buf,len);
}
--- 488,492 ----
if (len==0)
RETURN_ERR("GetItemText failed");
! return PyString_FromStringAndSize(buf,len);
}
***************
*** 577,581 ****
if (data==Py_None) data = NULL;
GUI_BGN_SAVE;
! BOOL ok = pList->SetItemData(item, (DWORD)data);
GUI_END_SAVE;
if (!ok)
--- 577,581 ----
if (data==Py_None) data = NULL;
GUI_BGN_SAVE;
! BOOL ok = pList->SetItemData(item, (DWORD_PTR)data);
GUI_END_SAVE;
if (!ok)
Index: win32brush.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32brush.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** win32brush.cpp 1 Sep 1999 23:33:00 -0000 1.1
--- win32brush.cpp 3 Jun 2007 12:35:57 -0000 1.2
***************
*** 81,85 ****
CBrush *pBrush = PyCBrush::GetBrush(self);
if (pBrush==NULL) return NULL;
! return PyInt_FromLong((long)pBrush->GetSafeHandle());
}
--- 81,85 ----
CBrush *pBrush = PyCBrush::GetBrush(self);
if (pBrush==NULL) return NULL;
! return PyWinLong_FromHANDLE(pBrush->GetSafeHandle());
}
Index: win32win.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32win.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** win32win.h 1 Sep 1999 23:33:03 -0000 1.1
--- win32win.h 3 Jun 2007 12:35:58 -0000 1.2
***************
*** 35,39 ****
virtual CString repr();
! BOOL check_key_stroke(UINT ch);
static ui_type_CObject type;
--- 35,39 ----
virtual CString repr();
! BOOL check_key_stroke(WPARAM ch);
static ui_type_CObject type;
Index: win32ui.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ui.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** win32ui.h 24 May 2007 12:50:50 -0000 1.4
--- win32ui.h 3 Jun 2007 12:35:58 -0000 1.5
***************
*** 303,306 ****
--- 303,307 ----
BOOL retval( CString &ret );
BOOL retval( MSG *msg);
+ BOOL retval( HANDLE &ret );
BOOL retnone();
PyObject *GetHandler();
***************
*** 320,323 ****
--- 321,326 ----
PYW_EXPORT int Python_callback(PyObject *);
PYW_EXPORT int Python_callback(PyObject *, int);
+ PYW_EXPORT int Python_callback(PyObject *, WPARAM);
+ PYW_EXPORT int Python_callback(PyObject *, LPARAM);
PYW_EXPORT int Python_callback(PyObject *, int, int);
PYW_EXPORT int Python_callback(PyObject *, const MSG *);
***************
*** 350,354 ****
PYW_EXPORT PyObject *MakeTV_ITEMTuple(TV_ITEM *item);
! PyObject *PyWin_GetPythonObjectFromLong(long val);
PYW_EXPORT PyObject *PyWinObject_FromRECT(RECT *p, bool bTakeCopy);
--- 353,357 ----
PYW_EXPORT PyObject *MakeTV_ITEMTuple(TV_ITEM *item);
! PyObject *PyWin_GetPythonObjectFromLong(LONG_PTR val);
PYW_EXPORT PyObject *PyWinObject_FromRECT(RECT *p, bool bTakeCopy);
Index: win32prinfo.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32prinfo.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** win32prinfo.cpp 5 Nov 1999 06:20:32 -0000 1.3
--- win32prinfo.cpp 3 Jun 2007 12:35:58 -0000 1.4
***************
*** 509,521 ****
static PyObject *ui_set_hdc(PyObject * self, PyObject * args)
{
! int dc;
// @pyparm int|hdc||The DC.
! if (!PyArg_ParseTuple(args, "i:SetHDC", &dc))
return NULL;
CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self);
if (!pInfo)
return NULL;
pInfo->m_pPD->m_pd.Flags |= PD_RETURNDC;
! pInfo->m_pPD->m_pd.hDC = (HDC)dc;
RETURN_NONE;
}
--- 509,524 ----
static PyObject *ui_set_hdc(PyObject * self, PyObject * args)
{
! PyObject *obdc;
// @pyparm int|hdc||The DC.
! if (!PyArg_ParseTuple(args, "O:SetHDC", &obdc))
return NULL;
+ HDC dc;
+ if (!PyWinObject_AsHANDLE(obdc, (HANDLE *)&dc))
+ return NULL;
CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self);
if (!pInfo)
return NULL;
pInfo->m_pPD->m_pd.Flags |= PD_RETURNDC;
! pInfo->m_pPD->m_pd.hDC = dc;
RETURN_NONE;
}
***************
*** 532,536 ****
HDC hDC = pInfo->m_pPD->CreatePrinterDC();
GUI_END_SAVE;
! return Py_BuildValue("l", (long)hDC);
}
--- 535,539 ----
HDC hDC = pInfo->m_pPD->CreatePrinterDC();
GUI_END_SAVE;
! return PyWinLong_FromHANDLE(hDC);
}
***************
*** 544,550 ****
return NULL;
GUI_BGN_SAVE;
! int res = pInfo->m_pPD->DoModal();
GUI_END_SAVE;
! return Py_BuildValue("i", res);
}
--- 547,553 ----
return NULL;
GUI_BGN_SAVE;
! INT_PTR res = pInfo->m_pPD->DoModal();
GUI_END_SAVE;
! return PyWinObject_FromDWORD_PTR(res);
}
***************
*** 640,644 ****
HDC hDC = pInfo->m_pPD->GetPrinterDC();
GUI_END_SAVE;
! return Py_BuildValue("l", (long)hDC);
}
--- 643,647 ----
HDC hDC = pInfo->m_pPD->GetPrinterDC();
GUI_END_SAVE;
! return PyWinLong_FromHANDLE(hDC);
}
***************
*** 671,675 ****
return NULL;
HDC hDC = pInfo->m_pPD->m_pd.hDC;
! return Py_BuildValue("l", (long)hDC);
}
--- 674,678 ----
return NULL;
HDC hDC = pInfo->m_pPD->m_pd.hDC;
! return PyWinLong_FromHANDLE(hDC);
}
Index: win32dc.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32dc.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** win32dc.cpp 25 Oct 2003 05:32:20 -0000 1.3
--- win32dc.cpp 3 Jun 2007 12:35:58 -0000 1.4
***************
*** 15,18 ****
--- 15,19 ----
*/
+ #define PY_SSIZE_T_CLEAN // this module is Py_ssize_t clean!
#include "stdafx.h"
***************
*** 35,39 ****
return FALSE;
}
! int n = PySequence_Length(obLogPal);
*ppLogPal = (LOGPALETTE *)malloc(sizeof(LOGPALETTE) + n * sizeof(PALETTEENTRY));
LOGPALETTE *pPal = *ppLogPal;
--- 36,40 ----
return FALSE;
}
! Py_ssize_t n = PySequence_Length(obLogPal);
*ppLogPal = (LOGPALETTE *)malloc(sizeof(LOGPALETTE) + n * sizeof(PALETTEENTRY));
LOGPALETTE *pPal = *ppLogPal;
***************
*** 44,50 ****
pPal->palVersion = 0x300;
! pPal->palNumEntries = n;
! for (int i=0;i<n;i++) {
PyObject *subOb = PySequence_GetItem(obLogPal, i);
if (subOb==NULL)
--- 45,51 ----
pPal->palVersion = 0x300;
! pPal->palNumEntries = PyWin_SAFE_DOWNCAST(n, Py_ssize_t, WORD);
! for (Py_ssize_t i=0;i<n;i++) {
PyObject *subOb = PySequence_GetItem(obLogPal, i);
if (subOb==NULL)
***************
*** 99,103 ****
if (hp==NULL)
RETURN_API_ERR("CreatePalette");
! return PyInt_FromLong((long)hp);
}
--- 100,104 ----
if (hp==NULL)
RETURN_API_ERR("CreatePalette");
! return PyWinLong_FromHANDLE(hp);
}
***************
*** 246,250 ****
// @pyseemfc CDC|GetSafeHdc
HDC hdc = pDC->GetSafeHdc();
! return Py_BuildValue("l", (long)hdc);
}
--- 247,251 ----
// @pyseemfc CDC|GetSafeHdc
HDC hdc = pDC->GetSafeHdc();
! return PyWinLong_FromHANDLE(hdc);
}
***************
*** 487,491 ****
return NULL;
char *text;
! int strLen, x, y;
UINT options;
PyObject *rectObject, *widthObject = NULL;
--- 488,493 ----
return NULL;
char *text;
! Py_ssize_t strLen;
! int x, y;
UINT options;
PyObject *rectObject, *widthObject = NULL;
***************
*** 518,525 ****
BOOL error = !PyTuple_Check(widthObject);
if (!error) {
! int len = PyTuple_Size(widthObject);
if (len == (strLen - 1)) {
widths = new int[len + 1];
! for (int i = 0; i < len; i++) {
PyObject *item = PyTuple_GetItem(widthObject, i);
if (!PyInt_Check(item))
--- 520,527 ----
BOOL error = !PyTuple_Check(widthObject);
if (!error) {
! Py_ssize_t len = PyTuple_Size(widthObject);
if (len == (strLen - 1)) {
widths = new int[len + 1];
! for (Py_ssize_t i = 0; i < len; i++) {
PyObject *item = PyTuple_GetItem(widthObject, i);
if (!PyInt_Check(item))
***************
*** 537,541 ****
GUI_BGN_SAVE;
! BOOL ret = pDC->ExtTextOut(x, y, options, rectPtr, text, strLen, widths); // @pyseemfc CDC|ExtTextOut
GUI_END_SAVE;
delete [] widths;
--- 539,545 ----
GUI_BGN_SAVE;
! BOOL ret = pDC->ExtTextOut(x, y, options, rectPtr, text,
! PyWin_SAFE_DOWNCAST(strLen, Py_ssize_t, DWORD),
! widths); // @pyseemfc CDC|ExtTextOut
GUI_END_SAVE;
delete [] widths;
***************
*** 678,684 ****
} else {
// Convert the list of point tuples into an array of POINT structs
! int num = PyList_Size (point_list);
POINT * point_array = new POINT[num];
! for (int i=0; i < num; i++) {
PyObject * point_tuple = PyList_GetItem (point_list, i);
if (!PyTuple_Check (point_tuple) || PyTuple_Size (point_tuple) != 2) {
--- 682,688 ----
} else {
// Convert the list of point tuples into an array of POINT structs
! Py_ssize_t num = PyList_Size (point_list);
POINT * point_array = new POINT[num];
! for (Py_ssize_t i=0; i < num; i++) {
PyObject * point_tuple = PyList_GetItem (point_list, i);
if (!PyTuple_Check (point_tuple) || PyTuple_Size (point_tuple) != 2) {
***************
*** 708,712 ****
// can finally draw the polygon.
GUI_BGN_SAVE;
! BOOL ret = pDC->Polygon (point_array, num);
GUI_END_SAVE;
delete[] point_array;
--- 712,716 ----
// can finally draw the polygon.
GUI_BGN_SAVE;
! BOOL ret = pDC->Polygon (point_array, PyWin_SAFE_DOWNCAST(num, Py_ssize_t, int));
GUI_END_SAVE;
delete[] point_array;
***************
*** 736,740 ****
} else {
int index = 0;
! int num = PyList_Size (triple_list);
#define HURL \
--- 740,744 ----
} else {
int index = 0;
! Py_ssize_t num = PyList_Size (triple_list);
#define HURL \
***************
*** 748,752 ****
POINT * point_array = new POINT[num*3];
! for (int i=0; i < num; i++) {
PyObject * triplet = PyList_GetItem (triple_list, i);
if (!PyTuple_Check (triplet) || PyTuple_Size (triplet) != 3) {
--- 752,756 ----
POINT * point_array = new POINT[num*3];
! for (Py_ssize_t i=0; i < num; i++) {
PyObject * triplet = PyList_GetItem (triple_list, i);
if (!PyTuple_Check (triplet) || PyTuple_Size (triplet) != 3) {
***************
*** 913,922 ****
return NULL;
char *text;
! int strLen;
// @pyparm string|text||The text to calculate for.
if (!PyArg_ParseTuple (args, "s#", &text, &strLen))
return NULL;
GUI_BGN_SAVE;
! CSize sz = pDC->GetTextExtent(text, strLen); // @pyseemfc CFC|GetTextExtent
GUI_END_SAVE;
return Py_BuildValue ("(ii)", sz.cx, sz.cy);
--- 917,927 ----
return NULL;
char *text;
! Py_ssize_t strLen;
// @pyparm string|text||The text to calculate for.
if (!PyArg_ParseTuple (args, "s#", &text, &strLen))
return NULL;
GUI_BGN_SAVE;
! CSize sz = pDC->GetTextExtent(text, PyWin_SAFE_DOWNCAST(strLen, Py_ssize_t, DWORD));
! // @pyseemfc CFC|GetTextExtent
GUI_END_SAVE;
return Py_BuildValue ("(ii)", sz.cx, sz.cy);
***************
*** 1388,1392 ****
HPALETTE ret = ::SelectPalette(pDC->GetSafeHdc(), hPal, bForceBG); // @pyseemfc CDC|SelectePalette
GUI_END_SAVE;
! return Py_BuildValue ("i", (int)ret);
// @rdesc The previous palette handle.
}
--- 1393,1397 ----
HPALETTE ret = ::SelectPalette(pDC->GetSafeHdc(), hPal, bForceBG); // @pyseemfc CDC|SelectePalette
GUI_END_SAVE;
! return PyWinLong_FromHANDLE(ret);
// @rdesc The previous palette handle.
}
***************
*** 1438,1442 ****
return NULL;
char *text;
! int strLen, x, y;
if (!PyArg_ParseTuple (args, "iis#",
&x, // @pyparm x|int||The x coordinate to write the text to.
--- 1443,1448 ----
return NULL;
char *text;
! Py_ssize_t strLen;
! int x, y;
if (!PyArg_ParseTuple (args, "iis#",
&x, // @pyparm x|int||The x coordinate to write the text to.
***************
*** 1446,1450 ****
return NULL;
GUI_BGN_SAVE;
! BOOL ret = pDC->TextOut (x, y, text, strLen); // @pyseemfc CDC|TextOut
GUI_END_SAVE;
if (!ret)
--- 1452,1457 ----
return NULL;
GUI_BGN_SAVE;
! BOOL ret = pDC->TextOut (x, y, text,
! PyWin_SAFE_DOWNCAST(strLen, Py_ssize_t, DWORD)); // @pyseemfc CDC|TextOut
GUI_END_SAVE;
if (!ret)
***************
*** 2055,2061 ****
} else {
// Convert the list of point tuples into an array of POINT structs
! int num = PySequence_Length(point_list);
POINT * point_array = new POINT[num];
! for (int i=0; i < num; i++) {
PyObject * point_tuple = PySequence_GetItem (point_list, i);
if (!PyTuple_Check (point_tuple) || PyTuple_Size (point_tuple) != 2) {
--- 2062,2068 ----
} else {
// Convert the list of point tuples into an array of POINT structs
! Py_ssize_t num = PySequence_Length(point_list);
POINT * point_array = new POINT[num];
! for (Py_ssize_t i=0; i < num; i++) {
PyObject * point_tuple = PySequence_GetItem (point_list, i);
if (!PyTuple_Check (point_tuple) || PyTuple_Size (point_tuple) != 2) {
***************
*** 2085,2089 ****
// can finally draw the polyline.
GUI_BGN_SAVE;
! BOOL ret = pDC->Polyline(point_array, num);
GUI_END_SAVE;
delete[] point_array;
--- 2092,2096 ----
// can finally draw the polyline.
GUI_BGN_SAVE;
! BOOL ret = pDC->Polyline(point_array, PyWin_SAFE_DOWNCAST(num, Py_ssize_t, int));
GUI_END_SAVE;
delete[] point_array;
Index: win32bitmap.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32bitmap.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** win32bitmap.cpp 3 Aug 2006 05:27:58 -0000 1.4
--- win32bitmap.cpp 3 Jun 2007 12:35:57 -0000 1.5
***************
*** 57,67 ****
PyObject *ui_bitmap::create_from_handle( PyObject *self, PyObject *args )
{
! PyObject *pObj;
! int handle;
! if (!PyArg_ParseTuple(args, "i", &handle))
return NULL;
CBitmap *pBitmap = new CBitmap;
// if (!pBitmap->Attach((HGDIOBJ)handle)) {
! if (!pBitmap->Attach((HBITMAP)handle)) {
delete pBitmap;
RETURN_ERR("Attach failed!");
--- 57,69 ----
PyObject *ui_bitmap::create_from_handle( PyObject *self, PyObject *args )
{
! PyObject *pObj, *obhandle;
! if (!PyArg_ParseTuple(args, "O", &obhandle))
! return NULL;
! HBITMAP handle;
! if (!PyWinObject_AsHANDLE(obhandle, (HANDLE *)&handle))
return NULL;
CBitmap *pBitmap = new CBitmap;
// if (!pBitmap->Attach((HGDIOBJ)handle)) {
! if (!pBitmap->Attach(handle)) {
delete pBitmap;
RETURN_ERR("Attach failed!");
***************
*** 186,190 ****
return NULL;
}
! int len = PyString_Size(result);
if (len != sizeof(BITMAPFILEHEADER)) {
DODECREF(seeker);
--- 188,192 ----
return NULL;
}
! Py_ssize_t len = PyString_Size(result);
if (len != sizeof(BITMAPFILEHEADER)) {
DODECREF(seeker);
***************
*** 307,311 ****
return NULL;
}
! int lenRead = PyString_Size(result);
// work out size of bitmap
int headerSize = sizeof(BITMAPINFOHEADER);
--- 309,313 ----
return NULL;
}
! Py_ssize_t lenRead = PyString_Size(result);
// work out size of bitmap
int headerSize = sizeof(BITMAPINFOHEADER);
Index: win32uimodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uimodule.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** win32uimodule.cpp 28 Mar 2007 12:26:50 -0000 1.33
--- win32uimodule.cpp 3 Jun 2007 12:35:58 -0000 1.34
***************
*** 449,454 ****
if (!GetFullPath(fullWorkBuf, workBuf)) // not a valid path
continue; // ignore it.
! int listLen = PyList_Size(p);
! int itemNo;
for (itemNo=0;itemNo<listLen;itemNo++) {
char *thisPath = PyString_AsString(PyList_GetItem(p, itemNo));
--- 449,454 ----
if (!GetFullPath(fullWorkBuf, workBuf)) // not a valid path
continue; // ignore it.
! Py_ssize_t listLen = PyList_Size(p);
! Py_ssize_t itemNo;
for (itemNo=0;itemNo<listLen;itemNo++) {
char *thisPath = PyString_AsString(PyList_GetItem(p, itemNo));
***************
*** 811,814 ****
--- 811,826 ----
return retVal;
}
+ int Python_callback(PyObject *method, WPARAM val)
+ {
+ PyObject *meth = method;
+ PyObject *thearglst = Py_BuildValue("(N)",PyWinObject_FromPARAM(val));
+ return Python_do_int_callback(meth,thearglst);
+ }
+ int Python_callback(PyObject *method, LPARAM val)
+ {
+ PyObject *meth = method;
+ PyObject *thearglst = Py_BuildValue("(N)",PyWinObject_FromPARAM(val));
+ return Python_do_int_callback(meth,thearglst);
+ }
int Python_callback(PyObject *method, int val)
{
***************
*** 1480,1484 ****
UINT cmd = HELP_CONTEXT;
PyObject *dataOb;
! DWORD data;
if (!PyArg_ParseTuple(args, "iO:WinHelp",
&cmd, // @pyparm int|cmd|win32con.HELP_CONTEXT|The type of help. See the api for full details.
--- 1492,1496 ----
UINT cmd = HELP_CONTEXT;
PyObject *dataOb;
! ULONG_PTR data;
if (!PyArg_ParseTuple(args, "iO:WinHelp",
&cmd, // @pyparm int|cmd|win32con.HELP_CONTEXT|The type of help. See the api for full details.
***************
*** 1486,1492 ****
return NULL;
if (PyString_Check(dataOb))
! data = (DWORD)PyString_AsString(dataOb);
else if (PyInt_Check(dataOb))
! data = (DWORD)PyInt_AsLong(dataOb);
else {
RETURN_TYPE_ERR("First argument must be a string or an integer.");
--- 1498,1504 ----
return NULL;
if (PyString_Check(dataOb))
! data = (DWORD_PTR)PyString_AsString(dataOb);
else if (PyInt_Check(dataOb))
! data = (DWORD_PTR)PyInt_AsLong(dataOb);
else {
RETURN_TYPE_ERR("First argument must be a string or an integer.");
***************
*** 1643,1652 ****
{
long style;
! long hCursor = 0, hBrush = 0, hIcon = 0;
! if (!PyArg_ParseTuple(args,"l|lll:RegisterWndClass",
&style, // @pyparm int|style||Specifies the Windows class style or combination of styles
! &hCursor, // @pyparm int|hCursor|0|
! &hBrush, // @pyparm int|hBrush|0|
! &hIcon)) // @pyparm int|hIcon|0|
return NULL;
--- 1655,1670 ----
{
long style;
! PyObject *obCursor = Py_None, *obBrush = Py_None, *obIcon = Py_None;
! if (!PyArg_ParseTuple(args,"l|OOO:RegisterWndClass",
&style, // @pyparm int|style||Specifies the Windows class style or combination of styles
! &obCursor, // @pyparm int|hCursor|0|
! &obBrush, // @pyparm int|hBrush|0|
! &obIcon)) // @pyparm int|hIcon|0|
! return NULL;
!
! HANDLE hCursor = 0, hBrush = 0, hIcon = 0;
! if (!PyWinObject_AsHANDLE(obCursor, &hCursor) ||
! !PyWinObject_AsHANDLE(obBrush, &hBrush) ||
! !PyWinObject_AsHANDLE(obIcon, &hIcon))
return NULL;
***************
*** 1688,1698 ****
ui_set_afxCurrentInstanceHandle(PyObject *self, PyObject *args)
{
! HMODULE newVal;
// @pyparm int|newVal||The new value for afxCurrentInstanceHandle
! if (!PyArg_ParseTuple(args, "l", &newVal))
return NULL;
HMODULE old = afxCurrentInstanceHandle;
afxCurrentInstanceHandle = newVal;
! return PyInt_FromLong((long)old);
// @rdesc The result is the previous value of afxCurrentInstanceHandle
}
--- 1706,1719 ----
ui_set_afxCurrentInstanceHandle(PyObject *self, PyObject *args)
{
! PyObject *obMod;
// @pyparm int|newVal||The new value for afxCurrentInstanceHandle
! if (!PyArg_ParseTuple(args, "O", &obMod))
! return NULL;
! HMODULE newVal;
! if (!PyWinObject_AsHANDLE(obMod, (HANDLE *)&newVal))
return NULL;
HMODULE old = afxCurrentInstanceHandle;
afxCurrentInstanceHandle = newVal;
! return PyWinLong_FromHANDLE(old);
// @rdesc The result is the previous value of afxCurrentInstanceHandle
}
***************
*** 1708,1712 ****
HMODULE old = afxCurrentResourceHandle;
afxCurrentResourceHandle = newVal;
! return PyInt_FromLong((long)old);
// @rdesc The result is the previous value of afxCurrentResourceHandle
}
--- 1729,1733 ----
HMODULE old = afxCurrentResourceHandle;
afxCurrentResourceHandle = newVal;
! return PyWinLong_FromHANDLE(old);
// @rdesc The result is the previous value of afxCurrentResourceHandle
}
***************
*** 1715,1720 ****
static PyObject *ui_get_bytes(PyObject *self, PyObject *args)
{
! long address;
int size;
// @pyparm int|address||The memory address
// @pyparm int|size||The size to get.
--- 1736,1742 ----
static PyObject *ui_get_bytes(PyObject *self, PyObject *args)
{
! void *address;
int size;
+ PyObject *obaddress;
// @pyparm int|address||The memory address
// @pyparm int|size||The size to get.
***************
*** 1722,1726 ****
// You must be very carefull when using this method.
// @rdesc The result is a string with a length of size.
! if (!PyArg_ParseTuple(args, "li|GetBytes", &address, &size))
return NULL;
return PyString_FromStringAndSize((char *)address, size);
--- 1744,1750 ----
// You must be very carefull when using this method.
// @rdesc The result is a string with a length of size.
! if (!PyArg_ParseTuple(args, "Oi|GetBytes", &obaddress, &size))
! return NULL;
! if (!PyWinLong_AsVoidPtr(obaddress, &address))
return NULL;
return PyString_FromStringAndSize((char *)address, size);
***************
*** 1742,1749 ****
// @pyparm int|hdc||
// @pyparm int|index||
! int hdc, index;
! if (!PyArg_ParseTuple(args, "ii", &hdc, &index))
return NULL;
! return PyInt_FromLong( ::GetDeviceCaps( (HDC)hdc, index) );
}
--- 1766,1777 ----
// @pyparm int|hdc||
// @pyparm int|index||
! int index;
! PyObject *obdc;
! if (!PyArg_ParseTuple(args, "Oi", &obdc, &index))
return NULL;
! HDC hdc;
! if (!PyWinObject_AsHANDLE(obdc, (HANDLE *)&hdc))
! return NULL;
! return PyInt_FromLong( ::GetDeviceCaps( hdc, index) );
}
***************
*** 2244,2248 ****
PyDict_SetItemString(dict, "copyright", copyright);
Py_XDECREF(copyright);
! PyObject *dllhandle = PyInt_FromLong((long)hWin32uiDll);
PyDict_SetItemString(dict, "dllhandle", dllhandle);
Py_XDECREF(dllhandle);
--- 2272,2276 ----
PyDict_SetItemString(dict, "copyright", copyright);
Py_XDECREF(copyright);
! PyObject *dllhandle = PyWinLong_FromHANDLE(hWin32uiDll);
PyDict_SetItemString(dict, "dllhandle", dllhandle);
Py_XDECREF(dllhandle);
Index: win32menu.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32menu.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** win32menu.cpp 1 Sep 1999 23:33:02 -0000 1.1
--- win32menu.cpp 3 Jun 2007 12:35:58 -0000 1.2
***************
*** 243,247 ****
} else {
HMENU hSubMenu = GetMenu(subMenu);
! if (!::InsertMenu(hMenu, pos, flags, (int)hSubMenu, value))
RETURN_API_ERR("::InsertMenu");
}
--- 243,247 ----
} else {
HMENU hSubMenu = GetMenu(subMenu);
! if (!::InsertMenu(hMenu, pos, flags, (UINT_PTR)hSubMenu, value))
RETURN_API_ERR("::InsertMenu");
}
Index: win32util.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32util.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** win32util.cpp 24 May 2007 12:50:50 -0000 1.8
--- win32util.cpp 3 Jun 2007 12:35:58 -0000 1.9
***************
*** 182,186 ****
PyObject *PyObjectFromCreateStruct(LPCREATESTRUCT lpcs)
{
! return Py_BuildValue("(iiii(iiii)illi)",
lpcs->lpCreateParams, // @pyparm int|createParams||
lpcs->hInstance, // @pyparm int|hInstance||
--- 182,186 ----
PyObject *PyObjectFromCreateStruct(LPCREATESTRUCT lpcs)
{
! return Py_BuildValue("(iiii(iiii)iNNi)",
lpcs->lpCreateParams, // @pyparm int|createParams||
lpcs->hInstance, // @pyparm int|hInstance||
***************
*** 192,197 ****
lpcs->x,
lpcs->style,// @pyparm int|style||
! (long)lpcs->lpszName,// @pyparm int|lpszName||A string cast to a long.
! (long)lpcs->lpszClass,// @pyparm int|lpszClass||A string cast to a long!?
lpcs->dwExStyle);// @pyparm int|dwExStyle||
--- 192,197 ----
lpcs->x,
lpcs->style,// @pyparm int|style||
! PyWinLong_FromVoidPtr(lpcs->lpszName),// @pyparm int|lpszName||A string cast to a long.
! PyWinLong_FromVoidPtr(lpcs->lpszClass),// @pyparm int|lpszClass||A string cast to a long!?
lpcs->dwExStyle);// @pyparm int|dwExStyle||
***************
*** 208,212 ****
else
sprintf(argBuf, "iiii(iiii)illi:%s", fnName);
! long name, className;
BOOL ret = PyArg_ParseTuple(ob, argBuf,
&lpcs->lpCreateParams,
--- 208,212 ----
else
sprintf(argBuf, "iiii(iiii)illi:%s", fnName);
! PyObject *obname, *obclassName;
BOOL ret = PyArg_ParseTuple(ob, argBuf,
&lpcs->lpCreateParams,
***************
*** 219,228 ****
&lpcs->x,
&lpcs->style,
! &name,
! &className,
&lpcs->dwExStyle);
// CCreateStruct
! lpcs->lpszName = (LPCTSTR)name;
! lpcs->lpszClass = (LPCTSTR)className;
return ret;
}
--- 219,229 ----
&lpcs->x,
&lpcs->style,
! &obname,
! &obclassName,
&lpcs->dwExStyle);
// CCreateStruct
! if (!ret || !PyWinLong_AsVoidPtr(obname, (void **)&lpcs->lpszName) ||
! !PyWinLong_AsVoidPtr(obclassName, (void **)&lpcs->lpszClass))
! return FALSE;
return ret;
}
***************
*** 359,363 ****
}
if (item->mask & LVIF_PARAM && item->lParam) {
! PyObject *ob = PyInt_FromLong(item->lParam);
PyTuple_SET_ITEM(ret, 6, ob);
} else {
--- 360,364 ----
}
if (item->mask & LVIF_PARAM && item->lParam) {
! PyObject *ob = PyWinObject_FromPARAM(item->lParam);
PyTuple_SET_ITEM(ret, 6, ob);
} else {
***************
*** 383,387 ****
PyObject *ob;
pItem->mask = 0;
! int len = PyTuple_Size(args);
if (len<2 || len > 7) {
PyErr_SetString(PyExc_TypeError, "LV_ITEM tuple has invalid size");
--- 384,388 ----
PyObject *ob;
pItem->mask = 0;
! Py_ssize_t len = PyTuple_Size(args);
if (len<2 || len > 7) {
PyErr_SetString(PyExc_TypeError, "LV_ITEM tuple has invalid size");
***************
*** 418,422 ****
pItem->mask |= LVIF_TEXT;
pItem->pszText = PyString_AsString(ob);
! pItem->cchTextMax = strlen(pItem->pszText)+1;
}
if (len<6) return TRUE;
--- 419,423 ----
pItem->mask |= LVIF_TEXT;
pItem->pszText = PyString_AsString(ob);
! pItem->cchTextMax = PyWin_SAFE_DOWNCAST(strlen(pItem->pszText)+1, ssize_t, int);
}
if (len<6) return TRUE;
***************
*** 483,487 ****
PyObject *ob;
pItem->mask = 0;
! int len = PyTuple_Size(args);
if (len...
[truncated message content] |