diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2025-03-16 14:13:17 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2025-03-16 14:13:17 (GMT) |
commit | c0c06b9e1cbb760b661a7adf4163cc6ba19828b3 (patch) | |
tree | 0cf4f6ef0051af5401cac31958b3a8ebafab204f /plugins | |
parent | a5469da2aa4cf44fa27e5a12234328824c755246 (diff) |
Update a GObject storage prototype to make its usage more convinient.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/pychrysalide/glibext/storage.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/plugins/pychrysalide/glibext/storage.c b/plugins/pychrysalide/glibext/storage.c index 4764700..f2962bf 100644 --- a/plugins/pychrysalide/glibext/storage.c +++ b/plugins/pychrysalide/glibext/storage.c @@ -309,32 +309,34 @@ static PyObject *py_object_storage_load_object(PyObject *self, PyObject *args) static PyObject *py_object_storage_unpack_object(PyObject *self, PyObject *args) { PyObject *result; /* Bilan à retourner */ - const char *name; /* Désignation de groupe #0 */ - const char *target_name; /* Désignation de groupe #1 */ + int fd; /* Flux de fonnées courant */ + const char *name; /* Désignation de groupe */ int ret; /* Bilan de lecture des args. */ GObjectStorage *storage; /* Mécanismes natifs */ GSerializableObject *object; /* Objet reconstruit ou NULL */ #define OBJECT_STORAGE_UNPACK_OBJECT_METHOD PYTHON_METHOD_DEF \ ( \ - unpack_object, "$self, name, target_name, /", \ + unpack_object, "$self, fd, name, /", \ METH_VARARGS, py_object_storage, \ "Load an object from a reference to serialized data.\n" \ "\n" \ - "The *name* is a string label for the group containing a position" \ - " pointing to a target object to load. The *target_name* is a" \ - " string label for the group of this target object.\n" \ + "The *fd* argument is a file descriptor pointing to the data" \ + " stream for a current object being restored. A reference to" \ + " another object belonging to a group pointed by the string *name*" \ + " should be available at the current read position for this data" \ + " stream.\n" \ "\n" \ "The result is a pychrysalide.analysis.storage.SerializableObject" \ " instancet in case of success, or *None* in case of failure." \ ) - ret = PyArg_ParseTuple(args, "sO&", &name, &target_name); + ret = PyArg_ParseTuple(args, "is", &fd, &name); if (!ret) return NULL; storage = G_OBJECT_STORAGE(pygobject_get(self)); - object = g_object_storage_unpack_object(storage, name, target_name); + object = g_object_storage_unpack_object(storage, fd, name); if (object != NULL) result = pygobject_new(G_OBJECT(object)); |