diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qarraydataops.h | 3 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 14 | ||||
-rw-r--r-- | src/corelib/tools/qtimezone.cpp | 8 | ||||
-rw-r--r-- | src/corelib/tools/qtimezoneprivate_p.h | 6 | ||||
-rw-r--r-- | src/corelib/tools/qvarlengtharray.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/tools.pri | 2 |
7 files changed, 22 insertions, 17 deletions
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index b7c3bc1287..d0f83d2b6a 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -76,7 +76,8 @@ struct QPodArrayOps Q_ASSERT(b < e); Q_ASSERT(size_t(e - b) <= this->alloc - uint(this->size)); - ::memcpy(this->end(), b, (e - b) * sizeof(T)); + ::memcpy(static_cast<void *>(this->end()), static_cast<const void *>(b), + (e - b) * sizeof(T)); this->size += e - b; } 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 */ diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index 6a514abbfe..65c304bcf7 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -62,9 +62,9 @@ static QTimeZonePrivate *newBackendTimeZone() #else #if defined Q_OS_MAC return new QMacTimeZonePrivate(); -#elif defined Q_OS_ANDROID +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) return new QAndroidTimeZonePrivate(); -#elif defined Q_OS_UNIX +#elif defined(Q_OS_UNIX) || defined(Q_OS_ANDROID_EMBEDDED) return new QTzTimeZonePrivate(); // Registry based timezone backend not available on WinRT #elif defined Q_OS_WIN @@ -89,9 +89,9 @@ static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId) #else #if defined Q_OS_MAC return new QMacTimeZonePrivate(ianaId); -#elif defined Q_OS_ANDROID +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) return new QAndroidTimeZonePrivate(ianaId); -#elif defined Q_OS_UNIX +#elif defined(Q_OS_UNIX) || defined(Q_OS_ANDROID_EMBEDDED) return new QTzTimeZonePrivate(ianaId); // Registry based timezone backend not available on WinRT #elif defined Q_OS_WIN diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index ca36f9d297..4d357111f2 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -68,7 +68,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSTimeZone); #include <qt_windows.h> #endif // Q_OS_WIN -#ifdef Q_OS_ANDROID +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) #include <QtCore/private/qjni_p.h> #endif @@ -266,7 +266,7 @@ private: }; #endif -#if defined Q_OS_UNIX && !defined Q_OS_MAC && !defined Q_OS_ANDROID +#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_EMBEDDED)) struct QTzTransitionTime { qint64 atMSecsSinceEpoch; @@ -442,7 +442,7 @@ private: }; #endif // Q_OS_WIN -#ifdef Q_OS_ANDROID +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) class QAndroidTimeZonePrivate final : public QTimeZonePrivate { public: diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index b2f05452ae..d0088471c7 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -344,7 +344,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::append(const T *abuf, in while (s < asize) new (ptr+(s++)) T(*abuf++); } else { - memcpy(&ptr[s], abuf, increment * sizeof(T)); + memcpy(static_cast<void *>(&ptr[s]), static_cast<const void *>(abuf), increment * sizeof(T)); s = asize; } } @@ -392,7 +392,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int a QT_RETHROW; } } else { - memcpy(ptr, oldPtr, copySize * sizeof(T)); + memcpy(static_cast<void *>(ptr), static_cast<const void *>(oldPtr), copySize * sizeof(T)); } } s = copySize; diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 24a19e68d4..9a6e67cc0b 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -747,7 +747,7 @@ typename QVector<T>::iterator QVector<T>::insert(iterator before, size_type n, c } else { T *b = d->begin() + offset; T *i = b + n; - memmove(i, b, (d->size - offset) * sizeof(T)); + memmove(static_cast<void *>(i), static_cast<const void *>(b), (d->size - offset) * sizeof(T)); while (i != b) new (--i) T(copy); } diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 56b30279bd..72224f280d 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -161,7 +161,7 @@ qtConfig(timezone) { tools/qtimezoneprivate.cpp !nacl:darwin: \ SOURCES += tools/qtimezoneprivate_mac.mm - else: android: \ + else: android:!android-embedded: \ SOURCES += tools/qtimezoneprivate_android.cpp else: unix: \ SOURCES += tools/qtimezoneprivate_tz.cpp |