Update of /cvsroot/pywin32/pywin32/Pythonwin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4653
Modified Files:
win32assoc.cpp win32cmd.cpp win32uimodule.cpp
Log Message:
Fix format string in PyCCmdTarget::repr
Use CString::Format in place of sprintf
Index: win32assoc.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32assoc.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** win32assoc.cpp 20 Nov 2006 12:36:41 -0000 1.8
--- win32assoc.cpp 24 Feb 2008 16:06:09 -0000 1.9
***************
*** 295,302 ****
{
CString csRet;
- char *buf = csRet.GetBuffer(128);
PyObject *vi_repr = virtualInst ? PyObject_Repr(virtualInst) : NULL;
! sprintf(buf, " - assoc is %p, vi=%s", assoc, vi_repr ? PyString_AsString(vi_repr) : "<None>" );
! csRet.ReleaseBuffer();
Py_XDECREF(vi_repr);
return ui_base_class::repr() + csRet;
--- 295,301 ----
{
CString csRet;
PyObject *vi_repr = virtualInst ? PyObject_Repr(virtualInst) : NULL;
! // sprintf(buf, " - assoc is %p, vi=%s", assoc, vi_repr ? PyString_AsString(vi_repr) : "<None>" );
! csRet.Format(" - assoc is %p, vi=%s", assoc, vi_repr ? PyString_AsString(vi_repr) : "<None>" );
Py_XDECREF(vi_repr);
return ui_base_class::repr() + csRet;
Index: win32uimodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uimodule.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** win32uimodule.cpp 7 Feb 2008 00:25:29 -0000 1.37
--- win32uimodule.cpp 24 Feb 2008 16:06:09 -0000 1.38
***************
*** 311,322 ****
ui_base_class* w = (ui_base_class *)op;
CString ret = w->repr();
! return Py_BuildValue("s",(const char *)ret);
}
CString ui_base_class::repr()
{
CString csRet;
! char *buf = csRet.GetBuffer(50);
! sprintf(buf, "object '%s'", ob_type->tp_name);
! csRet.ReleaseBuffer();
return csRet;
}
--- 311,320 ----
ui_base_class* w = (ui_base_class *)op;
CString ret = w->repr();
! return PyString_FromString(ret);
}
CString ui_base_class::repr()
{
CString csRet;
! csRet.Format("object '%s'", ob_type->tp_name);
return csRet;
}
Index: win32cmd.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32cmd.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** win32cmd.cpp 8 Jun 2007 07:20:09 -0000 1.4
--- win32cmd.cpp 24 Feb 2008 16:06:09 -0000 1.5
***************
*** 188,198 ****
{
CString csRet;
- char *buf = csRet.GetBuffer(64);
SSIZE_T numCmd = pCommandHookList ? pCommandHookList->GetCount() : 0;
SSIZE_T numNotify = pNotifyHookList ? pNotifyHookList->GetCount() : 0;
SSIZE_T numCmdUpdate = pCommandUpdateHookList ? pCommandUpdateHookList->GetCount() : 0;
SSIZE_T numOle = pOleEventHookList ? pOleEventHookList->GetCount() : 0;
! sprintf(buf, ", notify=%I,ch/u=%I/%I", numNotify, numCmd, numCmdUpdate);
! csRet.ReleaseBuffer();
return ui_assoc_object::repr() + csRet;
}
--- 188,196 ----
{
CString csRet;
SSIZE_T numCmd = pCommandHookList ? pCommandHookList->GetCount() : 0;
SSIZE_T numNotify = pNotifyHookList ? pNotifyHookList->GetCount() : 0;
SSIZE_T numCmdUpdate = pCommandUpdateHookList ? pCommandUpdateHookList->GetCount() : 0;
SSIZE_T numOle = pOleEventHookList ? pOleEventHookList->GetCount() : 0;
! csRet.Format(", notify=%Iu,ch/u=%Iu/%Iu", numNotify, numCmd, numCmdUpdate);
return ui_assoc_object::repr() + csRet;
}
|