diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-09-19 22:28:42 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-09-19 22:28:42 (GMT) |
commit | 0e3059731d9687027c913135b3b856596c49a689 (patch) | |
tree | d3c3754f95c90ae50168817e6248afee6873fbf3 /src/format/dwarf | |
parent | 18648e4e8763a3bc005d6fae51eae3d1528d7d29 (diff) |
Extended the prototype for matching formats in order to get it suitable for plugins.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@577 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/dwarf')
-rw-r--r-- | src/format/dwarf/dwarf.c | 31 | ||||
-rw-r--r-- | src/format/dwarf/dwarf.h | 4 |
2 files changed, 23 insertions, 12 deletions
diff --git a/src/format/dwarf/dwarf.c b/src/format/dwarf/dwarf.c index db8335b..519aa49 100644 --- a/src/format/dwarf/dwarf.c +++ b/src/format/dwarf/dwarf.c @@ -47,18 +47,20 @@ static void g_dwarf_format_finalize(GDwarfFormat *); * * * Paramètres : content = contenu binaire à parcourir. * * parent = éventuel format exécutable déjà chargé. * +* unused = adresse non utilisée ici. * +* key = identifiant de format trouvé ou NULL. [OUT] * * * * Description : Indique si le format peut être pris en charge ici. * * * -* Retour : Désignation du format reconnu ou NULL si aucun. * +* Retour : Conclusion de haut niveau sur la reconnaissance effectuée. * * * * Remarques : - * * * ******************************************************************************/ -const char *dwarf_is_matching(GBinContent *content, GExeFormat *parent) +FormatMatchStatus dwarf_is_matching(GBinContent *content, GExeFormat *parent, void *unused, char **key) { - const char *result; /* Format détecté à renvoyer */ + FormatMatchStatus result; /* Bilan à renvoyer */ size_t i; /* Boucle de parcours */ mrange_t range; /* Couverture d'une section */ dw_section_header header; /* En-tête DWARF de section */ @@ -114,10 +116,10 @@ const char *dwarf_is_matching(GBinContent *content, GExeFormat *parent) 0 /* .debug_types */ }; - result = NULL; + result = FMS_UNKNOWN; if (parent == NULL) - return NULL; + return FMS_UNKNOWN; /* Lecture des indices présents */ @@ -159,23 +161,32 @@ const char *dwarf_is_matching(GBinContent *content, GExeFormat *parent) found = check_dwarf_version(dwarf_v4_versions, current_versions, ARRAY_SIZE(section_names)); if (found) - result = "dwarf_v4"; + { + result = FMS_MATCHED; + *key = strdup("dwarf_v4"); + } - if (result == NULL) + if (result == FMS_UNKNOWN) { found = check_dwarf_version(dwarf_v3_versions, current_versions, ARRAY_SIZE(section_names)); if (found) - result = "dwarf_v3"; + { + result = FMS_MATCHED; + *key = strdup("dwarf_v3"); + } } - if (result == NULL) + if (result == FMS_UNKNOWN) { found = check_dwarf_version(dwarf_v2_versions, current_versions, ARRAY_SIZE(section_names)); if (found) - result = "dwarf_v2"; + { + result = FMS_MATCHED; + *key = strdup("dwarf_v2"); + } } diff --git a/src/format/dwarf/dwarf.h b/src/format/dwarf/dwarf.h index a5e988b..da5b70a 100644 --- a/src/format/dwarf/dwarf.h +++ b/src/format/dwarf/dwarf.h @@ -25,7 +25,7 @@ #define _FORMAT_DWARF_DWARF_H -#include "../executable.h" +#include "../../core/formats.h" @@ -45,7 +45,7 @@ typedef struct _GDwarfFormatClass GDwarfFormatClass; /* Indique si le format peut être pris en charge ici. */ -const char *dwarf_is_matching(GBinContent *, GExeFormat *); +FormatMatchStatus dwarf_is_matching(GBinContent *, GExeFormat *, void *, char **); /* Indique le type défini pour un format de débogage DWARF. */ GType g_dwarf_format_get_type(void); |