From e15ecf7e79a1927d841e1cff914718d615d680e8 Mon Sep 17 00:00:00 2001 From: pancake Date: Tue, 9 Nov 2010 18:08:07 +0100 Subject: [PATCH] * Fix warning noticed by iphone-gcc - Bug in the compiler? --- libr/bin/format/elf/elf.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libr/bin/format/elf/elf.c b/libr/bin/format/elf/elf.c index 66e03ff5e6..5f130dfbb5 100644 --- a/libr/bin/format/elf/elf.c +++ b/libr/bin/format/elf/elf.c @@ -386,7 +386,8 @@ char* Elf_(r_bin_elf_get_machine_name)(struct Elf_(r_bin_elf_obj_t) *bin) { } char* Elf_(r_bin_elf_get_file_type)(struct Elf_(r_bin_elf_obj_t) *bin) { - switch (bin->ehdr.e_type) { + ut32 e_type = (ut32)bin->ehdr.e_type; // cast to avoid warn in iphone-gcc, must be ut16 + switch (e_type) { case ET_NONE: return strdup ("NONE (None)"); case ET_REL: return strdup ("REL (Relocatable file)"); case ET_EXEC: return strdup ("EXEC (Executable file)"); @@ -394,11 +395,11 @@ char* Elf_(r_bin_elf_get_file_type)(struct Elf_(r_bin_elf_obj_t) *bin) { case ET_CORE: return strdup ("CORE (Core file)"); } - if ((bin->ehdr.e_type >= ET_LOPROC) && (bin->ehdr.e_type <= ET_HIPROC)) - return r_str_dup_printf ("Processor Specific: %x", bin->ehdr.e_type); - else if ((bin->ehdr.e_type >= ET_LOOS) && (bin->ehdr.e_type <= ET_HIOS)) - return r_str_dup_printf ("OS Specific: %x", bin->ehdr.e_type); - else return r_str_dup_printf (": %x", bin->ehdr.e_type); + if ((e_type >= ET_LOPROC) && (e_type <= ET_HIPROC)) + return r_str_dup_printf ("Processor Specific: %x", e_type); + else if ((e_type >= ET_LOOS) && (e_type <= ET_HIOS)) + return r_str_dup_printf ("OS Specific: %x", e_type); + else return r_str_dup_printf (": %x", e_type); } char* Elf_(r_bin_elf_get_elf_class)(struct Elf_(r_bin_elf_obj_t) *bin) {