mirror of
https://github.com/cemu-project/idapython.git
synced 2024-12-29 11:11:51 +01:00
added from_cobject method to both loader_input_t and qfile_t python classes
This commit is contained in:
parent
b9465ab7f6
commit
7970f9696d
@ -145,6 +145,17 @@ public:
|
||||
return l;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// This method can be used to pass a linput_t* from C code
|
||||
static loader_input_t *from_cobject(PyObject *pycobject)
|
||||
{
|
||||
if (!PyCObject_Check(pycobject))
|
||||
return NULL;
|
||||
loader_input_t *l = new loader_input_t();
|
||||
l->set_linput((linput_t *)PyCObject_AsVoidPtr(pycobject));
|
||||
return l;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
static loader_input_t *from_fp(FILE *fp)
|
||||
{
|
||||
|
@ -75,6 +75,13 @@ public:
|
||||
return qf;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// This method can be used to pass a FILE* from C code
|
||||
static qfile_t *from_cobject(PyObject *pycobject)
|
||||
{
|
||||
return PyCObject_Check(pycobject) ? from_fp((FILE *)PyCObject_AsVoidPtr(pycobject)) : NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
static qfile_t *tmpfile()
|
||||
{
|
||||
@ -162,7 +169,7 @@ public:
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
int write(PyObject *py_buf, bool big_endian)
|
||||
int writebytes(PyObject *py_buf, bool big_endian)
|
||||
{
|
||||
int sz = PyString_GET_SIZE(py_buf);
|
||||
void *buf = (void *)PyString_AS_STRING(py_buf);
|
||||
|
Loading…
Reference in New Issue
Block a user