Remove Q_PACKED from structures that do not need to be packed
These structures do not need to be packed. With some compilers, Q_PACKED was defined to be empty, which means that the code was working fine without packing. Or there were some lingering problems on those platforms (MSVC) and we're now exposing them in all platforms. Actually, it shouldn't be a problem anywhere. QCharAttributes, quint24 and QFontEngineQPA::Glyph have only char/uchar members, so they're packed already (they have alignof == 1). The only platform where that wasn't true was ARM OABI, which we don't support anymore. QFontEngineQPA::Header seems to always come from a QByteArray, so it doesn't neeed to be packed either. However, just to be sure, I'm inserting a check for alignment. And QFontEngineQPA::Block isn't used anywhere. Change-Id: Iacfa25edf336ef2a03aeb6e40ae90937a21661ae Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This commit is contained in:
parent
be8a76cffe
commit
f4ebb06189
@ -57,7 +57,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
struct Q_PACKED QCharAttributes
|
||||
struct QCharAttributes
|
||||
{
|
||||
uchar graphemeBoundary : 1;
|
||||
uchar wordBreak : 1;
|
||||
|
@ -702,7 +702,7 @@ struct quint24 {
|
||||
quint24(uint value);
|
||||
operator uint() const;
|
||||
uchar data[3];
|
||||
} Q_PACKED;
|
||||
};
|
||||
|
||||
inline quint24::quint24(uint value)
|
||||
{
|
||||
|
@ -169,6 +169,7 @@ const QFontEngineQPA::Glyph *QFontEngineQPA::findGlyph(glyph_t g) const
|
||||
|
||||
bool QFontEngineQPA::verifyHeader(const uchar *data, int size)
|
||||
{
|
||||
VERIFY(quintptr(data) % Q_ALIGNOF(Header) == 0);
|
||||
VERIFY(size >= int(sizeof(Header)));
|
||||
const Header *header = reinterpret_cast<const Header *>(data);
|
||||
if (header->magic[0] != 'Q'
|
||||
|
@ -131,7 +131,7 @@ public:
|
||||
GlyphBlock
|
||||
};
|
||||
|
||||
struct Q_PACKED Header
|
||||
struct Header
|
||||
{
|
||||
char magic[4]; // 'QPF2'
|
||||
quint32 lock; // values: 0 = unlocked, 0xffffffff = read-only, otherwise qws client id of locking process
|
||||
@ -140,14 +140,14 @@ public:
|
||||
quint16 dataSize;
|
||||
};
|
||||
|
||||
struct Q_PACKED Block
|
||||
struct Block
|
||||
{
|
||||
quint16 tag;
|
||||
quint16 pad;
|
||||
quint32 dataSize;
|
||||
};
|
||||
|
||||
struct Q_PACKED Glyph
|
||||
struct Glyph
|
||||
{
|
||||
quint8 width;
|
||||
quint8 height;
|
||||
|
@ -2561,7 +2561,7 @@ public:
|
||||
}
|
||||
|
||||
uchar data[3];
|
||||
} Q_PACKED;
|
||||
};
|
||||
|
||||
void tst_QPainter::drawhelper_blend_color()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user