mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-10 05:47:09 +01:00
Add a convenience function to the API for creating a writable buffer object from a pointer and size.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71407 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -95,6 +95,13 @@ inline void wxPyEndAllowThreads(PyThreadState* saved) {
|
||||
#define RETURN_NONE() { wxPyBLOCK_THREADS(Py_INCREF(Py_None)); return Py_None; }
|
||||
|
||||
|
||||
inline PyObject* wxPyMakeBuffer(void* ptr, Py_ssize_t len) {
|
||||
Py_buffer view;
|
||||
PyBuffer_FillInfo(&view, NULL, ptr, len, 0, PyBUF_WRITABLE|PyBUF_FORMAT|PyBUF_ND);
|
||||
return PyMemoryView_FromBuffer(&view);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// These are the API items whose implementation can not or should not be
|
||||
// inline functions or macros. The implementations will instead be accessed
|
||||
|
||||
@@ -37,9 +37,6 @@
|
||||
|
||||
// This isn't being used anywhere yet, but it should work.
|
||||
%ConvertFromTypeCode
|
||||
Py_buffer view;
|
||||
PyBuffer_FillInfo(&view, NULL, sipCpp->m_ptr, sipCpp->m_len, 0,
|
||||
PyBUF_WRITABLE|PyBUF_FORMAT|PyBUF_ND);
|
||||
return PyMemoryView_FromBuffer(&view);
|
||||
return wxPyMakeBuffer(sipCpp->m_ptr, sipCpp->m_len);
|
||||
%End
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user