summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/qpluginloader.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-09-25 10:23:57 -0700
committerThiago Macieira <thiago.macieira@intel.com>2021-10-11 18:59:45 -0700
commitc89286b26abd7bad5918359e2f6fe7c5785dc94d (patch)
treeb1e4aff6fbc20970dfa24a31298979e580272eb7 /src/corelib/plugin/qpluginloader.cpp
parent326b91ea788b013512ae911c51cc19497d88916d (diff)
QPlugin: suppress the "QTMETADATA !" magic in static plugins
The .qtmetadata section is already suppressed for static plugins, but we carried this unnecessary magic string. For library file formats where we don't have a scanner (Windows COFF PE), a library that linked multiple static plugins could end up with multiple metadata found. We can't suppress the header because the version of moc could be different to the version of Qt, so we need to read the header version too. Right now, the version isn't output by moc (all the logic is in qplugin.h), but this could change again in the future. In any case, 4 extra bytes are not a big deal, so the header stays. Change-Id: I3eb1bd30e0124f89a052fffd16a82088d8303081 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/plugin/qpluginloader.cpp')
-rw-r--r--src/corelib/plugin/qpluginloader.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index e0cd8e7c450..9afdf0e5374 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -477,12 +477,10 @@ QList<QStaticPlugin> QPluginLoader::staticPlugins()
*/
QJsonObject QStaticPlugin::metaData() const
{
- Q_ASSERT(rawMetaDataSize >= qsizetype(sizeof(QPluginMetaData::MagicHeader)));
auto ptr = static_cast<const char *>(rawMetaData);
- ptr += sizeof(QPluginMetaData::MagicString);
QString errMsg;
- QJsonDocument doc = qJsonFromRawLibraryMetaData(ptr, rawMetaDataSize - sizeof(QPluginMetaData::MagicString), &errMsg);
+ QJsonDocument doc = qJsonFromRawLibraryMetaData(ptr, rawMetaDataSize, &errMsg);
Q_ASSERT(doc.isObject());
Q_ASSERT(errMsg.isEmpty());
return doc.object();