diff options
author | Liang Qi <liang.qi@qt.io> | 2018-08-17 10:02:55 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2018-08-17 12:22:55 +0000 |
commit | ae5476eadcd718a11949d98290ea50936d2ba95e (patch) | |
tree | f47c0e22ddb63efca457db2eb5263081ce40fcc8 /src/corelib | |
parent | 52d4a2976fd7edaf68d697bb1f5cb379cb1739cc (diff) | |
parent | 8842d9d1e6c0286922bf18357ca30c146d692316 (diff) |
Merge "Merge remote-tracking branch 'origin/5.11' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib')
15 files changed, 40 insertions, 32 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_concurrent_qthreadpool.cpp b/src/corelib/doc/snippets/code/src_corelib_concurrent_qthreadpool.cpp index ba31972aa1..8490942048 100644 --- a/src/corelib/doc/snippets/code/src_corelib_concurrent_qthreadpool.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_concurrent_qthreadpool.cpp @@ -51,7 +51,7 @@ //! [0] class HelloWorldTask : public QRunnable { - void run() + void run() override { qDebug() << "Hello world from thread" << QThread::currentThread(); } diff --git a/src/corelib/doc/snippets/code/src_corelib_io_qabstractfileengine.cpp b/src/corelib/doc/snippets/code/src_corelib_io_qabstractfileengine.cpp index 055812ea60..ae2f305313 100644 --- a/src/corelib/doc/snippets/code/src_corelib_io_qabstractfileengine.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_io_qabstractfileengine.cpp @@ -52,7 +52,7 @@ class ZipEngineHandler : public QAbstractFileEngineHandler { public: - QAbstractFileEngine *create(const QString &fileName) const; + QAbstractFileEngine *create(const QString &fileName) const override; }; QAbstractFileEngine *ZipEngineHandler::create(const QString &fileName) const @@ -105,12 +105,12 @@ public: entries << "entry1" << "entry2" << "entry3"; } - bool hasNext() const + bool hasNext() const override { return index < entries.size() - 1; } - QString next() + QString next() override { if (!hasNext()) return QString(); @@ -118,7 +118,7 @@ public: return currentFilePath(); } - QString currentFileName() + QString currentFileName() override { return entries.at(index); } diff --git a/src/corelib/doc/snippets/code/src_corelib_io_qprocess.cpp b/src/corelib/doc/snippets/code/src_corelib_io_qprocess.cpp index 2e94666970..8a2825cd10 100644 --- a/src/corelib/doc/snippets/code/src_corelib_io_qprocess.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_io_qprocess.cpp @@ -94,7 +94,7 @@ class SandboxProcess : public QProcess { ... protected: - void setupChildProcess(); + void setupChildProcess() override; ... }; diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp index 3379d0bc1a..2e055ec439 100644 --- a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp @@ -120,7 +120,7 @@ public: ... - QVariant data(const QModelIndex &index, int role) + QVariant data(const QModelIndex &index, int role) override { if (role != Qt::BackgroundRole) return QSortFilterProxyModel::data(index, role); diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp index c12ed147db..6451f46b36 100644 --- a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp @@ -101,7 +101,7 @@ public: MainWindow(); protected: - bool eventFilter(QObject *obj, QEvent *ev); + bool eventFilter(QObject *obj, QEvent *ev) override; private: QTextEdit *textEdit; @@ -147,7 +147,7 @@ public: MyObject(QObject *parent = 0); protected: - void timerEvent(QTimerEvent *event); + void timerEvent(QTimerEvent *event) override; }; MyObject::MyObject(QObject *parent) @@ -215,7 +215,7 @@ class KeyPressEater : public QObject ... protected: - bool eventFilter(QObject *obj, QEvent *event); + bool eventFilter(QObject *obj, QEvent *event) override; }; bool KeyPressEater::eventFilter(QObject *obj, QEvent *event) @@ -508,7 +508,7 @@ public: MyClass(QWidget *parent = 0); ~MyClass(); - bool event(QEvent* ev) + bool event(QEvent* ev) override { if (ev->type() == QEvent::PolishRequest) { // overwrite handling of PolishRequest if any diff --git a/src/corelib/doc/snippets/code/src_corelib_thread_qexception.cpp b/src/corelib/doc/snippets/code/src_corelib_thread_qexception.cpp index eaf3a156cf..723c1630f6 100644 --- a/src/corelib/doc/snippets/code/src_corelib_thread_qexception.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_thread_qexception.cpp @@ -53,8 +53,8 @@ class MyException : public QException { public: - void raise() const { throw *this; } - MyException *clone() const { return new MyException(*this); } + void raise() const override { throw *this; } + MyException *clone() const override { return new MyException(*this); } }; //! [0] diff --git a/src/corelib/doc/snippets/code/src_gui_itemviews_qidentityproxymodel.cpp b/src/corelib/doc/snippets/code/src_gui_itemviews_qidentityproxymodel.cpp index 65ee9260b2..d89e28836f 100644 --- a/src/corelib/doc/snippets/code/src_gui_itemviews_qidentityproxymodel.cpp +++ b/src/corelib/doc/snippets/code/src_gui_itemviews_qidentityproxymodel.cpp @@ -58,7 +58,7 @@ class DateFormatProxyModel : public QIdentityProxyModel m_formatString = formatString; } - QVariant data(const QModelIndex &index, int role) const + QVariant data(const QModelIndex &index, int role) const override { if (role != Qt::DisplayRole) return QIdentityProxyModel::data(index, role); diff --git a/src/corelib/doc/snippets/eventfilters/filterobject.h b/src/corelib/doc/snippets/eventfilters/filterobject.h index 08b7c67192..354aa4ff5c 100644 --- a/src/corelib/doc/snippets/eventfilters/filterobject.h +++ b/src/corelib/doc/snippets/eventfilters/filterobject.h @@ -59,7 +59,7 @@ class FilterObject : public QObject public: FilterObject(QObject *parent = 0); - bool eventFilter(QObject *object, QEvent *event); + bool eventFilter(QObject *object, QEvent *event) override; void setFilteredObject(QObject *object); private: diff --git a/src/corelib/doc/snippets/events/events.cpp b/src/corelib/doc/snippets/events/events.cpp index 9606b0c2ee..969b0047f0 100644 --- a/src/corelib/doc/snippets/events/events.cpp +++ b/src/corelib/doc/snippets/events/events.cpp @@ -54,7 +54,7 @@ class MyCheckBox : public QCheckBox { public: - void mousePressEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event) override; }; //! [0] @@ -72,7 +72,7 @@ void MyCheckBox::mousePressEvent(QMouseEvent *event) class MyWidget : public QWidget { public: - bool event(QEvent *event); + bool event(QEvent *event) override; }; static const int MyCustomEventType = 1099; diff --git a/src/corelib/doc/snippets/settings/settings.cpp b/src/corelib/doc/snippets/settings/settings.cpp index 28b72acd6a..49312b9cfc 100644 --- a/src/corelib/doc/snippets/settings/settings.cpp +++ b/src/corelib/doc/snippets/settings/settings.cpp @@ -143,7 +143,7 @@ public: void readSettings(); protected: - void closeEvent(QCloseEvent *event); + void closeEvent(QCloseEvent *event) override; }; //! [16] diff --git a/src/corelib/doc/snippets/statemachine/eventtest.cpp b/src/corelib/doc/snippets/statemachine/eventtest.cpp index cecf26f2e7..d7d4ce0d21 100644 --- a/src/corelib/doc/snippets/statemachine/eventtest.cpp +++ b/src/corelib/doc/snippets/statemachine/eventtest.cpp @@ -58,7 +58,7 @@ public: protected: //![0] - bool eventTest(QEvent *event) + bool eventTest(QEvent *event) override { if (event->type() == QEvent::Wrapped) { QEvent *wrappedEvent = static_cast<QStateMachine::WrappedEvent *>(event)->event(); @@ -71,7 +71,7 @@ protected: } //![0] - void onTransition(QEvent *event) + void onTransition(QEvent *event) override { } diff --git a/src/corelib/doc/snippets/statemachine/main4.cpp b/src/corelib/doc/snippets/statemachine/main4.cpp index 5786fa3c17..e21656b91c 100644 --- a/src/corelib/doc/snippets/statemachine/main4.cpp +++ b/src/corelib/doc/snippets/statemachine/main4.cpp @@ -72,7 +72,7 @@ public: : m_value(value) {} protected: - virtual bool eventTest(QEvent *e) + bool eventTest(QEvent *e) override { if (e->type() != QEvent::Type(QEvent::User+1)) // StringEvent return false; @@ -80,7 +80,7 @@ protected: return (m_value == se->value); } - virtual void onTransition(QEvent *) {} + void onTransition(QEvent *) override {} private: QString m_value; diff --git a/src/corelib/io/qurl_p.h b/src/corelib/io/qurl_p.h index cb88cac35e..1b9237e58a 100644 --- a/src/corelib/io/qurl_p.h +++ b/src/corelib/io/qurl_p.h @@ -65,7 +65,7 @@ extern Q_AUTOTEST_EXPORT int qt_urlRecode(QString &appendTo, const QChar *begin, enum AceLeadingDot { AllowLeadingDot, ForbidLeadingDot }; enum AceOperation { ToAceOnly, NormalizeAce }; extern QString qt_ACE_do(const QString &domain, AceOperation op, AceLeadingDot dot); -extern Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from); +extern Q_AUTOTEST_EXPORT bool qt_nameprep(QString *source, int from); extern Q_AUTOTEST_EXPORT bool qt_check_std3rules(const QChar *uc, int len); extern Q_AUTOTEST_EXPORT void qt_punycodeEncoder(const QChar *s, int ucLength, QString *output); extern Q_AUTOTEST_EXPORT QString qt_punycodeDecoder(const QString &pc); diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp index 2f8bd91f6e..2305e66407 100644 --- a/src/corelib/io/qurlidna.cpp +++ b/src/corelib/io/qurlidna.cpp @@ -2021,7 +2021,7 @@ static bool isBidirectionalL(uint uc) return false; } -Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) +Q_AUTOTEST_EXPORT bool qt_nameprep(QString *source, int from) { QChar *src = source->data(); // causes a detach, so we're sure the only one using it QChar *out = src + from; @@ -2036,7 +2036,7 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) } } if (out == e) - return; // everything was mapped easily (lowercased, actually) + return true; // everything was mapped easily (lowercased, actually) int firstNonAscii = out - src; // Characters unassigned in Unicode 3.2 are not allowed in "stored string" scheme @@ -2059,7 +2059,7 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) QChar::UnicodeVersion version = QChar::unicodeVersion(uc); if (version == QChar::Unicode_Unassigned || version > QChar::Unicode_3_2) { source->resize(from); // not allowed, clear the label - return; + return false; } } if (!isMappedToNothing(uc)) { @@ -2086,7 +2086,7 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) // Strip prohibited output if (containsProhibitedOuptut(source, firstNonAscii)) { source->resize(from); - return; + return false; } // Check for valid bidirectional characters @@ -2110,9 +2110,13 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) } if (containsRandALCat) { if (containsLCat || (!isBidirectionalRorAL(src[from].unicode()) - || !isBidirectionalRorAL(e[-1].unicode()))) + || !isBidirectionalRorAL(e[-1].unicode()))) { source->resize(from); // not allowed, clear the label + return false; + } } + + return true; } static const QChar *qt_find_nonstd3(const QChar *uc, int len, Qt::CaseSensitivity cs) @@ -2553,7 +2557,8 @@ QString qt_ACE_do(const QString &domain, AceOperation op, AceLeadingDot dot) } else { // Punycode encoding and decoding cannot be done in-place // That means we need one or two temporaries - qt_nameprep(&result, prevLen); + if (!qt_nameprep(&result, prevLen)) + return QString(); // failed labelLength = result.length() - prevLen; int toReserve = labelLength + 4 + 6; // "xn--" plus some extra bytes aceForm.resize(0); diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h index b658d8afcf..0146e22fa3 100644 --- a/src/corelib/tools/qalgorithms.h +++ b/src/corelib/tools/qalgorithms.h @@ -651,6 +651,7 @@ Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW // So it's an acceptable compromise. #if defined(__AVX__) || defined(__SSE4_2__) || defined(__POPCNT__) #define QALGORITHMS_USE_BUILTIN_POPCOUNT +#define QALGORITHMS_USE_BUILTIN_POPCOUNTLL Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW { return __popcnt(v); @@ -663,13 +664,15 @@ Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) Q_DECL_NOTHROW { return __popcnt16(v); } -#if Q_PROCESSOR_WORDSIZE == 8 -#define QALGORITHMS_USE_BUILTIN_POPCOUNTLL Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW { +#if Q_PROCESSOR_WORDSIZE == 8 return __popcnt64(v); -} +#else + return __popcnt(quint32(v)) + __popcnt(quint32(v >> 32)); #endif // MSVC 64bit +} + #endif // __AVX__ || __SSE4_2__ || __POPCNT__ #endif // MSVC |