Fix a -Wclass-memaccess problem in qjson
qtbase/src/corelib/serialization/qjson_p.h:230:38: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of type ‘QJsonPrivate::qle_ushort’ {aka ‘class QSpecialInteger<QLittleEndianStorageType<short unsigned int> >’} with ‘private’ member ‘QSpecialInteger<QLittleEndianStorageType<short unsigned int> >::val’ from an array of ‘const class QChar’; use assignment or copy-initialization instead [-Werror=class-memaccess]
230 | str.length()*sizeof(ushort));
| ^
Change-Id: Ie58e7fe4bae3003227364012ad56ab23bd560d8c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
bb10
parent
c686e885c0
commit
9367d966e6
|
|
@ -222,7 +222,9 @@ public:
|
|||
for (int i = 0; i < str.length(); ++i)
|
||||
d->utf16[i] = uc[i];
|
||||
#else
|
||||
memcpy(d->utf16, str.unicode(), str.length()*sizeof(ushort));
|
||||
memcpy(static_cast<void *>(d->utf16),
|
||||
static_cast<const void *>(str.unicode()),
|
||||
str.length()*sizeof(ushort));
|
||||
#endif
|
||||
if (str.length() & 1)
|
||||
d->utf16[str.length()] = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue