diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2023-05-31 12:15:43 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2024-04-16 10:39:42 +0000 |
commit | 34282d8ceffae49df4025a4517e152bcfa67e0e4 (patch) | |
tree | 08ba35f0e45660eb6f2ea73f015779919c3bdec1 | |
parent | a5e0b01214ffdbac811b89c6e19f657d3a0cf34b (diff) |
Fix potential symbol clash in the IIOF helpers
Since the IIOF helpers are compiled multiple times into different
handler binaries, there is a potential for symbol clash when they are
linked into the same app. Solve by enclosing the IIOF helper class in
a namespace specific to each handler.
Fixes: QTBUG-113349
Pick-to: 6.7 6.5
Change-Id: I9784d5f76d990222dba0ba12e3ca30bfaa9945cc
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r-- | src/plugins/imageformats/macheif/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/plugins/imageformats/macheif/main.cpp | 1 | ||||
-rw-r--r-- | src/plugins/imageformats/macheif/qmacheifhandler.cpp | 1 | ||||
-rw-r--r-- | src/plugins/imageformats/macheif/qmacheifhandler.h | 4 | ||||
-rw-r--r-- | src/plugins/imageformats/macjp2/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/plugins/imageformats/macjp2/qmacjp2handler.cpp | 2 | ||||
-rw-r--r-- | src/plugins/imageformats/shared/qiiofhelpers.cpp | 12 | ||||
-rw-r--r-- | src/plugins/imageformats/shared/qiiofhelpers_p.h | 4 |
8 files changed, 21 insertions, 7 deletions
diff --git a/src/plugins/imageformats/macheif/CMakeLists.txt b/src/plugins/imageformats/macheif/CMakeLists.txt index c64510b..6ceee54 100644 --- a/src/plugins/imageformats/macheif/CMakeLists.txt +++ b/src/plugins/imageformats/macheif/CMakeLists.txt @@ -19,6 +19,8 @@ qt_internal_add_plugin(QMacHeifPlugin qmacheifhandler.cpp qmacheifhandler.h INCLUDE_DIRECTORIES ../shared + DEFINES + NS_IIOF_HELPERS=QMacHeif LIBRARIES ${FWCoreFoundation} ${FWCoreGraphics} diff --git a/src/plugins/imageformats/macheif/main.cpp b/src/plugins/imageformats/macheif/main.cpp index 01a6aea..d209f20 100644 --- a/src/plugins/imageformats/macheif/main.cpp +++ b/src/plugins/imageformats/macheif/main.cpp @@ -4,7 +4,6 @@ #ifndef QT_NO_IMAGEFORMATPLUGIN #include <qmacheifhandler.h> -#include <qiiofhelpers_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/imageformats/macheif/qmacheifhandler.cpp b/src/plugins/imageformats/macheif/qmacheifhandler.cpp index bf9fa90..36e074f 100644 --- a/src/plugins/imageformats/macheif/qmacheifhandler.cpp +++ b/src/plugins/imageformats/macheif/qmacheifhandler.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qmacheifhandler.h" -#include "qiiofhelpers_p.h" #include <QVariant> QT_BEGIN_NAMESPACE diff --git a/src/plugins/imageformats/macheif/qmacheifhandler.h b/src/plugins/imageformats/macheif/qmacheifhandler.h index e150ff9..7593bee 100644 --- a/src/plugins/imageformats/macheif/qmacheifhandler.h +++ b/src/plugins/imageformats/macheif/qmacheifhandler.h @@ -6,14 +6,16 @@ #include <QScopedPointer> #include <QImageIOHandler> +#include "qiiofhelpers_p.h" QT_BEGIN_NAMESPACE +using namespace NS_IIOF_HELPERS; + class QImage; class QByteArray; class QIODevice; class QVariant; -class QIIOFHelper; class QMacHeifHandler : public QImageIOHandler { diff --git a/src/plugins/imageformats/macjp2/CMakeLists.txt b/src/plugins/imageformats/macjp2/CMakeLists.txt index 99aa1fd..dab50e5 100644 --- a/src/plugins/imageformats/macjp2/CMakeLists.txt +++ b/src/plugins/imageformats/macjp2/CMakeLists.txt @@ -14,6 +14,8 @@ qt_internal_add_plugin(QMacJp2Plugin qmacjp2handler.cpp qmacjp2handler.h INCLUDE_DIRECTORIES ../shared + DEFINES + NS_IIOF_HELPERS=QMacJp2 LIBRARIES ${FWCoreFoundation} ${FWCoreGraphics} diff --git a/src/plugins/imageformats/macjp2/qmacjp2handler.cpp b/src/plugins/imageformats/macjp2/qmacjp2handler.cpp index 4e04a8f..8b06250 100644 --- a/src/plugins/imageformats/macjp2/qmacjp2handler.cpp +++ b/src/plugins/imageformats/macjp2/qmacjp2handler.cpp @@ -7,6 +7,8 @@ QT_BEGIN_NAMESPACE +using namespace NS_IIOF_HELPERS; + class QMacJp2HandlerPrivate { Q_DECLARE_PUBLIC(QMacJp2Handler) diff --git a/src/plugins/imageformats/shared/qiiofhelpers.cpp b/src/plugins/imageformats/shared/qiiofhelpers.cpp index 58607e5..f288a96 100644 --- a/src/plugins/imageformats/shared/qiiofhelpers.cpp +++ b/src/plugins/imageformats/shared/qiiofhelpers.cpp @@ -11,6 +11,12 @@ QT_BEGIN_NAMESPACE +// QImage <-> CGImage conversion functions from QtGui on darwin +CGImageRef qt_mac_toCGImage(const QImage &qImage); +QImage qt_mac_toQImage(CGImageRef image); + +namespace NS_IIOF_HELPERS { + // Callbacks for sequential data provider & consumer: static size_t cbGetBytes(void *info, void *buffer, size_t count) @@ -55,10 +61,6 @@ static size_t cbPutBytes(void *info, const void *buffer, size_t count) } -// QImage <-> CGImage conversion functions from QtGui on darwin -CGImageRef qt_mac_toCGImage(const QImage &qImage); -QImage qt_mac_toQImage(CGImageRef image); - QImageIOPlugin::Capabilities QIIOFHelpers::systemCapabilities(const QString &uti) { QImageIOPlugin::Capabilities res; @@ -286,4 +288,6 @@ bool QIIOFHelper::writeImage(const QImage &in, const QString &uti) return CGImageDestinationFinalize(cgImageDest); } +} + QT_END_NAMESPACE diff --git a/src/plugins/imageformats/shared/qiiofhelpers_p.h b/src/plugins/imageformats/shared/qiiofhelpers_p.h index 7ebb079..b572f20 100644 --- a/src/plugins/imageformats/shared/qiiofhelpers_p.h +++ b/src/plugins/imageformats/shared/qiiofhelpers_p.h @@ -22,6 +22,8 @@ QT_BEGIN_NAMESPACE +namespace NS_IIOF_HELPERS { + /* Functions to utilize the native ImageIO Framework in OS X and iOS */ @@ -55,6 +57,8 @@ protected: QCFType<CFDictionaryRef> cfImageDict = nullptr; }; +} + QT_END_NAMESPACE #endif |