summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qbytearray.h16
-rw-r--r--src/corelib/tools/qcryptographichash.cpp40
-rw-r--r--src/corelib/tools/qcryptographichash.h25
-rw-r--r--src/corelib/tools/qdatetime.cpp8
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp4
-rw-r--r--src/corelib/tools/qdatetimeparser_p.h6
-rw-r--r--src/corelib/tools/qiterator.h120
-rw-r--r--src/corelib/tools/qiterator.qdoc120
-rw-r--r--src/corelib/tools/qlocale.cpp8
-rw-r--r--src/corelib/tools/qmessageauthenticationcode.cpp8
-rw-r--r--src/corelib/tools/qrect.cpp4
-rw-r--r--src/corelib/tools/qset.h13
-rw-r--r--src/corelib/tools/qstring.cpp29
-rw-r--r--src/corelib/tools/qstring.h20
-rw-r--r--src/corelib/tools/qstringlist.cpp2
-rw-r--r--src/corelib/tools/qtimezoneprivate_mac.mm2
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp4
-rw-r--r--src/corelib/tools/tools.pri7
18 files changed, 233 insertions, 203 deletions
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index 38c1820685..300f795469 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -256,21 +256,21 @@ public:
# define Q_REQUIRED_RESULT
# define Q_REQUIRED_RESULT_pushed
# endif
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toLower() const &
+ Q_REQUIRED_RESULT QByteArray toLower() const &
{ return toLower_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toLower() &&
+ Q_REQUIRED_RESULT QByteArray toLower() &&
{ return toLower_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toUpper() const &
+ Q_REQUIRED_RESULT QByteArray toUpper() const &
{ return toUpper_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toUpper() &&
+ Q_REQUIRED_RESULT QByteArray toUpper() &&
{ return toUpper_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray trimmed() const &
+ Q_REQUIRED_RESULT QByteArray trimmed() const &
{ return trimmed_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray trimmed() &&
+ Q_REQUIRED_RESULT QByteArray trimmed() &&
{ return trimmed_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray simplified() const &
+ Q_REQUIRED_RESULT QByteArray simplified() const &
{ return simplified_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray simplified() &&
+ Q_REQUIRED_RESULT QByteArray simplified() &&
{ return simplified_helper(*this); }
# ifdef Q_REQUIRED_RESULT_pushed
# pragma pop_macro("Q_REQUIRED_RESULT")
diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp
index ffad2df053..a1b121f1ee 100644
--- a/src/corelib/tools/qcryptographichash.cpp
+++ b/src/corelib/tools/qcryptographichash.cpp
@@ -254,7 +254,9 @@ void QCryptographicHashPrivate::sha3Finish(int bitCount, Sha3Variant sha3Variant
\note In Qt versions before 5.9, when asked to generate a SHA3 hash sum,
QCryptographicHash actually calculated Keccak. If you need compatibility with
- SHA-3 hashes produced by those versions of Qt, use the \c{Keccak_} enumerators.
+ SHA-3 hashes produced by those versions of Qt, use the \c{Keccak_}
+ enumerators. Alternatively, if source compatibility is required, define the
+ macro \c QT_SHA3_KECCAK_COMPAT.
\value Md4 Generate an MD4 hash sum
\value Md5 Generate an MD5 hash sum
@@ -267,10 +269,14 @@ void QCryptographicHashPrivate::sha3Finish(int bitCount, Sha3Variant sha3Variant
\value Sha3_256 Generate an SHA3-256 hash sum. Introduced in Qt 5.1
\value Sha3_384 Generate an SHA3-384 hash sum. Introduced in Qt 5.1
\value Sha3_512 Generate an SHA3-512 hash sum. Introduced in Qt 5.1
- \value Keccak_224 \deprecated Generate a Keccak-224 hash sum. Introduced in Qt 5.10
- \value Keccak_256 \deprecated Generate a Keccak-256 hash sum. Introduced in Qt 5.10
- \value Keccak_384 \deprecated Generate a Keccak-384 hash sum. Introduced in Qt 5.10
- \value Keccak_512 \deprecated Generate a Keccak-512 hash sum. Introduced in Qt 5.10
+ \value Keccak_224 Generate a Keccak-224 hash sum. Introduced in Qt 5.9.2
+ \value Keccak_256 Generate a Keccak-256 hash sum. Introduced in Qt 5.9.2
+ \value Keccak_384 Generate a Keccak-384 hash sum. Introduced in Qt 5.9.2
+ \value Keccak_512 Generate a Keccak-512 hash sum. Introduced in Qt 5.9.2
+ \omitvalue RealSha3_224
+ \omitvalue RealSha3_256
+ \omitvalue RealSha3_384
+ \omitvalue RealSha3_512
*/
/*!
@@ -324,19 +330,19 @@ void QCryptographicHash::reset()
case Sha512:
SHA512Reset(&d->sha512Context);
break;
- case Sha3_224:
+ case RealSha3_224:
case Keccak_224:
sha3Init(&d->sha3Context, 224);
break;
- case Sha3_256:
+ case RealSha3_256:
case Keccak_256:
sha3Init(&d->sha3Context, 256);
break;
- case Sha3_384:
+ case RealSha3_384:
case Keccak_384:
sha3Init(&d->sha3Context, 384);
break;
- case Sha3_512:
+ case RealSha3_512:
case Keccak_512:
sha3Init(&d->sha3Context, 512);
break;
@@ -379,19 +385,19 @@ void QCryptographicHash::addData(const char *data, int length)
case Sha512:
SHA512Input(&d->sha512Context, reinterpret_cast<const unsigned char *>(data), length);
break;
- case Sha3_224:
+ case RealSha3_224:
case Keccak_224:
sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);
break;
- case Sha3_256:
+ case RealSha3_256:
case Keccak_256:
sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);
break;
- case Sha3_384:
+ case RealSha3_384:
case Keccak_384:
sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);
break;
- case Sha3_512:
+ case RealSha3_512:
case Keccak_512:
sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);
break;
@@ -491,19 +497,19 @@ QByteArray QCryptographicHash::result() const
SHA512Result(&copy, reinterpret_cast<unsigned char *>(d->result.data()));
break;
}
- case Sha3_224: {
+ case RealSha3_224: {
d->sha3Finish(224, QCryptographicHashPrivate::Sha3Variant::Sha3);
break;
}
- case Sha3_256: {
+ case RealSha3_256: {
d->sha3Finish(256, QCryptographicHashPrivate::Sha3Variant::Sha3);
break;
}
- case Sha3_384: {
+ case RealSha3_384: {
d->sha3Finish(384, QCryptographicHashPrivate::Sha3Variant::Sha3);
break;
}
- case Sha3_512: {
+ case RealSha3_512: {
d->sha3Finish(512, QCryptographicHashPrivate::Sha3Variant::Sha3);
break;
}
diff --git a/src/corelib/tools/qcryptographichash.h b/src/corelib/tools/qcryptographichash.h
index 20afab8b87..2f74d42405 100644
--- a/src/corelib/tools/qcryptographichash.h
+++ b/src/corelib/tools/qcryptographichash.h
@@ -65,15 +65,26 @@ public:
Sha256,
Sha384,
Sha512,
- Sha3_224,
- Sha3_256,
- Sha3_384,
- Sha3_512,
- // ### Qt 6: remove the Keccak enumerators
- Keccak_224,
+
+ Keccak_224 = 7,
Keccak_256,
Keccak_384,
- Keccak_512
+ Keccak_512,
+ RealSha3_224 = 11,
+ RealSha3_256,
+ RealSha3_384,
+ RealSha3_512,
+# ifndef QT_SHA3_KECCAK_COMPAT
+ Sha3_224 = RealSha3_224,
+ Sha3_256 = RealSha3_256,
+ Sha3_384 = RealSha3_384,
+ Sha3_512 = RealSha3_512
+# else
+ Sha3_224 = Keccak_224,
+ Sha3_256 = Keccak_256,
+ Sha3_384 = Keccak_384,
+ Sha3_512 = Keccak_512
+# endif
#endif
};
Q_ENUM(Algorithm)
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 056dff5442..f6fc672486 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -40,7 +40,9 @@
#include "qplatformdefs.h"
#include "private/qdatetime_p.h"
+#if QT_CONFIG(datetimeparser)
#include "private/qdatetimeparser_p.h"
+#endif
#include "qdatastream.h"
#include "qset.h"
@@ -1337,7 +1339,7 @@ QDate QDate::fromString(const QString& string, Qt::DateFormat format)
QDate QDate::fromString(const QString &string, const QString &format)
{
QDate date;
-#if QT_CONFIG(timezone)
+#if QT_CONFIG(datetimeparser)
QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString);
// dt.setDefaultLocale(QLocale::c()); ### Qt 6
if (dt.parseFormat(format))
@@ -2055,7 +2057,7 @@ QTime QTime::fromString(const QString& string, Qt::DateFormat format)
QTime QTime::fromString(const QString &string, const QString &format)
{
QTime time;
-#if QT_CONFIG(timezone)
+#if QT_CONFIG(datetimeparser)
QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString);
// dt.setDefaultLocale(QLocale::c()); ### Qt 6
if (dt.parseFormat(format))
@@ -5055,7 +5057,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
QDateTime QDateTime::fromString(const QString &string, const QString &format)
{
-#if QT_CONFIG(timezone)
+#if QT_CONFIG(datetimeparser)
QTime time;
QDate date;
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index 3908e6710e..978b663444 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -59,8 +59,6 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_BOOTSTRAPPED
-
QDateTimeParser::~QDateTimeParser()
{
}
@@ -1996,6 +1994,4 @@ bool operator==(const QDateTimeParser::SectionNode &s1, const QDateTimeParser::S
return (s1.type == s2.type) && (s1.pos == s2.pos) && (s1.count == s2.count);
}
-#endif // QT_BOOTSTRAPPED
-
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h
index f6f9ed5e24..75497f5c5a 100644
--- a/src/corelib/tools/qdatetimeparser_p.h
+++ b/src/corelib/tools/qdatetimeparser_p.h
@@ -63,6 +63,8 @@
#include "QtCore/qvector.h"
#include "QtCore/qcoreapplication.h"
+QT_REQUIRE_CONFIG(datetimeparser);
+
#define QDATETIMEEDIT_TIME_MIN QTime(0, 0, 0, 0)
#define QDATETIMEEDIT_TIME_MAX QTime(23, 59, 59, 999)
#define QDATETIMEEDIT_DATE_MIN QDate(100, 1, 1)
@@ -75,8 +77,6 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_BOOTSTRAPPED
-
class Q_CORE_EXPORT QDateTimeParser
{
Q_DECLARE_TR_FUNCTIONS(QDateTimeParser)
@@ -305,8 +305,6 @@ Q_CORE_EXPORT bool operator==(const QDateTimeParser::SectionNode &s1, const QDat
Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeParser::Sections)
Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeParser::FieldInfo)
-#endif // QT_BOOTSTRAPPED
-
QT_END_NAMESPACE
#endif // QDATETIME_P_H
diff --git a/src/corelib/tools/qiterator.h b/src/corelib/tools/qiterator.h
index 918b124d5c..586d26cbad 100644
--- a/src/corelib/tools/qiterator.h
+++ b/src/corelib/tools/qiterator.h
@@ -210,126 +210,6 @@ private:
Iterator i;
};
-/*! \class QKeyValueIterator
- \inmodule QtCore
- \since 5.10
-
- \brief Iterator over the key/value pairs of an associative container.
-
- The QKeyValueIterator class provides an STL-style iterator for returning
- key/value pairs from associative containers like QHash and QMap. It
- supports the same API as the STL associative containers, i.e. getting a
- key/value pair when iterating through the container.
-
- This will allow for better interoperability between QMap, QHash and friends
- and STL-style algorithms.
-
- \warning Iterators on implicitly shared containers do not work
- exactly like STL-iterators. You should avoid copying a container
- while iterators are active on that container. For more information,
- read \l{Implicit sharing iterator problem}.
-*/
-
-/*! \typedef QKeyValueIterator::iterator_category
- \internal
-*/
-
-/*! \typedef QKeyValueIterator::difference_type
- \internal
-*/
-
-/*! \typedef QKeyValueIterator::value_type
- \internal
-*/
-
-/*! \typedef QKeyValueIterator::pointer
- \internal
-*/
-
-/*! \typedef QKeyValueIterator::reference
- \internal
-*/
-
-/*! \fn QKeyValueIterator()
-
- Constructs a default QKeyValueIterator.
-*/
-
-/*! \fn QKeyValueIterator(Iterator o)
-
- Constructs a QKeyValueIterator on top of \a o.
-*/
-
-/*! \fn const T &QKeyValueIterator::operator*() const
-
- Returns the current entry as a pair.
-*/
-
-/*! \fn bool QKeyValueIterator::operator==(QKeyValueIterator lhs, QKeyValueIterator rhs)
-
- Returns \c true if \a rhs points to the same item as \a lhs otherwise returns
- \c false.
-
- \sa operator!=()
-*/
-
-/*! \fn bool QKeyValueIterator::operator!=(QKeyValueIterator lhs, QKeyValueIterator rhs) const
-
- Returns \c true if \a rhs points to a different item than \a lhs otherwise
- returns \c false.
-
- \sa operator==()
-*/
-
-/*!
- \fn QKeyValueIterator &QKeyValueIterator::operator++()
-
- The prefix ++ operator (\c{++i}) advances the iterator to the
- next item in the container and returns the iterator.
-
- \note Advancing the iterator past its container's end() constitutes
- undefined behavior.
-
- \sa operator--()
-*/
-
-/*! \fn QKeyValueIterator QKeyValueIterator::operator++(int)
-
- \overload
-
- The postfix ++ operator (\c{i++}) advances the iterator to the
- next item in the container and returns the iterator's prior value.
-
- \note Advancing the iterator past its container's end() constitutes
- undefined behavior.
-*/
-
-/*! \fn QKeyValueIterator &QKeyValueIterator::operator--()
-
- The prefix -- operator (\c{--i}) backs the iterator up to the previous item
- in the container and returns the iterator.
-
- \note Backing up an iterator to before its container's begin() constitutes
- undefined behavior.
-
- \sa operator++()
-*/
-
-/*! \fn QKeyValueIterator QKeyValueIterator::operator--(int)
-
- \overload
-
- The postfix -- operator (\c{i--}) backs the iterator up to the previous item
- in the container and returns the iterator's prior value.
-
- \note Backing up an iterator to before its container's begin() constitutes
- undefined behavior.
-*/
-
-/*! \fn Iterator QKeyValueIterator::base() const
- Returns the underlying iterator this QKeyValueIterator is based on.
-*/
-
QT_END_NAMESPACE
#endif // QITERATOR_H
diff --git a/src/corelib/tools/qiterator.qdoc b/src/corelib/tools/qiterator.qdoc
index 051d4896d9..77cc412602 100644
--- a/src/corelib/tools/qiterator.qdoc
+++ b/src/corelib/tools/qiterator.qdoc
@@ -1395,3 +1395,123 @@
\sa key(), value(), remove()
*/
+
+/*! \class QKeyValueIterator
+ \inmodule QtCore
+ \since 5.10
+
+ \brief Iterator over the key/value pairs of an associative container.
+
+ The QKeyValueIterator class provides an STL-style iterator for returning
+ key/value pairs from associative containers like QHash and QMap. It
+ supports the same API as the STL associative containers, i.e. getting a
+ key/value pair when iterating through the container.
+
+ This will allow for better interoperability between QMap, QHash and friends
+ and STL-style algorithms.
+
+ \warning Iterators on implicitly shared containers do not work
+ exactly like STL-iterators. You should avoid copying a container
+ while iterators are active on that container. For more information,
+ read \l{Implicit sharing iterator problem}.
+*/
+
+/*! \typedef QKeyValueIterator::iterator_category
+ \internal
+*/
+
+/*! \typedef QKeyValueIterator::difference_type
+ \internal
+*/
+
+/*! \typedef QKeyValueIterator::value_type
+ \internal
+*/
+
+/*! \typedef QKeyValueIterator::pointer
+ \internal
+*/
+
+/*! \typedef QKeyValueIterator::reference
+ \internal
+*/
+
+/*! \fn QKeyValueIterator::QKeyValueIterator()
+
+ Constructs a default QKeyValueIterator.
+*/
+
+/*! \fn QKeyValueIterator::QKeyValueIterator(Iterator o)
+
+ Constructs a QKeyValueIterator on top of \a o.
+*/
+
+/*! \fn const T &QKeyValueIterator::operator*() const
+
+ Returns the current entry as a pair.
+*/
+
+/*! \fn bool QKeyValueIterator::operator==(QKeyValueIterator lhs, QKeyValueIterator rhs)
+
+ Returns \c true if \a rhs points to the same item as \a lhs otherwise returns
+ \c false.
+
+ \sa operator!=()
+*/
+
+/*! \fn bool QKeyValueIterator::operator!=(QKeyValueIterator lhs, QKeyValueIterator rhs) const
+
+ Returns \c true if \a rhs points to a different item than \a lhs otherwise
+ returns \c false.
+
+ \sa operator==()
+*/
+
+/*!
+ \fn QKeyValueIterator &QKeyValueIterator::operator++()
+
+ The prefix ++ operator (\c{++i}) advances the iterator to the
+ next item in the container and returns the iterator.
+
+ \note Advancing the iterator past its container's end() constitutes
+ undefined behavior.
+
+ \sa operator--()
+*/
+
+/*! \fn QKeyValueIterator QKeyValueIterator::operator++(int)
+
+ \overload
+
+ The postfix ++ operator (\c{i++}) advances the iterator to the
+ next item in the container and returns the iterator's prior value.
+
+ \note Advancing the iterator past its container's end() constitutes
+ undefined behavior.
+*/
+
+/*! \fn QKeyValueIterator &QKeyValueIterator::operator--()
+
+ The prefix -- operator (\c{--i}) backs the iterator up to the previous item
+ in the container and returns the iterator.
+
+ \note Backing up an iterator to before its container's begin() constitutes
+ undefined behavior.
+
+ \sa operator++()
+*/
+
+/*! \fn QKeyValueIterator QKeyValueIterator::operator--(int)
+
+ \overload
+
+ The postfix -- operator (\c{i--}) backs the iterator up to the previous item
+ in the container and returns the iterator's prior value.
+
+ \note Backing up an iterator to before its container's begin() constitutes
+ undefined behavior.
+*/
+
+/*! \fn Iterator QKeyValueIterator::base() const
+ Returns the underlying iterator this QKeyValueIterator is based on.
+*/
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index ebda40bd8d..c85dcb4358 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -54,7 +54,9 @@
#include "qlocale.h"
#include "qlocale_p.h"
#include "qlocale_tools_p.h"
+#if QT_CONFIG(datetimeparser)
#include "qdatetimeparser_p.h"
+#endif
#include "qnamespace.h"
#include "qdatetime.h"
#include "qstringlist.h"
@@ -2084,7 +2086,7 @@ QDateTime QLocale::toDateTime(const QString &string, FormatType format) const
QTime QLocale::toTime(const QString &string, const QString &format) const
{
QTime time;
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(datetimeparser)
QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString);
dt.setDefaultLocale(*this);
if (dt.parseFormat(format))
@@ -2115,7 +2117,7 @@ QTime QLocale::toTime(const QString &string, const QString &format) const
QDate QLocale::toDate(const QString &string, const QString &format) const
{
QDate date;
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(datetimeparser)
QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString);
dt.setDefaultLocale(*this);
if (dt.parseFormat(format))
@@ -2145,7 +2147,7 @@ QDate QLocale::toDate(const QString &string, const QString &format) const
#ifndef QT_NO_DATESTRING
QDateTime QLocale::toDateTime(const QString &string, const QString &format) const
{
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(datetimeparser)
QTime time;
QDate date;
diff --git a/src/corelib/tools/qmessageauthenticationcode.cpp b/src/corelib/tools/qmessageauthenticationcode.cpp
index 5dd9591bc6..40a1193622 100644
--- a/src/corelib/tools/qmessageauthenticationcode.cpp
+++ b/src/corelib/tools/qmessageauthenticationcode.cpp
@@ -99,16 +99,16 @@ static int qt_hash_block_size(QCryptographicHash::Algorithm method)
return SHA384_Message_Block_Size;
case QCryptographicHash::Sha512:
return SHA512_Message_Block_Size;
- case QCryptographicHash::Sha3_224:
+ case QCryptographicHash::RealSha3_224:
case QCryptographicHash::Keccak_224:
return 144;
- case QCryptographicHash::Sha3_256:
+ case QCryptographicHash::RealSha3_256:
case QCryptographicHash::Keccak_256:
return 136;
- case QCryptographicHash::Sha3_384:
+ case QCryptographicHash::RealSha3_384:
case QCryptographicHash::Keccak_384:
return 104;
- case QCryptographicHash::Sha3_512:
+ case QCryptographicHash::RealSha3_512:
case QCryptographicHash::Keccak_512:
return 72;
}
diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp
index 895b6b9701..40d6c8b7c3 100644
--- a/src/corelib/tools/qrect.cpp
+++ b/src/corelib/tools/qrect.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
\brief The QRect class defines a rectangle in the plane using
integer precision.
- A rectangle is normally expressed as an upper-left corner and a
+ A rectangle is normally expressed as a top-left corner and a
size. The size (width and height) of a QRect is always equivalent
to the mathematical rectangle that forms the basis for its
rendering.
@@ -1317,7 +1317,7 @@ QDebug operator<<(QDebug dbg, const QRect &r)
\brief The QRectF class defines a rectangle in the plane using floating
point precision.
- A rectangle is normally expressed as an upper-left corner and a
+ A rectangle is normally expressed as a top-left corner and a
size. The size (width and height) of a QRectF is always equivalent
to the mathematical rectangle that forms the basis for its
rendering.
diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h
index 08b38a08c2..7ded120ab7 100644
--- a/src/corelib/tools/qset.h
+++ b/src/corelib/tools/qset.h
@@ -340,13 +340,14 @@ Q_INLINE_TEMPLATE bool QSet<T>::intersects(const QSet<T> &other) const
template <class T>
Q_INLINE_TEMPLATE QSet<T> &QSet<T>::subtract(const QSet<T> &other)
{
- QSet<T> copy1(*this);
- QSet<T> copy2(other);
- typename QSet<T>::const_iterator i = copy1.constEnd();
- while (i != copy1.constBegin()) {
- --i;
- if (copy2.contains(*i))
+ if (&other == this) {
+ clear();
+ } else {
+ auto i = other.constEnd();
+ while (i != other.constBegin()) {
+ --i;
remove(*i);
+ }
}
return *this;
}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index eeeff280ff..1f83eb2865 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -165,28 +165,37 @@ qssize_t qustrlen(const ushort *str) Q_DECL_NOTHROW
qssize_t result = 0;
#ifdef __SSE2__
- // progress until we get an aligned pointer
- const ushort *ptr = str;
- while (*ptr && quintptr(ptr) % 16)
- ++ptr;
- if (*ptr == 0)
- return ptr - str;
+ // find the 16-byte alignment immediately prior or equal to str
+ quintptr misalignment = quintptr(str) & 0xf;
+ Q_ASSERT((misalignment & 1) == 0);
+ const ushort *ptr = str - (misalignment / 2);
// load 16 bytes and see if we have a null
// (aligned loads can never segfault)
- int mask;
const __m128i zeroes = _mm_setzero_si128();
+ __m128i data = _mm_load_si128(reinterpret_cast<const __m128i *>(ptr));
+ __m128i comparison = _mm_cmpeq_epi16(data, zeroes);
+ quint32 mask = _mm_movemask_epi8(comparison);
+
+ // ignore the result prior to the beginning of str
+ mask >>= misalignment;
+
+ // Have we found something in the first block? Need to handle it now
+ // because of the left shift above.
+ if (mask)
+ return qCountTrailingZeroBits(quint32(mask)) / 2;
+
do {
- __m128i data = _mm_load_si128(reinterpret_cast<const __m128i *>(ptr));
ptr += 8;
+ data = _mm_load_si128(reinterpret_cast<const __m128i *>(ptr));
- __m128i comparison = _mm_cmpeq_epi16(data, zeroes);
+ comparison = _mm_cmpeq_epi16(data, zeroes);
mask = _mm_movemask_epi8(comparison);
} while (mask == 0);
// found a null
uint idx = qCountTrailingZeroBits(quint32(mask));
- return ptr - str - 8 + idx / 2;
+ return ptr - str + idx / 2;
#endif
if (sizeof(wchar_t) == sizeof(ushort))
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 1eca773c3e..6dd934263d 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -414,25 +414,25 @@ public:
# define Q_REQUIRED_RESULT
# define Q_REQUIRED_RESULT_pushed
# endif
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toLower() const &
+ Q_REQUIRED_RESULT QString toLower() const &
{ return toLower_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toLower() &&
+ Q_REQUIRED_RESULT QString toLower() &&
{ return toLower_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toUpper() const &
+ Q_REQUIRED_RESULT QString toUpper() const &
{ return toUpper_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toUpper() &&
+ Q_REQUIRED_RESULT QString toUpper() &&
{ return toUpper_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toCaseFolded() const &
+ Q_REQUIRED_RESULT QString toCaseFolded() const &
{ return toCaseFolded_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toCaseFolded() &&
+ Q_REQUIRED_RESULT QString toCaseFolded() &&
{ return toCaseFolded_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString trimmed() const &
+ Q_REQUIRED_RESULT QString trimmed() const &
{ return trimmed_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString trimmed() &&
+ Q_REQUIRED_RESULT QString trimmed() &&
{ return trimmed_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString simplified() const &
+ Q_REQUIRED_RESULT QString simplified() const &
{ return simplified_helper(*this); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString simplified() &&
+ Q_REQUIRED_RESULT QString simplified() &&
{ return simplified_helper(*this); }
# ifdef Q_REQUIRED_RESULT_pushed
# pragma pop_macro("Q_REQUIRED_RESULT")
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp
index d65563f76d..17f6bd8539 100644
--- a/src/corelib/tools/qstringlist.cpp
+++ b/src/corelib/tools/qstringlist.cpp
@@ -681,7 +681,7 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int
\overload
\since 5.0
- Returns the index position of the first match of \a re in
+ Returns the index position of the first exact match of \a re in
the list, searching forward from index position \a from. Returns
-1 if no item matched.
diff --git a/src/corelib/tools/qtimezoneprivate_mac.mm b/src/corelib/tools/qtimezoneprivate_mac.mm
index 876dc2d877..fa0dd87cfc 100644
--- a/src/corelib/tools/qtimezoneprivate_mac.mm
+++ b/src/corelib/tools/qtimezoneprivate_mac.mm
@@ -295,7 +295,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec
break;
}
if (prevSecs < endSecs) // i.e. we did make it into that while loop
- return data(qint64(prevSecs) * 1000);
+ return data(qint64(prevSecs * 1e3));
// No transition data; or first transition later than requested time.
return invalidData();
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index 521475c2dd..bcc1285472 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -272,8 +272,9 @@ static void parseTzLeapSeconds(QDataStream &ds, int tzh_leapcnt, bool longTran)
{
// Parse tzh_leapcnt x pairs of leap seconds
// We don't use leap seconds, so only read and don't store
- qint64 val;
+ qint32 val;
if (longTran) {
+ // v2 file format, each entry is 12 bytes long
qint64 time;
for (int i = 0; i < tzh_leapcnt && ds.status() == QDataStream::Ok; ++i) {
// Parse Leap Occurrence Time, 8 bytes
@@ -283,6 +284,7 @@ static void parseTzLeapSeconds(QDataStream &ds, int tzh_leapcnt, bool longTran)
ds >> val;
}
} else {
+ // v0 file format, each entry is 8 bytes long
for (int i = 0; i < tzh_leapcnt && ds.status() == QDataStream::Ok; ++i) {
// Parse Leap Occurrence Time, 4 bytes
ds >> val;
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index aa545497a2..2c609098ea 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -21,7 +21,6 @@ HEADERS += \
tools/qcryptographichash.h \
tools/qdatetime.h \
tools/qdatetime_p.h \
- tools/qdatetimeparser_p.h \
tools/qdoublescanprint_p.h \
tools/qeasingcurve.h \
tools/qfreelist_p.h \
@@ -84,7 +83,6 @@ SOURCES += \
tools/qcollator.cpp \
tools/qcryptographichash.cpp \
tools/qdatetime.cpp \
- tools/qdatetimeparser.cpp \
tools/qeasingcurve.cpp \
tools/qfreelist.cpp \
tools/qhash.cpp \
@@ -173,6 +171,11 @@ qtConfig(timezone) {
SOURCES += tools/qtimezoneprivate_icu.cpp
}
+qtConfig(datetimeparser) {
+ HEADERS += tools/qdatetimeparser_p.h
+ SOURCES += tools/qdatetimeparser.cpp
+}
+
qtConfig(regularexpression) {
QMAKE_USE_PRIVATE += pcre2