From 17fed33fbde85312aef489e8c7115e414a1a74e7 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 27 Dec 2017 22:15:20 +0100 Subject: Reorganized a small part of binary loading. --- ChangeLog | 7 +++++++ src/analysis/loading.c | 16 +++++++++++++++- src/analysis/project.c | 33 --------------------------------- src/analysis/project.h | 15 --------------- 4 files changed, 22 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index 973d4ff..8116e75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 17-12-27 Cyrille Bagard + * src/analysis/loading.c: + * src/analysis/project.c: + * src/analysis/project.h: + Reorganize a small part of binary loading. + +17-12-27 Cyrille Bagard + * plugins/pychrysa/analysis/Makefile.am: Add the 'loaded.[ch]' files to libpychrysaanalysis_la_SOURCES. diff --git a/src/analysis/loading.c b/src/analysis/loading.c index 254939b..700a03f 100644 --- a/src/analysis/loading.c +++ b/src/analysis/loading.c @@ -27,6 +27,7 @@ #include "../core/formats.h" #include "../core/global.h" #include "../glibext/delayed-int.h" +#include "../glibext/signal.h" #include "../gui/panels/log.h" @@ -591,6 +592,7 @@ static void g_binary_loader_process(GBinaryLoader *loader, GtkStatusStack *statu { xmlDocPtr xdoc; /* Structure XML chargée */ xmlXPathContextPtr context; /* Contexte pour les XPath */ + GLoadedBinary *binary; /* Binaire désormais en place */ /* Tentative de chargement de binaire */ @@ -617,7 +619,19 @@ static void g_binary_loader_process(GBinaryLoader *loader, GtkStatusStack *statu if (loader->from_content) g_study_project_add_binary_content(loader->project, loader->content, PCS_ROOT/* FIXME : dstudy->state*/); - ack_loaded_binary(loader, loader->project); + binary = g_binary_loader_get_result(loader); + + if (binary != NULL) + { + g_signal_connect_to_main_swapped(binary, "disassembly-done", + G_CALLBACK(g_study_project_attach_content), loader->project, + g_cclosure_marshal_VOID__VOID); + + g_loaded_binary_analyse(binary); + + g_object_unref(G_OBJECT(binary)); + + } } diff --git a/src/analysis/project.c b/src/analysis/project.c index a5b59ab..31376de 100644 --- a/src/analysis/project.c +++ b/src/analysis/project.c @@ -39,7 +39,6 @@ #include "../core/global.h" #include "../core/params.h" #include "../glibext/delayed-int.h" -#include "../glibext/signal.h" #include "../gui/core/panels.h" #include "../gui/panels/log.h" #include "../gui/panels/panel.h" @@ -503,38 +502,6 @@ GBinContent *g_study_project_find_binary_content_by_hash(GStudyProject *project, /****************************************************************************** * * -* Paramètres : loader = travail de chargement mené à bien. * -* project = lieu d'intégration des résultats obtenus. * -* * -* Description : Acquitte la fin d'un chargement différé et complet. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void ack_loaded_binary(GBinaryLoader *loader, GStudyProject *project) -{ - GLoadedBinary *binary; /* Binaire désormais en place */ - - binary = g_binary_loader_get_result(loader); - - if (binary != NULL) - { - g_signal_connect_to_main_swapped(binary, "disassembly-done", - G_CALLBACK(g_study_project_attach_content), project, - g_cclosure_marshal_VOID__VOID); - - g_loaded_binary_analyse(binary); - - } - -} - - -/****************************************************************************** -* * * Paramètres : project = project à manipuler. * * content = contenu chargé à associer au projet actuel. * * * diff --git a/src/analysis/project.h b/src/analysis/project.h index 9e777ee..c6f6fc9 100644 --- a/src/analysis/project.h +++ b/src/analysis/project.h @@ -32,18 +32,6 @@ #include "loaded.h" -/** - * Comme "gui/panels/panel.h" inclut "gui/editem.h", qui inclut lui même - * ce fichier pour la mise à jour de la zone de projet, on redéfinit... - */ -//typedef struct _GPanelItem GPanelItem; - -/** - * Autre boucle sans fin similaire... - */ -typedef struct _GBinaryLoader GBinaryLoader; - - /* ------------------------- DEFINITION D'UN PROJET INTERNE ------------------------- */ @@ -95,9 +83,6 @@ void g_study_project_add_binary_content(GStudyProject *, GBinContent *, ProjectC /* Recherche un contenu binaire du projet selon son empreinte. */ GBinContent *g_study_project_find_binary_content_by_hash(GStudyProject *, const char *); -/* Acquitte la fin d'un chargement différé et complet. */ -void ack_loaded_binary(GBinaryLoader *, GStudyProject *); - /* Attache un contenu donné à un projet donné. */ void g_study_project_attach_content(GStudyProject *, GLoadedContent *); -- cgit v0.11.2-87-g4458