From 555e12fb47d57f354bcdd7fdd54be7be50eeba4c Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sat, 29 Dec 2012 00:22:21 +0000 Subject: Fixed an error about types of instructions and some GCC warnings. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@313 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- ChangeLog | 8 ++++++ plugins/androhelpers/switch.c | 3 ++ src/glibext/delayed.c | 67 ++++++++++++++++++++++++++++++++++++------- 3 files changed, 68 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index ecfde9f..0463c1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +12-12-29 Cyrille Bagard + + * plugins/androhelpers/switch.c: + Fix an error about types of instructions. + + * src/glibext/delayed.c: + Fix some GCC warnings and improve some GLib finalizations. + 12-12-28 Cyrille Bagard * plugins/pychrysa/analysis/binaries/module.c: diff --git a/plugins/androhelpers/switch.c b/plugins/androhelpers/switch.c index a6f6f5b..9e6f306 100644 --- a/plugins/androhelpers/switch.c +++ b/plugins/androhelpers/switch.c @@ -287,6 +287,9 @@ static void look_for_switch_instructions(const GDexMethod *method, GArchInstruct iter != NULL; iter = g_arch_instruction_get_next_iter(instrs, iter, end)) { + if (!G_IS_DALVIK_INSTRUCTION(iter)) + continue; + opcode = g_dalvik_instruction_get_opcode(G_DALVIK_INSTRUCTION(iter)); if (opcode != DOP_PACKED_SWITCH && opcode != DOP_SPARSE_SWITCH) diff --git a/src/glibext/delayed.c b/src/glibext/delayed.c index e4dc37e..ae943d7 100644 --- a/src/glibext/delayed.c +++ b/src/glibext/delayed.c @@ -96,6 +96,12 @@ static void g_typed_queue_class_init(GTypedQueueClass *); /* Initialise une instance de gestionnaire de travaux typés. */ static void g_typed_queue_init(GTypedQueue *); +/* Supprime toutes les références externes. */ +static void g_typed_queue_dispose(GTypedQueue *); + +/* Procède à la libération totale de la mémoire. */ +static void g_typed_queue_finalize(GTypedQueue *); + /* Crée un nouveau thread dédié à un type de travaux donné. */ static GTypedQueue *g_typed_queue_new(GType, GtkExtStatusBar *); @@ -214,14 +220,10 @@ static void g_delayed_work_init(GDelayedWork *work) static void g_delayed_work_dispose(GDelayedWork *work) { - gpointer obj_class; /* Classe parente */ - g_mutex_free(work->mutex); g_cond_free(work->cond); - obj_class = g_type_class_peek_parent(G_DELAYED_WORK_GET_CLASS(work)); - - //G_OBJECT_CLASS(obj_class)->dispose(G_OBJECT(work)); + G_OBJECT_CLASS(g_delayed_work_parent_class)->dispose(G_OBJECT(work)); } @@ -240,11 +242,7 @@ static void g_delayed_work_dispose(GDelayedWork *work) static void g_delayed_work_finalize(GDelayedWork *work) { - gpointer obj_class; /* Classe parente */ - - obj_class = g_type_class_peek_parent(G_DELAYED_WORK_GET_CLASS(work)); - - //G_OBJECT_CLASS(obj_class)->finalize(G_OBJECT(work)); + G_OBJECT_CLASS(g_delayed_work_parent_class)->finalize(G_OBJECT(work)); } @@ -326,6 +324,12 @@ G_DEFINE_TYPE(GTypedQueue, g_typed_queue, G_TYPE_OBJECT); static void g_typed_queue_class_init(GTypedQueueClass *klass) { + GObjectClass *object; /* Autre version de la classe */ + + object = G_OBJECT_CLASS(klass); + + object->dispose = (GObjectFinalizeFunc/* ! */)g_typed_queue_dispose; + object->finalize = (GObjectFinalizeFunc)g_typed_queue_finalize; } @@ -367,6 +371,47 @@ static void g_typed_queue_init(GTypedQueue *queue) /****************************************************************************** * * +* Paramètres : queue = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_typed_queue_dispose(GTypedQueue *queue) +{ + g_mutex_free(queue->mutex); + g_cond_free(queue->cond); + + G_OBJECT_CLASS(g_typed_queue_parent_class)->dispose(G_OBJECT(queue)); + +} + + +/****************************************************************************** +* * +* Paramètres : queue = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_typed_queue_finalize(GTypedQueue *queue) +{ + G_OBJECT_CLASS(g_typed_queue_parent_class)->finalize(G_OBJECT(queue)); + +} + + +/****************************************************************************** +* * * Paramètres : type = type dont seront marqués tous les travaux donnés.* * statusbar = barre de statut à tenir informée. * * * @@ -385,7 +430,9 @@ static GTypedQueue *g_typed_queue_new(GType type, GtkExtStatusBar *statusbar) result = g_object_new(G_TYPE_TYPED_QUEUE, NULL); result->type = type; + result->statusbar = statusbar; + g_object_ref(statusbar); return result; -- cgit v0.11.2-87-g4458