diff options
author | Liang Qi <liang.qi@qt.io> | 2018-02-14 15:49:08 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2018-02-14 15:49:08 +0000 |
commit | 7bc1d6effaae8f5aa1bef92cb1094ec3b3f4fb95 (patch) | |
tree | cde8deeea717fc25d64640d96cf13a4fd44d9db1 /src/corelib/tools/qstring.cpp | |
parent | 2aeb2bcef48d7bca2186c262dde433737956a539 (diff) | |
parent | 305dd1b61f657474d751cc3b24f58249ec21b61b (diff) |
Merge "Merge remote-tracking branch 'origin/5.9' into 5.11" into refs/staging/5.11
Diffstat (limited to 'src/corelib/tools/qstring.cpp')
-rw-r--r-- | src/corelib/tools/qstring.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 4040d59b0a..25f829c38c 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -3855,14 +3855,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; @@ -6309,7 +6309,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); @@ -11834,7 +11834,7 @@ QString QString::toHtmlEscaped() const This cost can be avoided by using QStringLiteral instead: \code - if (node.hasAttribute(QStringLiteral("http-contents-length"))) //... + if (node.hasAttribute(QStringLiteral(u"http-contents-length"))) //... \endcode In this case, QString's internal data will be generated at compile time; no @@ -11854,6 +11854,10 @@ QString QString::toHtmlEscaped() const if (attribute.name() == QLatin1String("http-contents-length")) //... \endcode + \note Some compilers have bugs encoding strings containing characters outside + the US-ASCII character set. Make sure you prefix your string with \c{u} in + those cases. It is optional otherwise. + \sa QByteArrayLiteral */ |