QElfParser: remove one more unnecesary variable from the ELF parser

There's no need to keep this variable in the class.

Pick-to: 6.2
Change-Id: I2de1b4dfacd443148279fffd16a35775d56d3e45
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
This commit is contained in:
Thiago Macieira 2021-09-09 20:14:13 -07:00
parent 33a870afae
commit de9d7b0b25
2 changed files with 2 additions and 3 deletions

View File

@ -87,12 +87,12 @@ auto QElfParser::parse(const char *dataStart, ulong fdlen, const QString &librar
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library, QLibrary::tr("odd cpu architecture")); lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library, QLibrary::tr("odd cpu architecture"));
return Corrupt; return Corrupt;
} }
m_bits = (data[4] << 5);
/* If you remove this check, to read ELF objects of a different arch, please make sure you modify the typedefs /* If you remove this check, to read ELF objects of a different arch, please make sure you modify the typedefs
to match the _plugin_ architecture. to match the _plugin_ architecture.
*/ */
if ((sizeof(void*) == 4 && m_bits != 32) || (sizeof(void*) == 8 && m_bits != 64)) { constexpr int ExpectedClass = (sizeof(void *) == 4) ? 1 : 2;
if (data[4] != ExpectedClass) {
if (lib) if (lib)
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library, QLibrary::tr("wrong cpu architecture")); lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library, QLibrary::tr("wrong cpu architecture"));
return Corrupt; return Corrupt;

View File

@ -82,7 +82,6 @@ public:
qelfoff_t size; qelfoff_t size;
}; };
int m_bits;
qelfoff_t m_stringTableFileOffset; qelfoff_t m_stringTableFileOffset;
const char *parseSectionHeader(const char* s, ElfSectionHeader *sh); const char *parseSectionHeader(const char* s, ElfSectionHeader *sh);