diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2020-05-21 12:08:29 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2020-05-21 12:08:29 (GMT) |
commit | 7e5b1add6fdeb74b2356acf8ccf7009f45cfa85e (patch) | |
tree | b7373554017e97fcbe24db79d9818272764e858d /plugins/mobicore | |
parent | 5dd935b27a765177960bdfe4d2fcb296cbbd41da (diff) |
Changed the hierarchy of format objects.
Diffstat (limited to 'plugins/mobicore')
-rw-r--r-- | plugins/mobicore/mclf-int.c | 4 | ||||
-rw-r--r-- | plugins/mobicore/mclf.c | 32 |
2 files changed, 20 insertions, 16 deletions
diff --git a/plugins/mobicore/mclf-int.c b/plugins/mobicore/mclf-int.c index d2d5b18..d947525 100644 --- a/plugins/mobicore/mclf-int.c +++ b/plugins/mobicore/mclf-int.c @@ -46,7 +46,7 @@ bool read_mclf_header(GMCLFFormat *format, mclf_header_t *header, SourceEndian e vmpa2t pos; /* Position de lecture */ uint32_t tmp; /* Espace de transition */ - content = G_BIN_FORMAT(format)->content; + content = G_KNOWN_FORMAT(format)->content; init_vmpa(&pos, 0, VMPA_NO_VIRTUAL); @@ -103,7 +103,7 @@ bool read_mclf_segment_desc(GMCLFFormat *format, segment_descriptor_t *segment, bool result; /* Bilan à retourner */ GBinContent *content; /* Contenu binaire à lire */ - content = G_BIN_FORMAT(format)->content; + content = G_KNOWN_FORMAT(format)->content; result = g_binary_content_read_u32(content, pos, endian, &segment->start); result &= g_binary_content_read_u32(content, pos, endian, &segment->len); diff --git a/plugins/mobicore/mclf.c b/plugins/mobicore/mclf.c index 12374b6..564a6df 100644 --- a/plugins/mobicore/mclf.c +++ b/plugins/mobicore/mclf.c @@ -50,10 +50,10 @@ static void g_mclf_format_dispose(GMCLFFormat *); static void g_mclf_format_finalize(GMCLFFormat *); /* Indique la désignation interne du format. */ -static const char *g_mclf_format_get_name(const GMCLFFormat *); +static char *g_mclf_format_get_key(const GMCLFFormat *); /* Fournit une description humaine du format. */ -static const char *g_mclf_format_get_description(const GMCLFFormat *); +static char *g_mclf_format_get_description(const GMCLFFormat *); /* Assure l'interprétation d'un format en différé. */ static bool g_mclf_format_analyze(GMCLFFormat *, wgroup_id_t, GtkStatusStack *); @@ -118,6 +118,7 @@ G_DEFINE_TYPE(GMCLFFormat, g_mclf_format, G_TYPE_EXE_FORMAT); static void g_mclf_format_class_init(GMCLFFormatClass *klass) { GObjectClass *object; /* Autre version de la classe */ + GKnownFormatClass *known; /* Version de format connu */ GBinFormatClass *fmt; /* Version en format basique */ GExeFormatClass *exe; /* Version en exécutable */ @@ -126,11 +127,14 @@ static void g_mclf_format_class_init(GMCLFFormatClass *klass) object->dispose = (GObjectFinalizeFunc/* ! */)g_mclf_format_dispose; object->finalize = (GObjectFinalizeFunc)g_mclf_format_finalize; + known = G_KNOWN_FORMAT_CLASS(klass); + + known->get_key = (known_get_key_fc)g_mclf_format_get_key; + known->get_desc = (known_get_desc_fc)g_mclf_format_get_description; + known->analyze = (known_analyze_fc)g_mclf_format_analyze; + fmt = G_BIN_FORMAT_CLASS(klass); - fmt->get_name = (format_get_name_fc)g_mclf_format_get_name; - fmt->get_desc = (format_get_desc_fc)g_mclf_format_get_description; - fmt->analyze = (format_analyze_fc)g_mclf_format_analyze; fmt->get_endian = (format_get_endian_fc)g_mclf_format_get_endianness; exe = G_EXE_FORMAT_CLASS(klass); @@ -218,7 +222,7 @@ GExeFormat *g_mclf_format_new(GBinContent *content) result = g_object_new(G_TYPE_MCLF_FORMAT, NULL); - g_binary_format_set_content(G_BIN_FORMAT(result), content); + g_known_format_set_content(G_KNOWN_FORMAT(result), content); return G_EXE_FORMAT(result); @@ -231,17 +235,17 @@ GExeFormat *g_mclf_format_new(GBinContent *content) * * * Description : Indique la désignation interne du format. * * * -* Retour : Description du format. * +* Retour : Désignation du format. * * * * Remarques : - * * * ******************************************************************************/ -static const char *g_mclf_format_get_name(const GMCLFFormat *format) +static char *g_mclf_format_get_key(const GMCLFFormat *format) { - const char *result; /* Désignation à retourner */ + char *result; /* Désignation à retourner */ - result = "mclf"; + result = strdup("mclf"); return result; @@ -260,11 +264,11 @@ static const char *g_mclf_format_get_name(const GMCLFFormat *format) * * ******************************************************************************/ -static const char *g_mclf_format_get_description(const GMCLFFormat *format) +static char *g_mclf_format_get_description(const GMCLFFormat *format) { - const char *result; /* Désignation à retourner */ + char *result; /* Désignation à retourner */ - result = "MobiCore Load Format"; + result = strdup("MobiCore Load Format"); return result; @@ -422,7 +426,7 @@ static void g_mclf_format_refine_portions(GMCLFFormat *format) /* Signature finale */ - length = g_binary_content_compute_size(G_BIN_FORMAT(format)->content); + length = g_binary_content_compute_size(G_KNOWN_FORMAT(format)->content); if (length > 521) { |