QtGui: Disambiguate static variables

They cause clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: I3c51fb41d29e5c649537b999dced7e2d413b26a7
Done-with: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit 438096371c32ea6fdcd31d6d4ad2b6d3f29fab71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Friedemann Kleint 2023-01-23 11:34:46 +01:00 committed by Qt Cherry-pick Bot
parent 1d378b87cb
commit 9df96b3e09
9 changed files with 42 additions and 42 deletions

View File

@ -437,7 +437,7 @@ QAccessibleInterface::~QAccessibleInterface()
/* accessible widgets plugin discovery stuff */
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, acLoader,
(QAccessibleFactoryInterface_iid, "/accessible"_L1))
typedef QHash<QString, QAccessiblePlugin*> QAccessiblePluginsHash;
Q_GLOBAL_STATIC(QAccessiblePluginsHash, qAccessiblePlugins)
@ -683,9 +683,9 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
// no entry in the cache try to create it using the plugin loader.
if (!qAccessiblePlugins()->contains(cn)) {
QAccessiblePlugin *factory = nullptr; // 0 means "no plugin found". This is cached as well.
const int index = loader()->indexOf(cn);
const int index = acLoader()->indexOf(cn);
if (index != -1)
factory = qobject_cast<QAccessiblePlugin *>(loader()->instance(index));
factory = qobject_cast<QAccessiblePlugin *>(acLoader()->instance(index));
qAccessiblePlugins()->insert(cn, factory);
}

View File

