Fixed compilation bugs:

- Fixed small mismatch between SWIG define and CL defines (/DNO_OBSOLETE_FUNCS)
- Use print_type2() instead of the deprecated function print_type()
This commit is contained in:
elias.bachaalany@gmail.com 2013-06-28 01:32:56 +00:00
parent 21cd5a95eb
commit 4e295155bb
5 changed files with 21 additions and 14 deletions

View File

@ -358,6 +358,9 @@ def build_plugin(platform, idasdkdir, plugin_name, ea64):
if not '--no-early-load' in sys.argv:
platform_macros.append("PLUGINFIX")
# Turn off obsolete functions
platform_macros.append("NO_OBSOLETE_FUNCS")
# Build the wrapper from the interface files
ea64flag = ea64 and "-D__EA64__" or ""
swigcmd = "swig %s -Iswig -o idaapi.cpp %s -I%s idaapi.i" % (SWIG_OPTIONS, ea64flag, ida_include_directory)
@ -419,13 +422,17 @@ def build_binary_package(ea64, nukeold):
platform_string)
# Build the plugin
build_plugin(platform_string, IDA_SDK, plugin_name, ea64)
# Build the binary distribution
binmanifest = []
if nukeold:
binmanifest.extend(BINDIST_MANIFEST)
if not ea64 or nukeold:
binmanifest.extend([(x, "python") for x in "python/init.py", "python/idc.py", "python/idautils.py", "idaapi.py"])
binmanifest.append((plugin_name, "plugins"))
build_distribution(binmanifest, BINDISTDIR, ea64, nukeold)

View File

@ -319,7 +319,7 @@ static PyObject *ph_get_instruc()
{
Py_ssize_t i = 0;
PyObject *py_result = PyTuple_New(ph.instruc_end - ph.instruc_start);
for ( instruc_t *p = ph.instruc + ph.instruc_start, *end = ph.instruc + ph.instruc_end;
for ( const instruc_t *p = ph.instruc + ph.instruc_start, *end = ph.instruc + ph.instruc_end;
p != end;
++p )
{

View File

@ -63,7 +63,7 @@ def print_type(ea, on_line):
static PyObject *py_print_type(ea_t ea, bool one_line)
{
char buf[MAXSTR];
if ( print_type(ea, buf, sizeof(buf), one_line) )
if ( print_type2(ea, buf, sizeof(buf), one_line ? PRTYPE_1LINE : PRTYPE_MULTI) )
{
qstrncat(buf, ";", sizeof(buf));
return PyString_FromString(buf);

View File

@ -50,10 +50,10 @@ static int idaapi py_import_enum_cb(
PyObject *py_ea = Py_BuildValue(PY_FMT64, pyul_t(ea));
PYW_GIL_ENSURE;
PyObject *py_result = PyObject_CallFunctionObjArgs(
(PyObject *)param,
py_ea,
py_name,
py_ord,
(PyObject *)param,
py_ea,
py_name,
py_ord,
NULL);
PYW_GIL_RELEASE;
@ -79,7 +79,7 @@ switch_info_ex_t *switch_info_ex_t_get_clink(PyObject *self)
r = (switch_info_ex_t *) PyCObject_AsVoidPtr(attr);
else
r = NULL;
Py_DECREF(attr);
return r;
}
@ -111,7 +111,7 @@ static PyObject *py_get_import_module_name(int mod_index)
char buf[MAXSTR];
if ( !get_import_module_name(mod_index, buf, sizeof(buf)) )
Py_RETURN_NONE;
return PyString_FromString(buf);
}
@ -131,7 +131,7 @@ PyObject *py_get_switch_info_ex(ea_t ea)
{
switch_info_ex_t *ex = new switch_info_ex_t();
PyObject *py_obj;
if ( ::get_switch_info_ex(ea, ex, sizeof(switch_info_ex_t)) <= 0
if ( ::get_switch_info_ex(ea, ex, sizeof(switch_info_ex_t)) <= 0
|| (py_obj = create_idaapi_linked_class_instance(S_PY_SWIEX_CLSNAME, ex)) == NULL )
{
delete ex;
@ -151,7 +151,7 @@ def create_switch_xrefs(insn_ea, si):
will call it for switch tables
Note: Custom switch information are not supported yet.
@param insn_ea: address of the 'indirect jump' instruction
@param si: switch information
@ -179,7 +179,7 @@ idaman bool ida_export py_create_switch_xrefs(
def create_switch_table(insn_ea, si):
"""
Create switch table from the switch information
@param insn_ea: address of the 'indirect jump' instruction
@param si: switch information
@ -195,7 +195,7 @@ idaman bool ida_export py_create_switch_table(
switch_info_ex_t *swi = switch_info_ex_t_get_clink(py_swi);
if ( swi == NULL )
return false;
create_switch_table(insn_ea, swi);
return true;
}
@ -256,7 +256,7 @@ static int py_enum_import_names(int mod_index, PyObject *py_cb)
{
if ( !PyCallable_Check(py_cb) )
return -1;
return enum_import_names(mod_index, py_import_enum_cb, py_cb);
}

View File

@ -241,7 +241,7 @@ def print_type(ea, on_line):
static PyObject *py_print_type(ea_t ea, bool one_line)
{
char buf[MAXSTR];
if ( print_type(ea, buf, sizeof(buf), one_line) )
if ( print_type2(ea, buf, sizeof(buf), one_line ? PRTYPE_1LINE : PRTYPE_MULTI) )
{
qstrncat(buf, ";", sizeof(buf));
return PyString_FromString(buf);