Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32com/src/extensions
Modified Files:
Tag: py3k
PyICatInformation.cpp PyIType.cpp PySTGMEDIUM.cpp
Log Message:
Merge various changes from trunk and py3k-integration bzr branch
Index: PySTGMEDIUM.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PySTGMEDIUM.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
*** PySTGMEDIUM.cpp 29 Aug 2008 08:27:37 -0000 1.8.2.1
--- PySTGMEDIUM.cpp 26 Nov 2008 07:17:39 -0000 1.8.2.2
***************
*** 55,69 ****
const void * buf = NULL;
Py_ssize_t cb = 0;
! if (PyObject_AsReadBuffer(ob,&buf,&cb)==-1)
! return PyErr_Format(PyExc_TypeError, "tymed value of %d requires a string/unicode/buffer", tymed);
! // size doesnt include nulls!
// We need to include the NULL for strings and unicode, as the
// Windows clipboard functions will assume it is there for
// text related formats (eg, CF_TEXT).
! if (PyString_Check(ob))
! cb += 1;
! else if (PyUnicode_Check(ob))
! cb += sizeof(wchar_t);
! // else assume buffer needs no terminator...
ps->medium.hGlobal = GlobalAlloc(GMEM_FIXED, cb);
if (!ps->medium.hGlobal)
--- 55,74 ----
const void * buf = NULL;
Py_ssize_t cb = 0;
! // In py3k, unicode objects don't support the buffer
! // protocol, so explicitly check string types first.
// We need to include the NULL for strings and unicode, as the
// Windows clipboard functions will assume it is there for
// text related formats (eg, CF_TEXT).
! if (PyString_Check(ob)) {
! cb = PyString_GET_SIZE(ob) + 1; // for the NULL
! buf = (void *)PyString_AS_STRING(ob);
! } else if (PyUnicode_Check(ob)) {
! cb = PyUnicode_GET_DATA_SIZE(ob) + sizeof(Py_UNICODE);
! buf = (void *)PyUnicode_AS_UNICODE(ob);
! } else {
! if (PyObject_AsReadBuffer(ob,&buf,&cb)==-1)
! return PyErr_Format(PyExc_TypeError, "tymed value of %d requires a string/unicode/buffer", tymed);
! // no extra nulls etc needed here.
! }
ps->medium.hGlobal = GlobalAlloc(GMEM_FIXED, cb);
if (!ps->medium.hGlobal)
Index: PyIType.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyIType.cpp,v
retrieving revision 1.9.4.1
retrieving revision 1.9.4.2
diff -C2 -d -r1.9.4.1 -r1.9.4.2
*** PyIType.cpp 29 Aug 2008 08:27:37 -0000 1.9.4.1
--- PyIType.cpp 26 Nov 2008 07:17:39 -0000 1.9.4.2
***************
*** 412,416 ****
return NULL;
}
! LCID lcid;
UINT offset = 0;
if ( argc > 1 )
--- 412,416 ----
return NULL;
}
! LCID lcid = LOCALE_SYSTEM_DEFAULT;
UINT offset = 0;
if ( argc > 1 )
Index: PyICatInformation.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyICatInformation.cpp,v
retrieving revision 1.5.4.1
retrieving revision 1.5.4.2
diff -C2 -d -r1.5.4.1 -r1.5.4.2
*** PyICatInformation.cpp 13 Sep 2008 04:26:18 -0000 1.5.4.1
--- PyICatInformation.cpp 26 Nov 2008 07:17:39 -0000 1.5.4.2
***************
*** 135,138 ****
--- 135,139 ----
return PyCom_BuildPyException(hr, pMy, IID_ICatInformation);
PyObject *rc = PyWinObject_FromWCHAR(pResult);
+ // @comm The return type is a unicode object.
CoTaskMemFree(pResult);
return rc;
|