diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-02-28 17:39:48 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-03-01 20:15:47 (GMT) |
commit | 2245e2b3c4f4ff96cf462e76e24c04d4d0941996 (patch) | |
tree | fe32bed6dd26c4b4fa144c42db19771f02ca3ef5 /src/format/dex/method.c | |
parent | 11047009c222d3dba1380e63c3099cce0dbc6996 (diff) |
Dealt with the prototypes from the Dex pool.
Diffstat (limited to 'src/format/dex/method.c')
-rw-r--r-- | src/format/dex/method.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/format/dex/method.c b/src/format/dex/method.c index 316f094..bc4a063 100644 --- a/src/format/dex/method.c +++ b/src/format/dex/method.c @@ -24,6 +24,9 @@ #include "method.h" +#include <string.h> + + #include <i18n.h> @@ -40,6 +43,7 @@ struct _GDexMethod GBinRoutine *routine; /* Représentation interne */ + /* FIXME : méthode interne seulement */ encoded_method info; /* Propriétés de la méthode */ code_item body; /* Corps de la méthode */ off_t offset; /* Position du code */ @@ -220,14 +224,27 @@ GDexMethod *g_dex_method_new(GDexFormat *format, const encoded_method *seed, ule * * ******************************************************************************/ -GDexMethod *g_dex_method_new_empty(const GDexFormat *format, const method_id_item *method_id) +GDexMethod *g_dex_method_new_empty(GDexFormat *format, const method_id_item *method_id) { GDexMethod *result; /* Composant à retourner */ + const char *name; /* Nom de la routine finale */ + GBinRoutine *routine; /* Routine représentée */ + result = NULL; + name = get_string_from_dex_pool(format, method_id->name_idx); + if (name == NULL) goto gdmne_exit; + + routine = get_prototype_from_dex_pool(format, method_id->proto_idx); + if (routine == NULL) goto gdmne_exit; + + g_binary_routine_set_name(routine, strdup(name)); result = g_object_new(G_TYPE_DEX_METHOD, NULL); + result->routine = routine; + + gdmne_exit: return result; @@ -286,7 +303,13 @@ const code_item *g_dex_method_get_dex_body(const GDexMethod *method) GBinRoutine *g_dex_method_get_routine(const GDexMethod *method) { - return method->routine; + GBinRoutine *result; /* Instance à retourner */ + + result = method->routine; + + g_object_ref(G_OBJECT(result)); + + return result; } |