Skip to content
This repository was archived by the owner on Dec 24, 2025. It is now read-only.

Commit 4e29515

Browse files
author
elias.bachaalany@gmail.com
committed
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()
1 parent 21cd5a9 commit 4e29515

5 files changed

Lines changed: 21 additions & 14 deletions

File tree

build.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,9 @@ def build_plugin(platform, idasdkdir, plugin_name, ea64):
358358
if not '--no-early-load' in sys.argv:
359359
platform_macros.append("PLUGINFIX")
360360

361+
# Turn off obsolete functions
362+
platform_macros.append("NO_OBSOLETE_FUNCS")
363+
361364
# Build the wrapper from the interface files
362365
ea64flag = ea64 and "-D__EA64__" or ""
363366
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):
419422
platform_string)
420423
# Build the plugin
421424
build_plugin(platform_string, IDA_SDK, plugin_name, ea64)
425+
422426
# Build the binary distribution
423427
binmanifest = []
424428
if nukeold:
425429
binmanifest.extend(BINDIST_MANIFEST)
430+
426431
if not ea64 or nukeold:
427432
binmanifest.extend([(x, "python") for x in "python/init.py", "python/idc.py", "python/idautils.py", "idaapi.py"])
433+
428434
binmanifest.append((plugin_name, "plugins"))
435+
429436
build_distribution(binmanifest, BINDISTDIR, ea64, nukeold)
430437

431438

pywraps/py_idp.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static PyObject *ph_get_instruc()
319319
{
320320
Py_ssize_t i = 0;
321321
PyObject *py_result = PyTuple_New(ph.instruc_end - ph.instruc_start);
322-
for ( instruc_t *p = ph.instruc + ph.instruc_start, *end = ph.instruc + ph.instruc_end;
322+
for ( const instruc_t *p = ph.instruc + ph.instruc_start, *end = ph.instruc + ph.instruc_end;
323323
p != end;
324324
++p )
325325
{

pywraps/py_typeinf.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def print_type(ea, on_line):
6363
static PyObject *py_print_type(ea_t ea, bool one_line)
6464
{
6565
char buf[MAXSTR];
66-
if ( print_type(ea, buf, sizeof(buf), one_line) )
66+
if ( print_type2(ea, buf, sizeof(buf), one_line ? PRTYPE_1LINE : PRTYPE_MULTI) )
6767
{
6868
qstrncat(buf, ";", sizeof(buf));
6969
return PyString_FromString(buf);

swig/nalt.i

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ static int idaapi py_import_enum_cb(
5050
PyObject *py_ea = Py_BuildValue(PY_FMT64, pyul_t(ea));
5151
PYW_GIL_ENSURE;
5252
PyObject *py_result = PyObject_CallFunctionObjArgs(
53-
(PyObject *)param,
54-
py_ea,
55-
py_name,
56-
py_ord,
53+
(PyObject *)param,
54+
py_ea,
55+
py_name,
56+
py_ord,
5757
NULL);
5858
PYW_GIL_RELEASE;
5959

@@ -79,7 +79,7 @@ switch_info_ex_t *switch_info_ex_t_get_clink(PyObject *self)
7979
r = (switch_info_ex_t *) PyCObject_AsVoidPtr(attr);
8080
else
8181
r = NULL;
82-
82+
8383
Py_DECREF(attr);
8484
return r;
8585
}
@@ -111,7 +111,7 @@ static PyObject *py_get_import_module_name(int mod_index)
111111
char buf[MAXSTR];
112112
if ( !get_import_module_name(mod_index, buf, sizeof(buf)) )
113113
Py_RETURN_NONE;
114-
114+
115115
return PyString_FromString(buf);
116116
}
117117

@@ -131,7 +131,7 @@ PyObject *py_get_switch_info_ex(ea_t ea)
131131
{
132132
switch_info_ex_t *ex = new switch_info_ex_t();
133133
PyObject *py_obj;
134-
if ( ::get_switch_info_ex(ea, ex, sizeof(switch_info_ex_t)) <= 0
134+
if ( ::get_switch_info_ex(ea, ex, sizeof(switch_info_ex_t)) <= 0
135135
|| (py_obj = create_idaapi_linked_class_instance(S_PY_SWIEX_CLSNAME, ex)) == NULL )
136136
{
137137
delete ex;
@@ -151,7 +151,7 @@ def create_switch_xrefs(insn_ea, si):
151151
will call it for switch tables
152152
153153
Note: Custom switch information are not supported yet.
154-
154+
155155
@param insn_ea: address of the 'indirect jump' instruction
156156
@param si: switch information
157157
@@ -179,7 +179,7 @@ idaman bool ida_export py_create_switch_xrefs(
179179
def create_switch_table(insn_ea, si):
180180
"""
181181
Create switch table from the switch information
182-
182+
183183
@param insn_ea: address of the 'indirect jump' instruction
184184
@param si: switch information
185185
@@ -195,7 +195,7 @@ idaman bool ida_export py_create_switch_table(
195195
switch_info_ex_t *swi = switch_info_ex_t_get_clink(py_swi);
196196
if ( swi == NULL )
197197
return false;
198-
198+
199199
create_switch_table(insn_ea, swi);
200200
return true;
201201
}
@@ -256,7 +256,7 @@ static int py_enum_import_names(int mod_index, PyObject *py_cb)
256256
{
257257
if ( !PyCallable_Check(py_cb) )
258258
return -1;
259-
259+
260260
return enum_import_names(mod_index, py_import_enum_cb, py_cb);
261261
}
262262

swig/typeinf.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def print_type(ea, on_line):
241241
static PyObject *py_print_type(ea_t ea, bool one_line)
242242
{
243243
char buf[MAXSTR];
244-
if ( print_type(ea, buf, sizeof(buf), one_line) )
244+
if ( print_type2(ea, buf, sizeof(buf), one_line ? PRTYPE_1LINE : PRTYPE_MULTI) )
245245
{
246246
qstrncat(buf, ";", sizeof(buf));
247247
return PyString_FromString(buf);

0 commit comments

Comments
 (0)