Skip to content

Commit

Permalink
Fix GCC 8 warning in qurlrecode
Browse files Browse the repository at this point in the history
qtbase/src/corelib/io/qurlrecode.cpp:514:86: 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(appendTo.begin() + origSize, begin, (end - begin) * sizeof(ushort));

Change-Id: Ide78a4144d6bc63342c3c4334cc97fe73c5167bd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
  • Loading branch information
villevoutilainen committed Feb 14, 2018
1 parent 77582f1 commit c976323
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/corelib/io/qurlrecode.cpp
Expand Up @@ -511,15 +511,15 @@ static int decode(QString &appendTo, const ushort *begin, const ushort *end)
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(ushort));
memcpy(static_cast<void *>(appendTo.begin() + origSize), static_cast<const void *>(begin), (end - begin) * sizeof(ushort));
return end - begin;
}

if (Q_UNLIKELY(!output)) {
// detach
appendTo.resize(origSize + (end - begin));
output = reinterpret_cast<ushort *>(appendTo.begin()) + origSize;
memcpy(output, begin, (input - begin) * sizeof(ushort));
memcpy(static_cast<void *>(output), static_cast<const void *>(begin), (input - begin) * sizeof(ushort));
output += input - begin;
}

Expand Down

0 comments on commit c976323

Please sign in to comment.