summaryrefslogtreecommitdiff
path: root/plugins/dex/method.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/dex/method.c')
-rw-r--r--plugins/dex/method.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/dex/method.c b/plugins/dex/method.c
index 5b7b30e..e5f6273 100644
--- a/plugins/dex/method.c
+++ b/plugins/dex/method.c
@@ -49,6 +49,10 @@ struct _GDexMethod
* en place à partir du constructeur g_dex_method_new_defined().
*/
+#ifndef NDEBUG
+ bool already_defined; /* Vérofication d'unicité */
+#endif
+
encoded_method info; /* Propriétés de la méthode */
bool has_body; /* Indication de présence */
code_item body; /* Corps de la méthode */
@@ -120,6 +124,9 @@ static void g_dex_method_class_init(GDexMethodClass *class)
static void g_dex_method_init(GDexMethod *method)
{
+#ifndef NDEBUG
+ method->already_defined = false;
+#endif
}
@@ -197,6 +204,11 @@ GDexMethod *g_dex_method_new_defined(GDexFormat *format, const encoded_method *s
if (result == NULL)
return NULL;
+#ifndef NDEBUG
+ assert(!result->already_defined);
+ result->already_defined = true;
+#endif
+
result->info = *seed;
result->has_body = (seed->code_off > 0);
@@ -253,17 +265,23 @@ GDexMethod *g_dex_method_new_defined(GDexFormat *format, const encoded_method *s
GDexMethod *g_dex_method_new_callable(GDexFormat *format, const method_id_item *method_id)
{
GDexMethod *result; /* Composant à retourner */
+ GDataType *ns; /* Espace d'appartenance */
const char *name; /* Nom de la routine finale */
GBinRoutine *routine; /* Routine représentée */
result = NULL;
+ ns = get_type_from_dex_pool(format, method_id->class_idx);
+
name = get_string_from_dex_pool(format, method_id->name_idx, NULL);
if (name == NULL) goto gdmne_exit;
routine = get_prototype_from_dex_pool(format, method_id->proto_idx);
if (routine == NULL) goto gdmne_exit;
+ if (ns != NULL)
+ g_binary_routine_set_namespace(routine, ns, strdup("."));
+
g_binary_routine_set_name(routine, strdup(name));
result = g_object_new(G_TYPE_DEX_METHOD, NULL);