diff options
author | Ville Voutilainen <ville.voutilainen@qt.io> | 2018-02-07 17:58:38 +0200 |
---|---|---|
committer | Ville Voutilainen <ville.voutilainen@qt.io> | 2018-02-14 05:43:37 +0000 |
commit | 77582f1f103b4f86423aa29fc7233678a399938c (patch) | |
tree | c6867ba23fac67968a6626bff86af1848284a643 | |
parent | b34942710cf4e40bd9a3091032cb14baed741862 (diff) | |
download | qtbase-77582f1f103b4f86423aa29fc7233678a399938c.tar.gz |
Silence GCC 8 warnings in QString
qtbase/src/corelib/tools/qstring.cpp:3539:67: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘class QChar’ from an array of ‘short unsigned int’ [-Werror=class-memaccess]
memcpy(uc, d->data() + copystart, size * sizeof(QChar));
Change-Id: Ic601bed1a1f9e1b6f0ac1f9e58f1dcadb50ad724
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/corelib/tools/qstring.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index aff384a257..2c96a8d33c 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -3536,14 +3536,14 @@ QString& QString::replace(const QRegExp &rx, const QString &after) while (i < pos) { int copyend = replacements[i].pos; int size = copyend - copystart; - memcpy(uc, d->data() + copystart, size * sizeof(QChar)); + memcpy(static_cast<void*>(uc), static_cast<const void *>(d->data() + copystart), size * sizeof(QChar)); uc += size; - memcpy(uc, after.d->data(), al * sizeof(QChar)); + memcpy(static_cast<void *>(uc), static_cast<const void *>(after.d->data()), al * sizeof(QChar)); uc += al; copystart = copyend + replacements[i].length; i++; } - memcpy(uc, d->data() + copystart, (d->size - copystart) * sizeof(QChar)); + memcpy(static_cast<void *>(uc), static_cast<const void *>(d->data() + copystart), (d->size - copystart) * sizeof(QChar)); newstring.resize(newlen); *this = newstring; caretMode = QRegExp::CaretWontMatch; @@ -5766,7 +5766,7 @@ QString QString::rightJustified(int width, QChar fill, bool truncate) const while (padlen--) * uc++ = fill; if (len) - memcpy(uc, d->data(), sizeof(QChar)*len); + memcpy(static_cast<void *>(uc), static_cast<const void *>(d->data()), sizeof(QChar)*len); } else { if (truncate) result = left(width); |