QWindowsFontDatabase/QWindowsXPStyle: Fix compilation with g++ 8.1/MinGW
Silence warnings about copying/clearing memory types which g++
considers non-trivial, for example:
windows\qwindowsfontdatabase.cpp:1003:75: error: 'void* memcpy(void*, const void*, size_t)' copying an object of non-trivial type 'class QChar' from an array of 'const ushort' {aka 'const short unsigned int'} [-Werror=class-memaccess]
memcpy(faceNamePtr, faceName.utf16(), sizeof(wchar_t) * nameLength);
qwindowsxpstyle.cpp:946:46: error: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct ThemeMapData'; use assignment or value-initialization instead [-Werror=class-memaccess]
memset(&data, 0, sizeof(data));
^
qwindowsxpstyle.cpp:1053:38: error: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct ThemeMapData'; use assignment or value-initialization instead [-Werror=class-memaccess]
memset(&data, 0, sizeof(data));
by introducing a cast.
Task-number: QTBUG-68742
Task-number: QTQAINFRA-2095
Change-Id: I160eb5fc7b64a2bc404e1fa61d306af2662d1252
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
bb10
parent
22e9ff9c16
commit
3f01dc1995
|
|
@ -1000,7 +1000,7 @@ static QChar *createFontFile(const QString &faceName)
|
|||
if (!faceName.isEmpty()) {
|
||||
const int nameLength = qMin(faceName.length(), LF_FACESIZE - 1);
|
||||
faceNamePtr = new QChar[nameLength + 1];
|
||||
memcpy(faceNamePtr, faceName.utf16(), sizeof(wchar_t) * nameLength);
|
||||
memcpy(static_cast<void *>(faceNamePtr), faceName.utf16(), sizeof(wchar_t) * nameLength);
|
||||
faceNamePtr[nameLength] = 0;
|
||||
}
|
||||
return faceNamePtr;
|
||||
|
|
|
|||
|
|
@ -943,7 +943,7 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
|
|||
if (!isCached) {
|
||||
// SHORTCUT: If the part's state has no data, cache it for NOOP later
|
||||
if (!stateHasData) {
|
||||
memset(&data, 0, sizeof(data));
|
||||
memset(static_cast<void *>(&data), 0, sizeof(data));
|
||||
data.dataValid = true;
|
||||
alphaCache.insert(key, data);
|
||||
return true;
|
||||
|
|
@ -1050,7 +1050,7 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
|
|||
|
||||
// Add to theme part cache
|
||||
if (!isCached) {
|
||||
memset(&data, 0, sizeof(data));
|
||||
memset(static_cast<void *>(&data), 0, sizeof(data));
|
||||
data.dataValid = true;
|
||||
data.partIsTransparent = partIsTransparent;
|
||||
data.alphaType = alphaType;
|
||||
|
|
|
|||
Loading…
Reference in New Issue