diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2021-06-17 22:26:46 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2021-06-17 22:26:46 (GMT) |
commit | 9283ead0b063e526fdcab00bcf86e2f10387a78f (patch) | |
tree | a042459e2a430269691d96b568bddffafa0d9514 /plugins/pychrysalide/analysis/storage | |
parent | 2db42544f80a9d5f0e30a0e7d09dfd98082a8a0b (diff) |
Update the storage format for type memory.
Diffstat (limited to 'plugins/pychrysalide/analysis/storage')
-rw-r--r-- | plugins/pychrysalide/analysis/storage/tpmem.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/plugins/pychrysalide/analysis/storage/tpmem.c b/plugins/pychrysalide/analysis/storage/tpmem.c index 8df20b2..491ee68 100644 --- a/plugins/pychrysalide/analysis/storage/tpmem.c +++ b/plugins/pychrysalide/analysis/storage/tpmem.c @@ -52,8 +52,8 @@ static int py_type_memory_init(PyObject *, PyObject *, PyObject *); /* -------------------------- TAMPON POUR CODE DESASSEMBLE -------------------------- */ -/* Apprend tous les types mémorisés dans un flux. */ -static PyObject *py_type_memory_read_types(PyObject *, PyObject *); +/* Apprend tous les types mémorisés dans un tampon. */ +static PyObject *py_type_memory_load_types(PyObject *, PyObject *); /* Crée une nouvelle instance d'objet à partir de son type. */ static PyObject *py_type_memory_create_object(PyObject *, PyObject *); @@ -61,8 +61,8 @@ static PyObject *py_type_memory_create_object(PyObject *, PyObject *); /* Sauvegarde le type d'un objet instancié. */ static PyObject *py_type_memory_store_object_gtype(PyObject *, PyObject *); -/* Enregistre tous les types mémorisés dans un flux. */ -static PyObject *py_type_memory_write_types(PyObject *, PyObject *); +/* Enregistre tous les types mémorisés dans un tampon. */ +static PyObject *py_type_memory_store_types(PyObject *, PyObject *); @@ -178,7 +178,7 @@ static int py_type_memory_init(PyObject *self, PyObject *args, PyObject *kwds) * Paramètres : self = classe représentant une mémorisation de types. * * args = arguments fournis à l'appel. * * * -* Description : Apprend tous les types mémorisés dans un flux. * +* Description : Apprend tous les types mémorisés dans un tampon. * * * * Retour : Bilan de l'opération. * * * @@ -186,36 +186,36 @@ static int py_type_memory_init(PyObject *self, PyObject *args, PyObject *kwds) * * ******************************************************************************/ -static PyObject *py_type_memory_read_types(PyObject *self, PyObject *args) +static PyObject *py_type_memory_load_types(PyObject *self, PyObject *args) { PyObject *result; /* Bilan à retourner */ - int fd; /* Flux ouvert en lecture */ + packed_buffer_t *pbuf; /* Tampon à consulter */ int ret; /* Bilan de lecture des args. */ GTypeMemory *tpmem; /* Mémorisation native */ bool status; /* Bilan de l'opération */ -#define TYPE_MEMORY_READ_TYPES_METHOD PYTHON_METHOD_DEF \ +#define TYPE_MEMORY_LOAD_TYPES_METHOD PYTHON_METHOD_DEF \ ( \ - read_types, "$self, fd", \ + load_types, "$self, pbuf", \ METH_VARARGS, py_type_memory, \ - "Read types from a stream.\n" \ + "Read types from a buffer.\n" \ "\n" \ "This operation is usually handled internally by the" \ " Chrysalide's core.\n" \ "\n" \ - "The *fd* parameter is an integer representing a valid" \ - " identifier for a file descriptor opened for reading." \ + "The *pbuf* parameter is a pychrysalide.common.PackedBuffer"\ + " instance providing buffered data to read." \ "\n" \ "The result is a boolean value indicating the status of" \ " the operation: True for success, False for failure." \ ) - ret = PyArg_ParseTuple(args, "i", &fd); + ret = PyArg_ParseTuple(args, "O&", convert_to_packed_buffer, &pbuf); if (!ret) return NULL; tpmem = G_TYPE_MEMORY(pygobject_get(self)); - status = g_type_memory_read_types(tpmem, fd); + status = g_type_memory_load_types(tpmem, pbuf); result = status ? Py_True : Py_False; Py_INCREF(result); @@ -330,7 +330,7 @@ static PyObject *py_type_memory_store_object_gtype(PyObject *self, PyObject *arg * Paramètres : self = classe représentant une mémorisation de types. * * args = arguments fournis à l'appel. * * * -* Description : Enregistre tous les types mémorisés dans un flux. * +* Description : Enregistre tous les types mémorisés dans un tampon. * * * * Retour : Bilan de l'opération. * * * @@ -338,36 +338,36 @@ static PyObject *py_type_memory_store_object_gtype(PyObject *self, PyObject *arg * * ******************************************************************************/ -static PyObject *py_type_memory_write_types(PyObject *self, PyObject *args) +static PyObject *py_type_memory_store_types(PyObject *self, PyObject *args) { PyObject *result; /* Bilan à retourner */ - int fd; /* Flux ouvert en lecture */ + packed_buffer_t *pbuf; /* Tampon à consulter */ int ret; /* Bilan de lecture des args. */ GTypeMemory *tpmem; /* Mémorisation native */ bool status; /* Bilan de l'opération */ -#define TYPE_MEMORY_WRITE_TYPES_METHOD PYTHON_METHOD_DEF \ +#define TYPE_MEMORY_STORE_TYPES_METHOD PYTHON_METHOD_DEF \ ( \ - write_types, "$self, fd", \ + store_types, "$self, pbuf", \ METH_VARARGS, py_type_memory, \ - "Write types into a stream.\n" \ + "Write types into a buffer.\n" \ "\n" \ "This operation is usually handled internally by the" \ " Chrysalide's core.\n" \ "\n" \ - "The *fd* parameter is an integer representing a valid" \ - " identifier for a file descriptor opened for writing." \ + "The *pbuf* parameter is a pychrysalide.common.PackedBuffer"\ + " instance providing buffered data to read." \ "\n" \ "The result is a boolean value indicating the status of" \ " the operation: True for success, False for failure." \ ) - ret = PyArg_ParseTuple(args, "i", &fd); + ret = PyArg_ParseTuple(args, "O&", convert_to_packed_buffer, &pbuf); if (!ret) return NULL; tpmem = G_TYPE_MEMORY(pygobject_get(self)); - status = g_type_memory_write_types(tpmem, fd); + status = g_type_memory_store_types(tpmem, pbuf); result = status ? Py_True : Py_False; Py_INCREF(result); @@ -392,10 +392,10 @@ static PyObject *py_type_memory_write_types(PyObject *self, PyObject *args) PyTypeObject *get_python_type_memory_type(void) { static PyMethodDef py_type_memory_methods[] = { - TYPE_MEMORY_READ_TYPES_METHOD, + TYPE_MEMORY_LOAD_TYPES_METHOD, TYPE_MEMORY_CREATE_OBJECT_METHOD, TYPE_MEMORY_STORE_OBJECT_GTYPE_METHOD, - TYPE_MEMORY_WRITE_TYPES_METHOD, + TYPE_MEMORY_STORE_TYPES_METHOD, { NULL } }; |