diff options
author | Tim Blechmann <tim@klingt.org> | 2022-05-05 10:15:34 +0800 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-05-06 00:55:34 +0000 |
commit | 3ce1642f4c3037030063b6ec3bb965739267cf65 (patch) | |
tree | 91e0ca4c28f9b9d0791a98ced86f5be544857c3f /src/plugins | |
parent | 9bf52680bc6beae9ed11a568fd65822a409d753f (diff) |
plugins: image formats - fix odr violation
When linking Qt statically, the image fomats are not separated into
different DSOs. when linking them into the same target, gcc warns
about an ODR violation between icohandler and bmphandler:
```
/usr/src/debug/qtbase/6.3.0-r0/build/include/QtGui/6.3.0/QtGui/private/../../../../../../git/src/gui/image/qbmphandler_p.h:69:8: warning: type ‘struct BMP_INFOHDR’ violates the C++ One Definition Rule [-Wodr]
/usr/src/debug/qtbase/6.3.0-r0/git/src/plugins/imageformats/ico/qicohandler.cpp:98: note: a different type is defined in another translation unit
/usr/src/debug/qtbase/6.3.0-r0/build/include/QtGui/6.3.0/QtGui/private/../../../../../../git/src/gui/image/qbmphandler_p.h:70:13: note: the first difference of corresponding definitions is field ‘biSize’
/usr/src/debug/qtbase/6.3.0-r0/git/src/plugins/imageformats/ico/qicohandler.cpp:87: note: a field of same name but different type is defined in another translation unit
/usr/src/debug/qtbase/6.3.0-r0/build/include/QtGui/6.3.0/QtGui/private/../../../../../../git/src/gui/image/qbmphandler_p.h:69:8: note: type ‘qint32’ should match type ‘struct quint32_le’
```
we therefore wrap the `BMP_INFOHDR` into an anonymous namespace
Change-Id: I0e6ee66dd09ebda0c3e399738b5c172a57beb8f4
Pick-to: 5.15 6.2 6.3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/imageformats/ico/qicohandler.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp index e1811e861d..1307101f45 100644 --- a/src/plugins/imageformats/ico/qicohandler.cpp +++ b/src/plugins/imageformats/ico/qicohandler.cpp @@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcIco, "qt.gui.imageio.ico") +namespace { + // These next two structs represent how the icon information is stored // in an ICO file. typedef struct @@ -98,6 +100,8 @@ typedef struct { // BMP information header } BMP_INFOHDR ,*LPBMP_INFOHDR; #define BMP_INFOHDR_SIZE 40 +} + class ICOReader { public: |