On 3/25/2007 4:06 PM, Phil Thompson wrote:
As of tonight's snapshot SIP has support for wchar_t. There are some issues
related to wide strings and the heap - see the documentation for details -
which could be partly addressed with some new annotations. I'd prefer that
any changes are based on real world examples, so let me have some feedback if
you use want to use wchar_t in your own bindings.
I used to use this code:
%MappedType wchar_t
{
%ConvertFromTypeCode
if (!sipCpp)
{
Py_INCREF (Py_None);
return Py_None;
}
return PyUnicode_FromUnicode(sipCpp, wcslen(sipCpp));
%End
%ConvertToTypeCode
if (sipIsErr == NULL)
return PyUnicode_Check(sipPy);
size_t sz = PyUnicode_GetSize(sipPy);
wchar_t *wc = new wchar_t[sz+1];
wc[sz] = 0;
PyUnicode_AsWideChar((PyUnicodeObject*)sipPy, wc, sz);
*sipCppPtr = wc;
sipTransferObj = Py_None;
return 1;
%End
};
I'm now testing the native wchar_t support without it, but do you
foresee any memory leak problems (which are pretty hard to find out...)?
--
Giovanni Bajo
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt