From ed32af3506c42689001d9b7267897405c02d3c39 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 30 Jun 2016 10:16:35 +0200 Subject: winrt: fix conditional Seems the previous check was a leftover from debugging. Tests still pass and loop checks properly now. Change-Id: Ic12cd49881f6d146687e257794b3028f6c8e874c Reviewed-by: Friedemann Kleint --- src/corelib/io/qsettings_winrt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qsettings_winrt.cpp b/src/corelib/io/qsettings_winrt.cpp index 02c3c7624e..85ef64cbd4 100644 --- a/src/corelib/io/qsettings_winrt.cpp +++ b/src/corelib/io/qsettings_winrt.cpp @@ -86,7 +86,7 @@ static IApplicationDataContainer *subContainer(IApplicationDataContainer *parent if (FAILED(hr)) return 0; - while (SUCCEEDED(S_OK) && current) { + while (SUCCEEDED(hr) && current) { ComPtr item; hr = iterator->get_Current(&item); if (FAILED(hr)) -- cgit v1.2.3 From f3df265a38b1ee7b8dab918d669d9bb721f38f74 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 14 Jun 2016 12:26:29 +0200 Subject: QDateTime: early return to make a Q_UNREACHABLE actually true. It could be reached when QT_BOOTSTRAPPED was defined. Change-Id: I632d6f908a3bcbde81a6ebbadcaf2800dfe1449d Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 1719d7f470..fb679e56c5 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2698,7 +2698,7 @@ qint64 QDateTimePrivate::toMSecsSinceEpoch() const case Qt::TimeZone: #ifdef QT_BOOTSTRAPPED - break; + return 0; #else return zoneMSecsToEpochMSecs(m_msecs, m_timeZone); #endif -- cgit v1.2.3 From c376e3fbf0cbeb60be9db8903f9a2998b8311ed6 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Mon, 27 Jun 2016 18:52:30 +0300 Subject: QDir: Remove redundant QString wrapping Change-Id: I8368b137d15509cdec575a17f5dae3c0c343400f Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qdir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index d0527282b5..3004711571 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -686,7 +686,7 @@ QString QDir::filePath(const QString &fileName) const { const QDirPrivate* d = d_ptr.constData(); if (isAbsolutePath(fileName)) - return QString(fileName); + return fileName; QString ret = d->dirEntry.filePath(); if (!fileName.isEmpty()) { -- cgit v1.2.3 From 9964b850ad9c322ab842bbd5941976b3d613f5f6 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 30 May 2016 16:57:00 +0200 Subject: Doc: Improve QJsonDocument::fromJson documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Be explicit on how to check whether parsing succeeds. Change-Id: I44f408cb6e5a830826b84dfb3a8af331f03e58cc Reviewed-by: Topi Reiniƶ --- src/corelib/json/qjsondocument.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp index 5f8f807cf0..7af7e4080c 100644 --- a/src/corelib/json/qjsondocument.cpp +++ b/src/corelib/json/qjsondocument.cpp @@ -351,16 +351,14 @@ QByteArray QJsonDocument::toJson(JsonFormat format) const #endif /*! - Parses a UTF-8 encoded JSON document and creates a QJsonDocument + Parses \a json as a UTF-8 encoded JSON document, and creates a QJsonDocument from it. - \a json contains the json document to be parsed. + Returns a valid (non-null) QJsonDocument if the parsing succeeds. If it fails, + the returned document will be null, and the optional \a error variable will contain + further details about the error. - The optional \a error variable can be used to pass in a QJsonParseError data - structure that will contain information about possible errors encountered during - parsing. - - \sa toJson(), QJsonParseError + \sa toJson(), QJsonParseError, isNull() */ QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error) { -- cgit v1.2.3 From 1af4916e11c1251b2957a909f819678e9fd32feb Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 1 Jul 2016 13:49:46 +0200 Subject: QTime: restore Qt3 compatibility in the QDataStream operators A Qt5 program writing a null QTime() using setVersion(QDataStream::Qt_3_3), and then a Qt3 program reading that, would lead to a weird QTime, with isNull=false, isValid=false, hour=1193, minute=2, second=47, ms=295. This commit restores interoperability, by writing out the expected value (0) for a null QTime rather than the -1 value used by Qt4 and Qt5. Change-Id: Icde468a8f6fc9434ef7018296725819b44d672af Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index fb679e56c5..e6d0b97836 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -4759,7 +4759,12 @@ QDataStream &operator>>(QDataStream &in, QDate &date) QDataStream &operator<<(QDataStream &out, const QTime &time) { - return out << quint32(time.mds); + if (out.version() >= QDataStream::Qt_4_0) { + return out << quint32(time.mds); + } else { + // Qt3 had no support for reading -1, QTime() was valid and serialized as 0 + return out << quint32(time.isNull() ? 0 : time.mds); + } } /*! @@ -4774,7 +4779,12 @@ QDataStream &operator>>(QDataStream &in, QTime &time) { quint32 ds; in >> ds; - time.mds = int(ds); + if (in.version() >= QDataStream::Qt_4_0) { + time.mds = int(ds); + } else { + // Qt3 would write 0 for a null time + time.mds = (ds == 0) ? QTime::NullTime : int(ds); + } return in; } -- cgit v1.2.3 From 4f3eb6617331ba2634206064512ae68a4fbd793e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 30 Jun 2016 15:48:52 -0700 Subject: QUrl: Test that we do correctly accept valid schemes ... and reject invalid ones. There was one error: we accepted schemes starting with pluses, dashes and dots. Change-Id: Ie585843cfb684bc3b6e3fffd145cfe12227ec4ad Reviewed-by: David Faure --- src/corelib/io/qurl.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index fb2f4ba918..2672de24f2 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -978,10 +978,12 @@ inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetErro needsLowercasing = i; continue; } - if (p[i] >= '0' && p[i] <= '9' && i > 0) - continue; - if (p[i] == '+' || p[i] == '-' || p[i] == '.') - continue; + if (i) { + if (p[i] >= '0' && p[i] <= '9') + continue; + if (p[i] == '+' || p[i] == '-' || p[i] == '.') + continue; + } // found something else // don't call setError needlessly: -- cgit v1.2.3 From 946c1a578a7c1e6acc95ef8095fa8a6ff026334b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 14 Jun 2016 07:49:13 -0700 Subject: Fix build: ftok(3) requires sys/ipc.h Task-number: QTBUG-54069 Change-Id: Ib57b52598e2f452985e9fffd1457fa9c7ad3bac0 Reviewed-by: Giuseppe D'Angelo --- src/corelib/kernel/qcore_unix_p.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 05711354ff..07725b8cd2 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -72,6 +72,10 @@ #include #include +#if !defined(QT_POSIX_IPC) && !defined(QT_NO_SHAREDMEMORY) && !defined(Q_OS_ANDROID) +# include +#endif + #if defined(Q_OS_VXWORKS) # include #endif -- cgit v1.2.3 From daade9b90dd39aa844cb683af776b802b0786ba7 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 16 Jun 2016 11:56:42 +0200 Subject: QEventLoop: better describe the exception safety of Qt 1) In general it's unsafe to let exceptions propagate through Qt code, so document that. 2) Add a note that overriding notify() makes sense only in Qt 5, in Qt 6 it's going away. 3) The advice applies also to applications not using QApplication, but just QCoreApplication. Change-Id: I4f6e74c53da757faf2eeaa9de226ceba55c52536 Reviewed-by: Thiago Macieira Reviewed-by: Martin Smith --- src/corelib/kernel/qeventloop.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qeventloop.cpp b/src/corelib/kernel/qeventloop.cpp index dca25ce968..0ee677d213 100644 --- a/src/corelib/kernel/qeventloop.cpp +++ b/src/corelib/kernel/qeventloop.cpp @@ -182,8 +182,10 @@ int QEventLoop::exec(ProcessEventsFlags flags) { if (exceptionCaught) { qWarning("Qt has caught an exception thrown from an event handler. Throwing\n" - "exceptions from an event handler is not supported in Qt. You must\n" - "reimplement QApplication::notify() and catch all exceptions there.\n"); + "exceptions from an event handler is not supported in Qt.\n" + "You must not let any exception whatsoever propagate through Qt code.\n" + "If that is not possible, in Qt 5 you must at least reimplement\n" + "QCoreApplication::notify() and catch all exceptions there.\n"); } locker.relock(); QEventLoop *eventLoop = d->threadData->eventLoops.pop(); -- cgit v1.2.3