diff options
Diffstat (limited to 'src/analysis/storage/tpmem.c')
-rw-r--r-- | src/analysis/storage/tpmem.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/analysis/storage/tpmem.c b/src/analysis/storage/tpmem.c index cda8223..0703aeb 100644 --- a/src/analysis/storage/tpmem.c +++ b/src/analysis/storage/tpmem.c @@ -65,7 +65,7 @@ struct _GTypeMemory GObject parent; /* A laisser en premier */ gtype_ref_info_t *gtypes; /* Types des objets reconnus */ - uint64_t count; /* Quantité de ces objets */ + size_t count; /* Quantité de ces objets */ GMutex mutex; /* Contrôle d'accès à la liste */ }; @@ -248,11 +248,19 @@ bool g_type_memory_load_types(GTypeMemory *tpmem, packed_buffer_t *pbuf) assert(tpmem->gtypes == NULL); tpmem->gtypes = calloc(count, sizeof(gtype_ref_info_t)); + setup_empty_rle_string(&str); + for (i = 0; i < tpmem->count && result; i++) { result = unpack_rle_string(&str, pbuf); if (!result) break; + if (get_rle_string(&str) == NULL) + { + exit_rle_string(&str); + break; + } + tpmem->gtypes[i].gtype = g_type_from_name(get_rle_string(&str)); result = (tpmem->gtypes[i].gtype != 0); @@ -291,12 +299,12 @@ bool g_type_memory_load_types(GTypeMemory *tpmem, packed_buffer_t *pbuf) GObject *g_type_memory_create_object(GTypeMemory *tpmem, packed_buffer_t *pbuf) { GObject *result; /* Nouvelle instance à renvoyer*/ - uint64_t index; /* Indice du point d'insertion */ + uleb128_t index; /* Indice du point d'insertion */ bool status; /* Bilan d'une récupération */ result = NULL; - status = extract_packed_buffer(pbuf, &index, sizeof(uint64_t), true); + status = unpack_uleb128(&index, pbuf); if (status) { @@ -318,7 +326,7 @@ GObject *g_type_memory_create_object(GTypeMemory *tpmem, packed_buffer_t *pbuf) * * * Paramètres : tpmem = mémoire à manipuler. * * obj = instance dont le type est à mémoriser. * -* pbuf = zone tampon à remplir. * +* pbuf = zone tampon à remplir. [OUT] * * * * Description : Sauvegarde le type d'un objet instancié. * * * @@ -332,7 +340,7 @@ bool g_type_memory_store_object_gtype(GTypeMemory *tpmem, GObject *obj, packed_b { bool result; /* Bilan à retourner */ GType gtype; /* Type à enregistrer */ - uint64_t index; /* Indice du point d'insertion */ + size_t index; /* Indice du point d'insertion */ gtype = G_TYPE_FROM_INSTANCE(obj); @@ -369,7 +377,7 @@ bool g_type_memory_store_object_gtype(GTypeMemory *tpmem, GObject *obj, packed_b g_mutex_unlock(&tpmem->mutex); - result = extend_packed_buffer(pbuf, &index, sizeof(uint64_t), true); + result = pack_uleb128((uleb128_t []){ index }, pbuf); } @@ -381,7 +389,7 @@ bool g_type_memory_store_object_gtype(GTypeMemory *tpmem, GObject *obj, packed_b /****************************************************************************** * * * Paramètres : tpmem = mémoire à consulter. * -* pbuf = zone tampon à remplir. * +* pbuf = zone tampon à remplir. [OUT] * * * * Description : Enregistre tous les types mémorisés dans un tampon. * * * |