Use PyObject_AsReadBuffer in the typemap for getting buffer or buffer

compatible  objects


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40911 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2006-08-29 18:56:07 +00:00
parent 1cc14cea1c
commit 074d2e0449

View File

@@ -319,16 +319,19 @@ MAKE_INT_ARRAY_TYPEMAPS(styles, styles_field)
// Typemaps for loading a image or bitmap from an object that implements the
// buffer interface
%typemap(in) (buffer data, int DATASIZE)
{ if ($input != Py_None) {
if (!PyArg_Parse($input, "t#", &$1, &$2)) SWIG_fail;
}}
{
if (PyObject_AsReadBuffer($input, (const void**)(&$1), &$2) == -1) SWIG_fail;
}
%typemap(in) (buffer alpha, int ALPHASIZE)
{ if ($input != Py_None) {
if (!PyArg_Parse($input, "t#", &$1, &$2)) SWIG_fail;
}}
{
if ($input != Py_None) {
if (PyObject_AsReadBuffer($input, (const void**)(&$1), &$2) == -1) SWIG_fail;
}
}
//---------------------------------------------------------------------------
// Typemaps to convert return values that are base class pointers