Another change

This commit is contained in:
Serge Lamikhov-Center 2012-07-29 22:24:45 +03:00
parent 6d60be2dfd
commit e04476791a

View File

@ -39,7 +39,7 @@ class dump
out << "ELF Header\n" << std::endl; out << "ELF Header\n" << std::endl;
out << " Class: " out << " Class: "
<< str_elf_class( reader.get_class() ) << str_elf_class( reader.get_class() )
<< "(" << (int)reader.get_class() << ")" << " (" << (int)reader.get_class() << ")"
<< std::endl; << std::endl;
out << " Encoding: " out << " Encoding: "
<< ( ( ELFDATA2LSB == reader.get_encoding() ) ? "Little endian" : "" ) << ( ( ELFDATA2LSB == reader.get_encoding() ) ? "Little endian" : "" )
@ -59,8 +59,21 @@ class dump
} }
struct convert
{
Elf_Word type;
const char* str;
};
convert converts[] =
{
{ ELFCLASS32, "ELF32" },
{ ELFCLASS64, "ELF64" },
};
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
static std::string template<class T> static std::string
str_section_type( Elf_Word type ) str_section_type( Elf_Word type )
{ {
} }
@ -68,17 +81,6 @@ class dump
static std::string static std::string
str_elf_class( Elf_Word type ) str_elf_class( Elf_Word type )
{ {
struct convert
{
Elf_Word type;
const char* str;
};
convert converts[] =
{
{ ELFCLASS32, "ELF32" },
{ ELFCLASS64, "ELF64" },
};
std::string res = "UNKNOWN"; std::string res = "UNKNOWN";
for ( unsigned int i = 0; i < sizeof( converts )/sizeof( convert ); ++i ) { for ( unsigned int i = 0; i < sizeof( converts )/sizeof( convert ); ++i ) {
if ( converts[i].type == type ) { if ( converts[i].type == type ) {