From 7a127fb4b605da6a6f9cc781fe67de7aa00048aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 13 Feb 2019 14:29:32 +0100 Subject: Document that dialog parent relationship does not imply stacking order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On macOS, and most probably some X11 window managers, the parent/child relationship of the dialog is not possible to propagate to the platform, and the only determining factor of whether or not the windows stack on top of each other is the modal state of the window. Task-number: QTBUG-34767 Change-Id: I8b4b4910e3f905c44e577544fc347dbded373848 Reviewed-by: Volker Hilsheimer Reviewed-by: Topi Reiniö --- src/widgets/dialogs/qdialog.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index c9093095a7..1c10e3e786 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -246,6 +246,13 @@ void QDialogPrivate::deletePlatformHelper() window-system properties for the widget (in particular it will reset the Qt::Dialog flag). + \note The parent relationship of the dialog does \e{not} imply + that the dialog will always be stacked on top of the parent + window. To ensure that the dialog is always on top, make the + dialog modal. This also applies for child windows of the dialog + itself. To ensure that child windows of the dialog stay on top + of the dialog, make the child windows modal as well. + \section1 Modal Dialogs A \b{modal} dialog is a dialog that blocks input to other -- cgit v1.2.3 From 7831b276e610368514087a81396d1ca2425b2e42 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 5 Mar 2019 11:06:55 +0100 Subject: Handle error from MS-Win API in QCollator::compare() CompreString(Ex|) can fail, e.g. if it doesn't like the flags given. Report such failure and treat compared values as equal rather than whichever is first being less. Fixes: QTBUG-74209 Change-Id: If8fa962f9e14ee43cc423a09a67bc58259a24794 Reviewed-by: Thiago Macieira Reviewed-by: Aleix Pol Gonzalez --- src/corelib/tools/qcollator_win.cpp | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/corelib/tools/qcollator_win.cpp b/src/corelib/tools/qcollator_win.cpp index 35142bb8b8..10cfdaa264 100644 --- a/src/corelib/tools/qcollator_win.cpp +++ b/src/corelib/tools/qcollator_win.cpp @@ -72,6 +72,8 @@ void QCollatorPrivate::init() if (caseSensitivity == Qt::CaseInsensitive) collator |= NORM_IGNORECASE; + // WINE does not support SORT_DIGITSASNUMBERS :-( + // (and its std::sort() crashes on bad comparisons, QTBUG-74209) if (numericMode) collator |= SORT_DIGITSASNUMBERS; @@ -98,16 +100,36 @@ int QCollator::compare(const QChar *s1, int len1, const QChar *s2, int len2) con // Returns one of the following values if successful. To maintain the C runtime convention of // comparing strings, the value 2 can be subtracted from a nonzero return value. Then, the // meaning of <0, ==0, and >0 is consistent with the C runtime. + // [...] The function returns 0 if it does not succeed. + // https://docs.microsoft.com/en-us/windows/desktop/api/stringapiset/nf-stringapiset-comparestringex#return-value #ifndef USE_COMPARESTRINGEX - return CompareString(d->localeID, d->collator, - reinterpret_cast(s1), len1, - reinterpret_cast(s2), len2) - 2; + const int ret = CompareString(d->localeID, d->collator, + reinterpret_cast(s1), len1, + reinterpret_cast(s2), len2); #else - return CompareStringEx(LPCWSTR(d->localeName.utf16()), d->collator, - reinterpret_cast(s1), len1, - reinterpret_cast(s2), len2, NULL, NULL, 0) - 2; + const int ret = CompareStringEx(LPCWSTR(d->localeName.utf16()), d->collator, + reinterpret_cast(s1), len1, + reinterpret_cast(s2), len2, + nullptr, nullptr, 0); #endif + if (Q_LIKELY(ret)) + return ret - 2; + + switch (DWORD error = GetLastError()) { + case ERROR_INVALID_FLAGS: + qWarning("Unsupported flags (%d) used in QCollator", int(d->collator)); + break; + case ERROR_INVALID_PARAMETER: + qWarning("Invalid parameter for QCollator::compare()"); + break; + default: + qWarning("Failed (%ld) comparison in QCollator::compare()", long(error)); + break; + } + // We have no idea what to return, so pretend we think they're equal. + // At least that way we'll be consistent if we get the same values swapped ... + return 0; } int QCollator::compare(const QString &str1, const QString &str2) const -- cgit v1.2.3 From e431a3ac027915dbfc0588f42f3b56e07639811e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 4 Mar 2019 12:24:10 +0100 Subject: Don't retry a ssl connection if encryption was never finished As explained in the inline comment we don't actually have a protocol handler until we're done encrypting when we use SSL, but we would still retry the connection if an error occurred between "connected" and "encrypted". This would then lead us to fail an assert that checked if a protocol handler had been set Fixes: QTBUG-47822 Change-Id: If7f4ef4f70e72b764f492e7ced5a9349b3a421d2 Reviewed-by: Timur Pocheptsov --- src/network/access/qhttpnetworkconnectionchannel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 5726925cb0..d5f63af745 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -966,7 +966,10 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket } else if (state != QHttpNetworkConnectionChannel::IdleState && state != QHttpNetworkConnectionChannel::ReadingState) { // Try to reconnect/resend before sending an error. // While "Reading" the _q_disconnected() will handle this. - if (reconnectAttempts-- > 0) { + // If we're using ssl then the protocolHandler is not initialized until + // "encrypted" has been emitted, since retrying requires the protocolHandler (asserted) + // we will not try if encryption is not done. + if (!pendingEncrypt && reconnectAttempts-- > 0) { resendCurrentRequest(); return; } else { -- cgit v1.2.3 From 464d261aa8269c4dd59b88b6fa187a1973e32fbe Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 6 Mar 2019 12:50:26 +0100 Subject: Fix some warnings in manual tests Fix: gestures.cpp:46:16: warning: this statement may fall through [-Wimplicit-fallthrough=] gestures.cpp:47:5: note: here gestures.cpp:48:9: warning: this statement may fall through [-Wimplicit-fallthrough=] gestures.cpp:52:5: note: here main.cpp: In function 'QByteArray windowsVersionToString(QSysInfo::WinVersion)': main.cpp:40:12: warning: enumeration value 'WV_CE' not handled in switch [-Wswitch] ... main.cpp: In function 'QByteArray macVersionToString(QSysInfo::MacVersion)': main.cpp:68:12: warning: enumeration value 'MV_10_12' not handled in switch [-Wswitch] ... widget.cpp: In member function 'CustomItem* Widget::checkedItem() const': widget.cpp:238:12: warning: 'item' may be used uninitialized in this function [-Wmaybe-uninitialized] Change-Id: I434784e86d127e56b92663cb45eba7d60d8f8eaf Reviewed-by: Edward Welbourne --- tests/manual/gestures/graphicsview/gestures.cpp | 2 ++ tests/manual/qgraphicsitemgroup/widget.cpp | 2 +- tests/manual/qsysinfo/main.cpp | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/manual/gestures/graphicsview/gestures.cpp b/tests/manual/gestures/graphicsview/gestures.cpp index cc0ff3e1aa..6e5b07bf18 100644 --- a/tests/manual/gestures/graphicsview/gestures.cpp +++ b/tests/manual/gestures/graphicsview/gestures.cpp @@ -44,11 +44,13 @@ QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::recognize(QGesture switch (event->type()) { case QEvent::TouchBegin: result = QGestureRecognizer::MayBeGesture; + break; case QEvent::TouchEnd: if (d->gestureFired) result = QGestureRecognizer::FinishGesture; else result = QGestureRecognizer::CancelGesture; + break; case QEvent::TouchUpdate: if (d->state() != Qt::NoGesture) { QTouchEvent *ev = static_cast(event); diff --git a/tests/manual/qgraphicsitemgroup/widget.cpp b/tests/manual/qgraphicsitemgroup/widget.cpp index b0e7a47cf8..ba9ed815fa 100644 --- a/tests/manual/qgraphicsitemgroup/widget.cpp +++ b/tests/manual/qgraphicsitemgroup/widget.cpp @@ -224,7 +224,7 @@ void Widget::updateUngroupButton() CustomItem * Widget::checkedItem() const { - CustomItem *item; + CustomItem *item = nullptr; if (ui->blue->isChecked()) item = rectBlue; diff --git a/tests/manual/qsysinfo/main.cpp b/tests/manual/qsysinfo/main.cpp index 62d0c51416..1d39514236 100644 --- a/tests/manual/qsysinfo/main.cpp +++ b/tests/manual/qsysinfo/main.cpp @@ -57,6 +57,11 @@ QByteArray windowsVersionToString(QSysInfo::WinVersion v) CASE_VERSION(WV_WINDOWS8_1); CASE_VERSION(WV_WINDOWS10); case QSysInfo::WV_NT_based: // shouldn't happen + case QSysInfo::WV_CE: + case QSysInfo::WV_CENET: + case QSysInfo::WV_CE_5: + case QSysInfo::WV_CE_6: + case QSysInfo::WV_CE_based: break; } @@ -82,6 +87,7 @@ QByteArray macVersionToString(QSysInfo::MacVersion v) CASE_VERSION(MV_10_9); CASE_VERSION(MV_10_10); CASE_VERSION(MV_10_11); + CASE_VERSION(MV_10_12); CASE_VERSION(MV_IOS_4_3); CASE_VERSION(MV_IOS_5_0); @@ -96,8 +102,24 @@ QByteArray macVersionToString(QSysInfo::MacVersion v) CASE_VERSION(MV_IOS_8_3); CASE_VERSION(MV_IOS_8_4); CASE_VERSION(MV_IOS_9_0); + CASE_VERSION(MV_IOS_9_1); + CASE_VERSION(MV_IOS_9_2); + CASE_VERSION(MV_IOS_9_3); + CASE_VERSION(MV_IOS_10_0); case QSysInfo::MV_IOS: // shouldn't happen: + case QSysInfo::MV_TVOS: + case QSysInfo::MV_WATCHOS: break; + + CASE_VERSION(MV_TVOS_9_0); + CASE_VERSION(MV_TVOS_9_1); + CASE_VERSION(MV_TVOS_9_2); + CASE_VERSION(MV_TVOS_10_0); + + CASE_VERSION(MV_WATCHOS_2_0); + CASE_VERSION(MV_WATCHOS_2_1); + CASE_VERSION(MV_WATCHOS_2_2); + CASE_VERSION(MV_WATCHOS_3_0); } if (v & QSysInfo::MV_IOS) { -- cgit v1.2.3 From 3702622dde060442534019bd99cbbf140391547b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 6 Mar 2019 12:28:51 +0100 Subject: manual tests: Fix build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix QOverload::of(), causing ../../../../include/QtCore/../../src/corelib/global/qglobal.h: In instantiation of ‘struct QConstOverload’: Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...) const) const Q_DECL_NOTHROW -> decltype(ptr) and add a missing .pro-file. Change-Id: I19597adc33f2323a9f7dea9ee5ce94546f0e8f12 Reviewed-by: Edward Welbourne --- tests/manual/qtabletevent/regular_widgets/main.cpp | 2 +- tests/manual/widgets/widgets/widgets.pro | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 tests/manual/widgets/widgets/widgets.pro diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp index c0366dea63..4816e2f3b9 100644 --- a/tests/manual/qtabletevent/regular_widgets/main.cpp +++ b/tests/manual/qtabletevent/regular_widgets/main.cpp @@ -284,7 +284,7 @@ int main(int argc, char *argv[]) mainWindow.setWindowTitle(QString::fromLatin1("Tablet Test %1").arg(QT_VERSION_STR)); EventReportWidget *widget = new EventReportWidget; QObject::connect(proximityEventFilter, &ProximityEventFilter::proximityChanged, - widget, QOverload::of(&QWidget::update)); + widget, QOverload<>::of(&QWidget::update)); widget->setMinimumSize(640, 480); QMenu *fileMenu = mainWindow.menuBar()->addMenu("File"); fileMenu->addAction("Clear", widget, &EventReportWidget::clearPoints); diff --git a/tests/manual/widgets/widgets/widgets.pro b/tests/manual/widgets/widgets/widgets.pro new file mode 100644 index 0000000000..1fccb09d79 --- /dev/null +++ b/tests/manual/widgets/widgets/widgets.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs +SUBDIRS = bigmenucreator \ + defaultUpMenuBar \ + multiscreen-menus \ + qtoolbutton/menuOnMultiScreens -- cgit v1.2.3 From 8b3463fdeb3d03fd0c87873089a6f84321eecc49 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 17 Feb 2019 21:02:11 +0100 Subject: QAbstractItemView: make v-aligned items texts more user-friendly Commit 25133a1b77c059e32760f3d288c985183d86da4a fixed the item view text layouting correctly in a technical way. For a vertically aligned text which does not fit into the given rect it is not user-friendly to show some parts of the text. It is better to display the start of it and show an elide marker in the last visible line. Fixes: QTBUG-73721 Change-Id: Ia7453133ea0a229b24196467168c8371585c4d8f Reviewed-by: Eirik Aavitsland Reviewed-by: Richard Moe Gustavsen --- src/widgets/styles/qcommonstyle.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 79e338a6e7..c739ddc6e2 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -843,11 +843,14 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut } #endif // QT_CONFIG(toolbutton) -static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth) +static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth, int maxHeight = -1, int *lastVisibleLine = nullptr) { + if (lastVisibleLine) + *lastVisibleLine = -1; qreal height = 0; qreal widthUsed = 0; textLayout.beginLayout(); + int i = 0; while (true) { QTextLine line = textLayout.createLine(); if (!line.isValid()) @@ -856,6 +859,13 @@ static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth) line.setPosition(QPointF(0, height)); height += line.height(); widthUsed = qMax(widthUsed, line.naturalTextWidth()); + // we assume that the height of the next line is the same as the current one + if (maxHeight > 0 && lastVisibleLine && height + line.height() > maxHeight) { + const QTextLine nextLine = textLayout.createLine(); + *lastVisibleLine = nextLine.isValid() ? i : -1; + break; + } + ++i; } textLayout.endLayout(); return QSizeF(widthUsed, height); @@ -869,7 +879,13 @@ QString QCommonStylePrivate::calculateElidedText(const QString &text, const QTex QTextLayout textLayout(text, font); textLayout.setTextOption(textOption); - viewItemTextLayout(textLayout, textRect.width()); + // In AlignVCenter mode when more than one line is displayed and the height only allows + // some of the lines it makes no sense to display those. From a users perspective it makes + // more sense to see the start of the text instead something inbetween. + const bool vAlignmentOptimization = paintStartPosition && valign.testFlag(Qt::AlignVCenter); + + int lastVisibleLine = -1; + viewItemTextLayout(textLayout, textRect.width(), vAlignmentOptimization ? textRect.height() : -1, &lastVisibleLine); const QRectF boundingRect = textLayout.boundingRect(); // don't care about LTR/RTL here, only need the height @@ -896,7 +912,7 @@ QString QCommonStylePrivate::calculateElidedText(const QString &text, const QTex const int start = line.textStart(); const int length = line.textLength(); const bool drawElided = line.naturalTextWidth() > textRect.width(); - bool elideLastVisibleLine = false; + bool elideLastVisibleLine = lastVisibleLine == i; if (!drawElided && i + 1 < lineCount && lastVisibleLineShouldBeElided) { const QTextLine nextLine = textLayout.lineAt(i + 1); const int nextHeight = height + nextLine.height() / 2; @@ -927,7 +943,8 @@ QString QCommonStylePrivate::calculateElidedText(const QString &text, const QTex } // below visible text, can stop - if (height + layoutRect.top() >= textRect.bottom()) + if ((height + layoutRect.top() >= textRect.bottom()) || + (lastVisibleLine >= 0 && lastVisibleLine == i)) break; } return ret; -- cgit v1.2.3 From e4749e798585ffe43159fc32a10bf33843c6c5ed Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 6 Mar 2019 11:27:17 +0100 Subject: Do not mix QByteArray with QString in arithmetic QLatin1String + QByteArray + QLatin1String + QString should not be supported. That the compiler let us get away with this is distressing. Exposed by Anton Kudryavtsev's workon extending QString's operator+ support. Change-Id: I0adfaa87e48335928acb680da49e9173639af614 Reviewed-by: Anton Kudryavtsev Reviewed-by: Friedemann Kleint --- tests/baselineserver/shared/baselineprotocol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/baselineserver/shared/baselineprotocol.cpp b/tests/baselineserver/shared/baselineprotocol.cpp index 80e269ee2a..c9f9cd9bd2 100644 --- a/tests/baselineserver/shared/baselineprotocol.cpp +++ b/tests/baselineserver/shared/baselineprotocol.cpp @@ -366,7 +366,7 @@ bool BaselineProtocol::connect(const QString &testCase, bool *dryrun, const Plat if (!socket.waitForConnected(Timeout)) { sysSleep(3000); // Wait a bit and try again, the server might just be restarting if (!socket.waitForConnected(Timeout)) { - errMsg += QLS("TCP connectToHost failed. Host:") + serverName + QLS(" port:") + QString::number(ServerPort); + errMsg += QLS("TCP connectToHost failed. Host:") + QLS(serverName) + QLS(" port:") + QString::number(ServerPort); return false; } } -- cgit v1.2.3 From a0a1d9c5816bd9acb84f6a248e964f9a4f292973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 7 Mar 2019 17:01:19 +0100 Subject: iOS: Fix broken application background tracking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit e0e1c7ec2da12 amazingly both removed and inverted key parts of the logic for tracking the background state of the application. Fixes: QTBUG-74272 Change-Id: I9a9e8720f32e8228d27ee6b6a1fb35e5f7b7cedc Reviewed-by: Timur Pocheptsov Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioscontext.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm index fff66049ff..535e7d7aa6 100644 --- a/src/plugins/platforms/ios/qioscontext.mm +++ b/src/plugins/platforms/ios/qioscontext.mm @@ -306,7 +306,7 @@ bool QIOSContext::verifyGraphicsHardwareAvailability() Q_UNUSED(oldState); if (applicationBackgrounded && newState != Qt::ApplicationSuspended) { qCDebug(lcQpaGLContext) << "app no longer backgrounded, rendering enabled"; - applicationBackgrounded = true; + applicationBackgrounded = false; } } ); @@ -317,6 +317,7 @@ bool QIOSContext::verifyGraphicsHardwareAvailability() return; qCDebug(lcQpaGLContext) << "app backgrounded, rendering disabled"; + applicationBackgrounded = true; // By the time we receive this signal the application has moved into // Qt::ApplactionStateSuspended, and all windows have been obscured, -- cgit v1.2.3 From 6a86cc612dbcd1983c6bcb50c41832b2a835b937 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 8 Mar 2019 07:27:39 +0100 Subject: Fix a couple of small doc things in relation to QScopeGuard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6e61a18697b95d9e3f534d1d71ebf32fdff4a04f Reviewed-by: Tor Arne Vestbø Reviewed-by: Frederik Gladhorn --- src/corelib/doc/snippets/code/src_corelib_tools_qscopeguard.cpp | 2 +- src/corelib/tools/qscopeguard.qdoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qscopeguard.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qscopeguard.cpp index c8c5f694c6..2fa4f88011 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qscopeguard.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qscopeguard.cpp @@ -57,7 +57,7 @@ void myComplexCodeWithMultipleReturnPoints(int v) if (v == -1) return; - int v2 = code_that_might_through_exceptions(); + int v2 = code_that_might_throw_exceptions(); if (v2 == -1) return; diff --git a/src/corelib/tools/qscopeguard.qdoc b/src/corelib/tools/qscopeguard.qdoc index 70e13ab2fd..21b0bab9cf 100644 --- a/src/corelib/tools/qscopeguard.qdoc +++ b/src/corelib/tools/qscopeguard.qdoc @@ -33,7 +33,7 @@ QT_BEGIN_NAMESPACE \class QScopeGuard \since 5.12 \inmodule QtCore - \brief Provides a scope guard for calling a function at the of + \brief Provides a scope guard for calling a function at the end of a scope. */ -- cgit v1.2.3 From 3cdf3ae1f0f90cbb20791c69552453f2555d3016 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 7 Mar 2019 22:10:09 -0800 Subject: Fix Coverity warning about mixing enums MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Coverity says: >>> CID 190310: Incorrect expression (MIXED_ENUMS) >>> Mixing enum types "CborType" and "QCborStreamReader::Type" for "type_". Change-Id: Ifbadc62ac2d04a9a8952fffd1589e6e304fc7703 Reviewed-by: Mårten Nordheim Reviewed-by: Edward Welbourne --- src/corelib/serialization/qcborstream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/serialization/qcborstream.cpp b/src/corelib/serialization/qcborstream.cpp index d7b81ae324..264856b4bf 100644 --- a/src/corelib/serialization/qcborstream.cpp +++ b/src/corelib/serialization/qcborstream.cpp @@ -1934,7 +1934,7 @@ inline void QCborStreamReader::preparse() // for negative integer and we don't have separate types for Boolean, // Null and Undefined). if (type_ == CborBooleanType || type_ == CborNullType || type_ == CborUndefinedType) { - type_ = SimpleType; + type_ = CborSimpleType; value64 = quint8(d->buffer.at(d->bufferStart)) - CborSimpleType; } else { // Using internal TinyCBOR API! -- cgit v1.2.3 From 912bcf0f0df166705f9bfd0a74ab6afcf7b42f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Wed, 6 Mar 2019 09:30:54 +0200 Subject: Expand blacklisting of tst_qsslkey to cover all versions of RHELs Previous blacklisting 5c4e5032b5162341168c1cec09f0247c7f2283e7 only covered RHEL 6.6 and RHEL 7.4. The problem however exists in all 6.x and 7.x distros as they have the same openssl. This however leaves us the problem with future RHEL 8. This will keep blacklisting these tests there as well. We need a way to blacklist versions with a wildcard so that we could say RHEL-7.* Task-number: QTBUG-46203 Change-Id: I2cc52ba2eac949214ecaa02e19d9e623d5befc49 Reviewed-by: Timur Pocheptsov --- tests/auto/network/ssl/qsslkey/BLACKLIST | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/network/ssl/qsslkey/BLACKLIST b/tests/auto/network/ssl/qsslkey/BLACKLIST index c0dfe5eb86..f9bc0af6de 100644 --- a/tests/auto/network/ssl/qsslkey/BLACKLIST +++ b/tests/auto/network/ssl/qsslkey/BLACKLIST @@ -1,2 +1,2 @@ -redhatenterpriselinuxworkstation-6.6 -rhel-7.4 +redhatenterpriselinuxworkstation +rhel -- cgit v1.2.3 From c7f6761bc98593744f8f8f9d2b864656f8d36a58 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 13 Jul 2018 15:12:17 +0200 Subject: Doc: Remove background colors from simplified offline CSS The simplified style needs to work for both light and dark themes in Qt Creator's help system. Background and text colors are already applied according to the active theme, this commit removes the rest of the hardcoded element colors that do not look good with a dark theme. Task-number: QTBUG-49417 Task-number: QTBUG-69327 Change-Id: Ib5ebe2755e98ca120f0500ab82713a37ec7199bd Reviewed-by: Kai Koehne --- doc/global/template/style/offline-simple.css | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/doc/global/template/style/offline-simple.css b/doc/global/template/style/offline-simple.css index 82e99c42ac..b89ca5a808 100644 --- a/doc/global/template/style/offline-simple.css +++ b/doc/global/template/style/offline-simple.css @@ -1,5 +1,4 @@ pre, .LegaleseLeft { - background-color: #f0f0f0; font-family: Courier, monospace; font-weight: 600; vertical-align: top; @@ -40,7 +39,6 @@ h1.title { } h2, p.h2 { - background-color: #F2F3F4; padding: 4px; margin: 30px 0px 20px 10px; } @@ -67,10 +65,6 @@ ul li, ol li { } h3.fn, span.fn { - border-width: 3px; - border-style: solid; - border-color: #aaaaaa; - background-color: #eeeeee; word-spacing: 3px; padding: 5px; text-decoration: none; @@ -94,10 +88,6 @@ table td { padding: 6px 10px 6px 10px; } -table tr.odd { - background-color: #eeeeee; -} - table.qmlname td { padding: 0px; margin-left: 6px; @@ -144,19 +134,10 @@ span.naviSeparator { margin: 0; } -.navigationbar table tr { - background-color: #eeeeee; -} - -td#buildversion { - background-color: #ffffff; -} - .footer, .footer p { padding: 5px 0px 5px 0px; margin: 45px 15px 5px 15px; font-size: 8.5pt; - background-color: #cccccc; } .footer p { -- cgit v1.2.3 From 52c0bb59945f5068c84238619411078a1c67620f Mon Sep 17 00:00:00 2001 From: Robert Szefner Date: Mon, 11 Mar 2019 00:23:31 +0100 Subject: QPSQL: Use qstrtod() function for string to double conversion A change to qstrtod() will give us a small performance improvement. Because the qstrtod() function does not correctly parse the NaN values, an appropriate check condition for NaN has been added. Also changed code structure so now the double conversion function is called only in one place. Task-number: QTBUG-65748 Change-Id: I49d40e5157e79cc5fce35db4c4272d1ccd270c6b Reviewed-by: Andy Shaw --- src/plugins/sqldrivers/psql/qsql_psql.cpp | 44 +++++++++++++++++-------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp index 49b793ce38..fe4bb4b464 100644 --- a/src/plugins/sqldrivers/psql/qsql_psql.cpp +++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include @@ -663,27 +664,30 @@ QVariant QPSQLResult::data(int i) return atoi(val); case QVariant::Double: { if (ptype == QNUMERICOID) { - if (numericalPrecisionPolicy() != QSql::HighPrecision) { - QVariant retval; - bool convert; - double dbl=QString::fromLatin1(val).toDouble(&convert); - if (numericalPrecisionPolicy() == QSql::LowPrecisionInt64) - retval = (qlonglong)dbl; - else if (numericalPrecisionPolicy() == QSql::LowPrecisionInt32) - retval = (int)dbl; - else if (numericalPrecisionPolicy() == QSql::LowPrecisionDouble) - retval = dbl; - if (!convert) - return QVariant(); - return retval; - } - return QString::fromLatin1(val); + if (numericalPrecisionPolicy() == QSql::HighPrecision) + return QString::fromLatin1(val); + } + bool ok; + double dbl = qstrtod(val, nullptr, &ok); + if (!ok) { + if (qstricmp(val, "NaN") == 0) + dbl = qQNaN(); + else if (qstricmp(val, "Infinity") == 0) + dbl = qInf(); + else if (qstricmp(val, "-Infinity") == 0) + dbl = -qInf(); + else + return QVariant(); + } + if (ptype == QNUMERICOID) { + if (numericalPrecisionPolicy() == QSql::LowPrecisionInt64) + return QVariant((qlonglong)dbl); + else if (numericalPrecisionPolicy() == QSql::LowPrecisionInt32) + return QVariant((int)dbl); + else if (numericalPrecisionPolicy() == QSql::LowPrecisionDouble) + return QVariant(dbl); } - if (qstricmp(val, "Infinity") == 0) - return qInf(); - if (qstricmp(val, "-Infinity") == 0) - return -qInf(); - return QString::fromLatin1(val).toDouble(); + return dbl; } case QVariant::Date: if (val[0] == '\0') { -- cgit v1.2.3 From a9cd8ce2961190e51c59cdd34c26c5b6f4c70aa1 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Tue, 19 Feb 2019 10:25:12 +1000 Subject: wasm: fix error report when network request is cancelled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-73346 Change-Id: I8aaf8fe45f3014e2c9187c554ed86a4d29c03c0b Reviewed-by: Morten Johan Sørvig --- src/network/access/qnetworkreplywasmimpl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/network/access/qnetworkreplywasmimpl.cpp b/src/network/access/qnetworkreplywasmimpl.cpp index b1e9853a50..f347cc0479 100644 --- a/src/network/access/qnetworkreplywasmimpl.cpp +++ b/src/network/access/qnetworkreplywasmimpl.cpp @@ -235,6 +235,7 @@ void QNetworkReplyWasmImpl::close() void QNetworkReplyWasmImpl::abort() { Q_D(const QNetworkReplyWasmImpl); + setError( QNetworkReply::OperationCanceledError, "Operation canceled" ); d->doAbort(); close(); -- cgit v1.2.3 From 5e74505c33f0d8c8e7f0ec91cdf7e4fd6d3d5f20 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 12 Mar 2019 09:50:11 +0100 Subject: QOcspResponse - fix broken documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the 'other' parameter in the "defaulted" definitions was removed to get rid of 'unused variable' error, docs were not updated properly, still referring to non-existing 'other' parameter. Change-Id: I3acbebfa5f1cf915d46a5bbf1b4a1ea18374b565 Reviewed-by: Mårten Nordheim --- src/network/ssl/qocspresponse.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/ssl/qocspresponse.cpp b/src/network/ssl/qocspresponse.cpp index 1f2de44859..d564e817ca 100644 --- a/src/network/ssl/qocspresponse.cpp +++ b/src/network/ssl/qocspresponse.cpp @@ -124,14 +124,14 @@ QOcspResponse::QOcspResponse() /*! \since 5.13 - Creates a new response, the copy of \a other. + Copy-constructs a QOcspResponse instance. */ QOcspResponse::QOcspResponse(const QOcspResponse &) = default; /*! \since 5.13 - Move-constructs a QOcspResponse instance from \a other. + Move-constructs a QOcspResponse instance. */ QOcspResponse::QOcspResponse(QOcspResponse &&) Q_DECL_NOTHROW = default; @@ -145,14 +145,14 @@ QOcspResponse::~QOcspResponse() = default; /*! \since 5.13 - Assigns \a other to the response and returns a reference to this response. + Copy-assigns and returns a reference to this response. */ QOcspResponse &QOcspResponse::operator=(const QOcspResponse &) = default; /*! \since 5.13 - Move-assigns \a other to this QOcspResponse instance. + Move-assigns to this QOcspResponse instance. */ QOcspResponse &QOcspResponse::operator=(QOcspResponse &&) Q_DECL_NOTHROW = default; -- cgit v1.2.3 From 3fa5e637fb45ae6868422494f5a17c0c8fc68ab2 Mon Sep 17 00:00:00 2001 From: Robert Szefner Date: Mon, 11 Mar 2019 22:43:20 +0100 Subject: QPSQL: Fix code formatting Only whitespace changes. Change-Id: I474aa1b477be7081b58bd781417861878b207f4e Reviewed-by: Christian Ehrlicher --- src/plugins/sqldrivers/psql/qsql_psql.cpp | 51 +++++++++++++++---------------- src/plugins/sqldrivers/psql/qsql_psql_p.h | 14 ++++----- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp index fe4bb4b464..6476dd7839 100644 --- a/src/plugins/sqldrivers/psql/qsql_psql.cpp +++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp @@ -136,7 +136,7 @@ protected: bool nextResult() override; QVariant data(int i) override; bool isNull(int field) override; - bool reset (const QString &query) override; + bool reset(const QString &query) override; int size() override; int numRowsAffected() override; QSqlRecord record() const override; @@ -320,15 +320,15 @@ public: bool processResults(); }; -static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type, - const QPSQLDriverPrivate *p, PGresult* result = 0) +static QSqlError qMakeError(const QString &err, QSqlError::ErrorType type, + const QPSQLDriverPrivate *p, PGresult *result = 0) { const char *s = PQerrorMessage(p->connection); QString msg = p->isUtf8 ? QString::fromUtf8(s) : QString::fromLocal8Bit(s); QString errorCode; if (result) { - errorCode = QString::fromLatin1(PQresultErrorField(result, PG_DIAG_SQLSTATE)); - msg += QString::fromLatin1("(%1)").arg(errorCode); + errorCode = QString::fromLatin1(PQresultErrorField(result, PG_DIAG_SQLSTATE)); + msg += QString::fromLatin1("(%1)").arg(errorCode); } return QSqlError(QLatin1String("QPSQL: ") + err, msg, type, errorCode); } @@ -437,7 +437,7 @@ void QPSQLResultPrivate::deallocatePreparedStmt() preparedStmtId.clear(); } -QPSQLResult::QPSQLResult(const QPSQLDriver* db) +QPSQLResult::QPSQLResult(const QPSQLDriver *db) : QSqlResult(*new QPSQLResultPrivate(this, db)) { Q_D(QPSQLResult); @@ -715,7 +715,7 @@ QVariant QPSQLResult::data(int i) #if QT_CONFIG(datestring) if (dtval.length() < 10) { return QVariant(QDateTime()); - } else { + } else { QChar sign = dtval[dtval.size() - 3]; if (sign == QLatin1Char('-') || sign == QLatin1Char('+')) dtval += QLatin1String(":00"); return QVariant(QDateTime::fromString(dtval, Qt::ISODate).toLocalTime()); @@ -745,7 +745,7 @@ bool QPSQLResult::isNull(int field) return PQgetisnull(d->result, currentRow, field); } -bool QPSQLResult::reset (const QString& query) +bool QPSQLResult::reset(const QString &query) { Q_D(QPSQLResult); cleanup(); @@ -872,7 +872,6 @@ QSqlRecord QPSQLResult::record() const void QPSQLResult::virtual_hook(int id, void *data) { Q_ASSERT(data); - QSqlResult::virtual_hook(id, data); } @@ -970,7 +969,7 @@ bool QPSQLResult::exec() bool QPSQLDriverPrivate::setEncodingUtf8() { - PGresult* result = exec("SET CLIENT_ENCODING TO 'UNICODE'"); + PGresult *result = exec("SET CLIENT_ENCODING TO 'UNICODE'"); int status = PQresultStatus(result); PQclear(result); return status == PGRES_COMMAND_OK; @@ -978,7 +977,7 @@ bool QPSQLDriverPrivate::setEncodingUtf8() void QPSQLDriverPrivate::setDatestyle() { - PGresult* result = exec("SET DATESTYLE TO 'ISO'"); + PGresult *result = exec("SET DATESTYLE TO 'ISO'"); int status = PQresultStatus(result); if (status != PGRES_COMMAND_OK) qWarning("%s", PQerrorMessage(connection)); @@ -1007,7 +1006,7 @@ void QPSQLDriverPrivate::detectBackslashEscape() hasBackslashEscape = true; } else { hasBackslashEscape = false; - PGresult* result = exec(QStringLiteral("SELECT '\\\\' x")); + PGresult *result = exec(QStringLiteral("SELECT '\\\\' x")); int status = PQresultStatus(result); if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK) if (QString::fromLatin1(PQgetvalue(result, 0, 0)) == QLatin1String("\\")) @@ -1110,7 +1109,7 @@ static QPSQLDriver::Protocol qFindPSQLVersion(const QString &versionString) QPSQLDriver::Protocol QPSQLDriverPrivate::getPSQLVersion() { QPSQLDriver::Protocol serverVersion = QPSQLDriver::Version6; - PGresult* result = exec("SELECT version()"); + PGresult *result = exec("SELECT version()"); int status = PQresultStatus(result); if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK) { serverVersion = qFindPSQLVersion( @@ -1216,12 +1215,12 @@ static QString qQuote(QString s) return s; } -bool QPSQLDriver::open(const QString & db, - const QString & user, - const QString & password, - const QString & host, - int port, - const QString& connOpts) +bool QPSQLDriver::open(const QString &db, + const QString &user, + const QString &password, + const QString &host, + int port, + const QString &connOpts) { Q_D(QPSQLDriver); if (isOpen()) @@ -1297,7 +1296,7 @@ bool QPSQLDriver::beginTransaction() qWarning("QPSQLDriver::beginTransaction: Database not open"); return false; } - PGresult* res = d->exec("BEGIN"); + PGresult *res = d->exec("BEGIN"); if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) { setLastError(qMakeError(tr("Could not begin transaction"), QSqlError::TransactionError, d, res)); @@ -1315,7 +1314,7 @@ bool QPSQLDriver::commitTransaction() qWarning("QPSQLDriver::commitTransaction: Database not open"); return false; } - PGresult* res = d->exec("COMMIT"); + PGresult *res = d->exec("COMMIT"); bool transaction_failed = false; @@ -1344,7 +1343,7 @@ bool QPSQLDriver::rollbackTransaction() qWarning("QPSQLDriver::rollbackTransaction: Database not open"); return false; } - PGresult* res = d->exec("ROLLBACK"); + PGresult *res = d->exec("ROLLBACK"); if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) { setLastError(qMakeError(tr("Could not rollback transaction"), QSqlError::TransactionError, d, res)); @@ -1387,7 +1386,7 @@ static void qSplitTableName(QString &tablename, QString &schema) tablename = tablename.mid(dot + 1); } -QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const +QSqlIndex QPSQLDriver::primaryIndex(const QString &tablename) const { QSqlIndex idx(tablename); if (!isOpen()) @@ -1424,7 +1423,7 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const return idx; } -QSqlRecord QPSQLDriver::record(const QString& tablename) const +QSqlRecord QPSQLDriver::record(const QString &tablename) const { QSqlRecord info; if (!isOpen()) @@ -1575,7 +1574,7 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const QString QPSQLDriver::escapeIdentifier(const QString &identifier, IdentifierType) const { QString res = identifier; - if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) { + if (!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) { res.replace(QLatin1Char('"'), QLatin1String("\"\"")); res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); res.replace(QLatin1Char('.'), QLatin1String("\".\"")); @@ -1683,7 +1682,7 @@ void QPSQLDriver::_q_handleNotification(int) PQconsumeInput(d->connection); PGnotify *notify = 0; - while((notify = PQnotifies(d->connection)) != 0) { + while ((notify = PQnotifies(d->connection)) != 0) { QString name(QLatin1String(notify->relname)); if (d->seid.contains(name)) { QString payload; diff --git a/src/plugins/sqldrivers/psql/qsql_psql_p.h b/src/plugins/sqldrivers/psql/qsql_psql_p.h index 4f372346c6..99e0b5f60f 100644 --- a/src/plugins/sqldrivers/psql/qsql_psql_p.h +++ b/src/plugins/sqldrivers/psql/qsql_psql_p.h @@ -100,18 +100,18 @@ public: explicit QPSQLDriver(PGconn *conn, QObject *parent = nullptr); ~QPSQLDriver(); bool hasFeature(DriverFeature f) const override; - bool open(const QString & db, - const QString & user, - const QString & password, - const QString & host, + bool open(const QString &db, + const QString &user, + const QString &password, + const QString &host, int port, - const QString& connOpts) override; + const QString &connOpts) override; bool isOpen() const override; void close() override; QSqlResult *createResult() const override; QStringList tables(QSql::TableType) const override; - QSqlIndex primaryIndex(const QString& tablename) const override; - QSqlRecord record(const QString& tablename) const override; + QSqlIndex primaryIndex(const QString &tablename) const override; + QSqlRecord record(const QString &tablename) const override; Protocol protocol() const; QVariant handle() const override; -- cgit v1.2.3 From 2c6593b721f809012e6b93ba4c4428b76e22adb3 Mon Sep 17 00:00:00 2001 From: Robert Szefner Date: Mon, 11 Mar 2019 23:36:26 +0100 Subject: QPSQL: Use nullptr for pointers Change-Id: I2b61cf0b81550c0878b0f06488a933c4b14e4728 Reviewed-by: Christian Ehrlicher --- src/plugins/sqldrivers/psql/qsql_psql.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp index 6476dd7839..c1be91cb22 100644 --- a/src/plugins/sqldrivers/psql/qsql_psql.cpp +++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp @@ -321,7 +321,7 @@ public: }; static QSqlError qMakeError(const QString &err, QSqlError::ErrorType type, - const QPSQLDriverPrivate *p, PGresult *result = 0) + const QPSQLDriverPrivate *p, PGresult *result = nullptr) { const char *s = PQerrorMessage(p->connection); QString msg = p->isUtf8 ? QString::fromUtf8(s) : QString::fromLocal8Bit(s); @@ -1249,7 +1249,7 @@ bool QPSQLDriver::open(const QString &db, setLastError(qMakeError(tr("Unable to connect"), QSqlError::ConnectionError, d)); setOpenError(true); PQfinish(d->connection); - d->connection = 0; + d->connection = nullptr; return false; } @@ -1273,12 +1273,12 @@ void QPSQLDriver::close() if (d->sn) { disconnect(d->sn, SIGNAL(activated(int)), this, SLOT(_q_handleNotification(int))); delete d->sn; - d->sn = 0; + d->sn = nullptr; } if (d->connection) PQfinish(d->connection); - d->connection = 0; + d->connection = nullptr; setOpen(false); setOpenError(false); } @@ -1663,7 +1663,7 @@ bool QPSQLDriver::unsubscribeFromNotification(const QString &name) if (d->seid.isEmpty()) { disconnect(d->sn, SIGNAL(activated(int)), this, SLOT(_q_handleNotification(int))); delete d->sn; - d->sn = 0; + d->sn = nullptr; } return true; @@ -1681,8 +1681,8 @@ void QPSQLDriver::_q_handleNotification(int) d->pendingNotifyCheck = false; PQconsumeInput(d->connection); - PGnotify *notify = 0; - while ((notify = PQnotifies(d->connection)) != 0) { + PGnotify *notify = nullptr; + while ((notify = PQnotifies(d->connection)) != nullptr) { QString name(QLatin1String(notify->relname)); if (d->seid.contains(name)) { QString payload; -- cgit v1.2.3 From b0f17780dfc20722fba9cb2caa174e79009b058a Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 11 Mar 2019 22:01:17 +0100 Subject: Doc: Unify terminology for '\0'-terminated strings The documentation for QByteArray and QString is using different notations for '\0'-terminated strings. Unify them by using '\0'-terminated everywhere. Change-Id: Ia26ec5c50635bebba1b54b7fe227ff0bcca4f2ad Reviewed-by: Paul Wicking Reviewed-by: Samuel Gaist --- src/corelib/tools/qbytearray.cpp | 19 ++++++++++--------- src/corelib/tools/qstring.cpp | 26 +++++++++++--------------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 64674ddc00..0f27071176 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -523,7 +523,7 @@ int qstrnicmp(const char *str1, const char *str2, uint len) A helper for QByteArray::compare. Compares \a len1 bytes from \a str1 to \a len2 bytes from \a str2. If \a len2 is -1, then \a str2 is expected to be - null-terminated. + '\\0'-terminated. */ int qstrnicmp(const char *str1, qsizetype len1, const char *str2, qsizetype len2) { @@ -1765,9 +1765,10 @@ void QByteArray::chop(int n) If \a data is 0, a null byte array is constructed. - If \a size is negative, \a data is assumed to point to a nul-terminated - string and its length is determined dynamically. The terminating - nul-character is not considered part of the byte array. + If \a size is negative, \a data is assumed to point to a + '\\0'-terminated string and its length is determined dynamically. + The terminating \\0 character is not considered part of the + byte array. QByteArray makes a deep copy of the string data. @@ -1924,7 +1925,7 @@ void QByteArray::expand(int i) /*! \internal - Return a QByteArray that is sure to be NUL-terminated. + Return a QByteArray that is sure to be '\\0'-terminated. By default, all QByteArray have an extra NUL at the end, guaranteeing that assumption. However, if QByteArray::fromRawData @@ -2336,8 +2337,8 @@ QByteArray &QByteArray::replace(int pos, int len, const QByteArray &after) \overload - Replaces \a len bytes from index position \a pos with the zero terminated - string \a after. + Replaces \a len bytes from index position \a pos with the + '\\0'-terminated string \a after. Notice: this can change the length of the byte array. */ @@ -2415,7 +2416,7 @@ QByteArray &QByteArray::replace(const char *c, const QByteArray &after) Replaces every occurrence of the string \a before with the string \a after. Since the sizes of the strings are given by \a bsize and \a asize, they - may contain zero characters and do not need to be zero-terminated. + may contain zero characters and do not need to be '\\0'-terminated. */ QByteArray &QByteArray::replace(const char *before, int bsize, const char *after, int asize) @@ -4541,7 +4542,7 @@ QByteArray QByteArray::number(double n, char f, int prec) \snippet code/src_corelib_tools_qbytearray.cpp 43 \warning A byte array created with fromRawData() is \e not - null-terminated, unless the raw data contains a 0 character at + '\\0'-terminated, unless the raw data contains a 0 character at position \a size. While that does not matter for QDataStream or functions like indexOf(), passing the byte array to a function accepting a \c{const char *} expected to be '\\0'-terminated will diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 1f6fa89136..9d6e0cbdd8 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -1468,7 +1468,7 @@ const QString::Null QString::null = { }; In all of the QString functions that take \c{const char *} parameters, the \c{const char *} is interpreted as a classic C-style '\\0'-terminated string encoded in UTF-8. It is legal for - the \c{const char *} parameter to be 0. + the \c{const char *} parameter to be \nullptr. You can also provide string data as an array of \l{QChar}s: @@ -2041,7 +2041,7 @@ const QString::Null QString::null = { }; the size of wchar. If wchar is 4 bytes, the \a string is interpreted as UCS-4, if wchar is 2 bytes it is interpreted as UTF-16. - If \a size is -1 (default), the \a string has to be 0 terminated. + If \a size is -1 (default), the \a string has to be \\0'-terminated. \sa fromUtf16(), fromLatin1(), fromLocal8Bit(), fromUtf8(), fromUcs4(), fromStdWString() */ @@ -2107,7 +2107,7 @@ int QString::toUcs4_helper(const ushort *uc, int length, uint *out) If \a unicode is 0, a null string is constructed. - If \a size is negative, \a unicode is assumed to point to a nul-terminated + If \a size is negative, \a unicode is assumed to point to a \\0'-terminated array and its length is determined dynamically. The terminating nul-character is not considered part of the string. @@ -5448,7 +5448,7 @@ static QVector qt_convert_to_ucs4(QStringView string); this string is replaced by the Unicode's replacement character (QChar::ReplacementCharacter, which corresponds to \c{U+FFFD}). - The returned vector is not NUL terminated. + The returned vector is not \\0'-terminated. \sa fromUtf8(), toUtf8(), toLatin1(), toLocal8Bit(), QTextCodec, fromUcs4(), toWCharArray() */ @@ -5480,7 +5480,7 @@ static QVector qt_convert_to_ucs4(QStringView string) this string is replaced by the Unicode's replacement character (QChar::ReplacementCharacter, which corresponds to \c{U+FFFD}). - The returned vector is not NUL terminated. + The returned vector is not \\0'-terminated. \sa QString::toUcs4(), QStringView::toUcs4(), QtPrivate::convertToLatin1(), QtPrivate::convertToLocal8Bit(), QtPrivate::convertToUtf8() @@ -5638,8 +5638,7 @@ QString QString::fromUtf8_helper(const char *str, int size) Returns a QString initialized with the first \a size characters of the Unicode string \a unicode (ISO-10646-UTF-16 encoded). - If \a size is -1 (default), \a unicode must be terminated - with a 0. + If \a size is -1 (default), \a unicode must be \\0'-terminated. This function checks for a Byte Order Mark (BOM). If it is missing, host byte order is assumed. @@ -5670,8 +5669,7 @@ QString QString::fromUtf16(const ushort *unicode, int size) Returns a QString initialized with the first \a size characters of the Unicode string \a str (ISO-10646-UTF-16 encoded). - If \a size is -1 (default), \a str must be terminated - with a 0. + If \a size is -1 (default), \a str must be \\0'-terminated. This function checks for a Byte Order Mark (BOM). If it is missing, host byte order is assumed. @@ -5691,8 +5689,7 @@ QString QString::fromUtf16(const ushort *unicode, int size) Returns a QString initialized with the first \a size characters of the Unicode string \a str (ISO-10646-UCS-4 encoded). - If \a size is -1 (default), \a str must be terminated - with a 0. + If \a size is -1 (default), \a str must be \\0'-terminated. \sa toUcs4(), fromUtf16(), utf16(), setUtf16(), fromWCharArray(), fromStdU32String() */ @@ -5703,8 +5700,7 @@ QString QString::fromUtf16(const ushort *unicode, int size) Returns a QString initialized with the first \a size characters of the Unicode string \a unicode (ISO-10646-UCS-4 encoded). - If \a size is -1 (default), \a unicode must be terminated - with a 0. + If \a size is -1 (default), \a unicode must be \\0'-terminated. \sa toUcs4(), fromUtf16(), utf16(), setUtf16(), fromWCharArray(), fromStdU32String() */ @@ -10354,7 +10350,7 @@ ownership of it, no memory is freed when instances are destroyed. Returns a Unicode representation of the string reference. Since the data stems directly from the referenced string, it is not - null-terminated unless the string reference includes the string's + \\0'-terminated unless the string reference includes the string's null terminator. \sa string() @@ -11896,7 +11892,7 @@ QByteArray QStringRef::toUtf8() const this string is replaced by the Unicode's replacement character (QChar::ReplacementCharacter, which corresponds to \c{U+FFFD}). - The returned vector is not NUL terminated. + The returned vector is not \\0'-terminated. \sa toUtf8(), toLatin1(), toLocal8Bit(), QTextCodec */ -- cgit v1.2.3 From fed9fa171496fd24b264ef66e3e517d988fa3105 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 11 Mar 2019 22:00:27 +0100 Subject: Doc: replace 0 with \nullptr in documentation Replace some more 0 with \nullptr. Change-Id: I2af91bf3712eef5161b11da0c44614bc039ade03 Reviewed-by: Paul Wicking --- src/corelib/codecs/qtextcodec.cpp | 4 ++-- src/corelib/kernel/qobject.cpp | 16 ++++++++-------- src/corelib/plugin/qlibrary.cpp | 4 ++-- src/gui/itemmodels/qstandarditemmodel.cpp | 8 ++++---- src/gui/kernel/qplatformcursor.cpp | 2 +- src/gui/kernel/qwindow.cpp | 3 ++- src/widgets/graphicsview/qgraphicsscene.cpp | 4 ++-- src/widgets/kernel/qtooltip.cpp | 4 ++-- src/widgets/kernel/qwidget.cpp | 8 ++++---- src/widgets/widgets/qabstractspinbox.cpp | 2 +- src/widgets/widgets/qcombobox.cpp | 2 +- 11 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 804e0b2935..e2598b7858 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -764,7 +764,7 @@ QList QTextCodec::aliases() const encoding of the subclass to Unicode, and returns the result in a QString. - \a state can be 0, in which case the conversion is stateless and + \a state can be \nullptr, in which case the conversion is stateless and default conversion rules should be used. If state is not 0, the codec should save the state after the conversion in \a state, and adjust the \c remainingChars and \c invalidChars members of the struct. @@ -780,7 +780,7 @@ QList QTextCodec::aliases() const from Unicode to the encoding of the subclass, and returns the result in a QByteArray. - \a state can be 0 in which case the conversion is stateless and + \a state can be \nullptr in which case the conversion is stateless and default conversion rules should be used. If state is not 0, the codec should save the state after the conversion in \a state, and adjust the \c remainingChars and \c invalidChars members of the struct. diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 3a3eb726fa..15955e1665 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2934,8 +2934,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho 0 may be used as a wildcard, meaning "any signal", "any receiving object", or "any slot in the receiving object", respectively. - The \a sender may never be 0. (You cannot disconnect signals from - more than one object in a single call.) + The \a sender may never be \nullptr. (You cannot disconnect signals + from more than one object in a single call.) If \a signal is 0, it disconnects \a receiver and \a method from any signal. If not, only the specified signal is disconnected. @@ -2946,8 +2946,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho If \a method is 0, it disconnects anything that is connected to \a receiver. If not, only slots named \a method will be disconnected, - and all other slots are left alone. The \a method must be 0 if \a - receiver is left out, so you cannot disconnect a + and all other slots are left alone. The \a method must be \nullptr + if \a receiver is left out, so you cannot disconnect a specifically-named slot on all objects. \sa connect() @@ -4991,8 +4991,8 @@ bool QObject::disconnect(const QMetaObject::Connection &connection) 0 may be used as a wildcard, meaning "any signal", "any receiving object", or "any slot in the receiving object", respectively. - The \a sender may never be 0. (You cannot disconnect signals from - more than one object in a single call.) + The \a sender may never be \nullptr. (You cannot disconnect signals + from more than one object in a single call.) If \a signal is 0, it disconnects \a receiver and \a method from any signal. If not, only the specified signal is disconnected. @@ -5003,8 +5003,8 @@ bool QObject::disconnect(const QMetaObject::Connection &connection) If \a method is 0, it disconnects anything that is connected to \a receiver. If not, only slots named \a method will be disconnected, - and all other slots are left alone. The \a method must be 0 if \a - receiver is left out, so you cannot disconnect a + and all other slots are left alone. The \a method must be \nullptr + if \a receiver is left out, so you cannot disconnect a specifically-named slot on all objects. \note It is not possible to use this overload to diconnect signals diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index aa63ed1a6b..6635286f76 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -133,8 +133,8 @@ QT_BEGIN_NAMESPACE The following code snippet loads a library, resolves the symbol "mysymbol", and calls the function if everything succeeded. If something goes wrong, e.g. the library file does not exist or the - symbol is not defined, the function pointer will be 0 and won't be - called. + symbol is not defined, the function pointer will be \nullptr and + won't be called. \snippet code/src_corelib_plugin_qlibrary.cpp 0 diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 97cbf5f9d3..3e3c7a6211 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -1905,7 +1905,7 @@ QStandardItem *QStandardItem::takeChild(int row, int column) /*! Removes \a row without deleting the row items, and returns a list of pointers to the removed items. For items in the row that have not been - set, the corresponding pointers in the list will be 0. + set, the corresponding pointers in the list will be \nullptr. \sa removeRow(), insertRow(), takeColumn() */ @@ -1939,7 +1939,7 @@ QList QStandardItem::takeRow(int row) /*! Removes \a column without deleting the column items, and returns a list of pointers to the removed items. For items in the column that have not been - set, the corresponding pointers in the list will be 0. + set, the corresponding pointers in the list will be \nullptr. \sa removeColumn(), insertColumn(), takeRow() */ @@ -2718,7 +2718,7 @@ QStandardItem *QStandardItemModel::takeItem(int row, int column) Removes the given \a row without deleting the row items, and returns a list of pointers to the removed items. The model releases ownership of the items. For items in the row that have not been set, the corresponding - pointers in the list will be 0. + pointers in the list will be \nullptr. \sa takeColumn() */ @@ -2734,7 +2734,7 @@ QList QStandardItemModel::takeRow(int row) Removes the given \a column without deleting the column items, and returns a list of pointers to the removed items. The model releases ownership of the items. For items in the column that have not been set, the - corresponding pointers in the list will be 0. + corresponding pointers in the list will be \nullptr. \sa takeRow() */ diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp index 76e38ab12d..49eff2ad23 100644 --- a/src/gui/kernel/qplatformcursor.cpp +++ b/src/gui/kernel/qplatformcursor.cpp @@ -89,7 +89,7 @@ QT_BEGIN_NAMESPACE set or the system default cursor should take effect. \a window is a pointer to the window currently displayed at QCursor::pos(). Note - that this may be 0 if the current position is not occupied by a displayed widget. + that this may be \nullptr if the current position is not occupied by a displayed widget. \sa QCursor::pos() */ diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 3040a20308..1cc2435239 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -688,7 +688,8 @@ QWindow *QWindow::parent() const Sets the \a parent Window. This will lead to the windowing system managing the clip of the window, so it will be clipped to the \a parent window. - Setting \a parent to be 0 will make the window become a top level window. + Setting \a parent to be \nullptr will make the window become a top level + window. If \a parent is a window created by fromWinId(), then the current window will be embedded inside \a parent, if the platform supports it. diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index c517198a23..8bdce4af8b 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -5552,8 +5552,8 @@ bool QGraphicsScene::focusNextPrevChild(bool next) is a pointer to the item that gained input focus, or \nullptr if focus was lost. \a reason is the reason for the focus change (e.g., if the scene was deactivated while an input field had focus, \a oldFocusItem would point - to the input field item, \a newFocusItem would be 0, and \a reason would be - Qt::ActiveWindowFocusReason. + to the input field item, \a newFocusItem would be \nullptr, and \a reason + would be Qt::ActiveWindowFocusReason. */ /*! diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index cf0f3f153b..f81cb471fa 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -482,8 +482,8 @@ bool QTipLabel::tipChanged(const QPoint &pos, const QString &text, QObject *o) The \a rect is in the coordinates of the widget you specify with \a w. If the \a rect is not empty you must specify a widget. - Otherwise this argument can be 0 but it is used to determine the - appropriate screen on multi-head systems. + Otherwise this argument can be \nullptr but it is used to + determine the appropriate screen on multi-head systems. If \a text is empty the tool tip is hidden. If the text is the same as the currently shown tooltip, the tip will \e not move. diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 6a5f80f1ff..b71a0ed052 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1009,8 +1009,8 @@ struct QWidgetExceptionCleaner deleted. The widget flags argument, \a f, is normally 0, but it can be set - to customize the frame of a window (i.e. \a - parent must be 0). To customize the frame, use a value composed + to customize the frame of a window (i.e. \a parent must be + \nullptr). To customize the frame, use a value composed from the bitwise OR of any of the \l{Qt::WindowFlags}{window flags}. If you add a child widget to an already visible widget you must @@ -4232,7 +4232,7 @@ void QWidget::setFixedHeight(int h) /*! Translates the widget coordinate \a pos to the coordinate system - of \a parent. The \a parent must not be 0 and must be a parent + of \a parent. The \a parent must not be \nullptr and must be a parent of the calling widget. \sa mapFrom(), mapToParent(), mapToGlobal(), underMouse() @@ -4257,7 +4257,7 @@ QPoint QWidget::mapTo(const QWidget * parent, const QPoint & pos) const /*! Translates the widget coordinate \a pos from the coordinate system of \a parent to this widget's coordinate system. The \a parent - must not be 0 and must be a parent of the calling widget. + must not be \nullptr and must be a parent of the calling widget. \sa mapTo(), mapFromParent(), mapFromGlobal(), underMouse() */ diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 6a35dbe274..6edefaa311 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -688,7 +688,7 @@ QLineEdit *QAbstractSpinBox::lineEdit() const \fn void QAbstractSpinBox::setLineEdit(QLineEdit *lineEdit) Sets the line edit of the spinbox to be \a lineEdit instead of the - current line edit widget. \a lineEdit cannot be 0. + current line edit widget. \a lineEdit cannot be \nullptr. QAbstractSpinBox takes ownership of the new lineEdit diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index a24c9d350f..e38e1d7750 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -2034,7 +2034,7 @@ QAbstractItemModel *QComboBox::model() const } /*! - Sets the model to be \a model. \a model must not be 0. + Sets the model to be \a model. \a model must not be \nullptr. If you want to clear the contents of a model, call clear(). \sa clear() -- cgit v1.2.3 From eb25acc05b177c49eb81b190a476854fbf3c6fb1 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Mon, 11 Mar 2019 13:37:29 +0100 Subject: Improve project files of libfuzzer tests Change-Id: I7977beb1bbc142326a3cc48435b91ec7293e2cff Reviewed-by: Edward Welbourne --- tests/libfuzzer/README | 4 +++- .../serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro | 4 ++-- tests/libfuzzer/gui/text/qtextdocument/setHtml/setHtml.pro | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/libfuzzer/README b/tests/libfuzzer/README index ed668ff9e2..7327e76eff 100644 --- a/tests/libfuzzer/README +++ b/tests/libfuzzer/README @@ -12,7 +12,9 @@ data which triggered the crash. You can then use this to debug and fix the calle To run a test with libFuzzer: -1. Install libFuzzer, e.g. from the repositories of the Linux distribution you are using. +1. Install clang 5.0 or later, e.g. from the repositories of the Linux distribution you are using. + Depending on the version of clang and the source you are installing from, you might have to + install libFuzzer for this version of clang explicitly. 2. Make sure clang and clang++ from this version of clang are found in PATH. 3. Configure Qt with -platform linux-clang -coverage trace-pc-guard diff --git a/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro b/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro index 8c890f5b6e..2fda3ecefd 100644 --- a/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro +++ b/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro @@ -1,5 +1,5 @@ QT -= gui -CONFIG += c++11 console +CONFIG += console CONFIG -= app_bundle SOURCES += main.cpp -LIBS += -lFuzzer +LIBS += -fsanitize=fuzzer diff --git a/tests/libfuzzer/gui/text/qtextdocument/setHtml/setHtml.pro b/tests/libfuzzer/gui/text/qtextdocument/setHtml/setHtml.pro index 2602f16dc7..c9b14f6caf 100644 --- a/tests/libfuzzer/gui/text/qtextdocument/setHtml/setHtml.pro +++ b/tests/libfuzzer/gui/text/qtextdocument/setHtml/setHtml.pro @@ -1,4 +1,3 @@ QT += widgets -CONFIG += c++11 SOURCES += main.cpp -LIBS += -lFuzzer +LIBS += -fsanitize=fuzzer -- cgit v1.2.3