From 18fe9a81c7531d22384e331a7ef78617c722de15 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Thu, 15 Aug 2019 10:34:22 +0200 Subject: Changed the order of arguments for the Python symbol constructor. --- plugins/pychrysalide/format/symbol.c | 4 ++-- tests/format/symbol.py | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/pychrysalide/format/symbol.c b/plugins/pychrysalide/format/symbol.c index 962c627..7de534c 100644 --- a/plugins/pychrysalide/format/symbol.c +++ b/plugins/pychrysalide/format/symbol.c @@ -243,8 +243,8 @@ static char *g_binary_symbol_get_label_wrapper(const GBinSymbol *symbol) static int py_binary_symbol_init(PyObject *self, PyObject *args, PyObject *kwds) { - SymbolType stype; /* Type prévu pour le symbole */ mrange_t range; /* Version native d'un espace */ + unsigned long stype; /* Type prévu pour le symbole */ int ret; /* Bilan de lecture des args. */ GBinSymbol *symbol; /* Version GLib du symble */ @@ -265,7 +265,7 @@ static int py_binary_symbol_init(PyObject *self, PyObject *args, PyObject *kwds) /* Récupération des paramètres */ - ret = PyArg_ParseTuple(args, "kO&", &stype, convert_any_to_mrange, &range); + ret = PyArg_ParseTuple(args, "O&k", convert_any_to_mrange, &range, &stype); if (!ret) return -1; if (stype >= STP_COUNT) diff --git a/tests/format/symbol.py b/tests/format/symbol.py index 6cffe57..6c4f573 100644 --- a/tests/format/symbol.py +++ b/tests/format/symbol.py @@ -19,7 +19,7 @@ class TestBinarySymbols(ChrysalideTestCase): saddr = vmpa(0x10, vmpa.VMPA_NO_VIRTUAL) srange = mrange(saddr, 0x3) - symbol = BinSymbol(BinSymbol.SymbolType.ENTRY_POINT, srange) + symbol = BinSymbol(srange, BinSymbol.SymbolType.ENTRY_POINT) self.assertEqual(symbol.range.length, 0x3) @@ -55,7 +55,7 @@ class TestBinarySymbols(ChrysalideTestCase): saddr = vmpa(0x10, vmpa.VMPA_NO_VIRTUAL) srange = mrange(saddr, 0x3) - symbol = BinSymbol(BinSymbol.SymbolType.ENTRY_POINT, srange) + symbol = BinSymbol(srange, BinSymbol.SymbolType.ENTRY_POINT) self.assertEqual(symbol.status, BinSymbol.SymbolStatus.INTERNAL) @@ -67,15 +67,15 @@ class TestBinarySymbols(ChrysalideTestCase): saddr = vmpa(0x100, vmpa.VMPA_NO_VIRTUAL) srange = mrange(saddr, 0x3) - symbol0 = BinSymbol(BinSymbol.SymbolType.ENTRY_POINT, srange) + symbol0 = BinSymbol(srange, BinSymbol.SymbolType.ENTRY_POINT) saddr = vmpa(0x10, vmpa.VMPA_NO_VIRTUAL) srange = mrange(saddr, 0x3) - symbol1 = BinSymbol(BinSymbol.SymbolType.ENTRY_POINT, srange) + symbol1 = BinSymbol(srange, BinSymbol.SymbolType.ENTRY_POINT) saddr = vmpa(0x100, vmpa.VMPA_NO_VIRTUAL) srange = mrange(saddr, 0x30) - symbol2 = BinSymbol(BinSymbol.SymbolType.ENTRY_POINT, srange) + symbol2 = BinSymbol(srange, BinSymbol.SymbolType.ENTRY_POINT) self.assertTrue(symbol0 == symbol0) @@ -95,7 +95,7 @@ class TestBinarySymbols(ChrysalideTestCase): saddr = vmpa(0x100, vmpa.VMPA_NO_VIRTUAL) srange = mrange(saddr, 0x3) - symbol = MySymbol(BinSymbol.SymbolType.ENTRY_POINT, srange) + symbol = MySymbol(srange, BinSymbol.SymbolType.ENTRY_POINT) self.assertEqual(symbol.label, 'AAA') @@ -106,7 +106,7 @@ class TestBinarySymbols(ChrysalideTestCase): class MyOtherSymbol(BinSymbol): pass - other = MyOtherSymbol(BinSymbol.SymbolType.ENTRY_POINT, srange) + other = MyOtherSymbol(srange, BinSymbol.SymbolType.ENTRY_POINT) self.assertEqual(other.label, None) -- cgit v0.11.2-87-g4458