From 4e295155bbdc0b83556f4b5f77c76a1d192b74ba Mon Sep 17 00:00:00 2001 From: "elias.bachaalany@gmail.com" Date: Fri, 28 Jun 2013 01:32:56 +0000 Subject: [PATCH] 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() --- build.py | 7 +++++++ pywraps/py_idp.hpp | 2 +- pywraps/py_typeinf.hpp | 2 +- swig/nalt.i | 22 +++++++++++----------- swig/typeinf.i | 2 +- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/build.py b/build.py index d3b45a0..e855b17 100644 --- a/build.py +++ b/build.py @@ -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) diff --git a/pywraps/py_idp.hpp b/pywraps/py_idp.hpp index 93a061e..f8c0b82 100644 --- a/pywraps/py_idp.hpp +++ b/pywraps/py_idp.hpp @@ -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 ) { diff --git a/pywraps/py_typeinf.hpp b/pywraps/py_typeinf.hpp index d589f64..d7eed11 100644 --- a/pywraps/py_typeinf.hpp +++ b/pywraps/py_typeinf.hpp @@ -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); diff --git a/swig/nalt.i b/swig/nalt.i index edbbaeb..cf1c3ac 100644 --- a/swig/nalt.i +++ b/swig/nalt.i @@ -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); } diff --git a/swig/typeinf.i b/swig/typeinf.i index 274bc77..b96ce07 100644 --- a/swig/typeinf.i +++ b/swig/typeinf.i @@ -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);