summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2025-01-14 03:02:42 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2025-01-14 03:02:42 (GMT)
commitd87c3d00f6448233cfcabc2b6d8bc82e395d4190 (patch)
treeb2be6d75bd97189118124cb11fb1a535988dd4c4 /plugins/pychrysalide/analysis
parent9d6c6af8ea3a21e206b0ffb65c04db5cca7154b1 (diff)
Update code for Python abstract GLib objects constructors.
Diffstat (limited to 'plugins/pychrysalide/analysis')
-rw-r--r--plugins/pychrysalide/analysis/content.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/plugins/pychrysalide/analysis/content.c b/plugins/pychrysalide/analysis/content.c
index dd9c1c1..c271139 100644
--- a/plugins/pychrysalide/analysis/content.c
+++ b/plugins/pychrysalide/analysis/content.c
@@ -50,9 +50,9 @@
/* Initialise la classe générique des contenus de binaire. */
-static void py_binary_content_init_gclass(GBinContentClass *, gpointer);
+static int py_binary_content_init_gclass(GBinContentClass *, PyTypeObject *);
-CREATE_DYN_ABSTRACT_CONSTRUCTOR(binary_content, G_TYPE_BIN_CONTENT, py_binary_content_init_gclass);
+CREATE_DYN_ABSTRACT_CONSTRUCTOR(binary_content, G_TYPE_BIN_CONTENT);
/* Initialise une instance sur la base du dérivé de GObject. */
static int py_binary_content_init(PyObject *, PyObject *, PyObject *);
@@ -163,37 +163,39 @@ static PyObject *py_binary_content_get_data(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 générique des contenus de binaire. *
* *
-* Retour : - *
+* Retour : 0 pour indiquer un succès de l'opération. *
* *
* Remarques : - *
* *
******************************************************************************/
-static void py_binary_content_init_gclass(GBinContentClass *class, gpointer unused)
+static int py_binary_content_init_gclass(GBinContentClass *gclass, PyTypeObject *pyclass)
{
- class->describe = py_binary_content_describe_wrapper;
+ PY_CLASS_SET_WRAPPER(gclass->describe, py_binary_content_describe_wrapper);
+
+ PY_CLASS_SET_WRAPPER(gclass->compute_checksum, py_binary_content_compute_checksum_wrapper);
- class->compute_checksum = py_binary_content_compute_checksum_wrapper;
+ PY_CLASS_SET_WRAPPER(gclass->compute_size, py_binary_content_compute_size_wrapper);
+ PY_CLASS_SET_WRAPPER(gclass->compute_start_pos, py_binary_content_compute_start_pos_wrapper);
+ PY_CLASS_SET_WRAPPER(gclass->compute_end_pos, py_binary_content_compute_end_pos_wrapper);
- class->compute_size = py_binary_content_compute_size_wrapper;
- class->compute_start_pos = py_binary_content_compute_start_pos_wrapper;
- class->compute_end_pos = py_binary_content_compute_end_pos_wrapper;
+ PY_CLASS_SET_WRAPPER(gclass->seek, py_binary_content_seek_wrapper);
- class->seek = py_binary_content_seek_wrapper;
+ PY_CLASS_SET_WRAPPER(gclass->read_raw, py_binary_content_read_raw_wrapper);
+ PY_CLASS_SET_WRAPPER(gclass->read_u8, py_binary_content_read_u8_wrapper);
+ PY_CLASS_SET_WRAPPER(gclass->read_u16, py_binary_content_read_u16_wrapper);
+ PY_CLASS_SET_WRAPPER(gclass->read_u32, py_binary_content_read_u32_wrapper);
+ PY_CLASS_SET_WRAPPER(gclass->read_u64, py_binary_content_read_u64_wrapper);
- class->read_raw = py_binary_content_read_raw_wrapper;
- class->read_u8 = py_binary_content_read_u8_wrapper;
- class->read_u16 = py_binary_content_read_u16_wrapper;
- class->read_u32 = py_binary_content_read_u32_wrapper;
- class->read_u64 = py_binary_content_read_u64_wrapper;
+ PY_CLASS_SET_WRAPPER(gclass->read_uleb128, py_binary_content_read_uleb128_wrapper);
+ PY_CLASS_SET_WRAPPER(gclass->read_leb128, py_binary_content_read_leb128_wrapper);
- class->read_uleb128 = py_binary_content_read_uleb128_wrapper;
- class->read_leb128 = py_binary_content_read_leb128_wrapper;
+ return 0;
}
@@ -2248,6 +2250,8 @@ bool ensure_python_binary_content_is_registered(void)
dict = PyModule_GetDict(module);
+ pyg_register_class_init(G_TYPE_BIN_CONTENT, (PyGClassInitFunc)py_binary_content_init_gclass);
+
if (!register_class_for_pygobject(dict, G_TYPE_BIN_CONTENT, type))
return false;