summaryrefslogtreecommitdiff
path: root/src/format/executable.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-06-07 19:02:07 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-06-07 19:02:07 (GMT)
commitb2b00f3dedf496e4b22cdd8cdc14d9c8cb7cd7ac (patch)
tree8b9473b858ff37e50d2ac01ad5e3339c85b49238 /src/format/executable.c
parent74063a8f0e00e1b53b45ddcbd47348d9acce3f67 (diff)
Introduced the flat file format.
Diffstat (limited to 'src/format/executable.c')
-rw-r--r--src/format/executable.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/format/executable.c b/src/format/executable.c
index a2ee569..e70840b 100644
--- a/src/format/executable.c
+++ b/src/format/executable.c
@@ -302,6 +302,7 @@ void g_executable_format_setup_portions(GExeFormat *format, GtkStatusStack *stat
GBinFormat *base; /* Version basique du format */
vmpa2t addr; /* Emplacement vide de sens */
phys_t length; /* Taille de portion globale */
+ GExeFormatClass *class; /* Classe de l'instance */
base = G_BIN_FORMAT(format);
@@ -314,7 +315,10 @@ void g_executable_format_setup_portions(GExeFormat *format, GtkStatusStack *stat
format->portions = g_binary_portion_new(BPC_RAW, &addr, length);
- G_EXE_FORMAT_GET_CLASS(format)->refine_portions(format);
+ class = G_EXE_FORMAT_GET_CLASS(format);
+
+ if (class->refine_portions != NULL)
+ class->refine_portions(format);
}
@@ -518,8 +522,15 @@ bool g_exe_format_translate_address_into_vmpa(GExeFormat *format, virt_t addr, v
bool g_exe_format_get_section_range_by_name(const GExeFormat *format, const char *name, mrange_t *range)
{
bool result; /* Bilan à retourner */
+ GExeFormatClass *class; /* Classe de l'instance */
+
+ class = G_EXE_FORMAT_GET_CLASS(format);
- result = G_EXE_FORMAT_GET_CLASS(format)->get_range_by_name(format, name, range);
+ if (class->get_range_by_name == NULL)
+ result = false;
+
+ else
+ result = class->get_range_by_name(format, name, range);
return result;