Windows: Fix build of qwindowsfontdatabase.cpp with MinGW 4.9.2/-Werror.

Disable warning:
qwindowsfontdatabase.cpp: In member function 'virtual QFontEngine* QWindowsFontDatabase::fontEngine(const QByteArray&, qreal, QFont::HintingPreference)':
qwindowsfontdatabase.cpp:1111:74: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]

Change-Id: Ifce69db7d1f3b78d52e5b4e01db8e7bbfb62b439
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Friedemann Kleint 2015-03-06 15:45:26 +01:00
parent 7c3cfdbcb7
commit 8f1eb52525

View File

@ -1104,11 +1104,18 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal
GUID guid;
CoCreateGuid(&guid);
#ifdef Q_CC_GNU
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
QString uniqueFamilyName = QLatin1Char('f')
+ QString::number(guid.Data1, 36) + QLatin1Char('-')
+ QString::number(guid.Data2, 36) + QLatin1Char('-')
+ QString::number(guid.Data3, 36) + QLatin1Char('-')
+ QString::number(*reinterpret_cast<quint64 *>(guid.Data4), 36);
#ifdef Q_CC_GNU
# pragma GCC diagnostic pop
#endif
QString actualFontName = font.changeFamilyName(uniqueFamilyName);
if (actualFontName.isEmpty()) {