From abcf7a103eb1e00f2487b2346129112778f8c112 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Wed, 2 Jan 2019 12:18:15 +0100 Subject: configure: improve warning when all qpa plugins disabled with features.gui The mentioned README file has never been very trustworthy and after 863c6887495c0bd9ee3a85aa7cd2d997cdc5c93c it has become very minimal - it doesn't contain anything that is not already present in "configure --help" and enforced by the configure process. Furthermore, the warning was XCB specific, but Qt supports also other QPA plugins on linux. Change-Id: I3211dda3f294cbcd5f3d15fe8c21a1af7627f048 Reviewed-by: Joerg Bornemann --- config_help.txt | 2 +- src/gui/configure.json | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/config_help.txt b/config_help.txt index 7b5da3fbeb..fb37cbaed9 100644 --- a/config_help.txt +++ b/config_help.txt @@ -293,7 +293,7 @@ Gui, printing, widget options: -kms ............... Enable backends for KMS [auto] (Linux only) -linuxfb ........... Enable Linux Framebuffer support [auto] (Linux only) -mirclient ......... Enable Mir client support [no] (Linux only) - -xcb ............... Select used xcb-* libraries [system/qt/no] + -xcb ............... Enable X11 support. Select used xcb-* libraries [system/qt/no] (-qt-xcb still uses system version of libxcb itself) Input backends: diff --git a/src/gui/configure.json b/src/gui/configure.json index 582705f402..89934c8f1d 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -1830,8 +1830,7 @@ or may depend on your system and XQuartz setup." "condition": "features.gui && config.linux && !config.android && !features.xcb && !features.eglfs && !features.directfb && !features.linuxfb && !features.mirclient", "message": "No QPA platform plugin enabled! This will produce a Qt that cannot run GUI applications. -The dependencies needed for xcb to build are listed in -src/plugins/platforms/xcb/README" +See \"Platform backends\" in the output of --help." }, { "type": "warning", -- cgit v1.2.3 From 07685355b5a129dd65b08e39c96df4972924a809 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Mon, 7 Jan 2019 09:33:46 +0200 Subject: Bump version Change-Id: I2bf8da98a140bdd9848139a96bea736708357a1a Reviewed-by: Jani Heikkinen --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index 5df08093cd..518aa07f06 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -4,4 +4,4 @@ CONFIG += warning_clean QT_SOURCE_TREE = $$PWD QT_BUILD_TREE = $$shadowed($$PWD) -MODULE_VERSION = 5.12.0 +MODULE_VERSION = 5.12.1 -- cgit v1.2.3 From 772f56c3cf54dc34dbaa3ae50570a006f9e7721a Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 7 Jan 2019 13:58:30 +0100 Subject: Fix warnings about uninitialized variables - qrgba64_p.h In function 'QRgba64 rgbBlend(QRgba64, QRgba64, uint)': error: 'blend.QRgba64::rgba' is used uninitialized in this function [-Werror=uninitialized] qrgba64_p.h:246:13: note: 'blend' was declared here QRgba64 blend; Change-Id: I7b263f863281c51c7d8099704f2cffcc7e1a07df Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qrgba64_p.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qrgba64_p.h b/src/gui/painting/qrgba64_p.h index b7e4d4d905..ca879de27c 100644 --- a/src/gui/painting/qrgba64_p.h +++ b/src/gui/painting/qrgba64_p.h @@ -266,10 +266,10 @@ inline QRgba64 rgbBlend(QRgba64 d, QRgba64 s, uint rgbAlpha) const int mr = qRed(rgbAlpha); const int mg = qGreen(rgbAlpha); const int mb = qBlue(rgbAlpha); - blend.setRed (qt_div_255(s.red() * mr + d.red() * (255 - mr))); - blend.setGreen(qt_div_255(s.green() * mg + d.green() * (255 - mg))); - blend.setBlue (qt_div_255(s.blue() * mb + d.blue() * (255 - mb))); - blend.setAlpha(s.alpha()); + blend = qRgba64(qt_div_255(s.red() * mr + d.red() * (255 - mr)), + qt_div_255(s.green() * mg + d.green() * (255 - mg)), + qt_div_255(s.blue() * mb + d.blue() * (255 - mb)), + s.alpha()); #endif return blend; } -- cgit v1.2.3 From 2cd633e7eef6f67ee7ed5f23afea7e0f23c7eb03 Mon Sep 17 00:00:00 2001 From: Max Mazurov Date: Wed, 2 Jan 2019 16:55:24 +0000 Subject: XCB: Use application name for X11 selection owner name This makes it possible for clipboard managers (or other scripts) to distinguish different Qt applications and act differently. Change-Id: I5bc5a1914b51127b24a81142ca9dbdb196ffd0d8 Fixes: QTBUG-72806 Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbconnection.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 37ee980924..29acf0e86d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -39,6 +39,7 @@ #include #include +#include #include "qxcbconnection.h" #include "qxcbkeyboard.h" @@ -817,7 +818,7 @@ xcb_window_t QXcbConnection::getQtSelectionOwner() 0); // value list QXcbWindow::setWindowTitle(connection(), m_qtSelectionOwner, - QStringLiteral("Qt Selection Window")); + QLatin1String("Qt Selection Owner for ") + QCoreApplication::applicationName()); } return m_qtSelectionOwner; } -- cgit v1.2.3 From 5733dfbd90fd059e7310786faefb022b00289592 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 20 Dec 2018 16:30:51 +0100 Subject: qmake: make CONFIG+=egl work again while it's legacy and should not be used (use QMAKE_USE+=egl instead), it shouldn't be broken nonetheless. amends 310bf3f57c. Fixes: QTBUG-72564 Change-Id: Id6a070a4653dc1182a6b4d75af027a6ee6cbacae Reviewed-by: Joerg Bornemann Reviewed-by: Laszlo Agocs Reviewed-by: Rolf Eike Beer --- mkspecs/features/egl.prf | 1 + src/platformsupport/eglconvenience/qt_egl_p.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/egl.prf b/mkspecs/features/egl.prf index 9fa0c9e219..4577785576 100644 --- a/mkspecs/features/egl.prf +++ b/mkspecs/features/egl.prf @@ -2,6 +2,7 @@ INCLUDEPATH += $$QMAKE_INCDIR_EGL LIBS_PRIVATE += $$QMAKE_LIBS_EGL QMAKE_CFLAGS += $$QMAKE_CFLAGS_EGL QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_EGL +DEFINES += $$QMAKE_DEFINES_EGL LIBS += $$QMAKE_LFLAGS_EGL for(p, QMAKE_LIBDIR_EGL) { LIBS_PRIVATE += -L$$p diff --git a/src/platformsupport/eglconvenience/qt_egl_p.h b/src/platformsupport/eglconvenience/qt_egl_p.h index e2c6b0ceb6..ea554927de 100644 --- a/src/platformsupport/eglconvenience/qt_egl_p.h +++ b/src/platformsupport/eglconvenience/qt_egl_p.h @@ -52,7 +52,9 @@ // #ifdef QT_EGL_NO_X11 -# define MESA_EGL_NO_X11_HEADERS // MESA +# ifndef MESA_EGL_NO_X11_HEADERS +# define MESA_EGL_NO_X11_HEADERS // MESA +# endif # if !defined(Q_OS_INTEGRITY) # define WIN_INTERFACE_CUSTOM // NV # endif // Q_OS_INTEGRITY -- cgit v1.2.3 From 56e92dfdf255231aff0034d2e197fd096da7f0c0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 7 Jan 2019 13:41:10 +0100 Subject: QSplashScreen: Fix positioning in multimonitor setups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, QSplashScreen::setPixmap() used QDesktopWidgetPrivate::screenGeometry().center() to determine the screen position, which would always result in the primary screen being used. That is counter to the documentation of QSplashScreen(QWidget *, QPixmap), which states that a desktop screen widget can be passed as parent to set the screen. To fix that and make it easier to work with QScreen (which is the likely outcome of QTBUG-62094), extract the setPixmap() to QSplashScreenPrivate with an additional QScreen * parameter and add a helper to determine it. Do not set a position in case no parent was passed so that QPlatformWindow::initialGeometry() triggers, centering it over the cursor. Fixes: QTBUG-72819 Task-number: QTBUG-62094 Change-Id: Ic38cfecd24c3ff6b82dff37702b627c5a50a3e1d Reviewed-by: Tor Arne Vestbø --- src/widgets/widgets/qsplashscreen.cpp | 57 +++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp index 277d2fd99f..4af4f90119 100644 --- a/src/widgets/widgets/qsplashscreen.cpp +++ b/src/widgets/widgets/qsplashscreen.cpp @@ -46,6 +46,7 @@ #include "qpixmap.h" #include "qtextdocument.h" #include "qtextcursor.h" +#include #include #include #include @@ -69,6 +70,10 @@ public: int currAlign; inline QSplashScreenPrivate(); + + void setPixmap(const QPixmap &p, const QScreen *screen = nullptr); + + static const QScreen *screenFor(const QWidget *w); }; /*! @@ -143,8 +148,9 @@ QSplashScreen::QSplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) QSplashScreen::QSplashScreen(QWidget *parent, const QPixmap &pixmap, Qt::WindowFlags f) : QWidget(*new QSplashScreenPrivate, parent, Qt::SplashScreen | Qt::FramelessWindowHint | f) { - d_func()->pixmap = pixmap; - setPixmap(d_func()->pixmap); // Does an implicit repaint + // Does an implicit repaint. Explicitly pass parent as QObject::parent() + // is still 0 here due to QWidget's special handling. + d_func()->setPixmap(pixmap, QSplashScreenPrivate::screenFor(parent)); } /*! @@ -276,16 +282,47 @@ void QSplashScreen::finish(QWidget *mainWin) */ void QSplashScreen::setPixmap(const QPixmap &pixmap) { - Q_D(QSplashScreen); + d_func()->setPixmap(pixmap, QSplashScreenPrivate::screenFor(this)); +} + +// In setPixmap(), resize and try to position on a screen according to: +// 1) If a QDesktopScreenWidget is found in the parent hierarchy, use that (see docs on +// QSplashScreen(QWidget *, QPixmap). +// 2) If a widget with associated QWindow is found, use that +// 3) When nothing can be found, do not position the widget, allowing for +// QPlatformWindow::initialGeometry() to center it over the cursor + +static inline int screenNumberOf(const QDesktopScreenWidget *dsw) +{ + auto desktopWidgetPrivate = + static_cast(qt_widget_private(QApplication::desktop())); + return desktopWidgetPrivate->screens.indexOf(const_cast(dsw)); +} + +const QScreen *QSplashScreenPrivate::screenFor(const QWidget *w) +{ + for (const QWidget *p = w; p !=nullptr ; p = p->parentWidget()) { + if (auto dsw = qobject_cast(p)) + return QGuiApplication::screens().value(screenNumberOf(dsw)); + if (QWindow *window = p->windowHandle()) + return window->screen(); + } + return nullptr; +} + +void QSplashScreenPrivate::setPixmap(const QPixmap &p, const QScreen *screen) +{ + Q_Q(QSplashScreen); - d->pixmap = pixmap; - setAttribute(Qt::WA_TranslucentBackground, pixmap.hasAlpha()); + pixmap = p; + q->setAttribute(Qt::WA_TranslucentBackground, pixmap.hasAlpha()); - QRect r(QPoint(), d->pixmap.size() / d->pixmap.devicePixelRatio()); - resize(r.size()); - move(QDesktopWidgetPrivate::screenGeometry().center() - r.center()); - if (isVisible()) - repaint(); + QRect r(QPoint(), pixmap.size() / pixmap.devicePixelRatio()); + q->resize(r.size()); + if (screen) + q->move(screen->geometry().center() - r.center()); + if (q->isVisible()) + q->repaint(); } /*! -- cgit v1.2.3 From 78b422c3415d99713cac98137a9ebad6571eb937 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 2 Jan 2019 13:11:47 +0100 Subject: QNetworkReplyHttpImpl::_q_startOperation - remove a useless warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since it explains nothing and now, after some other bug was fixed (see, for example, c89d0f9d532), we trigger this message on the first request, which happens because: - 'createSession()' indeed, creates a session, compares a previous kwnon state (which happens to be 'Invalid') with a current state, which is 'Connected' and then invokes '_q_networkSessionStateChanged'. - '_q_networkSessionStateChanged()' on 'Connected' emits 'networkSessionConnected()' to which a newly-created QNetworkReplyHttpImpl will respond with it's _q_startOperation(). - QHttpNetworkReplyImpl will also try to 'open' a session, its 'opened()' signal will trigger, again, 'networkSessionConnected()' and ... the next _q_startOperation(). Now, not to add even more twisted spaghetti if/conditions with some unpredictable regressions, let's suppress a useless warning and silently return. We, indeed, in 'Working' state, let's keep working. Task-number: QTBUG-72463 Change-Id: I5282979920915ffded889c20b8ae740a46efef04 Reviewed-by: Mårten Nordheim --- src/network/access/qnetworkreplyhttpimpl.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index ed2235ad28..ef54c198ba 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1879,11 +1879,9 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation() { Q_Q(QNetworkReplyHttpImpl); - // ensure this function is only being called once - if (state == Working) { - qDebug() << "QNetworkReplyHttpImplPrivate::_q_startOperation was called more than once" << url; + if (state == Working) // ensure this function is only being called once return; - } + state = Working; #ifndef QT_NO_BEARERMANAGEMENT -- cgit v1.2.3 From 98552a84cec7459db1ff41d1cebadcec9ee93849 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 18 Dec 2018 15:13:42 +0100 Subject: Emit paletteChanged and send ApplicationPaletteChange on theme change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-72575 Change-Id: I407e081295a456a7bdd36de91ca5bbf74bba6078 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qguiapplication.cpp | 12 ++++++++++++ src/gui/kernel/qguiapplication_p.h | 1 + src/widgets/kernel/qapplication.cpp | 36 ++++++++++++++++++------------------ src/widgets/kernel/qapplication_p.h | 3 +++ 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index f4e2dda05a..a63e172461 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3983,6 +3983,9 @@ void QGuiApplicationPrivate::notifyThemeChanged() !QCoreApplication::testAttribute(Qt::AA_SetPalette)) { clearPalette(); initPalette(); + emit qGuiApp->paletteChanged(*app_pal); + if (is_app_running && !is_app_closing) + sendApplicationPaletteChange(); } if (!(applicationResourceFlags & ApplicationFontExplicitlySet)) { QMutexLocker locker(&applicationFontMutex); @@ -3991,6 +3994,15 @@ void QGuiApplicationPrivate::notifyThemeChanged() } } +void QGuiApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const char *className) +{ + Q_UNUSED(toAllWidgets) + Q_UNUSED(className) + + QEvent event(QEvent::ApplicationPaletteChange); + QGuiApplication::sendEvent(QGuiApplication::instance(), &event); +} + #if QT_CONFIG(draganddrop) void QGuiApplicationPrivate::notifyDragStarted(const QDrag *drag) { diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 79c1a1c820..042a36c31f 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -313,6 +313,7 @@ public: protected: virtual void notifyThemeChanged(); + virtual void sendApplicationPaletteChange(bool toAllWidgets = false, const char *className = nullptr); bool tryCloseRemainingWindows(QWindowList processedWindows); #if QT_CONFIG(draganddrop) virtual void notifyDragStarted(const QDrag *); diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index f9db6155af..6800a51d4b 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1420,24 +1420,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { // Send ApplicationPaletteChange to qApp itself, and to the widgets. - QEvent e(QEvent::ApplicationPaletteChange); - QApplication::sendEvent(QApplication::instance(), &e); - - QWidgetList wids = QApplication::allWidgets(); - for (QWidgetList::ConstIterator it = wids.constBegin(), cend = wids.constEnd(); it != cend; ++it) { - QWidget *w = *it; - if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class - QApplication::sendEvent(w, &e); - } - - // Send to all scenes as well. -#if QT_CONFIG(graphicsview) - QList &scenes = qApp->d_func()->scene_list; - for (QList::ConstIterator it = scenes.constBegin(); - it != scenes.constEnd(); ++it) { - QApplication::sendEvent(*it, &e); - } -#endif // QT_CONFIG(graphicsview) + qApp->d_func()->sendApplicationPaletteChange(all, className); } if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))) { if (!QApplicationPrivate::set_pal) @@ -4508,6 +4491,23 @@ void QApplicationPrivate::notifyThemeChanged() qt_init_tooltip_palette(); } +void QApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const char *className) +{ + QGuiApplicationPrivate::sendApplicationPaletteChange(); + + QEvent event(QEvent::ApplicationPaletteChange); + const QWidgetList widgets = QApplication::allWidgets(); + for (auto widget : widgets) { + if (toAllWidgets || (!className && widget->isWindow()) || (className && widget->inherits(className))) + QApplication::sendEvent(widget, &event); + } + +#if QT_CONFIG(graphicsview) + for (auto scene : qAsConst(scene_list)) + QApplication::sendEvent(scene, &event); +#endif // QT_CONFIG(graphicsview) +} + #if QT_CONFIG(draganddrop) void QApplicationPrivate::notifyDragStarted(const QDrag *drag) { diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 05bc2468c1..133279f977 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -177,6 +177,9 @@ public: protected: void notifyThemeChanged() override; + void sendApplicationPaletteChange(bool toAllWidgets = false, + const char *className = nullptr) override; + #if QT_CONFIG(draganddrop) void notifyDragStarted(const QDrag *) override; #endif // QT_CONFIG(draganddrop) -- cgit v1.2.3 From a3f3c1d599d412a6ffbcffdca8916acd3506381d Mon Sep 17 00:00:00 2001 From: Heikki Halmet Date: Mon, 7 Jan 2019 14:46:02 +0200 Subject: Make Android arch x86_64 to use platform-21 Change-Id: I0dc1f87af2270aa5a8ac9fcc256b5b923e1c8c21 Reviewed-by: Eskil Abrahamsen Blomfeldt --- configure.pri | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.pri b/configure.pri index b3b3e27c44..629ca78ff1 100644 --- a/configure.pri +++ b/configure.pri @@ -606,6 +606,9 @@ defineTest(qtConfOutput_prepareOptions) { isEmpty(platform): equals(target_arch, arm64-v8a): \ platform = android-21 + isEmpty(platform): equals(target_arch, x86_64): \ + platform = android-21 + isEmpty(platform): \ platform = android-16 ### the windows configure disagrees ... -- cgit v1.2.3 From 8b1a23ed32cbba28ad642a1884a50e6f2b13d17e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Tue, 8 Jan 2019 12:23:35 +0200 Subject: Blacklist a flaky qtableview function in WinRT Task-number: QTBUG-72853 Change-Id: Iaf2b25712b571a3ce73387cb3d2e70d427808364 Reviewed-by: Oliver Wolff --- tests/auto/widgets/itemviews/qtableview/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/widgets/itemviews/qtableview/BLACKLIST b/tests/auto/widgets/itemviews/qtableview/BLACKLIST index fc231a4e30..be90475a6f 100644 --- a/tests/auto/widgets/itemviews/qtableview/BLACKLIST +++ b/tests/auto/widgets/itemviews/qtableview/BLACKLIST @@ -1,2 +1,4 @@ [moveCursorBiggerJump] osx +[columnViewportPosition] +winrt # QTBUG-72853 -- cgit v1.2.3 From 2e2832a4994a8172ce1ba5b3e1478ef5a7f8c24f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 3 Jan 2019 16:52:08 +0100 Subject: Fix typo in fontconfig autotest Change-Id: Ie6ef3aa654083cd23320eda99660ff85050d999c Reviewed-by: Leena Miettinen --- src/gui/configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/configure.json b/src/gui/configure.json index 89934c8f1d..39c0232c0b 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -250,7 +250,7 @@ "test": { "tail": [ "#ifndef FC_RGBA_UNKNOWN", - "# error This version of fontconfig is tool old, it is missing the FC_RGBA_UNKNOWN define", + "# error This version of fontconfig is too old, it is missing the FC_RGBA_UNKNOWN define", "#endif" ], "main": [ -- cgit v1.2.3 From 4d9ac14bf8d1c1a33a2720c7f7dcaf8d912a592f Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 31 Oct 2018 14:51:26 +0100 Subject: Doc: Complete doc on QHostAddress::clear() Task-number: QTBUG-31280 Change-Id: Ia9904433b0b67bead8831f2ef678b9598977df6b Reviewed-by: Timur Pocheptsov Reviewed-by: Paul Wicking --- src/network/kernel/qhostaddress.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index 27b5f570dc..fba91c62c8 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -574,7 +574,8 @@ QHostAddress &QHostAddress::operator=(SpecialAddress address) */ /*! - Sets the host address to null. + Sets the host address to null and sets the protocol to + QAbstractSocket::UnknownNetworkLayerProtocol. \sa QHostAddress::Null */ -- cgit v1.2.3 From 2780f80fae58ecd986c0695f9bc61cfb5b099dc0 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Mon, 17 Dec 2018 13:16:40 +1000 Subject: wasm: fix blob download handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I34a8ec05c18b15ed71787986b5b0316693235b4d Fixes: QTBUG-72105 Reviewed-by: Morten Johan Sørvig --- src/network/access/qnetworkreplywasmimpl.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/network/access/qnetworkreplywasmimpl.cpp b/src/network/access/qnetworkreplywasmimpl.cpp index 3bfe927c9f..df4e034d97 100644 --- a/src/network/access/qnetworkreplywasmimpl.cpp +++ b/src/network/access/qnetworkreplywasmimpl.cpp @@ -102,6 +102,8 @@ static void q_loadCallback(val event) return; } QString statusText = QString::fromStdString(xhr["statusText"].as()); + int readyState = xhr["readyState"].as(); + if (status == 200 || status == 203) { QString responseString; const std::string responseType = xhr["responseType"].as(); @@ -112,13 +114,15 @@ static void q_loadCallback(val event) QString::fromStdWString(val::global("JSON").call("stringify", xhr["response"])); } else if (responseType == "arraybuffer" || responseType == "blob") { // handle this data in the FileReader, triggered by the call to readAsArrayBuffer + val blob = xhr["response"]; + val reader = val::global("FileReader").new_(); reader.set("onload", val::module_property("QNetworkReplyWasmImplPrivate_readBinary")); reader.set("data-handler", xhr["data-handler"]); - reader.call("readAsArrayBuffer", xhr["response"]); + + reader.call("readAsArrayBuffer", blob); } - int readyState = xhr["readyState"].as(); if (readyState == 4) { // done reply->setReplyAttributes(xhr["data-handler"].as(), status, statusText); @@ -167,9 +171,9 @@ static void q_readBinary(val event) reinterpret_cast(buffer.data()), size); destinationTypedArray.call("set", sourceTypedArray); reply->dataReceived(buffer, buffer.size()); + QCoreApplication::processEvents(); } - EMSCRIPTEN_BINDINGS(network_module) { function("QNetworkReplyWasmImplPrivate_requestErrorCallback", q_requestErrorCallback); function("QNetworkReplyWasmImplPrivate_progressCallback", q_progressCallback); @@ -240,9 +244,6 @@ qint64 QNetworkReplyWasmImpl::bytesAvailable() const { Q_D(const QNetworkReplyWasmImpl); - if (!d->isFinished) - return QNetworkReply::bytesAvailable(); - return QNetworkReply::bytesAvailable() + d->downloadBufferCurrentSize - d->downloadBufferReadPosition; } @@ -357,8 +358,7 @@ void QNetworkReplyWasmImplPrivate::doSendRequest() m_xhr.set("responseType", val("json")); dataToSend = val(extraDataString.toStdString()); } - } - if (contentType.contains("form")) { //construct form data + } else if (contentType.contains("form")) { //construct form data if (!extraDataString.isEmpty()) { val formData = val::global("FormData").new_(); QStringList formList = extraDataString.split('&'); @@ -368,6 +368,8 @@ void QNetworkReplyWasmImplPrivate::doSendRequest() } dataToSend = formData; } + } else { + m_xhr.set("responseType", val("blob")); } // set request headers for (auto header : request.rawHeaderList()) { @@ -417,10 +419,13 @@ void QNetworkReplyWasmImplPrivate::dataReceived(const QByteArray &buffer, int bu downloadBuffer.append(buffer, bufferSize); + emit q->readyRead(); + if (downloadBufferCurrentSize == totalDownloadSize) { - q->setFinished(true); - emit q->finished(); - } + q->setFinished(true); + emit q->readChannelFinished(); + emit q->finished(); + } } //taken from qnetworkrequest.cpp -- cgit v1.2.3 From 166162d8305404e8fc820de91ef9f6d733b4657a Mon Sep 17 00:00:00 2001 From: Roland Rossgotterer Date: Mon, 7 Jan 2019 14:49:28 +0100 Subject: Always access the 64-bit registry key to read MachineGuid When running a 32bit application on a 64bit Windows, the call to open the key "HKLM/Software/Microsoft/Cryptography/MachineGuid" will by default be redirect to "HKLM/Software/WOW6432Node/Microsoft/Cryptography/MachineGuid" which does not exist. Instead access the 64bit key from either a 32bit or 64bit application. KEY_WOW64_64KEY has no effect on 32bit Windows. Change-Id: Ic5e13f99d08aef2658d58a52cffe66dbab0510b8 Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 88d4877be5..0109bb3568 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2933,7 +2933,7 @@ QByteArray QSysInfo::machineUniqueId() #elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Let's poke at the registry HKEY key = NULL; - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography", 0, KEY_READ, &key) + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography", 0, KEY_READ | KEY_WOW64_64KEY, &key) == ERROR_SUCCESS) { wchar_t buffer[UuidStringLen + 1]; DWORD size = sizeof(buffer); -- cgit v1.2.3 From 0330db86fdd42ef1be1354cdbbd6e0ffc21d9a80 Mon Sep 17 00:00:00 2001 From: Roland Rossgotterer Date: Tue, 8 Jan 2019 16:03:02 +0100 Subject: Increase sysctl argument buffer size to include null character An UUID is 36 characters long, but sysctl and sysctlbyname return a null terminated string with 37 characters. That was too long for the provided buffer. Surprisingly the return code was still 0 instead of -1. The returned buffer was empty though. Change-Id: Ic4d20ecc1b2b3a3e98468d31ac304957d56deee9 Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 0109bb3568..d15a8ba6ae 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2899,18 +2899,18 @@ enum { QByteArray QSysInfo::machineUniqueId() { #ifdef Q_OS_BSD4 - char uuid[UuidStringLen]; + char uuid[UuidStringLen + 1]; size_t uuidlen = sizeof(uuid); # ifdef KERN_HOSTUUID int name[] = { CTL_KERN, KERN_HOSTUUID }; if (sysctl(name, sizeof name / sizeof name[0], &uuid, &uuidlen, nullptr, 0) == 0 && uuidlen == sizeof(uuid)) - return QByteArray(uuid, uuidlen); + return QByteArray(uuid, uuidlen - 1); # else // Darwin: no fixed value, we need to search by name if (sysctlbyname("kern.uuid", uuid, &uuidlen, nullptr, 0) == 0 && uuidlen == sizeof(uuid)) - return QByteArray(uuid, uuidlen); + return QByteArray(uuid, uuidlen - 1); # endif #elif defined(Q_OS_UNIX) // The modern name on Linux is /etc/machine-id, but that path is @@ -2974,11 +2974,11 @@ QByteArray QSysInfo::bootUniqueId() } #elif defined(Q_OS_DARWIN) // "kern.bootsessionuuid" is only available by name - char uuid[UuidStringLen]; + char uuid[UuidStringLen + 1]; size_t uuidlen = sizeof(uuid); if (sysctlbyname("kern.bootsessionuuid", uuid, &uuidlen, nullptr, 0) == 0 && uuidlen == sizeof(uuid)) - return QByteArray(uuid, uuidlen); + return QByteArray(uuid, uuidlen - 1); #endif return QByteArray(); }; -- cgit v1.2.3 From 68511d41d50b1a136fb0e74fdabfd362e0b21a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 5 Sep 2018 13:47:05 +0200 Subject: qWaitFor: Prevent being stuck in QCoreApplication::processEvents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using the overload of QCoreApplication::processEvents that takes a maxtime argument, the function will keep processing events until there are no more events, or until it times out. The problem is that the function doesn't distinguish between events that were on the event queue when the function was called, and events generated by processing events as part of its own execution. If for example a widget calls update() in its paintEvent, the function will spin for the entire duration of maxtime. That doesn't work for qWaitFor, where we need to check the predicate between each pass, so we use the overload of processEvents that doesn't take a maxtime. That's fine, as we have our own timeout logic. Change-Id: I9738d7d0187c36d4a5ddfcd3fd075b0bd84583c4 Reviewed-by: Qt CI Bot Reviewed-by: Tor Arne Vestbø --- src/corelib/kernel/qtestsupport_core.h | 8 +++++- tests/auto/opengl/qgl/tst_qgl.cpp | 1 + .../dialogs/qfiledialog2/tst_qfiledialog2.cpp | 5 ++++ .../qgraphicseffect/tst_qgraphicseffect.cpp | 1 + .../tst_qgraphicseffectsource.cpp | 1 + .../qgraphicsitem/tst_qgraphicsitem.cpp | 29 +++++++++++++++------- .../qgraphicsscene/tst_qgraphicsscene.cpp | 1 + .../qgraphicsview/tst_qgraphicsview.cpp | 1 + .../itemviews/qtreewidget/tst_qtreewidget.cpp | 1 + 9 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/corelib/kernel/qtestsupport_core.h b/src/corelib/kernel/qtestsupport_core.h index c8b664b6d3..c8209b5ae4 100644 --- a/src/corelib/kernel/qtestsupport_core.h +++ b/src/corelib/kernel/qtestsupport_core.h @@ -67,7 +67,13 @@ Q_REQUIRED_RESULT static bool qWaitFor(Functor predicate, int timeout = 5000) QDeadlineTimer deadline(remaining, Qt::PreciseTimer); do { - QCoreApplication::processEvents(QEventLoop::AllEvents, remaining); + // We explicitly do not pass the remaining time to processEvents, as + // that would keep spinning processEvents for the whole duration if + // new events were posted as part of processing events, and we need + // to return back to this function to check the predicate between + // each pass of processEvents. Our own timer will take care of the + // timeout. + QCoreApplication::processEvents(QEventLoop::AllEvents); QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); remaining = deadline.remainingTime(); diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp index 7666bf81e4..053c4b026b 100644 --- a/tests/auto/opengl/qgl/tst_qgl.cpp +++ b/tests/auto/opengl/qgl/tst_qgl.cpp @@ -924,6 +924,7 @@ void tst_QGL::partialGLWidgetUpdates() widget.setAutoFillBackground(autoFillBackground); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QCoreApplication::processEvents(); // Process all queued paint events if (widget.format().doubleBuffer() != doubleBufferedContext) QSKIP("Platform does not support requested format"); diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index 8f9a8c11a7..24ce598279 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -601,6 +601,11 @@ void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior() fd.setDirectory(current.absolutePath()); fd.show(); QVERIFY(QTest::qWaitForWindowActive(&fd)); + + // Ensure LayoutRequest event is processed so that the list view + // is sorted correctly to have the directory entires at the top. + QCoreApplication::processEvents(); + QListView *list = fd.findChild("listView"); QVERIFY(list); QTest::keyClick(list, Qt::Key_Down); diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp index 95662a49a0..c4b6e22c37 100644 --- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp @@ -313,6 +313,7 @@ void tst_QGraphicsEffect::draw() view.show(); QVERIFY(QTest::qWaitForWindowActive(&view)); QTRY_VERIFY(item->numRepaints > 0); + QCoreApplication::processEvents(); // Process all queued paint events item->reset(); // Make sure installing the effect triggers a repaint. diff --git a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index e7d26622c9..973a73a4a9 100644 --- a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp @@ -183,6 +183,7 @@ void tst_QGraphicsEffectSource::init() effect->storeDeviceDependentStuff = false; effect->doNothingInDraw = false; item->reset(); + QCoreApplication::processEvents(); // Process all queued paint events } void tst_QGraphicsEffectSource::graphicsItem() diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index bd08461544..5f269bd520 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -3231,6 +3231,7 @@ void tst_QGraphicsItem::hoverEventsGenerateRepaints() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); QVERIFY(QTest::qWaitForWindowActive(&view)); + QCoreApplication::processEvents(); // Process all queued paint events EventTester *tester = new EventTester; scene.addItem(tester); @@ -5074,13 +5075,11 @@ void tst_QGraphicsItem::paint() QGraphicsView view2(&scene2); view2.show(); QVERIFY(QTest::qWaitForWindowExposed(&view2)); + QCoreApplication::processEvents(); // Process all queued paint events PaintTester tester2; scene2.addItem(&tester2); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT. Figure out why - QTBUG-68297", Abort); -#endif //First show one paint QTRY_COMPARE(tester2.painted, 1); @@ -6534,11 +6533,9 @@ void tst_QGraphicsItem::ensureUpdateOnTextItem() QGraphicsView view(&scene); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); + QCoreApplication::processEvents(); // Process all queued paint events TextItem *text1 = new TextItem(QLatin1String("123")); scene.addItem(text1); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT. Figure out why - QTBUG-68297", Abort); -#endif QTRY_COMPARE(text1->updates,1); //same bouding rect but we have to update @@ -6810,6 +6807,7 @@ void tst_QGraphicsItem::opacity2() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); QVERIFY(QTest::qWaitForWindowActive(&view)); + QCoreApplication::processEvents(); // Process all queued paint events QTRY_VERIFY(view.repaints >= 1); #define RESET_REPAINT_COUNTERS \ @@ -6883,6 +6881,7 @@ void tst_QGraphicsItem::opacityZeroUpdates() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); QVERIFY(QTest::qWaitForWindowActive(&view)); + QCoreApplication::processEvents(); // Process all queued paint events QTRY_VERIFY(view.repaints > 0); view.reset(); @@ -7275,6 +7274,7 @@ void tst_QGraphicsItem::cacheMode() QApplication::setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowExposed(&view)); QVERIFY(QTest::qWaitForWindowActive(&view)); + QCoreApplication::processEvents(); // Process all queued paint events EventTester *tester = new EventTester; EventTester *testerChild = new EventTester; @@ -7454,6 +7454,7 @@ void tst_QGraphicsItem::cacheMode2() QApplication::setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowExposed(&view)); QVERIFY(QTest::qWaitForWindowActive(&view)); + QCoreApplication::processEvents(); // Process all queued paint events EventTester *tester = new EventTester; scene.addItem(tester); @@ -7944,6 +7945,7 @@ void tst_QGraphicsItem::itemUsesExtendedStyleOption() rect->startTrack = false; topLevel.show(); QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QCoreApplication::processEvents(); // Process all queued paint events QTRY_VERIFY(rect->repaints > 0); rect->repaints = 0; rect->startTrack = true; @@ -8030,6 +8032,7 @@ void tst_QGraphicsItem::moveItem() MyGraphicsView view(&scene); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); + QCoreApplication::processEvents(); // Process all queued paint events EventTester *parent = new EventTester; EventTester *child = new EventTester(parent); @@ -8108,6 +8111,7 @@ void tst_QGraphicsItem::moveLineItem() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); QVERIFY(QTest::qWaitForWindowActive(&view)); + QCoreApplication::processEvents(); // Process all queued paint events view.reset(); QRectF brect = item->boundingRect(); @@ -8288,6 +8292,7 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem() toplevel.resize(300, 300); toplevel.show(); QVERIFY(QTest::qWaitForWindowExposed(&toplevel)); + QCoreApplication::processEvents(); // Process all queued paint events // Confuse the BSP with dummy items. QGraphicsRectItem *dummy = new QGraphicsRectItem(0, 0, 20, 20); @@ -11266,6 +11271,7 @@ void tst_QGraphicsItem::QTBUG_6738_missingUpdateWithSetParent() qApp->setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowExposed(&view)); QVERIFY(QTest::qWaitForWindowActive(&view)); + QCoreApplication::processEvents(); // Process all queued paint events QTRY_VERIFY(view.repaints > 0); // test case #1 @@ -11315,6 +11321,7 @@ void tst_QGraphicsItem::QT_2653_fullUpdateDiscardingOpacityUpdate() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); QVERIFY(QTest::qWaitForWindowActive(&view)); + QCoreApplication::processEvents(); // Process all queued paint events view.reset(); parentGreen->setOpacity(1.0); @@ -11348,6 +11355,8 @@ void tst_QGraphicsItem::QTBUG_7714_fullUpdateDiscardingOpacityUpdate2() origView.show(); QVERIFY(QTest::qWaitForWindowActive(&origView)); + QCoreApplication::processEvents(); // Process all queued paint events + origView.setGeometry(origView.x() + origView.width() + 20, origView.y() + 20, origView.width(), origView.height()); @@ -11356,9 +11365,6 @@ void tst_QGraphicsItem::QTBUG_7714_fullUpdateDiscardingOpacityUpdate2() origView.reset(); childYellow->setOpacity(0.0); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT. Figure out why - QTBUG-68297", Abort); -#endif QTRY_COMPARE(origView.repaints, 1); view.show(); @@ -11370,6 +11376,10 @@ void tst_QGraphicsItem::QTBUG_7714_fullUpdateDiscardingOpacityUpdate2() childYellow->setOpacity(1.0); +#ifdef Q_OS_WINRT + QEXPECT_FAIL("", "Fails on WinRT. Figure out why - QTBUG-68297", Abort); +#endif + QTRY_COMPARE(origView.repaints, 1); QTRY_COMPARE(view.repaints, 1); } @@ -11505,6 +11515,7 @@ void tst_QGraphicsItem::doNotMarkFullUpdateIfNotInScene() view.show(); QVERIFY(QTest::qWaitForWindowExposed(view.windowHandle())); QVERIFY(QTest::qWaitForWindowActive(view.windowHandle())); + QCoreApplication::processEvents(); // Process all queued paint events view.activateWindow(); QTRY_VERIFY(view.isActiveWindow()); QTRY_VERIFY(view.repaints >= 1); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 838b1f4be6..48488abfb8 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -4318,6 +4318,7 @@ void tst_QGraphicsScene::removeFullyTransparentItem() view.show(); qApp->setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowActive(&view)); + QCoreApplication::processEvents(); // Process all queued paint events // NB! The parent has the ItemHasNoContents flag set, which means // the parent itself doesn't generate any update requests, only the diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 3dc110298a..55139ff99a 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -1650,6 +1650,7 @@ void tst_QGraphicsView::itemsInRect_cosmeticAdjust() QVERIFY(QTest::qWaitForWindowActive(&view)); QTRY_VERIFY(rect->numPaints > 0); + QCoreApplication::processEvents(); // Process all queued paint events rect->numPaints = 0; if (updateRect.isNull()) view.viewport()->update(); diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index 8c93df9073..adb2c54751 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -3368,6 +3368,7 @@ void tst_QTreeWidget::setChildIndicatorPolicy() treeWidget.setItemDelegate(&delegate); treeWidget.show(); QVERIFY(QTest::qWaitForWindowExposed(&treeWidget)); + QCoreApplication::processEvents(); // Process all queued paint events QTreeWidgetItem *item = new QTreeWidgetItem(QStringList("Hello")); treeWidget.insertTopLevelItem(0, item); -- cgit v1.2.3 From 574b56913f3d1ca6ad05617c32bd275807613c6b Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 7 Jan 2019 14:55:58 +0100 Subject: Doc: mention that some filtered events need to be explicitly accepted QKeyEvent's detailed description already documents this: "A key event contains a special accept flag that indicates whether the receiver will handle the key event. This flag is set by default for QEvent::KeyPress and QEvent::KeyRelease, so there is no need to call accept() when acting on a key event. For QEvent::ShortcutOverride the receiver needs to explicitly accept the event to trigger the override. Calling ignore() on a key event will propagate it to the parent widget. The event is propagated up the parent widget chain until a widget accepts it or an event filter consumes it." However, someone looking at eventFilter() won't see this, resulting in the shortcut not being consumed and propagating elsewhere, so mention it in the docs for eventFilter() too. Change-Id: I14fece52133be641ccdabd81f75706cd10b64669 Reviewed-by: Friedemann Kleint Reviewed-by: Venugopal Shivashankar Reviewed-by: Paul Wicking --- src/corelib/kernel/qobject.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 14af9ac8ef..b5d97c5538 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1374,6 +1374,10 @@ void QObject::customEvent(QEvent * /* event */) might have reimplemented eventFilter() for its own internal purposes. + Some events, such as \l QEvent::ShortcutOverride must be explicitly + accepted (by calling \l {QEvent::}{accept()} on them) in order to prevent + propagation. + \warning If you delete the receiver object in this function, be sure to return true. Otherwise, Qt will forward the event to the deleted object and the program might crash. -- cgit v1.2.3 From 3eac688ec005833509bffc7097c378af9c5b515f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 10 Jan 2019 08:46:52 +0100 Subject: Documentation: Add \nullptr macro and use where applicable Qt for Python users reading the documentation assume that int(0) can be passed for pointer parameters. Use the newly introduced \nullptr to disambiguate this. In a follow-up step, the \nullptr macro can be defined as None when generating the Qt for Python documentation. Task-number: PYSIDE-903 Change-Id: I3a45f87175a0668ab5f3f95f0aff409f7e3ef027 Reviewed-by: Cristian Maureira-Fredes Reviewed-by: Christian Tismer Reviewed-by: Venugopal Shivashankar Reviewed-by: Paul Wicking --- doc/global/macros.qdocconf | 1 + src/gui/accessible/qaccessible.cpp | 14 +++++++------- src/gui/image/qimage.cpp | 2 +- src/gui/itemmodels/qstandarditemmodel.cpp | 18 +++++++++--------- src/gui/kernel/qevent.cpp | 4 ++-- src/gui/kernel/qguiapplication.cpp | 2 +- src/gui/kernel/qopenglcontext.cpp | 2 +- src/gui/kernel/qplatformcursor.cpp | 2 +- src/gui/kernel/qplatformintegration.cpp | 2 +- src/gui/kernel/qplatformscreen.cpp | 2 +- src/gui/kernel/qwindow.cpp | 2 +- src/gui/painting/qpaintengine.cpp | 2 +- src/gui/text/qtextcursor.cpp | 6 +++--- src/gui/text/qtextobject.cpp | 2 +- src/network/access/qftp.cpp | 2 +- src/network/access/qnetworkrequest.cpp | 2 +- src/testlib/qtestcase.qdoc | 2 +- src/widgets/dialogs/qdialog.cpp | 2 +- src/widgets/dialogs/qprogressdialog.cpp | 2 +- src/widgets/effects/qgraphicseffect.cpp | 6 +++--- src/widgets/graphicsview/qgraphicsitem.cpp | 4 ++-- src/widgets/graphicsview/qgraphicslayoutitem.cpp | 2 +- src/widgets/itemviews/qabstractitemdelegate.cpp | 2 +- src/widgets/itemviews/qlistwidget.cpp | 4 ++-- src/widgets/itemviews/qtablewidget.cpp | 6 +++--- src/widgets/itemviews/qtreewidget.cpp | 2 +- src/widgets/kernel/qapplication.cpp | 6 +++--- src/widgets/kernel/qformlayout.cpp | 2 +- src/widgets/kernel/qwidget.cpp | 4 ++-- src/widgets/styles/qstylefactory.cpp | 2 +- src/widgets/util/qundogroup.cpp | 2 +- src/widgets/util/qundoview.cpp | 2 +- src/widgets/widgets/qabstractbutton.cpp | 2 +- src/widgets/widgets/qabstractspinbox.cpp | 2 +- src/widgets/widgets/qmenu.cpp | 2 +- src/widgets/widgets/qmenubar.cpp | 2 +- 36 files changed, 62 insertions(+), 61 deletions(-) diff --git a/doc/global/macros.qdocconf b/doc/global/macros.qdocconf index 704b1da277..ef3ca1dc1d 100644 --- a/doc/global/macros.qdocconf +++ b/doc/global/macros.qdocconf @@ -14,6 +14,7 @@ macro.macos = "macOS" macro.menu = "\\b" macro.oslash.HTML = "ø" macro.ouml.HTML = "ö" +macro.nullptr = "\\c{nullptr}" macro.QA = "\\e{Qt Assistant}" macro.QD = "\\e{Qt Designer}" macro.QL = "\\e{Qt Linguist}" diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index a3f53e149b..46dec7f28d 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -654,7 +654,7 @@ void QAccessible::removeActivationObserver(ActivationObserver *observer) /*! If a QAccessibleInterface implementation exists for the given \a object, this function returns a pointer to the implementation; otherwise it - returns 0. + returns \nullptr. The function calls all installed factory functions (from most recently installed to least recently installed) until one is found @@ -770,7 +770,7 @@ QAccessible::Id QAccessible::uniqueId(QAccessibleInterface *iface) /*! Returns the QAccessibleInterface belonging to the \a id. - Returns 0 if the id is invalid. + Returns \nullptr if the id is invalid. */ QAccessibleInterface *QAccessible::accessibleInterface(Id id) { @@ -1119,7 +1119,7 @@ QAccessibleInterface *QAccessibleInterface::focusChild() const \fn QAccessibleInterface *QAccessibleInterface::childAt(int x, int y) const Returns the QAccessibleInterface of a child that contains the screen coordinates (\a x, \a y). - If there are no children at this position this function returns 0. + If there are no children at this position this function returns \nullptr. The returned accessible must be a child, but not necessarily a direct child. This function is only relyable for visible objects (invisible @@ -1139,7 +1139,7 @@ QAccessibleInterface *QAccessibleInterface::focusChild() const Returns the QAccessibleInterface of the parent in the accessible object hierarchy. - Returns 0 if no parent exists (e.g. for the top level application object). + Returns \nullptr if no parent exists (e.g. for the top level application object). \sa child() */ @@ -1150,7 +1150,7 @@ QAccessibleInterface *QAccessibleInterface::focusChild() const Returns the accessible child with index \a index. 0-based index. The number of children of an object can be checked with childCount. - Returns 0 when asking for an invalid child (e.g. when the child became invalid in the meantime). + Returns \nullptr when asking for an invalid child (e.g. when the child became invalid in the meantime). \sa childCount(), parent() */ @@ -1356,7 +1356,7 @@ QAccessibleEvent::~QAccessibleEvent() \internal Returns the uniqueId of the QAccessibleInterface represented by this event. - In case the object() function returns 0 this is the only way to access the + In case the object() function returns \nullptr, this is the only way to access the interface. */ QAccessible::Id QAccessibleEvent::uniqueId() const @@ -1786,7 +1786,7 @@ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const (This means that at least one interface among the ancestors should return a valid QWindow pointer). - The default implementation returns 0. + The default implementation returns \nullptr. */ QWindow *QAccessibleInterface::window() const { diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 0105f1decd..6801e2e1ea 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -113,7 +113,7 @@ QImageData::QImageData() \internal Creates a new image data. - Returns 0 if invalid parameters are give or anything else failed. + Returns \nullptr if invalid parameters are give or anything else failed. */ QImageData * QImageData::create(const QSize &size, QImage::Format format) { diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 430ba152a9..7afad95bd9 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -879,8 +879,8 @@ QStandardItem::~QStandardItem() } /*! - Returns the item's parent item, or 0 if the item has no parent. - \note For toplevel items parent() returns 0. To receive toplevel + Returns the item's parent item, or \nullptr if the item has no parent. + \note For toplevel items parent() returns \nullptr. To receive toplevel item's parent use QStandardItemModel::invisibleRootItem() instead. \sa child(), QStandardItemModel::invisibleRootItem() @@ -1548,7 +1548,7 @@ QModelIndex QStandardItem::index() const Returns the QStandardItemModel that this item belongs to. If the item is not a child of another item that belongs to the model, this - function returns 0. + function returns \nullptr. \sa index() */ @@ -1865,7 +1865,7 @@ void QStandardItem::setChild(int row, int column, QStandardItem *item) /*! Returns the child item at (\a row, \a column) if one has been set; otherwise - returns 0. + returns \nullptr. \sa setChild(), takeChild(), parent() */ @@ -1881,7 +1881,7 @@ QStandardItem *QStandardItem::child(int row, int column) const /*! Removes the child item at (\a row, \a column) without deleting it, and returns a pointer to the item. If there was no child at the given location, then - this function returns 0. + this function returns \nullptr. Note that this function, unlike takeRow() and takeColumn(), does not affect the dimensions of the child table. @@ -2283,7 +2283,7 @@ void QStandardItemModel::clear() itemPrototype()), and set it in the parent item's child table, if no item already exists at that index. - If \a index is an invalid index, this function returns 0. + If \a index is an invalid index, this function returns \nullptr. \sa indexFromItem() */ @@ -2380,7 +2380,7 @@ void QStandardItemModel::setItem(int row, int column, QStandardItem *item) \since 4.2 Returns the item for the given \a row and \a column if one has been set; - otherwise returns 0. + otherwise returns \nullptr. \sa setItem(), takeItem(), itemFromIndex() */ @@ -2453,7 +2453,7 @@ void QStandardItemModel::setHorizontalHeaderItem(int column, QStandardItem *item \since 4.2 Returns the horizontal header item for \a column if one has been set; - otherwise returns 0. + otherwise returns \nullptr. \sa setHorizontalHeaderItem(), verticalHeaderItem() */ @@ -2509,7 +2509,7 @@ void QStandardItemModel::setVerticalHeaderItem(int row, QStandardItem *item) \since 4.2 Returns the vertical header item for row \a row if one has been set; - otherwise returns 0. + otherwise returns \nullptr. \sa setVerticalHeaderItem(), horizontalHeaderItem() */ diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 53d1ac1fc0..7123c4d8ba 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3072,7 +3072,7 @@ QDropEvent::~QDropEvent() /*! If the source of the drag operation is a widget in this application, this function returns that source; otherwise it - returns 0. The source of the operation is the first parameter to + returns \nullptr. The source of the operation is the first parameter to the QDrag object used instantiate the drag. This is useful if your widget needs special behavior when dragging @@ -3514,7 +3514,7 @@ QActionEvent::~QActionEvent() \fn QAction *QActionEvent::before() const If type() is \l ActionAdded, returns the action that should - appear before action(). If this function returns 0, the action + appear before action(). If this function returns \nullptr, the action should be appended to already existing actions on the same widget. diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index a63e172461..fd01f8bb7b 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3747,7 +3747,7 @@ Qt::LayoutDirection QGuiApplication::layoutDirection() Returns the active application override cursor. - This function returns 0 if no application cursor has been defined (i.e. the + This function returns \nullptr if no application cursor has been defined (i.e. the internal cursor stack is empty). \sa setOverrideCursor(), restoreOverrideCursor() diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index c5d5490ea0..be04513de6 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1118,7 +1118,7 @@ void QOpenGLContext::swapBuffers(QSurface *surface) /*! Resolves the function pointer to an OpenGL extension function, identified by \a procName - Returns 0 if no such function can be found. + Returns \nullptr if no such function can be found. */ QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName) const { diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp index bab26f6028..76e38ab12d 100644 --- a/src/gui/kernel/qplatformcursor.cpp +++ b/src/gui/kernel/qplatformcursor.cpp @@ -84,7 +84,7 @@ QT_BEGIN_NAMESPACE \a windowCursor is a pointer to the QCursor that should be displayed. - To unset the cursor of \a window, 0 is passed. This means \a window does not have + To unset the cursor of \a window, \nullptr is passed. This means \a window does not have a cursor set and the cursor of a the first parent window which has a cursor explicitly set or the system default cursor should take effect. diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 6e285a8fa5..7d1fcd4eeb 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -350,7 +350,7 @@ void QPlatformIntegration::destroy() /*! Returns the platforms input context. - The default implementation returns 0, implying no input method support. + The default implementation returns \nullptr, implying no input method support. */ QPlatformInputContext *QPlatformIntegration::inputContext() const { diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp index 9614be7f3e..b7b312e89e 100644 --- a/src/gui/kernel/qplatformscreen.cpp +++ b/src/gui/kernel/qplatformscreen.cpp @@ -370,7 +370,7 @@ QString QPlatformScreen::serialNumber() const /*! Reimplement this function in subclass to return the cursor of the screen. - The default implementation returns 0. + The default implementation returns \nullptr. */ QPlatformCursor *QPlatformScreen::cursor() const { diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index bc2d6e6a17..61ef029cbd 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2644,7 +2644,7 @@ QOpenGLContext *QWindowPrivate::shareContext() const native window, or to embed a native window inside a QWindow. If foreign windows are not supported or embedding the native window - failed in the platform plugin, this function returns 0. + failed in the platform plugin, this function returns \nullptr. \note The resulting QWindow should not be used to manipulate the underlying native window (besides re-parenting), or to observe state changes of the diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index 1aee7d5f74..bfe1c9cadf 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -913,7 +913,7 @@ void QPaintEngine::setPaintDevice(QPaintDevice *device) /*! Returns the device that this engine is painting on, if painting is - active; otherwise returns 0. + active; otherwise returns \nullptr. */ QPaintDevice *QPaintEngine::paintDevice() const { diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index af8fcf369c..7719a2e6da 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -2116,7 +2116,7 @@ QTextList *QTextCursor::createList(QTextListFormat::Style style) /*! Returns the current list if the cursor position() is inside a - block that is part of a list; otherwise returns 0. + block that is part of a list; otherwise returns \nullptr. \sa insertList(), createList() */ @@ -2176,7 +2176,7 @@ QTextTable *QTextCursor::insertTable(int rows, int cols, const QTextTableFormat /*! Returns a pointer to the current table if the cursor position() - is inside a block that is part of a table; otherwise returns 0. + is inside a block that is part of a table; otherwise returns \nullptr. \sa insertTable() */ @@ -2213,7 +2213,7 @@ QTextFrame *QTextCursor::insertFrame(const QTextFrameFormat &format) } /*! - Returns a pointer to the current frame. Returns 0 if the cursor is invalid. + Returns a pointer to the current frame. Returns \nullptr if the cursor is invalid. \sa insertFrame() */ diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index e2130a09d9..0ed8be8530 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -1301,7 +1301,7 @@ const QTextDocument *QTextBlock::document() const /*! If the block represents a list item, returns the list that the item belongs - to; otherwise returns 0. + to; otherwise returns \nullptr. */ QTextList *QTextBlock::textList() const { diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index feece4ebaf..d33355c470 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -2154,7 +2154,7 @@ QFtp::Command QFtp::currentCommand() const \internal Returns the QIODevice pointer that is used by the FTP command to read data from or store data to. If there is no current FTP command being executed or - if the command does not use an IO device, this function returns 0. + if the command does not use an IO device, this function returns \nullptr. This function can be used to delete the QIODevice in the slot connected to the commandFinished() signal. diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 689eecfbb9..e4c46c3183 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -714,7 +714,7 @@ void QNetworkRequest::setOriginatingObject(QObject *object) \since 4.6 Returns a reference to the object that initiated this - network request; returns 0 if not set or the object has + network request; returns \nullptr if not set or the object has been destroyed. \sa setOriginatingObject() diff --git a/src/testlib/qtestcase.qdoc b/src/testlib/qtestcase.qdoc index ad9776f7ec..31903ea29c 100644 --- a/src/testlib/qtestcase.qdoc +++ b/src/testlib/qtestcase.qdoc @@ -959,7 +959,7 @@ \overload \since 5.8 - Returns a string containing \c{nullptr}. + Returns a string containing \nullptr. */ /*! diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 1fb5e61301..c9093095a7 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -969,7 +969,7 @@ Qt::Orientation QDialog::orientation() const Sets the widget, \a extension, to be the dialog's extension, deleting any previous extension. The dialog takes ownership of the - extension. Note that if 0 is passed any existing extension will be + extension. Note that if \nullptr is passed, any existing extension will be deleted. This function must only be called while the dialog is hidden. Instead of using this functionality, we recommend that you simply call diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index 4bf78e2115..e1fb1055ae 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -397,7 +397,7 @@ void QProgressDialog::setLabelText(const QString &text) Sets the cancel button to the push button, \a cancelButton. The progress dialog takes ownership of this button which will be deleted when necessary, so do not pass the address of an object that is on - the stack, i.e. use new() to create the button. If 0 is passed then + the stack, i.e. use new() to create the button. If \nullptr is passed, no cancel button will be shown. \sa setCancelButtonText() diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp index 028010d3dd..94188f3485 100644 --- a/src/widgets/effects/qgraphicseffect.cpp +++ b/src/widgets/effects/qgraphicseffect.cpp @@ -178,7 +178,7 @@ QRectF QGraphicsEffect::sourceBoundingRect(Qt::CoordinateSystem system) const /*! Returns a pointer to the item if this source is a QGraphicsItem; otherwise - returns 0. + returns \nullptr. \sa widget() */ @@ -189,7 +189,7 @@ const QGraphicsItem *QGraphicsEffectSource::graphicsItem() const /*! Returns a pointer to the widget if this source is a QWidget; otherwise - returns 0. + returns \nullptr. \sa graphicsItem() */ @@ -200,7 +200,7 @@ const QWidget *QGraphicsEffectSource::widget() const /*! Returns a pointer to the style options (used when drawing the source) if - available; otherwise returns 0. + available; otherwise returns \nullptr. \sa graphicsItem(), widget() */ diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 3a9bfab298..86f3d6a2f0 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -1726,8 +1726,8 @@ QGraphicsItem *QGraphicsItem::topLevelItem() const /*! \since 4.6 - Returns a pointer to the item's parent, cast to a QGraphicsObject. returns 0 if the parent item - is not a QGraphicsObject. + Returns a pointer to the item's parent, cast to a QGraphicsObject. Returns + \nullptr if the parent item is not a QGraphicsObject. \sa parentItem(), childItems() */ diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.cpp b/src/widgets/graphicsview/qgraphicslayoutitem.cpp index 9951fc0383..aed154a95f 100644 --- a/src/widgets/graphicsview/qgraphicslayoutitem.cpp +++ b/src/widgets/graphicsview/qgraphicslayoutitem.cpp @@ -369,7 +369,7 @@ bool QGraphicsLayoutItemPrivate::hasWidthForHeight() const protected constructor, or by calling setParentLayoutItem(). The parentLayoutItem() function returns a pointer to the item's layoutItem parent. If the item's parent is 0 or if the parent does not inherit - from QGraphicsItem, the parentLayoutItem() function then returns 0. + from QGraphicsItem, the parentLayoutItem() function then returns \nullptr. isLayout() returns \c true if the QGraphicsLayoutItem subclass is itself a layout, or false otherwise. diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp index 7bc0ece4b3..9508aed3d3 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.cpp +++ b/src/widgets/itemviews/qabstractitemdelegate.cpp @@ -240,7 +240,7 @@ QAbstractItemDelegate::~QAbstractItemDelegate() model being used. The editor's parent widget is specified by \a parent, and the item options by \a option. - The base implementation returns 0. If you want custom editing you + The base implementation returns \nullptr. If you want custom editing you will need to reimplement this function. The returned editor widget should have Qt::StrongFocus; diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index 72e0a67a64..b9c0e0a4b7 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -1375,7 +1375,7 @@ void QListWidget::setSelectionModel(QItemSelectionModel *selectionModel) /*! Returns the item that occupies the given \a row in the list if one has been - set; otherwise returns 0. + set; otherwise returns \nullptr. \sa row() */ @@ -1442,7 +1442,7 @@ void QListWidget::insertItems(int row, const QStringList &labels) /*! Removes and returns the item from the given \a row in the list widget; - otherwise returns 0. + otherwise returns \nullptr. Items removed from a list widget will not be managed by Qt, and will need to be deleted manually. diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp index 2d539e10ba..eee3e91ac3 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -1936,7 +1936,7 @@ int QTableWidget::column(const QTableWidgetItem *item) const /*! Returns the item for the given \a row and \a column if one has been set; otherwise - returns 0. + returns \nullptr. \sa setItem() */ @@ -2029,7 +2029,7 @@ QTableWidgetItem *QTableWidget::takeVerticalHeaderItem(int row) /*! Returns the horizontal header item for column, \a column, if one has been - set; otherwise returns 0. + set; otherwise returns \nullptr. */ QTableWidgetItem *QTableWidget::horizontalHeaderItem(int column) const { @@ -2435,7 +2435,7 @@ int QTableWidget::visualColumn(int logicalColumn) const /*! \fn QTableWidgetItem *QTableWidget::itemAt(const QPoint &point) const - Returns a pointer to the item at the given \a point, or returns 0 if + Returns a pointer to the item at the given \a point, or returns \nullptr if \a point is not covered by an item in the table widget. \sa item() diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index a0af27115d..9fbfb50029 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -2688,7 +2688,7 @@ void QTreeWidget::addTopLevelItem(QTreeWidgetItem *item) /*! Removes the top-level item at the given \a index in the tree and - returns it, otherwise returns 0; + returns it, otherwise returns \nullptr; \sa insertTopLevelItem(), topLevelItem(), topLevelItemCount() */ diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 6800a51d4b..ebab87b193 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -360,7 +360,7 @@ void QApplicationPrivate::createEventDispatcher() /*! \fn QWidget *QApplication::topLevelAt(const QPoint &point) - Returns the top-level widget at the given \a point; returns 0 if + Returns the top-level widget at the given \a point; returns \nullptr if there is no such widget. */ QWidget *QApplication::topLevelAt(const QPoint &pos) @@ -1226,7 +1226,7 @@ void QApplication::setStyle(QStyle *style) "windows", "windowsvista", "fusion", or "macintosh". Style names are case insensitive. - Returns 0 if an unknown \a style is passed, otherwise the QStyle object + Returns \nullptr if an unknown \a style is passed, otherwise the QStyle object returned is set as the application's GUI style. \warning To ensure that the application's style is set correctly, it is @@ -2177,7 +2177,7 @@ void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous) /*!internal * Helper function that returns the new focus widget, but does not set the focus reason. - * Returns 0 if a new focus widget could not be found. + * Returns \nullptr if a new focus widget could not be found. * Shared with QGraphicsProxyWidgetPrivate::findFocusChild() */ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool next, diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index 66e8858e21..600934b8a1 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -1825,7 +1825,7 @@ int QFormLayout::rowCount() const /*! Returns the layout item in the given \a row with the specified \a - role (column). Returns 0 if there is no such item. + role (column). Returns \nullptr if there is no such item. \sa QLayout::itemAt(), setItem() */ diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 2a94b25ec9..9f7c486148 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -10409,7 +10409,7 @@ bool QWidget::hasHeightForWidth() const Returns the visible child widget at the position (\a{x}, \a{y}) in the widget's coordinate system. If there is no visible child - widget at the specified position, the function returns 0. + widget at the specified position, the function returns \nullptr. */ /*! @@ -12373,7 +12373,7 @@ Q_WIDGETS_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget) \since 4.5 Returns the proxy widget for the corresponding embedded widget in a graphics - view; otherwise returns 0. + view; otherwise returns \nullptr. \sa QGraphicsProxyWidget::createProxyForChildWidget(), QGraphicsScene::addWidget() diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index c959994d2c..b0ce5e52cf 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -77,7 +77,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, /*! Creates and returns a QStyle object that matches the given \a key, or - returns 0 if no matching style is found. + returns \nullptr if no matching style is found. Both built-in styles and styles from style plugins are queried for a matching style. diff --git a/src/widgets/util/qundogroup.cpp b/src/widgets/util/qundogroup.cpp index f9605c7a2f..9bd63d4232 100644 --- a/src/widgets/util/qundogroup.cpp +++ b/src/widgets/util/qundogroup.cpp @@ -242,7 +242,7 @@ void QUndoGroup::setActiveStack(QUndoStack *stack) Returns the active stack of this group. If none of the stacks are active, or if the group is empty, this function - returns 0. + returns \nullptr. \sa setActiveStack(), QUndoStack::setActive() */ diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp index 31f6c0dff2..c862cbcea5 100644 --- a/src/widgets/util/qundoview.cpp +++ b/src/widgets/util/qundoview.cpp @@ -412,7 +412,7 @@ void QUndoView::setGroup(QUndoGroup *group) /*! Returns the group displayed by this view. - If the view is not looking at group, this function returns 0. + If the view is not looking at group, this function returns \nullptr. \sa setGroup(), setStack() */ diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 5854472ff0..f30a3bc7b8 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -805,7 +805,7 @@ bool QAbstractButton::autoExclusive() const Returns the group that this button belongs to. If the button is not a member of any QButtonGroup, this function - returns 0. + returns \nullptr. \sa QButtonGroup */ diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 4e1aa51b4b..00ac5034e9 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -692,7 +692,7 @@ QLineEdit *QAbstractSpinBox::lineEdit() const QAbstractSpinBox takes ownership of the new lineEdit - If QLineEdit::validator() for the \a lineEdit returns 0, the internal + If QLineEdit::validator() for the \a lineEdit returns \nullptr, the internal validator of the spinbox will be set on the line edit. */ diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index e3c29ff6ee..48253b52b0 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -2283,7 +2283,7 @@ int QMenu::columnCount() const } /*! - Returns the item at \a pt; returns 0 if there is no item there. + Returns the item at \a pt; returns \nullptr if there is no item there. */ QAction *QMenu::actionAt(const QPoint &pt) const { diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index ce74a4c2ff..e7984078de 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -1581,7 +1581,7 @@ bool QMenuBar::eventFilter(QObject *object, QEvent *event) } /*! - Returns the QAction at \a pt. Returns 0 if there is no action at \a pt or if + Returns the QAction at \a pt. Returns \nullptr if there is no action at \a pt or if the location has a separator. \sa addAction(), addSeparator() -- cgit v1.2.3 From eef4d16639d739a7ddf59bc44a9c4d54f67fafa7 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 21 Dec 2018 16:45:01 +0100 Subject: QtOpenGLExtensions: Unify license headers Change-Id: If410c0dc739657a65732d29d45a86a35bee359de Reviewed-by: Jani Heikkinen --- src/openglextensions/qopenglextensions.cpp | 2 +- src/openglextensions/qopenglextensions.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openglextensions/qopenglextensions.cpp b/src/openglextensions/qopenglextensions.cpp index e923e7cead..6413ae4a78 100644 --- a/src/openglextensions/qopenglextensions.cpp +++ b/src/openglextensions/qopenglextensions.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB) ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGLExtensions module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/src/openglextensions/qopenglextensions.h b/src/openglextensions/qopenglextensions.h index afbc18f474..59dbdd4f12 100644 --- a/src/openglextensions/qopenglextensions.h +++ b/src/openglextensions/qopenglextensions.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB) ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGLExtensions module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage -- cgit v1.2.3 From 911da982df662dfddbb087ca33af239574dd8132 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Fri, 11 Jan 2019 10:25:55 +0100 Subject: qmltestcase: Fix generation of Visual Studio project files Mimicking the approach from testlib_defines.prf, DEFINES containing a path surrounded by quotation marks have to be handled differently for Visual Studio projects. Change-Id: I26f6a45d4df154f599e8be15b3aa3905cf703a1f Reviewed-by: Joerg Bornemann --- mkspecs/features/qmltestcase.prf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/qmltestcase.prf b/mkspecs/features/qmltestcase.prf index 216f37d61a..b4b1224781 100644 --- a/mkspecs/features/qmltestcase.prf +++ b/mkspecs/features/qmltestcase.prf @@ -1,7 +1,8 @@ !isEmpty(SOURCES) { QT += qml qmltest load(testcase) - DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$_PRO_FILE_PWD_\\\"\" + contains(TEMPLATE, vc.*): DEFINES += QUICK_TEST_SOURCE_DIR=\"$$_PRO_FILE_PWD_\" + else: DEFINES += QUICK_TEST_SOURCE_DIR=$$shell_quote(\"$$_PRO_FILE_PWD_\") } else { # Allow a project to run tests without a CPP stub TEMPLATE = aux -- cgit v1.2.3 From 7044409c878f100c005b76fc90717b4f71667f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 11 Jan 2019 12:12:11 +0100 Subject: macOS: Use tool environment to ensure tests load matching Qt libraries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linking with a framework suffix to pick up the debug version of libraries doesn't work as long as the dependencies picked up from prl files are not rewritten to also include the suffix. The result is that we end up loading both release and debug versions of the Qt libraries. Use the target environment (target_wrapper.sh) to set the image suffix instead, which means 'make check' will automatically work. Change-Id: I60b0840760f68e579c270245d394e1dd609a0ebb Reviewed-by: Timur Pocheptsov Reviewed-by: Tor Arne Vestbø --- mkspecs/features/qt.prf | 8 -------- mkspecs/features/testcase.prf | 10 +++++++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 5da82fdb5b..d8d5acaafd 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -209,14 +209,6 @@ for(ever) { !isEmpty(MODULE_MODULE) { contains(MODULE_CONFIG, lib_bundle) { framework = $$MODULE_MODULE - qtConfig(debug_and_release):qt_link_suffixed_framework:!macx-xcode { - platform_target_suffix = $$qtPlatformTargetSuffix() - !isEmpty(platform_target_suffix): \ - # The -framework linker argument supports a name[,suffix] version, - # where if the suffix is specified the framework is first searched - # for the library with the suffix and then without. - framework = $$framework,$$platform_target_suffix - } LIBS$$var_sfx += -framework $$framework } else { !isEmpty(MODULE_LIBS_ADD): \ diff --git a/mkspecs/features/testcase.prf b/mkspecs/features/testcase.prf index bfc28c6861..b8102c26b5 100644 --- a/mkspecs/features/testcase.prf +++ b/mkspecs/features/testcase.prf @@ -21,15 +21,19 @@ testcase_lowdpi { } } -# Make sure we explicitly link to the debug version of the Qt libraries if needed -macos: CONFIG += qt_link_suffixed_framework - benchmark: type = benchmark else: type = check $${type}.files = $${type}.path = . +# Make sure we explicitly load the debug version of the Qt libraries if needed +macos { + dyld_image_suffix.name = DYLD_IMAGE_SUFFIX + dyld_image_suffix.value = $$qtPlatformTargetSuffix() + QT_TOOL_ENV += dyld_image_suffix +} + # Add environment for non-installed builds. Do this first, so the # 'make' variable expansions don't end up in a batch file/script. QT_TOOL_NAME = target -- cgit v1.2.3 From 6e21c9ac4a70c448b42666b622d6001fefc1c231 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 13 Jan 2019 15:38:30 +0100 Subject: QLocale: fix crash when using qDebug() in a global destructor `kdevelop -s doesnotexist` led to ASSERT failure in Q_GLOBAL_STATIC: "The global static was used after being destroyed because of a qDebug() statement in some "unregister" method called by a global object's destructor. This is normally fine, but with %{time} in QT_MESSAGE_PATTERN, qDebug() ends up using QLocale after its global objects (systemLocalePrivate and defaultLocalePrivate) were destroyed. Change-Id: I8d8b34e0197ad1eda8283fcf36d2c250385bb1a3 Reviewed-by: Thiago Macieira --- src/corelib/tools/qlocale.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 1f5d5f0dc6..63499ab93f 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2367,6 +2367,8 @@ QLocale QLocale::system() { // this function is NOT thread-safe! QT_PREPEND_NAMESPACE(systemData)(); // trigger updating of the system data if necessary + if (systemLocalePrivate.isDestroyed()) + return QLocale(QLocale::C); return QLocale(*systemLocalePrivate->data()); } -- cgit v1.2.3 From 6178913a234dfbb5a24c9128f6460f070fb7ce14 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Mon, 14 Jan 2019 09:12:55 +0200 Subject: Bump version Change-Id: I80954f7a3f33dbc8f04b61ebe5b5ed8b6ecb7b6a --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index 518aa07f06..6c2b67442a 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -4,4 +4,4 @@ CONFIG += warning_clean QT_SOURCE_TREE = $$PWD QT_BUILD_TREE = $$shadowed($$PWD) -MODULE_VERSION = 5.12.1 +MODULE_VERSION = 5.12.2 -- cgit v1.2.3 From c365fa49d85810c6ad09bb5f43b5081cd7543bf1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 19 Dec 2016 13:50:17 +0100 Subject: fix out-of-bounds access on trailing percent sign in tr() argument tr() recognizes %n and %Ln. it offers no way to escape lone percent signs, which implies that they must be interpreted verbatim, which is what the code actually does. except that it would run off the end if the % appeared at the end of the string. Fixes: QTBUG-57171 Done-with: Mateusz Starzycki Change-Id: Icf81925c482be1ea66ec8daafb3e92ad17ea7fab Reviewed-by: Oswald Buddenhagen --- src/corelib/kernel/qcoreapplication.cpp | 4 ++++ tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp | 6 ++++++ tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h | 1 + 3 files changed, 11 insertions(+) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 3c8b0f947c..b6b4da3885 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2097,9 +2097,13 @@ static void replacePercentN(QString *result, int n) int len = 0; while ((percentPos = result->indexOf(QLatin1Char('%'), percentPos + len)) != -1) { len = 1; + if (percentPos + len == result->length()) + break; QString fmt; if (result->at(percentPos + len) == QLatin1Char('L')) { ++len; + if (percentPos + len == result->length()) + break; fmt = QLatin1String("%L1"); } else { fmt = QLatin1String("%1"); diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index a53501b9dd..6adb393ddd 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -928,6 +928,12 @@ void tst_QCoreApplication::threadedEventDelivery() thread.start(); QVERIFY(thread.wait(1000)); QCOMPARE(receiver.recordedEvents.contains(QEvent::User + 1), eventsReceived); + +} + +void tst_QCoreApplication::testTrWithPercantegeAtTheEnd() +{ + QCoreApplication::translate("testcontext", "this will crash%", "testdisamb", 3); } #if QT_CONFIG(library) diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h index 105cca5174..2a23cf0751 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h @@ -59,6 +59,7 @@ private slots: void applicationEventFilters_auxThread(); void threadedEventDelivery_data(); void threadedEventDelivery(); + void testTrWithPercantegeAtTheEnd(); #if QT_CONFIG(library) void addRemoveLibPaths(); #endif -- cgit v1.2.3 From 2ab139596d058cf9cc93e723c340467c70d93b10 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 10 Jan 2019 13:07:30 +0100 Subject: Fix alignment-warnings about Q_DECLARE_PRIVATE's casts Q_DECLARE_PRIVATE gets used in the declaration of the public class, where the private class is typically visible only as a forward-decl, with no knowledge of what it's based on; consequently, the macro is obliged to use reinterpret_cast<>, which is subject to warnings when the compiler *can* see both types and their alignments differ. The same applies to Q_DECLARE_PRIVATE_D. So suppress gcc's -Wcast-align around the d_func() return statements. (If we get similar problems with other compilers we can add their suppressions likewise; but, for now, we've only seen this on MIPS64, where we use gcc.) This tripped over one use of Q_DECLARE_PRIVATE in a private Q_SLOTS: section; for some reason, gcc didn't like the semicolon on the friend declaration. Changing the context to plain private fixed that. Fixes: QTBUG-72885 Change-Id: I5edc11d46bd4eb820713adede79d53191a7e2736 Reviewed-by: Liang Qi Reviewed-by: Ville Voutilainen Reviewed-by: Boxiang Sun --- src/corelib/global/qglobal.h | 14 ++++++++++---- src/network/access/qnetworkreplyfileimpl_p.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index b608489576..ccab228804 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1037,14 +1037,20 @@ for (auto _container_ = QtPrivate::qMakeForeachContainer(container); \ template inline T *qGetPtrHelper(T *ptr) { return ptr; } template inline auto qGetPtrHelper(const Ptr &ptr) -> decltype(ptr.operator->()) { return ptr.operator->(); } +// The body must be a statement: +#define Q_CAST_IGNORE_ALIGN(body) QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wcast-align") body QT_WARNING_POP #define Q_DECLARE_PRIVATE(Class) \ - inline Class##Private* d_func() { return reinterpret_cast(qGetPtrHelper(d_ptr)); } \ - inline const Class##Private* d_func() const { return reinterpret_cast(qGetPtrHelper(d_ptr)); } \ + inline Class##Private* d_func() \ + { Q_CAST_IGNORE_ALIGN(return reinterpret_cast(qGetPtrHelper(d_ptr));) } \ + inline const Class##Private* d_func() const \ + { Q_CAST_IGNORE_ALIGN(return reinterpret_cast(qGetPtrHelper(d_ptr));) } \ friend class Class##Private; #define Q_DECLARE_PRIVATE_D(Dptr, Class) \ - inline Class##Private* d_func() { return reinterpret_cast(qGetPtrHelper(Dptr)); } \ - inline const Class##Private* d_func() const { return reinterpret_cast(qGetPtrHelper(Dptr)); } \ + inline Class##Private* d_func() \ + { Q_CAST_IGNORE_ALIGN(return reinterpret_cast(qGetPtrHelper(Dptr));) } \ + inline const Class##Private* d_func() const \ + { Q_CAST_IGNORE_ALIGN(return reinterpret_cast(qGetPtrHelper(Dptr));) } \ friend class Class##Private; #define Q_DECLARE_PUBLIC(Class) \ diff --git a/src/network/access/qnetworkreplyfileimpl_p.h b/src/network/access/qnetworkreplyfileimpl_p.h index 55aece0bed..48d82abd3f 100644 --- a/src/network/access/qnetworkreplyfileimpl_p.h +++ b/src/network/access/qnetworkreplyfileimpl_p.h @@ -80,6 +80,7 @@ public: private Q_SLOTS: void fileOpenFinished(bool isOpen); +private: Q_DECLARE_PRIVATE(QNetworkReplyFileImpl) }; -- cgit v1.2.3 From 1b47e7154a31a4747942043df933a3af978dc1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 9 Jan 2019 02:32:36 +0100 Subject: Fix default rpath dirs on Apple platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The @executable_path relative framework directory is one step below the executable, as in: Foo.app/Contents/Frameworks not: Foo.app/Contents/MacOS/Frameworks The former is what Xcode defaults to for new projects. Change-Id: Id08f3f1d80f1c84d76fb71676c5df4a3a6b3da36 Reviewed-by: Kai Koehne Reviewed-by: Joerg Bornemann Reviewed-by: Tor Arne Vestbø --- mkspecs/features/mac/default_post.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index 8e2c5e603a..c46222debd 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -67,7 +67,7 @@ qt { # Add the same default rpaths as Xcode does for new projects. # This is especially important for iOS/tvOS/watchOS where no other option is possible. !no_default_rpath { - QMAKE_RPATHDIR += @executable_path/Frameworks + QMAKE_RPATHDIR += @executable_path/../Frameworks equals(TEMPLATE, lib):!plugin:lib_bundle: QMAKE_RPATHDIR += @loader_path/Frameworks } -- cgit v1.2.3 From eabef55b8bd61b8693c4ed61c667bb0bbade0904 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 15 Jan 2019 09:56:18 +0100 Subject: testlib: Add missing header files to .pro file With all the headers missing, Creator's clang code model just gives up and it's impossible to work on testlib in Creator. Change-Id: I8814264db10992eeec6f45625580f6788d23b56b Reviewed-by: Edward Welbourne --- src/testlib/testlib.pro | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro index 46b61dac07..34bb581e02 100644 --- a/src/testlib/testlib.pro +++ b/src/testlib/testlib.pro @@ -12,6 +12,7 @@ unix:!embedded:QMAKE_PKGCONFIG_DESCRIPTION = Qt \ QMAKE_DOCS = $$PWD/doc/qttestlib.qdocconf HEADERS = \ + qabstracttestlogger_p.h \ qbenchmark.h \ qbenchmark_p.h \ qbenchmarkmeasurement_p.h \ @@ -21,10 +22,16 @@ HEADERS = \ qbenchmarkperfevents_p.h \ qbenchmarkmetric.h \ qbenchmarkmetric_p.h \ + qcsvbenchmarklogger_p.h \ + qplaintestlogger_p.h \ + qsignaldumper_p.h \ qsignalspy.h \ + qteamcitylogger_p.h \ qtestaccessible.h \ qtestassert.h \ qtestcase.h \ + qtestcoreelement_p.h \ + qtestcorelist_p.h \ qtestdata.h \ qtestevent.h \ qtesteventloop.h \ @@ -32,15 +39,23 @@ HEADERS = \ qtest_network.h \ qtest_widgets.h \ qtest.h \ + qtestelement_p.h \ + qtestelementattribute_p.h \ qtestkeyboard.h \ + qtestlog_p.h \ qtestmouse.h \ + qtestresult_p.h \ qtestspontaneevent.h \ qtestsystem.h \ + qtesttable_p.h \ qtesttouch.h \ qtestblacklist_p.h \ qtesthelpers_p.h \ qttestglobal.h \ - qtaptestlogger_p.h + qtestxunitstreamer_p.h \ + qtaptestlogger_p.h \ + qxmltestlogger_p.h \ + qxunittestlogger_p.h SOURCES = \ qtestcase.cpp \ -- cgit v1.2.3 From a7fa2618e4c8f10927a01d415d96ee783cf4348d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 14 Jan 2019 13:00:06 -0600 Subject: Update QOpenGLTexture::generateMipMaps for ES 3 Per the Khronos documentation, this operation is not permitted on ES 3. Change-Id: Iff70ef83d48228277b883df588011432ba80f4bd Reviewed-by: Giuseppe D'Angelo --- src/gui/opengl/qopengltexture.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index cea4b51a5c..5b7956d31e 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -3914,8 +3914,7 @@ bool QOpenGLTexture::isAutoMipMapGenerationEnabled() const have disabled automatic mipmap generation then you need to call this function or the overload to create the mipmap chain. - \note Mipmap generation is not supported for compressed textures with OpenGL - ES 2.0. + \note Mipmap generation is not supported for compressed textures with OpenGL ES. \sa setAutoMipMapGenerationEnabled(), setMipLevels(), mipLevels() */ @@ -3926,7 +3925,7 @@ void QOpenGLTexture::generateMipMaps() Q_ASSERT(d->textureId); if (isCompressedFormat(d->format)) { if (QOpenGLContext *ctx = QOpenGLContext::currentContext()) - if (ctx->isOpenGLES() && ctx->format().majorVersion() < 3) + if (ctx->isOpenGLES()) return; } d->texFuncs->glGenerateTextureMipmap(d->textureId, d->target, d->bindingTarget); @@ -3951,7 +3950,7 @@ void QOpenGLTexture::generateMipMaps(int baseLevel, bool resetBaseLevel) Q_ASSERT(d->textureId); if (isCompressedFormat(d->format)) { if (QOpenGLContext *ctx = QOpenGLContext::currentContext()) - if (ctx->isOpenGLES() && ctx->format().majorVersion() < 3) + if (ctx->isOpenGLES()) return; } int oldBaseLevel; -- cgit v1.2.3 From 8961493b4036af018842820238c4eda0c0717e64 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 11 Jan 2019 10:37:46 +0100 Subject: QMacStyle - take into account that native controls are transparent now MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We use NSButton to emulate tabs in QTabWidget. Starting from 10.14 in dark theme those button objects tend to be somewhat transparent, thus widget's frame is visible through tab buttons. This is true for native controls also - NSButton, NSSegmentedControl, NSTabView - they all show the similar behavior. The only difference is NSTabView, which is the closest control to our QTabWidget - tab buttons are transparent, but they (AppKit) it would appear just do not draw the frame under this area. Let's do the same, but using clipping. Task-number: QTBUG-71741 Change-Id: I9f19014d0db5f36bacf76ee0068fae6eee793c0f Reviewed-by: Tor Arne Vestbø --- src/plugins/styles/mac/qmacstyle_mac.mm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index b84448d5e2..c2b6fbfead 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -130,6 +130,7 @@ #include #endif #include +#include #include #include #include @@ -314,6 +315,26 @@ static QLinearGradient titlebarGradientInactive() return qt_mac_applicationIsInDarkMode() ? darkGradient : lightGradient; } +static void clipTabBarFrame(const QStyleOption *option, const QMacStyle *style, CGContextRef ctx) +{ + Q_ASSERT(option); + Q_ASSERT(style); + Q_ASSERT(ctx); + + if (qt_mac_applicationIsInDarkMode()) { + QTabWidget *tabWidget = qobject_cast(option->styleObject); + Q_ASSERT(tabWidget); + + const QRect tabBarRect = style->subElementRect(QStyle::SE_TabWidgetTabBar, option, tabWidget).adjusted(2, 2, -3, -2); + const QRegion clipPath = QRegion(option->rect) - tabBarRect; + QVarLengthArray cgRects; + for (const QRect &qtRect : clipPath) + cgRects.push_back(qtRect.toCGRect()); + if (cgRects.size()) + CGContextClipToRects(ctx, &cgRects[0], size_t(cgRects.size())); + } +} + static const QColor titlebarSeparatorLineActive(111, 111, 111); static const QColor titlebarSeparatorLineInactive(131, 131, 131); static const QColor darkModeSeparatorLine(88, 88, 88); @@ -2976,6 +2997,8 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai // QDarkNSBox, of type NSBoxCustom. Its appearance is close enough to the real thing so // we can use this for now. d->drawNSViewInRect(box, opt->rect, p, ^(CGContextRef ctx, const CGRect &rect) { + if (QTabWidget *tabWidget = qobject_cast(opt->styleObject)) + clipTabBarFrame(opt, this, ctx); CGContextTranslateCTM(ctx, 0, rect.origin.y + rect.size.height); CGContextScaleCTM(ctx, 1, -1); if (QOperatingSystemVersion::current() < QOperatingSystemVersion::MacOSMojave @@ -3699,6 +3722,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // inFrame:withView:], -[drawRect:] or anything in between. Besides, // there's no public API do draw the pressed state, AFAICS. We'll use // a push NSButton instead and clip the CGContext. + // NOTE/TODO: this is not true. On 10.13 NSSegmentedControl works with + // some (black?) magic/magic dances, on 10.14 it simply works (was + // it fixed in AppKit?). But, indeed, we cannot make a tab 'pressed' + // with NSSegmentedControl (only selected), so we stay with buttons + // (mixing buttons and NSSegmentedControl for such a simple thing + // is too much work). const auto cs = d->effectiveAquaSizeConstrain(opt, w); // Extra hacks to get the proper pressed appreance when not selected or selected and inactive -- cgit v1.2.3 From b782004149610d5c6af27e12d788acfb213b84d0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 15 Jan 2019 16:38:01 +0100 Subject: Fix multiple emission of QGuiApplication::lastWindowClosed() when native child widgets are used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run the handling in QWindowPrivate::maybeQuitOnLastWindowClosed() for top level windows only. Fixes: QTBUG-73061 Change-Id: I74deb50b06a64e8ef0e438d2abf14888f778a46e Reviewed-by: Tor Arne Vestbø Reviewed-by: Qt CI Bot --- src/gui/kernel/qwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 61ef029cbd..e0da4d0ea7 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2588,6 +2588,8 @@ void QWindowPrivate::maybeQuitOnLastWindowClosed() return; Q_Q(QWindow); + if (!q->isTopLevel()) + return; // Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent bool quitOnClose = QGuiApplication::quitOnLastWindowClosed() && !q->parent(); QWindowList list = QGuiApplication::topLevelWindows(); -- cgit v1.2.3 From fa2821b484dfe21de1af508bec314ff865917014 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 9 Jan 2019 10:33:30 +0100 Subject: Add the command line option --no-strip to androiddeployqt There are certain use cases for keeping debug information on the device, for example collecting stack traces when the app crashes. [ChangeLog][Android] Added the --no-strip command line option to androiddeployqt. Change-Id: I96574c2c57d85fb23d5fc65380e471fa892b6543 Fixes: QTBUG-57771 Reviewed-by: Volker Krause Reviewed-by: Andy Shaw --- src/tools/androiddeployqt/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 587ae21e4f..af3a3ae39a 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -128,6 +128,7 @@ struct Options bool build; bool gradle; bool auxMode; + bool stripLibraries = true; QTime timer; // External tools @@ -437,6 +438,8 @@ Options parseOptions() options.generateAssetsFileList = false; } else if (argument.compare(QLatin1String("--aux-mode"), Qt::CaseInsensitive) == 0) { options.auxMode = true; + } else if (argument.compare(QLatin1String("--no-strip"), Qt::CaseInsensitive) == 0) { + options.stripLibraries = false; } } @@ -525,6 +528,7 @@ void printHelp() " --aux-mode: Operate in auxiliary mode. This will only copy the\n" " dependencies into the build directory and update the XML templates.\n" " The project will not be built or installed.\n" + " --no-strip: Do not strip debug symbols from libraries.\n" " --help: Displays this information.\n\n", qPrintable(QCoreApplication::arguments().at(0)) ); @@ -1897,6 +1901,8 @@ bool stripFile(const Options &options, const QString &fileName) bool stripLibraries(const Options &options) { + if (!options.stripLibraries) + return true; if (options.verbose) fprintf(stdout, "Stripping libraries to minimize size.\n"); -- cgit v1.2.3 From f8f0f3eef1151c9377a5c76ccfa6432e930e1307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 14 Jan 2019 10:37:42 +0100 Subject: QSyntaxHighlighter: cancel delayed highlight if done manually MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was an implicit effect before which stopped working after dec7961709c90f6977d2447f7fa6c6625af41cb2. Reintroduce it as some projects used this side-effect as a way to abort the initial highlighting. Change-Id: I5340ee9882a242bc8b5f7f843f1cfe793a65d357 Reviewed-by: Jędrzej Nowacki --- src/gui/text/qsyntaxhighlighter.cpp | 1 + .../qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index b09f8b565a..0e07b69868 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -376,6 +376,7 @@ void QSyntaxHighlighter::rehighlight() QTextCursor cursor(d->doc); d->rehighlight(cursor, QTextCursor::End); + d->rehighlightPending = false; // user manually did a full rehighlight } /*! diff --git a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp index 9d6ce78b24..c683ecd424 100644 --- a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp +++ b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp @@ -82,6 +82,7 @@ private slots: void preservePreeditArea(); void task108530(); void avoidUnnecessaryRehighlight(); + void avoidUnnecessaryDelayedRehighlight(); void noContentsChangedDuringHighlight(); void rehighlight(); void rehighlightBlock(); @@ -478,6 +479,24 @@ void tst_QSyntaxHighlighter::avoidUnnecessaryRehighlight() QTRY_VERIFY(!hl->highlighted); } +void tst_QSyntaxHighlighter::avoidUnnecessaryDelayedRehighlight() +{ + // Having text in the document before creating the highlighter starts the delayed rehighlight + cursor.insertText("Hello World"); + + TestHighlighter *hl = new TestHighlighter(doc); + QVERIFY(!hl->highlighted); + + hl->rehighlight(); + QVERIFY(hl->highlighted); + + hl->highlighted = false; + // Process events, including delayed rehighlight emission + QCoreApplication::processEvents(); + // Should be cancelled and no extra rehighlight should be done + QVERIFY(!hl->highlighted); +} + void tst_QSyntaxHighlighter::noContentsChangedDuringHighlight() { QVector formats; -- cgit v1.2.3 From 8e500e15fa544f5eb9667f1c916d3764848bf4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 14 Jan 2019 16:30:45 +0100 Subject: tst_qsyntaxhighlighter: fix no-op QTRY_VERIFY check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bool is assigned on the previous line: QTRY_VERIFY will not do anything because the statement is already true. Change-Id: I067290e19ffd100819b2b631af431c6013623a00 Reviewed-by: Jędrzej Nowacki --- tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp index c683ecd424..55fff34a8e 100644 --- a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp +++ b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp @@ -476,7 +476,8 @@ void tst_QSyntaxHighlighter::avoidUnnecessaryRehighlight() QVERIFY(hl->highlighted); hl->highlighted = false; - QTRY_VERIFY(!hl->highlighted); + QCoreApplication::processEvents(); + QVERIFY(!hl->highlighted); } void tst_QSyntaxHighlighter::avoidUnnecessaryDelayedRehighlight() -- cgit v1.2.3 From 61af5abb33f98039733492633f5bf4b56efc9972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 15 Jan 2019 14:16:19 +0100 Subject: clang-cl: use GCC -m CPU feature flag option To enable non-default options Change-Id: I2d2f5dc8368a8235fd91e7f9986df4402612a823 Reviewed-by: Thiago Macieira Reviewed-by: Friedemann Kleint --- mkspecs/win32-clang-msvc/qmake.conf | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/mkspecs/win32-clang-msvc/qmake.conf b/mkspecs/win32-clang-msvc/qmake.conf index 027f93ca6e..c639ad6f3d 100644 --- a/mkspecs/win32-clang-msvc/qmake.conf +++ b/mkspecs/win32-clang-msvc/qmake.conf @@ -6,6 +6,27 @@ include(../common/msvc-desktop.conf) +# clang-cl does not use anything above SSE2 without extra arguments +QMAKE_CFLAGS_SSE3 = -msse3 +QMAKE_CFLAGS_SSSE3 = -mssse3 +QMAKE_CFLAGS_SSE4_1 = -msse4.1 +QMAKE_CFLAGS_SSE4_2 = -msse4.2 +QMAKE_CFLAGS_AVX = -mavx +QMAKE_CFLAGS_AVX2 = -mavx2 +QMAKE_CFLAGS_F16C = -mf16c +QMAKE_CFLAGS_RDRND = -mrdrnd +QMAKE_CFLAGS_AVX512F = -mavx512f +QMAKE_CFLAGS_AVX512ER = -mavx512er +QMAKE_CFLAGS_AVX512CD = -mavx512cd +QMAKE_CFLAGS_AVX512PF = -mavx512pf +QMAKE_CFLAGS_AVX512DQ = -mavx512dq +QMAKE_CFLAGS_AVX512BW = -mavx512bw +QMAKE_CFLAGS_AVX512VL = -mavx512vl +QMAKE_CFLAGS_AVX512IFMA = -mavx512ifma +QMAKE_CFLAGS_AVX512VBMI = -mavx512vbmi +QMAKE_CFLAGS_AESNI = -maes +QMAKE_CFLAGS_SHANI = -msha + QMAKE_COMPILER += clang_cl llvm QMAKE_CC = clang-cl -- cgit v1.2.3 From 5d8b01468e8bd752dad090aaef4ccf3a83a58a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Thu, 27 Dec 2018 09:51:50 +0100 Subject: Update bundled libpng to version 1.6.36 The remaining diff to clean 1.6.36 is archived in the qtpatches.diff file. [ChangeLog][Third-Party Code] libpng was updated to version 1.6.36 Change-Id: Ia9d20c5abca115d509ed0aaf9eebfc85a88bef1d Reviewed-by: Kai Koehne Reviewed-by: Eirik Aavitsland --- src/3rdparty/libpng/ANNOUNCE | 99 +++++++---- src/3rdparty/libpng/CHANGES | 29 ++- src/3rdparty/libpng/LICENSE | 175 +++++++++--------- src/3rdparty/libpng/README | 111 ++++-------- src/3rdparty/libpng/libpng-manual.txt | 91 ++-------- src/3rdparty/libpng/png.c | 50 +++--- src/3rdparty/libpng/png.h | 303 ++++++++++++++------------------ src/3rdparty/libpng/pngconf.h | 16 +- src/3rdparty/libpng/pngdebug.h | 6 +- src/3rdparty/libpng/pngerror.c | 12 +- src/3rdparty/libpng/pngget.c | 6 +- src/3rdparty/libpng/pnginfo.h | 6 +- src/3rdparty/libpng/pnglibconf.h | 11 +- src/3rdparty/libpng/pngmem.c | 6 +- src/3rdparty/libpng/pngpread.c | 16 +- src/3rdparty/libpng/pngpriv.h | 38 +++- src/3rdparty/libpng/pngread.c | 32 ++-- src/3rdparty/libpng/pngrio.c | 6 +- src/3rdparty/libpng/pngrtran.c | 88 +++++++--- src/3rdparty/libpng/pngrutil.c | 39 ++-- src/3rdparty/libpng/pngset.c | 12 +- src/3rdparty/libpng/pngstruct.h | 10 +- src/3rdparty/libpng/pngtrans.c | 12 +- src/3rdparty/libpng/pngwio.c | 6 +- src/3rdparty/libpng/pngwrite.c | 38 ++-- src/3rdparty/libpng/pngwtran.c | 11 +- src/3rdparty/libpng/pngwutil.c | 38 ++-- src/3rdparty/libpng/qt_attribution.json | 6 +- 28 files changed, 634 insertions(+), 639 deletions(-) diff --git a/src/3rdparty/libpng/ANNOUNCE b/src/3rdparty/libpng/ANNOUNCE index 9fc9021b5a..f1724c0d0d 100644 --- a/src/3rdparty/libpng/ANNOUNCE +++ b/src/3rdparty/libpng/ANNOUNCE @@ -1,48 +1,77 @@ -Libpng 1.6.35 - July 15, 2018 +libpng 1.6.36 - December 1, 2018 +================================ This is a public release of libpng, intended for use in production code. -Files available for download: + +Files available for download +---------------------------- Source files with LF line endings (for Unix/Linux): - libpng-1.6.35.tar.xz (LZMA-compressed, recommended) - libpng-1.6.35.tar.gz + * libpng-1.6.36.tar.xz (LZMA-compressed, recommended) + * libpng-1.6.36.tar.gz Source files with CRLF line endings (for Windows): - lp1635.7z (LZMA-compressed, recommended) - lp1635.zip + * lp1636.7z (LZMA-compressed, recommended) + * lp1636.zip Other information: - libpng-1.6.35-README.txt - libpng-1.6.35-LICENSE.txt - -Changes since the last public release (1.6.34): - - Restored 21 of the contrib/pngsuite/i*.png, which do not cause test - failures. Placed the remainder in contrib/pngsuite/interlaced/i*.png. - Added calls to png_set_*() transforms commonly used by browsers to - the fuzzer. - Removed some unnecessary brackets in pngrtran.c - Fixed miscellaneous typos (Patch by github user "luzpaz"). - Change "ASM C" to "C ASM" in CMakeLists.txt - Fixed incorrect handling of bKGD chunk in sub-8-bit files (Cosmin) - Added hardware optimization directories to zip and 7z distributions. - Fixed incorrect bitmask for options. - Fixed many spelling typos. - Make png_get_iCCP consistent with man page (allow compression-type argument - to be NULL, bug report by Lenard Szolnoki). - Replaced the remaining uses of png_size_t with size_t (Cosmin) - Fixed the calculation of row_factor in png_check_chunk_length - (reported by Thuan Pham in SourceForge issue #278) - Added missing parentheses to a macro definition - (suggested by "irwir" in GitHub issue #216) - -Send comments/corrections/commendations to png-mng-implement at lists.sf.net -(subscription required; visit -https://lists.sourceforge.net/lists/listinfo/png-mng-implement -to subscribe). + * README.md + * LICENSE.md + * AUTHORS.md + * TRADEMARK.md + + +IMPORTANT licensing update: libpng license v2 +--------------------------------------------- + +The new libpng license comprises the terms and conditions from the zlib +license, and the disclaimer from the Boost license. + +The legacy libpng license, used until libpng-1.6.35, is appended to the +new license, following the precedent established in the Python Software +Foundation License version 2. -Glenn R-P +From now on, the list of contributing authors shall be maintained in a +separate AUTHORS file. The lists of previous contributing authors, +mentioned in the legacy libpng license and considered to be an integral +part of that license, are kept intact, with no further updates. + + +Changes since the previous public release (version 1.6.35) +---------------------------------------------------------- + + * Optimized png_do_expand_palette for ARM processors. + Improved performance by around 10-22% on a recent ARM Chromebook. + (Contributed by Richard Townsend, ARM Holdings) + * Fixed manipulation of machine-specific optimization options. + (Contributed by Vicki Pfau) + * Used memcpy instead of manual pointer arithmetic on Intel SSE2. + (Contributed by Samuel Williams) + * Fixed build errors with MSVC on ARM64. + (Contributed by Zhijie Liang) + * Fixed detection of libm in CMakeLists. + (Contributed by Cameron Cawley) + * Fixed incorrect creation of pkg-config file in CMakeLists. + (Contributed by Kyle Bentley) + * Fixed the CMake build on Windows MSYS by avoiding symlinks. + * Fixed a build warning on OpenBSD. + (Contributed by Theo Buehler) + * Fixed various typos in comments. + (Contributed by "luz.paz") + * Raised the minimum required CMake version from 3.0.2 to 3.1. + * Removed yet more of the vestigial support for pre-ANSI C compilers. + * Removed ancient makefiles for ancient systems that have been broken + across all previous libpng-1.6.x versions. + * Removed the Y2K compliance statement and the export control + information. + * Applied various code style and documentation fixes. + + +Send comments/corrections/commendations to png-mng-implement at lists.sf.net. +Subscription is required; visit +https://lists.sourceforge.net/lists/listinfo/png-mng-implement +to subscribe. diff --git a/src/3rdparty/libpng/CHANGES b/src/3rdparty/libpng/CHANGES index 0ed6a11872..bdd4480654 100644 --- a/src/3rdparty/libpng/CHANGES +++ b/src/3rdparty/libpng/CHANGES @@ -6063,9 +6063,34 @@ Version 1.6.35 [July 15, 2018] Added missing parentheses to a macro definition (suggested by "irwir" in GitHub issue #216) +Version 1.6.36 [December 1, 2018] + Optimized png_do_expand_palette for ARM processors. + Improved performance by around 10-22% on a recent ARM Chromebook. + (Contributed by Richard Townsend, ARM Holdings) + Fixed manipulation of machine-specific optimization options. + (Contributed by Vicki Pfau) + Used memcpy instead of manual pointer arithmetic on Intel SSE2. + (Contributed by Samuel Williams) + Fixed build errors with MSVC on ARM64. + (Contributed by Zhijie Liang) + Fixed detection of libm in CMakeLists. + (Contributed by Cameron Cawley) + Fixed incorrect creation of pkg-config file in CMakeLists. + (Contributed by Kyle Bentley) + Fixed the CMake build on Windows MSYS by avoiding symlinks. + Fixed a build warning on OpenBSD. + (Contributed by Theo Buehler) + Fixed various typos in comments. + (Contributed by "luz.paz") + Raised the minimum required CMake version from 3.0.2 to 3.1. + Removed yet more of the vestigial support for pre-ANSI C compilers. + Removed ancient makefiles for ancient systems that have been broken + across all previous libpng-1.6.x versions. + Removed the Y2K compliance statement and the export control + information. + Applied various code style and documentation fixes. + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe). - -Glenn R-P diff --git a/src/3rdparty/libpng/LICENSE b/src/3rdparty/libpng/LICENSE index 6ee9c8f554..62ab8e48dc 100644 --- a/src/3rdparty/libpng/LICENSE +++ b/src/3rdparty/libpng/LICENSE @@ -1,14 +1,43 @@ +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE +========================================= -This copy of the libpng notices is provided for your convenience. In case of -any discrepancy between this copy and the notices in the file png.h that is -included in the libpng distribution, the latter shall prevail. +PNG Reference Library License version 2 +--------------------------------------- -COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: + * Copyright (c) 1995-2018 The PNG Reference Library Authors. + * Copyright (c) 2018 Cosmin Truta. + * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. + * Copyright (c) 1996-1997 Andreas Dilger. + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. -If you modify libpng you may insert additional notices immediately following -this sentence. +The software is supplied "as is", without warranty of any kind, +express or implied, including, without limitation, the warranties +of merchantability, fitness for a particular purpose, title, and +non-infringement. In no even shall the Copyright owners, or +anyone distributing the software, be liable for any damages or +other liability, whether in contract, tort or otherwise, arising +from, out of, or in connection with the software, or the use or +other dealings in the software, even if advised of the possibility +of such damage. -This code is released under the libpng license. +Permission is hereby granted to use, copy, modify, and distribute +this software, or portions hereof, for any purpose, without fee, +subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you + use this software in a product, an acknowledgment in the product + documentation would be appreciated, but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + + +PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) +----------------------------------------------------------------------- libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are @@ -16,38 +45,38 @@ 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 added to the list of Contributing Authors: - Simon-Pierre Cadieux - Eric S. Raymond - Mans Rullgard - Cosmin Truta - Gilles Vollant - James Yu - Mandar Sahastrabuddhe - Google Inc. - Vadim Barkov + Simon-Pierre Cadieux + Eric S. Raymond + Mans Rullgard + Cosmin Truta + Gilles Vollant + James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov and with the following additions to the disclaimer: - There is no warranty against interference with your enjoyment of the - library or against infringement. There is no warranty that our - efforts or the library will fulfill any of your particular purposes - or needs. This library is provided with all faults, and the entire - risk of satisfactory quality, performance, accuracy, and effort is with - the user. + There is no warranty against interference with your enjoyment of + the library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is + with the user. Some files in the "contrib" directory and some configure-generated -files that are distributed with libpng have other copyright owners and +files that are distributed with libpng have other copyright owners, and are released under other open source licenses. libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from libpng-0.96, and are distributed according to the same disclaimer and -license as libpng-0.96, with the following individuals added to the list -of Contributing Authors: +license as libpng-0.96, with the following individuals added to the +list of Contributing Authors: - Tom Lane - Glenn Randers-Pehrson - Willem van Schaik + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik libpng versions 0.89, June 1996, through 0.96, May 1997, are Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, @@ -55,14 +84,14 @@ and are distributed according to the same disclaimer and license as libpng-0.88, with the following individuals added to the list of Contributing Authors: - John Bowler - Kevin Bracey - Sam Bushell - Magnus Holmgren - Greg Roelofs - Tom Tanner + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner -Some files in the "scripts" directory have other copyright owners +Some files in the "scripts" directory have other copyright owners, but are released under this license. libpng versions 0.5, May 1995, through 0.88, January 1996, are @@ -71,63 +100,35 @@ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. For the purposes of this copyright and license, "Contributing Authors" is defined as the following set of individuals: - Andreas Dilger - Dave Martindale - Guy Eric Schalnat - Paul Schmidt - Tim Wegner - -The PNG Reference Library is supplied "AS IS". The Contributing Authors -and Group 42, Inc. disclaim all warranties, expressed or implied, -including, without limitation, the warranties of merchantability and of -fitness for any purpose. The Contributing Authors and Group 42, Inc. -assume no liability for direct, indirect, incidental, special, exemplary, -or consequential damages, which may result from the use of the PNG -Reference Library, even if advised of the possibility of such damage. + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing +Authors and Group 42, Inc. disclaim all warranties, expressed or +implied, including, without limitation, the warranties of +merchantability and of fitness for any purpose. The Contributing +Authors and Group 42, Inc. assume no liability for direct, indirect, +incidental, special, exemplary, or consequential damages, which may +result from the use of the PNG Reference Library, even if advised of +the possibility of such damage. Permission is hereby granted to use, copy, modify, and distribute this source code, or portions hereof, for any purpose, without fee, subject to the following restrictions: - 1. The origin of this source code must not be misrepresented. - - 2. Altered versions must be plainly marked as such and must not - be misrepresented as being the original source. - - 3. This Copyright notice may not be removed or altered from any - source or altered source distribution. - -The Contributing Authors and Group 42, Inc. specifically permit, without -fee, and encourage the use of this source code as a component to -supporting the PNG file format in commercial products. If you use this -source code in a product, acknowledgment is not required but would be -appreciated. - -END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE. - -TRADEMARK: - -The name "libpng" has not been registered by the Copyright owner -as a trademark in any jurisdiction. However, because libpng has -been distributed and maintained world-wide, continually since 1995, -the Copyright owner claims "common-law trademark protection" in any -jurisdiction where common-law trademark is recognized. - -OSI CERTIFICATION: - -Libpng is OSI Certified Open Source Software. OSI Certified Open Source is -a certification mark of the Open Source Initiative. OSI has not addressed -the additional disclaimers inserted at version 1.0.7. + 1. The origin of this source code must not be misrepresented. -EXPORT CONTROL: + 2. Altered versions must be plainly marked as such and must not + be misrepresented as being the original source. -The Copyright owner believes that the Export Control Classification -Number (ECCN) for libpng is EAR99, which means not subject to export -controls or International Traffic in Arms Regulations (ITAR) because -it is open source, publicly available software, that does not contain -any encryption software. See the EAR, paragraphs 734.3(b)(3) and -734.7(b). + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. -Glenn Randers-Pehrson -glennrp at users.sourceforge.net -July 15, 2018 +The Contributing Authors and Group 42, Inc. specifically permit, +without fee, and encourage the use of this source code as a component +to supporting the PNG file format in commercial products. If you use +this source code in a product, acknowledgment is not required but would +be appreciated. diff --git a/src/3rdparty/libpng/README b/src/3rdparty/libpng/README index f098b27f39..e41e0f549b 100644 --- a/src/3rdparty/libpng/README +++ b/src/3rdparty/libpng/README @@ -1,15 +1,16 @@ -README for libpng version 1.6.35 - July 15, 2018 (shared library 16.0) -See the note about version numbers near the top of png.h +README for libpng version 1.6.36 - December 1, 2018 +=================================================== +See the note about version numbers near the top of png.h. See INSTALL for instructions on how to install libpng. Libpng comes in several distribution formats. Get libpng-*.tar.gz or -libpng-*.tar.xz or if you want UNIX-style line endings in the text files, -or lpng*.7z or lpng*.zip if you want DOS-style line endings. +libpng-*.tar.xz or if you want UNIX-style line endings in the text +files, or lpng*.7z or lpng*.zip if you want DOS-style line endings. Version 0.89 was the first official release of libpng. Don't let the -fact that it's the first release fool you. The libpng library has been in -extensive use and testing since mid-1995. By late 1997 it had +fact that it's the first release fool you. The libpng library has been +in extensive use and testing since mid-1995. By late 1997 it had finally gotten to the stage where there hadn't been significant changes to the API in some time, and people have a bad feeling about libraries with versions < 1.0. Version 1.0.0 was released in @@ -60,59 +61,37 @@ the library action on the detection of chunk CRC errors. It is possible to set different actions based on whether the CRC error occurred in a critical or an ancillary chunk. -The changes made to the library, and bugs fixed are based on discussions -on the PNG-implement mailing list and not on material submitted -privately to Guy, Andreas, or Glenn. They will forward any good -suggestions to the list. - -For a detailed description on using libpng, read libpng-manual.txt. For -examples of libpng in a program, see example.c and pngtest.c. For usage -information and restrictions (what little they are) on libpng, see -png.h. For a description on using zlib (the compression library used by -libpng) and zlib's restrictions, see zlib.h +For a detailed description on using libpng, read libpng-manual.txt. +For examples of libpng in a program, see example.c and pngtest.c. For +usage information and restrictions (what little they are) on libpng, +see png.h. For a description on using zlib (the compression library +used by libpng) and zlib's restrictions, see zlib.h I have included a general makefile, as well as several machine and -compiler specific ones, but you may have to modify one for your own needs. +compiler specific ones, but you may have to modify one for your own +needs. You should use zlib 1.0.4 or later to run this, but it MAY work with versions as old as zlib 0.95. Even so, there are bugs in older zlib versions which can cause the output of invalid compression streams for -some images. You will definitely need zlib 1.0.4 or later if you are -taking advantage of the MS-DOS "far" structure allocation for the small -and medium memory models. You should also note that zlib is a -compression library that is useful for more things than just PNG files. -You can use zlib as a drop-in replacement for fread() and fwrite() if -you are so inclined. +some images. + +You should also note that zlib is a compression library that is useful +for more things than just PNG files. You can use zlib as a drop-in +replacement for fread() and fwrite(), if you are so inclined. -zlib should be available at the same place that libpng is, or at zlib.net. +zlib should be available at the same place that libpng is, or at +https://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/pngdocs.html . 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 -controls or International Traffic in Arms Regulations (ITAR) because it -is open source, publicly available software, that does not contain any -encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b). - -If you have any code changes, requests, problems, etc., please e-mail -them to me. Also, I'd appreciate any make files or project files, -and any modifications you needed to make to get libpng to compile, -along with a #define variable to tell what compiler/system you are on. -If you needed to add transformations to libpng, or wish libpng would -provide the image in a different way, drop me a note (and code, if -possible), so I can consider supporting the transformation. -Finally, if you get any warning messages when compiling libpng -(note: not zlib), and they are easy to fix, I'd appreciate the -fix. Please mention "libpng" somewhere in the subject line. Thanks. - -This release was created and will be supported by myself (of course -based in a large way on Guy's and Andreas' earlier work), and the PNG +[DOWNLOAD] area, and at http://libpng.download/src . + +This release, based in a large way on Glenn's, Guy's and Andreas' +earlier work, was created and will be supported by myself and the PNG development group. Send comments/corrections/commendations to png-mng-implement at @@ -120,34 +99,21 @@ lists.sourceforge.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe). -You can't reach Guy, the original libpng author, at the addresses -given in previous versions of this document. He and Andreas will -read mail addressed to the png-implement list, however. - -Please do not send general questions about PNG. Send them to -png-mng-misc at lists.sf.net (subscription required; visit +Send general questions about the PNG specification to png-mng-misc +at lists.sourceforge.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-misc to -subscribe). If you have a question about something -in the PNG specification that is related to using libpng, send it -to me. Send me any questions that start with "I was using libpng, -and ...". If in doubt, send questions to me. I'll bounce them -to others, if necessary. - -Please do not send suggestions on how to change PNG. We have -been discussing PNG for twenty years now, and it is official and -finished. If you have suggestions for libpng, however, I'll -gladly listen. Even if your suggestion is not used immediately, -it may be used later. +subscribe). Files in this distribution: ANNOUNCE => Announcement of this version, with recent changes + AUTHORS => List of contributing authors CHANGES => Description of changes between libpng versions KNOWNBUG => List of known bugs and deficiencies LICENSE => License to use and redistribute libpng README => This file TODO => Things not implemented in the current library - Y2KINFO => Statement of Y2K compliance + TRADEMARK => Trademark information example.c => Example code for using libpng functions libpng.3 => manual page for libpng (includes libpng-manual.txt) libpng-manual.txt => Description of libpng and its functions @@ -208,15 +174,10 @@ Files in this distribution: scripts => Directory containing scripts for building libpng: (see scripts/README.txt for the list of scripts) -Good luck, and happy coding. - --Glenn Randers-Pehrson (current maintainer, since 1998) - Internet: glennrp at users.sourceforge.net - --Andreas Eric Dilger (former maintainer, 1996-1997) - Internet: adilger at enel.ucalgary.ca - Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/ +Good luck, and happy coding! --Guy Eric Schalnat (original author and former maintainer, 1995-1996) - (formerly of Group 42, Inc) - Internet: gschal at infinet.com + * Cosmin Truta (current maintainer, since 2018) + * Glenn Randers-Pehrson (former maintainer, 1998-2018) + * Andreas Eric Dilger (former maintainer, 1996-1997) + * Guy Eric Schalnat (original author and former maintainer, 1995-1996) + (formerly of Group 42, Inc.) diff --git a/src/3rdparty/libpng/libpng-manual.txt b/src/3rdparty/libpng/libpng-manual.txt index b14a534163..19cfed28ad 100644 --- a/src/3rdparty/libpng/libpng-manual.txt +++ b/src/3rdparty/libpng/libpng-manual.txt @@ -1,7 +1,6 @@ libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.35 - July 15, 2018 - Updated and distributed by Glenn Randers-Pehrson + Copyright (c) 2018 Cosmin Truta Copyright (c) 1998-2018 Glenn Randers-Pehrson This document is released under the libpng license. @@ -10,9 +9,13 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: + libpng version 1.6.36 - December 1, 2018 + Updated and distributed by Cosmin Truta + Copyright (c) 2018 Cosmin Truta + libpng versions 0.97, January 1998, through 1.6.35 - July 15, 2018 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2017 Glenn Randers-Pehrson + Copyright (c) 1998-2018 Glenn Randers-Pehrson libpng 1.0 beta 6 - version 0.96 - May 28, 1997 Updated and distributed by Andreas Dilger @@ -44,7 +47,6 @@ libpng-manual.txt - A description on how to use and modify libpng XIII. Detecting libpng XIV. Source code repository XV. Coding style - XVI. Y2K Compliance in libpng I. Introduction @@ -65,7 +67,7 @@ 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 -. The W3C and ISO documents have identical technical content. The PNG-1.2 specification is available at @@ -73,9 +75,9 @@ The PNG-1.2 specification is available 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 +The PNG-1.0 specification is available as RFC 2083 at and as a -W3C Recommendation . +W3C Recommendation at . Some additional chunks are described in the special-purpose public chunks documents at @@ -4054,7 +4056,7 @@ Flags containing additional information about the image are held in the 'flags' field of png_image. PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB == 0x01 - This indicates the the RGB values of the in-memory bitmap do not + This indicates that the RGB values of the in-memory bitmap do not correspond to the red, green and blue end-points defined by sRGB. PNG_IMAGE_FLAG_FAST == 0x02 @@ -4520,7 +4522,7 @@ When PNG_DEBUG = 1, the macros are defined, but only png_debug statements having level = 0 will be printed. There aren't any such statements in this version of libpng, but if you insert some they will be printed. -VII. MNG support +VII. MNG support The MNG specification (available at http://www.libpng.org/pub/mng) allows certain extensions to PNG for PNG images that are embedded in MNG datastreams. @@ -4547,7 +4549,7 @@ or any other MNG chunks; your application must provide its own support for them. You may wish to consider using libmng (available at https://www.libmng.com/) instead. -VIII. Changes to Libpng from version 0.88 +VIII. Changes to Libpng from version 0.88 It should be noted that versions of libpng later than 0.96 are not distributed by the original libpng author, Guy Schalnat, nor by @@ -4602,7 +4604,7 @@ application: png_uint_32 application_vn = PNG_LIBPNG_VER; -IX. Changes to Libpng from version 1.0.x to 1.2.x +IX. Changes to Libpng from version 1.0.x to 1.2.x Support for user memory management was enabled by default. To accomplish this, the functions png_create_read_struct_2(), @@ -4699,7 +4701,7 @@ which also expands tRNS to alpha was replaced with png_set_expand_gray_1_2_4_to_8() which does not. It has been deprecated since libpng-1.0.18 and 1.2.9. -X. Changes to Libpng from version 1.0.x/1.2.x to 1.4.x +X. Changes to Libpng from version 1.0.x/1.2.x to 1.4.x Private libpng prototypes and macro definitions were moved from png.h and pngconf.h into a new pngpriv.h header file. @@ -4809,7 +4811,7 @@ was renamed to PNG_READ_QUANTIZE_SUPPORTED. We removed the trailing '.' from the warning and error messages. -XI. Changes to Libpng from version 1.4.x to 1.5.x +XI. Changes to Libpng from version 1.4.x to 1.5.x From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the function) incorrectly returned a value of type png_uint_32. @@ -4872,7 +4874,7 @@ to png_bytepp, and in png_set_iCCP, from png_charp to png_const_bytep. There are changes of form in png.h, including new and changed macros to declare parts of the API. Some API functions with arguments that are pointers to data not modified within the function have been corrected to -declare these arguments with PNG_CONST. +declare these arguments with const. Much of the internal use of C macros to control the library build has also changed and some of this is visible in the exported header files, in @@ -5067,7 +5069,7 @@ even though the default is to use the macros - this allows applications to choose at app buildtime whether or not to use macros (previously impossible because the functions weren't in the default build.) -XII. Changes to Libpng from version 1.5.x to 1.6.x +XII. Changes to Libpng from version 1.5.x to 1.6.x A "simplified API" has been added (see documentation in png.h and a simple example in contrib/examples/pngtopng.c). The new publicly visible API @@ -5230,7 +5232,7 @@ 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 +XIII. Detecting libpng The png_get_io_ptr() function has been present since libpng-0.88, has never changed, and is unaffected by conditional compilation macros. It is the @@ -5255,7 +5257,7 @@ or you can browse it with a web browser at https://sourceforge.net/p/libpng/code/ci/libpng16/tree/ Patches can be sent to png-mng-implement at lists.sourceforge.net or -you can upload them to the libpng bug tracker at +uploaded to the libpng bug tracker at https://libpng.sourceforge.io/ @@ -5405,58 +5407,3 @@ We do not use the TAB character for indentation in the C sources. Lines do not exceed 80 characters. Other rules can be inferred by inspecting the libpng source. - -XVI. Y2K Compliance in libpng - -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.35 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 -that will hold years up to 65535. The other, which is deprecated, -holds the date in text format, and will hold years up to 9999. - -The integer is - "png_uint_16 year" in png_time_struct. - -The string is - "char time_buffer[29]" in png_struct. This is no longer used -in libpng-1.6.x and will be removed from libpng-1.7.0. - -There are seven time-related functions: - - png_convert_to_rfc_1123_buffer() in png.c - (formerly png_convert_to_rfc_1152() in error, and - also formerly png_convert_to_rfc_1123()) - png_convert_from_struct_tm() in pngwrite.c, called - in pngwrite.c - png_convert_from_time_t() in pngwrite.c - png_get_tIME() in pngget.c - png_handle_tIME() in pngrutil.c, called in pngread.c - png_set_tIME() in pngset.c - png_write_tIME() in pngwutil.c, called in pngwrite.c - -All appear to handle dates properly in a Y2K environment. The -png_convert_from_time_t() function calls gmtime() to convert from system -clock time, which returns (year - 1900), which we properly convert to -the full 4-digit year. There is a possibility that applications using -libpng are not passing 4-digit years into the png_convert_to_rfc_1123() -function, or that they are incorrectly passing only a 2-digit year -instead of "year - 1900" into the png_convert_from_struct_tm() function, -but this is not under our control. The libpng documentation has always -stated that it works with 4-digit years, and the APIs have been -documented as such. - -The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned -integer to hold the year, and can hold years as large as 65535. - -zlib, upon which libpng depends, is also Y2K compliant. It contains -no date-related code. - - - Glenn Randers-Pehrson - libpng maintainer - PNG Development Group diff --git a/src/3rdparty/libpng/png.c b/src/3rdparty/libpng/png.c index a25afebcc8..3dce191d17 100644 --- a/src/3rdparty/libpng/png.c +++ b/src/3rdparty/libpng/png.c @@ -1,10 +1,10 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -14,7 +14,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_35 Your_png_h_is_not_version_1_6_35; +typedef png_libpng_version_1_6_36 Your_png_h_is_not_version_1_6_36; #ifdef __GNUC__ /* The version tests may need to be added to, but the problem warning has @@ -736,7 +736,7 @@ png_save_int_32(png_bytep buf, png_int_32 i) int PNGAPI png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime) { - static PNG_CONST char short_months[12][4] = + static const char short_months[12][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; @@ -814,20 +814,14 @@ png_get_copyright(png_const_structrp png_ptr) #ifdef PNG_STRING_COPYRIGHT return PNG_STRING_COPYRIGHT #else -# ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.35 - July 15, 2018" PNG_STRING_NEWLINE \ + "libpng version 1.6.36" PNG_STRING_NEWLINE \ + "Copyright (c) 2018 Cosmin Truta" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2018 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.35 - July 15, 2018\ - Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson\ - Copyright (c) 1996-1997 Andreas Dilger\ - Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; -# endif #endif } @@ -1121,7 +1115,7 @@ png_colorspace_set_gamma(png_const_structrp png_ptr, png_colorspacerp colorspace, png_fixed_point gAMA) { /* Changed in libpng-1.5.4 to limit the values to ensure overflow can't - * occur. Since the fixed point representation is asymetrical it is + * occur. Since the fixed point representation is asymmetrical it is * possible for 1/gamma to overflow the limit of 21474 and this means the * gamma value must be at least 5/100000 and hence at most 20000.0. For * safety the limits here are a little narrower. The values are 0.00016 to @@ -3134,11 +3128,11 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size, /* The total output count (max) is now 4+precision */ /* 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 a flag - it got - * to '-1' because of the decrement after outputting - * the decimal point above (the exponent required is - * *not* -1!) + * done and just need to terminate the string. At 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.) */ if (exp_b10 >= (-1) && exp_b10 <= 2) { @@ -3976,18 +3970,18 @@ png_gamma_correct(png_structrp png_ptr, unsigned int value, */ static void png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable, - PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val) + unsigned int shift, png_fixed_point gamma_val) { /* Various values derived from 'shift': */ - PNG_CONST unsigned int num = 1U << (8U - shift); + unsigned int num = 1U << (8U - shift); #ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED /* CSE the division and work round wacky GCC warnings (see the comments * in png_gamma_8bit_correct for where these come from.) */ - PNG_CONST double fmax = 1./(((png_int_32)1 << (16U - shift))-1); + double fmax = 1.0 / (((png_int_32)1 << (16U - shift)) - 1); #endif - PNG_CONST unsigned int max = (1U << (16U - shift))-1U; - PNG_CONST unsigned int max_by_2 = 1U << (15U-shift); + unsigned int max = (1U << (16U - shift)) - 1U; + unsigned int max_by_2 = 1U << (15U - shift); unsigned int i; png_uint_16pp table = *ptable = @@ -4053,10 +4047,10 @@ png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable, */ static void png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable, - PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val) + unsigned int shift, png_fixed_point gamma_val) { - PNG_CONST unsigned int num = 1U << (8U - shift); - PNG_CONST unsigned int max = (1U << (16U - shift))-1U; + unsigned int num = 1U << (8U - shift); + unsigned int max = (1U << (16U - shift))-1U; unsigned int i; png_uint_32 last; @@ -4121,7 +4115,7 @@ png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable, */ static void png_build_8bit_table(png_structrp png_ptr, png_bytepp ptable, - PNG_CONST png_fixed_point gamma_val) + png_fixed_point gamma_val) { unsigned int i; png_bytep table = *ptable = (png_bytep)png_malloc(png_ptr, 256); diff --git a/src/3rdparty/libpng/png.h b/src/3rdparty/libpng/png.h index 19e464cc17..8e272a0553 100644 --- a/src/3rdparty/libpng/png.h +++ b/src/3rdparty/libpng/png.h @@ -1,29 +1,65 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.35, July 15, 2018 + * libpng version 1.6.36 - December 1, 2018 * + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * - * This code is released under the libpng license (See LICENSE, below) + * This code is released under the libpng license. (See LICENSE, below.) * * 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.35, July 15, 2018: + * libpng versions 0.97, January 1998, through 1.6.35, July 2018: * Glenn Randers-Pehrson. + * libpng version 1.6.36, December 1, 2018: Cosmin Truta * See also "Contributing Authors", below. */ /* - * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: + * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE + * ========================================= + * + * PNG Reference Library License version 2 + * --------------------------------------- + * + * * Copyright (c) 1995-2018 The PNG Reference Library Authors. + * * Copyright (c) 2018 Cosmin Truta. + * * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. + * * Copyright (c) 1996-1997 Andreas Dilger. + * * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + * + * The software is supplied "as is", without warranty of any kind, + * express or implied, including, without limitation, the warranties + * of merchantability, fitness for a particular purpose, title, and + * non-infringement. In no even shall the Copyright owners, or + * anyone distributing the software, be liable for any damages or + * other liability, whether in contract, tort or otherwise, arising + * from, out of, or in connection with the software, or the use or + * other dealings in the software, even if advised of the possibility + * of such damage. + * + * Permission is hereby granted to use, copy, modify, and distribute + * this software, or portions hereof, for any purpose, without fee, + * subject to the following restrictions: * - * If you modify libpng you may insert additional notices immediately following - * this sentence. + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you + * use this software in a product, an acknowledgment in the product + * documentation would be appreciated, but is not required. * - * This code is released under the libpng license. + * 2. Altered source versions must be plainly marked as such, and must + * not be misrepresented as being the original software. + * + * 3. This Copyright notice may not be removed or altered from any + * source or altered source distribution. + * + * + * PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) + * ----------------------------------------------------------------------- * * libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are @@ -31,38 +67,38 @@ * disclaimer and license as libpng-1.0.6 with the following individuals * added to the list of Contributing Authors: * - * Simon-Pierre Cadieux - * Eric S. Raymond - * Mans Rullgard - * Cosmin Truta - * Gilles Vollant - * James Yu - * Mandar Sahastrabuddhe - * Google Inc. - * Vadim Barkov + * Simon-Pierre Cadieux + * Eric S. Raymond + * Mans Rullgard + * Cosmin Truta + * Gilles Vollant + * James Yu + * Mandar Sahastrabuddhe + * Google Inc. + * Vadim Barkov * * and with the following additions to the disclaimer: * - * There is no warranty against interference with your enjoyment of the - * library or against infringement. There is no warranty that our - * efforts or the library will fulfill any of your particular purposes - * or needs. This library is provided with all faults, and the entire - * risk of satisfactory quality, performance, accuracy, and effort is with - * the user. + * There is no warranty against interference with your enjoyment of + * the library or against infringement. There is no warranty that our + * efforts or the library will fulfill any of your particular purposes + * or needs. This library is provided with all faults, and the entire + * risk of satisfactory quality, performance, accuracy, and effort is + * with the user. * * Some files in the "contrib" directory and some configure-generated - * files that are distributed with libpng have other copyright owners and + * files that are distributed with libpng have other copyright owners, and * are released under other open source licenses. * * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from * libpng-0.96, and are distributed according to the same disclaimer and - * license as libpng-0.96, with the following individuals added to the list - * of Contributing Authors: + * license as libpng-0.96, with the following individuals added to the + * list of Contributing Authors: * - * Tom Lane - * Glenn Randers-Pehrson - * Willem van Schaik + * Tom Lane + * Glenn Randers-Pehrson + * Willem van Schaik * * libpng versions 0.89, June 1996, through 0.96, May 1997, are * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, @@ -70,14 +106,14 @@ * libpng-0.88, with the following individuals added to the list of * Contributing Authors: * - * John Bowler - * Kevin Bracey - * Sam Bushell - * Magnus Holmgren - * Greg Roelofs - * Tom Tanner + * John Bowler + * Kevin Bracey + * Sam Bushell + * Magnus Holmgren + * Greg Roelofs + * Tom Tanner * - * Some files in the "scripts" directory have other copyright owners + * Some files in the "scripts" directory have other copyright owners, * but are released under this license. * * libpng versions 0.5, May 1995, through 0.88, January 1996, are @@ -86,62 +122,49 @@ * For the purposes of this copyright and license, "Contributing Authors" * is defined as the following set of individuals: * - * Andreas Dilger - * Dave Martindale - * Guy Eric Schalnat - * Paul Schmidt - * Tim Wegner - * - * The PNG Reference Library is supplied "AS IS". The Contributing Authors - * and Group 42, Inc. disclaim all warranties, expressed or implied, - * including, without limitation, the warranties of merchantability and of - * fitness for any purpose. The Contributing Authors and Group 42, Inc. - * assume no liability for direct, indirect, incidental, special, exemplary, - * or consequential damages, which may result from the use of the PNG - * Reference Library, even if advised of the possibility of such damage. + * Andreas Dilger + * Dave Martindale + * Guy Eric Schalnat + * Paul Schmidt + * Tim Wegner + * + * The PNG Reference Library is supplied "AS IS". The Contributing + * Authors and Group 42, Inc. disclaim all warranties, expressed or + * implied, including, without limitation, the warranties of + * merchantability and of fitness for any purpose. The Contributing + * Authors and Group 42, Inc. assume no liability for direct, indirect, + * incidental, special, exemplary, or consequential damages, which may + * result from the use of the PNG Reference Library, even if advised of + * the possibility of such damage. * * Permission is hereby granted to use, copy, modify, and distribute this * source code, or portions hereof, for any purpose, without fee, subject * to the following restrictions: * - * 1. The origin of this source code must not be misrepresented. + * 1. The origin of this source code must not be misrepresented. * - * 2. Altered versions must be plainly marked as such and must not - * be misrepresented as being the original source. + * 2. Altered versions must be plainly marked as such and must not + * be misrepresented as being the original source. * - * 3. This Copyright notice may not be removed or altered from any - * source or altered source distribution. + * 3. This Copyright notice may not be removed or altered from any + * source or altered source distribution. * - * The Contributing Authors and Group 42, Inc. specifically permit, without - * fee, and encourage the use of this source code as a component to - * supporting the PNG file format in commercial products. If you use this - * source code in a product, acknowledgment is not required but would be - * appreciated. + * The Contributing Authors and Group 42, Inc. specifically permit, + * without fee, and encourage the use of this source code as a component + * to supporting the PNG file format in commercial products. If you use + * this source code in a product, acknowledgment is not required but would + * be appreciated. * * END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE. * - * TRADEMARK: + * TRADEMARK + * ========= * - * The name "libpng" has not been registered by the Copyright owner + * The name "libpng" has not been registered by the Copyright owners * as a trademark in any jurisdiction. However, because libpng has * been distributed and maintained world-wide, continually since 1995, - * the Copyright owner claims "common-law trademark protection" in any + * the Copyright owners claim "common-law trademark protection" in any * jurisdiction where common-law trademark is recognized. - * - * OSI CERTIFICATION: - * - * Libpng is OSI Certified Open Source Software. OSI Certified Open Source is - * a certification mark of the Open Source Initiative. OSI has not addressed - * the additional disclaimers inserted at version 1.0.7. - * - * EXPORT CONTROL: - * - * The Copyright owner believes that the Export Control Classification - * Number (ECCN) for libpng is EAR99, which means not subject to export - * controls or International Traffic in Arms Regulations (ITAR) because - * it is open source, publicly available software, that does not contain - * any encryption software. See the EAR, paragraphs 734.3(b)(3) and - * 734.7(b). */ /* @@ -207,23 +230,25 @@ * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) * 1.0.7 1 10007 (still compatible) * ... - * 1.0.19 10 10019 10.so.0.19[.0] + * 1.0.69 10 10069 10.so.0.69[.0] * ... - * 1.2.59 13 10257 12.so.0.59[.0] + * 1.2.59 13 10259 12.so.0.59[.0] * ... - * 1.5.30 15 10527 15.so.15.30[.0] + * 1.4.20 14 10420 14.so.0.20[.0] * ... - * 1.6.35 16 10635 16.so.16.35[.0] - * - * Henceforth the source version will match the shared-library major - * and minor numbers; the shared-library major version number will be - * used for changes in backward compatibility, as it is intended. The - * PNG_LIBPNG_VER macro, which is not used within libpng but is available - * for applications, is an unsigned integer of the form xyyzz corresponding - * to the source version x.y.z (leading zeros in y and z). Beta versions - * were given the previous public release number plus a letter, until - * version 1.0.6j; from then on they were given the upcoming public - * release number plus "betaNN" or "rcNN". + * 1.5.30 15 10530 15.so.15.30[.0] + * ... + * 1.6.36 16 10636 16.so.16.36[.0] + * + * Henceforth the source version will match the shared-library major and + * minor numbers; the shared-library major version number will be used for + * changes in backward compatibility, as it is intended. + * The PNG_LIBPNG_VER macro, which is not used within libpng but is + * available for applications, is an unsigned integer of the form XYYZZ + * corresponding to the source version X.Y.Z (leading zeros in Y and Z). + * Beta versions were given the previous public release number plus a + * letter, until version 1.0.6j; from then on they were given the upcoming + * public release number plus "betaNN" or "rcNN". * * Binary incompatibility exists only when applications make direct access * to the info_ptr or png_ptr members through png.h, and the compiled @@ -233,65 +258,8 @@ * in binary compatibility (e.g., when a new feature is added). * * See libpng.txt or libpng.3 for more information. The PNG specification - * is available as a W3C Recommendation and as an ISO Specification, - * */ #ifndef PNG_H @@ -309,8 +277,8 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.35" -#define PNG_HEADER_VERSION_STRING " libpng version 1.6.35 - July 15, 2018\n" +#define PNG_LIBPNG_VER_STRING "1.6.36" +#define PNG_HEADER_VERSION_STRING " libpng version 1.6.36 - December 1, 2018\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -318,13 +286,13 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 35 +#define PNG_LIBPNG_VER_RELEASE 36 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ -#define PNG_LIBPNG_VER_BUILD 02 +#define PNG_LIBPNG_VER_BUILD 0 /* Release Status */ #define PNG_LIBPNG_BUILD_ALPHA 1 @@ -341,15 +309,16 @@ #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with PNG_LIBPNG_BUILD_PRIVATE */ -#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA +#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE -/* Careful here. At one time, Guy wanted to use 082, but that would be octal. - * We must not include leading zeros. - * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only - * version 1.0.0 was mis-numbered 100 instead of 10000). From - * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release +/* Careful here. At one time, Guy wanted to use 082, but that + * would be octal. We must not include leading zeros. + * Versions 0.7 through 1.0.0 were in the range 0 to 100 here + * (only version 1.0.0 was mis-numbered 100 instead of 10000). + * From version 1.0.1 it is: + * XXYYZZ, where XX=major, YY=minor, ZZ=release */ -#define PNG_LIBPNG_VER 10635 /* 1.6.35 */ +#define PNG_LIBPNG_VER 10636 /* 1.6.36 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -459,7 +428,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_6_35; +typedef char* png_libpng_version_1_6_36; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * @@ -2013,12 +1982,12 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr, PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr, png_inforp info_ptr, png_bytep *exif)); PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr, - png_inforp info_ptr, const png_bytep exif)); + png_inforp info_ptr, png_bytep exif)); PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr, png_const_inforp info_ptr, png_uint_32 *num_exif, png_bytep *exif)); PNG_EXPORT(249, void, png_set_eXIf_1, (png_const_structrp png_ptr, - png_inforp info_ptr, const png_uint_32 num_exif, const png_bytep exif)); + png_inforp info_ptr, png_uint_32 num_exif, png_bytep exif)); #endif #ifdef PNG_gAMA_SUPPORTED @@ -2764,7 +2733,7 @@ typedef struct * * 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 https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 + * article at ) 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 @@ -2967,7 +2936,7 @@ typedef struct * 'flags' field of png_image. */ #define PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB 0x01 - /* This indicates the the RGB values of the in-memory bitmap do not + /* This indicates that the RGB values of the in-memory bitmap do not * correspond to the red, green and blue end-points defined by sRGB. */ diff --git a/src/3rdparty/libpng/pngconf.h b/src/3rdparty/libpng/pngconf.h index a4646bab85..5e641b2509 100644 --- a/src/3rdparty/libpng/pngconf.h +++ b/src/3rdparty/libpng/pngconf.h @@ -1,11 +1,12 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.6.35, July 15, 2018 + * libpng version 1.6.36 * + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -57,14 +58,13 @@ #endif /* PNG_BUILDING_SYMBOL_TABLE */ -/* Prior to 1.6.0 it was possible to turn off 'const' in declarations using - * PNG_NO_CONST; this is no longer supported except for data declarations which - * apparently still cause problems in 2011 on some compilers. +/* Prior to 1.6.0, it was possible to turn off 'const' in declarations, + * using PNG_NO_CONST. This is no longer supported. */ #define PNG_CONST const /* backward compatibility only */ -/* This controls optimization of the reading of 16-bit and 32-bit values - * from PNG files. It can be set on a per-app-file basis - it +/* This controls optimization of the reading of 16-bit and 32-bit + * values from PNG files. It can be set on a per-app-file basis: it * just changes whether a macro is used when the function is called. * The library builder sets the default; if read functions are not * built into the library the macro implementation is forced on. diff --git a/src/3rdparty/libpng/pngdebug.h b/src/3rdparty/libpng/pngdebug.h index 15a7ed0c95..00d5a4569e 100644 --- a/src/3rdparty/libpng/pngdebug.h +++ b/src/3rdparty/libpng/pngdebug.h @@ -1,10 +1,10 @@ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c * - * Last changed in libpng 1.6.8 [December 19, 2013] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer diff --git a/src/3rdparty/libpng/pngerror.c b/src/3rdparty/libpng/pngerror.c index ad48bfb986..ec3a709b9d 100644 --- a/src/3rdparty/libpng/pngerror.c +++ b/src/3rdparty/libpng/pngerror.c @@ -1,10 +1,10 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 2018 Cosmin Truta * 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -425,7 +425,7 @@ png_app_error(png_const_structrp png_ptr, png_const_charp error_message) * if the character is invalid. */ #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) -static PNG_CONST char png_digit[16] = { +static const char png_digit[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; @@ -885,7 +885,7 @@ PNG_FUNCTION(void /* PRIVATE */, (PNGCBAPI png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message), PNG_NORETURN) { - const png_const_structrp png_ptr = png_nonconst_ptr; + png_const_structrp png_ptr = png_nonconst_ptr; png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr); /* An error is always logged here, overwriting anything (typically a warning) @@ -920,7 +920,7 @@ png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message), void /* PRIVATE */ PNGCBAPI png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message) { - const png_const_structrp png_ptr = png_nonconst_ptr; + png_const_structrp png_ptr = png_nonconst_ptr; png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr); /* A warning is only logged if there is no prior warning or error. */ diff --git a/src/3rdparty/libpng/pngget.c b/src/3rdparty/libpng/pngget.c index 2325508f1d..5abf1efd9f 100644 --- a/src/3rdparty/libpng/pngget.c +++ b/src/3rdparty/libpng/pngget.c @@ -1,10 +1,10 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer diff --git a/src/3rdparty/libpng/pnginfo.h b/src/3rdparty/libpng/pnginfo.h index 2fcf868dac..1f98dedc42 100644 --- a/src/3rdparty/libpng/pnginfo.h +++ b/src/3rdparty/libpng/pnginfo.h @@ -1,10 +1,10 @@ /* pnginfo.h - header file for PNG reference library * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013,2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer diff --git a/src/3rdparty/libpng/pnglibconf.h b/src/3rdparty/libpng/pnglibconf.h index 00acecc69b..00340c678b 100644 --- a/src/3rdparty/libpng/pnglibconf.h +++ b/src/3rdparty/libpng/pnglibconf.h @@ -1,10 +1,9 @@ -/* libpng 1.6.35 STANDARD API DEFINITION */ - /* pnglibconf.h - library build configuration */ -/* Libpng version 1.6.35 - July 15, 2018 */ +/* libpng version 1.6.36 */ -/* Copyright (c) 1998-2018 Glenn Randers-Pehrson */ +/* Copyright (c) 2018 Cosmin Truta */ +/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */ /* This code is released under the libpng license. */ /* For conditions of distribution and use, see the disclaimer */ @@ -20,8 +19,6 @@ #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*/ @@ -46,6 +43,8 @@ #define PNG_IO_STATE_SUPPORTED #define PNG_MNG_FEATURES_SUPPORTED #define PNG_POINTER_INDEXING_SUPPORTED +/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/ +/*#undef PNG_POWERPC_VSX_CHECK_SUPPORTED*/ #define PNG_PROGRESSIVE_READ_SUPPORTED #define PNG_READ_16BIT_SUPPORTED #define PNG_READ_ALPHA_MODE_SUPPORTED diff --git a/src/3rdparty/libpng/pngmem.c b/src/3rdparty/libpng/pngmem.c index ff3ef7e88c..09ed9c1c99 100644 --- a/src/3rdparty/libpng/pngmem.c +++ b/src/3rdparty/libpng/pngmem.c @@ -1,10 +1,10 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.6.26 [October 20, 2016] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2014,2016 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer diff --git a/src/3rdparty/libpng/pngpread.c b/src/3rdparty/libpng/pngpread.c index c4ba51c4d4..e283627b77 100644 --- a/src/3rdparty/libpng/pngpread.c +++ b/src/3rdparty/libpng/pngpread.c @@ -1,10 +1,10 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -972,20 +972,20 @@ png_read_push_finish_row(png_structrp png_ptr) /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ - static PNG_CONST png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; + static const png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; /* Offset to next interlace block */ - static PNG_CONST png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; + static const png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; /* Start of interlace block in the y direction */ - static PNG_CONST png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; + static const png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; /* Offset to next interlace block in the y direction */ - static PNG_CONST png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; + static const png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; /* Height of interlace block. This is not currently used - if you need * it, uncomment it here and in png.h - static PNG_CONST png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; + static const png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; */ #endif diff --git a/src/3rdparty/libpng/pngpriv.h b/src/3rdparty/libpng/pngpriv.h index e43862a886..f53c81d039 100644 --- a/src/3rdparty/libpng/pngpriv.h +++ b/src/3rdparty/libpng/pngpriv.h @@ -1,10 +1,10 @@ /* pngpriv.h - private declarations for use inside libpng * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -180,7 +180,10 @@ # else /* !defined __ARM_NEON__ */ /* The 'intrinsics' code simply won't compile without this -mfpu=neon: */ -# define PNG_ARM_NEON_IMPLEMENTATION 2 +# if !defined(__aarch64__) + /* The assembler code currently does not work on ARM64 */ +# define PNG_ARM_NEON_IMPLEMENTATION 2 +# endif /* __aarch64__ */ # endif /* __ARM_NEON__ */ # endif /* !PNG_ARM_NEON_IMPLEMENTATION */ @@ -1548,10 +1551,10 @@ PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr, #endif PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr, - const png_uint_32 chunk_name),PNG_EMPTY); + 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_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); @@ -2128,6 +2131,29 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2, PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr, png_const_charp key, png_bytep new_key), PNG_EMPTY); +#if PNG_ARM_NEON_IMPLEMENTATION == 1 +PNG_INTERNAL_FUNCTION(void, + png_riffle_palette_rgba, + (png_structrp, png_row_infop), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, + png_do_expand_palette_neon_rgba, + (png_structrp, + png_row_infop, + png_const_bytep, + const png_bytepp, + const png_bytepp), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, + png_do_expand_palette_neon_rgb, + (png_structrp, + png_row_infop, + png_const_bytep, + const png_bytepp, + const png_bytepp), + PNG_EMPTY); +#endif + /* Maintainer: Put new private prototypes here ^ */ #include "pngdebug.h" diff --git a/src/3rdparty/libpng/pngread.c b/src/3rdparty/libpng/pngread.c index bff7503ee3..f8e762196e 100644 --- a/src/3rdparty/libpng/pngread.c +++ b/src/3rdparty/libpng/pngread.c @@ -1,10 +1,10 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -1621,7 +1621,7 @@ png_image_skip_unused_chunks(png_structrp png_ptr) * errors (which are unfortunately quite common.) */ { - static PNG_CONST png_byte chunks_to_process[] = { + static const png_byte chunks_to_process[] = { 98, 75, 71, 68, '\0', /* bKGD */ 99, 72, 82, 77, '\0', /* cHRM */ 103, 65, 77, 65, '\0', /* gAMA */ @@ -1758,9 +1758,9 @@ png_create_colormap_entry(png_image_read_control *display, png_uint_32 alpha, int encoding) { png_imagep image = display->image; - const int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) != 0 ? + int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) != 0 ? P_LINEAR : P_sRGB; - const int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 && + int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 && (red != green || green != blue); if (ip > 255) @@ -1869,13 +1869,13 @@ png_create_colormap_entry(png_image_read_control *display, /* Store the value. */ { # ifdef PNG_FORMAT_AFIRST_SUPPORTED - const int afirst = (image->format & PNG_FORMAT_FLAG_AFIRST) != 0 && + int afirst = (image->format & PNG_FORMAT_FLAG_AFIRST) != 0 && (image->format & PNG_FORMAT_FLAG_ALPHA) != 0; # else # define afirst 0 # endif # ifdef PNG_FORMAT_BGR_SUPPORTED - const int bgr = (image->format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0; + int bgr = (image->format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0; # else # define bgr 0 # endif @@ -2085,11 +2085,11 @@ png_image_read_colormap(png_voidp argument) { png_image_read_control *display = png_voidcast(png_image_read_control*, argument); - const png_imagep image = display->image; + png_imagep image = display->image; - const png_structrp png_ptr = image->opaque->png_ptr; - const png_uint_32 output_format = image->format; - const int output_encoding = (output_format & PNG_FORMAT_FLAG_LINEAR) != 0 ? + png_structrp png_ptr = image->opaque->png_ptr; + png_uint_32 output_format = image->format; + int output_encoding = (output_format & PNG_FORMAT_FLAG_LINEAR) != 0 ? P_LINEAR : P_sRGB; unsigned int cmap_entries; @@ -2802,7 +2802,7 @@ png_image_read_colormap(png_voidp argument) unsigned int num_trans = png_ptr->num_trans; png_const_bytep trans = num_trans > 0 ? png_ptr->trans_alpha : NULL; png_const_colorp colormap = png_ptr->palette; - const int do_background = trans != NULL && + int do_background = trans != NULL && (output_format & PNG_FORMAT_FLAG_ALPHA) == 0; unsigned int i; @@ -3946,7 +3946,7 @@ png_image_read_direct(png_voidp argument) */ if (linear != 0) { - PNG_CONST png_uint_16 le = 0x0001; + png_uint_16 le = 0x0001; if ((*(png_const_bytep) & le) != 0) png_set_swap(png_ptr); @@ -4108,7 +4108,7 @@ png_image_finish_read(png_imagep image, png_const_colorp background, * original PNG format because it may not occur in the output PNG format * and libpng deals with the issues of reading the original. */ - const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); + unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); /* The following checks just the 'row_stride' calculation to ensure it * fits in a signed 32-bit value. Because channels/components can be @@ -4119,7 +4119,7 @@ png_image_finish_read(png_imagep image, png_const_colorp background, if (image->width <= 0x7fffffffU/channels) /* no overflow */ { png_uint_32 check; - const png_uint_32 png_row_stride = image->width * channels; + png_uint_32 png_row_stride = image->width * channels; if (row_stride == 0) row_stride = (png_int_32)/*SAFE*/png_row_stride; diff --git a/src/3rdparty/libpng/pngrio.c b/src/3rdparty/libpng/pngrio.c index 372221483f..7946358101 100644 --- a/src/3rdparty/libpng/pngrio.c +++ b/src/3rdparty/libpng/pngrio.c @@ -1,10 +1,10 @@ /* pngrio.c - functions for data input * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer diff --git a/src/3rdparty/libpng/pngrtran.c b/src/3rdparty/libpng/pngrtran.c index 67d1f249a6..ccc58ce6f1 100644 --- a/src/3rdparty/libpng/pngrtran.c +++ b/src/3rdparty/libpng/pngrtran.c @@ -1,10 +1,10 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -18,6 +18,17 @@ #include "pngpriv.h" +#ifdef PNG_ARM_NEON_IMPLEMENTATION +# if PNG_ARM_NEON_IMPLEMENTATION == 1 +# define PNG_ARM_NEON_INTRINSICS_AVAILABLE +# if defined(_MSC_VER) && defined(_M_ARM64) +# include +# else +# include +# endif +# endif +#endif + #ifdef PNG_READ_SUPPORTED /* Set the action on getting a CRC error for an ancillary or critical chunk. */ @@ -2986,7 +2997,6 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) */ static int png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row) - { int rgb_error = 0; @@ -2995,12 +3005,11 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row) if ((row_info->color_type & PNG_COLOR_MASK_PALETTE) == 0 && (row_info->color_type & PNG_COLOR_MASK_COLOR) != 0) { - PNG_CONST png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff; - PNG_CONST png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff; - PNG_CONST png_uint_32 bc = 32768 - rc - gc; - PNG_CONST png_uint_32 row_width = row_info->width; - PNG_CONST int have_alpha = - (row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0; + png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff; + png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff; + png_uint_32 bc = 32768 - rc - gc; + png_uint_32 row_width = row_info->width; + int have_alpha = (row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0; if (row_info->bit_depth == 8) { @@ -4143,12 +4152,11 @@ png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr) { if (row_info->bit_depth == 8) { - PNG_CONST png_bytep table = png_ptr->gamma_from_1; + png_bytep table = png_ptr->gamma_from_1; if (table != NULL) { - PNG_CONST int step = - (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 4 : 2; + int step = (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 4 : 2; /* The alpha channel is the last component: */ row += step - 1; @@ -4162,13 +4170,12 @@ png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr) else if (row_info->bit_depth == 16) { - PNG_CONST png_uint_16pp table = png_ptr->gamma_16_from_1; - PNG_CONST int gamma_shift = png_ptr->gamma_shift; + png_uint_16pp table = png_ptr->gamma_16_from_1; + int gamma_shift = png_ptr->gamma_shift; if (table != NULL) { - PNG_CONST int step = - (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 8 : 4; + int step = (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 8 : 4; /* The alpha channel is the last component: */ row += step - 2; @@ -4199,8 +4206,9 @@ png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr) * upon whether you supply trans and num_trans. */ static void -png_do_expand_palette(png_row_infop row_info, png_bytep row, - png_const_colorp palette, png_const_bytep trans_alpha, int num_trans) +png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info, + png_bytep row, png_const_colorp palette, png_const_bytep trans_alpha, + int num_trans) { int shift, value; png_bytep sp, dp; @@ -4304,14 +4312,25 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row, sp = row + (size_t)row_width - 1; dp = row + ((size_t)row_width << 2) - 1; - for (i = 0; i < row_width; i++) + i = 0; +#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE + if (png_ptr->riffled_palette != NULL) + { + /* The RGBA optimization works with png_ptr->bit_depth == 8 + * but sometimes row_info->bit_depth has been changed to 8. + * In these cases, the palette hasn't been riffled. + */ + i = png_do_expand_palette_neon_rgba(png_ptr, row_info, row, + &sp, &dp); + } +#endif + + for (; i < row_width; i++) { if ((int)(*sp) >= num_trans) *dp-- = 0xff; - else *dp-- = trans_alpha[*sp]; - *dp-- = palette[*sp].blue; *dp-- = palette[*sp].green; *dp-- = palette[*sp].red; @@ -4328,8 +4347,13 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row, { sp = row + (size_t)row_width - 1; dp = row + (size_t)(row_width * 3) - 1; + i = 0; +#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE + i = png_do_expand_palette_neon_rgb(png_ptr, row_info, row, + &sp, &dp); +#endif - for (i = 0; i < row_width; i++) + for (; i < row_width; i++) { *dp-- = palette[*sp].blue; *dp-- = palette[*sp].green; @@ -4743,8 +4767,22 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info) { if (row_info->color_type == PNG_COLOR_TYPE_PALETTE) { - png_do_expand_palette(row_info, png_ptr->row_buf + 1, - png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans); +#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE + if ((png_ptr->num_trans > 0) && (png_ptr->bit_depth == 8)) + { + /* Allocate space for the decompressed full palette. */ + if (png_ptr->riffled_palette == NULL) + { + png_ptr->riffled_palette = png_malloc(png_ptr, 256*4); + if (png_ptr->riffled_palette == NULL) + png_error(png_ptr, "NULL row buffer"); + /* Build the RGBA palette. */ + png_riffle_palette_rgba(png_ptr, row_info); + } + } +#endif + png_do_expand_palette(png_ptr, row_info, png_ptr->row_buf + 1, + png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans); } else diff --git a/src/3rdparty/libpng/pngrutil.c b/src/3rdparty/libpng/pngrutil.c index 7001f1976e..d5fa08c397 100644 --- a/src/3rdparty/libpng/pngrutil.c +++ b/src/3rdparty/libpng/pngrutil.c @@ -1,10 +1,10 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -1461,8 +1461,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) { /* We have the ICC profile header; do the basic header checks. */ - const png_uint_32 profile_length = - png_get_uint_32(profile_header); + png_uint_32 profile_length = png_get_uint_32(profile_header); if (png_icc_check_length(png_ptr, &png_ptr->colorspace, keyword, profile_length) != 0) @@ -1479,8 +1478,8 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) * profile. The header check has already validated * that none of this stuff will overflow. */ - const png_uint_32 tag_count = png_get_uint_32( - profile_header+128); + png_uint_32 tag_count = + png_get_uint_32(profile_header + 128); png_bytep profile = png_read_buffer(png_ptr, profile_length, 2/*silent*/); @@ -3132,7 +3131,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, */ void /* PRIVATE */ -png_check_chunk_name(png_const_structrp png_ptr, const png_uint_32 chunk_name) +png_check_chunk_name(png_const_structrp png_ptr, png_uint_32 chunk_name) { int i; png_uint_32 cn=chunk_name; @@ -3151,7 +3150,7 @@ png_check_chunk_name(png_const_structrp png_ptr, const png_uint_32 chunk_name) } void /* PRIVATE */ -png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length) +png_check_chunk_length(png_const_structrp png_ptr, png_uint_32 length) { png_alloc_size_t limit = PNG_UINT_31_MAX; @@ -3363,7 +3362,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) /* Hence the pre-compiled masks indexed by PACKSWAP (or not), depth and * then pass: */ - static PNG_CONST png_uint_32 row_mask[2/*PACKSWAP*/][3/*depth*/][6] = + static const png_uint_32 row_mask[2/*PACKSWAP*/][3/*depth*/][6] = { /* Little-endian byte masks for PACKSWAP */ { S_MASKS(1,0), S_MASKS(2,0), S_MASKS(4,0) }, @@ -3374,7 +3373,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) /* display_mask has only three entries for the odd passes, so index by * pass>>1. */ - static PNG_CONST png_uint_32 display_mask[2][3][3] = + static const png_uint_32 display_mask[2][3][3] = { /* Little-endian byte masks for PACKSWAP */ { B_MASKS(1,0), B_MASKS(2,0), B_MASKS(4,0) }, @@ -3687,7 +3686,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, { /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Offset to next interlace block */ - static PNG_CONST unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + static const unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; png_debug(1, "in png_do_read_interlace"); if (row != NULL && row_info != NULL) @@ -4329,16 +4328,16 @@ png_read_finish_row(png_structrp png_ptr) /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ - static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; /* Offset to next interlace block */ - static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; /* Start of interlace block in the y direction */ - static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; /* Offset to next interlace block in the y direction */ - static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; + static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; png_debug(1, "in png_read_finish_row"); png_ptr->row_number++; @@ -4394,16 +4393,16 @@ png_read_start_row(png_structrp png_ptr) /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ - static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; /* Offset to next interlace block */ - static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; /* Start of interlace block in the y direction */ - static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; /* Offset to next interlace block in the y direction */ - static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; + static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; unsigned int max_pixel_depth; size_t row_bytes; diff --git a/src/3rdparty/libpng/pngset.c b/src/3rdparty/libpng/pngset.c index 7cf54d9248..ec75dbe369 100644 --- a/src/3rdparty/libpng/pngset.c +++ b/src/3rdparty/libpng/pngset.c @@ -1,10 +1,10 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -137,7 +137,7 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X, #ifdef PNG_eXIf_SUPPORTED void PNGAPI png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, - const png_bytep eXIf_buf) + png_bytep eXIf_buf) { png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1"); PNG_UNUSED(info_ptr) @@ -146,7 +146,7 @@ png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, 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) + png_uint_32 num_exif, png_bytep eXIf_buf) { int i; @@ -1399,7 +1399,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep, /* Ignore all unknown chunks and all chunks recognized by * libpng except for IHDR, PLTE, tRNS, IDAT, and IEND */ - static PNG_CONST png_byte chunks_to_ignore[] = { + static const png_byte chunks_to_ignore[] = { 98, 75, 71, 68, '\0', /* bKGD */ 99, 72, 82, 77, '\0', /* cHRM */ 101, 88, 73, 102, '\0', /* eXIf */ diff --git a/src/3rdparty/libpng/pngstruct.h b/src/3rdparty/libpng/pngstruct.h index 699e8ac68a..94a6d041ff 100644 --- a/src/3rdparty/libpng/pngstruct.h +++ b/src/3rdparty/libpng/pngstruct.h @@ -1,10 +1,10 @@ /* pngstruct.h - header file for PNG reference library * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -228,6 +228,10 @@ struct png_struct_def * big_row_buf; while writing it is separately * allocated. */ +#ifdef PNG_READ_EXPAND_SUPPORTED + /* Buffer to accelerate palette transformations. */ + png_bytep riffled_palette; +#endif #ifdef PNG_WRITE_FILTER_SUPPORTED png_bytep try_row; /* buffer to save trial row when filtering */ png_bytep tst_row; /* buffer to save best trial row when filtering */ diff --git a/src/3rdparty/libpng/pngtrans.c b/src/3rdparty/libpng/pngtrans.c index de84aa6d6b..1100f46ebe 100644 --- a/src/3rdparty/libpng/pngtrans.c +++ b/src/3rdparty/libpng/pngtrans.c @@ -1,10 +1,10 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -345,7 +345,7 @@ png_do_swap(png_row_infop row_info, png_bytep row) #endif #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) -static PNG_CONST png_byte onebppswaptable[256] = { +static const png_byte onebppswaptable[256] = { 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, @@ -380,7 +380,7 @@ static PNG_CONST png_byte onebppswaptable[256] = { 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF }; -static PNG_CONST png_byte twobppswaptable[256] = { +static const png_byte twobppswaptable[256] = { 0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0, 0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0, 0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4, @@ -415,7 +415,7 @@ static PNG_CONST png_byte twobppswaptable[256] = { 0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF }; -static PNG_CONST png_byte fourbppswaptable[256] = { +static const png_byte fourbppswaptable[256] = { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0, 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, diff --git a/src/3rdparty/libpng/pngwio.c b/src/3rdparty/libpng/pngwio.c index e5391687a2..10e919dd03 100644 --- a/src/3rdparty/libpng/pngwio.c +++ b/src/3rdparty/libpng/pngwio.c @@ -1,10 +1,10 @@ /* pngwio.c - functions for data output * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2014,2016,2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer diff --git a/src/3rdparty/libpng/pngwrite.c b/src/3rdparty/libpng/pngwrite.c index 5bd87f373e..160c877d38 100644 --- a/src/3rdparty/libpng/pngwrite.c +++ b/src/3rdparty/libpng/pngwrite.c @@ -1,10 +1,10 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -469,7 +469,7 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_CONVERT_tIME_SUPPORTED void PNGAPI -png_convert_from_struct_tm(png_timep ptime, PNG_CONST struct tm * ttime) +png_convert_from_struct_tm(png_timep ptime, const struct tm * ttime) { png_debug(1, "in png_convert_from_struct_tm"); @@ -948,6 +948,10 @@ png_write_destroy(png_structrp png_ptr) png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list); png_free(png_ptr, png_ptr->row_buf); png_ptr->row_buf = NULL; +#ifdef PNG_READ_EXPANDED_SUPPORTED + png_free(png_ptr, png_ptr->riffled_palette); + png_ptr->riffled_palette = NULL; +#endif #ifdef PNG_WRITE_FILTER_SUPPORTED png_free(png_ptr, png_ptr->prev_row); png_free(png_ptr, png_ptr->try_row); @@ -1536,7 +1540,7 @@ png_write_image_16bit(png_voidp argument) display->first_row); png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row); png_uint_16p row_end; - const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? + unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1; int aindex = 0; png_uint_32 y = image->height; @@ -1573,7 +1577,7 @@ png_write_image_16bit(png_voidp argument) while (out_ptr < row_end) { - const png_uint_16 alpha = in_ptr[aindex]; + png_uint_16 alpha = in_ptr[aindex]; png_uint_32 reciprocal = 0; int c; @@ -1695,7 +1699,7 @@ png_write_image_8bit(png_voidp argument) display->first_row); png_bytep output_row = png_voidcast(png_bytep, display->local_row); png_uint_32 y = image->height; - const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? + unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1; if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0) @@ -1783,25 +1787,25 @@ png_write_image_8bit(png_voidp argument) static void png_image_set_PLTE(png_image_write_control *display) { - const png_imagep image = display->image; + png_imagep image = display->image; const void *cmap = display->colormap; - const int entries = image->colormap_entries > 256 ? 256 : + int entries = image->colormap_entries > 256 ? 256 : (int)image->colormap_entries; /* NOTE: the caller must check for cmap != NULL and entries != 0 */ - const png_uint_32 format = image->format; - const unsigned int channels = PNG_IMAGE_SAMPLE_CHANNELS(format); + png_uint_32 format = image->format; + unsigned int channels = PNG_IMAGE_SAMPLE_CHANNELS(format); # if defined(PNG_FORMAT_BGR_SUPPORTED) &&\ defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED) - const int afirst = (format & PNG_FORMAT_FLAG_AFIRST) != 0 && + int afirst = (format & PNG_FORMAT_FLAG_AFIRST) != 0 && (format & PNG_FORMAT_FLAG_ALPHA) != 0; # else # define afirst 0 # endif # ifdef PNG_FORMAT_BGR_SUPPORTED - const int bgr = (format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0; + int bgr = (format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0; # else # define bgr 0 # endif @@ -1951,12 +1955,12 @@ png_image_write_main(png_voidp argument) * and total image size to ensure that they are within the system limits. */ { - const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); + unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); if (image->width <= 0x7fffffffU/channels) /* no overflow */ { png_uint_32 check; - const png_uint_32 png_row_stride = image->width * channels; + png_uint_32 png_row_stride = image->width * channels; if (display->row_stride == 0) display->row_stride = (png_int_32)/*SAFE*/png_row_stride; @@ -2052,7 +2056,7 @@ png_image_write_main(png_voidp argument) */ if (write_16bit != 0) { - PNG_CONST png_uint_16 le = 0x0001; + png_uint_16 le = 0x0001; if ((*(png_const_bytep) & le) != 0) png_set_swap(png_ptr); @@ -2166,7 +2170,7 @@ image_memory_write)(png_structp png_ptr, png_bytep/*const*/ data, size_t size) { png_image_write_control *display = png_voidcast(png_image_write_control*, png_ptr->io_ptr/*backdoor: png_get_io_ptr(png_ptr)*/); - const png_alloc_size_t ob = display->output_bytes; + png_alloc_size_t ob = display->output_bytes; /* Check for overflow; this should never happen: */ if (size <= ((png_alloc_size_t)-1) - ob) diff --git a/src/3rdparty/libpng/pngwtran.c b/src/3rdparty/libpng/pngwtran.c index 3a1e0a21d2..49a13c1e98 100644 --- a/src/3rdparty/libpng/pngwtran.c +++ b/src/3rdparty/libpng/pngwtran.c @@ -1,10 +1,10 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -254,8 +254,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, for (i = 0; i < istop; i++, bp++) { - - const unsigned int c = i%channels; + unsigned int c = i%channels; int j; unsigned int v, out; @@ -283,7 +282,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, for (bp = row, i = 0; i < istop; i++) { - const unsigned int c = i%channels; + unsigned int c = i%channels; int j; unsigned int value, v; diff --git a/src/3rdparty/libpng/pngwutil.c b/src/3rdparty/libpng/pngwutil.c index ab431e712c..16345e4c0b 100644 --- a/src/3rdparty/libpng/pngwutil.c +++ b/src/3rdparty/libpng/pngwutil.c @@ -1,10 +1,10 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -1893,16 +1893,16 @@ png_write_start_row(png_structrp png_ptr) /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ - static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; /* Offset to next interlace block */ - static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; /* Start of interlace block in the y direction */ - static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; /* Offset to next interlace block in the y direction */ - static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; + static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; #endif png_alloc_size_t buf_size; @@ -2008,16 +2008,16 @@ png_write_finish_row(png_structrp png_ptr) /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ - static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; /* Offset to next interlace block */ - static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; /* Start of interlace block in the y direction */ - static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; /* Offset to next interlace block in the y direction */ - static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; + static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; #endif png_debug(1, "in png_write_finish_row"); @@ -2098,10 +2098,10 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ - static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; /* Offset to next interlace block */ - static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; png_debug(1, "in png_do_write_interlace"); @@ -2276,7 +2276,7 @@ png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row, #ifdef PNG_WRITE_FILTER_SUPPORTED static size_t /* PRIVATE */ -png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp, +png_setup_sub_row(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes, size_t lmins) { png_bytep rp, dp, lp; @@ -2315,7 +2315,7 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp, } static void /* PRIVATE */ -png_setup_sub_row_only(png_structrp png_ptr, const png_uint_32 bpp, +png_setup_sub_row_only(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes) { png_bytep rp, dp, lp; @@ -2380,7 +2380,7 @@ png_setup_up_row_only(png_structrp png_ptr, size_t row_bytes) } static size_t /* PRIVATE */ -png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp, +png_setup_avg_row(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes, size_t lmins) { png_bytep rp, dp, pp, lp; @@ -2420,7 +2420,7 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp, return (sum); } static void /* PRIVATE */ -png_setup_avg_row_only(png_structrp png_ptr, const png_uint_32 bpp, +png_setup_avg_row_only(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes) { png_bytep rp, dp, pp, lp; @@ -2442,7 +2442,7 @@ png_setup_avg_row_only(png_structrp png_ptr, const png_uint_32 bpp, } static size_t /* PRIVATE */ -png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp, +png_setup_paeth_row(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes, size_t lmins) { png_bytep rp, dp, pp, cp, lp; @@ -2503,7 +2503,7 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp, return (sum); } static void /* PRIVATE */ -png_setup_paeth_row_only(png_structrp png_ptr, const png_uint_32 bpp, +png_setup_paeth_row_only(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes) { png_bytep rp, dp, pp, cp, lp; diff --git a/src/3rdparty/libpng/qt_attribution.json b/src/3rdparty/libpng/qt_attribution.json index 2f82b4c1c6..a0fd149bf4 100644 --- a/src/3rdparty/libpng/qt_attribution.json +++ b/src/3rdparty/libpng/qt_attribution.json @@ -6,9 +6,9 @@ "Description": "libpng is the official PNG reference library.", "Homepage": "http://www.libpng.org/pub/png/libpng.html", - "Version": "1.6.35", - "License": "libpng License", - "LicenseId": "Libpng", + "Version": "1.6.36", + "License": "libpng License and libpng License 2", + "LicenseId": "Libpng AND Libpng2", "LicenseFile": "LICENSE", "Copyright": "Copyright (c) 1998-2018 Glenn Randers-Pehrson Copyright (c) 2000-2017 Simon-Pierre Cadieux -- cgit v1.2.3 From a53500f5bf75a89e2a616781c806553568531e5a Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 16 Jan 2019 13:47:12 +0100 Subject: Eliminate some stray misleading paths from expected output files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The output files for the tuplediagnostics selftest of testlib had a stray non-canoical path fragment in them; so replaced with its canonical form. Change-Id: Ib421380036c3fb1b91447eb8c87be4ad0dfe5c96 Reviewed-by: Jędrzej Nowacki --- tests/auto/testlib/selftests/expected_tuplediagnostics.lightxml | 4 ++-- tests/auto/testlib/selftests/expected_tuplediagnostics.tap | 8 ++++---- tests/auto/testlib/selftests/expected_tuplediagnostics.teamcity | 4 ++-- tests/auto/testlib/selftests/expected_tuplediagnostics.txt | 4 ++-- tests/auto/testlib/selftests/expected_tuplediagnostics.xml | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/auto/testlib/selftests/expected_tuplediagnostics.lightxml b/tests/auto/testlib/selftests/expected_tuplediagnostics.lightxml index 810941d894..85f8fac42a 100644 --- a/tests/auto/testlib/selftests/expected_tuplediagnostics.lightxml +++ b/tests/auto/testlib/selftests/expected_tuplediagnostics.lightxml @@ -12,7 +12,7 @@ - + {1}): std::tuple(1) Expected (std::tuple{2}): std::tuple(2)]]> @@ -20,7 +20,7 @@ - + diff --git a/tests/auto/testlib/selftests/expected_tuplediagnostics.tap b/tests/auto/testlib/selftests/expected_tuplediagnostics.tap index 9e007c14e1..a079a9bf40 100644 --- a/tests/auto/testlib/selftests/expected_tuplediagnostics.tap +++ b/tests/auto/testlib/selftests/expected_tuplediagnostics.tap @@ -10,8 +10,8 @@ not ok 3 - testSimpleTuple() found: std::tuple(1) (std::tuple{1}) expected: std::tuple(2) (std::tuple{2}) actual: std::tuple(1) (std::tuple{1}) - at: tst_TupleDiagnostics::testSimpleTuple() (/localqtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp:53) - file: /localqtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp + at: tst_TupleDiagnostics::testSimpleTuple() (qtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp:53) + file: qtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp line: 53 ... not ok 4 - testTuple() @@ -22,8 +22,8 @@ not ok 4 - testTuple() found: std::tuple(42, 'Y', "tuple1") (tuple1) expected: std::tuple(42, 'Y', "tuple2") (tuple2) actual: std::tuple(42, 'Y', "tuple1") (tuple1) - at: tst_TupleDiagnostics::testTuple() (/localqtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp:60) - file: /localqtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp + at: tst_TupleDiagnostics::testTuple() (qtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp:60) + file: qtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp line: 60 ... ok 5 - cleanupTestCase() diff --git a/tests/auto/testlib/selftests/expected_tuplediagnostics.teamcity b/tests/auto/testlib/selftests/expected_tuplediagnostics.teamcity index a395857c60..7256992518 100644 --- a/tests/auto/testlib/selftests/expected_tuplediagnostics.teamcity +++ b/tests/auto/testlib/selftests/expected_tuplediagnostics.teamcity @@ -4,10 +4,10 @@ ##teamcity[testStarted name='testEmptyTuple()' flowId='tst_TupleDiagnostics'] ##teamcity[testFinished name='testEmptyTuple()' flowId='tst_TupleDiagnostics'] ##teamcity[testStarted name='testSimpleTuple()' flowId='tst_TupleDiagnostics'] -##teamcity[testFailed name='testSimpleTuple()' message='Failure! |[Loc: /localqtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp(0)|]' details='Compared values are not the same|n Actual (std::tuple{1}): std::tuple(1)|n Expected (std::tuple{2}): std::tuple(2)' flowId='tst_TupleDiagnostics'] +##teamcity[testFailed name='testSimpleTuple()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp(0)|]' details='Compared values are not the same|n Actual (std::tuple{1}): std::tuple(1)|n Expected (std::tuple{2}): std::tuple(2)' flowId='tst_TupleDiagnostics'] ##teamcity[testFinished name='testSimpleTuple()' flowId='tst_TupleDiagnostics'] ##teamcity[testStarted name='testTuple()' flowId='tst_TupleDiagnostics'] -##teamcity[testFailed name='testTuple()' message='Failure! |[Loc: /localqtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp(0)|]' details='Compared values are not the same|n Actual (tuple1): std::tuple(42, |'Y|', "tuple1")|n Expected (tuple2): std::tuple(42, |'Y|', "tuple2")' flowId='tst_TupleDiagnostics'] +##teamcity[testFailed name='testTuple()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp(0)|]' details='Compared values are not the same|n Actual (tuple1): std::tuple(42, |'Y|', "tuple1")|n Expected (tuple2): std::tuple(42, |'Y|', "tuple2")' flowId='tst_TupleDiagnostics'] ##teamcity[testFinished name='testTuple()' flowId='tst_TupleDiagnostics'] ##teamcity[testStarted name='cleanupTestCase()' flowId='tst_TupleDiagnostics'] ##teamcity[testFinished name='cleanupTestCase()' flowId='tst_TupleDiagnostics'] diff --git a/tests/auto/testlib/selftests/expected_tuplediagnostics.txt b/tests/auto/testlib/selftests/expected_tuplediagnostics.txt index ce568bf6c0..8d121acc83 100644 --- a/tests/auto/testlib/selftests/expected_tuplediagnostics.txt +++ b/tests/auto/testlib/selftests/expected_tuplediagnostics.txt @@ -5,11 +5,11 @@ PASS : tst_TupleDiagnostics::testEmptyTuple() FAIL! : tst_TupleDiagnostics::testSimpleTuple() Compared values are not the same Actual (std::tuple{1}): std::tuple(1) Expected (std::tuple{2}): std::tuple(2) - Loc: [/localqtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp(0)] + Loc: [qtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp(0)] FAIL! : tst_TupleDiagnostics::testTuple() Compared values are not the same Actual (tuple1): std::tuple(42, 'Y', "tuple1") Expected (tuple2): std::tuple(42, 'Y', "tuple2") - Loc: [/localqtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp(0)] + Loc: [qtbase/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp(0)] PASS : tst_TupleDiagnostics::cleanupTestCase() Totals: 3 passed, 2 failed, 0 skipped, 0 blacklisted, 0ms ********* Finished testing of tst_TupleDiagnostics ********* diff --git a/tests/auto/testlib/selftests/expected_tuplediagnostics.xml b/tests/auto/testlib/selftests/expected_tuplediagnostics.xml index 4c55a6d393..f32974adb4 100644 --- a/tests/auto/testlib/selftests/expected_tuplediagnostics.xml +++ b/tests/auto/testlib/selftests/expected_tuplediagnostics.xml @@ -14,7 +14,7 @@ - + {1}): std::tuple(1) Expected (std::tuple{2}): std::tuple(2)]]> @@ -22,7 +22,7 @@ - + -- cgit v1.2.3 From ccfd6872badaed768df14076dc46afcb2b3c861a Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 11 Jan 2019 20:18:23 +0100 Subject: QSqlRelationalDelegate: compile with QT_NO_CAST_FROM_BYTEARRAY QSqlRelationalDelegate::setEditorData() does not compile when QT_NO_CAST_FROM_BYTEARRAY is defined. Since it's a public header this will break user code. Fix it by calling QByteArray::data() instead of relying on the implicit cast. Fixes: QTBUG-72764 Change-Id: I9c111dd25f48c9c9780d9f9a5b6b75eed0c8d6ed Reviewed-by: Edward Welbourne Reviewed-by: Andy Shaw --- src/sql/models/qsqlrelationaldelegate.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sql/models/qsqlrelationaldelegate.h b/src/sql/models/qsqlrelationaldelegate.h index e8ae5a229d..ca5c46778f 100644 --- a/src/sql/models/qsqlrelationaldelegate.h +++ b/src/sql/models/qsqlrelationaldelegate.h @@ -109,11 +109,11 @@ QWidget *createEditor(QWidget *aParent, // to present the DisplayRole and not the EditRole which // is the id reference to the related model QVariant v = index.data(Qt::DisplayRole); - QByteArray n = editor->metaObject()->userProperty().name(); + const QByteArray n = editor->metaObject()->userProperty().name(); if (!n.isEmpty()) { if (!v.isValid()) - v = QVariant(editor->property(n).userType(), nullptr); - editor->setProperty(n, v); + v = QVariant(editor->property(n.data()).userType(), nullptr); + editor->setProperty(n.data(), v); return; } } -- cgit v1.2.3 From 83aa70f0ca5e5c7427a3493c4d3dbc398735a5df Mon Sep 17 00:00:00 2001 From: Vyacheslav Koscheev Date: Wed, 16 Jan 2019 13:11:37 +0700 Subject: Android: fix NPE on m_editPopupMenu Change-Id: Id6d4aea91d621194cf85f604b1b9acdc916bede1 Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../jar/src/org/qtproject/qt5/android/QtActivityDelegate.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 74b515ef5b..02033859e9 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -506,7 +506,8 @@ public class QtActivityDelegate m_rightSelectionHandle = null; m_leftSelectionHandle = null; } - m_editPopupMenu.hide(); + if (m_editPopupMenu != null) + m_editPopupMenu.hide(); break; case CursorHandleShowNormal: @@ -561,7 +562,8 @@ public class QtActivityDelegate } m_editPopupMenu.setPosition(editX, editY, editButtons); } else { - m_editPopupMenu.hide(); + if (m_editPopupMenu != null) + m_editPopupMenu.hide(); } } -- cgit v1.2.3 From 9d2923c1b048b519c352c40bf26328dacef9304e Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 18 Jan 2019 20:52:36 +0100 Subject: tst_QString: fix localeAwareCompare() when using ICU tst_QString::localeAwareCompare() is failing since ab448f731ecd8437c7c5c8b96a0e7f419ec3a7ca because the 'C' locale no longer initializes ICU and falls back to simple QString comparison. Fix it by explicitly setting the locale for the testdata to en_US so the QCollator is properly initialized. Task-number: QTBUG-73116 Change-Id: I9d4d55e666c5c52f93298dedb7e22da01a25318d Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 50 ++++++++++++------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index f429bda804..c78cd2276f 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -5521,35 +5521,35 @@ void tst_QString::localeAwareCompare_data() // console.log("\u1111\u1171\u11B6".localeCompare("\ud4db") // example from Unicode 5.0, section 3.7, definition D70 - QTest::newRow("normalize1") << QString() << QString::fromUtf8("o\xCC\x88") << QString::fromUtf8("\xC3\xB6") << 0; + QTest::newRow("normalize1") << QString("en_US") << QString::fromUtf8("o\xCC\x88") << QString::fromUtf8("\xC3\xB6") << 0; // examples from Unicode 5.0, chapter 3.11 - QTest::newRow("normalize2") << QString() << QString::fromUtf8("\xC3\xA4\xCC\xA3") << QString::fromUtf8("a\xCC\xA3\xCC\x88") << 0; - QTest::newRow("normalize3") << QString() << QString::fromUtf8("a\xCC\x88\xCC\xA3") << QString::fromUtf8("a\xCC\xA3\xCC\x88") << 0; - QTest::newRow("normalize4") << QString() << QString::fromUtf8("\xE1\xBA\xA1\xCC\x88") << QString::fromUtf8("a\xCC\xA3\xCC\x88") << 0; - QTest::newRow("normalize5") << QString() << QString::fromUtf8("\xC3\xA4\xCC\x86") << QString::fromUtf8("a\xCC\x88\xCC\x86") << 0; - QTest::newRow("normalize6") << QString() << QString::fromUtf8("\xC4\x83\xCC\x88") << QString::fromUtf8("a\xCC\x86\xCC\x88") << 0; + QTest::newRow("normalize2") << QString("en_US") << QString::fromUtf8("\xC3\xA4\xCC\xA3") << QString::fromUtf8("a\xCC\xA3\xCC\x88") << 0; + QTest::newRow("normalize3") << QString("en_US") << QString::fromUtf8("a\xCC\x88\xCC\xA3") << QString::fromUtf8("a\xCC\xA3\xCC\x88") << 0; + QTest::newRow("normalize4") << QString("en_US") << QString::fromUtf8("\xE1\xBA\xA1\xCC\x88") << QString::fromUtf8("a\xCC\xA3\xCC\x88") << 0; + QTest::newRow("normalize5") << QString("en_US") << QString::fromUtf8("\xC3\xA4\xCC\x86") << QString::fromUtf8("a\xCC\x88\xCC\x86") << 0; + QTest::newRow("normalize6") << QString("en_US") << QString::fromUtf8("\xC4\x83\xCC\x88") << QString::fromUtf8("a\xCC\x86\xCC\x88") << 0; // example from Unicode 5.0, chapter 3.12 - QTest::newRow("normalize7") << QString() << QString::fromUtf8("\xE1\x84\x91\xE1\x85\xB1\xE1\x86\xB6") << QString::fromUtf8("\xED\x93\x9B") << 0; + QTest::newRow("normalize7") << QString("en_US") << QString::fromUtf8("\xE1\x84\x91\xE1\x85\xB1\xE1\x86\xB6") << QString::fromUtf8("\xED\x93\x9B") << 0; // examples from UTS 10, Unicode Collation Algorithm - QTest::newRow("normalize8") << QString() << QString::fromUtf8("\xE2\x84\xAB") << QString::fromUtf8("\xC3\x85") << 0; - QTest::newRow("normalize9") << QString() << QString::fromUtf8("\xE2\x84\xAB") << QString::fromUtf8("A\xCC\x8A") << 0; - QTest::newRow("normalize10") << QString() << QString::fromUtf8("x\xCC\x9B\xCC\xA3") << QString::fromUtf8("x\xCC\xA3\xCC\x9B") << 0; - QTest::newRow("normalize11") << QString() << QString::fromUtf8("\xE1\xBB\xB1") << QString::fromUtf8("\xE1\xBB\xA5\xCC\x9B") << 0; - QTest::newRow("normalize12") << QString() << QString::fromUtf8("\xE1\xBB\xB1") << QString::fromUtf8("u\xCC\x9B\xCC\xA3") << 0; - QTest::newRow("normalize13") << QString() << QString::fromUtf8("\xE1\xBB\xB1") << QString::fromUtf8("\xC6\xB0\xCC\xA3") << 0; - QTest::newRow("normalize14") << QString() << QString::fromUtf8("\xE1\xBB\xB1") << QString::fromUtf8("u\xCC\xA3\xCC\x9B") << 0; + QTest::newRow("normalize8") << QString("en_US") << QString::fromUtf8("\xE2\x84\xAB") << QString::fromUtf8("\xC3\x85") << 0; + QTest::newRow("normalize9") << QString("en_US") << QString::fromUtf8("\xE2\x84\xAB") << QString::fromUtf8("A\xCC\x8A") << 0; + QTest::newRow("normalize10") << QString("en_US") << QString::fromUtf8("x\xCC\x9B\xCC\xA3") << QString::fromUtf8("x\xCC\xA3\xCC\x9B") << 0; + QTest::newRow("normalize11") << QString("en_US") << QString::fromUtf8("\xE1\xBB\xB1") << QString::fromUtf8("\xE1\xBB\xA5\xCC\x9B") << 0; + QTest::newRow("normalize12") << QString("en_US") << QString::fromUtf8("\xE1\xBB\xB1") << QString::fromUtf8("u\xCC\x9B\xCC\xA3") << 0; + QTest::newRow("normalize13") << QString("en_US") << QString::fromUtf8("\xE1\xBB\xB1") << QString::fromUtf8("\xC6\xB0\xCC\xA3") << 0; + QTest::newRow("normalize14") << QString("en_US") << QString::fromUtf8("\xE1\xBB\xB1") << QString::fromUtf8("u\xCC\xA3\xCC\x9B") << 0; // examples from UAX 15, Unicode Normalization Forms - QTest::newRow("normalize15") << QString() << QString::fromUtf8("\xC3\x87") << QString::fromUtf8("C\xCC\xA7") << 0; - QTest::newRow("normalize16") << QString() << QString::fromUtf8("q\xCC\x87\xCC\xA3") << QString::fromUtf8("q\xCC\xA3\xCC\x87") << 0; - QTest::newRow("normalize17") << QString() << QString::fromUtf8("\xEA\xB0\x80") << QString::fromUtf8("\xE1\x84\x80\xE1\x85\xA1") << 0; - QTest::newRow("normalize18") << QString() << QString::fromUtf8("\xE2\x84\xAB") << QString::fromUtf8("A\xCC\x8A") << 0; - QTest::newRow("normalize19") << QString() << QString::fromUtf8("\xE2\x84\xA6") << QString::fromUtf8("\xCE\xA9") << 0; - QTest::newRow("normalize20") << QString() << QString::fromUtf8("\xC3\x85") << QString::fromUtf8("A\xCC\x8A") << 0; - QTest::newRow("normalize21") << QString() << QString::fromUtf8("\xC3\xB4") << QString::fromUtf8("o\xCC\x82") << 0; - QTest::newRow("normalize22") << QString() << QString::fromUtf8("\xE1\xB9\xA9") << QString::fromUtf8("s\xCC\xA3\xCC\x87") << 0; - QTest::newRow("normalize23") << QString() << QString::fromUtf8("\xE1\xB8\x8B\xCC\xA3") << QString::fromUtf8("d\xCC\xA3\xCC\x87") << 0; - QTest::newRow("normalize24") << QString() << QString::fromUtf8("\xE1\xB8\x8B\xCC\xA3") << QString::fromUtf8("\xE1\xB8\x8D\xCC\x87") << 0; - QTest::newRow("normalize25") << QString() << QString::fromUtf8("q\xCC\x87\xCC\xA3") << QString::fromUtf8("q\xCC\xA3\xCC\x87") << 0; + QTest::newRow("normalize15") << QString("en_US") << QString::fromUtf8("\xC3\x87") << QString::fromUtf8("C\xCC\xA7") << 0; + QTest::newRow("normalize16") << QString("en_US") << QString::fromUtf8("q\xCC\x87\xCC\xA3") << QString::fromUtf8("q\xCC\xA3\xCC\x87") << 0; + QTest::newRow("normalize17") << QString("en_US") << QString::fromUtf8("\xEA\xB0\x80") << QString::fromUtf8("\xE1\x84\x80\xE1\x85\xA1") << 0; + QTest::newRow("normalize18") << QString("en_US") << QString::fromUtf8("\xE2\x84\xAB") << QString::fromUtf8("A\xCC\x8A") << 0; + QTest::newRow("normalize19") << QString("en_US") << QString::fromUtf8("\xE2\x84\xA6") << QString::fromUtf8("\xCE\xA9") << 0; + QTest::newRow("normalize20") << QString("en_US") << QString::fromUtf8("\xC3\x85") << QString::fromUtf8("A\xCC\x8A") << 0; + QTest::newRow("normalize21") << QString("en_US") << QString::fromUtf8("\xC3\xB4") << QString::fromUtf8("o\xCC\x82") << 0; + QTest::newRow("normalize22") << QString("en_US") << QString::fromUtf8("\xE1\xB9\xA9") << QString::fromUtf8("s\xCC\xA3\xCC\x87") << 0; + QTest::newRow("normalize23") << QString("en_US") << QString::fromUtf8("\xE1\xB8\x8B\xCC\xA3") << QString::fromUtf8("d\xCC\xA3\xCC\x87") << 0; + QTest::newRow("normalize24") << QString("en_US") << QString::fromUtf8("\xE1\xB8\x8B\xCC\xA3") << QString::fromUtf8("\xE1\xB8\x8D\xCC\x87") << 0; + QTest::newRow("normalize25") << QString("en_US") << QString::fromUtf8("q\xCC\x87\xCC\xA3") << QString::fromUtf8("q\xCC\xA3\xCC\x87") << 0; } -- cgit v1.2.3 From b1092a7d4240d419cc2b5f3f5c326a1cb680bbdd Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 19 Jan 2019 18:59:55 +0100 Subject: tst_QPrinter: stabilize qprinter test The CreationDate entry in the two PDF files can potentially be different depending on when the test is run. 97b4c5a5746a33a27076d72ceb3533fbd54b9642 already accounts for it but the current tag for creation date is '/CreationDate'. Therefore check if the line contains 'CreationDate' instead. Change-Id: I1fc069cf935bba07084ac4a0743ff05312374d10 Reviewed-by: Thiago Macieira --- tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index a65dd0bf8f..abe4325278 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -644,7 +644,7 @@ void tst_QPrinter::taskQTBUG4497_reusePrinterOnDifferentFiles() QByteArray file1Line = file1.readLine(); QByteArray file2Line = file2.readLine(); - if (!file1Line.startsWith("%%CreationDate")) + if (!file1Line.contains("CreationDate")) QCOMPARE(file1Line, file2Line); } -- cgit v1.2.3