Fixed netnode::getblob()

This commit is contained in:
gergely.erdelyi 2009-05-04 19:07:51 +00:00
parent 9b6a6eda86
commit 791fde6af7
2 changed files with 37 additions and 3 deletions

View File

@ -43,6 +43,9 @@
#include "xref.hpp"
%}
// Do not create separate wrappers for default arguments
%feature("compactdefaultargs");
#ifdef __EA64__
%constant ea_t BADADDR = 0xFFFFFFFFFFFFFFFF;
%constant sel_t BADSEL = 0xFFFFFFFFFFFFFFFF;
@ -78,6 +81,7 @@ typedef long long longlong;
// Convert all of these
%cstring_output_maxstr_none(char *buf, size_t bufsize);
%binary_output_or_none(void *buf, size_t bufsize);
%binary_output_with_size(void *buf, size_t *bufsize);
// Accept single Python string for const void * + size input arguments
// For example: put_many_bytes() and patch_many_bytes()
@ -97,9 +101,6 @@ typedef long long longlong;
%pointer_class(sval_t, sval_pointer);
%pointer_class(sel_t, sel_pointer);
// Do not create separate wrappers for default arguments
%feature("compactdefaultargs");
%include "ida.i"
%include "idd.i"
%include "idp.i"

View File

@ -112,6 +112,39 @@
}
%enddef
%define %binary_output_with_size(TYPEMAP, SIZE)
%typemap (default) SIZE {
size_t ressize = MAXSPECSIZE;
$1 = &ressize;
}
%typemap(in,numinputs=0) (TYPEMAP, SIZE) {
#ifdef __cplusplus
$1 = (char *) new char[MAXSPECSIZE+1];
#else
$1 = (char *) malloc(MAXSPECSIZE+1);
#endif
}
%typemap(out) ssize_t {
/* REMOVING ssize_t return value in $symname */
}
%typemap(argout) (TYPEMAP,SIZE) {
if (result)
{
resultobj = PyString_FromStringAndSize((char *)$1, *$2);
}
else
{
Py_INCREF(Py_None);
resultobj = Py_None;
}
#ifdef __cplusplus
delete [] (char *)$1;
#else
free((char *)$1);
#endif
}
%enddef
// Check that the argument is a callable Python object
%typemap(in) PyObject *pyfunc {
if (!PyCallable_Check($input)) {