@ -515,12 +515,12 @@ bool QPixmapIconEngine::write(QDataStream &out) const
return true;
}
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, iceLoader,
(QIconEngineFactoryInterface_iid, "/iconengines"_L1, Qt::CaseInsensitive))
QFactoryLoader *qt_iconEngineFactoryLoader()
{
return loader();
return iceLoader();
}
@ -1019,9 +1019,9 @@ void QIcon::addPixmap(const QPixmap &pixmap, Mode mode, State state)
static QIconEngine *iconEngineFromSuffix(const QString &fileName, const QString &suffix)
{
if (!suffix.isEmpty()) {
const int index = loader()->indexOf(suffix);
const int index = iceLoader()->indexOf(suffix);
if (index != -1) {
if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index))) {
if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(iceLoader()->instance(index))) {
return factory->create(fileName);
}
}
@ -1434,9 +1434,9 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon)
icon.d = new QIconPrivate(new QIconLoaderEngine());
icon.d->engine->read(s);
} else {
const int index = loader()->indexOf(key);
const int index = iceLoader()->indexOf(key);
if (index != -1) {
if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index))) {
if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(iceLoader()->instance(index))) {
if (QIconEngine *engine= factory->create()) {
icon.d = new QIconPrivate(engine);
engine->read(s);

View File

@ -15,9 +15,9 @@ namespace QImageReaderWriterHelpers {
#ifndef QT_NO_IMAGEFORMATPLUGIN
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, irhLoader,
(QImageIOHandlerFactoryInterface_iid, "/imageformats"_L1))
Q_GLOBAL_STATIC(QMutex, loaderMutex)
Q_GLOBAL_STATIC(QMutex, irhLoaderMutex)
static void appendImagePluginFormats(QFactoryLoader *loader,
QImageIOPlugin::Capability cap,
@ -68,9 +68,9 @@ static void appendImagePluginMimeTypes(QFactoryLoader *loader,
QSharedPointer<QFactoryLoader> pluginLoader()
{
loaderMutex()->lock();
return QSharedPointer<QFactoryLoader>(loader(), [](QFactoryLoader *) {
loaderMutex()->unlock();
irhLoaderMutex()->lock();
return QSharedPointer<QFactoryLoader>(irhLoader(), [](QFactoryLoader *) {
irhLoaderMutex()->unlock();
});
}
@ -89,7 +89,7 @@ QList<QByteArray> supportedImageFormats(Capability cap)
formats << _qt_BuiltInFormats[i].extension;
#ifndef QT_NO_IMAGEFORMATPLUGIN
appendImagePluginFormats(loader(), pluginCapability(cap), &formats);
appendImagePluginFormats(irhLoader(), pluginCapability(cap), &formats);
#endif // QT_NO_IMAGEFORMATPLUGIN
std::sort(formats.begin(), formats.end());
@ -105,7 +105,7 @@ QList<QByteArray> supportedMimeTypes(Capability cap)
mimeTypes.append(QByteArrayLiteral("image/") + fmt.mimeType);
#ifndef QT_NO_IMAGEFORMATPLUGIN
appendImagePluginMimeTypes(loader(), pluginCapability(cap), &mimeTypes);
appendImagePluginMimeTypes(irhLoader(), pluginCapability(cap), &mimeTypes);
#endif // QT_NO_IMAGEFORMATPLUGIN
std::sort(mimeTypes.begin(), mimeTypes.end());
@ -127,7 +127,7 @@ QList<QByteArray> imageFormatsForMimeType(const QByteArray &mimeType, Capability
#ifndef QT_NO_IMAGEFORMATPLUGIN
QList<QByteArray> mimeTypes;
QList<QByteArray> keys;
appendImagePluginMimeTypes(loader(), pluginCapability(cap), &mimeTypes, &keys);
appendImagePluginMimeTypes(irhLoader(), pluginCapability(cap), &mimeTypes, &keys);
for (int i = 0; i < mimeTypes.size(); ++i) {
if (mimeTypes.at(i) == mimeType) {
const auto &key = keys.at(i);

View File

@ -12,7 +12,7 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, gpLoader,
(QGenericPluginFactoryInterface_iid, "/generic"_L1, Qt::CaseInsensitive))
/*!
@ -34,7 +34,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
*/
QObject *QGenericPluginFactory::create(const QString& key, const QString &specification)
{
return qLoadPlugin<QObject, QGenericPlugin>(loader(), key.toLower(), specification);
return qLoadPlugin<QObject, QGenericPlugin>(gpLoader(), key.toLower(), specification);
}
/*!
@ -49,7 +49,7 @@ QStringList QGenericPluginFactory::keys()
typedef QMultiMap<int, QString> PluginKeyMap;
typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
const PluginKeyMap keyMap = loader()->keyMap();
const PluginKeyMap keyMap = gpLoader()->keyMap();
const PluginKeyMapConstIterator cend = keyMap.constEnd();
for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it)
if (!list.contains(it.value()))

View File

@ -15,14 +15,14 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
#if QT_CONFIG(settings)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, icLoader,
(QPlatformInputContextFactoryInterface_iid, "/platforminputcontexts"_L1, Qt::CaseInsensitive))
#endif
QStringList QPlatformInputContextFactory::keys()
{
#if QT_CONFIG(settings)
return loader()->keyMap().values();
return icLoader()->keyMap().values();
#else
return QStringList();
#endif
@ -42,7 +42,7 @@ QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key)
const QString platform = paramList.takeFirst().toLower();
QPlatformInputContext *ic = qLoadPlugin<QPlatformInputContext, QPlatformInputContextPlugin>
(loader(), platform, paramList);
(icLoader(), platform, paramList);
if (ic && ic->isValid())
return ic;

View File

@ -14,13 +14,13 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, piLoader,
(QPlatformIntegrationFactoryInterface_iid, "/platforms"_L1, Qt::CaseInsensitive))
QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platform, const QStringList &paramList, int &argc, char **argv, const QString &platformPluginPath)
{
loader->setExtraSearchPath(platformPluginPath);
return qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(loader(), platform, paramList, argc, argv);
piLoader->setExtraSearchPath(platformPluginPath);
return qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(piLoader(), platform, paramList, argc, argv);
}
/*!
@ -32,8 +32,8 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platfor
QStringList QPlatformIntegrationFactory::keys(const QString &platformPluginPath)
{
loader->setExtraSearchPath(platformPluginPath);
return loader->keyMap().values();
piLoader->setExtraSearchPath(platformPluginPath);
return piLoader->keyMap().values();
}
QT_END_NAMESPACE

View File

@ -16,15 +16,15 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, ptLoader,
(QPlatformThemeFactoryInterface_iid, "/platformthemes"_L1, Qt::CaseInsensitive))
QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString &platformPluginPath)
{
QStringList paramList = key.split(u':');
const QString platform = paramList.takeFirst().toLower();
loader->setExtraSearchPath(platformPluginPath);
QPlatformTheme *theme = qLoadPlugin<QPlatformTheme, QPlatformThemePlugin>(loader(), platform, paramList);
ptLoader->setExtraSearchPath(platformPluginPath);
QPlatformTheme *theme = qLoadPlugin<QPlatformTheme, QPlatformThemePlugin>(ptLoader(), platform, paramList);
if (theme)
theme->d_func()->name = key;
return theme;
@ -38,8 +38,8 @@ QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString
*/
QStringList QPlatformThemeFactory::keys(const QString &platformPluginPath)
{
loader->setExtraSearchPath(platformPluginPath);
return loader->keyMap().values();
ptLoader->setExtraSearchPath(platformPluginPath);
return ptLoader->keyMap().values();
}
QT_END_NAMESPACE

View File

@ -41,7 +41,7 @@ struct KTXHeader {
quint32 bytesOfKeyValueData;
};
static const quint32 headerSize = sizeof(KTXHeader);
static const quint32 qktxh_headerSize = sizeof(KTXHeader);
// Currently unused, declared for future reference
struct KTXKeyValuePairItem {
@ -94,7 +94,7 @@ QTextureFileData QKtxHandler::read()
const QByteArray buf = device()->readAll();
const quint32 dataSize = quint32(buf.size());
if (dataSize < headerSize || !canRead(QByteArray(), buf)) {
if (dataSize < qktxh_headerSize || !canRead(QByteArray(), buf)) {
qCDebug(lcQtGuiTextureIO, "Invalid KTX file %s", logName().constData());
return QTextureFileData();
}
@ -117,10 +117,10 @@ QTextureFileData QKtxHandler::read()
texData.setNumFaces(decode(header->numberOfFaces));
const quint32 bytesOfKeyValueData = decode(header->bytesOfKeyValueData);
if (headerSize + bytesOfKeyValueData < quint64(buf.size())) // oob check
texData.setKeyValueMetadata(
decodeKeyValues(QByteArrayView(buf.data() + headerSize, bytesOfKeyValueData)));
quint32 offset = headerSize + bytesOfKeyValueData;
if (qktxh_headerSize + bytesOfKeyValueData < quint64(buf.size())) // oob check
texData.setKeyValueMetadata(decodeKeyValues(
QByteArrayView(buf.data() + qktxh_headerSize, bytesOfKeyValueData)));
quint32 offset = qktxh_headerSize + bytesOfKeyValueData;
constexpr int MAX_ITERATIONS = 32; // cap iterations in case of corrupt data

View File

@ -13,7 +13,7 @@
QT_BEGIN_NAMESPACE
static const int headerSize = 16;
static const int qpkmh_headerSize = 16;
struct PkmType
{
@ -46,7 +46,7 @@ QTextureFileData QPkmHandler::read()
return texData;
QByteArray fileData = device()->readAll();
if (fileData.size() < headerSize || !canRead(QByteArray(), fileData)) {
if (fileData.size() < qpkmh_headerSize || !canRead(QByteArray(), fileData)) {
qCDebug(lcQtGuiTextureIO, "Invalid PKM file %s", logName().constData());
return QTextureFileData();
}
@ -75,7 +75,7 @@ QTextureFileData QPkmHandler::read()
QSize texSize(qFromBigEndian<quint16>(rawData + 12), qFromBigEndian<quint16>(rawData + 14));
texData.setSize(texSize);
texData.setDataOffset(headerSize);
texData.setDataOffset(qpkmh_headerSize);
if (!texData.isValid()) {
qCDebug(lcQtGuiTextureIO, "Invalid values in header of PKM file %s", logName().constData());