Revert "QUrl: Remove explicit casts to {const,} void*"
This reverts commit 63c1e7c4a1
.
It caused the following compilation error with g++-11.
error: ‘void* memcpy(void*, const void*, size_t)’ copying an
object of non-trivial type ‘class QChar’ from an array of
‘const char16_t’
Fixes: QTBUG-96268
Change-Id: I2680b15aba8d0d867092391fcee3815e7fa4c0bc
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
f3bc1f8500
commit
80256b3683
@ -591,7 +591,7 @@ static qsizetype decode(QString &appendTo, QStringView in)
|
||||
const int origSize = appendTo.size();
|
||||
appendTo.resize(origSize + (end - begin));
|
||||
QChar *output = appendTo.data() + origSize;
|
||||
memcpy(output, begin, (input - begin) * sizeof(QChar));
|
||||
memcpy(static_cast<void *>(output), static_cast<const void *>(begin), (input - begin) * sizeof(QChar));
|
||||
output += input - begin;
|
||||
|
||||
while (input != end) {
|
||||
@ -601,7 +601,8 @@ static qsizetype decode(QString &appendTo, QStringView in)
|
||||
if (Q_UNLIKELY(end - input < 3 || !isHex(input[1]) || !isHex(input[2]))) {
|
||||
// badly-encoded data
|
||||
appendTo.resize(origSize + (end - begin));
|
||||
memcpy(appendTo.begin() + origSize, begin, (end - begin) * sizeof(*end));
|
||||
memcpy(static_cast<void *>(appendTo.begin() + origSize),
|
||||
static_cast<const void *>(begin), (end - begin) * sizeof(*end));
|
||||
return end - begin;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user