summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-09-09 20:14:13 -0700
committerThiago Macieira <thiago.macieira@intel.com>2021-09-14 12:25:54 -0700
commitde9d7b0b25245b73d4da63552e5fa24e7fb8578a (patch)
treef2963a2749d348f160fd38b3e59cd3e56821e538 /src/corelib/plugin
parent33a870afae5434d9463b9d9877127078cdd3c8e3 (diff)
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>
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/qelfparser_p.cpp4
-rw-r--r--src/corelib/plugin/qelfparser_p.h1
2 files changed, 2 insertions, 3 deletions
diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp
index 46df38debc..07f9a5323b 100644
--- a/src/corelib/plugin/qelfparser_p.cpp
+++ b/src/corelib/plugin/qelfparser_p.cpp
@@ -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"));
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
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)
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library, QLibrary::tr("wrong cpu architecture"));
return Corrupt;
diff --git a/src/corelib/plugin/qelfparser_p.h b/src/corelib/plugin/qelfparser_p.h
index 0a3470dab7..bd967e53ae 100644
--- a/src/corelib/plugin/qelfparser_p.h
+++ b/src/corelib/plugin/qelfparser_p.h
@@ -82,7 +82,6 @@ public:
qelfoff_t size;
};
- int m_bits;
qelfoff_t m_stringTableFileOffset;
const char *parseSectionHeader(const char* s, ElfSectionHeader *sh);