diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2025-01-14 03:02:42 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2025-01-14 03:02:42 (GMT) |
commit | d87c3d00f6448233cfcabc2b6d8bc82e395d4190 (patch) | |
tree | b2be6d75bd97189118124cb11fb1a535988dd4c4 /plugins/pychrysalide/format/executable.c | |
parent | 9d6c6af8ea3a21e206b0ffb65c04db5cca7154b1 (diff) |
Update code for Python abstract GLib objects constructors.
Diffstat (limited to 'plugins/pychrysalide/format/executable.c')
-rw-r--r-- | plugins/pychrysalide/format/executable.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/plugins/pychrysalide/format/executable.c b/plugins/pychrysalide/format/executable.c index 7d05578..f0d3d6b 100644 --- a/plugins/pychrysalide/format/executable.c +++ b/plugins/pychrysalide/format/executable.c @@ -47,9 +47,9 @@ /* Initialise la classe des formats exécutables. */ -static void py_executable_format_init_gclass(GExecutableFormatClass *, gpointer); +static int py_executable_format_init_gclass(GExecutableFormatClass *, PyTypeObject *); -CREATE_DYN_ABSTRACT_CONSTRUCTOR(executable_format, G_TYPE_EXECUTABLE_FORMAT, py_executable_format_init_gclass); +CREATE_DYN_ABSTRACT_CONSTRUCTOR(executable_format, G_TYPE_EXECUTABLE_FORMAT); /* Initialise une instance sur la base du dérivé de GObject. */ static int py_executable_format_init(PyObject *, PyObject *, PyObject *); @@ -95,23 +95,25 @@ static PyObject *py_executable_format_get_portions(PyObject *, void *); /****************************************************************************** * * -* Paramètres : class = classe à initialiser. * -* unused = données non utilisées ici. * +* Paramètres : gclass = classe GLib à initialiser. * +* pyclass = classe Python à initialiser. * * * * Description : Initialise la classe des formats exécutables. * * * -* Retour : - * +* Retour : 0 pour indiquer un succès de l'opération. * * * * Remarques : - * * * ******************************************************************************/ -static void py_executable_format_init_gclass(GExecutableFormatClass *class, gpointer unused) +static int py_executable_format_init_gclass(GExecutableFormatClass *gclass, PyTypeObject *pyclass) { - class->get_machine = py_executable_format_get_target_machine_wrapper; + PY_CLASS_SET_WRAPPER(gclass->get_machine, py_executable_format_get_target_machine_wrapper); - class->get_main_addr = py_executable_format_get_main_address_wrapper; - class->refine_portions = py_executable_format_refine_portions_wrapper; + PY_CLASS_SET_WRAPPER(gclass->get_main_addr, py_executable_format_get_main_address_wrapper); + PY_CLASS_SET_WRAPPER(gclass->refine_portions, py_executable_format_refine_portions_wrapper); + + return 0; } @@ -784,6 +786,8 @@ bool ensure_python_executable_format_is_registered(void) if (!ensure_python_program_format_is_registered()) return false; + pyg_register_class_init(G_TYPE_EXECUTABLE_FORMAT, (PyGClassInitFunc)py_executable_format_init_gclass); + if (!register_class_for_pygobject(dict, G_TYPE_EXECUTABLE_FORMAT, type)) return false; |