diff options
Diffstat (limited to 'plugins/dalvik')
-rw-r--r-- | plugins/dalvik/operands/args.c | 109 |
1 files changed, 7 insertions, 102 deletions
diff --git a/plugins/dalvik/operands/args.c b/plugins/dalvik/operands/args.c index 7eec5d7..b1aa59f 100644 --- a/plugins/dalvik/operands/args.c +++ b/plugins/dalvik/operands/args.c @@ -97,12 +97,6 @@ static void g_dalvik_args_operand_update_inner_instances(GDalvikArgsOperand *, G /* Fournit l'empreinte d'un candidat à une centralisation. */ static guint g_dalvik_args_operand_hash(const GDalvikArgsOperand *, bool); -/* Charge un contenu depuis une mémoire tampon. */ -static bool g_dalvik_args_operand_load(GDalvikArgsOperand *, GObjectStorage *, packed_buffer_t *); - -/* Sauvegarde un contenu dans une mémoire tampon. */ -static bool g_dalvik_args_operand_store(GDalvikArgsOperand *, GObjectStorage *, packed_buffer_t *); - /* ---------------------------------------------------------------------------------- */ @@ -148,8 +142,8 @@ static void g_dalvik_args_operand_class_init(GDalvikArgsOperandClass *klass) operand->update_inner = (operand_update_inners_fc)g_dalvik_args_operand_update_inner_instances; operand->hash = (operand_hash_fc)g_dalvik_args_operand_hash; - operand->load = (load_operand_fc)g_dalvik_args_operand_load; - operand->store = (store_operand_fc)g_dalvik_args_operand_store; + operand->load = g_arch_operand_load_generic_variadic; + operand->store = g_arch_operand_store_generic_variadic; } @@ -586,15 +580,16 @@ static void g_dalvik_args_operand_update_inner_instances(GDalvikArgsOperand *ope { size_t i; /* Boucle de parcours */ - assert(count == operand->count); - for (i = 0; i < count; i++) - { g_object_unref(G_OBJECT(operand->args[i])); + operand->count = count; + operand->args = realloc(operand->args, operand->count * sizeof(GArchOperand *)); + + for (i = 0; i < count; i++) + { operand->args[i] = instances[i]; g_object_ref(G_OBJECT(instances[i])); - } } @@ -635,93 +630,3 @@ static guint g_dalvik_args_operand_hash(const GDalvikArgsOperand *operand, bool return result; } - - -/****************************************************************************** -* * -* Paramètres : operand = élément GLib à constuire. * -* storage = conservateur de données à manipuler ou NULL. * -* pbuf = zone tampon à lire. * -* * -* Description : Charge un contenu depuis une mémoire tampon. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static bool g_dalvik_args_operand_load(GDalvikArgsOperand *operand, GObjectStorage *storage, packed_buffer_t *pbuf) -{ - bool result; /* Bilan à retourner */ - GArchOperandClass *parent; /* Classe parente à consulter */ - uleb128_t value; /* Valeur ULEB128 à charger */ - size_t i; /* Boucle de parcours */ - GSerializableObject *arg; /* Nouvel argument à intégrer */ - - parent = G_ARCH_OPERAND_CLASS(g_dalvik_args_operand_parent_class); - - result = parent->load(G_ARCH_OPERAND(operand), storage, pbuf); - - if (result) - result = unpack_uleb128(&value, pbuf); - - if (result) - { - operand->count = value; - operand->args = calloc(operand->count, sizeof(GArchOperand *)); - } - - for (i = 0; i < operand->count && result; i++) - { - arg = g_object_storage_unpack_object(storage, "operands", pbuf); - if (arg == NULL) break; - - operand->args[operand->count - 1] = G_ARCH_OPERAND(arg); - - } - - result = (i == operand->count); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : operand = élément GLib à consulter. * -* storage = conservateur de données à manipuler ou NULL. * -* pbuf = zone tampon à remplir. * -* * -* Description : Sauvegarde un contenu dans une mémoire tampon. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static bool g_dalvik_args_operand_store(GDalvikArgsOperand *operand, GObjectStorage *storage, packed_buffer_t *pbuf) -{ - bool result; /* Bilan à retourner */ - GArchOperandClass *parent; /* Classe parente à consulter */ - size_t i; /* Boucle de parcours */ - GSerializableObject *arg; /* Nouvel argument à intégrer */ - - parent = G_ARCH_OPERAND_CLASS(g_dalvik_args_operand_parent_class); - - result = parent->store(G_ARCH_OPERAND(operand), storage, pbuf); - - if (result) - result = pack_uleb128((uleb128_t []){ operand->count }, pbuf); - - for (i = 0; i < operand->count && result; i++) - { - arg = G_SERIALIZABLE_OBJECT(operand->args[i]); - result = g_object_storage_pack_object(storage, "operands", arg, pbuf); - } - - return result; - -} |