From eb2b635154c5b57f80abebd50e2ec344de0b8be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Thu, 10 Aug 2017 11:22:42 +0200 Subject: Check for loopback address if network access is unavailable A loopback address warrants the same exception as local files. Task-number: QTBUG-59219 Change-Id: Ie0a75faa558d6596455da38656c8749c994d0fd8 Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/network/access/qnetworkaccessmanager.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index d57acc2f6b..057821fa3f 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -71,6 +71,8 @@ #include "qthread.h" +#include + QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNetworkAccessFileBackendFactory, fileBackend) @@ -1324,10 +1326,16 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera } #ifndef QT_NO_BEARERMANAGEMENT + // Return a disabled network reply if network access is disabled. - // Except if the scheme is empty or file://. + // Except if the scheme is empty or file:// or if the host resolves to a loopback address. if (d->networkAccessible == NotAccessible && !isLocalFile) { - return new QDisabledNetworkReply(this, req, op); + QHostAddress dest; + QString host = req.url().host().toLower(); + if (!(dest.setAddress(host) && dest.isLoopback()) && host != QLatin1String("localhost") + && host != QHostInfo::localHostName().toLower()) { + return new QDisabledNetworkReply(this, req, op); + } } if (!d->networkSessionStrongRef && (d->initializeSession || !d->networkConfiguration.identifier().isEmpty())) { -- cgit v1.2.3 From bad6b8e400a5787acdfd3185e9d546d65618b9d7 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Tue, 1 Aug 2017 16:24:10 +0200 Subject: Propagate all module defines to CMake config files So far this only covered the QT_xxx_LIB define, but not any other defines a module might export (such as QT_NO_QML_DEBUGGER which hasn't been ported to the new configure system yet). Change-Id: I8aae2354fed77a6f0e527ad8d63d25654bb067d0 Reviewed-by: Ulf Hermann Reviewed-by: Kevin Funk Reviewed-by: Oswald Buddenhagen --- mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in index 17da8b979e..55c74aad66 100644 --- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in @@ -156,7 +156,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS}) set(Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS -D$${MODULE_DEFINE}) - set(Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS $${MODULE_DEFINE}) + set(Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS $${MODULE_DEFINES}) !!ENDIF // TEMPLATE != aux set(_Qt5$${CMAKE_MODULE_NAME}_MODULE_DEPENDENCIES \"$${CMAKE_MODULE_DEPS}\") @@ -243,7 +243,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS}) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY - INTERFACE_COMPILE_DEFINITIONS $${MODULE_DEFINE}) + INTERFACE_COMPILE_DEFINITIONS $${MODULE_DEFINES}) set(_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIRS_EXIST TRUE) foreach (_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIR ${Qt5$${CMAKE_MODULE_NAME}_OWN_PRIVATE_INCLUDE_DIRS}) -- cgit v1.2.3 From 5c21c3c23a0fb4c0a1752810e847d863be3e0a8a Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 15 Aug 2017 11:23:11 +0700 Subject: QMenu: Prevent torn-off menus from extending behind the taskbar On Windows and macOS, that area of the menu can become inaccessible if the menu is tall enough. Since these are not popups but tool windows, the test for UseFullScreenForPopupMenu should not apply for torn-off menus. Change-Id: Ife7836bef568896a5bb67d42a2af412f06a871d6 Reviewed-by: Shawn Rutledge --- src/widgets/widgets/qmenu.cpp | 22 ++++++++++++---------- src/widgets/widgets/qmenu_p.h | 4 ++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 46525b6124..9b2856a728 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -263,20 +263,23 @@ int QMenuPrivate::scrollerHeight() const } //Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't -QRect QMenuPrivate::popupGeometry(const QWidget *widget) const +QRect QMenuPrivate::popupGeometry() const { - if (QGuiApplicationPrivate::platformTheme() && + Q_Q(const QMenu); + if (!tornoff && // Torn-off menus are different + QGuiApplicationPrivate::platformTheme() && QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()) { - return QApplication::desktop()->screenGeometry(widget); + return QApplication::desktop()->screenGeometry(q); } else { - return QApplication::desktop()->availableGeometry(widget); + return QApplication::desktop()->availableGeometry(q); } } //Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't QRect QMenuPrivate::popupGeometry(int screen) const { - if (QGuiApplicationPrivate::platformTheme() && + if (!tornoff && // Torn-off menus are different + QGuiApplicationPrivate::platformTheme() && QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()) { return QApplication::desktop()->screenGeometry(screen); } else { @@ -301,8 +304,7 @@ QVector > QMenuPrivate::calcCausedStack() const void QMenuPrivate::updateActionRects() const { - Q_Q(const QMenu); - updateActionRects(popupGeometry(q)); + updateActionRects(popupGeometry()); } void QMenuPrivate::updateActionRects(const QRect &screen) const @@ -1069,7 +1071,7 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc if (newScrollFlags & QMenuScroller::ScrollUp) newOffset -= vmargin; - QRect screen = popupGeometry(q); + QRect screen = popupGeometry(); const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q); if (q->height() < screen.height()-(desktopFrame*2)-1) { QRect geom = q->geometry(); @@ -2322,7 +2324,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) #if QT_CONFIG(graphicsview) bool isEmbedded = !bypassGraphicsProxyWidget(this) && d->nearestGraphicsProxyWidget(this); if (isEmbedded) - screen = d->popupGeometry(this); + screen = d->popupGeometry(); else #endif screen = d->popupGeometry(QApplication::desktop()->screenNumber(p)); @@ -3592,7 +3594,7 @@ void QMenu::internalDelayedPopup() #if QT_CONFIG(graphicsview) bool isEmbedded = !bypassGraphicsProxyWidget(this) && d->nearestGraphicsProxyWidget(this); if (isEmbedded) - screen = d->popupGeometry(this); + screen = d->popupGeometry(); else #endif screen = d->popupGeometry(QApplication::desktop()->screenNumber(pos())); diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 2f04fac3c0..785a9db308 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -316,8 +316,8 @@ public: mutable QHash widgetItems; void updateActionRects() const; void updateActionRects(const QRect &screen) const; - QRect popupGeometry(const QWidget *widget) const; - QRect popupGeometry(int screen = -1) const; + QRect popupGeometry() const; + QRect popupGeometry(int screen) const; mutable uint ncols : 4; //4 bits is probably plenty uint collapsibleSeparators : 1; uint toolTipsVisible : 1; -- cgit v1.2.3 From f9f5b35e7321fded3fdd887fce656475c3d83f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Wed, 16 Aug 2017 09:57:45 +0300 Subject: Blacklist tst_QFont::DefaultFamily in B2Qt Task-number: QTBUG-62528 Change-Id: Iadf9a923b2a624c5082fd1bd61691f8100178f94 Reviewed-by: Sami Nurmenniemi Reviewed-by: Simon Hausmann --- tests/auto/gui/text/qfont/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/gui/text/qfont/BLACKLIST b/tests/auto/gui/text/qfont/BLACKLIST index 8890ec1ef3..295c61ff12 100644 --- a/tests/auto/gui/text/qfont/BLACKLIST +++ b/tests/auto/gui/text/qfont/BLACKLIST @@ -2,3 +2,5 @@ # QTBUG-46054 opensuse-13.1 opensuse-42.1 +[defaultFamily] +b2qt -- cgit v1.2.3 From a26a3cfbc7cd5c87afeda63eb324a2ba2a4c8192 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 16 Aug 2017 13:20:33 +0200 Subject: macOS: Fix matching of font weights for application fonts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5ad2e1cea1b2c08950c91174840f542806954d99 exposed a latent bug when matching font weights that do not exactly match any of the canonical weights in the system . It seems that when we registered the font with FontManager, it would modify the font weight to match a system weight, while we now get raw values from the font instead. So for Roboto Medium, for instance, we would now get 0.2 instead of 0.23, and since our conversion logic would convert everything between Light (-0.4) to Medium (0.23) to QFont::Normal, we would regard this as normal weight instead of medium. But on a linear scale, it makes more sense to match to the closest canonical weight instead of requiring exact matches. Note that the definition says that the middle between two weights should tend upwards, therefore we do the comparisons in decreasing order. [ChangeLog][QtGui][Text] Fixed matching of non-regular font weights for application fonts on macOS. Task-number: QTBUG-61520 Change-Id: Ieda4927c2c69ec72125257340cf06c683b031d05 Reviewed-by: Tor Arne Vestbø --- .../fontdatabases/mac/qfontengine_coretext.mm | 45 +++++++++++++--------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 49a6049c4b..66baf162d9 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -112,25 +112,32 @@ bool QCoreTextFontEngine::ct_getSfntTable(void *user_data, uint tag, uchar *buff QFont::Weight QCoreTextFontEngine::qtWeightFromCFWeight(float value) { - if (value >= kCTFontWeightBlack) - return QFont::Black; - if (value >= kCTFontWeightHeavy) - return QFont::ExtraBold; - if (value >= kCTFontWeightBold) - return QFont::Bold; - if (value >= kCTFontWeightSemibold) - return QFont::DemiBold; - if (value >= kCTFontWeightMedium) - return QFont::Medium; - if (value == kCTFontWeightRegular) - return QFont::Normal; - if (value <= kCTFontWeightUltraLight) - return QFont::Thin; - if (value <= kCTFontWeightThin) - return QFont::ExtraLight; - if (value <= kCTFontWeightLight) - return QFont::Light; - return QFont::Normal; +#define COMPARE_WEIGHT_DISTANCE(ct_weight, qt_weight) \ + { \ + float d; \ + if ((d = qAbs(value - ct_weight)) < distance) { \ + distance = d; \ + ret = qt_weight; \ + } \ + } + + float distance = qAbs(value - kCTFontWeightBlack); + QFont::Weight ret = QFont::Black; + + // Compare distance to system weight to find the closest match. + // (Note: Must go from high to low, so that midpoints are rounded up) + COMPARE_WEIGHT_DISTANCE(kCTFontWeightHeavy, QFont::ExtraBold); + COMPARE_WEIGHT_DISTANCE(kCTFontWeightBold, QFont::Bold); + COMPARE_WEIGHT_DISTANCE(kCTFontWeightSemibold, QFont::DemiBold); + COMPARE_WEIGHT_DISTANCE(kCTFontWeightMedium, QFont::Medium); + COMPARE_WEIGHT_DISTANCE(kCTFontWeightRegular, QFont::Normal); + COMPARE_WEIGHT_DISTANCE(kCTFontWeightLight, QFont::Light); + COMPARE_WEIGHT_DISTANCE(kCTFontWeightThin, QFont::ExtraLight); + COMPARE_WEIGHT_DISTANCE(kCTFontWeightUltraLight, QFont::Thin); + +#undef COMPARE_WEIGHT_DISTANCE + + return ret; } static void loadAdvancesForGlyphs(CTFontRef ctfont, -- cgit v1.2.3 From a3d59c7c7f675b0a4e128efeb781aa1c2f7db4c0 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 15 Aug 2017 10:29:16 +0200 Subject: Block input to a window shown while an application modal dialog is visible Although the window is refused input for the most part from the system, it does not act like that it is blocked by the application modal dialog. This ensures that it is the case and prevents things like being able to double click on the title bar to maximize the window on Windows. Task-number: QTBUG-49102 Change-Id: If1582819b90cb2ec9d891f664da24f13bfec7103 Reviewed-by: Paul Olav Tvete --- src/gui/kernel/qwindow.cpp | 2 ++ tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 42 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index cf4a75dfce..eb9d7a8868 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -576,6 +576,8 @@ void QWindow::setVisible(bool visible) QGuiApplicationPrivate::showModalWindow(this); else QGuiApplicationPrivate::hideModalWindow(this); + } else if (visible && QGuiApplication::modalWindow()) { + QGuiApplicationPrivate::updateBlockedStatus(this); } #ifndef QT_NO_CURSOR diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 92f7182249..e1366ce2eb 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -105,6 +105,7 @@ private slots: void stateChange(); void flags(); void cleanup(); + void testBlockingWindowShownAfterModalDialog(); private: QPoint m_availableTopLeft; @@ -2241,6 +2242,47 @@ void tst_QWindow::flags() QCOMPARE(window.flags(), baseFlags | Qt::WindowStaysOnTopHint); } +class EventWindow : public QWindow +{ +public: + EventWindow() : QWindow(), gotBlocked(false) {} + bool gotBlocked; +protected: + bool event(QEvent *e) + { + if (e->type() == QEvent::WindowBlocked) + gotBlocked = true; + return QWindow::event(e); + } +}; + +void tst_QWindow::testBlockingWindowShownAfterModalDialog() +{ + EventWindow normalWindow; + normalWindow.setFramePosition(m_availableTopLeft + QPoint(80, 80)); + normalWindow.resize(m_testWindowSize); + normalWindow.show(); + QVERIFY(QTest::qWaitForWindowExposed(&normalWindow)); + QVERIFY(!normalWindow.gotBlocked); + + QWindow dialog; + dialog.setFramePosition(m_availableTopLeft + QPoint(200, 200)); + dialog.resize(m_testWindowSize); + dialog.setModality(Qt::ApplicationModal); + dialog.setFlags(Qt::Dialog); + dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&dialog)); + QVERIFY(normalWindow.gotBlocked); + + EventWindow normalWindowAfter; + normalWindowAfter.setFramePosition(m_availableTopLeft + QPoint(80, 80)); + normalWindowAfter.resize(m_testWindowSize); + QVERIFY(!normalWindowAfter.gotBlocked); + normalWindowAfter.show(); + QVERIFY(QTest::qWaitForWindowExposed(&normalWindowAfter)); + QVERIFY(normalWindowAfter.gotBlocked); +} + #include QTEST_MAIN(tst_QWindow) -- cgit v1.2.3 From baf1158c48c3342f4e90d83c3b93236535aac285 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 13 Jul 2017 15:49:20 +0200 Subject: Doc: Mark the dbmsType() function and DbmsType enum as internal The function and type is only used in the tests and has no benefit in applications so it should be marked as internal to avoid confusion for those implementing their own drivers. Task-number: QTBUG-56278 Change-Id: I0f2ae27d41b133c4f0d3b0d390688fd3307592ce Reviewed-by: Andre Somers Reviewed-by: Venugopal Shivashankar Reviewed-by: Andy Shaw --- src/sql/kernel/qsqldriver.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp index bf98f82087..6fe5b351dc 100644 --- a/src/sql/kernel/qsqldriver.cpp +++ b/src/sql/kernel/qsqldriver.cpp @@ -246,6 +246,7 @@ bool QSqlDriver::isOpenError() const /*! \enum QSqlDriver::DbmsType + \internal This enum contains DBMS types. @@ -807,6 +808,7 @@ QSql::NumericalPrecisionPolicy QSqlDriver::numericalPrecisionPolicy() const /*! \since 5.4 + \internal Returns the current DBMS type for the database connection. */ -- cgit v1.2.3 From cdc79f5ebc0ec1898e3845acb9c880b5e69e593b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 11 Aug 2017 12:01:12 -0700 Subject: XCB: Don't core-dump if we can't connect to the X displayName Exit with error, but don't crash. Change-Id: Ie05c6480d8a44fda817ffffd14d9dfd8c951beef Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/xcb/qxcbconnection.cpp | 20 ++++++++++++++------ src/plugins/platforms/xcb/qxcbconnection.h | 1 + src/plugins/platforms/xcb/qxcbintegration.cpp | 17 +++++++++++++++-- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index e167ba1231..d36a14b920 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -571,9 +571,10 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra m_connection = xcb_connect(m_displayName.constData(), &m_primaryScreenNumber); #endif // QT_CONFIG(xcb_xlib) - if (Q_UNLIKELY(!m_connection || xcb_connection_has_error(m_connection))) - qFatal("QXcbConnection: Could not connect to display %s", m_displayName.constData()); - + if (Q_UNLIKELY(!m_connection || xcb_connection_has_error(m_connection))) { + qCWarning(lcQpaScreen, "QXcbConnection: Could not connect to display %s", m_displayName.constData()); + return; + } m_reader = new QXcbEventReader(this); m_reader->start(); @@ -668,7 +669,7 @@ QXcbConnection::~QXcbConnection() finalizeXInput2(); #endif - if (m_reader->isRunning()) { + if (m_reader && m_reader->isRunning()) { sendConnectionEvent(QXcbAtom::_QT_CLOSE_CONNECTION); m_reader->wait(); } @@ -685,15 +686,22 @@ QXcbConnection::~QXcbConnection() delete m_glIntegration; + if (isConnected()) { #if QT_CONFIG(xcb_xlib) - XCloseDisplay(static_cast(m_xlib_display)); + XCloseDisplay(static_cast(m_xlib_display)); #else - xcb_disconnect(xcb_connection()); + xcb_disconnect(xcb_connection()); #endif + } delete m_keyboard; } +bool QXcbConnection::isConnected() const +{ + return m_connection && !xcb_connection_has_error(m_connection); +} + QXcbScreen *QXcbConnection::primaryScreen() const { if (!m_screens.isEmpty()) { diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 1129090eca..edbc8d846e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -388,6 +388,7 @@ public: ~QXcbConnection(); QXcbConnection *connection() const { return const_cast(this); } + bool isConnected() const; const QList &virtualDesktops() const { return m_virtualDesktops; } const QList &screens() const { return m_screens; } diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index b372ecd7c4..c9ecdceb0d 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -178,12 +178,25 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char const int numParameters = parameters.size(); m_connections.reserve(1 + numParameters / 2); - m_connections << new QXcbConnection(m_nativeInterface.data(), m_canGrab, m_defaultVisualId, displayName); + auto conn = new QXcbConnection(m_nativeInterface.data(), m_canGrab, m_defaultVisualId, displayName); + if (conn->isConnected()) + m_connections << conn; + else + delete conn; for (int i = 0; i < numParameters - 1; i += 2) { qCDebug(lcQpaScreen) << "connecting to additional display: " << parameters.at(i) << parameters.at(i+1); QString display = parameters.at(i) + QLatin1Char(':') + parameters.at(i+1); - m_connections << new QXcbConnection(m_nativeInterface.data(), m_canGrab, m_defaultVisualId, display.toLatin1().constData()); + conn = new QXcbConnection(m_nativeInterface.data(), m_canGrab, m_defaultVisualId, display.toLatin1().constData()); + if (conn->isConnected()) + m_connections << conn; + else + delete conn; + } + + if (m_connections.isEmpty()) { + qCritical("Could not connect to any X display."); + exit(1); } m_fontDatabase.reset(new QGenericUnixFontDatabase()); -- cgit v1.2.3 From d7db2b43596b9a51017546eb1c6e2c4e30a0041e Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 19 Jul 2017 16:21:36 +0200 Subject: QPicture: check that pictureFormat doesn't return dangling pointers The function returns a const char * out of a QByteArray. We must be sure that the QByteArray outlives the function, otherwise the pointer returned would be dangling. Add an assertion for that. Found by clazy. Change-Id: I3416af4eb5ec79ddb3e4baf3bdcfe046b44d4225 Reviewed-by: Eirik Aavitsland --- src/gui/image/qpicture.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index 7506e2e1a9..010f5ecf67 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -1206,7 +1206,12 @@ QT_END_INCLUDE_NAMESPACE const char* QPicture::pictureFormat(const QString &fileName) { - return QPictureIO::pictureFormat(fileName); + const QByteArray format = QPictureIO::pictureFormat(fileName); + // This function returns a const char * from a QByteArray. + // Double check that the QByteArray is not detached, otherwise + // we would return a dangling pointer. + Q_ASSERT(!format.isDetached()); + return format; } /*! -- cgit v1.2.3 From b9557296cb988c6007ed17f182a03c8205d5dffc Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 7 Aug 2017 12:49:59 +0200 Subject: Fix crash when reading a PKCS12 file with no private key The only reason our code wants PKCS12 files is for a private key, but a valid file needn't contain one; and reading a file without lead to a crash in QSslKeyPrivate::fromEVP_PKEY(). So check for missing key and fail the load, since the file is useless to us. Also ensure the caller's pkey is initialized, as we aren't promised that PKCS12_parse() will set it when there is no private key. Add a test for this case (it crashes without the fix) and update the instructions for how to generate test data to cover it also. (Corrected the wording there, too; at the interactive prompt, "providing no password" really provides an empty password.) Task-number: QTBUG-62335 Change-Id: I617508b903f6d9dee40d539b7136b0be8bc2c747 Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslkey_openssl.cpp | 3 +++ src/network/ssl/qsslsocket_openssl.cpp | 2 +- .../auto/network/ssl/qsslcertificate/pkcs12/README | 21 ++++++++++++++++----- .../ssl/qsslcertificate/pkcs12/leaf-nokey.p12 | Bin 0 -> 2216 bytes .../ssl/qsslcertificate/tst_qsslcertificate.cpp | 10 ++++++++++ 5 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 tests/auto/network/ssl/qsslcertificate/pkcs12/leaf-nokey.p12 diff --git a/src/network/ssl/qsslkey_openssl.cpp b/src/network/ssl/qsslkey_openssl.cpp index 79df33ecca..26119023d1 100644 --- a/src/network/ssl/qsslkey_openssl.cpp +++ b/src/network/ssl/qsslkey_openssl.cpp @@ -84,6 +84,9 @@ void QSslKeyPrivate::clear(bool deep) bool QSslKeyPrivate::fromEVP_PKEY(EVP_PKEY *pkey) { + if (pkey == nullptr) + return false; + if (pkey->type == EVP_PKEY_RSA) { isNull = false; algorithm = QSsl::Rsa; diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 644dfdb6a8..ab82cdcfc9 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1805,7 +1805,7 @@ bool QSslSocketBackendPrivate::importPkcs12(QIODevice *device, } // Extract the data - EVP_PKEY *pkey; + EVP_PKEY *pkey = nullptr; X509 *x509; STACK_OF(X509) *ca = 0; diff --git a/tests/auto/network/ssl/qsslcertificate/pkcs12/README b/tests/auto/network/ssl/qsslcertificate/pkcs12/README index 1828d089c1..231567f586 100644 --- a/tests/auto/network/ssl/qsslcertificate/pkcs12/README +++ b/tests/auto/network/ssl/qsslcertificate/pkcs12/README @@ -1,8 +1,19 @@ -The PKCS#12 bundle was created by running the following on -in the qsslsocket/certs directory: +The PKCS#12 bundle was created by running the following in an +interactive shell in ../../qsslsocket/certs/: -openssl pkcs12 -export -in leaf.crt -inkey leaf.key \ - -out leaf.p12 \ +openssl pkcs12 -export -in leaf.crt \ + -inkey leaf.key -out leaf.p12 \ -certfile inter.crt -CAfile ca.crt -No password was provided. +An empty password was provided (twice). The pkcs.crt and pkcs.key +files were then copied here and leaf.p12 was moved here. + + +The test-case with no private key (in a valid PKCS12 file) was created +similarly but with the command adjusted to: + +openssl pkcs12 -export -in leaf.crt \ + -nokeys -out leaf-nokey.p12 \ + -certfile inter.crt -CAfile ca.crt + +The file leaf-nokey.p12 was then moved here. diff --git a/tests/auto/network/ssl/qsslcertificate/pkcs12/leaf-nokey.p12 b/tests/auto/network/ssl/qsslcertificate/pkcs12/leaf-nokey.p12 new file mode 100644 index 0000000000..032bf97b1b Binary files /dev/null and b/tests/auto/network/ssl/qsslcertificate/pkcs12/leaf-nokey.p12 differ diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp index fced638ecb..064efc120b 100644 --- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp @@ -1308,6 +1308,7 @@ void tst_QSslCertificate::version() void tst_QSslCertificate::pkcs12() { + // See pkcs12/README for how to generate the PKCS12 files used here. if (!QSslSocket::supportsSsl()) { qWarning("SSL not supported, skipping test"); return; @@ -1349,6 +1350,15 @@ void tst_QSslCertificate::pkcs12() QVERIFY(!caCerts.isEmpty()); QCOMPARE(caCerts.first(), caCert.first()); QCOMPARE(caCerts, caCert); + + // QTBUG-62335 - Fail (found no private key) but don't crash: + QFile nocert(testDataDir + QLatin1String("/pkcs12/leaf-nokey.p12")); + ok = nocert.open(QIODevice::ReadOnly); + QVERIFY(ok); + QTest::ignoreMessage(QtWarningMsg, "Unable to convert private key"); + ok = QSslCertificate::importPkcs12(&nocert, &key, &cert, &caCerts); + QVERIFY(!ok); + nocert.close(); } #endif // QT_NO_SSL -- cgit v1.2.3 From 39852ce60f4de4c454b4bf19ef87bbcdad0aa76c Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 16 Aug 2017 12:57:48 +0300 Subject: Android: Fix warning for __fp16 Change-Id: I65cd64dfc0ed357555e8b5276109303377a67e0e Reviewed-by: Thiago Macieira --- src/corelib/global/qfloat16.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h index 054d503249..89a62a93db 100644 --- a/src/corelib/global/qfloat16.h +++ b/src/corelib/global/qfloat16.h @@ -141,7 +141,7 @@ inline qfloat16::operator float() const Q_DECL_NOTHROW #elif defined (__ARM_FP16_FORMAT_IEEE) __fp16 f16; memcpy(&f16, &b16, sizeof(quint16)); - return f16; + return float(f16); #else quint32 u = mantissatable[offsettable[b16 >> 10] + (b16 & 0x3ff)] + exponenttable[b16 >> 10]; -- cgit v1.2.3 From b525ec2eb0bb441ac0dcd0a055efcad08fe6957c Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 17 Aug 2017 09:31:19 +0300 Subject: Android: Fix compile with unified headers Unified headers now defines _POSIX_THREAD_SAFE_FUNCTIONS but not all libc functions are available in all Android API versions. Change-Id: I01c94f0b89e7f8aa8575e7bbda28d9fe41a68ff1 Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 74 +++++++++++++-------------- src/corelib/io/qfilesystemengine_unix.cpp | 2 +- src/corelib/io/qfilesystemwatcher_inotify.cpp | 10 +++- src/corelib/thread/qthread_unix.cpp | 2 +- 4 files changed, 48 insertions(+), 40 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 12e908f09f..a9664e7564 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -3344,7 +3344,11 @@ bool qunsetenv(const char *varName) #endif } -#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) +#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21) +typedef QThreadStorage AndroidRandomStorage; +Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS) + +#elif defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) # if defined(Q_OS_INTEGRITY) && defined(__GHS_VERSION_NUMBER) && (__GHS_VERSION_NUMBER < 500) // older versions of INTEGRITY used a long instead of a uint for the seed. @@ -3355,10 +3359,6 @@ typedef uint SeedStorageType; typedef QThreadStorage SeedStorage; Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value - -#elif defined(Q_OS_ANDROID) -typedef QThreadStorage AndroidRandomStorage; -Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS) #endif /*! @@ -3378,21 +3378,7 @@ Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS) */ void qsrand(uint seed) { -#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) - SeedStorage *seedStorage = randTLS(); - if (seedStorage) { - SeedStorageType *pseed = seedStorage->localData(); - if (!pseed) - seedStorage->setLocalData(pseed = new SeedStorageType); - *pseed = seed; - } else { - //global static seed storage should always exist, - //except after being deleted by QGlobalStaticDeleter. - //But since it still can be called from destructor of another - //global static object, fallback to srand(seed) - srand(seed); - } -#elif defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21) if (randomTLS->hasLocalData()) { randomTLS->localData().callMethod("setSeed", "(J)V", jlong(seed)); return; @@ -3407,6 +3393,20 @@ void qsrand(uint seed) } randomTLS->setLocalData(random); +#elif defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) + SeedStorage *seedStorage = randTLS(); + if (seedStorage) { + SeedStorageType *pseed = seedStorage->localData(); + if (!pseed) + seedStorage->setLocalData(pseed = new SeedStorageType); + *pseed = seed; + } else { + //global static seed storage should always exist, + //except after being deleted by QGlobalStaticDeleter. + //But since it still can be called from destructor of another + //global static object, fallback to srand(seed) + srand(seed); + } #else // On Windows srand() and rand() already use Thread-Local-Storage // to store the seed between calls @@ -3432,23 +3432,7 @@ void qsrand(uint seed) */ int qrand() { -#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) - SeedStorage *seedStorage = randTLS(); - if (seedStorage) { - SeedStorageType *pseed = seedStorage->localData(); - if (!pseed) { - seedStorage->setLocalData(pseed = new SeedStorageType); - *pseed = 1; - } - return rand_r(pseed); - } else { - //global static seed storage should always exist, - //except after being deleted by QGlobalStaticDeleter. - //But since it still can be called from destructor of another - //global static object, fallback to rand() - return rand(); - } -#elif defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21) AndroidRandomStorage *randomStorage = randomTLS(); if (!randomStorage) return rand(); @@ -3468,6 +3452,22 @@ int qrand() randomStorage->setLocalData(random); return random.callMethod("nextInt", "(I)I", RAND_MAX); +#elif defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) + SeedStorage *seedStorage = randTLS(); + if (seedStorage) { + SeedStorageType *pseed = seedStorage->localData(); + if (!pseed) { + seedStorage->setLocalData(pseed = new SeedStorageType); + *pseed = 1; + } + return rand_r(pseed); + } else { + //global static seed storage should always exist, + //except after being deleted by QGlobalStaticDeleter. + //But since it still can be called from destructor of another + //global static object, fallback to rand() + return rand(); + } #else // On Windows srand() and rand() already use Thread-Local-Storage // to store the seed between calls diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 6640e2b7e7..ac0c43d055 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -398,7 +398,7 @@ QString QFileSystemEngine::resolveGroupName(uint groupId) #if !defined(Q_OS_INTEGRITY) struct group *gr = 0; -#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID) && (__ANDROID_API__ >= 24)) size_max = sysconf(_SC_GETGR_R_SIZE_MAX); if (size_max == -1) size_max = 1024; diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index 3cfc6a254f..048669b92f 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -222,6 +222,14 @@ QT_END_NAMESPACE #include +// see https://github.com/android-ndk/ndk/issues/394 +# if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21) +static inline int inotify_init1(int flags) +{ + return syscall(__NR_inotify_init1, flags); +} +# endif + #endif QT_BEGIN_NAMESPACE @@ -229,7 +237,7 @@ QT_BEGIN_NAMESPACE QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create(QObject *parent) { int fd = -1; -#ifdef IN_CLOEXEC +#if defined(IN_CLOEXEC) fd = inotify_init1(IN_CLOEXEC); #endif if (fd == -1) { diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index f359d25a73..69a11b2b62 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -101,7 +101,7 @@ # define SCHED_IDLE 5 #endif -#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) +#if defined(Q_OS_DARWIN) || !defined(Q_OS_ANDROID) && !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) #define QT_HAS_THREAD_PRIORITY_SCHEDULING #endif -- cgit v1.2.3 From 0027d73b0283d01bbe718df8865ce8b0ca794780 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 17 Aug 2017 09:32:44 +0300 Subject: Android: Dissable internal hack when using libc++ libc++ has proper wstring support Change-Id: Ifae98676974bfd660b7f849d4466efc5486d3fca Reviewed-by: Thiago Macieira --- src/corelib/tools/qstring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 88ba4a3fb5..8f957a7b22 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -53,7 +53,7 @@ #include #include -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(ANDROID_HAS_WSTRING) // std::wstring is disabled on android's glibc, as bionic lacks certain features // that libstdc++ checks for (like mbcslen). namespace std -- cgit v1.2.3 From 1cd91a0ee58a653e7543dc01988d92adc89d3116 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 17 Aug 2017 09:31:43 +0300 Subject: Android: Fix compile using ndkr15 clang and unified headers Add missing includes Change-Id: I6fd58c9ebb5a8099c99928e3a7a0cbf3aa23ba43 Reviewed-by: Thiago Macieira --- src/plugins/platforms/android/androidjniinput.cpp | 1 + src/plugins/platforms/android/extract.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index f19b7d5484..dc55ccd615 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -50,6 +50,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/android/extract.cpp b/src/plugins/platforms/android/extract.cpp index e6636e37d4..2f2ffa7126 100644 --- a/src/plugins/platforms/android/extract.cpp +++ b/src/plugins/platforms/android/extract.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #define LOG_TAG "extractSyleInfo" #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) -- cgit v1.2.3 From 362466c7d2e12c4587d5de1eb51cd537be9f7e2b Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Thu, 17 Aug 2017 09:16:16 +0300 Subject: QProcess/Unix: fix possible race condition inside waitForXXX() loops Calling QCoreApplication::processEvents() from a slot connected to the readyRead() signal might cause desynchronization in the waitForXXX() loop, if the process has been finished during the event processing. This results in unnecessary timeouts and causes waitForFinished() to fail unexpectedly. So, a proposed solution is to check the state on each iteration of the loop, as Windows implementation does. Given issue is tested by tst_QProcess::processEventsInAReadyReadSlot() which was unstable in CI. Task-number: QTBUG-62584 Change-Id: I7438cf67b0163bbf49314008a9dc660c0977fb7b Reviewed-by: Thiago Macieira --- src/corelib/io/qprocess_unix.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 6b7f187fee..318c633017 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -792,6 +792,10 @@ bool QProcessPrivate::waitForReadyRead(int msecs) if (qt_pollfd_check(poller.stdinPipe(), POLLOUT)) _q_canWrite(); + // Signals triggered by I/O may have stopped this process: + if (processState == QProcess::NotRunning) + return false; + if (qt_pollfd_check(poller.forkfd(), POLLIN)) { if (_q_processDied()) return false; @@ -838,6 +842,10 @@ bool QProcessPrivate::waitForBytesWritten(int msecs) if (qt_pollfd_check(poller.stderrPipe(), POLLIN)) _q_canReadStandardError(); + // Signals triggered by I/O may have stopped this process: + if (processState == QProcess::NotRunning) + return false; + if (qt_pollfd_check(poller.forkfd(), POLLIN)) { if (_q_processDied()) return false; @@ -883,6 +891,10 @@ bool QProcessPrivate::waitForFinished(int msecs) if (qt_pollfd_check(poller.stderrPipe(), POLLIN)) _q_canReadStandardError(); + // Signals triggered by I/O may have stopped this process: + if (processState == QProcess::NotRunning) + return true; + if (qt_pollfd_check(poller.forkfd(), POLLIN)) { if (_q_processDied()) return true; -- cgit v1.2.3 From b5d762ae87e8f3a35a84a6c7d6d324c27d487a8c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 17 Aug 2017 11:31:27 +0200 Subject: macOS: Fix padding around tab label with icon Change c12072c685f7e93d5b84e289ca23106482379eff fixed a problem where tab labels would overlap with the icons if the tab became too small to contain the text. But it did not properly account for the full area occupied by the icon, because the horizontal padding is hardcoded to 4 in the mac style, whereas in the common style (where the icon is drawn) it uses the pixel metric for this. In addition, the change only allocated space on the left side, causing the label to no longer be centered. Task-number: QTBUG-61235 Change-Id: Ieec4f7044584361f92045addbc8bbd81bd5c9fc7 Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qmacstyle_mac.mm | 7 +- tests/manual/qtabbar/main.cpp | 12 ++- tests/manual/qtabbar/tabbarform.ui | 159 +++++++++++++++++++----------------- 3 files changed, 100 insertions(+), 78 deletions(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index b5d1fff5e7..d9eeb2c83b 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1142,7 +1142,12 @@ void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widg tabIconSize.width(), tabIconSize.height()); if (!verticalTabs) *iconRect = proxyStyle->visualRect(opt->direction, opt->rect, *iconRect); - tr.setLeft(tr.left() + tabIconSize.width() + 4); + + int stylePadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2; + stylePadding -= hpadding; + + tr.setLeft(tr.left() + stylePadding + tabIconSize.width() + 4); + tr.setRight(tr.right() - stylePadding - tabIconSize.width() - 4); } if (!verticalTabs) diff --git a/tests/manual/qtabbar/main.cpp b/tests/manual/qtabbar/main.cpp index 466a7e20fc..82bcd838e6 100644 --- a/tests/manual/qtabbar/main.cpp +++ b/tests/manual/qtabbar/main.cpp @@ -103,6 +103,9 @@ int main(int argc, char *argv[]) // right // tabBar.setShape(QTabBar::RoundedEast); + const auto shortLabel = QStringLiteral("Tab %1"); + const auto longLabel = QStringLiteral("An Extremely Long Tab Label %1"); + QMap tabs; for (int i = 0; i < TabCount; i++) { QString tabNumberString = QString::number(i); @@ -110,7 +113,7 @@ int main(int argc, char *argv[]) tabs[i] = label; label->setAlignment(Qt::AlignCenter); stackedWidget.addWidget(label); - tabBar.addTab(QStringLiteral("Tab %1").arg(tabNumberString)); + tabBar.addTab(shortLabel.arg(tabNumberString)); } QObject::connect(&tabBar, &QTabBar::tabMoved, [&tabs](int from, int to) { @@ -205,6 +208,13 @@ int main(int argc, char *argv[]) tabBar.setTabIcon(i, icon); }); + form.ui->longLabelButton->setChecked(false); + QObject::connect(form.ui->longLabelButton, &QCheckBox::toggled, [&] { + const auto &label = form.ui->longLabelButton->isChecked() ? longLabel : shortLabel; + for (int i = 0; i < tabBar.count(); i++) + tabBar.setTabText(i, label.arg(i)); + }); + QObject::connect(form.ui->shapeComboBox, QOverload::of(&QComboBox::currentIndexChanged), [&](int index) { Q_UNUSED(index); // TODO diff --git a/tests/manual/qtabbar/tabbarform.ui b/tests/manual/qtabbar/tabbarform.ui index 17100b3b62..f8766f22f2 100644 --- a/tests/manual/qtabbar/tabbarform.ui +++ b/tests/manual/qtabbar/tabbarform.ui @@ -7,7 +7,7 @@ 0 0 308 - 260 + 308 @@ -22,24 +22,61 @@ - - + + + + false + + + + North + + + + + South + + + + + West + + + + + East + + + + + + + + Qt::Vertical + + + + 20 + 12 + + + + + + - Right aligned + Tab bar options: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - textAlignmentGroup - - - + + - Left aligned + Document mode - - textAlignmentGroup - @@ -49,14 +86,14 @@ - - + + - Tabs alignment: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Left aligned + + textAlignmentGroup + @@ -66,10 +103,13 @@ - - + + - Document mode + Tab shape (TODO): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -80,47 +120,17 @@ - - - - false - - - - North - - - - - South - - - - - West - - - - - East - - - - - - - - Qt::Vertical + + + + Tabs alignment: - - - 20 - 12 - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + - + Qt::Vertical @@ -133,17 +143,14 @@ - - + + - Tab bar options: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Display icon - + Centered @@ -153,20 +160,20 @@ - - + + - Tab shape (TODO): - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Right aligned + + textAlignmentGroup + - - + + - Display icon + Long tab label -- cgit v1.2.3 From 7c4c93a76ae80e2f4223a08e92145ce15645cfa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 16 Aug 2017 10:45:41 +0200 Subject: Avoid dereferencing nullptr Change-Id: Id9558fa1db6a7a8f29149e26c761450f58b74b81 Reviewed-by: Jesus Fernandez Reviewed-by: Edward Welbourne --- src/network/access/qnetworkaccessmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 057821fa3f..4b8c03c5ac 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -691,7 +691,7 @@ void QNetworkAccessManager::setCookieJar(QNetworkCookieJar *cookieJar) if (d->cookieJar && d->cookieJar->parent() == this) delete d->cookieJar; d->cookieJar = cookieJar; - if (thread() == cookieJar->thread()) + if (cookieJar && thread() == cookieJar->thread()) d->cookieJar->setParent(this); } } -- cgit v1.2.3 From 7cbd13b76ae79186848b946bd0cbfe4042fcf4dd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 10 Aug 2017 11:23:22 +0200 Subject: fix configure PSQL_*= being ignored, take 2 amends 09e2fc43ab. Task-number: QTBUG-62402 Change-Id: I63ca700b12646e8be97735b67c1519b0b4625798 Reviewed-by: Lars Knoll --- src/plugins/sqldrivers/configure.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/sqldrivers/configure.pri b/src/plugins/sqldrivers/configure.pri index 9fb957291f..b69b51b679 100644 --- a/src/plugins/sqldrivers/configure.pri +++ b/src/plugins/sqldrivers/configure.pri @@ -37,7 +37,7 @@ defineTest(qtConfLibrary_psqlEnv) { $${1}.libs = $$PSQL_LIBS export($${1}.libs) } else { - !qtConfLibrary_inline($$1): \ + !qtConfLibrary_inline($$1, $$2): \ return(false) } return(true) -- cgit v1.2.3 From 5f7287cfb690d9692d319bd617a5bdd6a2f2f26e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 16 Aug 2017 15:40:25 +0200 Subject: Add MSVC manifest backup file to "clean" target The $${TARGET}_manifest.bak file was not removed on "nmake clean". Task-number: QTBUG-59827 Change-Id: Ia5b636f4917f3e7a2df8d753824b72e63d278005 Reviewed-by: Oswald Buddenhagen --- qmake/generators/win32/msvc_nmake.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index ef1eaf095e..21f96e49d9 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -611,6 +611,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) if (generateManifest) { manifest = escapeFilePath(manifest); QString manifest_bak = escapeFilePath(target + "_manifest.bak"); + project->values("QMAKE_CLEAN") << manifest_bak; t << "\n\tif not exist $(DESTDIR_TARGET) if exist " << manifest << " del " << manifest; t << "\n\tif exist " << manifest << " copy /Y " << manifest << ' ' << manifest_bak; -- cgit v1.2.3 From 73573fce295caef35da706a8c8c796ec18e6baf1 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Fri, 18 Aug 2017 10:19:48 +0200 Subject: Fix huge painting artefact of certain dashed lines The artefacts appeared for square-capped dashed pens when the end of the line fell a tiny fraction into the start of a new dash. At that point in the dashing algorithm, accumulated precision errors in the 'length' variable could make it slightly differ from the actual length between the start and end points of the line fragment. Although both values would be "almost zero", the rasterizeLine() function's square capping would make the error very visible; see the bug report. Fix by calculating the precise length of the last line fragment. Task-number: QTBUG-56969 Change-Id: I7b69c0d465649be61fb87ac7b8348f0c299486ee Reviewed-by: Lars Knoll --- src/gui/painting/qpaintengine_raster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index f99a247270..ef58f96fbc 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3207,7 +3207,7 @@ void QRasterPaintEnginePrivate::rasterizeLine_dashed(QLineF line, QLineF l = line; if (dash >= length) { - dash = length; + dash = line.length(); // Avoid accumulated precision error in 'length' *dashOffset += dash / width; length = 0; } else { -- cgit v1.2.3 From 4e3917587b11432d2d892f5146b367de2a3e4864 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Wed, 14 Jun 2017 22:41:54 +0200 Subject: kms: Send enter and leave events to all screens Propage event to all sibling screens resulting in enter and leave events being properly sent. Change-Id: Ia89d53105f6303fae3f304ce0920b5a4a24f86ae Reviewed-by: Laszlo Agocs --- .../platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp index 5b779d6732..19790e5c45 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp @@ -240,6 +240,8 @@ void QEglFSKmsGbmCursor::setPos(const QPoint &pos) m_pos = pos; else qWarning("Failed to move cursor on screen %s: %d", kmsScreen->name().toLatin1().constData(), ret); + + kmsScreen->handleCursorMove(pos); } } -- cgit v1.2.3 From 2282ca44e4ab41d0b680d0f3481746c8b03a5770 Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 10 Aug 2017 22:44:38 +0200 Subject: Fix compilation on 64-bit CPUs when QPROCESS_DEBUG is enabled Change-Id: Iad4bea50805b59bd6e985f5830315a7437880b99 Reviewed-by: Jesus Fernandez Reviewed-by: Alex Trotsenko Reviewed-by: Thiago Macieira --- src/corelib/io/qprocess.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 2226b4435b..88a54f275f 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1029,7 +1029,8 @@ bool QProcessPrivate::tryReadFromChannel(Channel *channel) if (readBytes == -1) { setErrorAndEmit(QProcess::ReadError); #if defined QPROCESS_DEBUG - qDebug("QProcessPrivate::tryReadFromChannel(%d), failed to read from the process", channel - &stdinChannel); + qDebug("QProcessPrivate::tryReadFromChannel(%d), failed to read from the process", + int(channel - &stdinChannel)); #endif return false; } @@ -1039,13 +1040,14 @@ bool QProcessPrivate::tryReadFromChannel(Channel *channel) channel->notifier->setEnabled(false); closeChannel(channel); #if defined QPROCESS_DEBUG - qDebug("QProcessPrivate::tryReadFromChannel(%d), 0 bytes available", channel - &stdinChannel); + qDebug("QProcessPrivate::tryReadFromChannel(%d), 0 bytes available", + int(channel - &stdinChannel)); #endif return false; } #if defined QPROCESS_DEBUG - qDebug("QProcessPrivate::tryReadFromChannel(%d), read %d bytes from the process' output", channel - &stdinChannel - int(readBytes)); + qDebug("QProcessPrivate::tryReadFromChannel(%d), read %d bytes from the process' output", + int(channel - &stdinChannel), int(readBytes)); #endif if (channel->closed) { -- cgit v1.2.3 From 4700a32f214eaa54ae4ddddd06936d6ca85dd72f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 18 Aug 2017 14:11:37 +0200 Subject: Android: stop composing before pasting new text We have to exit composition mode before inserting text. Otherwise, the state of the input method will be out of sync with the contents of the text editor. Task-number: QTBUG-61717 Change-Id: I58bf3988ae9e0acf3302e810e46bb0ebeda30d17 Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/qandroidinputcontext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index 279cb338f4..7fa809f3f8 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -303,7 +303,7 @@ static jboolean paste(JNIEnv */*env*/, jobject /*thiz*/) return JNI_FALSE; #ifdef QT_DEBUG_ANDROID_IM_PROTOCOL - qDebug("@@@"); + qDebug("@@@ PASTE"); #endif return m_androidInputContext->paste(); } @@ -1138,6 +1138,7 @@ jboolean QAndroidInputContext::copyURL() jboolean QAndroidInputContext::paste() { + finishComposingText(); m_cursorHandleShown = CursorHandleNotShown; sendShortcut(QKeySequence::Paste); return JNI_TRUE; -- cgit v1.2.3 From 2ea3c0d5f641ebcee20e76a3874e9c6a27459259 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 18 Aug 2017 13:02:45 +0200 Subject: Doc: Clean up Qt::ApplicationAttribute docs Move deprecated and obsoleted enum values to the end, as there already was a category for them. Fix linking to 'Q(Gui)Application'. Update the usage of the name macOS. To make the table more readable in online style, add zero-width spaces to long strings, allowing browsers to word-break them, thus avoiding text overflow/horizontal scroll bar. Task-number: QTWEBSITE-783 Change-Id: I0a96156d24cba4a0405c4edd8d3829def30c69bf Reviewed-by: Venugopal Shivashankar --- src/corelib/global/qnamespace.qdoc | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index c030baa05c..efa8e26938 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -123,15 +123,13 @@ \value AA_PluginApplication Indicates that Qt is used to author a plugin. Depending on the operating system, it suppresses specific initializations that do not necessarily make sense in the plugin case. - For example on OS X, this includes avoiding loading our nib for the main + For example on \macos, this includes avoiding loading our nib for the main menu and not taking possession of the native menu bar. Setting this attribute to true will also set the AA_DontUseNativeMenuBar attribute to true. It also disables native event filters. This attribute has been added in Qt 5.7. It must be set before - \l {QGuiApplication}{Q(Gui)Application} is constructed. + \l {QGuiApplication}{Q\(Gui\)Application} is constructed. - \value AA_MacPluginApplication This attribute has been deprecated. - Use AA_PluginApplication instead. \value AA_DontUseNativeMenuBar All menubars created while this attribute is set to true won't be used as a native menubar (e.g, the menubar at @@ -150,8 +148,6 @@ to be consistent in pixels-per-point across devices rather than defining 1 point as 1/72 inch. - \value AA_X11InitThreads This value is obsolete and has no effect. - \value AA_SynthesizeTouchForUnhandledMouseEvents All mouse events that are not accepted by the application will be translated to touch events instead. @@ -174,12 +170,13 @@ \value AA_UseDesktopOpenGL Forces the usage of desktop OpenGL (for example, \e opengl32.dll or \e libGL.so) on platforms that use dynamic loading of the OpenGL implementation. This value has been added in Qt 5.3. - This attribute must be set before Q(Gui)Application is constructed. + This attribute must be set before \l {QGuiApplication} + {Q\(Gui\)Application} is constructed. \value AA_UseOpenGLES Forces the usage of OpenGL ES 2.0 or higher on platforms that use dynamic loading of the OpenGL implementation. This value has been added in Qt 5.3. This attribute must be set - before Q(Gui)Application is constructed. + before \l {QGuiApplication}{Q\(Gui\)Application} is constructed. \value AA_UseSoftwareOpenGL Forces the usage of a software based OpenGL implementation on platforms that use dynamic loading of the OpenGL @@ -191,24 +188,25 @@ variable \e QT_OPENGL_DLL. See the platform-specific pages, for instance \l{Qt for Windows}, for more information. This value has been added in Qt 5.4. This attribute must be set before - Q(Gui)Application is constructed. + \l {QGuiApplication}{Q\(Gui\)Application} is constructed. \value AA_ShareOpenGLContexts Enables resource sharing between the OpenGL contexts used by classes like QOpenGLWidget and QQuickWidget. This allows sharing OpenGL resources, like textures, between QOpenGLWidget instances that belong to different top-level windows. This value has been added in Qt 5.4. This attribute must be set before - Q(Gui)Application is constructed. + \l {QGuiApplication}{Q\(Gui\)Application} is constructed. \value AA_SetPalette Indicates whether a palette was explicitly set on the - QApplication/QGuiApplication. This value has been added in Qt 5.5. + \l {QGuiApplication}{Q\(Gui\)Application}. This value has been added + in Qt 5.5. \value AA_EnableHighDpiScaling Enables high-DPI scaling in Qt on supported platforms (see also \l{High DPI Displays}). Supported platforms are X11, Windows and Android. Enabling makes Qt scale the main (device independent) coordinate system according to display scale factors provided by the operating system. This corresponds to setting the - QT_AUTO_SCREEN_SCALE_FACTOR environment variable to 1. This value + QT_AUTO_SCREEN\unicode{0x200b}_SCALE_FACTOR environment variable to 1. This value has been added in Qt 5.6. This attribute must be set before Q(Gui)Application is constructed. @@ -216,8 +214,9 @@ system coordinates. Note that the window system may do its own scaling, so this does not guarantee that QPaintDevice::devicePixelRatio() will be equal to 1. In addition, scale factors set by QT_SCALE_FACTOR will not - be affected. This corresponds to setting the QT_AUTO_SCREEN_SCALE_FACTOR - environment variable to 0. This value has been added in Qt 5.6. This + be affected. This corresponds to setting the + QT_AUTO_SCREEN\unicode{0x200b}_SCALE_FACTOR environment variable to 0. + This value has been added in Qt 5.6. This attribute must be set before Q(Gui)Application is constructed. \value AA_UseStyleSheetPropagationInWidgetStyles By default, Qt Style Sheets @@ -263,7 +262,7 @@ \e glProgramBinary(). In the unlikely event of this being problematic, set this attribute to disable all disk-based caching of shaders. - The following values are obsolete: + The following values are deprecated or obsolete: \value AA_ImmediateWidgetCreation This attribute is no longer fully supported in Qt 5. It ensures that widgets are created @@ -275,9 +274,14 @@ Therefore, if it is important to minimize resource consumption, do not set this attribute. + \value AA_MacPluginApplication This attribute has been deprecated. + Use AA_PluginApplication instead. + \value AA_MSWindowsUseDirect3DByDefault This value is obsolete and has no effect. + \value AA_X11InitThreads This value is obsolete and has no effect. + \omitvalue AA_AttributeCount */ -- cgit v1.2.3 From 0f4cce2630efaaa27f35b630119f2511fd3002bb Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 16 Aug 2017 16:03:37 -0700 Subject: QOperatingSystemVersion: add Android Oreo (v8.0, API level 26) [ChangeLog][Binary Compatibility Note] The variable QOperatingSystemVersion::AndroidOreo was added in this release. Code that uses this variable will not run under Qt 5.9.1. If backwards compatibility is desired, use instead QOperatingSystemVersion(QOperatingSystemVersion::Android, 8) Change-Id: I1da5a5577bf6b719e543a1ded1f9b912a83665c3 Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 4 +++- src/corelib/global/qoperatingsystemversion.cpp | 9 +++++++++ src/corelib/global/qoperatingsystemversion.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index a9664e7564..b5cc88534e 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2339,6 +2339,7 @@ Lollipop Marshmallow Nougat Nougat +Oreo */ static const char versions_string[] = "\0" @@ -2354,13 +2355,14 @@ Nougat "Lollipop\0" "Marshmallow\0" "Nougat\0" + "Oreo\0" "\0"; static const int versions_indices[] = { 0, 0, 0, 1, 9, 15, 15, 15, 22, 28, 28, 40, 40, 40, 50, 50, 69, 69, 69, 80, 80, 87, 87, 96, - 108, 108, -1 + 108, 108, 115, -1 }; static const int versions_count = (sizeof versions_indices) / (sizeof versions_indices[0]); diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 83ba6e69ee..594dc6bc17 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -204,6 +204,7 @@ QOperatingSystemVersion QOperatingSystemVersion::current() { 6, 0 }, // API level 23 { 7, 0 }, // API level 24 { 7, 1 }, // API level 25 + { 8, 0 }, // API level 26 }; // This will give us at least the first 2 version components @@ -501,4 +502,12 @@ const QOperatingSystemVersion QOperatingSystemVersion::AndroidNougat = const QOperatingSystemVersion QOperatingSystemVersion::AndroidNougat_MR1 = QOperatingSystemVersion(QOperatingSystemVersion::Android, 7, 1); +/*! + \variable QOperatingSystemVersion::AndroidOreo + \brief a version corresponding to Android Oreo (version 8.0, API level 26). + \since 5.9.2 + */ +const QOperatingSystemVersion QOperatingSystemVersion::AndroidOreo = + QOperatingSystemVersion(QOperatingSystemVersion::Android, 8, 0); + QT_END_NAMESPACE diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index 2e319e66d5..1f3ff8e1ab 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -80,6 +80,7 @@ public: static const QOperatingSystemVersion AndroidMarshmallow; static const QOperatingSystemVersion AndroidNougat; static const QOperatingSystemVersion AndroidNougat_MR1; + static const QOperatingSystemVersion AndroidOreo; Q_DECL_CONSTEXPR QOperatingSystemVersion(OSType osType, int vmajor, int vminor = -1, int vmicro = -1) -- cgit v1.2.3 From 1fc9c8d8f31b3c6587691608550ff41bed765fb9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 21 Aug 2017 11:18:14 +0200 Subject: Windows QPA: Call raise unconditionally for popups A case of nested Qt::WindowStaysOnTopHint may occur when context menus are created on windows with Qt::WindowStaysOnTopHint set. Raise the popup in that case. Amends 329a029c361bcbaf70f3aa919693f0bef48a152f. Task-number: QTBUG-62004 Change-Id: Ifb761edbd42b1447bec30735810c006d02e1aa97 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 3c79c8aefe..5e0fd77776 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -872,8 +872,10 @@ void QWindowsBaseWindow::hide_sys() // Normal hide, do not activate other window void QWindowsBaseWindow::raise_sys() { qCDebug(lcQpaWindows) << __FUNCTION__ << this << window(); - if ((window()->flags() & (Qt::WindowStaysOnTopHint | Qt::WindowStaysOnBottomHint)) == 0) + if (window()->type() == Qt::Popup + || (window()->flags() & (Qt::WindowStaysOnTopHint | Qt::WindowStaysOnBottomHint)) == 0) { SetWindowPos(handle(), HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); + } } void QWindowsBaseWindow::lower_sys() -- cgit v1.2.3 From 82e7bd689ace5e07e195db6514cec85ff9bc7688 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 7 Jul 2017 15:34:56 +0200 Subject: tst_QPrinter: Disambiguate all file names Introduce helper function which uses a number to build unique names. Remove helper for deleting files since it now uses a temporary directory. Add a few cases that were overlooked in 88c68f4d9ed649f444bb22c52595da71ce4aac4e. Task-number: QTBUG-61827 Change-Id: I53355f99ffc3bfe6ad6994a5439710c9fa8cdad5 Reviewed-by: Andy Shaw --- .../printsupport/kernel/qprinter/tst_qprinter.cpp | 63 +++++++++------------- 1 file changed, 25 insertions(+), 38 deletions(-) diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index 16bb0b7c3e..4806d1a435 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -50,22 +50,7 @@ QT_FORWARD_DECLARE_CLASS(QPrinter) -// Helper class to make sure temp files are cleaned up after test complete -class TempFileCleanup -{ -public: - TempFileCleanup(const QString &file) - : m_file(file) - { - } - - ~TempFileCleanup() - { - QFile::remove(m_file); - } -private: - QString m_file; -}; +static int fileNumber = 0; class tst_QPrinter : public QObject { @@ -133,6 +118,9 @@ private slots: void testPageMetrics(); #endif private: + QString testFileName(const QString &prefix, const QString &suffix); + QString testPdfFileName(const QString &prefix) { return testFileName(prefix, QStringLiteral("pdf")); } + QTemporaryDir m_tempDir; }; @@ -246,9 +234,7 @@ void tst_QPrinter::testPageRectAndPaperRect() QPainter *painter = 0; QPrinter printer(QPrinter::HighResolution); printer.setOrientation(QPrinter::Orientation(orientation)); - const QString fileName = m_tempDir.path() + QLatin1String("/silly"); - printer.setOutputFileName(fileName); - TempFileCleanup tmpFile(fileName); + printer.setOutputFileName(testFileName(QLatin1String("silly"), QString())); QRect pageRect = doPaperRect ? printer.paperRect() : printer.pageRect(); float inchesX = float(pageRect.width()) / float(printer.resolution()); @@ -328,7 +314,7 @@ void tst_QPrinter::testMargins() Q_UNUSED(height); QPrinter printer; QPainter *painter = 0; - printer.setOutputFileName("silly"); + printer.setOutputFileName(testFileName(QLatin1String("silly"), QString())); printer.setOrientation((QPrinter::Orientation)orientation); printer.setFullPage(fullpage); printer.setPageSize((QPrinter::PageSize)pagesize); @@ -337,7 +323,6 @@ void tst_QPrinter::testMargins() if (painter) delete painter; - QFile::remove("silly"); } void tst_QPrinter::testMulitpleSets_data() @@ -420,9 +405,7 @@ void tst_QPrinter::outputFormatFromSuffix() QSKIP("No printers available."); QPrinter p; QCOMPARE(p.outputFormat(), QPrinter::NativeFormat); - const QString fileName = m_tempDir.path() + QLatin1String("/test.pdf"); - p.setOutputFileName(fileName); - TempFileCleanup tmpFile(fileName); + p.setOutputFileName(testPdfFileName(QLatin1String("test"))); QCOMPARE(p.outputFormat(), QPrinter::PdfFormat); p.setOutputFileName(QString()); QCOMPARE(p.outputFormat(), QPrinter::NativeFormat); @@ -510,9 +493,7 @@ void tst_QPrinter::errorReporting() p.setOutputFileName("/foobar/nonwritable.pdf"); QCOMPARE(painter.begin(&p), false); // it should check the output file is writable #endif - const QString fileName = m_tempDir.path() + QLatin1String("/test.pdf"); - p.setOutputFileName(fileName); - TempFileCleanup tmpFile(fileName); + p.setOutputFileName(testPdfFileName(QLatin1String("test"))); QCOMPARE(painter.begin(&p), true); // it should check the output QCOMPARE(p.isValid(), true); painter.end(); @@ -606,8 +587,7 @@ void tst_QPrinter::customPaperSizeAndMargins() void tst_QPrinter::printDialogCompleter() { QPrintDialog dialog; - dialog.printer()->setOutputFileName("file.pdf"); - TempFileCleanup tmpFile("file.pdf"); + dialog.printer()->setOutputFileName(testPdfFileName(QLatin1String("file"))); dialog.setEnabledOptions(QAbstractPrintDialog::PrintToFile); dialog.show(); @@ -627,10 +607,8 @@ static void printPage(QPainter *painter) void tst_QPrinter::taskQTBUG4497_reusePrinterOnDifferentFiles() { - const QString fileName1 = m_tempDir.path() + QLatin1String("/out1.pdf"); - const QString fileName2 = m_tempDir.path() + QLatin1String("/out2.pdf"); - TempFileCleanup tmpFile1(fileName1); - TempFileCleanup tmpFile2(fileName2); + const QString fileName1 = testPdfFileName(QLatin1String("out1_")); + const QString fileName2 = testPdfFileName(QLatin1String("out2_")); QPrinter printer; { @@ -689,7 +667,7 @@ void tst_QPrinter::testCurrentPage() void tst_QPrinter::testPdfTitle() { - const QString fileName = m_tempDir.path() + QLatin1String("/file.pdf"); + const QString fileName = testPdfFileName(QLatin1String("file")); // Check the document name is represented correctly in produced pdf { @@ -703,7 +681,6 @@ void tst_QPrinter::testPdfTitle() painter.begin(&printer); painter.end(); } - TempFileCleanup tmpFile(fileName); QFile file(fileName); QVERIFY(file.open(QIODevice::ReadOnly)); // The we expect the title to appear in the PDF as: @@ -1244,8 +1221,9 @@ void tst_QPrinter::outputFileName() QPrinter pdf; pdf.setOutputFormat(QPrinter::PdfFormat); QCOMPARE(pdf.outputFileName(), QString()); - pdf.setOutputFileName(QStringLiteral("Test File")); - QCOMPARE(pdf.outputFileName(), QString("Test File")); + const QString fileName = testFileName(QStringLiteral("Test File"), QString()); + pdf.setOutputFileName(fileName); + QCOMPARE(pdf.outputFileName(), fileName); QPrinter native; if (native.outputFormat() == QPrinter::NativeFormat) { @@ -1253,7 +1231,7 @@ void tst_QPrinter::outputFileName() QCOMPARE(native.outputFileName(), QString()); // Test set/get - QString expected = QStringLiteral("Test File"); + QString expected = fileName; native.setOutputFileName(expected); QCOMPARE(native.outputFileName(), expected); @@ -1960,6 +1938,15 @@ void tst_QPrinter::testPageMetrics() QCOMPARE(printer.pageRect(QPrinter::Millimeter), QRectF(leftMMf, topMMf, heightMMf - leftMMf - rightMMf, widthMMf - topMMf - bottomMMf)); } +QString tst_QPrinter::testFileName(const QString &prefix, const QString &suffix) +{ + QString result = m_tempDir.path() + QLatin1Char('/') + prefix + + QString::number(fileNumber++); + if (!suffix.isEmpty()) + result += QLatin1Char('.') + suffix; + return result; +} + #endif // QT_CONFIG(printer) QTEST_MAIN(tst_QPrinter) -- cgit v1.2.3 From c1cd8df84ea1180536509d3caa2c1fe802b188ab Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 21 Aug 2017 15:54:24 +0200 Subject: Fix the test for non-English based setups Unsetting the SOFTWARE environment variable will force lpstat to use English for the output, so we can ensure that the test will pass regardless of the language used for the machine. Change-Id: Iddf5e8aadaa546ae3e0dd172df84e4e43ee02c2a Reviewed-by: Friedemann Kleint --- .../printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp index c20fafe158..92a06cda00 100644 --- a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp +++ b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp @@ -136,7 +136,7 @@ QStringList tst_QPrinterInfo::getPrintersFromSystem() #ifdef Q_OS_UNIX // This function does roughly the same as the `command substitution` in // the shell. -QString tst_QPrinterInfo::getOutputFromCommand(const QStringList& command) +QString getOutputFromCommandInternal(const QStringList &command) { // The command execution does nothing on non-unix systems. int pid; @@ -194,6 +194,16 @@ QString tst_QPrinterInfo::getOutputFromCommand(const QStringList& command) return QString(array); } } + +QString tst_QPrinterInfo::getOutputFromCommand(const QStringList &command) +{ + // Forces the ouptut from the command to be in English + const QByteArray origSoftwareEnv = qgetenv("SOFTWARE"); + qputenv("SOFTWARE", QByteArray()); + QString output = getOutputFromCommandInternal(command); + qputenv("SOFTWARE", origSoftwareEnv); + return output; +} #endif // Windows test support not yet implemented -- cgit v1.2.3 From 1bbad92e83d9fe4f5f75e5b232e1c06cf8bf049d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 7 Jul 2017 16:30:24 +0200 Subject: tst_QPrinter: Share printers in testPageRectAndPaperRect/testMargin Speeds up testing by a factor of 2. Task-number: QTBUG-61827 Change-Id: I9d6c9d9786d35af3083bc7e98beb9a79dbcc7e11 Reviewed-by: Andy Shaw --- .../printsupport/kernel/qprinter/tst_qprinter.cpp | 132 +++++++++++---------- 1 file changed, 68 insertions(+), 64 deletions(-) diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index 4806d1a435..cc32e73b9c 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -47,8 +48,13 @@ #include #endif +#if QT_CONFIG(printer) +typedef QSharedPointer PrinterPtr; -QT_FORWARD_DECLARE_CLASS(QPrinter) +Q_DECLARE_METATYPE(PrinterPtr) +Q_DECLARE_METATYPE(QPrinter::Orientation) +Q_DECLARE_METATYPE(QPrinter::PageSize) +#endif // printer static int fileNumber = 0; @@ -190,70 +196,72 @@ void tst_QPrinter::testPrintPreviewDialog() void tst_QPrinter::testPageRectAndPaperRect_data() { - QTest::addColumn("orientation"); + QTest::addColumn("printer"); + QTest::addColumn("orientation"); QTest::addColumn("withPainter"); QTest::addColumn("resolution"); QTest::addColumn("doPaperRect"); + const PrinterPtr printer(new QPrinter(QPrinter::HighResolution)); // paperrect - QTest::newRow("paperRect0") << int(QPrinter::Portrait) << true << 300 << true; - QTest::newRow("paperRect1") << int(QPrinter::Portrait) << false << 300 << true; - QTest::newRow("paperRect2") << int(QPrinter::Landscape) << true << 300 << true; - QTest::newRow("paperRect3") << int(QPrinter::Landscape) << false << 300 << true; - QTest::newRow("paperRect4") << int(QPrinter::Portrait) << true << 600 << true; - QTest::newRow("paperRect5") << int(QPrinter::Portrait) << false << 600 << true; - QTest::newRow("paperRect6") << int(QPrinter::Landscape) << true << 600 << true; - QTest::newRow("paperRect7") << int(QPrinter::Landscape) << false << 600 << true; - QTest::newRow("paperRect8") << int(QPrinter::Portrait) << true << 1200 << true; - QTest::newRow("paperRect9") << int(QPrinter::Portrait) << false << 1200 << true; - QTest::newRow("paperRect10") << int(QPrinter::Landscape) << true << 1200 << true; - QTest::newRow("paperRect11") << int(QPrinter::Landscape) << false << 1200 << true; + QTest::newRow("paperRect0") << printer << QPrinter::Portrait << true << 300 << true; + QTest::newRow("paperRect1") << printer << QPrinter::Portrait << false << 300 << true; + QTest::newRow("paperRect2") << printer << QPrinter::Landscape << true << 300 << true; + QTest::newRow("paperRect3") << printer << QPrinter::Landscape << false << 300 << true; + QTest::newRow("paperRect4") << printer << QPrinter::Portrait << true << 600 << true; + QTest::newRow("paperRect5") << printer << QPrinter::Portrait << false << 600 << true; + QTest::newRow("paperRect6") << printer << QPrinter::Landscape << true << 600 << true; + QTest::newRow("paperRect7") << printer << QPrinter::Landscape << false << 600 << true; + QTest::newRow("paperRect8") << printer << QPrinter::Portrait << true << 1200 << true; + QTest::newRow("paperRect9") << printer << QPrinter::Portrait << false << 1200 << true; + QTest::newRow("paperRect10") << printer << QPrinter::Landscape << true << 1200 << true; + QTest::newRow("paperRect11") << printer << QPrinter::Landscape << false << 1200 << true; // page rect - QTest::newRow("pageRect0") << int(QPrinter::Portrait) << true << 300 << false; - QTest::newRow("pageRect1") << int(QPrinter::Portrait) << false << 300 << false; - QTest::newRow("pageRect2") << int(QPrinter::Landscape) << true << 300 << false; - QTest::newRow("pageRect3") << int(QPrinter::Landscape) << false << 300 << false; - QTest::newRow("pageRect4") << int(QPrinter::Portrait) << true << 600 << false; - QTest::newRow("pageRect5") << int(QPrinter::Portrait) << false << 600 << false; - QTest::newRow("pageRect6") << int(QPrinter::Landscape) << true << 600 << false; - QTest::newRow("pageRect7") << int(QPrinter::Landscape) << false << 600 << false; - QTest::newRow("pageRect8") << int(QPrinter::Portrait) << true << 1200 << false; - QTest::newRow("pageRect9") << int(QPrinter::Portrait) << false << 1200 << false; - QTest::newRow("pageRect10") << int(QPrinter::Landscape) << true << 1200 << false; - QTest::newRow("pageRect11") << int(QPrinter::Landscape) << false << 1200 << false; + QTest::newRow("pageRect0") << printer << QPrinter::Portrait << true << 300 << false; + QTest::newRow("pageRect1") << printer << QPrinter::Portrait << false << 300 << false; + QTest::newRow("pageRect2") << printer << QPrinter::Landscape << true << 300 << false; + QTest::newRow("pageRect3") << printer << QPrinter::Landscape << false << 300 << false; + QTest::newRow("pageRect4") << printer << QPrinter::Portrait << true << 600 << false; + QTest::newRow("pageRect5") << printer << QPrinter::Portrait << false << 600 << false; + QTest::newRow("pageRect6") << printer << QPrinter::Landscape << true << 600 << false; + QTest::newRow("pageRect7") << printer << QPrinter::Landscape << false << 600 << false; + QTest::newRow("pageRect8") << printer << QPrinter::Portrait << true << 1200 << false; + QTest::newRow("pageRect9") << printer << QPrinter::Portrait << false << 1200 << false; + QTest::newRow("pageRect10") << printer << QPrinter::Landscape << true << 1200 << false; + QTest::newRow("pageRect11") << printer << QPrinter::Landscape << false << 1200 << false; } void tst_QPrinter::testPageRectAndPaperRect() { + QFETCH(PrinterPtr, printer); QFETCH(bool, withPainter); - QFETCH(int, orientation); + QFETCH(QPrinter::Orientation, orientation); QFETCH(int, resolution); QFETCH(bool, doPaperRect); QPainter *painter = 0; - QPrinter printer(QPrinter::HighResolution); - printer.setOrientation(QPrinter::Orientation(orientation)); - printer.setOutputFileName(testFileName(QLatin1String("silly"), QString())); + printer->setOrientation(orientation); + printer->setOutputFileName(testFileName(QLatin1String("silly"), QString())); - QRect pageRect = doPaperRect ? printer.paperRect() : printer.pageRect(); - float inchesX = float(pageRect.width()) / float(printer.resolution()); - float inchesY = float(pageRect.height()) / float(printer.resolution()); - printer.setResolution(resolution); + QRect pageRect = doPaperRect ? printer->paperRect() : printer->pageRect(); + float inchesX = float(pageRect.width()) / float(printer->resolution()); + float inchesY = float(pageRect.height()) / float(printer->resolution()); + printer->setResolution(resolution); if (withPainter) - painter = new QPainter(&printer); + painter = new QPainter(printer.data()); - QRect otherRect = doPaperRect ? printer.paperRect() : printer.pageRect(); - float otherInchesX = float(otherRect.width()) / float(printer.resolution()); - float otherInchesY = float(otherRect.height()) / float(printer.resolution()); + QRect otherRect = doPaperRect ? printer->paperRect() : printer->pageRect(); + float otherInchesX = float(otherRect.width()) / float(printer->resolution()); + float otherInchesY = float(otherRect.height()) / float(printer->resolution()); if (painter != 0) delete painter; QVERIFY(qAbs(otherInchesX - inchesX) < 0.01); QVERIFY(qAbs(otherInchesY - inchesY) < 0.01); - QVERIFY(printer.orientation() == QPrinter::Portrait || pageRect.width() > pageRect.height()); - QVERIFY(printer.orientation() != QPrinter::Portrait || pageRect.width() < pageRect.height()); + QVERIFY(printer->orientation() == QPrinter::Portrait || pageRect.width() > pageRect.height()); + QVERIFY(printer->orientation() != QPrinter::Portrait || pageRect.width() < pageRect.height()); } void tst_QPrinter::testSetOptions() @@ -285,41 +293,37 @@ void tst_QPrinter::testSetOptions() void tst_QPrinter::testMargins_data() { - QTest::addColumn("orientation"); + QTest::addColumn("printer"); + QTest::addColumn("orientation"); QTest::addColumn("fullpage"); - QTest::addColumn("pagesize"); - QTest::addColumn("width"); - QTest::addColumn("height"); + QTest::addColumn("pagesize"); QTest::addColumn("withPainter"); - QTest::newRow("data0") << int(QPrinter::Portrait) << true << int(QPrinter::A4) << 210 << 297 << false; - QTest::newRow("data1") << int(QPrinter::Landscape) << true << int(QPrinter::A4) << 297 << 210 << false; - QTest::newRow("data2") << int(QPrinter::Landscape) << false << int(QPrinter::A4) << 297 << 210 << false; - QTest::newRow("data3") << int(QPrinter::Portrait) << false << int(QPrinter::A4) << 210 << 297 << false; - QTest::newRow("data4") << int(QPrinter::Portrait) << true << int(QPrinter::A4) << 210 << 297 << true; - QTest::newRow("data5") << int(QPrinter::Landscape) << true << int(QPrinter::A4) << 297 << 210 << true; - QTest::newRow("data6") << int(QPrinter::Landscape) << false << int(QPrinter::A4) << 297 << 210 << true; - QTest::newRow("data7") << int(QPrinter::Portrait) << false << int(QPrinter::A4) << 210 << 297 << true; + const PrinterPtr printer(new QPrinter); + QTest::newRow("data0") << printer << QPrinter::Portrait << true << QPrinter::A4 << false; + QTest::newRow("data1") << printer << QPrinter::Landscape << true << QPrinter::A4 << false; + QTest::newRow("data2") << printer << QPrinter::Landscape << false << QPrinter::A4 << false; + QTest::newRow("data3") << printer << QPrinter::Portrait << false << QPrinter::A4 << false; + QTest::newRow("data4") << printer << QPrinter::Portrait << true << QPrinter::A4 << true; + QTest::newRow("data5") << printer << QPrinter::Landscape << true << QPrinter::A4 << true; + QTest::newRow("data6") << printer << QPrinter::Landscape << false << QPrinter::A4 << true; + QTest::newRow("data7") << printer << QPrinter::Portrait << false << QPrinter::A4 << true; } void tst_QPrinter::testMargins() { + QFETCH(PrinterPtr, printer); QFETCH(bool, withPainter); - QFETCH(int, orientation); - QFETCH(int, pagesize); - QFETCH(int, width); - QFETCH(int, height); + QFETCH(QPrinter::Orientation, orientation); + QFETCH(QPrinter::PageSize, pagesize); QFETCH(bool, fullpage); - Q_UNUSED(width); - Q_UNUSED(height); - QPrinter printer; QPainter *painter = 0; - printer.setOutputFileName(testFileName(QLatin1String("silly"), QString())); - printer.setOrientation((QPrinter::Orientation)orientation); - printer.setFullPage(fullpage); - printer.setPageSize((QPrinter::PageSize)pagesize); + printer->setOutputFileName(testFileName(QLatin1String("silly"), QString())); + printer->setOrientation(orientation); + printer->setFullPage(fullpage); + printer->setPageSize(pagesize); if (withPainter) - painter = new QPainter(&printer); + painter = new QPainter(printer.data()); if (painter) delete painter; -- cgit v1.2.3 From b65e30c861af308d142c36b5f96f1a4cfedde1f3 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 12 Jun 2017 16:55:03 -0700 Subject: QWidget: Call appropriate QWindow method from setGeometry_sys() When calling resize() from showEvent(), we'd set the full geometry on the widget's QWindow. This resulted in the top-level window being moved to the top-left corner, even though no other call to move() or setGeometry() had happened before. The solution consists on calling the proper QWindow methods depending on whether setGeometry_sys() is called for a move, a resize or both. Furthermore, this needs QWindow::resize() to set its position policy to frame-exclusive. The documentation states that is already the case and we're setting the full geometry on the platform window, so we need to convey that bit of information. This also solves the age-old conundrum: "### why do we have isMove as a parameter?" Change-Id: I2e00fd632929ade14b35ae5e6495ed1ab176d32f Task-number: QTBUG-56277 Reviewed-by: Gabriel de Dietrich Reviewed-by: Friedemann Kleint --- src/gui/kernel/qwindow.cpp | 1 + src/widgets/kernel/qwidget.cpp | 14 +++++++--- .../kernel/qwidget_window/tst_qwidget_window.cpp | 31 ++++++++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index eb9d7a8868..43b201e9b0 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1759,6 +1759,7 @@ void QWindow::resize(int w, int h) void QWindow::resize(const QSize &newSize) { Q_D(QWindow); + d->positionPolicy = QWindowPrivate::WindowFrameExclusive; if (d->platformWindow) { d->platformWindow->setGeometry(QHighDpi::toNativePixels(QRect(position(), newSize), this)); } else { diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index d372d69d02..11915a4a21 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -7255,7 +7255,8 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) QRect r(x, y, w, h); bool isResize = olds != r.size(); - isMove = oldp != r.topLeft(); //### why do we have isMove as a parameter? + if (!isMove) + isMove = oldp != r.topLeft(); // We only care about stuff that changes the geometry, or may @@ -7289,12 +7290,17 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (q->isVisible()) { if (!q->testAttribute(Qt::WA_DontShowOnScreen) && !q->testAttribute(Qt::WA_OutsideWSRange)) { - if (q->windowHandle()) { + if (QWindow *win = q->windowHandle()) { if (q->isWindow()) { - q->windowHandle()->setGeometry(q->geometry()); + if (isResize && !isMove) + win->resize(w, h); + else if (isMove && !isResize) + win->setPosition(x, y); + else + win->setGeometry(q->geometry()); } else { QPoint posInNativeParent = q->mapTo(q->nativeParentWidget(),QPoint()); - q->windowHandle()->setGeometry(QRect(posInNativeParent,r.size())); + win->setGeometry(QRect(posInNativeParent,r.size())); } if (needsShow) diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index 6aaac6d135..f20978c295 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -99,6 +99,8 @@ private slots: void tst_eventfilter_on_toplevel(); void QTBUG_50561_QCocoaBackingStore_paintDevice_crash(); + + void QTBUG_56277_resize_on_showEvent(); }; void tst_QWidget_window::initTestCase() @@ -861,5 +863,34 @@ void tst_QWidget_window::QTBUG_50561_QCocoaBackingStore_paintDevice_crash() w.close(); } +class ResizedOnShowEventWidget : public QWidget +{ +public: + void showEvent(QShowEvent *) override + { + const auto *primaryScreen = QApplication::primaryScreen(); + auto newSize = primaryScreen->availableGeometry().size() / 4; + if (newSize == geometry().size()) + newSize -= QSize(10, 10); + resize(newSize); + } +}; + +void tst_QWidget_window::QTBUG_56277_resize_on_showEvent() +{ + const auto platformName = QGuiApplication::platformName().toLower(); + if (platformName != "cocoa" && platformName != "windows") + QSKIP("This can only be consistently tested on desktop platforms with well-known behavior."); + + ResizedOnShowEventWidget w; + w.show(); + QVERIFY(QTest::qWaitForWindowExposed(&w)); + const auto *screen = w.windowHandle()->screen(); + const auto geometry = w.geometry(); + const int frameHeight = geometry.top() - w.frameGeometry().top(); + const int topmostY = screen->availableGeometry().top() + frameHeight; + QVERIFY(geometry.top() > topmostY || geometry.left() > screen->availableGeometry().left()); +} + QTEST_MAIN(tst_QWidget_window) #include "tst_qwidget_window.moc" -- cgit v1.2.3 From a576954f9b96d2777d8cce09be31eb3f62e0e882 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 7 Jun 2017 14:06:33 +0200 Subject: QTableGenerator: Fix handling of illegal characters in fromBase8 Task-number: QTBUG-60387 Change-Id: I084c2b4a86439857e898e9adc7370c19961d0126 Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll --- src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index ca9f7af127..809aa68365 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -520,7 +520,7 @@ static inline int fromBase8(const char *s, const char *end) { int result = 0; while (*s && s != end) { - if (*s <= '0' && *s >= '7') + if (*s <= '0' || *s >= '7') return 0; result *= 8; result += *s - '0'; -- cgit v1.2.3 From 2740584e6de5ec2999e0e44f363bc18b9252dc23 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Fri, 18 Aug 2017 16:51:37 +0200 Subject: Doc: Update Qt Creator Manual link targets to match version 4.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib784779b09f4bce38ada4833777f873ee510af16 Reviewed-by: Tarja Sundqvist Reviewed-by: Topi Reiniö --- doc/global/externalsites/qtcreator.qdoc | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/doc/global/externalsites/qtcreator.qdoc b/doc/global/externalsites/qtcreator.qdoc index 4b9160cea4..7f2322d041 100644 --- a/doc/global/externalsites/qtcreator.qdoc +++ b/doc/global/externalsites/qtcreator.qdoc @@ -117,10 +117,6 @@ \externalpage http://doc.qt.io/qtcreator/quick-screens.html \title Qt Creator: Creating Screens */ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-qtquick-designer-extensions.html - \title Qt Creator: Using Qt Quick Designer Extensions -*/ /*! \externalpage http://doc.qt.io/qtcreator/qmldesigner-pathview-editor.html \title Qt Creator: Editing PathView Properties @@ -295,7 +291,7 @@ */ /*! \externalpage http://doc.qt.io/qtcreator/creator-connecting-mobile.html - \title Qt Creator: Connecting Mobile Devices + \title Qt Creator: Connecting Devices */ /*! \externalpage http://doc.qt.io/qtcreator/creator-usability.html @@ -323,7 +319,7 @@ */ /*! \externalpage http://doc.qt.io/qtcreator/creator-deployment.html - \title Qt Creator: Deploying to Mobile Devices + \title Qt Creator: Deploying to Devices */ /*! \externalpage http://doc.qt.io/qtcreator/creator-tutorials.html @@ -405,7 +401,7 @@ */ /*! \externalpage http://doc.qt.io/qtcreator/creator-project-cmake.html - \title Qt Creator: Setting Up a CMake Project + \title Qt Creator: Setting Up CMake */ /*! \externalpage http://doc.qt.io/qtcreator/creator-targets.html @@ -417,7 +413,7 @@ */ /*! \externalpage http://doc.qt.io/qtcreator/creator-project-qbs.html - \title Qt Creator: Setting Up a Qbs Project + \title Qt Creator: Setting Up Qbs */ /*! \externalpage http://doc.qt.io/qtcreator/creator-project-creating.html @@ -523,22 +519,16 @@ \externalpage http://doc.qt.io/qtcreator/creator-beautifier.html \title Qt Creator: Beautifying Source Code */ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-developing-winrt.html - \title Qt Creator: Connecting Windows Runtime Devices -*/ + /*! \externalpage http://doc.qt.io/qtcreator/creator-clang-codemodel.html - \title Qt Creator: Parsing C++ Files + \title Qt Creator: Parsing C++ Files with the Clang Code Model */ /*! \externalpage http://doc.qt.io/qtcreator/creator-quick-ui-forms.html \title Qt Creator: Qt Quick UI Forms */ -/*! - \externalpage http://doc.qt.io/qtcreator/qtcreator-uiforms-example.html - \title Qt Creator: Using Qt Quick UI Forms -*/ + /*! \externalpage http://doc.qt.io/qtcreator/creator-clang-static-analyzer.html \title Qt Creator: Using Clang Static Analyzer -- cgit v1.2.3 From 09ea013ae17caad7d973fb05287a634dba2768c9 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 28 Jul 2017 16:52:31 +0300 Subject: Use libc++ instead of libstdc++ when compiling with android-clang mkspec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clang+libc++ is the only supported way by Google nowadays. libstdc++ is too old and already fails to build some C++11 apps e.g. missing std::to_string(). android-g++ mkspec still uses libstdc++ and g++. Use -isystem to include system headers instead of QMAKE_INCDIR_POST (-I). Task-number: QTBUG-60455 Change-Id: Iba8b04594c2e5e2832e6cf480e4e52ff31ad4106 Reviewed-by: Sérgio Martins Reviewed-by: Eskil Abrahamsen Blomfeldt --- mkspecs/android-clang/qmake.conf | 28 ++++++++++++++++------ mkspecs/android-g++/qmake.conf | 21 +++++++++++++--- mkspecs/common/android-base-head.conf | 10 ++------ mkspecs/common/android-base-tail.conf | 28 ++++++---------------- .../android/android_deployment_settings.prf | 1 + 5 files changed, 49 insertions(+), 39 deletions(-) diff --git a/mkspecs/android-clang/qmake.conf b/mkspecs/android-clang/qmake.conf index 3e621c7d77..2f38e100b2 100644 --- a/mkspecs/android-clang/qmake.conf +++ b/mkspecs/android-clang/qmake.conf @@ -15,20 +15,34 @@ QMAKE_CC = $$NDK_LLVM_PATH/bin/clang QMAKE_CXX = $$NDK_LLVM_PATH/bin/clang++ equals(ANDROID_TARGET_ARCH, armeabi-v7a): \ - QMAKE_CFLAGS = -target armv7-none-linux-androideabi + QMAKE_CFLAGS += -target armv7-none-linux-androideabi else: equals(ANDROID_TARGET_ARCH, armeabi): \ - QMAKE_CFLAGS = -target armv5te-none-linux-androideabi + QMAKE_CFLAGS += -target armv5te-none-linux-androideabi else: equals(ANDROID_TARGET_ARCH, arm64-v8a): \ - QMAKE_CFLAGS = -target aarch64-none-linux-android + QMAKE_CFLAGS += -target aarch64-none-linux-android else: equals(ANDROID_TARGET_ARCH, x86): \ - QMAKE_CFLAGS = -target i686-none-linux-android + QMAKE_CFLAGS += -target i686-none-linux-android else: equals(ANDROID_TARGET_ARCH, x86_64): \ - QMAKE_CFLAGS = -target x86_64-none-linux-android + QMAKE_CFLAGS += -target x86_64-none-linux-android else: equals(ANDROID_TARGET_ARCH, mips): \ QMAKE_CFLAGS += -target mipsel-none-linux-android else: equals(ANDROID_TARGET_ARCH, mips64): \ - QMAKE_CFLAGS = -target mips64el-none-linux-android + QMAKE_CFLAGS += -target mips64el-none-linux-android -QMAKE_LINK = $$QMAKE_CXX $$QMAKE_CFLAGS -gcc-toolchain $$NDK_TOOLCHAIN_PATH +QMAKE_CFLAGS += -gcc-toolchain $$NDK_TOOLCHAIN_PATH +QMAKE_LINK = $$QMAKE_CXX $$QMAKE_CFLAGS -Wl,--exclude-libs,libgcc.a +QMAKE_CFLAGS += -DANDROID_HAS_WSTRING --sysroot=$$NDK_ROOT/sysroot \ + -isystem $$NDK_ROOT/sysroot/usr/include/$$NDK_TOOLS_PREFIX \ + -isystem $$NDK_ROOT/sources/cxx-stl/llvm-libc++/include \ + -isystem $$NDK_ROOT/sources/android/support/include \ + -isystem $$NDK_ROOT/sources/cxx-stl/llvm-libc++abi/include + +ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/$$ANDROID_TARGET_ARCH + +ANDROID_STDCPP_PATH = $$ANDROID_SOURCES_CXX_STL_LIBDIR/libc++_shared.so +ANDROID_CXX_STL_LIBS = -lc++ + +QMAKE_ARM_CFLAGS_RELEASE = -Oz +QMAKE_ARM_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Oz include(../common/android-base-tail.conf) diff --git a/mkspecs/android-g++/qmake.conf b/mkspecs/android-g++/qmake.conf index 2b81ac58f0..5e8a97c9d7 100644 --- a/mkspecs/android-g++/qmake.conf +++ b/mkspecs/android-g++/qmake.conf @@ -10,9 +10,24 @@ include(../common/gcc-base-unix.conf) include(../common/android-base-head.conf) QMAKE_CC = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-gcc -QMAKE_CXX = $$QMAKE_GCC +QMAKE_CXX = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-g++ +QMAKE_LINK = $$QMAKE_CXX -QMAKE_CFLAGS = -QMAKE_LINK = $$QMAKE_GCC +ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/libs/$$ANDROID_TARGET_ARCH +ANDROID_STDCPP_PATH = $$ANDROID_SOURCES_CXX_STL_LIBDIR/libgnustl_shared.so +ANDROID_CXX_STL_LIBS = -lgnustl_shared -lgcc + +QMAKE_CFLAGS += --sysroot=$$ANDROID_PLATFORM_ROOT_PATH \ + -isystem $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/include \ + -isystem $$ANDROID_SOURCES_CXX_STL_LIBDIR/include + +equals(ANDROID_TARGET_ARCH, armeabi)|equals(ANDROID_TARGET_ARCH, armeabi-v7a): \ + LIBGCC_PATH_FULL = $$system("$$QMAKE_CXX -mthumb-interwork -print-libgcc-file-name") +else: \ + LIBGCC_PATH_FULL = $$system("$$QMAKE_CXX -print-libgcc-file-name") +ANDROID_SOURCES_CXX_STL_LIBDIR += $$dirname(LIBGCC_PATH_FULL) + +QMAKE_ARM_CFLAGS_RELEASE = -Os +QMAKE_ARM_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Os include(../common/android-base-tail.conf) diff --git a/mkspecs/common/android-base-head.conf b/mkspecs/common/android-base-head.conf index ae4933c453..90cc71247a 100644 --- a/mkspecs/common/android-base-head.conf +++ b/mkspecs/common/android-base-head.conf @@ -66,17 +66,11 @@ isEmpty(ANDROID_SDK_BUILD_TOOLS_REVISION) { } CONFIG += $$ANDROID_PLATFORM +QMAKE_CFLAGS = -D__ANDROID_API__=$$replace(ANDROID_PLATFORM, "android-", "") + ANDROID_PLATFORM_ROOT_PATH = $$NDK_ROOT/platforms/$$ANDROID_PLATFORM/arch-$$ANDROID_ARCHITECTURE/ ANDROID_PLATFORM_PATH = $$ANDROID_PLATFORM_ROOT_PATH/usr -# used to compile platform plugins for android-4 and android-5 -QMAKE_ANDROID_PLATFORM_INCDIR = $$ANDROID_PLATFORM_PATH/include -QMAKE_ANDROID_PLATFORM_LIBDIR = $$ANDROID_PLATFORM_PATH/lib - -ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/libs/$$ANDROID_TARGET_ARCH -ANDROID_SOURCES_CXX_STL_INCDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/include $$ANDROID_SOURCES_CXX_STL_LIBDIR/include - equals(ANDROID_TARGET_ARCH, x86_64)|equals(ANDROID_TARGET_ARCH, mips64): \ QMAKE_ANDROID_PLATFORM_LIBDIR = $${QMAKE_ANDROID_PLATFORM_LIBDIR}64 -QMAKE_GCC = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-g++ diff --git a/mkspecs/common/android-base-tail.conf b/mkspecs/common/android-base-tail.conf index 3f1b414d3f..3472dfdf77 100644 --- a/mkspecs/common/android-base-tail.conf +++ b/mkspecs/common/android-base-tail.conf @@ -11,18 +11,11 @@ else: equals(ANDROID_TARGET_ARCH, armeabi): \ QMAKE_CFLAGS += -march=armv5te -mtune=xscale -msoft-float -fno-builtin-memmove # -fno-builtin-memmove is used to workaround https://code.google.com/p/android/issues/detail?id=81692 -QMAKE_CFLAGS += --sysroot=$$ANDROID_PLATFORM_ROOT_PATH QMAKE_CFLAGS_WARN_ON = -Wall -W QMAKE_CFLAGS_WARN_OFF = equals(ANDROID_TARGET_ARCH, armeabi-v7a) | equals(ANDROID_TARGET_ARCH, armeabi) { - contains(QMAKE_COMPILER, clang) { - QMAKE_CFLAGS_RELEASE = -Oz - QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Oz - } else { - QMAKE_CFLAGS_RELEASE = -Os - QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Os - } - + QMAKE_CFLAGS_RELEASE = $$QMAKE_ARM_CFLAGS_RELEASE + QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = $$QMAKE_ARM_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CFLAGS_DEBUG = -g -marm -O0 equals(ANDROID_TARGET_ARCH, armeabi):if(equals(NDK_TOOLCHAIN_VERSION, 4.8)|equals(NDK_TOOLCHAIN_VERSION, 4.9)) { DEFINES += QT_OS_ANDROID_GCC_48_WORKAROUND @@ -73,19 +66,12 @@ QMAKE_STRIP = QMAKE_RANLIB = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ranlib -equals(ANDROID_TARGET_ARCH, armeabi)|equals(ANDROID_TARGET_ARCH, armeabi-v7a): \ - LIBGCC_PATH_FULL = $$system("$$QMAKE_GCC -mthumb-interwork -print-libgcc-file-name") -else: \ - LIBGCC_PATH_FULL = $$system("$$QMAKE_GCC -print-libgcc-file-name") - -LIBGCC_PATH = $$dirname(LIBGCC_PATH_FULL) - -QMAKE_INCDIR_POST = $$ANDROID_SOURCES_CXX_STL_INCDIR $$QMAKE_ANDROID_PLATFORM_INCDIR -QMAKE_LIBDIR_POST = $$ANDROID_SOURCES_CXX_STL_LIBDIR $$QMAKE_ANDROID_PLATFORM_LIBDIR $$LIBGCC_PATH +QMAKE_INCDIR_POST = +QMAKE_LIBDIR_POST = $$ANDROID_SOURCES_CXX_STL_LIBDIR QMAKE_INCDIR_X11 = QMAKE_LIBDIR_X11 = -QMAKE_INCDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_INCDIR -QMAKE_LIBDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_LIBDIR +QMAKE_INCDIR_OPENGL = +QMAKE_LIBDIR_OPENGL = QMAKE_LINK_SHLIB = $$QMAKE_LINK QMAKE_LFLAGS = --sysroot=$$ANDROID_PLATFORM_ROOT_PATH @@ -97,7 +83,7 @@ QMAKE_LFLAGS_NOUNDEF = -Wl,--no-undefined QMAKE_LFLAGS_RPATH = -Wl,-rpath= QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link= -QMAKE_LIBS_PRIVATE = -lgnustl_shared -llog -lz -lm -ldl -lc -lgcc +QMAKE_LIBS_PRIVATE = $$ANDROID_CXX_STL_LIBS -llog -lz -lm -ldl -lc QMAKE_LIBS_X11 = QMAKE_LIBS_THREAD = QMAKE_LIBS_EGL = -lEGL diff --git a/mkspecs/features/android/android_deployment_settings.prf b/mkspecs/features/android/android_deployment_settings.prf index 9fe1e26075..913ab71412 100644 --- a/mkspecs/features/android/android_deployment_settings.prf +++ b/mkspecs/features/android/android_deployment_settings.prf @@ -62,6 +62,7 @@ contains(TEMPLATE, ".*app"):!build_pass: { isEmpty(QML_ROOT_PATH): \ QML_ROOT_PATH = $$_PRO_FILE_PWD_ FILE_CONTENT += " \"qml-root-path\": $$emitString($$QML_ROOT_PATH)," + FILE_CONTENT += " \"stdcpp-path\": $$emitString($$ANDROID_STDCPP_PATH)," FILE_CONTENT += " \"application-binary\": $$emitString($$absolute_path($$DESTDIR, $$OUT_PWD)/$$TARGET)" FILE_CONTENT += "}" -- cgit v1.2.3 From 6522d4c487bbb19bceb466762f8bc611f8d78444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Wed, 14 Jun 2017 00:02:14 +0100 Subject: Fix invalid placeholder name in tst_qsqlthread.cpp Change-Id: I88c0c48888b86b58d85223ad1dc4cafdaea01d77 Reviewed-by: Andy Shaw --- tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp b/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp index c21223886a..5482dc393b 100644 --- a/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp +++ b/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp @@ -177,7 +177,7 @@ public: for (int i = 0; i < ProdConIterations; ++i) { QVERIFY_SQL(q1, exec("select max(id) from " + qtest)); q1.first(); - q2.bindValue("id", q1.value(0)); + q2.bindValue(":id", q1.value(0)); q1.clear(); QVERIFY_SQL(q2, exec()); QThread::yieldCurrentThread(); -- cgit v1.2.3 From 94c4827a9f3942ddde2f2371de4e1aab709995cb Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 7 Aug 2017 21:15:56 -0700 Subject: configure: Disable warnings in configure tests No need to log them. Change-Id: I3868166e5efc45538544fffd14d8c3cc0012ba12 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qt_configure.prf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index afeb4f3d1d..1ba96767be 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -926,6 +926,9 @@ defineTest(qtConfTest_compile) { use_gold_linker: \ qmake_configs += "use_gold_linker" + # disable warnings from the builds, since they're just noise at this point. + qmake_configs += "warn_off" + # add console to the CONFIG variable when running the tests, so that they # can work with a regular main() entry point on Windows. qmake_configs += "console" -- cgit v1.2.3 From 643d19f87b09ef486afa64eb630153e482f8a6e9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 9 Aug 2017 15:42:03 -0700 Subject: QNetworkInterface: Fold the test for if_nameindex into the config test No need to make workarounds for Android in the .cpp source. Just let it fail (if it still has to fail). Change-Id: Iaf4157b7efa2416d898cfffd14d94ebcb4d979be Reviewed-by: Oswald Buddenhagen --- src/network/configure.json | 3 ++- src/network/kernel/qnetworkinterface_unix.cpp | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/network/configure.json b/src/network/configure.json index 6e7ce25051..916448a727 100644 --- a/src/network/configure.json +++ b/src/network/configure.json @@ -135,7 +135,8 @@ "main": [ "char buf[IFNAMSIZ];", "if_nametoindex(\"eth0\");", - "if_indextoname(1, buf);" + "if_indextoname(1, buf);", + "if_freenameindex(if_nameindex());" ] }, "use": "network" diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp index 4f4615d4d0..afa6b4296e 100644 --- a/src/network/kernel/qnetworkinterface_unix.cpp +++ b/src/network/kernel/qnetworkinterface_unix.cpp @@ -60,11 +60,6 @@ # define QT_NO_GETIFADDRS #endif -#ifdef Q_OS_ANDROID -// android lacks if_nameindex -# define QT_NO_IPV6IFNAME -#endif - #ifdef Q_OS_HAIKU # include # define IFF_RUNNING 0x0001 -- cgit v1.2.3 From 797530c3f81b6c5fb8e25e431105fdcd22d8775a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 22 Aug 2017 20:29:16 -0700 Subject: QHostInfo: Remove Darwin refusal to use getnameinfo(3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This #if has been there since 0248ec4054b (Oct 2005), presumably due to bugs reported after the Qt 4.0 release (the first containing QHostInfo). Any macOS issues with getnameinfo() have long since been gone. I've confirmed that it works on 10.9, 10.10, 10.11 and 10.12, so I'm dropping the #ifndef. [ChangeLog][Deprecation Notice] Starting with Qt 5.10, IPv6 support will be mandatory for all platforms. Systems without proper IPv6 support, such as the getaddrinfo() function or the proper socket address structures, will not be able to build QtNetwork anymore. Change-Id: I320d9d2f42284a69a4cbfffd14dd5bf479e5f678 Reviewed-by: Tor Arne Vestbø Reviewed-by: Edward Welbourne --- src/network/kernel/qhostinfo_unix.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp index cf08a15f96..9a24938284 100644 --- a/src/network/kernel/qhostinfo_unix.cpp +++ b/src/network/kernel/qhostinfo_unix.cpp @@ -150,8 +150,7 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) QHostAddress address; if (address.setAddress(hostName)) { // Reverse lookup -// Reverse lookups using getnameinfo are broken on darwin, use gethostbyaddr instead. -#if !defined (QT_NO_GETADDRINFO) && !defined (Q_OS_DARWIN) +#if !defined (QT_NO_GETADDRINFO) sockaddr_in sa4; sockaddr_in6 sa6; sockaddr *sa = 0; -- cgit v1.2.3 From 515b9051505d61af6be0eba87616c7281ee4ce62 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 6 Sep 2016 19:21:50 +0200 Subject: Adapt qmake's raw-string parser to avoid confusion by macros A macro name ending in R might expand to a string; if this precedes a string constant, we're juxtaposing the strings. My first parser for raw strings would mistake it for a raw string instead, ignoring the part of the identifier before R. Re-worked the exploration of what came before the string to catch these cases, too. The backwards parsing would also allow any messy jumble of [RLUu8]* as prefix for the string; but in fact R must (if present) be last in the prefix and *it* can have at most one prefix, [LUu] or u8. Anything else is an identifier that happens to precede the string. Reworked the parsing to allow only one prefix and not treat R specially unless it's immediately (modulo BSNL) before the string's open-quotes. Add link to the cppreference page about string literals, on which the grammar now parsed is based. Added a test for the issue this addresses. Verified that this fails on 5.6, dev and 5.9 without the fix. Expanded the existing test to cover R-with-prefix cases. Task-number: QTBUG-55633 Change-Id: I541486c2ec909cfb42050907c84bee83ead4a2f4 Reviewed-by: Oswald Buddenhagen --- qmake/generators/makefiledeps.cpp | 42 +++++++-- tests/auto/tools/qmake/testdata/rawString/main.cpp | 101 ++++++++++++++++++++- .../auto/tools/qmake/testdata/rawString/object2.h | 54 +++++++++++ .../tools/qmake/testdata/rawString/rawString.pro | 2 +- 4 files changed, 190 insertions(+), 9 deletions(-) create mode 100644 tests/auto/tools/qmake/testdata/rawString/object2.h diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index 3140b045a1..c68eeb13d6 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -422,25 +422,53 @@ static bool matchWhileUnsplitting(const char *buffer, int buffer_len, int start, /* Advance from an opening quote at buffer[offset] to the matching close quote. */ static int scanPastString(char *buffer, int buffer_len, int offset, int *lines) { + // http://en.cppreference.com/w/cpp/language/string_literal // It might be a C++11 raw string. bool israw = false; if (buffer[offset] == '"' && offset > 0) { int explore = offset - 1; - while (explore > 0 && buffer[explore] != 'R') { - if (buffer[explore] == '8' || buffer[explore] == 'u' || buffer[explore] == 'U') { - explore--; - } else if (explore > 1 && qmake_endOfLine(buffer[explore]) - && buffer[explore - 1] == '\\') { + bool prefix = false; // One of L, U, u or u8 may appear before R + bool saw8 = false; // Partial scan of u8 + while (explore >= 0) { + // Cope with backslash-newline interruptions of the prefix: + if (explore > 0 + && qmake_endOfLine(buffer[explore]) + && buffer[explore - 1] == '\\') { explore -= 2; - } else if (explore > 2 && buffer[explore] == '\n' + } else if (explore > 1 + && buffer[explore] == '\n' && buffer[explore - 1] == '\r' && buffer[explore - 2] == '\\') { explore -= 3; + // Remaining cases can only decrement explore by one at a time: + } else if (saw8 && buffer[explore] == 'u') { + explore--; + saw8 = false; + prefix = true; + } else if (saw8 || prefix) { + break; + } else if (explore > 1 && buffer[explore] == '8') { + explore--; + saw8 = true; + } else if (buffer[explore] == 'L' + || buffer[explore] == 'U' + || buffer[explore] == 'u') { + explore--; + prefix = true; + } else if (buffer[explore] == 'R') { + if (israw) + break; + explore--; + israw = true; } else { break; } } - israw = (buffer[explore] == 'R'); + // Check the R (with possible prefix) isn't just part of an identifier: + if (israw && explore >= 0 + && (isalnum(buffer[explore]) || buffer[explore] == '_')) { + israw = false; + } } if (israw) { diff --git a/tests/auto/tools/qmake/testdata/rawString/main.cpp b/tests/auto/tools/qmake/testdata/rawString/main.cpp index 53a28f7bc0..bc557f39f8 100644 --- a/tests/auto/tools/qmake/testdata/rawString/main.cpp +++ b/tests/auto/tools/qmake/testdata/rawString/main.cpp @@ -26,8 +26,107 @@ ** ****************************************************************************/ +// macro names that *aren't* string-literal-prefixes: +#define Ru8 "rue-it" +#define RL "real life" +#define Ru "are you ?" +#define RU "Are You ?" +#define LLR "double-hockey-sticks" +#define LUR "Tricky" +#define LuR "tricky" +#define Lu8R "l'uber" +#define UUR "Double-Yew" +#define ULR "Eweler" +#define UuR "You ... you-are" +#define Uu8R "You ... you *ate* our ..." +#define uuR "water" +#define uLR "eweler" +#define uUR "double-Your" +#define uu8R "totally uber" +#define u8u8R "rubber-you" +#define u8LR "Uber left-to-right" +#define u8UR "Uber Upper-Right" +#define u8uR "Uber upper-right" +#define Ru8R "bouncy" +#define RLR "Marching" +#define RuR "Rossum's general-purpose workers" +#define RUR "Rossum's Universal Robots" + +static const char monstrosity[] = + Ru8"Ru8(" + RL"RL(" + Ru"Ru(" + RU"RU(" + LLR"LLR(" + LUR"LUR(" + LuR"LuR(" + Lu8R"Lu8R(" + UUR"UUR(" + ULR"ULR(" + UuR"UuR(" + Uu8R"Uu8R(" + uuR"uuR(" + uLR"uLR(" + uUR"uUR(" + uu8R"uu8R(" + u8u8R"u8u8R(" + u8LR"u8LR(" + u8UR"u8UR(" + u8uR"u8uR(" + Ru8R"Ru8R(" + RLR"RLR(" + RuR"RuR(" + RUR"RUR(" + "Finally, some content"; + +#include + +static const char closure[] = + ")RUR" + ")RuR" + ")RLR" + ")Ru8R" + ")u8uR" + ")u8UR" + ")u8LR" + ")u8u8R" + ")uu8R" + ")uUR" + ")uLR" + ")uuR" + ")Uu8R" + ")UuR" + ")ULR" + ")UUR" + ")Lu8R" + ")LuR" + ")LUR" + ")LLR" + ")RU" + ")Ru" + ")RL" + ")Ru8"; +// If moc got confused, the confusion should now be over + +// Real raw strings, not actually leaving us inside any comments: static const char raw[] = R"blah(lorem " ipsum /*)blah"\ ; +static const wchar_t wider[] = LR"blah(lorem " ipsum /*)blah"\ +; +static const char32_t UCS4[] = UR"blah(lorem " ipsum /*)blah"\ +; +static const char16_t UCS2[] = uR"blah(lorem " ipsum /*)blah"\ +; +static const char utf8[] = u8R"blah(lorem " ipsum /*)blah"\ +; #include -int main () { return 0; } +/* Avoid unused variable warnings by silly uses of arrays: */ +#define final(x) x[sizeof(x) - 1] // 0, of course +int main () { + return final(raw) + * (final(wider) - final(UCS4)) + * (final(UCS2) - final(utf8)) + * (final(monstrosity) - final(closure)); +} +#undef final diff --git a/tests/auto/tools/qmake/testdata/rawString/object2.h b/tests/auto/tools/qmake/testdata/rawString/object2.h new file mode 100644 index 0000000000..2ab77cd3bd --- /dev/null +++ b/tests/auto/tools/qmake/testdata/rawString/object2.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef TEST_QMAKE_RAWSTRING_OBJECT2_H +#define TEST_QMAKE_RAWSTRING_OBJECT2_H + +#define Lu8UR "land" +inline char opener(int i) { + const char text[] = Lu8UR"blah( not a raw string; just juxtaposed"; + return text[i]; +} + +#include + +class Object2 : public QObject +{ + Q_OBJECT +}; + +inline char closer(int i) { + const char text[] = "pretend to close it, all the same )blah"; + return text[i]; +} + +#endif // TEST_QMAKE_RAWSTRING_OBJECT2_H diff --git a/tests/auto/tools/qmake/testdata/rawString/rawString.pro b/tests/auto/tools/qmake/testdata/rawString/rawString.pro index d2d8132ceb..19c81dfe97 100644 --- a/tests/auto/tools/qmake/testdata/rawString/rawString.pro +++ b/tests/auto/tools/qmake/testdata/rawString/rawString.pro @@ -1,4 +1,4 @@ DESTDIR = ./ -HEADERS += object1.h +HEADERS += object1.h object2.h SOURCES += main.cpp -- cgit v1.2.3 From 7b1a3ba027cf729e2bbc205801595a1d82b75a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 23 Aug 2017 15:22:35 +0200 Subject: Fix QCFType::constructFromGet() crash when passed a nullptr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I83cbbb47af8580fa67cbc75fee07bc1e123895eb Reviewed-by: Simon Hausmann Reviewed-by: Tor Arne Vestbø --- src/corelib/kernel/qcore_mac_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index d0edef33a2..b87babc07a 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -111,7 +111,8 @@ public: template X as() const { return reinterpret_cast(type); } static QCFType constructFromGet(const T &t) { - CFRetain(t); + if (t) + CFRetain(t); return QCFType(t); } protected: -- cgit v1.2.3 From 31190140c3aa11570f4c07ca2cb62b2bfe96a131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 21 Aug 2017 22:36:27 +0200 Subject: iOS: Remove support for OpenGL-backed QBackingStore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default on iOS has been raster for two years now, as of 3e892e4a97, and we haven't seen any major performance regressions that would warrant keeping the OpenGL based code-path alive. This includes the default surface format, which was ony set so that QPainter clip regions would work when using the GL backed backing store. Change-Id: I37b880a758b9c3fad1f23ae60268629ffbe9bc3e Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosbackingstore.h | 9 -- src/plugins/platforms/ios/qiosbackingstore.mm | 139 +++----------------------- src/plugins/platforms/ios/qiosintegration.mm | 5 - 3 files changed, 12 insertions(+), 141 deletions(-) diff --git a/src/plugins/platforms/ios/qiosbackingstore.h b/src/plugins/platforms/ios/qiosbackingstore.h index 1c072c0935..3954347471 100644 --- a/src/plugins/platforms/ios/qiosbackingstore.h +++ b/src/plugins/platforms/ios/qiosbackingstore.h @@ -54,19 +54,10 @@ public: QIOSBackingStore(QWindow *window); ~QIOSBackingStore(); - QPaintDevice *paintDevice() Q_DECL_OVERRIDE; - - void beginPaint(const QRegion &) Q_DECL_OVERRIDE; - void endPaint() Q_DECL_OVERRIDE; - void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE; - void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE; - - void makeCurrent(); private: QOpenGLContext *m_context; - QOpenGLPaintDevice *m_glDevice; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm index 96be28af81..74229684e3 100644 --- a/src/plugins/platforms/ios/qiosbackingstore.mm +++ b/src/plugins/platforms/ios/qiosbackingstore.mm @@ -41,79 +41,31 @@ #include "qioswindow.h" #include -#include -#include -#include -#include #include #include QT_BEGIN_NAMESPACE -class QIOSPaintDevice : public QOpenGLPaintDevice -{ -public: - QIOSPaintDevice(QIOSBackingStore *backingStore) : m_backingStore(backingStore) { } - void ensureActiveTarget() Q_DECL_OVERRIDE; - -private: - QIOSBackingStore *m_backingStore; -}; - -void QIOSPaintDevice::ensureActiveTarget() -{ - m_backingStore->makeCurrent(); -} - /*! \class QIOSBackingStore - \brief The QPlatformBackingStore on iOS. - QBackingStore enables the use of QPainter to paint on a QWindow, as opposed to rendering to a QWindow through the use of OpenGL with QOpenGLContext. - - Historically, the iOS port initially implemented the backing store by using - an QOpenGLPaintDevice as its paint device, triggering the use of the OpenGL - paint engine for QPainter based drawing. This was due to raster drawing - operations being too slow when not being NEON-optimized, and got the port - up and running quickly. - - As of 3e892e4a97, released in Qt 5.7, the backing store now uses a QImage, - for its paint device, giving normal raster-based QPainter operations, and - enabling features such as antialiased drawing. - - To account for regressions in performance, the old code path is still - available by setting the surface type of the QWindow to OpenGLSurface. - This surface type is normally used when rendering though QOpenGLContext, - but will in the case of QIOSBackingStore trigger the old OpenGL based - painter. - - This fallback path is not too intrusive, as the QImage based path still - uses OpenGL to composite the image at flush() time using composeAndFlush. */ QIOSBackingStore::QIOSBackingStore(QWindow *window) : QRasterBackingStore(window) , m_context(new QOpenGLContext) - , m_glDevice(nullptr) { - QSurfaceFormat fmt = window->requestedFormat(); - - // Due to sharing QIOSContext redirects our makeCurrent on window() attempts to - // the global share context. Hence it is essential to have a compatible format. - fmt.setDepthBufferSize(QSurfaceFormat::defaultFormat().depthBufferSize()); - fmt.setStencilBufferSize(QSurfaceFormat::defaultFormat().stencilBufferSize()); - - if (fmt.depthBufferSize() == 0) - qWarning("No depth in default format, expect rendering errors"); - // We use the surface both for raster operations and for GL drawing (when // we blit the raster image), so the type needs to cover both use cases. if (window->surfaceType() == QSurface::RasterSurface) window->setSurfaceType(QSurface::RasterGLSurface); - m_context->setFormat(fmt); + Q_ASSERT_X(window->surfaceType() != QSurface::OpenGLSurface, "QIOSBackingStore", + "QBackingStore on iOS can only be used with raster-enabled surfaces."); + + m_context->setFormat(window->requestedFormat()); m_context->setScreen(window->screen()); Q_ASSERT(QOpenGLContext::globalShareContext()); m_context->setShareContext(QOpenGLContext::globalShareContext()); @@ -122,54 +74,12 @@ QIOSBackingStore::QIOSBackingStore(QWindow *window) QIOSBackingStore::~QIOSBackingStore() { - if (window()->surfaceType() == QSurface::RasterGLSurface) { - // We're using composeAndFlush from QPlatformBackingStore, which - // need to clean up any textures in its destructor, so make the - // context current and keep it alive until QPlatformBackingStore - // has cleaned up everything. - makeCurrent(); - m_context->deleteLater(); - } else { - delete m_context; - } - - delete m_glDevice; -} - -void QIOSBackingStore::makeCurrent() -{ - if (!m_context->makeCurrent(window())) - qWarning("QIOSBackingStore: makeCurrent() failed"); -} - -void QIOSBackingStore::beginPaint(const QRegion ®ion) -{ - makeCurrent(); - - if (!m_glDevice) - m_glDevice = new QIOSPaintDevice(this); - - if (window()->surfaceType() == QSurface::RasterGLSurface) - QRasterBackingStore::beginPaint(region); -} - -void QIOSBackingStore::endPaint() -{ -} - -QPaintDevice *QIOSBackingStore::paintDevice() -{ - Q_ASSERT(m_glDevice); - - // Keep paint device size and device pixel ratio in sync with window - qreal devicePixelRatio = window()->devicePixelRatio(); - m_glDevice->setSize(window()->size() * devicePixelRatio); - m_glDevice->setDevicePixelRatio(devicePixelRatio); - - if (window()->surfaceType() == QSurface::RasterGLSurface) - return QRasterBackingStore::paintDevice(); - else - return m_glDevice; + // We're using composeAndFlush from QPlatformBackingStore, which + // need to clean up any textures in its destructor, so make the + // context current and keep it alive until QPlatformBackingStore + // has cleaned up everything. + m_context->makeCurrent(window()); + m_context->deleteLater(); } void QIOSBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) @@ -187,33 +97,8 @@ void QIOSBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoin return; } - if (window->surfaceType() == QSurface::RasterGLSurface) { - static QPlatformTextureList emptyTextureList; - composeAndFlush(window, region, offset, &emptyTextureList, m_context, false); - } else { - m_context->makeCurrent(window); - m_context->swapBuffers(window); - } -} - -void QIOSBackingStore::resize(const QSize &size, const QRegion &staticContents) -{ - Q_UNUSED(staticContents); - - if (window()->surfaceType() == QSurface::OpenGLSurface) { - // Resizing the backing store would in this case mean resizing the QWindow, - // as we use an QOpenGLPaintDevice that we target at the window. That's - // probably not what the user intended, so we ignore resizes of the backing - // store and always keep the paint device's size in sync with the window - // size in beginPaint(). - - if (size != window()->size() && !window()->inherits("QWidgetWindow")) - qWarning("QIOSBackingStore needs to have the same size as its window"); - - return; - } - - QRasterBackingStore::resize(size, staticContents); + static QPlatformTextureList emptyTextureList; + composeAndFlush(window, region, offset, &emptyTextureList, m_context, false); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 5c42828885..482f996943 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -97,11 +97,6 @@ QIOSIntegration::QIOSIntegration() // The backingstore needs a global share context in order to support composition in // QPlatformBackingStore. qApp->setAttribute(Qt::AA_ShareOpenGLContexts, true); - // And that context must match the format used for the backingstore's context. - QSurfaceFormat fmt = QSurfaceFormat::defaultFormat(); - fmt.setDepthBufferSize(16); - fmt.setStencilBufferSize(8); - QSurfaceFormat::setDefaultFormat(fmt); // Set current directory to app bundle folder QDir::setCurrent(QString::fromUtf8([[[NSBundle mainBundle] bundlePath] UTF8String])); -- cgit v1.2.3 From 8ebfe00f4ab79516a8276929a682c24f4c675b5f Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 21 Aug 2017 14:34:17 +0200 Subject: Initialize the print engine with the given printer name Originally when the QPrinter was created it would create the engine with the default printer and then change it afterwards even though the desired printer may already be known here. So by passing the printer name we ensure that it is initialized with the desired one right away. Task-number: QTBUG-62221 Change-Id: Iaa90243708b57bf89354a527a982ac45c991f603 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/cocoa/qcocoaprintersupport.h | 2 +- src/plugins/platforms/cocoa/qcocoaprintersupport.mm | 4 ++-- src/plugins/platforms/cocoa/qprintengine_mac.mm | 8 ++++++-- src/plugins/platforms/cocoa/qprintengine_mac_p.h | 2 +- src/plugins/printsupport/cups/qcupsprintengine.cpp | 4 ++-- src/plugins/printsupport/cups/qcupsprintengine_p.h | 2 +- src/plugins/printsupport/cups/qcupsprintersupport.cpp | 4 ++-- src/plugins/printsupport/cups/qcupsprintersupport_p.h | 2 +- src/plugins/printsupport/windows/qwindowsprintersupport.cpp | 4 ++-- src/plugins/printsupport/windows/qwindowsprintersupport.h | 2 +- src/printsupport/kernel/qplatformprintersupport.cpp | 2 +- src/printsupport/kernel/qplatformprintersupport.h | 2 +- src/printsupport/kernel/qprintengine_win.cpp | 4 ++-- src/printsupport/kernel/qprintengine_win_p.h | 2 +- src/printsupport/kernel/qprinter.cpp | 3 +-- 15 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaprintersupport.h b/src/plugins/platforms/cocoa/qcocoaprintersupport.h index 371212dae2..a07bf0ec1b 100644 --- a/src/plugins/platforms/cocoa/qcocoaprintersupport.h +++ b/src/plugins/platforms/cocoa/qcocoaprintersupport.h @@ -53,7 +53,7 @@ public: QCocoaPrinterSupport(); ~QCocoaPrinterSupport(); - QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode) Q_DECL_OVERRIDE; + QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) Q_DECL_OVERRIDE; QPaintEngine *createPaintEngine(QPrintEngine *, QPrinter::PrinterMode printerMode) Q_DECL_OVERRIDE; QPrintDevice createPrintDevice(const QString &id) Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/cocoa/qcocoaprintersupport.mm b/src/plugins/platforms/cocoa/qcocoaprintersupport.mm index c2f7d5b022..d7eaa469fb 100644 --- a/src/plugins/platforms/cocoa/qcocoaprintersupport.mm +++ b/src/plugins/platforms/cocoa/qcocoaprintersupport.mm @@ -54,9 +54,9 @@ QCocoaPrinterSupport::QCocoaPrinterSupport() QCocoaPrinterSupport::~QCocoaPrinterSupport() { } -QPrintEngine *QCocoaPrinterSupport::createNativePrintEngine(QPrinter::PrinterMode printerMode) +QPrintEngine *QCocoaPrinterSupport::createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId) { - return new QMacPrintEngine(printerMode); + return new QMacPrintEngine(printerMode, deviceId); } QPaintEngine *QCocoaPrinterSupport::createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode printerMode) diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm index 8098c5e829..c39af870d4 100644 --- a/src/plugins/platforms/cocoa/qprintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm @@ -51,11 +51,15 @@ QT_BEGIN_NAMESPACE extern QMarginsF qt_convertMargins(const QMarginsF &margins, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits); -QMacPrintEngine::QMacPrintEngine(QPrinter::PrinterMode mode) : QPaintEngine(*(new QMacPrintEnginePrivate)) +QMacPrintEngine::QMacPrintEngine(QPrinter::PrinterMode mode, const QString &deviceId) + : QPaintEngine(*(new QMacPrintEnginePrivate)) { Q_D(QMacPrintEngine); d->mode = mode; - d->m_printDevice.reset(new QCocoaPrintDevice(QCocoaPrinterSupport().defaultPrintDeviceId())); + QString id = deviceId; + if (id.isEmpty()) + id = QCocoaPrinterSupport().defaultPrintDeviceId(); + d->m_printDevice.reset(new QCocoaPrintDevice(id)); d->m_pageLayout.setPageSize(d->m_printDevice->defaultPageSize()); d->initialize(); } diff --git a/src/plugins/platforms/cocoa/qprintengine_mac_p.h b/src/plugins/platforms/cocoa/qprintengine_mac_p.h index ee98275b63..2d46a250d5 100644 --- a/src/plugins/platforms/cocoa/qprintengine_mac_p.h +++ b/src/plugins/platforms/cocoa/qprintengine_mac_p.h @@ -78,7 +78,7 @@ class QMacPrintEngine : public QPaintEngine, public QPrintEngine { Q_DECLARE_PRIVATE(QMacPrintEngine) public: - QMacPrintEngine(QPrinter::PrinterMode mode); + QMacPrintEngine(QPrinter::PrinterMode mode, const QString &deviceId); Qt::HANDLE handle() const; diff --git a/src/plugins/printsupport/cups/qcupsprintengine.cpp b/src/plugins/printsupport/cups/qcupsprintengine.cpp index a16eb3abb5..e7949d3a0b 100644 --- a/src/plugins/printsupport/cups/qcupsprintengine.cpp +++ b/src/plugins/printsupport/cups/qcupsprintengine.cpp @@ -57,11 +57,11 @@ QT_BEGIN_NAMESPACE extern QMarginsF qt_convertMargins(const QMarginsF &margins, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits); -QCupsPrintEngine::QCupsPrintEngine(QPrinter::PrinterMode m) +QCupsPrintEngine::QCupsPrintEngine(QPrinter::PrinterMode m, const QString &deviceId) : QPdfPrintEngine(*new QCupsPrintEnginePrivate(m)) { Q_D(QCupsPrintEngine); - d->setupDefaultPrinter(); + d->changePrinter(deviceId); state = QPrinter::Idle; } diff --git a/src/plugins/printsupport/cups/qcupsprintengine_p.h b/src/plugins/printsupport/cups/qcupsprintengine_p.h index 5956c86551..0ebf6e7a0f 100644 --- a/src/plugins/printsupport/cups/qcupsprintengine_p.h +++ b/src/plugins/printsupport/cups/qcupsprintengine_p.h @@ -68,7 +68,7 @@ class QCupsPrintEngine : public QPdfPrintEngine { Q_DECLARE_PRIVATE(QCupsPrintEngine) public: - QCupsPrintEngine(QPrinter::PrinterMode m); + QCupsPrintEngine(QPrinter::PrinterMode m, const QString &deviceId); virtual ~QCupsPrintEngine(); // reimplementations QPdfPrintEngine diff --git a/src/plugins/printsupport/cups/qcupsprintersupport.cpp b/src/plugins/printsupport/cups/qcupsprintersupport.cpp index 1887625406..a9c992a2e1 100644 --- a/src/plugins/printsupport/cups/qcupsprintersupport.cpp +++ b/src/plugins/printsupport/cups/qcupsprintersupport.cpp @@ -63,9 +63,9 @@ QCupsPrinterSupport::~QCupsPrinterSupport() { } -QPrintEngine *QCupsPrinterSupport::createNativePrintEngine(QPrinter::PrinterMode printerMode) +QPrintEngine *QCupsPrinterSupport::createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId) { - return new QCupsPrintEngine(printerMode); + return new QCupsPrintEngine(printerMode, (deviceId.isEmpty() ? defaultPrintDeviceId() : deviceId)); } QPaintEngine *QCupsPrinterSupport::createPaintEngine(QPrintEngine *engine, QPrinter::PrinterMode printerMode) diff --git a/src/plugins/printsupport/cups/qcupsprintersupport_p.h b/src/plugins/printsupport/cups/qcupsprintersupport_p.h index 13f64b5e69..df6507d324 100644 --- a/src/plugins/printsupport/cups/qcupsprintersupport_p.h +++ b/src/plugins/printsupport/cups/qcupsprintersupport_p.h @@ -64,7 +64,7 @@ public: QCupsPrinterSupport(); ~QCupsPrinterSupport(); - QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode) Q_DECL_OVERRIDE; + QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) Q_DECL_OVERRIDE; QPaintEngine *createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode) Q_DECL_OVERRIDE; QPrintDevice createPrintDevice(const QString &id) Q_DECL_OVERRIDE; diff --git a/src/plugins/printsupport/windows/qwindowsprintersupport.cpp b/src/plugins/printsupport/windows/qwindowsprintersupport.cpp index 875ee589c7..a7eabc2622 100644 --- a/src/plugins/printsupport/windows/qwindowsprintersupport.cpp +++ b/src/plugins/printsupport/windows/qwindowsprintersupport.cpp @@ -55,9 +55,9 @@ QWindowsPrinterSupport::~QWindowsPrinterSupport() { } -QPrintEngine *QWindowsPrinterSupport::createNativePrintEngine(QPrinter::PrinterMode printerMode) +QPrintEngine *QWindowsPrinterSupport::createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId) { - return new QWin32PrintEngine(printerMode); + return new QWin32PrintEngine(printerMode, deviceId); } QPaintEngine *QWindowsPrinterSupport::createPaintEngine(QPrintEngine *engine, QPrinter::PrinterMode printerMode) diff --git a/src/plugins/printsupport/windows/qwindowsprintersupport.h b/src/plugins/printsupport/windows/qwindowsprintersupport.h index 50db810f34..84b60a8207 100644 --- a/src/plugins/printsupport/windows/qwindowsprintersupport.h +++ b/src/plugins/printsupport/windows/qwindowsprintersupport.h @@ -50,7 +50,7 @@ public: QWindowsPrinterSupport(); ~QWindowsPrinterSupport(); - QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode) Q_DECL_OVERRIDE; + QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) Q_DECL_OVERRIDE; QPaintEngine *createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode) Q_DECL_OVERRIDE; QPrintDevice createPrintDevice(const QString &id) Q_DECL_OVERRIDE; diff --git a/src/printsupport/kernel/qplatformprintersupport.cpp b/src/printsupport/kernel/qplatformprintersupport.cpp index 5397c43b33..388dd5ff8e 100644 --- a/src/printsupport/kernel/qplatformprintersupport.cpp +++ b/src/printsupport/kernel/qplatformprintersupport.cpp @@ -68,7 +68,7 @@ QPlatformPrinterSupport::~QPlatformPrinterSupport() { } -QPrintEngine *QPlatformPrinterSupport::createNativePrintEngine(QPrinter::PrinterMode) +QPrintEngine *QPlatformPrinterSupport::createNativePrintEngine(QPrinter::PrinterMode, const QString &) { return 0; } diff --git a/src/printsupport/kernel/qplatformprintersupport.h b/src/printsupport/kernel/qplatformprintersupport.h index d3da4295a1..6a4246adc0 100644 --- a/src/printsupport/kernel/qplatformprintersupport.h +++ b/src/printsupport/kernel/qplatformprintersupport.h @@ -72,7 +72,7 @@ public: QPlatformPrinterSupport(); virtual ~QPlatformPrinterSupport(); - virtual QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode); + virtual QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()); virtual QPaintEngine *createPaintEngine(QPrintEngine *, QPrinter::PrinterMode printerMode); virtual QPrintDevice createPrintDevice(const QString &id); diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index 37f2290d94..e399118cc9 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -79,7 +79,7 @@ extern QMarginsF qt_convertMargins(const QMarginsF &margins, QPageLayout::Unit f static void draw_text_item_win(const QPointF &_pos, const QTextItemInt &ti, HDC hdc, const QTransform &xform, const QPointF &topLeft); -QWin32PrintEngine::QWin32PrintEngine(QPrinter::PrinterMode mode) +QWin32PrintEngine::QWin32PrintEngine(QPrinter::PrinterMode mode, const QString &deviceId) : QAlphaPaintEngine(*(new QWin32PrintEnginePrivate), PaintEngineFeatures(PrimitiveTransform | PixmapTransform @@ -92,7 +92,7 @@ QWin32PrintEngine::QWin32PrintEngine(QPrinter::PrinterMode mode) d->mode = mode; QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); if (ps) - d->m_printDevice = ps->createDefaultPrintDevice(); + d->m_printDevice = ps->createPrintDevice(deviceId.isEmpty() ? ps->defaultPrintDeviceId() : deviceId); d->m_pageLayout.setPageSize(d->m_printDevice.defaultPageSize()); d->initialize(); } diff --git a/src/printsupport/kernel/qprintengine_win_p.h b/src/printsupport/kernel/qprintengine_win_p.h index 196263df74..876155a3a5 100644 --- a/src/printsupport/kernel/qprintengine_win_p.h +++ b/src/printsupport/kernel/qprintengine_win_p.h @@ -73,7 +73,7 @@ class Q_PRINTSUPPORT_EXPORT QWin32PrintEngine : public QAlphaPaintEngine, public { Q_DECLARE_PRIVATE(QWin32PrintEngine) public: - QWin32PrintEngine(QPrinter::PrinterMode mode); + QWin32PrintEngine(QPrinter::PrinterMode mode, const QString &deviceId); // override QWin32PaintEngine bool begin(QPaintDevice *dev); diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 83ebb15a12..e2138512cc 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -146,7 +146,7 @@ void QPrinterPrivate::initEngines(QPrinter::OutputFormat format, const QPrinterI } if (outputFormat == QPrinter::NativeFormat) { - printEngine = ps->createNativePrintEngine(printerMode); + printEngine = ps->createNativePrintEngine(printerMode, printerName); paintEngine = ps->createPaintEngine(printEngine, printerMode); } else { QPdfPrintEngine *pdfEngine = new QPdfPrintEngine(printerMode); @@ -156,7 +156,6 @@ void QPrinterPrivate::initEngines(QPrinter::OutputFormat format, const QPrinterI use_default_engine = true; had_default_engines = true; - setProperty(QPrintEngine::PPK_PrinterName, printerName); validPrinter = true; } -- cgit v1.2.3 From 75b323c30e56c20ce722985b9c5783d7bf35540b Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 16 Aug 2017 10:03:05 +0700 Subject: QMenuPrivate: Fix implicit type conversion warnings As reported within Qt Creator. Change-Id: I9dc06b9fba52936e01e01fb0e8cdf4b216c46551 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/widgets/widgets/qmenu_p.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 785a9db308..40cbb3b891 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -110,9 +110,9 @@ public: { m_menu = menu; m_uni_directional = menu->style()->styleHint(QStyle::SH_Menu_SubMenuUniDirection, 0, menu); - m_uni_dir_fail_at_count = menu->style()->styleHint(QStyle::SH_Menu_SubMenuUniDirectionFailCount, 0, menu); + m_uni_dir_fail_at_count = short(menu->style()->styleHint(QStyle::SH_Menu_SubMenuUniDirectionFailCount, 0, menu)); m_select_other_actions = menu->style()->styleHint(QStyle::SH_Menu_SubMenuSloppySelectOtherActions, 0 , menu); - m_timeout = menu->style()->styleHint(QStyle::SH_Menu_SubMenuSloppyCloseTimeout); + m_timeout = short(menu->style()->styleHint(QStyle::SH_Menu_SubMenuSloppyCloseTimeout)); m_discard_state_when_entering_parent = menu->style()->styleHint(QStyle::SH_Menu_SubMenuResetWhenReenteringParent); m_dont_start_time_on_leave = menu->style()->styleHint(QStyle::SH_Menu_SubMenuDontStartSloppyOnLeave); reset(); @@ -150,12 +150,12 @@ public: void leave(); void childLeave(); - static float slope(const QPointF &p1, const QPointF &p2) + static qreal slope(const QPointF &p1, const QPointF &p2) { const QPointF slope = p2 - p1; - if (slope.x()== 0) + if (qFuzzyIsNull(slope.x())) return 9999; - return slope.y()/slope.x(); + return slope.y() / slope.x(); } bool checkSlope(qreal oldS, qreal newS, bool wantSteeper) @@ -218,7 +218,7 @@ public: bool slopeTop = checkSlope(prev_slope_top, current_slope_top, sub_menu_top.y() < mousePos.y()); bool slopeBottom = checkSlope(prev_slope_bottom, current_slope_bottom, sub_menu_bottom.y() > mousePos.y()); bool rightDirection = false; - int mouseDir = m_previous_point.y() - mousePos.y(); + int mouseDir = int(m_previous_point.y() - mousePos.y()); if (mouseDir >= 0) { rightDirection = rightDirection || slopeTop; } -- cgit v1.2.3 From dbaa4de28e5cdfa1787af77d236586833786ee61 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 21 Aug 2017 11:23:14 +0200 Subject: Cocoa: Fix compile when using QT_NO_TABLETEVENT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I76f08d747009a5bf2c0e8004c3443e16e83b6a7d Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qnsview.h | 2 ++ src/plugins/platforms/cocoa/qnsview.mm | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index a78151ebbe..c37c45ce80 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -133,9 +133,11 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); - (void)otherMouseUp:(NSEvent *)theEvent; - (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent; +#ifndef QT_NO_TABLETEVENT - (bool)handleTabletEvent: (NSEvent *)theEvent; - (void)tabletPoint: (NSEvent *)theEvent; - (void)tabletProximity: (NSEvent *)theEvent; +#endif - (int) convertKeyCode : (QChar)keyCode; + (Qt::KeyboardModifiers) convertKeyModifiers : (ulong)modifierFlags; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index e6d513bb89..a40bdfd314 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -644,10 +644,12 @@ static bool _q_dontOverrideCtrlLMB = false; if (!m_platformWindow) return; +#ifndef QT_NO_TABLETEVENT // Tablet events may come in via the mouse event handlers, // check if this is a valid tablet event first. if ([self handleTabletEvent: theEvent]) return; +#endif QPointF qtWindowPoint; QPointF qtScreenPoint; @@ -1041,6 +1043,7 @@ static bool _q_dontOverrideCtrlLMB = false; m_platformWindow->m_enterLeaveTargetWindow = 0; } +#ifndef QT_NO_TABLETEVENT struct QCocoaTabletDeviceData { QTabletEvent::TabletDevice device; @@ -1211,6 +1214,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) QWindowSystemInterface::handleTabletLeaveProximityEvent(timestamp, deviceData.device, deviceData.pointerType, deviceData.uid); } } +#endif - (bool)shouldSendSingleTouch { -- cgit v1.2.3 From ab323c5bf488db20750407abd4cdb93b894803ce Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 18 Aug 2017 15:43:37 +0200 Subject: Append the QMAKE_EXTRA_ARGS to the output instead of overwriting it When QMAKE_* variable assignments were passed to the configure line they would cause the current contents of the private pro output to be overwritten. This would cause anything added to it before the QMAKE_* variable assignments to be parsed to be lost. Change-Id: Idcb8cad5f07cbb96b4da204384f5618b95b375b0 Reviewed-by: Oswald Buddenhagen --- configure.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.pri b/configure.pri index 76bb27e4ae..83c0dee141 100644 --- a/configure.pri +++ b/configure.pri @@ -1041,7 +1041,7 @@ defineTest(qtConfOutput_gccSysroot) { defineTest(qtConfOutput_qmakeArgs) { !$${2}: return() - $${currentConfig}.output.privatePro = "!host_build|!cross_compile {" + $${currentConfig}.output.privatePro += "!host_build|!cross_compile {" for (a, config.input.qmakeArgs) { $${currentConfig}.output.privatePro += " $$a" EXTRA_QMAKE_ARGS += $$system_quote($$a) -- cgit v1.2.3 From d293f071f5b5c4bdafa4bfcf55c778d09bf9661d Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 17 Aug 2017 06:21:08 +0200 Subject: Add missing #ifdef for isTouchScreen() implementation The definition of isTouchScreen() is protected with XCB_USE_XINPUT22 so the implementation needs to have this too. Task-number: QTBUG-62226 Change-Id: Icc3de01a6cb1299b43e56fc9f77833764131ca4b Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 38ea2d9ab9..6f20ec25e3 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -1028,12 +1028,14 @@ Qt::MouseButton QXcbConnection::xiToQtMouseButton(uint32_t b) return Qt::NoButton; } +#ifdef XCB_USE_XINPUT22 bool QXcbConnection::isTouchScreen(int id) const { auto device = m_touchDevices.value(id); return device && device->qtTouchDevice && device->qtTouchDevice->type() == QTouchDevice::TouchScreen; } +#endif #if QT_CONFIG(tabletevent) static QTabletEvent::TabletDevice toolIdToTabletDevice(quint32 toolId) { -- cgit v1.2.3 From eb0ba90b0af9fa7d5b70c74140f64295f2d05c18 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 10 Aug 2017 20:53:15 +0200 Subject: qmake: make yet more use of ProString::toQStringRef() in most cases, the main advantage is not using toQString(m_tmp), which reduces the possibility of raw data leaks. in cases where we used toQString() without temporary, this is a slight optimization. Change-Id: Ib343acffd383aa2c4fefab75fb52762fb534dfc6 Reviewed-by: Joerg Bornemann --- qmake/library/proitems.cpp | 7 ++++++- qmake/library/proitems.h | 6 ++++-- qmake/library/qmakebuiltins.cpp | 12 ++++++------ qmake/library/qmakeevaluator.cpp | 10 +++++----- qmake/library/qmakeevaluator_p.h | 2 +- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/qmake/library/proitems.cpp b/qmake/library/proitems.cpp index 1744304c67..8bbde9f8c0 100644 --- a/qmake/library/proitems.cpp +++ b/qmake/library/proitems.cpp @@ -74,6 +74,11 @@ ProString::ProString(const QString &str) : { } +ProString::ProString(const QStringRef &str) : + m_string(*str.string()), m_offset(str.position()), m_length(str.size()), m_file(0), m_hash(0x80000000) +{ +} + ProString::ProString(const char *str, DoPreHashing) : m_string(QString::fromLatin1(str)), m_offset(0), m_length(qstrlen(str)), m_file(0) { @@ -336,7 +341,7 @@ ProString ProString::trimmed() const QTextStream &operator<<(QTextStream &t, const ProString &str) { - t << str.toQString(); // XXX optimize ... somehow + t << str.toQStringRef(); return t; } diff --git a/qmake/library/proitems.h b/qmake/library/proitems.h index 6ce8c98789..5bfacf0b46 100644 --- a/qmake/library/proitems.h +++ b/qmake/library/proitems.h @@ -68,6 +68,7 @@ public: ProString(); ProString(const ProString &other); PROITEM_EXPLICIT ProString(const QString &str); + PROITEM_EXPLICIT ProString(const QStringRef &str); PROITEM_EXPLICIT ProString(const char *str); ProString(const QString &str, int offset, int length); void setValue(const QString &str); @@ -94,6 +95,7 @@ public: bool operator==(const ProString &other) const { return toQStringRef() == other.toQStringRef(); } bool operator==(const QString &other) const { return toQStringRef() == other; } + bool operator==(const QStringRef &other) const { return toQStringRef() == other; } bool operator==(QLatin1String other) const { return toQStringRef() == other; } bool operator==(const char *other) const { return toQStringRef() == QLatin1String(other); } bool operator!=(const ProString &other) const { return !(*this == other); } @@ -203,9 +205,9 @@ Q_DECLARE_TYPEINFO(ProKey, Q_MOVABLE_TYPE); uint qHash(const ProString &str); QString operator+(const ProString &one, const ProString &two); inline QString operator+(const ProString &one, const QString &two) - { return one + ProString(two); } + { return one.toQStringRef() + two; } inline QString operator+(const QString &one, const ProString &two) - { return ProString(one) + two; } + { return one + two.toQStringRef(); } inline QString operator+(const ProString &one, const char *two) { QString ret = one.toQStringRef() + QLatin1String(two); ret.detach(); return ret; } diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 23867d09ee..a6d9df0fb9 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -731,9 +731,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( const QString &sep = (args.count() == 2) ? args.at(1).toQString(m_tmp1) : statics.field_sep; const auto vars = values(map(args.at(0))); for (const ProString &var : vars) { - const auto splits = var.toQString(m_tmp2).split(sep); - for (const QString &splt : splits) - ret << (splt.isSharedWith(m_tmp2) ? var : ProString(splt).setSource(var)); + const auto splits = var.toQStringRef().split(sep); + for (const auto &splt : splits) + ret << ProString(splt).setSource(var); } } break; @@ -1431,7 +1431,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } if (args.count() == 1) return returnBool(isActiveConfig(args.at(0).toQStringRef())); - const QStringList &mutuals = args.at(1).toQString(m_tmp2).split(QLatin1Char('|')); + const auto &mutuals = args.at(1).toQStringRef().split(QLatin1Char('|')); const ProStringList &configs = values(statics.strCONFIG); for (int i = configs.size() - 1; i >= 0; i--) { @@ -1465,7 +1465,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( t ^= 1; } } else { - const QStringList &mutuals = args.at(2).toQString(m_tmp3).split(QLatin1Char('|')); + const auto &mutuals = args.at(2).toQStringRef().split(QLatin1Char('|')); for (int i = l.size() - 1; i >= 0; i--) { const ProString val = l[i]; for (int mut = 0; mut < mutuals.count(); mut++) { @@ -1536,7 +1536,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( return ReturnFalse; } return returnBool(values(map(args.at(0))).join(statics.field_sep) - == args.at(1).toQString(m_tmp1)); + == args.at(1).toQStringRef()); case T_CLEAR: { if (args.count() != 1) { evalError(fL1S("%1(variable) requires one argument.") diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index a07f84e242..8c93448d51 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -775,7 +775,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop( } infinite = true; } else { - const QString &itl = it_list.toQString(m_tmp1); + const QStringRef &itl = it_list.toQStringRef(); int dotdot = itl.indexOf(statics.strDotDot); if (dotdot != -1) { bool ok; @@ -872,13 +872,13 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable( ProStringList varVal; if (expandVariableReferences(tokPtr, sizeHint, &varVal, true) == ReturnError) return ReturnError; - const QString &val = varVal.at(0).toQString(m_tmp1); + const QStringRef &val = varVal.at(0).toQStringRef(); if (val.length() < 4 || val.at(0) != QLatin1Char('s')) { evalError(fL1S("The ~= operator can handle only the s/// function.")); return ReturnTrue; } QChar sep = val.at(1); - QStringList func = val.split(sep); + auto func = val.split(sep); if (func.count() < 3 || func.count() > 4) { evalError(fL1S("The s/// function expects 3 or 4 arguments.")); return ReturnTrue; @@ -890,8 +890,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable( case_sense = func[3].indexOf(QLatin1Char('i')) == -1; quote = func[3].indexOf(QLatin1Char('q')) != -1; } - QString pattern = func[1]; - QString replace = func[2]; + QString pattern = func[1].toString(); + QString replace = func[2].toString(); if (quote) pattern = QRegExp::escape(pattern); diff --git a/qmake/library/qmakeevaluator_p.h b/qmake/library/qmakeevaluator_p.h index 42aaef70c3..f386a49108 100644 --- a/qmake/library/qmakeevaluator_p.h +++ b/qmake/library/qmakeevaluator_p.h @@ -43,7 +43,7 @@ r == ReturnNext ? "next" : \ r == ReturnReturn ? "return" : \ "") -# define dbgKey(s) qPrintable(s.toString().toQString()) +# define dbgKey(s) s.toString().toQStringRef().toLocal8Bit().constData() # define dbgStr(s) qPrintable(formatValue(s, true)) # define dbgStrList(s) qPrintable(formatValueList(s)) # define dbgSepStrList(s) qPrintable(formatValueList(s, true)) -- cgit v1.2.3 From 5131bb9bed3af7a2ecfce27af3940ff11ed219c2 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 11 Aug 2017 13:24:43 +0200 Subject: qmake: fix excessive detaching of raw data ... in $$basename(), $$dirname(), and contains(). the latter case is marginal, as it only applies to mutuals which are regexes, which i don't remember ever seeing used. QRegExp saves a copy of the matched string, so it's necessary to alternate between two temporaries to avoid detaching. we already did that in most places. Change-Id: I97b8294585c17c76d1756f83971f42cb88353af0 Reviewed-by: Joerg Bornemann --- qmake/library/qmakebuiltins.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index a6d9df0fb9..211b3d3f02 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -585,8 +585,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( if (regexp) { QRegExp sepRx(sep); for (const ProString &str : strings) { - const QString &rstr = str.toQString(m_tmp1).section(sepRx, beg, end); - ret << (rstr.isSharedWith(m_tmp1) ? str : ProString(rstr).setSource(str)); + const QString &rstr = str.toQString(m_tmp[m_toggle ^= 1]).section(sepRx, beg, end); + ret << (rstr.isSharedWith(m_tmp[m_toggle]) ? str : ProString(rstr).setSource(str)); } } else { for (const ProString &str : strings) { @@ -1471,7 +1471,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( for (int mut = 0; mut < mutuals.count(); mut++) { if (val == mutuals[mut].trimmed()) { return returnBool((!regx.isEmpty() - && regx.exactMatch(val.toQString(m_tmp2))) + && regx.exactMatch(val.toQString(m_tmp[m_toggle ^= 1]))) || val == qry); } } -- cgit v1.2.3 From ccb8afcda752093bfb6bc32f560131a91bd826a1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 11 Aug 2017 14:55:37 +0200 Subject: qmake: fix raw data detach avoidance the m_tmp array is a member, so the index toggle for accessing it also needs to be one - otherwise, odd iteration counts will defeat the mechanism. Change-Id: If7a800ed5a4b4168625daf1ebbd5d2d164569d8e Reviewed-by: Joerg Bornemann --- qmake/library/qmakebuiltins.cpp | 12 +++--------- qmake/library/qmakeevaluator.cpp | 5 ++--- qmake/library/qmakeevaluator.h | 1 + 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 211b3d3f02..a41aa8dfc8 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -884,12 +884,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( evalError(fL1S("find(var, str) requires two arguments.")); } else { QRegExp regx(args.at(1).toQString()); - int t = 0; const auto vals = values(map(args.at(0))); for (const ProString &val : vals) { - if (regx.indexIn(val.toQString(m_tmp[t])) != -1) + if (regx.indexIn(val.toQString(m_tmp[m_toggle ^= 1])) != -1) ret += val; - t ^= 1; } } break; @@ -1387,12 +1385,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( copy.detach(); regx.setPattern(copy); } - int t = 0; const auto strings = vars.value(map(args.at(1))); for (const ProString &s : strings) { - if ((!regx.isEmpty() && regx.exactMatch(s.toQString(m_tmp[t]))) || s == qry) + if ((!regx.isEmpty() && regx.exactMatch(s.toQString(m_tmp[m_toggle ^= 1]))) || s == qry) return ReturnTrue; - t ^= 1; } } return ReturnFalse; @@ -1457,12 +1453,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } const ProStringList &l = values(map(args.at(0))); if (args.count() == 2) { - int t = 0; for (int i = 0; i < l.size(); ++i) { const ProString &val = l[i]; - if ((!regx.isEmpty() && regx.exactMatch(val.toQString(m_tmp[t]))) || val == qry) + if ((!regx.isEmpty() && regx.exactMatch(val.toQString(m_tmp[m_toggle ^= 1]))) || val == qry) return ReturnTrue; - t ^= 1; } } else { const auto &mutuals = args.at(2).toQStringRef().split(QLatin1Char('|')); diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 8c93448d51..80cde1f6d0 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -226,6 +226,7 @@ QMakeEvaluator::QMakeEvaluator(QMakeGlobals *option, QMakeParser *parser, QMakeV m_skipLevel = 0; #endif m_listCount = 0; + m_toggle = 0; m_valuemapStack.push(ProValueMap()); m_valuemapInited = false; } @@ -1638,12 +1639,10 @@ bool QMakeEvaluator::isActiveConfig(const QStringRef &config, bool regex) return true; // CONFIG variable - int t = 0; const auto configValues = values(statics.strCONFIG); for (const ProString &configValue : configValues) { - if (re.exactMatch(configValue.toQString(m_tmp[t]))) + if (re.exactMatch(configValue.toQString(m_tmp[m_toggle ^= 1]))) return true; - t ^= 1; } } else { // mkspecs diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h index fcac0388c7..5b346bd45e 100644 --- a/qmake/library/qmakeevaluator.h +++ b/qmake/library/qmakeevaluator.h @@ -286,6 +286,7 @@ public: QString m_outputDir; int m_listCount; + int m_toggle; bool m_valuemapInited; bool m_hostBuild; QString m_qmakespec; -- cgit v1.2.3 From ce5e6876d4a191087969134e489db99cf167ca69 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 11 Aug 2017 12:16:57 +0200 Subject: qmake: make more use of ProString built-ins saves some noisy toQString() uses. Change-Id: I62a9e2725c4baabac311124d19c7d8b40f54c8f7 Reviewed-by: Joerg Bornemann --- qmake/generators/mac/pbuilder_pbx.cpp | 2 +- qmake/library/qmakebuiltins.cpp | 22 ++++++++++------------ qmake/library/qmakeevaluator.cpp | 10 ++++------ 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index ab699157ca..63926e7ef0 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1902,7 +1902,7 @@ int ProjectBuilderMakefileGenerator::pbuilderVersion() const { if (!project->isEmpty("QMAKE_PBUILDER_VERSION")) - return project->first("QMAKE_PBUILDER_VERSION").toQString().toInt(); + return project->first("QMAKE_PBUILDER_VERSION").toInt(); return 46; // Xcode 3.2-compatible; default format since that version } diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index a41aa8dfc8..b8b2c97c5b 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -1763,13 +1763,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( if (args.count() >= 3) { const auto opts = split_value_list(args.at(2).toQStringRef()); for (const ProString &opt : opts) { - opt.toQString(m_tmp3); - if (m_tmp3 == QLatin1String("append")) { + if (opt == QLatin1String("append")) { mode = QIODevice::Append; - } else if (m_tmp3 == QLatin1String("exe")) { + } else if (opt == QLatin1String("exe")) { exe = true; } else { - evalError(fL1S("write_file(): invalid flag %1.").arg(m_tmp3)); + evalError(fL1S("write_file(): invalid flag %1.").arg(opt.toQString(m_tmp3))); return ReturnFalse; } } @@ -1807,21 +1806,20 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( if (args.count() >= 2) { const auto opts = split_value_list(args.at(1).toQStringRef()); for (const ProString &opt : opts) { - opt.toQString(m_tmp3); - if (m_tmp3 == QLatin1String("transient")) { + if (opt == QLatin1String("transient")) { persist = false; - } else if (m_tmp3 == QLatin1String("super")) { + } else if (opt == QLatin1String("super")) { target = TargetSuper; - } else if (m_tmp3 == QLatin1String("stash")) { + } else if (opt == QLatin1String("stash")) { target = TargetStash; - } else if (m_tmp3 == QLatin1String("set")) { + } else if (opt == QLatin1String("set")) { mode = CacheSet; - } else if (m_tmp3 == QLatin1String("add")) { + } else if (opt == QLatin1String("add")) { mode = CacheAdd; - } else if (m_tmp3 == QLatin1String("sub")) { + } else if (opt == QLatin1String("sub")) { mode = CacheSub; } else { - evalError(fL1S("cache(): invalid flag %1.").arg(m_tmp3)); + evalError(fL1S("cache(): invalid flag %1.").arg(opt.toQString(m_tmp3))); return ReturnFalse; } } diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 80cde1f6d0..7d9d6a5d8e 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -973,11 +973,9 @@ void QMakeEvaluator::setTemplate() values.erase(values.begin() + 1, values.end()); } if (!m_option->user_template_prefix.isEmpty()) { - QString val = values.first().toQString(m_tmp1); - if (!val.startsWith(m_option->user_template_prefix)) { - val.prepend(m_option->user_template_prefix); - values = ProStringList(ProString(val)); - } + ProString val = values.first(); + if (!val.startsWith(m_option->user_template_prefix)) + values = ProStringList(ProString(m_option->user_template_prefix + val)); } } @@ -1745,7 +1743,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBoolFunction( if (ret.at(0) == statics.strtrue) return ReturnTrue; bool ok; - int val = ret.at(0).toQString(m_tmp1).toInt(&ok); + int val = ret.at(0).toInt(&ok); if (ok) { if (val) return ReturnTrue; -- cgit v1.2.3 From 9f98935d33cc15c938be2b9295ba2fbe4edb0ee0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 10 Aug 2017 20:55:39 +0200 Subject: qmake: prune obsolete QString::detach() call no m_tmp is involved any more in this code path; it uses QStringRef. amends 11d957d04381. Change-Id: Ib272d61edfb150a549c5e6a9a60d53502702e802 Reviewed-by: Joerg Bornemann --- qmake/library/qmakeevaluator.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 7d9d6a5d8e..3fc8968cbd 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -1628,9 +1628,7 @@ bool QMakeEvaluator::isActiveConfig(const QStringRef &config, bool regex) return m_hostBuild; if (regex && (config.contains(QLatin1Char('*')) || config.contains(QLatin1Char('?')))) { - QString cfg = config.toString(); - cfg.detach(); // Keep m_tmp out of QRegExp's cache - QRegExp re(cfg, Qt::CaseSensitive, QRegExp::Wildcard); + QRegExp re(config.toString(), Qt::CaseSensitive, QRegExp::Wildcard); // mkspecs if (re.exactMatch(m_qmakespecName)) -- cgit v1.2.3 From 14505bbfea220a39c2158480db8ba788707ff332 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 10 Aug 2017 19:59:54 +0200 Subject: qmake: remove seemingly pointless QString::detach() calls it's not clear why detaching would be necessary; there is no danger of a raw data leak here. concatenating a QStringRef with a non-empty QLatin1String (the only expected use of this overload) will yield a detached QString anyway, so this makes little difference in practice. amends f137957e08. Change-Id: I521c0e89a8b0c1ae62b1450e81b0ae91a931bcfa Reviewed-by: Joerg Bornemann --- qmake/library/proitems.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qmake/library/proitems.h b/qmake/library/proitems.h index 5bfacf0b46..8f88883683 100644 --- a/qmake/library/proitems.h +++ b/qmake/library/proitems.h @@ -210,9 +210,9 @@ inline QString operator+(const QString &one, const ProString &two) { return one + two.toQStringRef(); } inline QString operator+(const ProString &one, const char *two) - { QString ret = one.toQStringRef() + QLatin1String(two); ret.detach(); return ret; } + { return one.toQStringRef() + QLatin1String(two); } inline QString operator+(const char *one, const ProString &two) - { QString ret = QLatin1String(one) + two.toQStringRef(); ret.detach(); return ret; } + { return QLatin1String(one) + two.toQStringRef(); } inline QString operator+(const ProString &one, QChar two) { return one.toQStringRef() + two; } inline QString operator+(QChar one, const ProString &two) -- cgit v1.2.3 From 18533ae2a72aba9ad8c0f1862e1e6ace50655864 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 11 Aug 2017 15:52:47 +0200 Subject: qmake: remove pointless use of raw data in $$[QMAKEFEATURES] access property values are de-facto guaranteed to be backed by full QStrings, so there is nothing to be gained from using the raw data optimization, while doing so risks raw data leaks. Change-Id: I3d43da9aaadd4d5811c4b1a9d7ac734049da423c Reviewed-by: Joerg Bornemann --- qmake/library/qmakeevaluator.cpp | 2 +- qmake/library/qmakeevaluator.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 3fc8968cbd..6c8112de57 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -1517,7 +1517,7 @@ void QMakeEvaluator::updateFeaturePaths() feature_roots += m_option->getPathListEnv(QLatin1String("QMAKEFEATURES")); feature_roots += m_qmakefeatures; feature_roots += m_option->splitPathList( - m_option->propertyValue(ProKey("QMAKEFEATURES")).toQString(m_mtmp)); + m_option->propertyValue(ProKey("QMAKEFEATURES")).toQString()); QStringList feature_bases; if (!m_buildRoot.isEmpty()) { diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h index 5b346bd45e..7318664d46 100644 --- a/qmake/library/qmakeevaluator.h +++ b/qmake/library/qmakeevaluator.h @@ -306,7 +306,6 @@ public: ProStringList m_returnValue; ProValueMapStack m_valuemapStack; // VariableName must be us-ascii, the content however can be non-us-ascii. QString m_tmp1, m_tmp2, m_tmp3, m_tmp[2]; // Temporaries for efficient toQString - mutable QString m_mtmp; QMakeGlobals *m_option; QMakeParser *m_parser; -- cgit v1.2.3 From 702be65532263bd52ad0b67235c112083120699e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 11 Aug 2017 14:36:23 +0200 Subject: qmake: fix hypothetical raw data leaks relating to qt i/o classes technically, we should not rely on the i/o classes not storing the strings beyond the instantiated object's life time. Change-Id: I0990769b3cf86860184869036c096c531160e9be Reviewed-by: Joerg Bornemann --- qmake/library/qmakebuiltins.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index b8b2c97c5b..acc1924e80 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -819,7 +819,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( if (args.count() < 1 || args.count() > 2) { evalError(fL1S("cat(file, singleline=true) requires one or two arguments.")); } else { - const QString &file = args.at(0).toQString(m_tmp1); + QString fn = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1))); + fn.detach(); bool blob = false; bool lines = false; @@ -833,7 +834,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( lines = true; } - QFile qfile(resolvePath(m_option->expandEnvVars(file))); + QFile qfile(fn); if (qfile.open(QIODevice::ReadOnly)) { QTextStream stream(&qfile); if (blob) { @@ -908,7 +909,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( lines = true; } int exitCode; - QByteArray bytes = getCommandOutput(args.at(0).toQString(m_tmp2), &exitCode); + QByteArray bytes = getCommandOutput(args.at(0).toQString(), &exitCode); if (args.count() > 2 && !args.at(2).isEmpty()) { m_valuemapStack.top()[args.at(2).toKey()] = ProStringList(ProString(QString::number(exitCode))); @@ -1689,7 +1690,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( #if QT_CONFIG(process) QProcess proc; proc.setProcessChannelMode(QProcess::ForwardedChannels); - runProcess(&proc, args.at(0).toQString(m_tmp2)); + runProcess(&proc, args.at(0).toQString()); return returnBool(proc.exitStatus() == QProcess::NormalExit && proc.exitCode() == 0); #else int ec = system((QLatin1String("cd ") @@ -1726,8 +1727,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( return ReturnTrue; int slsh = file.lastIndexOf(QLatin1Char('/')); QString fn = file.mid(slsh+1); + fn.detach(); if (fn.contains(QLatin1Char('*')) || fn.contains(QLatin1Char('?'))) { QString dirstr = file.left(slsh+1); + dirstr.detach(); if (!QDir(dirstr).entryList(QStringList(fn)).isEmpty()) return ReturnTrue; } @@ -1740,7 +1743,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( return ReturnFalse; } #ifdef PROEVALUATOR_FULL - const QString &fn = resolvePath(args.at(0).toQString(m_tmp1)); + QString fn = resolvePath(args.at(0).toQString(m_tmp1)); + fn.detach(); if (!QDir::current().mkpath(fn)) { evalError(fL1S("Cannot create directory %1.").arg(QDir::toNativeSeparators(fn))); return ReturnFalse; -- cgit v1.2.3 From e8b9a17a3bd770f6bf1bc8f4e0586565acf425e2 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 11 Aug 2017 13:41:39 +0200 Subject: qmake: fix hypothetical raw data leak in $$replace() the replacement value may well constitute the whole output string - this is in fact common, given this rather typical usage pattern: BAR = $$replace(FOO, -flag, -otherflag) this must be considered when constructing the return value. compare 3c8134958c6. as of now, this is irrelevant, as QString::replace(QRegExp, QString) will always memcpy the replacement into a detached copy of the target, but one never knows. Change-Id: Ia1f271f45023746040fc28ce6d88a6609e05e5c2 Reviewed-by: Joerg Bornemann --- qmake/library/qmakebuiltins.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index acc1924e80..1b98cbd909 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -1111,7 +1111,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( QString rstr = val.toQString(m_tmp1); QString copy = rstr; // Force a detach on modify rstr.replace(before, after); - ret << (rstr.isSharedWith(m_tmp1) ? val : ProString(rstr).setSource(val)); + ret << (rstr.isSharedWith(m_tmp1) + ? val + : rstr.isSharedWith(m_tmp2) + ? args.at(2) + : ProString(rstr).setSource(val)); } } break; -- cgit v1.2.3 From 3635b78c548c53d50b98c63b581556e5a2b3b1a4 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 25 Aug 2017 15:15:45 +0300 Subject: QFileInfo: Fix typo in doc Change-Id: Id1051f08a870461b172b646c126eb44e8addc114 Reviewed-by: Thiago Macieira Reviewed-by: Jake Petroules --- src/corelib/io/qfileinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 12fd7d3048..11c1e45e63 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -1117,7 +1117,7 @@ bool QFileInfo::isRoot() const \since 4.2 Returns the absolute path to the file or directory a symlink (or shortcut - on Windows) points to, or a an empty string if the object isn't a symbolic + on Windows) points to, or an empty string if the object isn't a symbolic link. This name may not represent an existing file; it is only a string. -- cgit v1.2.3 From e51dbda0677d9ff4419c9dc70e6209fae194ee02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Sat, 26 Aug 2017 01:23:25 +0200 Subject: Update bundled libpng to version 1.6.32 Also add import script. The remaining diff to clean 1.6.32 is archived in the qtpatches.diff file. [ChangeLog][Third-Party Code] libpng was updated to version 1.6.32 Change-Id: I1b4b78e39a6eb098d1b66c2528e47544bd9e6713 Reviewed-by: Thiago Macieira --- src/3rdparty/libpng/ANNOUNCE | 83 +++++++-- src/3rdparty/libpng/CHANGES | 202 +++++++++++++++++++++- src/3rdparty/libpng/INSTALL | 71 ++++++-- src/3rdparty/libpng/LICENSE | 6 +- src/3rdparty/libpng/README | 18 +- src/3rdparty/libpng/import_from_libpng_tarball.sh | 113 ++++++++++++ src/3rdparty/libpng/libpng-manual.txt | 126 ++++++++++---- src/3rdparty/libpng/png.c | 134 +++++++++++--- src/3rdparty/libpng/png.h | 54 ++++-- src/3rdparty/libpng/pngconf.h | 2 +- src/3rdparty/libpng/pngerror.c | 8 +- src/3rdparty/libpng/pngget.c | 33 +++- src/3rdparty/libpng/pnginfo.h | 8 + src/3rdparty/libpng/pnglibconf.h | 20 +-- src/3rdparty/libpng/pngpread.c | 5 +- src/3rdparty/libpng/pngpriv.h | 152 +++++++++++++--- src/3rdparty/libpng/pngread.c | 26 ++- src/3rdparty/libpng/pngrtran.c | 21 ++- src/3rdparty/libpng/pngrutil.c | 198 +++++++++++++++++---- src/3rdparty/libpng/pngset.c | 63 ++++++- src/3rdparty/libpng/pngstruct.h | 2 +- src/3rdparty/libpng/pngtrans.c | 38 ++-- src/3rdparty/libpng/pngwrite.c | 21 ++- src/3rdparty/libpng/pngwutil.c | 51 ++++-- src/3rdparty/libpng/qt_attribution.json | 2 +- 25 files changed, 1212 insertions(+), 245 deletions(-) create mode 100755 src/3rdparty/libpng/import_from_libpng_tarball.sh diff --git a/src/3rdparty/libpng/ANNOUNCE b/src/3rdparty/libpng/ANNOUNCE index 70a71e3b0e..3cbe5a926e 100644 --- a/src/3rdparty/libpng/ANNOUNCE +++ b/src/3rdparty/libpng/ANNOUNCE @@ -1,4 +1,4 @@ -Libpng 1.6.28 - January 5, 2017 +Libpng 1.6.32 - August 24, 2017 This is a public release of libpng, intended for use in production codes. @@ -7,28 +7,79 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a "configure" script - libpng-1.6.28.tar.xz (LZMA-compressed, recommended) - libpng-1.6.28.tar.gz + libpng-1.6.32.tar.xz (LZMA-compressed, recommended) + libpng-1.6.32.tar.gz Source files with CRLF line endings (for Windows), without the "configure" script - lpng1628.7z (LZMA-compressed, recommended) - lpng1628.zip + lpng1632.7z (LZMA-compressed, recommended) + lpng1632.zip Other information: - libpng-1.6.28-README.txt - libpng-1.6.28-LICENSE.txt - libpng-1.6.28-*.asc (armored detached GPG signatures) - -Changes since the last public release (1.6.27): - Fixed arm/aarch64 detection in CMakeLists.txt (Gianfranco Costamagna). - Added option to Cmake build allowing a custom location of zlib to be - specified in a scenario where libpng is being built as a subproject - alongside zlib by another project (Sam Serrels). - Changed png_ptr->options from a png_byte to png_uint_32, to accomodate - up to 16 options. + libpng-1.6.32-README.txt + libpng-1.6.32-LICENSE.txt + libpng-1.6.32-*.asc (armored detached GPG signatures) + +Changes since the last public release (1.6.31): + Avoid possible NULL dereference in png_handle_eXIf when benign_errors + are allowed. Avoid leaking the input buffer "eXIf_buf". + Eliminated png_ptr->num_exif member from pngstruct.h and added num_exif + to arguments for png_get_eXIf() and png_set_eXIf(). + Added calls to png_handle_eXIf(() in pngread.c and png_write_eXIf() in + pngwrite.c, and made various other fixes to png_write_eXIf(). + Changed name of png_get_eXIF and png_set_eXIf() to png_get_eXIf_1() and + png_set_eXIf_1(), respectively, to avoid breaking API compatibility + with libpng-1.6.31. + Updated contrib/libtests/pngunknown.c with eXIf chunk. + Initialized btoa[] in pngstest.c + Stop memory leak when returning from png_handle_eXIf() with an error + (Bug report from the OSS-fuzz project). + Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf(). + Update libpng.3 and libpng-manual.txt about eXIf functions. + Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability. + Removed png_get_eXIf_1() and png_set_eXIf_1(). + Check length of all chunks except IDAT against user limit to fix an + OSS-fuzz issue. + Check length of IDAT against maximum possible IDAT size, accounting + for height, rowbytes, interlacing and zlib/deflate overhead. + Restored png_get_eXIf_1() and png_set_eXIf_1(), because strlen(eXIf_buf) + does not work (the eXIf chunk data can contain zeroes). + Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation, + no longer using deprecated cmake LOCATION feature (Clifford Yapp). + Fixed five-byte error in the calculation of IDAT maximum possible size. + Moved chunk-length check into a png_check_chunk_length() private + function (Suggested by Max Stepin). + Moved bad pngs from tests to contrib/libtests/crashers + Moved testing of bad pngs into a separate tests/pngtest-badpngs script + Added the --xfail (expected FAIL) option to pngtest.c. It writes XFAIL + in the output but PASS for the libpng test. + Require cmake-3.0.2 in CMakeLists.txt (Clifford Yapp). + Fix "const" declaration info_ptr argument to png_get_eXIf_1() and the + num_exif argument to png_get_eXIf_1() (Github Issue 171). + Added "eXIf" to "chunks_to_ignore[]" in png_set_keep_unknown_chunks(). + Added huge_IDAT.png and empty_ancillary_chunks.png to testpngs/crashers. + Make pngtest --strict, --relax, --xfail options imply -m (multiple). + Removed unused chunk_name parameter from png_check_chunk_length(). + Relocated setting free_me for eXIf data, to stop an OSS-fuzz leak. + Initialize profile_header[] in png_handle_iCCP() to fix OSS-fuzz issue. + Initialize png_ptr->row_buf[0] to 255 in png_read_row() to fix OSS-fuzz UMR. + Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue. + Increase minimum zlib stream from 9 to 14 in png_handle_iCCP(), to account + for the minimum 'deflate' stream, and relocate the test to a point + after the keyword has been read. + Check that the eXIf chunk has at least 2 bytes and begins with "II" or "MM". + Added a set of "huge_xxxx_chunk.png" files to contrib/testpngs/crashers, + one for each known chunk type, with length = 2GB-1. + Check for 0 return from png_get_rowbytes() and added some (size_t) typecasts + in contrib/pngminus/*.c to stop some Coverity issues (162705, 162706, + and 162707). + Renamed chunks in contrib/testpngs/crashers to avoid having files whose + names differ only in case; this causes problems with some platforms + (github issue #172). + Added contrib/oss-fuzz directory which contains files used by the oss-fuzz + project (https://github.com/google/oss-fuzz/tree/master/projects/libpng). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/src/3rdparty/libpng/CHANGES b/src/3rdparty/libpng/CHANGES index 0b5e944ee3..14e60dd269 100644 --- a/src/3rdparty/libpng/CHANGES +++ b/src/3rdparty/libpng/CHANGES @@ -5761,7 +5761,9 @@ Version 1.6.27beta01 [November 2, 2016] if built with zlib-1.2.8.1. Version 1.6.27rc01 [December 27, 2016] - Control ADLER32 checking with new PNG_IGNORE_ADLER32 option. + Control ADLER32 checking with new PNG_IGNORE_ADLER32 option. Fixes + an endless loop when handling erroneous ADLER32 checksums; bug + introduced in libpng-1.6.26. Removed the use of a macro containing the pre-processor 'defined' operator. It is unclear whether this is valid; a macro that "generates" 'defined' is not permitted, but the use of the word @@ -5794,6 +5796,204 @@ Version 1.6.28rc03 [January 4, 2017] Version 1.6.28 [January 5, 2017] No changes. +Version 1.6.29beta01 [January 12, 2017] + Readded "include(GNUInstallDirs)" to CMakeLists.txt (Gianfranco Costamagna). + Moved SSE2 optimization code into the main libpng source directory. + Configure libpng with "configure --enable-intel-sse" or compile + libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it. + Simplified conditional compilation in pngvalid.c, for AIX (Michael Felt). + +Version 1.6.29beta02 [February 22, 2017] + Avoid conditional directives that break statements in pngrutil.c (Romero + Malaquias) + The contrib/examples/pngtopng.c recovery code was in the wrong "if" + branches; the comments were correct. + Added code for PowerPC VSX optimisation (Vadim Barkov). + +Version 1.6.29beta03 [March 1, 2017] + Avoid potential overflow of shift operations in png_do_expand() (Aaron Boxer). + Change test ZLIB_VERNUM >= 0x1281 to ZLIB_VERNUM >= 0x1290 in pngrutil.c + because Solaris 11 distributes zlib-1.2.8.f that is older than 1.2.8.1, + as suggested in zlib FAQ, item 24. + Suppress clang warnings about implicit sign changes in png.c + +Version 1.6.29 [March 16, 2017] + No changes. + +Version 1.6.30beta01 [April 1, 2017] + Added missing "$(CPPFLAGS)" to the compile line for c.pic.o in + makefile.linux and makefile.solaris-x86 (Cosmin). + Revised documentation of png_get_error_ptr() in the libpng manual. + Silence clang -Wcomma and const drop warnings (Viktor Szakats). + Update Sourceforge URLs in documentation (https instead of http). + +Version 1.6.30beta02 [April 22, 2017] + Document need to check for integer overflow when allocating a pixel + buffer for multiple rows in contrib/gregbook, contrib/pngminus, + example.c, and in the manual (suggested by Jaeseung Choi). This + is similar to the bug reported against pngquant in CVE-2016-5735. + Removed reference to the obsolete PNG_SAFE_LIMITS macro in the documentation. + +Version 1.6.30beta03 [May 22, 2017] + Check for integer overflow in contrib/visupng and contrib/tools/genpng. + Do not double evaluate CMAKE_SYSTEM_PROCESSOR in CMakeLists.txt. + Test CMAKE_HOST_WIN32 instead of WIN32 in CMakeLists.txt. + Fix some URL in documentation. + +Version 1.6.30beta04 [June 7, 2017] + Avoid writing an empty IDAT when the last IDAT exactly fills the + compression buffer (bug report by Brian Baird). This bug was + introduced in libpng-1.6.0. + +Version 1.6.30rc01 [June 14, 2017] + No changes. + +Version 1.6.30rc02 [June 25, 2017] + Update copyright year in pnglibconf.h, make ltmain.sh executable. + Add a reference to the libpng.download site in README. + +Version 1.6.30 [June 28, 2017] + No changes. + +Version 1.6.31beta01 [July 5, 2017] + Guard the definition of _POSIX_SOURCE in pngpriv.h (AIX already defines it; + bug report by Michael Felt). + Revised pngpriv.h to work around failure to compile arm/filter_neon.S + ("typedef" directive is unrecognized by the assembler). The problem + was introduced in libpng-1.6.30beta01. + Added "Requires: zlib" to libpng.pc.in (Pieter Neerincx). + Added special case for FreeBSD in arm/filter_neon.S (Maya Rashish). + +Version 1.6.31beta02 [July 8, 2017] + Added instructions for disabling hardware optimizations in INSTALL. + Added "--enable-hardware-optimizations" configuration flag to enable + or disable all hardware optimizations with one flag. + +Version 1.6.31beta03 [July 9, 2017] + Updated CMakeLists.txt to add INTEL_SSE and MIPS_MSA platforms. + Changed "int" to "png_size_t" in intel/filter_sse2.c to prevent + possible integer overflow (Bug report by John Bowler). + Quieted "declaration after statement" warnings in intel/filter_sse2.c. + Added scripts/makefile-linux-opt, which has hardware optimizations enabled. + +Version 1.6.31beta04 [July 11, 2017] + Removed one of the GCC-7.1.0 'strict-overflow' warnings that result when + integers appear on both sides of a compare. Worked around the others by + forcing the strict-overflow setting in the relevant functions to a level + where they are not reported (John Bowler). + Changed "FALL THROUGH" comments to "FALLTHROUGH" because GCC doesn't like + the space. + Worked around some C-style casts from (void*) because g++ 5.4.0 objects + to them. + Increased the buffer size for 'sprint' to pass the gcc 7.1.0 'sprint + overflow' check that is on by default with -Wall -Wextra. + +Version 1.6.31beta05 [July 13, 2017] + Added eXIf chunk support. + +Version 1.6.31beta06 [July 17, 2017] + Added a minimal eXIf chunk (with Orientation and FocalLengthIn35mmFilm + tags) to pngtest.png. + +Version 1.6.31beta07 [July 18, 2017] + Revised the eXIf chunk in pngtest.png to fix "Bad IFD1 Directory" warning. + +Version 1.6.31rc01 [July 19, 2017] + No changes. + +Version 1.6.31rc02 [July 25, 2017] + Fixed typo in example.c (png_free_image should be png_image_free) (Bug + report by John Smith) + +Version 1.6.31 [July 27, 2017] + No changes. + +Version 1.6.32beta01 [July 31, 2017] + Avoid possible NULL dereference in png_handle_eXIf when benign_errors + are allowed. Avoid leaking the input buffer "eXIf_buf". + Eliminated png_ptr->num_exif member from pngstruct.h and added num_exif + to arguments for png_get_eXIf() and png_set_eXIf(). + Added calls to png_handle_eXIf(() in pngread.c and png_write_eXIf() in + pngwrite.c, and made various other fixes to png_write_eXIf(). + Changed name of png_get_eXIF and png_set_eXIf() to png_get_eXIf_1() and + png_set_eXIf_1(), respectively, to avoid breaking API compatibility + with libpng-1.6.31. + +Version 1.6.32beta02 [August 1, 2017] + Updated contrib/libtests/pngunknown.c with eXIf chunk. + +Version 1.6.32beta03 [August 2, 2017] + Initialized btoa[] in pngstest.c + Stop memory leak when returning from png_handle_eXIf() with an error + (Bug report from the OSS-fuzz project). + +Version 1.6.32beta04 [August 2, 2017] + Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf(). + Update libpng.3 and libpng-manual.txt about eXIf functions. + +Version 1.6.32beta05 [August 2, 2017] + Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability. + +Version 1.6.32beta06 [August 2, 2017] + Removed png_get_eXIf_1() and png_set_eXIf_1(). + +Version 1.6.32beta07 [August 3, 2017] + Check length of all chunks except IDAT against user limit to fix an + OSS-fuzz issue. + +Version 1.6.32beta08 [August 3, 2017] + Check length of IDAT against maximum possible IDAT size, accounting + for height, rowbytes, interlacing and zlib/deflate overhead. + Restored png_get_eXIf_1() and png_set_eXIf_1(), because strlen(eXIf_buf) + does not work (the eXIf chunk data can contain zeroes). + +Version 1.6.32beta09 [August 3, 2017] + Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation, + no longer using deprecated cmake LOCATION feature (Clifford Yapp). + Fixed five-byte error in the calculation of IDAT maximum possible size. + +Version 1.6.32beta10 [August 5, 2017] + Moved chunk-length check into a png_check_chunk_length() private + function (Suggested by Max Stepin). + Moved bad pngs from tests to contrib/libtests/crashers + Moved testing of bad pngs into a separate tests/pngtest-badpngs script + Added the --xfail (expected FAIL) option to pngtest.c. It writes XFAIL + in the output but PASS for the libpng test. + Require cmake-3.0.2 in CMakeLists.txt (Clifford Yapp). + Fix "const" declaration info_ptr argument to png_get_eXIf_1() and the + num_exif argument to png_get_eXIf_1() (Github Issue 171). + +Version 1.6.32beta11 [August 7, 2017] + Added "eXIf" to "chunks_to_ignore[]" in png_set_keep_unknown_chunks(). + Added huge_IDAT.png and empty_ancillary_chunks.png to testpngs/crashers. + Make pngtest --strict, --relax, --xfail options imply -m (multiple). + Removed unused chunk_name parameter from png_check_chunk_length(). + Relocated setting free_me for eXIf data, to stop an OSS-fuzz leak. + Initialize profile_header[] in png_handle_iCCP() to fix OSS-fuzz issue. + Initialize png_ptr->row_buf[0] to 255 in png_read_row() to fix OSS-fuzz UMR. + Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue. + Increase minimum zlib stream from 9 to 14 in png_handle_iCCP(), to account + for the minimum 'deflate' stream, and relocate the test to a point + after the keyword has been read. + Check that the eXIf chunk has at least 2 bytes and begins with "II" or "MM". + +Version 1.6.32rc01 [August 18, 2017] + Added a set of "huge_xxxx_chunk.png" files to contrib/testpngs/crashers, + one for each known chunk type, with length = 2GB-1. + Check for 0 return from png_get_rowbytes() and added some (size_t) typecasts + in contrib/pngminus/*.c to stop some Coverity issues (162705, 162706, + and 162707). + Renamed chunks in contrib/testpngs/crashers to avoid having files whose + names differ only in case; this causes problems with some platforms + (github issue #172). + +Version 1.6.32rc02 [August 22, 2017] + Added contrib/oss-fuzz directory which contains files used by the oss-fuzz + project (https://github.com/google/oss-fuzz/tree/master/projects/libpng). + +Version 1.6.32 [August 24, 2017] + No changes. + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement diff --git a/src/3rdparty/libpng/INSTALL b/src/3rdparty/libpng/INSTALL index 58ec0b60a7..e8edb7240f 100644 --- a/src/3rdparty/libpng/INSTALL +++ b/src/3rdparty/libpng/INSTALL @@ -16,10 +16,11 @@ Contents XI. Prepending a prefix to exported symbols XII. Configuring for compiler xxx: XIII. Removing unwanted object code - XIV. Changes to the build and configuration of libpng in libpng-1.5.x - XV. Setjmp/longjmp issues - XVI. Common linking failures - XVII. Other sources of information about libpng + XIV. Enabling or disabling hardware optimizations + XV. Changes to the build and configuration of libpng in libpng-1.5.x + XVI. Setjmp/longjmp issues + XVII. Common linking failures + XVIII. Other sources of information about libpng I. Simple installation @@ -78,8 +79,8 @@ Or you can use one of the "projects" in the "projects" directory. Before installing libpng, you must first install zlib, if it is not already on your system. zlib can usually be found -wherever you got libpng; otherwise go to http://zlib.net. You can place -zlib in the same directory as libpng or in another directory. +wherever you got libpng; otherwise go to https://zlib.net/. You can +place zlib in the same directory as libpng or in another directory. If your system already has a preinstalled zlib you will still need to have access to the zlib.h and zconf.h include files that @@ -281,7 +282,57 @@ library to fail if they call functions not available in your library. The size of the library itself should not be an issue, because only those sections that are actually used will be loaded into memory. -XIV. Changes to the build and configuration of libpng in libpng-1.5.x +XIV. Enabling or disabling hardware optimizations + +Certain hardware capabilites, such as the Intel SSE instructions, +are normally detected at run time. Enable them with configure options +such as one of + + --enable-arm-neon=yes + --enable-mips-msa=yes + --enable-intel-sse=yes + --enable-powerpc-vsx=yes + +or enable them all at once with + + --enable-hardware-optimizations=yes + +or, if you are not using "configure", you can use one +or more of + + CPPFLAGS += "-DPNG_ARM_NEON" + CPPFLAGS += "-DPNG_MIPS_MSA" + CPPFLAGS += "-DPNG_INTEL_SSE" + CPPFLAGS += "-DPNG_POWERPC_VSX" + +See for example scripts/makefile.linux-opt + +If you wish to avoid using them, +you can disable them via the configure option + + --disable-hardware-optimizations + +to disable them all, or + + --enable-intel-sse=no + +to disable a particular one, +or via compiler-command options such as + + CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_OPT=0, + -DPNG_INTEL_SSE_OPT=0, -DPNG_POWERPC_VSX_OPT=0" + +If you are using cmake, hardware optimizations are "on" +by default. To disable them, use + + cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \ + -DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no + +or disable them all at once with + + cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no + +XV. Changes to the build and configuration of libpng in libpng-1.5.x Details of internal changes to the library code can be found in the CHANGES file and in the GIT repository logs. These will be of no concern to the vast @@ -372,7 +423,7 @@ $PREFIX/include directory). Do not edit pnglibconf.h after you have built libpng, because than the settings would not accurately reflect the settings that were used to build libpng. -XV. Setjmp/longjmp issues +XVI. Setjmp/longjmp issues Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp() is known to be not thread-safe on some platforms and we don't know of @@ -390,7 +441,7 @@ This requires setjmp/longjmp, so you must either build the library with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined. -XVI. Common linking failures +XVII. Common linking failures If your application fails to find libpng or zlib entries while linking: @@ -402,7 +453,7 @@ If your application fails to find libpng or zlib entries while linking: If you are using the vstudio project, observe the WARNING in project/vstudio/README.txt. -XVII. Other sources of information about libpng: +XVIII. Other sources of information about libpng: Further information can be found in the README and libpng-manual.txt files, in the individual makefiles, in png.h, and the manual pages diff --git a/src/3rdparty/libpng/LICENSE b/src/3rdparty/libpng/LICENSE index 912552e2af..e803911d37 100644 --- a/src/3rdparty/libpng/LICENSE +++ b/src/3rdparty/libpng/LICENSE @@ -10,7 +10,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.0.7, July 1, 2000 through 1.6.28, January 5, 2017 are +libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals @@ -23,6 +23,8 @@ added to the list of Contributing Authors: Gilles Vollant James Yu Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov and with the following additions to the disclaimer: @@ -128,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and Glenn Randers-Pehrson glennrp at users.sourceforge.net -January 5, 2017 +April 1, 2017 diff --git a/src/3rdparty/libpng/README b/src/3rdparty/libpng/README index 67b579d13c..71292715eb 100644 --- a/src/3rdparty/libpng/README +++ b/src/3rdparty/libpng/README @@ -1,4 +1,4 @@ -README for libpng version 1.6.28 - January 5, 2017 (shared library 16.0) +README for libpng version 1.6.32 - August 24, 2017 (shared library 16.0) See the note about version numbers near the top of png.h See INSTALL for instructions on how to install libpng. @@ -23,7 +23,7 @@ earlier versions if you are using a shared library. The type of the png_uint_32, which will affect shared-library applications that use this function. -To avoid problems with changes to the internals of png info_struct, +To avoid problems with changes to the internals of the png info_struct, new APIs have been made available in 0.95 to avoid direct application access to info_ptr. These functions are the png_set_ and png_get_ functions. These functions should be used when @@ -88,11 +88,11 @@ zlib should be available at the same place that libpng is, or at zlib.net. You may also want a copy of the PNG specification. It is available as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find -these at http://www.libpng.org/pub/png/documents/ +these at http://www.libpng.org/pub/png/pngdocs.html . -This code is currently being archived at libpng.sf.net in the -[DOWNLOAD] area, and at ftp://ftp.simplesystems.org. If you can't find it -in any of those places, e-mail me, and I'll help you find it. +This code is currently being archived at libpng.sourceforge.io in the +[DOWNLOAD] area, and at http://libpng.download/src . If you +can't find it in any of those places, e-mail me, and I'll help you find it. I am not a lawyer, but I believe that the Export Control Classification Number (ECCN) for libpng is EAR99, which means not subject to export @@ -179,14 +179,16 @@ Files in this distribution: pngwtran.c => Write data transformations pngwutil.c => Write utility functions arm => Contains optimized code for the ARM platform + powerpc => Contains optimized code for the PowerPC platform contrib => Contributions arm-neon => Optimized code for ARM-NEON platform + powerpc-vsx => Optimized code for POWERPC-VSX platform examples => Example programs gregbook => source code for PNG reading and writing, from Greg Roelofs' "PNG: The Definitive Guide", O'Reilly, 1999 - intel => Optimized code for INTEL-SSE2 platform libtests => Test programs + mips-msa => Optimized code for MIPS-MSA platform pngminim => Minimal decoder, encoder, and progressive decoder programs demonstrating use of pngusr.dfa pngminus => Simple pnm2png and png2pnm programs @@ -194,6 +196,8 @@ Files in this distribution: testpngs tools => Various tools visupng => Contains a MSVC workspace for VisualPng + intel => Optimized code for INTEL-SSE2 platform + mips => Optimized code for MIPS platform projects => Contains project files and workspaces for building a DLL owatcom => Contains a WATCOM project for building libpng diff --git a/src/3rdparty/libpng/import_from_libpng_tarball.sh b/src/3rdparty/libpng/import_from_libpng_tarball.sh new file mode 100755 index 0000000000..d67b7903a6 --- /dev/null +++ b/src/3rdparty/libpng/import_from_libpng_tarball.sh @@ -0,0 +1,113 @@ +#! /bin/sh +############################################################################# +## +## Copyright (C) 2017 André Klitzing +## Contact: https://www.qt.io/licensing/ +## +## This file is the build configuration utility of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 3 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL3 included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 3 requirements +## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 2.0 or (at your option) the GNU General +## Public license version 3 or any later version approved by the KDE Free +## Qt Foundation. The licenses are as published by the Free Software +## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-2.0.html and +## https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +# This is a small script to copy the required files from a libpng tarball +# into 3rdparty/libpng/ + +if [ $# -ne 2 ]; then + echo "Usage: $0 libpng_tarball_dir/ \$QTDIR/src/3rdparty/libpng/" + exit 1 +fi + +LIBPNG_DIR=$1 +TARGET_DIR=$2 + +if [ ! -d "$LIBPNG_DIR" -o ! -r "$LIBPNG_DIR" -o ! -d "$TARGET_DIR" -o ! -w "$TARGET_DIR" ]; then + echo "Either the libpng source dir or the target dir do not exist," + echo "are not directories or have the wrong permissions." + exit 2 +fi + +# with 1 argument, copies LIBPNG_DIR/$1 to TARGET_DIR/$1 +# with 2 arguments, copies LIBPNG_DIR/$1 to TARGET_DIR/$2 +copy_file() { + if [ $# -lt 1 -o $# -gt 2 ]; then + echo "Wrong number of arguments to copy_file" + exit 3 + fi + + SOURCE_FILE=$1 + if [ -n "$2" ]; then + DEST_FILE=$2 + else + DEST_FILE=$1 + fi + + mkdir -p "$TARGET_DIR/$(dirname "$SOURCE_FILE")" + cp "$LIBPNG_DIR/$SOURCE_FILE" "$TARGET_DIR/$DEST_FILE" +} + +copy_file "scripts/pnglibconf.h.prebuilt" "pnglibconf.h" + +FILES=" + ANNOUNCE + README + CHANGES + LICENSE + INSTALL + libpng-manual.txt + + png.c + pngerror.c + pngget.c + pngmem.c + pngpread.c + pngread.c + pngrio.c + pngrtran.c + pngrutil.c + pngset.c + pngtrans.c + pngwio.c + pngwrite.c + pngwtran.c + pngwutil.c + + png.h + pngpriv.h + pngstruct.h + pnginfo.h + pngconf.h + pngdebug.h +" + +for i in $FILES; do + copy_file "$i" "$i" +done diff --git a/src/3rdparty/libpng/libpng-manual.txt b/src/3rdparty/libpng/libpng-manual.txt index 048ba31c06..e34b1436f5 100644 --- a/src/3rdparty/libpng/libpng-manual.txt +++ b/src/3rdparty/libpng/libpng-manual.txt @@ -1,9 +1,9 @@ libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.28 - January 5, 2017 + libpng version 1.6.32 - August 24, 2017 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2016 Glenn Randers-Pehrson + Copyright (c) 1998-2017 Glenn Randers-Pehrson This document is released under the libpng license. For conditions of distribution and use, see the disclaimer @@ -11,9 +11,9 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.28 - January 5, 2017 + libpng versions 0.97, January 1998, through 1.6.32 - August 24, 2017 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2016 Glenn Randers-Pehrson + Copyright (c) 1998-2017 Glenn Randers-Pehrson libpng 1.0 beta 6 - version 0.96 - May 28, 1997 Updated and distributed by Andreas Dilger @@ -66,17 +66,17 @@ file format in application programs. The PNG specification (second edition), November 2003, is available as a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at -. +. It is technically equivalent to the PNG specification (second edition) but has some additional material. -The PNG-1.0 specification is available as RFC 2083 - and as a -W3C Recommendation . +The PNG-1.0 specification is available as RFC 2083 + and as a +W3C Recommendation . Some additional chunks are described in the special-purpose public chunks documents at @@ -101,7 +101,7 @@ majority of the needs of its users. Libpng uses zlib for its compression and decompression of PNG files. Further information about zlib, and the latest version of zlib, can -be found at the zlib home page, . +be found at the zlib home page, . The zlib compression utility is a general purpose utility that is useful for more than PNG files, and can be used without libpng. See the documentation delivered with zlib for more details. @@ -688,8 +688,9 @@ where 0x7fffffffL means unlimited. You can retrieve this limit with chunk_cache_max = png_get_chunk_cache_max(png_ptr); Libpng imposes a limit of 8 Megabytes (8,000,000 bytes) on the amount of -memory that a compressed chunk other than IDAT can occupy, when decompressed. -You can change this limit with +memory that any chunk other than IDAT can occupy, originally or when +decompressed (prior to libpng-1.6.32 the limit was only applied to compressed +chunks after decompression). You can change this limit with png_set_chunk_malloc_max(png_ptr, user_chunk_malloc_max); @@ -1190,7 +1191,20 @@ row_pointers prior to calling png_read_png() with png_set_rows(png_ptr, info_ptr, &row_pointers); Alternatively you could allocate your image in one big block and define -row_pointers[i] to point into the proper places in your block. +row_pointers[i] to point into the proper places in your block, but first +be sure that your platform is able to allocate such a large buffer: + + /* Guard against integer overflow */ + if (height > PNG_SIZE_MAX/(width*pixel_size)) { + png_error(png_ptr,"image_data buffer would be too large"); + } + + png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size); + + for (int i=0; i PNG_SIZE_MAX/(width*pixel_size)) { + png_error(png_ptr,"image_data buffer would be too large"); + } + Remember: Before you call png_read_update_info(), the png_get_*() functions return the values corresponding to the original PNG image. After you call png_read_update_info the values refer to the image @@ -2470,6 +2504,7 @@ your application instead of by libpng, you can use PNG_INFO_gAMA, PNG_INFO_sBIT, PNG_INFO_cHRM, PNG_INFO_PLTE, PNG_INFO_tRNS, PNG_INFO_bKGD, + PNG_INFO_eXIf, PNG_INFO_hIST, PNG_INFO_pHYs, PNG_INFO_oFFs, PNG_INFO_tIME, PNG_INFO_pCAL, PNG_INFO_sRGB, @@ -3069,6 +3104,11 @@ width, height, bit_depth, and color_type must be the same in each call. single transparent color for non-paletted images (PNG_INFO_tRNS) + png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif); + + exif - Exif profile (array of + png_byte) (PNG_INFO_eXIf) + png_set_hIST(png_ptr, info_ptr, hist); hist - histogram of palette (array of @@ -3824,7 +3864,7 @@ PNG_FORMAT_FLAG_LINEAR flag below. When the simplified API needs to convert between sRGB and linear colorspaces, the actual sRGB transfer curve defined in the sRGB specification (see the -article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 +article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 approximation used elsewhere in libpng. When an alpha channel is present it is expected to denote pixel coverage @@ -4088,7 +4128,7 @@ READ APIs When the simplified API needs to convert between sRGB and linear colorspaces, the actual sRGB transfer curve defined in the sRGB specification (see the -article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 +article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 approximation used elsewhere in libpng. WRITE APIS @@ -4246,8 +4286,6 @@ functions after png_create_*_struct() has been called by calling: png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn); - png_voidp error_ptr = png_get_error_ptr(png_ptr); - If NULL is supplied for either error_fn or warning_fn, then the libpng default function will be used, calling fprintf() and/or longjmp() if a problem is encountered. The replacement error functions should have @@ -4259,6 +4297,11 @@ parameters as follows: void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg); +Then, within your user_error_fn or user_warning_fn, you can retrieve +the error_ptr if you need it, by calling + + png_voidp error_ptr = png_get_error_ptr(png_ptr); + The motivation behind using setjmp() and longjmp() is the C++ throw and catch exception handling methods. This makes the code much easier to write, as there is no need to check every return code of every function call. @@ -4266,7 +4309,7 @@ However, there are some uncertainties about the status of local variables after a longjmp, so the user may want to be careful about doing anything after setjmp returns non-zero besides returning itself. Consult your compiler documentation for more details. For an alternative approach, you -may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net), +may wish to use the "cexcept" facility (see https://cexcept.sourceforge.io/), which is illustrated in pngvalid.c and in contrib/visupng. Beginning in libpng-1.4.0, the png_set_benign_errors() API became available. @@ -4494,7 +4537,7 @@ in a MNG datastream. As a minimum, it must have the MNG 8-byte signature and the MHDR and MEND chunks. Libpng does not provide support for these or any other MNG chunks; your application must provide its own support for them. You may wish to consider using libmng (available at -http://www.libmng.com) instead. +https://www.libmng.com/) instead. VIII. Changes to Libpng from version 0.88 @@ -4917,18 +4960,14 @@ PNG_USER_WIDTH_MAX and PNG_USER_HEIGHT_MAX, although this document said that it could be used to override them. Now this function will reduce or increase the limits. -Starting in libpng-1.5.10, the user limits can be set en masse with the -configuration option PNG_SAFE_LIMITS_SUPPORTED. If this option is enabled, -a set of "safe" limits is applied in pngpriv.h. These can be overridden by -application calls to png_set_user_limits(), png_set_user_chunk_cache_max(), -and/or png_set_user_malloc_max() that increase or decrease the limits. Also, -in libpng-1.5.10 the default width and height limits were increased -from 1,000,000 to 0x7fffffff (i.e., made unlimited). Therefore, the -limits are now - default safe +Starting in libpng-1.5.22, default user limits were established. These +can be overridden by application calls to png_set_user_limits(), +png_set_user_chunk_cache_max(), and/or png_set_user_malloc_max(). +The limits are now + max possible default png_user_width_max 0x7fffffff 1,000,000 png_user_height_max 0x7fffffff 1,000,000 - png_user_chunk_cache_max 0 (unlimited) 128 + png_user_chunk_cache_max 0 (unlimited) 1000 png_user_chunk_malloc_max 0 (unlimited) 8,000,000 The png_set_option() function (and the "options" member of the png struct) was @@ -5178,6 +5217,11 @@ is an error. Previously this requirement of the PNG specification was not enforced, and the palette was always limited to 256 entries. An over-length PLTE chunk found in an input PNG is silently truncated. +Starting with libpng-1.6.31, the eXIf chunk is supported. Libpng does not +attempt to decode the Exif profile; it simply returns a byte array +containing the profile to the calling application which must do its own +decoding. + XIII. Detecting libpng The png_get_io_ptr() function has been present since libpng-0.88, has never @@ -5194,27 +5238,33 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files going back to version 0.70. You can access the git repository (read only) at - git://git.code.sf.net/p/libpng/code + https://github.com/glennrp/libpng or + https://git.code.sf.net/p/libpng/code.git -or you can browse it with a web browser by selecting the "code" button at +or you can browse it with a web browser at - https://sourceforge.net/projects/libpng + https://github.com/glennrp/libpng or + https://sourceforge.net/p/libpng/code/ci/libpng16/tree/ Patches can be sent to glennrp at users.sourceforge.net or to png-mng-implement at lists.sourceforge.net or you can upload them to the libpng bug tracker at - http://libpng.sourceforge.net + https://libpng.sourceforge.io/ + +or as a "pull request" to + + https://github.com/glennrp/libpng/pulls We also accept patches built from the tar or zip distributions, and simple verbal discriptions of bug fixes, reported either to the SourceForge bug tracker, to the png-mng-implement at lists.sf.net -mailing list, or directly to glennrp. +mailing list, as github issues, or directly to glennrp. XV. Coding style Our coding style is similar to the "Allman" style -(See http://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly +(See https://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly braces on separate lines: if (condition) @@ -5315,7 +5365,7 @@ Prior to libpng-1.6.0 we used a "png_sizeof()" macro, formatted as though it were a function. Control keywords if, for, while, and switch are always followed by a space -to distinguish them from function calls, which have no trailing space. +to distinguish them from function calls, which have no trailing space. We put a space after each comma and after each semicolon in "for" statements, and we put spaces before and after each @@ -5341,7 +5391,7 @@ for a few type names that we inherit from zlib.h. We prefer "if (something != 0)" and "if (something == 0)" over "if (something)" and if "(!something)", respectively, and for pointers -we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)". +we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)". We do not use the TAB character for indentation in the C sources. @@ -5355,7 +5405,7 @@ Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.6.28 are Y2K compliant. It is my belief that earlier +upward through 1.6.32 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has two year fields. One is a 2-byte unsigned integer diff --git a/src/3rdparty/libpng/png.c b/src/3rdparty/libpng/png.c index 78ce39f46d..2352df13cb 100644 --- a/src/3rdparty/libpng/png.c +++ b/src/3rdparty/libpng/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.6.28 [January 5, 2017] + * Last changed in libpng 1.6.32 [August 24, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -14,7 +14,27 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_28 Your_png_h_is_not_version_1_6_28; +typedef png_libpng_version_1_6_32 Your_png_h_is_not_version_1_6_32; + +#ifdef __GNUC__ +/* The version tests may need to be added to, but the problem warning has + * consistently been fixed in GCC versions which obtain wide-spread release. + * The problem is that many versions of GCC rearrange comparison expressions in + * the optimizer in such a way that the results of the comparison will change + * if signed integer overflow occurs. Such comparisons are not permitted in + * ANSI C90, however GCC isn't clever enough to work out that that do not occur + * below in png_ascii_from_fp and png_muldiv, so it produces a warning with + * -Wextra. Unfortunately this is highly dependent on the optimizer and the + * machine architecture so the warning comes and goes unpredictably and is + * impossible to "fix", even were that a good idea. + */ +#if __GNUC__ == 7 && __GNUC_MINOR__ == 1 +#define GCC_STRICT_OVERFLOW 1 +#endif /* GNU 7.1.x */ +#endif /* GNU */ +#ifndef GCC_STRICT_OVERFLOW +#define GCC_STRICT_OVERFLOW 0 +#endif /* Tells libpng that we have already handled the first "num_bytes" bytes * of the PNG file signature. If the PNG data is embedded into another @@ -595,6 +615,26 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, } #endif +#ifdef PNG_eXIf_SUPPORTED + /* Free any eXIf entry */ + if (((mask & PNG_FREE_EXIF) & info_ptr->free_me) != 0) + { +# ifdef PNG_READ_eXIf_SUPPORTED + if (info_ptr->eXIf_buf) + { + png_free(png_ptr, info_ptr->eXIf_buf); + info_ptr->eXIf_buf = NULL; + } +# endif + if (info_ptr->exif) + { + png_free(png_ptr, info_ptr->exif); + info_ptr->exif = NULL; + } + info_ptr->valid &= ~PNG_INFO_eXIf; + } +#endif + #ifdef PNG_hIST_SUPPORTED /* Free any hIST entry */ if (((mask & PNG_FREE_HIST) & info_ptr->free_me) != 0) @@ -776,14 +816,14 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.28 - January 5, 2017" PNG_STRING_NEWLINE \ + "libpng version 1.6.32 - August 24, 2017" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \ PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.6.28 - January 5, 2017\ + return "libpng version 1.6.32 - August 24, 2017\ Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; @@ -2832,7 +2872,7 @@ png_pow10(int power) if (power < 0) { if (power < DBL_MIN_10_EXP) return 0; - recip = 1, power = -power; + recip = 1; power = -power; } if (power > 0) @@ -2857,6 +2897,14 @@ png_pow10(int power) /* Function to format a floating point value in ASCII with a given * precision. */ +#if GCC_STRICT_OVERFLOW +#pragma GCC diagnostic push +/* The problem arises below with exp_b10, which can never overflow because it + * comes, originally, from frexp and is therefore limited to a range which is + * typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)). + */ +#pragma GCC diagnostic warning "-Wstrict-overflow=2" +#endif /* GCC_STRICT_OVERFLOW */ void /* PRIVATE */ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, double fp, unsigned int precision) @@ -2910,7 +2958,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, double test = png_pow10(exp_b10+1); if (test <= DBL_MAX) - ++exp_b10, base = test; + { + ++exp_b10; base = test; + } else break; @@ -2924,7 +2974,10 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, * test on DBL_MAX above. */ fp /= base; - while (fp >= 1) fp /= 10, ++exp_b10; + while (fp >= 1) + { + fp /= 10; ++exp_b10; + } /* Because of the code above fp may, at this point, be * less than .1, this is ok because the code below can @@ -2941,7 +2994,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, */ if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */ { - czero = (unsigned int)(-exp_b10); /* PLUS 2 digits: TOTAL 3 */ + czero = 0U-exp_b10; /* PLUS 2 digits: TOTAL 3 */ exp_b10 = 0; /* Dot added below before first output. */ } else @@ -2975,7 +3028,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Rounding up to 10, handle that here. */ if (czero > 0) { - --czero, d = 1; + --czero; d = 1; if (cdigits == 0) --clead; } else @@ -2989,7 +3042,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, else if (ch == 46) { - ch = *--ascii, ++size; + ch = *--ascii; ++size; /* Advance exp_b10 to '1', so that the * decimal point happens after the * previous digit. @@ -3016,7 +3069,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, int ch = *--ascii; if (ch == 46) - ++size, exp_b10 = 1; + { + ++size; exp_b10 = 1; + } /* Else lost a leading zero, so 'exp_b10' is * still ok at (-1) @@ -3052,21 +3107,26 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, */ if (exp_b10 != (-1)) { - if (exp_b10 == 0) *ascii++ = 46, --size; + if (exp_b10 == 0) + { + *ascii++ = 46; --size; + } /* PLUS 1: TOTAL 4 */ --exp_b10; } - *ascii++ = 48, --czero; + *ascii++ = 48; --czero; } if (exp_b10 != (-1)) { if (exp_b10 == 0) - *ascii++ = 46, --size; /* counted above */ + { + *ascii++ = 46; --size; /* counted above */ + } --exp_b10; } - *ascii++ = (char)(48 + (int)d), ++cdigits; + *ascii++ = (char)(48 + (int)d); ++cdigits; } } while (cdigits+czero < precision+clead && fp > DBL_MIN); @@ -3075,7 +3135,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Check for an exponent, if we don't need one we are * done and just need to terminate the string. At - * this point exp_b10==(-1) is effectively if flag - it got + * this point exp_b10==(-1) is effectively a flag - it got * to '-1' because of the decrement after outputting * the decimal point above (the exponent required is * *not* -1!) @@ -3089,7 +3149,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, * zeros were *not* output, so this doesn't increase * the output count. */ - while (--exp_b10 >= 0) *ascii++ = 48; + while (exp_b10-- > 0) *ascii++ = 48; *ascii = 0; @@ -3107,7 +3167,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, */ size -= cdigits; - *ascii++ = 69, --size; /* 'E': PLUS 1 TOTAL 2+precision */ + *ascii++ = 69; --size; /* 'E': PLUS 1 TOTAL 2+precision */ /* The following use of an unsigned temporary avoids ambiguities in * the signed arithmetic on exp_b10 and permits GCC at least to do @@ -3118,12 +3178,12 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, if (exp_b10 < 0) { - *ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */ - uexp_b10 = (unsigned int)(-exp_b10); + *ascii++ = 45; --size; /* '-': PLUS 1 TOTAL 3+precision */ + uexp_b10 = 0U-exp_b10; } else - uexp_b10 = (unsigned int)exp_b10; + uexp_b10 = 0U+exp_b10; cdigits = 0; @@ -3166,6 +3226,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Here on buffer too small. */ png_error(png_ptr, "ASCII conversion buffer too small"); } +#if GCC_STRICT_OVERFLOW +#pragma GCC diagnostic pop +#endif /* GCC_STRICT_OVERFLOW */ # endif /* FLOATING_POINT */ @@ -3185,7 +3248,9 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii, /* Avoid overflow here on the minimum integer. */ if (fp < 0) - *ascii++ = 45, num = (png_uint_32)(-fp); + { + *ascii++ = 45; num = (png_uint_32)(-fp); + } else num = (png_uint_32)fp; @@ -3223,7 +3288,10 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii, * then ndigits digits to first: */ i = 5; - while (ndigits < i) *ascii++ = 48, --i; + while (ndigits < i) + { + *ascii++ = 48; --i; + } while (ndigits >= first) *ascii++ = digits[--ndigits]; /* Don't output the trailing zeros! */ } @@ -3274,6 +3342,15 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text) * the nearest .00001). Overflow and divide by zero are signalled in * the result, a boolean - true on success, false on overflow. */ +#if GCC_STRICT_OVERFLOW /* from above */ +/* It is not obvious which comparison below gets optimized in such a way that + * signed overflow would change the result; looking through the code does not + * reveal any tests which have the form GCC complains about, so presumably the + * optimizer is moving an add or subtract into the 'if' somewhere. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wstrict-overflow=2" +#endif /* GCC_STRICT_OVERFLOW */ int png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times, png_int_32 divisor) @@ -3388,6 +3465,9 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times, return 0; } +#if GCC_STRICT_OVERFLOW +#pragma GCC diagnostic pop +#endif /* GCC_STRICT_OVERFLOW */ #endif /* READ_GAMMA || INCH_CONVERSIONS */ #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED) @@ -4260,13 +4340,13 @@ png_set_option(png_structrp png_ptr, int option, int onoff) if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT && (option & 1) == 0) { - png_uint_32 mask = 3 << option; - png_uint_32 setting = (2 + (onoff != 0)) << option; + png_uint_32 mask = 3U << option; + png_uint_32 setting = (2U + (onoff != 0)) << option; png_uint_32 current = png_ptr->options; png_ptr->options = (png_uint_32)(((current & ~mask) | setting) & 0xff); - return (current & mask) >> option; + return (int)(current & mask) >> option; } return PNG_OPTION_INVALID; @@ -4278,7 +4358,7 @@ png_set_option(png_structrp png_ptr, int option, int onoff) defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) /* sRGB conversion tables; these are machine generated with the code in * contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the - * specification (see the article at http://en.wikipedia.org/wiki/SRGB) + * specification (see the article at https://en.wikipedia.org/wiki/SRGB) * is used, not the gamma=1/2.2 approximation use elsewhere in libpng. * The sRGB to linear table is exact (to the nearest 16-bit linear fraction). * The inverse (linear to sRGB) table has accuracies as follows: diff --git a/src/3rdparty/libpng/png.h b/src/3rdparty/libpng/png.h index e4cf032816..51ac8abe74 100644 --- a/src/3rdparty/libpng/png.h +++ b/src/3rdparty/libpng/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.28, January 5, 2017 + * libpng version 1.6.32, August 24, 2017 * * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -12,7 +12,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.6.28, January 5, 2017: + * libpng versions 0.97, January 1998, through 1.6.32, August 24, 2017: * Glenn Randers-Pehrson. * See also "Contributing Authors", below. */ @@ -25,7 +25,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.0.7, July 1, 2000 through 1.6.28, January 5, 2017 are + * libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are * derived from libpng-1.0.6, and are distributed according to the same * disclaimer and license as libpng-1.0.6 with the following individuals @@ -38,6 +38,8 @@ * Gilles Vollant * James Yu * Mandar Sahastrabuddhe + * Google Inc. + * Vadim Barkov * * and with the following additions to the disclaimer: * @@ -211,7 +213,7 @@ * ... * 1.5.28 15 10527 15.so.15.28[.0] * ... - * 1.6.28 16 10628 16.so.16.28[.0] + * 1.6.32 16 10632 16.so.16.32[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -232,20 +234,20 @@ * * See libpng.txt or libpng.3 for more information. The PNG specification * is available as a W3C Recommendation and as an ISO Specification, - * valid & PNG_INFO_eXIf) != 0 && exif != NULL) + { + *num_exif = info_ptr->num_exif; + *exif = info_ptr->exif; + return (PNG_INFO_eXIf); + } + + return (0); +} +#endif + #ifdef PNG_hIST_SUPPORTED png_uint_32 PNGAPI png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr, diff --git a/src/3rdparty/libpng/pnginfo.h b/src/3rdparty/libpng/pnginfo.h index 361ed8be70..d5f6149dbd 100644 --- a/src/3rdparty/libpng/pnginfo.h +++ b/src/3rdparty/libpng/pnginfo.h @@ -185,6 +185,14 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */ #endif +#ifdef PNG_eXIf_SUPPORTED + int num_exif; /* Added at libpng-1.6.31 */ + png_bytep exif; +# ifdef PNG_READ_eXIf_SUPPORTED + png_bytep eXIf_buf; /* Added at libpng-1.6.32 */ +# endif +#endif + #ifdef PNG_hIST_SUPPORTED /* The hIST chunk contains the relative frequency or importance of the * various palette entries, so that a viewer can intelligently select a diff --git a/src/3rdparty/libpng/pnglibconf.h b/src/3rdparty/libpng/pnglibconf.h index 0dba5055f7..9e45f73129 100644 --- a/src/3rdparty/libpng/pnglibconf.h +++ b/src/3rdparty/libpng/pnglibconf.h @@ -1,8 +1,10 @@ +/* libpng 1.6.32 STANDARD API DEFINITION */ + /* pnglibconf.h - library build configuration */ -/* libpng version 1.6.20 - December 3, 2015 */ +/* Libpng version 1.6.32 - August 24, 2017 */ -/* Copyright (c) 1998-2014 Glenn Randers-Pehrson */ +/* Copyright (c) 1998-2017 Glenn Randers-Pehrson */ /* This code is released under the libpng license. */ /* For conditions of distribution and use, see the disclaimer */ @@ -18,6 +20,8 @@ #define PNG_ALIGNED_MEMORY_SUPPORTED /*#undef PNG_ARM_NEON_API_SUPPORTED*/ /*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/ +/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/ +/*#undef PNG_POWERPC_VSX_CHECK_SUPPORTED*/ #define PNG_BENIGN_ERRORS_SUPPORTED #define PNG_BENIGN_READ_ERRORS_SUPPORTED /*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/ @@ -25,9 +29,7 @@ #define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED #define PNG_COLORSPACE_SUPPORTED #define PNG_CONSOLE_IO_SUPPORTED -#ifndef _WIN32_WCE #define PNG_CONVERT_tIME_SUPPORTED -#endif #define PNG_EASY_ACCESS_SUPPORTED /*#undef PNG_ERROR_NUMBERS_SUPPORTED*/ #define PNG_ERROR_TEXT_SUPPORTED @@ -82,6 +84,7 @@ #define PNG_READ_USER_TRANSFORM_SUPPORTED #define PNG_READ_bKGD_SUPPORTED #define PNG_READ_cHRM_SUPPORTED +#define PNG_READ_eXIf_SUPPORTED #define PNG_READ_gAMA_SUPPORTED #define PNG_READ_hIST_SUPPORTED #define PNG_READ_iCCP_SUPPORTED @@ -101,19 +104,16 @@ #define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED #define PNG_SEQUENTIAL_READ_SUPPORTED #define PNG_SETJMP_SUPPORTED -#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED -#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED #define PNG_SET_OPTION_SUPPORTED #define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED #define PNG_SET_USER_LIMITS_SUPPORTED -#ifndef _WIN32_WCE #define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED #define PNG_SIMPLIFIED_READ_BGR_SUPPORTED #define PNG_SIMPLIFIED_READ_SUPPORTED #define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED #define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED +#define PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED #define PNG_SIMPLIFIED_WRITE_SUPPORTED -#endif #define PNG_STDIO_SUPPORTED #define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED #define PNG_TEXT_SUPPORTED @@ -154,6 +154,7 @@ #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #define PNG_WRITE_bKGD_SUPPORTED #define PNG_WRITE_cHRM_SUPPORTED +#define PNG_WRITE_eXIf_SUPPORTED #define PNG_WRITE_gAMA_SUPPORTED #define PNG_WRITE_hIST_SUPPORTED #define PNG_WRITE_iCCP_SUPPORTED @@ -171,6 +172,7 @@ #define PNG_WRITE_zTXt_SUPPORTED #define PNG_bKGD_SUPPORTED #define PNG_cHRM_SUPPORTED +#define PNG_eXIf_SUPPORTED #define PNG_gAMA_SUPPORTED #define PNG_hIST_SUPPORTED #define PNG_iCCP_SUPPORTED @@ -189,7 +191,6 @@ /* end of options */ /* settings */ #define PNG_API_RULE 0 -#define PNG_COST_SHIFT 3 #define PNG_DEFAULT_READ_MACROS 1 #define PNG_GAMMA_THRESHOLD_FIXED 5000 #define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE @@ -208,7 +209,6 @@ #define PNG_USER_CHUNK_MALLOC_MAX 8000000 #define PNG_USER_HEIGHT_MAX 1000000 #define PNG_USER_WIDTH_MAX 1000000 -#define PNG_WEIGHT_SHIFT 8 #define PNG_ZBUF_SIZE 8192 #define PNG_ZLIB_VERNUM 0 /* unknown */ #define PNG_Z_DEFAULT_COMPRESSION (-1) diff --git a/src/3rdparty/libpng/pngpread.c b/src/3rdparty/libpng/pngpread.c index 650ba1e232..fbe361dc34 100644 --- a/src/3rdparty/libpng/pngpread.c +++ b/src/3rdparty/libpng/pngpread.c @@ -1,8 +1,8 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -189,6 +189,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) png_crc_read(png_ptr, chunk_tag, 4); png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag); png_check_chunk_name(png_ptr, png_ptr->chunk_name); + png_check_chunk_length(png_ptr, png_ptr->push_length); png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; } diff --git a/src/3rdparty/libpng/pngpriv.h b/src/3rdparty/libpng/pngpriv.h index 0a12fb67bd..922fe80c29 100644 --- a/src/3rdparty/libpng/pngpriv.h +++ b/src/3rdparty/libpng/pngpriv.h @@ -1,8 +1,8 @@ /* pngpriv.h - private declarations for use inside libpng * - * Last changed in libpng 1.6.26 [October 20, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -41,7 +41,9 @@ * Windows/Visual Studio) there is no effect; the OS specific tests below are * still required (as of 2011-05-02.) */ -#define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */ +#ifndef _POSIX_SOURCE +# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */ +#endif #ifndef PNG_VERSION_INFO_ONLY /* Standard library headers not required by png.h: */ @@ -196,6 +198,50 @@ # endif #endif +#ifndef PNG_POWERPC_VSX_OPT +# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__) +# define PNG_POWERPC_VSX_OPT 2 +# else +# define PNG_POWERPC_VSX_OPT 0 +# endif +#endif + +#ifndef PNG_INTEL_SSE_OPT +# ifdef PNG_INTEL_SSE + /* Only check for SSE if the build configuration has been modified to + * enable SSE optimizations. This means that these optimizations will + * be off by default. See contrib/intel for more details. + */ +# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \ + defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \ + (defined(_M_IX86_FP) && _M_IX86_FP >= 2) +# define PNG_INTEL_SSE_OPT 1 +# endif +# endif +#endif + +#if PNG_INTEL_SSE_OPT > 0 +# ifndef PNG_INTEL_SSE_IMPLEMENTATION +# if defined(__SSE4_1__) || defined(__AVX__) + /* We are not actually using AVX, but checking for AVX is the best + way we can detect SSE4.1 and SSSE3 on MSVC. + */ +# define PNG_INTEL_SSE_IMPLEMENTATION 3 +# elif defined(__SSSE3__) +# define PNG_INTEL_SSE_IMPLEMENTATION 2 +# elif defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \ + (defined(_M_IX86_FP) && _M_IX86_FP >= 2) +# define PNG_INTEL_SSE_IMPLEMENTATION 1 +# else +# define PNG_INTEL_SSE_IMPLEMENTATION 0 +# endif +# endif + +# if PNG_INTEL_SSE_IMPLEMENTATION > 0 +# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2 +# endif +#endif + #if PNG_MIPS_MSA_OPT > 0 # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa # ifndef PNG_MIPS_MSA_IMPLEMENTATION @@ -216,6 +262,11 @@ # endif #endif /* PNG_MIPS_MSA_OPT > 0 */ +#if PNG_POWERPC_VSX_OPT > 0 +# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx +# define PNG_POWERPC_VSX_IMPLEMENTATION 1 +#endif + /* Is this a build of a DLL where compilation of the object modules requires * different preprocessor settings to those required for a simple library? If @@ -414,6 +465,21 @@ # define png_fixed_error(s1,s2) png_err(s1) #endif +/* Some fixed point APIs are still required even if not exported because + * they get used by the corresponding floating point APIs. This magic + * deals with this: + */ +#ifdef PNG_FIXED_POINT_SUPPORTED +# define PNGFAPI PNGAPI +#else +# define PNGFAPI /* PRIVATE */ +#endif + +#ifndef PNG_VERSION_INFO_ONLY +/* Other defines specific to compilers can go here. Try to keep + * them inside an appropriate ifdef/endif pair for portability. + */ + /* C allows up-casts from (void*) to any pointer and (const void*) to any * pointer to a const object. C++ regards this as a type error and requires an * explicit, static, cast and provides the static_cast<> rune to ensure that @@ -428,25 +494,20 @@ static_cast(static_cast(value)) #else # define png_voidcast(type, value) (value) -# define png_constcast(type, value) ((type)(value)) +# ifdef _WIN64 +# ifdef __GNUC__ + typedef unsigned long long png_ptruint; +# else + typedef unsigned __int64 png_ptruint; +# endif +# else + typedef unsigned long png_ptruint; +# endif +# define png_constcast(type, value) ((type)(png_ptruint)(const void*)(value)) # define png_aligncast(type, value) ((void*)(value)) # define png_aligncastconst(type, value) ((const void*)(value)) #endif /* __cplusplus */ -/* Some fixed point APIs are still required even if not exported because - * they get used by the corresponding floating point APIs. This magic - * deals with this: - */ -#ifdef PNG_FIXED_POINT_SUPPORTED -# define PNGFAPI PNGAPI -#else -# define PNGFAPI /* PRIVATE */ -#endif - -#ifndef PNG_VERSION_INFO_ONLY -/* Other defines specific to compilers can go here. Try to keep - * them inside an appropriate ifdef/endif pair for portability. - */ #if defined(PNG_FLOATING_POINT_SUPPORTED) ||\ defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) /* png.c requires the following ANSI-C constants if the conversion of @@ -795,6 +856,7 @@ #define png_PLTE PNG_U32( 80, 76, 84, 69) #define png_bKGD PNG_U32( 98, 75, 71, 68) #define png_cHRM PNG_U32( 99, 72, 82, 77) +#define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */ #define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */ #define png_gAMA PNG_U32(103, 65, 77, 65) #define png_gIFg PNG_U32(103, 73, 70, 103) @@ -1095,6 +1157,11 @@ PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr, int intent),PNG_EMPTY); #endif +#ifdef PNG_WRITE_eXIf_SUPPORTED +PNG_INTERNAL_FUNCTION(void,png_write_eXIf,(png_structrp png_ptr, + png_bytep exif, int num_exif),PNG_EMPTY); +#endif + #ifdef PNG_WRITE_iCCP_SUPPORTED PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr, png_const_charp name, png_const_bytep profile), PNG_EMPTY); @@ -1270,6 +1337,38 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); #endif +#if PNG_POWERPC_VSX_OPT > 0 +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info, + png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +#endif + +#if PNG_INTEL_SSE_IMPLEMENTATION > 0 +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +#endif + /* Choose the best filter to use and filter the row data */ PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr, png_row_infop row_info),PNG_EMPTY); @@ -1362,6 +1461,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); #endif +#ifdef PNG_READ_eXIf_SUPPORTED +PNG_INTERNAL_FUNCTION(void,png_handle_eXIf,(png_structrp png_ptr, + png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); +#endif + #ifdef PNG_READ_gAMA_SUPPORTED PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); @@ -1437,8 +1541,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); #endif -PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr, - png_uint_32 chunk_name),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr, + const png_uint_32 chunk_name),PNG_EMPTY); + +PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr, + const png_uint_32 chunk_length),PNG_EMPTY); PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY); @@ -2005,6 +2112,11 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon, PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa, (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); #endif + +# if PNG_INTEL_SSE_IMPLEMENTATION > 0 +PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2, + (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); +# endif #endif PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr, diff --git a/src/3rdparty/libpng/pngread.c b/src/3rdparty/libpng/pngread.c index 106a80588c..e34ddd99a0 100644 --- a/src/3rdparty/libpng/pngread.c +++ b/src/3rdparty/libpng/pngread.c @@ -1,8 +1,8 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.6.26 [October 20, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -175,6 +175,11 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr) png_handle_cHRM(png_ptr, info_ptr, length); #endif +#ifdef PNG_READ_eXIf_SUPPORTED + else if (chunk_name == png_eXIf) + png_handle_eXIf(png_ptr, info_ptr, length); +#endif + #ifdef PNG_READ_gAMA_SUPPORTED else if (chunk_name == png_gAMA) png_handle_gAMA(png_ptr, info_ptr, length); @@ -534,6 +539,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row) png_error(png_ptr, "Invalid attempt to read row data"); /* Fill the row with IDAT data: */ + png_ptr->row_buf[0]=255; /* to force error if no data was found */ png_read_IDAT_data(png_ptr, png_ptr->row_buf, row_info.rowbytes + 1); if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE) @@ -842,6 +848,11 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr) png_handle_cHRM(png_ptr, info_ptr, length); #endif +#ifdef PNG_READ_eXIf_SUPPORTED + else if (chunk_name == png_eXIf) + png_handle_eXIf(png_ptr, info_ptr, length); +#endif + #ifdef PNG_READ_gAMA_SUPPORTED else if (chunk_name == png_gAMA) png_handle_gAMA(png_ptr, info_ptr, length); @@ -1883,7 +1894,7 @@ png_create_colormap_entry(png_image_read_control *display, { case 4: entry[afirst ? 0 : 3] = (png_uint_16)alpha; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 3: if (alpha < 65535) @@ -1905,7 +1916,7 @@ png_create_colormap_entry(png_image_read_control *display, case 2: entry[1 ^ afirst] = (png_uint_16)alpha; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 1: if (alpha < 65535) @@ -1934,6 +1945,7 @@ png_create_colormap_entry(png_image_read_control *display, { case 4: entry[afirst ? 0 : 3] = (png_byte)alpha; + /* FALLTHROUGH */ case 3: entry[afirst + (2 ^ bgr)] = (png_byte)blue; entry[afirst + 1] = (png_byte)green; @@ -1942,6 +1954,7 @@ png_create_colormap_entry(png_image_read_control *display, case 2: entry[1 ^ afirst] = (png_byte)alpha; + /* FALLTHROUGH */ case 1: entry[afirst] = (png_byte)green; break; @@ -2861,7 +2874,7 @@ png_image_read_colormap(png_voidp argument) case P_sRGB: /* Change to 8-bit sRGB */ png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB); - /* FALL THROUGH */ + /* FALLTHROUGH */ case P_FILE: if (png_ptr->bit_depth > 8) @@ -3179,8 +3192,7 @@ png_image_read_colormapped(png_voidp argument) image->colormap_entries == 244 /* 216 + 1 + 27 */) break; - /* goto bad_output; */ - /* FALL THROUGH */ + goto bad_output; default: bad_output: diff --git a/src/3rdparty/libpng/pngrtran.c b/src/3rdparty/libpng/pngrtran.c index 0b4f4f9068..9a30ddf22b 100644 --- a/src/3rdparty/libpng/pngrtran.c +++ b/src/3rdparty/libpng/pngrtran.c @@ -1,8 +1,8 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -49,6 +49,7 @@ png_set_crc_action(png_structrp png_ptr, int crit_action, int ancil_action) case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */ png_warning(png_ptr, "Can't discard critical data on CRC error"); + /* FALLTHROUGH */ case PNG_CRC_ERROR_QUIT: /* Error/quit */ case PNG_CRC_DEFAULT: @@ -1253,7 +1254,7 @@ png_init_rgb_transformations(png_structrp png_ptr) default: case 8: - /* FALL THROUGH (Already 8 bits) */ + /* FALLTHROUGH */ /* (Already 8 bits) */ case 16: /* Already a full 16 bits */ @@ -2934,7 +2935,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) * using the equation given in Poynton's ColorFAQ of 1998-01-04 at * (THIS LINK IS DEAD June 2008 but * versions dated 1998 through November 2002 have been archived at - * http://web.archive.org/web/20000816232553/http://www.inforamp.net/ + * https://web.archive.org/web/20000816232553/www.inforamp.net/ * ~poynton/notes/colour_and_gamma/ColorFAQ.txt ) * Charles Poynton poynton at poynton.com * @@ -4302,7 +4303,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row, if (num_trans > 0) { sp = row + (png_size_t)row_width - 1; - dp = row + (png_size_t)(row_width << 2) - 1; + dp = row + ((png_size_t)row_width << 2) - 1; for (i = 0; i < row_width; i++) { @@ -4463,7 +4464,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, { gray = gray & 0xff; sp = row + (png_size_t)row_width - 1; - dp = row + (png_size_t)(row_width << 1) - 1; + dp = row + ((png_size_t)row_width << 1) - 1; for (i = 0; i < row_width; i++) { @@ -4519,7 +4520,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, png_byte green = (png_byte)(trans_color->green & 0xff); png_byte blue = (png_byte)(trans_color->blue & 0xff); sp = row + (png_size_t)row_info->rowbytes - 1; - dp = row + (png_size_t)(row_width << 2) - 1; + dp = row + ((png_size_t)row_width << 2) - 1; for (i = 0; i < row_width; i++) { if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue) @@ -4542,7 +4543,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, png_byte green_low = (png_byte)(trans_color->green & 0xff); png_byte blue_low = (png_byte)(trans_color->blue & 0xff); sp = row + row_info->rowbytes - 1; - dp = row + (png_size_t)(row_width << 3) - 1; + dp = row + ((png_size_t)row_width << 3) - 1; for (i = 0; i < row_width; i++) { if (*(sp - 5) == red_high && @@ -4601,7 +4602,9 @@ png_do_expand_16(png_row_infop row_info, png_bytep row) png_byte *sp = row + row_info->rowbytes; /* source, last byte + 1 */ png_byte *dp = sp + row_info->rowbytes; /* destination, end + 1 */ while (dp > sp) - dp[-2] = dp[-1] = *--sp, dp -= 2; + { + dp[-2] = dp[-1] = *--sp; dp -= 2; + } row_info->rowbytes *= 2; row_info->bit_depth = 16; diff --git a/src/3rdparty/libpng/pngrutil.c b/src/3rdparty/libpng/pngrutil.c index bee0ea1158..a4fa71457b 100644 --- a/src/3rdparty/libpng/pngrutil.c +++ b/src/3rdparty/libpng/pngrutil.c @@ -1,8 +1,8 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.6.27 [January 5, 2017] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -181,6 +181,9 @@ png_read_chunk_header(png_structrp png_ptr) /* Check to see if chunk name is valid. */ png_check_chunk_name(png_ptr, png_ptr->chunk_name); + /* Check for too-large chunk length */ + png_check_chunk_length(png_ptr, length); + #ifdef PNG_IO_STATE_SUPPORTED png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_DATA; #endif @@ -418,7 +421,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED; } -#if ZLIB_VERNUM >= 0x1281 && \ +#if ZLIB_VERNUM >= 0x1290 && \ defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32) if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON) /* Turn off validation of the ADLER32 checksum in IDAT chunks */ @@ -1377,11 +1380,13 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) * chunk is just ignored, so does not invalidate the color space. An * alternative is to set the 'invalid' flags at the start of this routine * and only clear them in they were not set before and all the tests pass. - * The minimum 'deflate' stream is assumed to be just the 2 byte header and - * 4 byte checksum. The keyword must be at least one character and there is - * a terminator (0) byte and the compression method. */ - if (length < 9) + + /* The keyword must be at least one character and there is a + * terminator (0) byte and the compression method byte, and the + * 'zlib' datastream is at least 11 bytes. + */ + if (length < 14) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, "too short"); @@ -1413,6 +1418,16 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) png_crc_read(png_ptr, (png_bytep)keyword, read_length); length -= read_length; + /* The minimum 'zlib' stream is assumed to be just the 2 byte header, + * 5 bytes minimum 'deflate' stream, and the 4 byte checksum. + */ + if (length < 11) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "too short"); + return; + } + keyword_length = 0; while (keyword_length < 80 && keyword_length < read_length && keyword[keyword_length] != 0) @@ -1431,7 +1446,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) if (png_inflate_claim(png_ptr, png_iCCP) == Z_OK) { - Byte profile_header[132]; + Byte profile_header[132]={0}; Byte local_buffer[PNG_INFLATE_BUF_SIZE]; png_alloc_size_t size = (sizeof profile_header); @@ -2009,6 +2024,69 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) } #endif +#ifdef PNG_READ_eXIf_SUPPORTED +void /* PRIVATE */ +png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) +{ + unsigned int i; + + png_debug(1, "in png_handle_eXIf"); + + if ((png_ptr->mode & PNG_HAVE_IHDR) == 0) + png_chunk_error(png_ptr, "missing IHDR"); + + if (length < 2) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "too short"); + return; + } + + else if (info_ptr == NULL || (info_ptr->valid & PNG_INFO_eXIf) != 0) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "duplicate"); + return; + } + + info_ptr->free_me |= PNG_FREE_EXIF; + + info_ptr->eXIf_buf = png_voidcast(png_bytep, + png_malloc_warn(png_ptr, length)); + + if (info_ptr->eXIf_buf == NULL) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "out of memory"); + return; + } + + for (i = 0; i < length; i++) + { + png_byte buf[1]; + png_crc_read(png_ptr, buf, 1); + info_ptr->eXIf_buf[i] = buf[0]; + if (i == 1 && buf[0] != 'M' && buf[0] != 'I' + && info_ptr->eXIf_buf[0] != buf[0]) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "incorrect byte-order specifier"); + png_free(png_ptr, info_ptr->eXIf_buf); + info_ptr->eXIf_buf = NULL; + return; + } + } + + if (png_crc_finish(png_ptr, 0) != 0) + return; + + png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf); + + png_free(png_ptr, info_ptr->eXIf_buf); + info_ptr->eXIf_buf = NULL; +} +#endif + #ifdef PNG_READ_hIST_SUPPORTED void /* PRIVATE */ png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) @@ -2537,6 +2615,9 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) if ((png_ptr->mode & PNG_HAVE_IDAT) != 0) png_ptr->mode |= PNG_AFTER_IDAT; + /* Note, "length" is sufficient here; we won't be adding + * a null terminator later. + */ buffer = png_read_buffer(png_ptr, length, 2/*silent*/); if (buffer == NULL) @@ -2583,23 +2664,28 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) { png_text text; - /* It worked; png_ptr->read_buffer now looks like a tEXt chunk except - * for the extra compression type byte and the fact that it isn't - * necessarily '\0' terminated. - */ - buffer = png_ptr->read_buffer; - buffer[uncompressed_length+(keyword_length+2)] = 0; - - text.compression = PNG_TEXT_COMPRESSION_zTXt; - text.key = (png_charp)buffer; - text.text = (png_charp)(buffer + keyword_length+2); - text.text_length = uncompressed_length; - text.itxt_length = 0; - text.lang = NULL; - text.lang_key = NULL; - - if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0) - errmsg = "insufficient memory"; + if (png_ptr->read_buffer == NULL) + errmsg="Read failure in png_handle_zTXt"; + else + { + /* It worked; png_ptr->read_buffer now looks like a tEXt chunk + * except for the extra compression type byte and the fact that + * it isn't necessarily '\0' terminated. + */ + buffer = png_ptr->read_buffer; + buffer[uncompressed_length+(keyword_length+2)] = 0; + + text.compression = PNG_TEXT_COMPRESSION_zTXt; + text.key = (png_charp)buffer; + text.text = (png_charp)(buffer + keyword_length+2); + text.text_length = uncompressed_length; + text.itxt_length = 0; + text.lang = NULL; + text.lang_key = NULL; + + if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0) + errmsg = "insufficient memory"; + } } else @@ -2975,7 +3061,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, case 2: png_ptr->user_chunk_cache_max = 1; png_chunk_benign_error(png_ptr, "no space in chunk cache"); - /* FALL THROUGH */ + /* FALLTHROUGH */ case 1: /* NOTE: prior to 1.6.0 this case resulted in an unknown critical * chunk being skipped, now there will be a hard error below. @@ -2984,7 +3070,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, default: /* not at limit */ --(png_ptr->user_chunk_cache_max); - /* FALL THROUGH */ + /* FALLTHROUGH */ case 0: /* no limit */ # endif /* USER_LIMITS */ /* Here when the limit isn't reached or when limits are compiled @@ -3035,20 +3121,58 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, */ void /* PRIVATE */ -png_check_chunk_name(png_structrp png_ptr, png_uint_32 chunk_name) +png_check_chunk_name(png_const_structrp png_ptr, const png_uint_32 chunk_name) { int i; + png_uint_32 cn=chunk_name; png_debug(1, "in png_check_chunk_name"); for (i=1; i<=4; ++i) { - int c = chunk_name & 0xff; + int c = cn & 0xff; if (c < 65 || c > 122 || (c > 90 && c < 97)) png_chunk_error(png_ptr, "invalid chunk type"); - chunk_name >>= 8; + cn >>= 8; + } +} + +void /* PRIVATE */ +png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length) +{ + png_alloc_size_t limit = PNG_UINT_31_MAX; + + if (png_ptr->chunk_name != png_IDAT) + { +# ifdef PNG_SET_USER_LIMITS_SUPPORTED + if (png_ptr->user_chunk_malloc_max > 0 && + png_ptr->user_chunk_malloc_max < limit) + limit = png_ptr->user_chunk_malloc_max; +# elif PNG_USER_CHUNK_MALLOC_MAX > 0 + if (PNG_USER_CHUNK_MALLOC_MAX < limit) + limit = PNG_USER_CHUNK_MALLOC_MAX; +# endif + } + else + { + size_t row_factor = + (png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1) + + 1 + (png_ptr->interlaced? 6: 0)); + if (png_ptr->height > PNG_UINT_32_MAX/row_factor) + limit=PNG_UINT_31_MAX; + else + limit = png_ptr->height * row_factor; + limit += 6 + 5*(limit/32566+1); /* zlib+deflate overhead */ + limit=limit < PNG_UINT_31_MAX? limit : PNG_UINT_31_MAX; + } + + if (length > limit) + { + png_debug2(0," length = %lu, limit = %lu", + (unsigned long)length,(unsigned long)limit); + png_chunk_error(png_ptr, "chunk data is too large"); } } @@ -3377,7 +3501,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) */ do { - dp[0] = sp[0], dp[1] = sp[1]; + dp[0] = sp[0]; dp[1] = sp[1]; if (row_width <= bytes_to_jump) return; @@ -3398,7 +3522,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) */ for (;;) { - dp[0] = sp[0], dp[1] = sp[1], dp[2] = sp[2]; + dp[0] = sp[0]; dp[1] = sp[1]; dp[2] = sp[2]; if (row_width <= bytes_to_jump) return; @@ -3887,7 +4011,10 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row, /* Find the best predictor, the least of pa, pb, pc favoring the earlier * ones in the case of a tie. */ - if (pb < pa) pa = pb, a = b; + if (pb < pa) + { + pa = pb; a = b; + } if (pc < pa) a = c; /* Calculate the current pixel in a, and move the previous row pixel to c @@ -3939,7 +4066,10 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row, pc = (p + pc) < 0 ? -(p + pc) : p + pc; #endif - if (pb < pa) pa = pb, a = b; + if (pb < pa) + { + pa = pb; a = b; + } if (pc < pa) a = c; a += *row; diff --git a/src/3rdparty/libpng/pngset.c b/src/3rdparty/libpng/pngset.c index 28ff3a064d..6f3a1ee11e 100644 --- a/src/3rdparty/libpng/pngset.c +++ b/src/3rdparty/libpng/pngset.c @@ -1,8 +1,8 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.6.26 [October 20, 2016] - * Copyright (c) 1998-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -134,6 +134,53 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X, #endif /* cHRM */ +#ifdef PNG_eXIf_SUPPORTED +void PNGAPI +png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, + const png_bytep eXIf_buf) +{ + png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1"); + PNG_UNUSED(info_ptr) + PNG_UNUSED(eXIf_buf) +} + +void PNGAPI +png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr, + const png_uint_32 num_exif, const png_bytep eXIf_buf) +{ + int i; + + png_debug1(1, "in %s storage function", "eXIf"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + if (info_ptr->exif) + { + png_free(png_ptr, info_ptr->exif); + info_ptr->exif = NULL; + } + + info_ptr->num_exif = num_exif; + + info_ptr->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr, + info_ptr->num_exif)); + + if (info_ptr->exif == NULL) + { + png_warning(png_ptr, "Insufficient memory for eXIf chunk data"); + return; + } + + info_ptr->free_me |= PNG_FREE_EXIF; + + for (i = 0; i < (int) info_ptr->num_exif; i++) + info_ptr->exif[i] = eXIf_buf[i]; + + info_ptr->valid |= PNG_INFO_eXIf; +} +#endif /* eXIf */ + #ifdef PNG_gAMA_SUPPORTED void PNGFAPI png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr, @@ -1102,8 +1149,9 @@ png_set_sPLT(png_const_structrp png_ptr, info_ptr->valid |= PNG_INFO_sPLT; ++(info_ptr->splt_palettes_num); ++np; + ++entries; } - while (++entries, --nentries); + while (--nentries); if (nentries > 0) png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR); @@ -1354,6 +1402,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep, static PNG_CONST png_byte chunks_to_ignore[] = { 98, 75, 71, 68, '\0', /* bKGD */ 99, 72, 82, 77, '\0', /* cHRM */ + 101, 88, 73, 102, '\0', /* eXIf */ 103, 65, 77, 65, '\0', /* gAMA */ 104, 73, 83, 84, '\0', /* hIST */ 105, 67, 67, 80, '\0', /* iCCP */ @@ -1696,14 +1745,16 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key) png_byte ch = (png_byte)*key++; if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/)) - *new_key++ = ch, ++key_len, space = 0; + { + *new_key++ = ch; ++key_len; space = 0; + } else if (space == 0) { /* A space or an invalid character when one wasn't seen immediately * before; output just a space. */ - *new_key++ = 32, ++key_len, space = 1; + *new_key++ = 32; ++key_len; space = 1; /* If the character was not a space then it is invalid. */ if (ch != 32) @@ -1716,7 +1767,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key) if (key_len > 0 && space != 0) /* trailing space */ { - --key_len, --new_key; + --key_len; --new_key; if (bad_character == 0) bad_character = 32; } diff --git a/src/3rdparty/libpng/pngstruct.h b/src/3rdparty/libpng/pngstruct.h index 749d7e35b1..d83f971253 100644 --- a/src/3rdparty/libpng/pngstruct.h +++ b/src/3rdparty/libpng/pngstruct.h @@ -1,7 +1,7 @@ /* pngstruct.h - header file for PNG reference library * - * Last changed in libpng 1.6.28 [January 5, 2017] + * Last changed in libpng 1.6.32 [August 24, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) diff --git a/src/3rdparty/libpng/pngtrans.c b/src/3rdparty/libpng/pngtrans.c index da7413fb80..326ac33f0e 100644 --- a/src/3rdparty/libpng/pngtrans.c +++ b/src/3rdparty/libpng/pngtrans.c @@ -1,8 +1,8 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.6.26 [October 20, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.30 [June 28, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -514,11 +514,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */ ++sp; else /* Skip initial channel and, for sp, the filler */ - sp += 2, ++dp; + { + sp += 2; ++dp; + } /* For a 1 pixel wide image there is nothing to do */ while (sp < ep) - *dp++ = *sp, sp += 2; + { + *dp++ = *sp; sp += 2; + } row_info->pixel_depth = 8; } @@ -528,10 +532,14 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */ sp += 2; else /* Skip initial channel and, for sp, the filler */ - sp += 4, dp += 2; + { + sp += 4; dp += 2; + } while (sp < ep) - *dp++ = *sp++, *dp++ = *sp, sp += 3; + { + *dp++ = *sp++; *dp++ = *sp; sp += 3; + } row_info->pixel_depth = 16; } @@ -554,11 +562,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */ ++sp; else /* Skip initial channels and, for sp, the filler */ - sp += 4, dp += 3; + { + sp += 4; dp += 3; + } /* Note that the loop adds 3 to dp and 4 to sp each time. */ while (sp < ep) - *dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2; + { + *dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp; sp += 2; + } row_info->pixel_depth = 24; } @@ -568,14 +580,16 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */ sp += 2; else /* Skip initial channels and, for sp, the filler */ - sp += 8, dp += 6; + { + sp += 8; dp += 6; + } while (sp < ep) { /* Copy 6 bytes, skip 2 */ - *dp++ = *sp++, *dp++ = *sp++; - *dp++ = *sp++, *dp++ = *sp++; - *dp++ = *sp++, *dp++ = *sp, sp += 3; + *dp++ = *sp++; *dp++ = *sp++; + *dp++ = *sp++; *dp++ = *sp++; + *dp++ = *sp++; *dp++ = *sp; sp += 3; } row_info->pixel_depth = 48; diff --git a/src/3rdparty/libpng/pngwrite.c b/src/3rdparty/libpng/pngwrite.c index 07088ee75e..a7662acb71 100644 --- a/src/3rdparty/libpng/pngwrite.c +++ b/src/3rdparty/libpng/pngwrite.c @@ -1,8 +1,8 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.6.26 [October 20, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -237,6 +237,11 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr) png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type); #endif +#ifdef PNG_WRITE_eXIf_SUPPORTED + if ((info_ptr->valid & PNG_INFO_eXIf) != 0) + png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif); +#endif + #ifdef PNG_WRITE_hIST_SUPPORTED if ((info_ptr->valid & PNG_INFO_hIST) != 0) png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette); @@ -432,6 +437,12 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) } } #endif + +#ifdef PNG_WRITE_eXIf_SUPPORTED + if ((info_ptr->valid & PNG_INFO_eXIf) != 0) + png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif); +#endif + #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED write_unknown_chunks(png_ptr, info_ptr, PNG_AFTER_IDAT); #endif @@ -1007,8 +1018,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters) case 5: case 6: case 7: png_app_error(png_ptr, "Unknown row filter for method 0"); - /* FALL THROUGH */ #endif /* WRITE_FILTER */ + /* FALLTHROUGH */ case PNG_FILTER_VALUE_NONE: png_ptr->do_filter = PNG_FILTER_NONE; break; @@ -1875,7 +1886,7 @@ png_image_set_PLTE(png_image_write_control *display) tRNS[i] = entry[afirst ? 0 : 3]; if (tRNS[i] < 255) num_trans = i+1; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 3: palette[i].blue = entry[afirst + (2 ^ bgr)]; palette[i].green = entry[afirst + 1]; @@ -1886,7 +1897,7 @@ png_image_set_PLTE(png_image_write_control *display) tRNS[i] = entry[1 ^ afirst]; if (tRNS[i] < 255) num_trans = i+1; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 1: palette[i].blue = palette[i].red = palette[i].green = entry[afirst]; diff --git a/src/3rdparty/libpng/pngwutil.c b/src/3rdparty/libpng/pngwutil.c index d1a82d45e1..0d4fb1336c 100644 --- a/src/3rdparty/libpng/pngwutil.c +++ b/src/3rdparty/libpng/pngwutil.c @@ -1,8 +1,8 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.6.26 [October 20, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -675,6 +675,7 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, int interlace_type) { png_byte buf[13]; /* Buffer to store the IHDR info */ + int is_invalid_depth; png_debug(1, "in png_write_IHDR"); @@ -700,11 +701,11 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, break; case PNG_COLOR_TYPE_RGB: + is_invalid_depth = (bit_depth != 8); #ifdef PNG_WRITE_16BIT_SUPPORTED - if (bit_depth != 8 && bit_depth != 16) -#else - if (bit_depth != 8) + is_invalid_depth = (is_invalid_depth && bit_depth != 16); #endif + if (is_invalid_depth) png_error(png_ptr, "Invalid bit depth for RGB image"); png_ptr->channels = 3; @@ -726,18 +727,22 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, break; case PNG_COLOR_TYPE_GRAY_ALPHA: - if (bit_depth != 8 && bit_depth != 16) + is_invalid_depth = (bit_depth != 8); +#ifdef PNG_WRITE_16BIT_SUPPORTED + is_invalid_depth = (is_invalid_depth && bit_depth != 16); +#endif + if (is_invalid_depth) png_error(png_ptr, "Invalid bit depth for grayscale+alpha image"); png_ptr->channels = 2; break; case PNG_COLOR_TYPE_RGB_ALPHA: + is_invalid_depth = (bit_depth != 8); #ifdef PNG_WRITE_16BIT_SUPPORTED - if (bit_depth != 8 && bit_depth != 16) -#else - if (bit_depth != 8) + is_invalid_depth = (is_invalid_depth && bit_depth != 16); #endif + if (is_invalid_depth) png_error(png_ptr, "Invalid bit depth for RGBA image"); png_ptr->channels = 4; @@ -998,7 +1003,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, optimize_cmf(data, png_image_size(png_ptr)); #endif - png_write_complete_chunk(png_ptr, png_IDAT, data, size); + if (size > 0) + png_write_complete_chunk(png_ptr, png_IDAT, data, size); png_ptr->mode |= PNG_HAVE_IDAT; png_ptr->zstream.next_out = data; @@ -1044,7 +1050,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, optimize_cmf(data, png_image_size(png_ptr)); #endif - png_write_complete_chunk(png_ptr, png_IDAT, data, size); + if (size > 0) + png_write_complete_chunk(png_ptr, png_IDAT, data, size); png_ptr->zstream.avail_out = 0; png_ptr->zstream.next_out = NULL; png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT; @@ -1466,6 +1473,28 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type) } #endif +#ifdef PNG_WRITE_eXIf_SUPPORTED +/* Write the Exif data */ +void /* PRIVATE */ +png_write_eXIf(png_structrp png_ptr, png_bytep exif, int num_exif) +{ + int i; + png_byte buf[1]; + + png_debug(1, "in png_write_eXIf"); + + png_write_chunk_header(png_ptr, png_eXIf, (png_uint_32)(num_exif)); + + for (i = 0; i < num_exif; i++) + { + buf[0] = exif[i]; + png_write_chunk_data(png_ptr, buf, (png_size_t)1); + } + + png_write_chunk_end(png_ptr); +} +#endif + #ifdef PNG_WRITE_hIST_SUPPORTED /* Write the histogram */ void /* PRIVATE */ diff --git a/src/3rdparty/libpng/qt_attribution.json b/src/3rdparty/libpng/qt_attribution.json index 5affffd298..7b2d776978 100644 --- a/src/3rdparty/libpng/qt_attribution.json +++ b/src/3rdparty/libpng/qt_attribution.json @@ -6,7 +6,7 @@ "Description": "libpng is the official PNG reference library.", "Homepage": "http://www.libpng.org/pub/png/libpng.html", - "Version": "1.6.28", + "Version": "1.6.32", "License": "libpng License", "LicenseId": "Libpng", "LicenseFile": "LICENSE", -- cgit v1.2.3 From 0f11fab6f75dec78d3721280971448cc2edd6e72 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sat, 26 Aug 2017 23:02:07 +0300 Subject: Fix resolution of relative symlinks from relative path on unix Consider the following: /root/target - a file /root/path/link -> ../target /root/path/other/exe - executable Running from /root/path/other. exe is: #include #include int main() { qDebug() << QFileInfo("../link").symLinkTarget() return 0; } The link references /root/target, but the current output is /root/path/target. The link doesn't depend on the PWD. It depends on its own directory. Change-Id: I61e95018154a75e0e0d795ee801068e18870a5df Reviewed-by: Thiago Macieira --- src/corelib/io/qfilesystemengine_unix.cpp | 12 +++++------- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 7 +++++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index ac0c43d055..7600c9a613 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -187,13 +187,11 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link, #endif if (!ret.startsWith(QLatin1Char('/'))) { - const QString linkFilePath = link.filePath(); - if (linkFilePath.startsWith(QLatin1Char('/'))) { - ret.prepend(linkFilePath.leftRef(linkFilePath.lastIndexOf(QLatin1Char('/'))) - + QLatin1Char('/')); - } else { - ret.prepend(QDir::currentPath() + QLatin1Char('/')); - } + const QString linkPath = link.path(); + if (linkPath.startsWith(QLatin1Char('/'))) + ret.prepend(linkPath + QLatin1Char('/')); + else + ret.prepend(QDir::currentPath() + QLatin1Char('/') + linkPath + QLatin1Char('/')); } ret = QDir::cleanPath(ret); if (ret.size() > 1 && ret.endsWith(QLatin1Char('/'))) diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 87b579bb2b..17f41cba2b 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -1261,6 +1261,7 @@ void tst_QFileInfo::isSymLink_data() QFile::remove("link.lnk"); QFile::remove("brokenlink.lnk"); QFile::remove("dummyfile"); + QFile::remove("relative/link.lnk"); QFile file1(m_sourceFile); QVERIFY(file1.link("link.lnk")); @@ -1277,6 +1278,12 @@ void tst_QFileInfo::isSymLink_data() QTest::newRow("existent file") << m_sourceFile << false << ""; QTest::newRow("link") << "link.lnk" << true << QFileInfo(m_sourceFile).absoluteFilePath(); QTest::newRow("broken link") << "brokenlink.lnk" << true << QFileInfo("dummyfile").absoluteFilePath(); + +#ifndef Q_OS_WIN + QDir::current().mkdir("relative"); + QFile::link("../dummyfile", "relative/link.lnk"); + QTest::newRow("relative link") << "relative/link.lnk" << true << QFileInfo("dummyfile").absoluteFilePath(); +#endif #endif } -- cgit v1.2.3 From db0585d63ad44756c9b9476a53413ccd061c52d8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 19 Jul 2017 23:32:30 -0700 Subject: Fix crashes with libproxy+webkitgtk: it's not threadsafe I'm getting crashes in Akonadi processes due to libproxy. I don't have direct evidence that this was caused by a threading condition, but it's clear from the source code of libproxy that the plugins it runs for expanding PAC scripts are not thread-safe. To overcome this problem, we only run libproxy functions in one thread only. #0 0x00007f745f0ac1d8 in JSC::HeapTimer::timerDidFire() () at /usr/lib64/libjavascriptcoregtk-4.0.so.18 #1 0x00007f745f0ac287 in () at /usr/lib64/libjavascriptcoregtk-4.0.so.18 #2 0x00007f748e5ae9c5 in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0 #3 0x00007f748e5aed88 in () at /usr/lib64/libglib-2.0.so.0 #4 0x00007f748e5aee1c in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0 #5 0x00007f7494f4268f in QEventDispatcherGlib::processEvents(QFlags) () at /usr/lib64/libQt5Core.so.5 #6 0x00007f7494eeb35a in QEventLoop::exec(QFlags) () at /usr/lib64/libQt5Core.so.5 #7 0x00007f7494d1b31a in QThread::exec() () at /usr/lib64/libQt5Core.so.5 #8 0x00007f7494d1fd2e in () at /usr/lib64/libQt5Core.so.5 #9 0x00007f74913174e7 in start_thread () at /lib64/libpthread.so.0 The pacrunner implementation of libproxy uses libdbus-1 which (officially) is thread-safe, but experience tells that it has problems. Since it is not running a JS engine, we don't need a thread, but we do need to lock around it. Change-Id: I84e45059a888497fb55ffffd14d2f638f21e807d Reviewed-by: Edward Welbourne --- src/network/kernel/kernel.pri | 2 +- src/network/kernel/qnetworkproxy_libproxy.cpp | 143 +++++++++++++++++++++----- 2 files changed, 120 insertions(+), 25 deletions(-) diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index a80b2d387e..2c5975182f 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -63,6 +63,6 @@ osx:SOURCES += kernel/qnetworkproxy_mac.cpp else:win32:SOURCES += kernel/qnetworkproxy_win.cpp else: qtConfig(libproxy) { SOURCES += kernel/qnetworkproxy_libproxy.cpp - QMAKE_USE_PRIVATE += libproxy + QMAKE_USE_PRIVATE += libproxy libdl } else:SOURCES += kernel/qnetworkproxy_generic.cpp diff --git a/src/network/kernel/qnetworkproxy_libproxy.cpp b/src/network/kernel/qnetworkproxy_libproxy.cpp index 184dc6469d..29d2a0bd3b 100644 --- a/src/network/kernel/qnetworkproxy_libproxy.cpp +++ b/src/network/kernel/qnetworkproxy_libproxy.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. @@ -42,57 +43,149 @@ #ifndef QT_NO_NETWORKPROXY #include +#include +#include #include +#include +#include #include +#include QT_BEGIN_NAMESPACE -class QLibProxyWrapper +static bool isThreadingNeeded() { -public: - QLibProxyWrapper() - : factory(px_proxy_factory_new()) - { - if (!factory) - qWarning("libproxy initialization failed."); - } + // Try to guess if the libproxy we linked to is from the libproxy project + // or if it is from pacrunner. Neither library is thread-safe, but the one + // from libproxy is worse, since it may launch JS engines that don't take + // kindly to being executed from multiple threads (even if at different + // times). The pacrunner implementation doesn't suffer from this because + // the JS execution is out of process, in the pacrunner daemon. - ~QLibProxyWrapper() - { - px_proxy_factory_free(factory); - } + void *sym; + +#ifdef Q_CC_GNU + // Search for the mangled name of the virtual table of the pacrunner + // extension. Even if libproxy begins using -fvisibility=hidden, this + // symbol can't be hidden. + sym = dlsym(RTLD_DEFAULT, "_ZTVN8libproxy19pacrunner_extensionE"); +#else + // The default libproxy one uses libmodman for its module management and + // leaks symbols because it doesn't use -fvisibility=hidden (as of + // v0.4.15). + sym = dlsym(RTLD_DEFAULT, "mm_info_ignore_hostname"); +#endif + + return sym != nullptr; +} + +class QLibProxyWrapper : public QDaemonThread +{ + Q_OBJECT +public: + QLibProxyWrapper(); + ~QLibProxyWrapper(); QList getProxies(const QUrl &url); private: - pxProxyFactory *factory; + struct Data { + // we leave the conversion to/from QUrl to the calling thread + const char *url; + char **proxies; + QSemaphore replyReady; + }; + + void run() override; + + pxProxyFactory *factory; // not subject to the mutex + + QMutex mutex; + QSemaphore requestReady; + Data *request; }; Q_GLOBAL_STATIC(QLibProxyWrapper, libProxyWrapper); +QLibProxyWrapper::QLibProxyWrapper() +{ + if (isThreadingNeeded()) { + setEventDispatcher(new QEventDispatcherUNIX); // don't allow the Glib one + start(); + } else { + factory = px_proxy_factory_new(); + Q_CHECK_PTR(factory); + } +} + +QLibProxyWrapper::~QLibProxyWrapper() +{ + if (isRunning()) { + requestInterruption(); + requestReady.release(); + wait(); + } else { + px_proxy_factory_free(factory); + } +} + /* - Gets the list of proxies from libproxy, converted to QUrl list. - Thread safe, according to libproxy documentation. + Gets the list of proxies from libproxy, converted to QUrl list. Apply + thread-safety, though its documentation says otherwise, libproxy isn't + thread-safe. */ QList QLibProxyWrapper::getProxies(const QUrl &url) { - QList ret; + QByteArray encodedUrl = url.toEncoded(); + Data data; + data.url = encodedUrl.constData(); + + { + QMutexLocker locker(&mutex); + if (isRunning()) { + // threaded mode + // it's safe to write to request because we hold the mutex: + // our aux thread is blocked waiting for work and no other thread + // could have got here + request = &data; + requestReady.release(); - if (factory) { - char **proxies = px_proxy_factory_get_proxies(factory, url.toEncoded()); - if (proxies) { - for (int i = 0; proxies[i]; i++) { - ret.append(QUrl::fromEncoded(proxies[i])); - free(proxies[i]); - } - free(proxies); + // wait for the reply + data.replyReady.acquire(); + } else { + // non-threaded mode + data.proxies = px_proxy_factory_get_proxies(factory, data.url); } } + QList ret; + if (data.proxies) { + for (int i = 0; data.proxies[i]; i++) { + ret.append(QUrl::fromEncoded(data.proxies[i])); + free(data.proxies[i]); + } + free(data.proxies); + } return ret; } +void QLibProxyWrapper::run() +{ + factory = px_proxy_factory_new(); + Q_CHECK_PTR(factory); + + forever { + requestReady.acquire(); + if (isInterruptionRequested()) + break; + request->proxies = px_proxy_factory_get_proxies(factory, request->url); + request->replyReady.release(); + } + + px_proxy_factory_free(factory); +} + QList QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query) { QList proxyList; @@ -161,4 +254,6 @@ QList QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro QT_END_NAMESPACE +#include "qnetworkproxy_libproxy.moc" + #endif -- cgit v1.2.3 From f1a857c079e11c8e298ec8f2dafef49039f8ca40 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 25 Aug 2017 16:16:12 +0700 Subject: QCompleter: Add check before setting the widget This prevents unnecessarily removing and reinstalling the completer as event filter on the same widget. This does not prevent what's going on in QComboBox::focusInEvent(), where we'd set the line edit as widget just to immediately override it with combo box itself. Change-Id: I70c081a920f4daf4d7560e5cd7158e4070042d42 Reviewed-by: Friedemann Kleint --- src/widgets/util/qcompleter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 9ae0384020..a9ab0c22c8 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -1013,11 +1013,15 @@ QCompleter::~QCompleter() void QCompleter::setWidget(QWidget *widget) { Q_D(QCompleter); + if (widget == d->widget) + return; + if (d->widget) d->widget->removeEventFilter(this); d->widget = widget; if (d->widget) d->widget->installEventFilter(this); + if (d->popup) { d->popup->hide(); d->popup->setFocusProxy(d->widget); -- cgit v1.2.3 From 1bb70830d4ea030c4ce2d41be3e31a9c05c6b976 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 23 Aug 2017 12:28:51 +0200 Subject: Make it possible to override QT_LOGGING_TO_CONSOLE in test cases It is currently impossible to get output from autotests in Visual Studio or Qt Creator when running under the debugger. Qt Creator's cdb integration cannot distinguish between the inferior's console output and cdb's console output. If the inferior's output came from OutputDebugString we'd be able to catch and display it. Pave a way to force QTestLib's logging facility use OutputDebugString. Task-number: QTCREATORBUG-16161 Change-Id: Iccd69c283626266ee4384a6163a8b72bb0e7df27 Reviewed-by: hjk Reviewed-by: Thiago Macieira Reviewed-by: Simon Hausmann --- src/testlib/qtestcase.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 8b0820b941..74a5d0ac19 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1652,9 +1652,15 @@ static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo) } #endif // Q_OS_WIN) && !Q_OS_WINRT +static void qputenvIfEmpty(const char *name, const QByteArray &value) +{ + if (qEnvironmentVariableIsEmpty(name)) + qputenv(name, value); +} + static void initEnvironment() { - qputenv("QT_LOGGING_TO_CONSOLE", "1"); + qputenvIfEmpty("QT_LOGGING_TO_CONSOLE", "1"); qputenv("QT_QTESTLIB_RUNNING", "1"); } -- cgit v1.2.3 From 3380c7949e897cb65fe4ea4d8f58b44ccd6c999c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 18 Aug 2017 16:04:42 +0200 Subject: Remove QMAKE_LIBS_NETWORK from QSqlQuery benchmark This was added in c6612de3 for WEC7 which we do not support anymore. Change-Id: I329374bb8375d629a6f7619236371c0fc953792d Reviewed-by: Oswald Buddenhagen --- tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro b/tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro index 18425f4a25..0b710ab89c 100644 --- a/tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro +++ b/tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro @@ -3,4 +3,3 @@ TARGET = tst_bench_qsqlquery SOURCES += main.cpp QT = core sql testlib core-private sql-private -LIBS += $$QMAKE_LIBS_NETWORK -- cgit v1.2.3 From d7438593a890749b72ec042b7817c59d6d99815c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 18 Aug 2017 16:45:22 +0200 Subject: Remove QMAKE_LIBS_CORE variable Define the lib dependencies for corelib in corelib.pro, where they belong. Change-Id: I973d3b0c571782d869b27dea243e899db4dddc43 Reviewed-by: Oswald Buddenhagen --- mkspecs/common/ghs-base.conf | 2 -- mkspecs/common/msvc-desktop.conf | 1 - mkspecs/common/winrt_winphone/qmake.conf | 1 - mkspecs/win32-g++/qmake.conf | 1 - src/angle/src/common/common.pri | 2 +- src/corelib/corelib.pro | 10 +++++++--- src/platformsupport/fontdatabases/winrt/winrt.pri | 2 +- src/plugins/platforms/winrt/winrt.pro | 2 +- 8 files changed, 10 insertions(+), 11 deletions(-) diff --git a/mkspecs/common/ghs-base.conf b/mkspecs/common/ghs-base.conf index addc05241c..a66971578c 100644 --- a/mkspecs/common/ghs-base.conf +++ b/mkspecs/common/ghs-base.conf @@ -38,5 +38,3 @@ QMAKE_LFLAGS_RELEASE += -Ospeed -Olink -Omax QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_LFLAGS_RELEASE -g QMAKE_LFLAGS_CXX11 += --c++11 --thread_local_storage QMAKE_LFLAGS_EXCEPTIONS_ON += --exceptions - -QMAKE_LIBS_CORE = -lposix -livfs -lsocket -lnet -lshm_client diff --git a/mkspecs/common/msvc-desktop.conf b/mkspecs/common/msvc-desktop.conf index f538acfcd9..f95a3bbdc8 100644 --- a/mkspecs/common/msvc-desktop.conf +++ b/mkspecs/common/msvc-desktop.conf @@ -88,7 +88,6 @@ QMAKE_EXTENSION_SHLIB = dll QMAKE_PREFIX_STATICLIB = QMAKE_EXTENSION_STATICLIB = lib -QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib QMAKE_LIBS_NETWORK = ws2_32.lib QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib diff --git a/mkspecs/common/winrt_winphone/qmake.conf b/mkspecs/common/winrt_winphone/qmake.conf index 8e0aba7371..2bb6f9bcbd 100644 --- a/mkspecs/common/winrt_winphone/qmake.conf +++ b/mkspecs/common/winrt_winphone/qmake.conf @@ -76,7 +76,6 @@ QMAKE_PREFIX_STATICLIB = QMAKE_EXTENSION_STATICLIB = lib QMAKE_LIBS += runtimeobject.lib -QMAKE_LIBS_CORE += ws2_32.lib QMAKE_LIBS_GUI = QMAKE_LIBS_NETWORK += ws2_32.lib diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf index d2500355ac..185afaaa49 100644 --- a/mkspecs/win32-g++/qmake.conf +++ b/mkspecs/win32-g++/qmake.conf @@ -61,7 +61,6 @@ QMAKE_EXTENSION_STATICLIB = a QMAKE_LIB_EXTENSIONS = a dll.a QMAKE_LIBS = -QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lws2_32 -lole32 -luuid -luser32 -ladvapi32 QMAKE_LIBS_NETWORK = -lws2_32 QMAKE_LIBS_OPENGL = -lglu32 -lopengl32 -lgdi32 -luser32 diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri index 7305362d86..c1fad14951 100644 --- a/src/angle/src/common/common.pri +++ b/src/angle/src/common/common.pri @@ -12,7 +12,7 @@ INCLUDEPATH += \ $$ANGLE_DIR/src \ $$ANGLE_DIR/include -LIBS_PRIVATE = $$QMAKE_LIBS_CORE $$QMAKE_LIBS_GUI +LIBS_PRIVATE = $$QMAKE_LIBS_GUI TR_EXCLUDE += $$ANGLE_DIR/src/* diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 7d09070b81..32f9992b6b 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -53,8 +53,10 @@ win32 { # Override MinGW's definition in _mingw.h DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600 } - - !winrt: LIBS_PRIVATE += -lwinmm + LIBS_PRIVATE += -lws2_32 + !winrt { + LIBS_PRIVATE += -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lwinmm + } } darwin { @@ -66,7 +68,9 @@ darwin { LIBS_PRIVATE += -framework Foundation } -QMAKE_LIBS += $$QMAKE_LIBS_CORE +integrity { + LIBS_PRIVATE += -lposix -livfs -lsocket -lnet -lshm_client +} QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtCore.dynlist diff --git a/src/platformsupport/fontdatabases/winrt/winrt.pri b/src/platformsupport/fontdatabases/winrt/winrt.pri index 4875338182..291ada220f 100644 --- a/src/platformsupport/fontdatabases/winrt/winrt.pri +++ b/src/platformsupport/fontdatabases/winrt/winrt.pri @@ -8,4 +8,4 @@ HEADERS += \ DEFINES += __WRL_NO_DEFAULT_LIB__ -LIBS += $$QMAKE_LIBS_CORE -ldwrite +LIBS += -lws2_32 -ldwrite diff --git a/src/plugins/platforms/winrt/winrt.pro b/src/plugins/platforms/winrt/winrt.pro index 02a848b03f..042b270cff 100644 --- a/src/plugins/platforms/winrt/winrt.pro +++ b/src/plugins/platforms/winrt/winrt.pro @@ -8,7 +8,7 @@ QT += \ DEFINES *= QT_NO_CAST_FROM_ASCII __WRL_NO_DEFAULT_LIB__ -LIBS += $$QMAKE_LIBS_CORE -ld3d11 +LIBS += -lws2_32 -ld3d11 SOURCES = \ main.cpp \ -- cgit v1.2.3 From ea168ead1a5ac24f540895f18fa88ab27d8e6c3a Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 24 Aug 2017 11:11:09 +0200 Subject: Remove unused mkspecs variable QMAKE_LIBS_NIS Change-Id: I09a161fe4706c19eba4ff54cdb03a10edc34871a Reviewed-by: Oswald Buddenhagen --- mkspecs/common/linux.conf | 1 - mkspecs/common/solaris.conf | 1 - mkspecs/hurd-g++/qmake.conf | 1 - mkspecs/linux-icc/qmake.conf | 1 - mkspecs/lynxos-g++/qmake.conf | 1 - mkspecs/solaris-cc-64/qmake.conf | 1 - mkspecs/solaris-cc/qmake.conf | 1 - mkspecs/unsupported/linux-host-g++/qmake.conf | 1 - mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf | 1 - mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf | 1 - 10 files changed, 10 deletions(-) diff --git a/mkspecs/common/linux.conf b/mkspecs/common/linux.conf index 13916a5646..68e566aeab 100644 --- a/mkspecs/common/linux.conf +++ b/mkspecs/common/linux.conf @@ -29,7 +29,6 @@ QMAKE_LIBDIR_OPENVG = QMAKE_LIBS = QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_NIS = -lnsl QMAKE_LIBS_EGL = -lEGL QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 diff --git a/mkspecs/common/solaris.conf b/mkspecs/common/solaris.conf index 23e26debff..024b75a9d9 100644 --- a/mkspecs/common/solaris.conf +++ b/mkspecs/common/solaris.conf @@ -19,7 +19,6 @@ QMAKE_INCDIR_OPENGL = /usr/X11/include/mesa QMAKE_LIBS = QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_X11 = -lXext -lX11 -lresolv -lsocket -lnsl -QMAKE_LIBS_NIS = QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_THREAD = -lpthread -lrt QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl diff --git a/mkspecs/hurd-g++/qmake.conf b/mkspecs/hurd-g++/qmake.conf index fc6ef779fc..f701755fb3 100644 --- a/mkspecs/hurd-g++/qmake.conf +++ b/mkspecs/hurd-g++/qmake.conf @@ -29,7 +29,6 @@ QMAKE_LIBDIR_OPENVG = QMAKE_LIBS = QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_NIS = -lnsl QMAKE_LIBS_EGL = -lEGL QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf index 4fc2251665..cee91317f8 100644 --- a/mkspecs/linux-icc/qmake.conf +++ b/mkspecs/linux-icc/qmake.conf @@ -100,7 +100,6 @@ QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG QMAKE_LIBS = QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_NIS = -lnsl QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_THREAD = -lpthread diff --git a/mkspecs/lynxos-g++/qmake.conf b/mkspecs/lynxos-g++/qmake.conf index 91bcc6b85d..1a44d93275 100644 --- a/mkspecs/lynxos-g++/qmake.conf +++ b/mkspecs/lynxos-g++/qmake.conf @@ -64,7 +64,6 @@ QMAKE_LFLAGS_RPATH = -Wl,-rpath, QMAKE_LIBS = QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_NIS = -lnsl QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_THREAD = -lpthread diff --git a/mkspecs/solaris-cc-64/qmake.conf b/mkspecs/solaris-cc-64/qmake.conf index 1c7b43c29c..e2317de3b8 100644 --- a/mkspecs/solaris-cc-64/qmake.conf +++ b/mkspecs/solaris-cc-64/qmake.conf @@ -80,7 +80,6 @@ QMAKE_LFLAGS_RPATH = -R QMAKE_LIBS = QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_X11 = -lXext -lX11 -lresolv -lsocket -lnsl -QMAKE_LIBS_NIS = QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_THREAD = -lpthread -lrt QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl diff --git a/mkspecs/solaris-cc/qmake.conf b/mkspecs/solaris-cc/qmake.conf index 045ab033dd..1a711e753a 100644 --- a/mkspecs/solaris-cc/qmake.conf +++ b/mkspecs/solaris-cc/qmake.conf @@ -63,7 +63,6 @@ QMAKE_LFLAGS_RPATH = -R QMAKE_LIBS = QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_X11 = -lXext -lX11 -lresolv -lsocket -lnsl -QMAKE_LIBS_NIS = QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_THREAD = -lpthread -lrt QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl diff --git a/mkspecs/unsupported/linux-host-g++/qmake.conf b/mkspecs/unsupported/linux-host-g++/qmake.conf index 3aa7520776..7853ade8ce 100644 --- a/mkspecs/unsupported/linux-host-g++/qmake.conf +++ b/mkspecs/unsupported/linux-host-g++/qmake.conf @@ -98,7 +98,6 @@ QMAKE_LIBDIR_OPENVG = QMAKE_LIBS = QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_NIS = -lnsl QMAKE_LIBS_EGL = -lEGL QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 diff --git a/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf b/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf index 16e3127803..2fa514854c 100644 --- a/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf +++ b/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf @@ -76,7 +76,6 @@ QMAKE_LIBDIR_OPENGL = $$QMAKE_LIBDIR_X11 QMAKE_LIBS = QMAKE_LIBS_DYNLOAD = QMAKE_LIBS_X11 = -lXext -lX11 -QMAKE_LIBS_NIS = -lnsl QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_THREAD = QMAKE_LIBS_NETWORK = # -lnetwrap # only needed if kernel is missing gethostbyname and friends diff --git a/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf b/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf index 44e39a8a8c..5aa96dff78 100644 --- a/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf +++ b/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf @@ -76,7 +76,6 @@ QMAKE_LIBDIR_OPENGL = $$QMAKE_LIBDIR_X11 QMAKE_LIBS = QMAKE_LIBS_DYNLOAD = QMAKE_LIBS_X11 = -lXext -lX11 -QMAKE_LIBS_NIS = -lnsl QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_THREAD = QMAKE_LIBS_NETWORK = # -lnet # only needed if kernel is missing gethostbyname and friends -- cgit v1.2.3 From 48784486a36f60dea882baabc6923f4b59d2bfe6 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 28 Aug 2017 20:38:20 +0700 Subject: QCocoaMenu: Stop update timer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This amends patch f27d1ccbb24ec2fd4098f2976503478831006cc8. Change-Id: I4c7a390a5f2cdd3307007c7b6708692c36f861b4 Task-number: QTBUG-62396 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoamenu.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index d7f0efe86c..3a11023a4d 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -427,6 +427,7 @@ void QCocoaMenu::scheduleUpdate() void QCocoaMenu::timerEvent(QTimerEvent *e) { if (e->timerId() == m_updateTimer) { + killTimer(m_updateTimer); m_updateTimer = 0; [m_nativeMenu update]; } -- cgit v1.2.3 From e81f430e30635f975dd4635ffb64d66fc1bce355 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Fri, 25 Aug 2017 17:39:19 +0200 Subject: Doc: Fix example Change-Id: Ic678b69c6c9820701c4cc10c7797f599e5d71b7a Reviewed-by: Leena Miettinen --- src/corelib/io/qfileinfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 11c1e45e63..e80294fb6c 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -864,12 +864,12 @@ QString QFileInfo::suffix() const \b{Note:} The QDir returned always corresponds to the object's parent directory, even if the QFileInfo represents a directory. - For each of the following, dir() returns a QDir for + For each of the following, dir() returns the QDir \c{"~/examples/191697"}. \snippet fileinfo/main.cpp 0 - For each of the following, dir() returns a QDir for + For each of the following, dir() returns the QDir \c{"."}. \snippet fileinfo/main.cpp 1 -- cgit v1.2.3 From 041df6e2aedcf0d8a305a503045965cc15cec2a2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 28 Aug 2017 13:26:22 +0200 Subject: QFileInfo: Clarify documentation on symlinks Explain symbolic links vs shortcuts. Change-Id: I12176616be72c97607ee1f441d1ea05af5e9e549 Reviewed-by: Thiago Macieira Reviewed-by: Joerg Bornemann --- src/corelib/io/qfileinfo.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index e80294fb6c..907574b6dd 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -1056,12 +1056,16 @@ bool QFileInfo::isBundle() const } /*! - Returns \c true if this object points to a symbolic link (or to a - shortcut on Windows); otherwise returns \c false. + Returns \c true if this object points to a symbolic link; + otherwise returns \c false. - On Unix (including \macos and iOS), opening a symlink effectively opens - the \l{symLinkTarget()}{link's target}. On Windows, it opens the \c - .lnk file itself. + Symbolic links exist on Unix (including \macos and iOS) and Windows + and are typically created by the \c{ln -s} or \c{mklink} commands, + respectively. Opening a symbolic link effectively opens + the \l{symLinkTarget()}{link's target}. + + In addition, true will be returned for shortcuts (\c *.lnk files) on + Windows. Opening those will open the \c .lnk file itself. Example: @@ -1116,8 +1120,8 @@ bool QFileInfo::isRoot() const \fn QString QFileInfo::symLinkTarget() const \since 4.2 - Returns the absolute path to the file or directory a symlink (or shortcut - on Windows) points to, or an empty string if the object isn't a symbolic + Returns the absolute path to the file or directory a symbolic link + points to, or an empty string if the object isn't a symbolic link. This name may not represent an existing file; it is only a string. -- cgit v1.2.3 From 3b962d16dba91aa13ad6bc04abc7608b6de5bdf4 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 21 Jul 2017 09:57:00 +0200 Subject: Fix jumping to anchors with offline style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the style changes after the browser already jumped to an anchor, the resulting browser position will be messed up. So, after we changed the style we need to make sure that we jump to the anchor again. Since browsers do not jump to anchors that they already jumped to, that means first jumping to the top, then to the actual anchor. Task-number: QTCREATORBUG-18448 Change-Id: I86c736adab6940903276f8a896b4054ddae11ebe Reviewed-by: Topi Reiniö --- doc/global/qt-html-templates-offline-simple.qdocconf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/global/qt-html-templates-offline-simple.qdocconf b/doc/global/qt-html-templates-offline-simple.qdocconf index 1fea752a16..c3c2d3cca0 100644 --- a/doc/global/qt-html-templates-offline-simple.qdocconf +++ b/doc/global/qt-html-templates-offline-simple.qdocconf @@ -7,6 +7,16 @@ HTML.headerstyles = \ " \n" \ " \n" HTML.postheader = \ -- cgit v1.2.3 From 01af6771c3c2f575840da58abb8da2594f8144ae Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Wed, 2 Aug 2017 13:44:12 +0200 Subject: Fix: WebP missing from QMovie::supportedFormats() Use QImageReader::supportsOption() instead of ::supportsAnimation(), since the former checks what the handler supports in general, not just the particular device. Task-number: QTBUG-61642 Change-Id: I57db24425b4fd8821446659936e6a8ca55008921 Reviewed-by: J-P Nurmi --- src/gui/image/qmovie.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp index a1ca857daa..fbbf6e9802 100644 --- a/src/gui/image/qmovie.cpp +++ b/src/gui/image/qmovie.cpp @@ -975,7 +975,7 @@ QList QMovie::supportedFormats() const auto doesntSupportAnimation = [&buffer](const QByteArray &format) { - return !QImageReader(&buffer, format).supportsAnimation(); + return !QImageReader(&buffer, format).supportsOption(QImageIOHandler::Animation); }; list.erase(std::remove_if(list.begin(), list.end(), doesntSupportAnimation), list.end()); -- cgit v1.2.3 From c827afa2820e539179c5d11ca073e4d90e98df5d Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 7 Jul 2017 16:46:47 +0200 Subject: QWidgets/CommonStyle: Fix tooltip drawing under HighDPI Delegating the border painting to qDrawPlainRect ensures that there are no off-by-one pixel issues. Task-number: QTBUG-61849 Change-Id: I56dc849da80fad00d02a0f9c60dbb621e6de7c48 Reviewed-by: Michael Winkelmann Reviewed-by: J-P Nurmi Reviewed-by: Alessandro Portale --- src/widgets/styles/qcommonstyle.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 64a3a73b0d..a8f8c97776 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -572,13 +572,8 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q break; } #endif // QT_NO_SPINBOX case PE_PanelTipLabel: { - QBrush oldBrush = p->brush(); - QPen oldPen = p->pen(); - p->setPen(QPen(opt->palette.toolTipText(), 0)); - p->setBrush(opt->palette.toolTipBase()); - p->drawRect(opt->rect.adjusted(0, 0, -1, -1)); - p->setPen(oldPen); - p->setBrush(oldBrush); + const QBrush brush(opt->palette.toolTipBase()); + qDrawPlainRect(p, opt->rect, opt->palette.toolTipText().color(), 1, &brush); break; } #if QT_CONFIG(tabbar) -- cgit v1.2.3 From de6d6eb13ebfeefc6e628cc46d695d7693d364ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joni=20J=C3=A4ntti?= Date: Tue, 29 Aug 2017 14:37:54 +0300 Subject: Revert "tst_qgraphicswidget expect fail on Win 10" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3d5bf00f18b5b9d1f5de4ff610ad15d5d0ed8c3d. This change needs to be reverted because Windows 10 Creator's Update doesn't fail on this test anymore during CI runs. Reason for this is unknown. Change-Id: I9f1c88606c97afc5952af34e04310612b783a9c2 Reviewed-by: Tony Sarajärvi --- .../widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp index 5e3cb66aae..1be17b552e 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp @@ -41,7 +41,6 @@ #include #include #include -#include typedef QList QGraphicsItemList; @@ -1776,17 +1775,11 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie() QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, center); #ifdef Q_OS_MAC QEXPECT_FAIL("", "QTBUG-23699", Continue); -#endif -#ifdef Q_OS_WIN - if (QSysInfo::kernelVersion() == "10.0.15063") { - QEXPECT_FAIL("", "This fails on Windows 10 Creators Update (10.0.15063)", Continue); - } #endif QTRY_COMPARE(qApp->activeWindow(), static_cast(&view)); QTRY_COMPARE(scene.focusItem(), static_cast(w)); } - void tst_QGraphicsWidget::sizeHint_data() { QTest::addColumn("layout"); -- cgit v1.2.3 From 0270651dda8e247164a8dccd71fb65712c7d1480 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 25 Aug 2017 16:06:44 +0200 Subject: Cocoa integration: do not use released session MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QTBUG_10735_crashWithDialog started to show flakyness recently - it crashes, but not every time (which fits the definition of UB perfectly). While the test itself is doing weird things and puts our event dispatcher into a weird state, our API allows to: 1. Using QDialog to enter event loop (with runModalSession under the hood), then ... 2. to call from a slot (e.g. timer-attached) QApplication::closeAllWindows() while ... 3. we are still inside that special loop and using the 'session' object, thus ... 4. on the next iteration with [NSApp runModalSession:session] we'll re-use already released session (released by endModalSession which in turn was called indirectly by closeAllWindows). And Cocoa gives us a warning/hint: "Use of freed session detected. Do not call runModalSession: after calling endModalSesion:." Task-number: QTBUG-62589 Change-Id: Ie651cee1fba43cfd2b0fc44af5eddc5fd52e2907 Reviewed-by: Tor Arne Vestbø Reviewed-by: Morten Johan Sørvig Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index d2f985ec87..b22f1b1f54 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -401,8 +401,18 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) // [NSApp run], which is the normal code path for cocoa applications. if (NSModalSession session = d->currentModalSession()) { QBoolBlocker execGuard(d->currentExecIsNSAppRun, false); - while ([NSApp runModalSession:session] == NSModalResponseContinue && !d->interrupt) + while ([NSApp runModalSession:session] == NSModalResponseContinue && !d->interrupt) { qt_mac_waitForMoreEvents(NSModalPanelRunLoopMode); + if (session != d->currentModalSessionCached) { + // It's possible to release the current modal session + // while we are in this loop, for example, by closing all + // windows from a slot via QApplication::closeAllWindows. + // In this case we cannot use 'session' anymore. A warning + // from Cocoa is: "Use of freed session detected. Do not + // call runModalSession: after calling endModalSesion:." + break; + } + } if (!d->interrupt && session == d->currentModalSessionCached) { // Someone called [NSApp stopModal:] from outside the event -- cgit v1.2.3 From 63002b2f378e8b663276279fb304afa752171bee Mon Sep 17 00:00:00 2001 From: Dongmei Wang Date: Fri, 18 Aug 2017 11:28:33 -0700 Subject: QFbVtHandler: Remove unused sys/signalfd.h include Change-Id: Ia9fa3c4de0a1dbdd1b36730c82f5180c2128cbcf Reviewed-by: Oswald Buddenhagen Reviewed-by: Laszlo Agocs --- src/platformsupport/fbconvenience/qfbvthandler.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/platformsupport/fbconvenience/qfbvthandler.cpp b/src/platformsupport/fbconvenience/qfbvthandler.cpp index 102bc91647..7bb9e28ac2 100644 --- a/src/platformsupport/fbconvenience/qfbvthandler.cpp +++ b/src/platformsupport/fbconvenience/qfbvthandler.cpp @@ -50,7 +50,6 @@ #include #include #include -#include #include #include -- cgit v1.2.3 From 789f9d0d56204354652760fcde407b30b3b3aded Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 29 Aug 2017 15:08:59 +0200 Subject: Avoid assert on large clips in qt_alphamapblit_generic It is (end - start) that represent the number of pixels being worked on and needs to be smaller than the buffer size. Change-Id: I75a22bc2656ac1c7d231278c3a1931758090f8ce Reviewed-by: Gatis Paeglis Reviewed-by: Laszlo Agocs --- src/gui/painting/qdrawhelper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 5c6c91f0ba..c78fdfe62e 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5627,7 +5627,7 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer, int start = qMax(x, clip.x); int end = qMin(x + mapWidth, clip.x + clip.len); - Q_ASSERT(clip.len <= buffer_size); + Q_ASSERT(end - start <= buffer_size); QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start); for (int xp=start; xp(x, clip.x); int end = qMin(x + mapWidth, clip.x + clip.len); - Q_ASSERT(clip.len <= buffer_size); + Q_ASSERT(end - start <= buffer_size); QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start); for (int xp=start; xp Date: Mon, 7 Aug 2017 22:54:11 +0200 Subject: examples: fix compile without opengl support Compile examples/opengl only in case opengl support is available. Task-number: QTBUG-62372 Change-Id: I742a1eb7b7639a5a722c4d5e9b4ee070b629b02e Reviewed-by: Jake Petroules Reviewed-by: Oswald Buddenhagen --- examples/examples.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/examples.pro b/examples/examples.pro index a3851c6d81..d87fa2da88 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -14,7 +14,8 @@ qtHaveModule(concurrent): SUBDIRS += qtconcurrent qtHaveModule(sql): SUBDIRS += sql qtHaveModule(widgets): SUBDIRS += widgets qtHaveModule(xml): SUBDIRS += xml -qtHaveModule(gui): SUBDIRS += gui opengl +qtHaveModule(gui): SUBDIRS += gui +qtHaveModule(gui):qtConfig(opengl): SUBDIRS += opengl aggregate.files = aggregate/examples.pro aggregate.path = $$[QT_INSTALL_EXAMPLES] -- cgit v1.2.3 From b7722c251c3a0938c7c71fc3da47fdbe920060b7 Mon Sep 17 00:00:00 2001 From: Peter Seiderer Date: Sun, 16 Jul 2017 00:05:44 +0200 Subject: Fix error attribute(target("+crc")) is unknown Task-number: QTBUG-61975 Change-Id: I0b1b55c0737dad485b5ace8e6eb7cb842589453d Reviewed-by: Laszlo Agocs --- src/corelib/tools/qhash.cpp | 2 ++ src/corelib/tools/qsimd_p.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 1f9c05c0b7..4cc9ec8ec8 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -144,7 +144,9 @@ static inline bool hasFastCrc32() } template +#if defined(Q_PROCESSOR_ARM_64) QT_FUNCTION_TARGET(CRC32) +#endif static uint crc32(const Char *ptr, size_t len, uint h) { // The crc32[whbd] instructions on Aarch64/Aarch32 calculate a 32-bit CRC32 checksum diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 023a4b08d2..05f118a9eb 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -326,7 +326,10 @@ #endif // AArch64/ARM64 #if defined(Q_PROCESSOR_ARM_V8) && defined(__ARM_FEATURE_CRC32) +#if defined(Q_PROCESSOR_ARM_64) +// only available on aarch64 #define QT_FUNCTION_TARGET_STRING_CRC32 "+crc" +#endif # include #endif -- cgit v1.2.3 From e938150412d22e61926fe16791158805b71268bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joni=20J=C3=A4ntti?= Date: Wed, 30 Aug 2017 15:45:44 +0300 Subject: Revert "tst_qwidget::activation expect fail on Win 10" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 85612817685f8b64307276a2ce9ef79d9e048be4. This change needs to be reverted because Windows 10 Creator's Update doesn't fail on this test anymore during CI runs. Reason for this is unknown. Change-Id: Ice250ecedb14ac96fb3693b2d9884ef452a91cc2 Reviewed-by: Tony Sarajärvi --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index ef851f38b2..63ff8380f8 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -1774,12 +1774,6 @@ void tst_QWidget::activation() QCOMPARE(QApplication::activeWindow(), &widget2); widget2.hide(); QTest::qWait(waitTime); -#ifdef Q_OS_WIN - if (QSysInfo::kernelVersion() == "10.0.15063") { - QEXPECT_FAIL("", "This fails on Windows 10 Creators Update (10.0.15063)", Continue); - // This happens in automated Windows 10 Creators Update (10.0.15063) CI builds! - } -#endif QCOMPARE(QApplication::activeWindow(), &widget1); } #endif // Q_OS_WIN -- cgit v1.2.3