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> (cherry picked from commit 9367d966e6c10c95b92f2b55e2cead7e85d80cfe)
This commit is contained in:
parent
8476ac456e
commit
a4a5b4288e
@ -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…
x
Reference in New Issue
Block a user