diff options
author | Liang Qi <liang.qi@qt.io> | 2017-10-04 10:41:19 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-10-04 13:41:04 +0200 |
commit | bc5f45052fd8f9a5481a37a6a4d55c7f6cbf037d (patch) | |
tree | 2c20e6c42ccd008e431a8d485450713883eacbb5 /src/corelib | |
parent | b8947e9194f0f88f464448ac51f6a05113d36a33 (diff) | |
parent | 3faf8f4d48abd982be8470786cc5f61372519722 (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
src/corelib/global/qconfig-bootstrapped.h
src/corelib/global/qglobal.h
src/corelib/tools/qcryptographichash.cpp
src/corelib/tools/qcryptographichash.h
src/corelib/tools/qmessageauthenticationcode.cpp
src/plugins/platforms/windows/qwindowswindow.h
tests/auto/gui/kernel/qwindow/BLACKLIST
tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST
Change-Id: Ib68112de985a3d714c2071f47c10e907e4f0229a
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/configure.json | 8 | ||||
-rw-r--r-- | src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp | 2 | ||||
-rw-r--r-- | src/corelib/global/qconfig-bootstrapped.h | 14 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qcryptographichash.cpp | 40 | ||||
-rw-r--r-- | src/corelib/tools/qcryptographichash.h | 25 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 8 | ||||
-rw-r--r-- | src/corelib/tools/qdatetimeparser.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qdatetimeparser_p.h | 6 | ||||
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 8 | ||||
-rw-r--r-- | src/corelib/tools/qmessageauthenticationcode.cpp | 8 | ||||
-rw-r--r-- | src/corelib/tools/qset.h | 13 | ||||
-rw-r--r-- | src/corelib/tools/qtimezoneprivate_tz.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/tools.pri | 7 |
14 files changed, 89 insertions, 60 deletions
diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 8b503233a0..3feda2fffc 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -815,10 +815,16 @@ }, "timezone": { "label": "QTimeZone", - "purpose": "Provides support for timezone handling.", + "purpose": "Provides support for time-zone handling.", "section": "Utilities", "output": [ "publicFeature" ] }, + "datetimeparser": { + "label": "QDateTimeParser", + "purpose": "Provides support for parsing date-time texts.", + "section": "Utilities", + "output": [ "privateFeature" ] + }, "commandlineparser": { "label": "QCommandlineParser", "purpose": "Provides support for command line parsing.", diff --git a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp index 1169ad5536..8d4bd36beb 100644 --- a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp @@ -617,7 +617,7 @@ template<> class QTypeInfo<A> : public QTypeInfoMerger<A, B, C, D> {}; void overloadedFunction(int, QString); void overloadedFunction(int, QString) const; }; - ... qConstOverload<>(&Foo::overloadedFunction) + ... qConstOverload<int, QString>(&Foo::overloadedFunction) ... qNonConstOverload<int, QString>(&Foo::overloadedFunction) //! [54] diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 95095f4b76..2164d7f21f 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -66,8 +66,7 @@ #define QT_NO_USING_NAMESPACE #define QT_NO_DEPRECATED -#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1 -#define QT_NO_DATASTREAM +// Keep feature-test macros in alphabetic order by feature name: #define QT_FEATURE_alloca 1 #define QT_FEATURE_alloca_h -1 #ifdef _WIN32 @@ -75,9 +74,13 @@ #else # define QT_FEATURE_alloca_malloc_h -1 #endif +#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #define QT_FEATURE_cxx11_random (QT_HAS_INCLUDE(<random>) ? 1 : -1) +#define QT_NO_DATASTREAM +#define QT_FEATURE_datetimeparser -1 #define QT_FEATURE_getauxval (QT_HAS_INCLUDE(<sys/auxv.h>) ? 1 : -1) #define QT_FEATURE_getentropy -1 +#define QT_NO_GEOM_VARIANT #define QT_FEATURE_iconv -1 #define QT_FEATURE_icu -1 #define QT_FEATURE_journald -1 @@ -86,20 +89,19 @@ #define QT_FEATURE_library -1 #define QT_NO_QOBJECT #define QT_FEATURE_process -1 -#define QT_NO_SYSTEMLOCALE #define QT_FEATURE_renameat2 -1 +#define QT_FEATURE_sharedmemory -1 #define QT_FEATURE_slog2 -1 #define QT_FEATURE_statx -1 #define QT_FEATURE_syslog -1 +#define QT_NO_SYSTEMLOCALE +#define QT_FEATURE_systemsemaphore -1 #define QT_FEATURE_temporaryfile 1 #define QT_NO_THREAD #define QT_FEATURE_timezone -1 #define QT_FEATURE_topleveldomain -1 #define QT_NO_TRANSLATION #define QT_FEATURE_translation -1 -#define QT_NO_GEOM_VARIANT -#define QT_FEATURE_sharedmemory -1 -#define QT_FEATURE_systemsemaphore -1 #ifdef QT_BUILD_QMAKE #define QT_FEATURE_commandlineparser -1 diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index ff388770f5..7b691ca59e 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -357,7 +357,7 @@ typedef double qreal; #if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC) extern "C" #endif -Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion() Q_DECL_NOTHROW; +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOTHROW; #if defined(__cplusplus) 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(©, 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/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 9a46018ede..723e63114d 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/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/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 |