summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--src/3rdparty/gradle/qt_attribution.json6
-rw-r--r--src/3rdparty/harfbuzz-ng/import_from_tarball.sh5
-rw-r--r--src/3rdparty/harfbuzz-ng/qt_attribution.json4
-rw-r--r--src/3rdparty/harfbuzz-ng/src/OT/Color/COLR/COLR.hh308
-rw-r--r--src/3rdparty/harfbuzz-ng/src/OT/Color/COLR/colrv1-closure.hh50
-rw-r--r--src/3rdparty/harfbuzz-ng/src/OT/Layout/GDEF/GDEF.hh41
-rw-r--r--src/3rdparty/harfbuzz-ng/src/OT/Layout/GSUB/Ligature.hh15
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-aat-layout-common.hh203
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-aat-layout-kerx-table.hh183
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-aat-layout-morx-table.hh262
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-aat-layout.cc53
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-algs.hh4
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-cff2-interp-cs.hh8
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-cplusplus.hh3
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-face-table-list.hh8
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-face.cc2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh3
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-kern-table.hh71
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-base-table.hh75
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common.hh14
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos.hh83
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc8
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-stat-table.hh3
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-tag-table.hh45
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-var-avar-table.hh8
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-var-common.hh94
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-var-fvar-table.hh7
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-var-gvar-table.hh5
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-repacker.hh18
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-set-digest.hh20
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-set.hh2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-subset-cff-common.hh57
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-subset-cff2.cc3
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-subset-input.cc15
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-iup.cc68
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-iup.hh2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-solver.cc94
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-solver.hh32
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-subset-plan-member-list.hh8
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-subset-plan.cc185
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-subset.h11
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-version.h4
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-wasm-api.h3
-rw-r--r--src/3rdparty/libjpeg/LICENSE31
-rwxr-xr-xsrc/3rdparty/libjpeg/import_from_libjpeg_tarball.sh2
-rw-r--r--src/3rdparty/libjpeg/qt_attribution.json10
-rw-r--r--src/3rdparty/libjpeg/src/ChangeLog.md24
-rw-r--r--src/3rdparty/libjpeg/src/jcmaster.c122
-rw-r--r--src/3rdparty/libjpeg/src/jconfig.h4
-rw-r--r--src/3rdparty/libjpeg/src/jconfigint.h2
-rw-r--r--src/3rdparty/libjpeg/src/jerror.c14
-rw-r--r--src/3rdparty/libjpeg/src/jversion.h7
-rw-r--r--src/3rdparty/libjpeg/zlib-license.txt15
-rw-r--r--src/3rdparty/sqlite/qt_attribution.json4
-rw-r--r--src/3rdparty/sqlite/sqlite3.c8475
-rw-r--r--src/3rdparty/sqlite/sqlite3.h97
-rw-r--r--src/android/CMakeLists.txt1
-rw-r--r--src/android/jar/CMakeLists.txt8
-rw-r--r--src/android/jar/build.gradle4
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/BackendRegister.java9
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtAccessibilityDelegate.java2
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtAccessibilityInterface.java14
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtActivityBase.java14
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java135
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtActivityDelegateBase.java90
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java63
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegateFactory.java37
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtEmbeddedLoader.java2
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtEmbeddedViewInterfaceFactory.java34
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtInputConnection.java9
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtInputDelegate.java261
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtInputInterface.java21
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtLayoutInterface.java8
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtMenuInterface.java11
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtNative.java97
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtRootLayout.java20
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtServiceEmbeddedDelegate.java10
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtSurface.java2
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtSurfaceInterface.java3
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtTextureView.java5
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtView.java52
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtWindow.java25
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtWindowInterface.java11
-rw-r--r--src/android/templates/build.gradle8
-rw-r--r--src/android/templates/doc/src/android-manifest-file-configuration.qdoc6
-rw-r--r--src/android/templates_aar/AndroidManifest.xml9
-rw-r--r--src/android/templates_aar/CMakeLists.txt24
-rw-r--r--src/assets/CMakeLists.txt2
-rw-r--r--src/corelib/CMakeLists.txt40
-rw-r--r--src/corelib/Qt6AndroidMacros.cmake57
-rw-r--r--src/corelib/Qt6CoreConfigExtras.cmake.in2
-rw-r--r--src/corelib/Qt6CoreMacros.cmake8
-rw-r--r--src/corelib/compat/removed_api.cpp93
-rw-r--r--src/corelib/configure.cmake72
-rw-r--r--src/corelib/doc/snippets/signalsandslots/signalsandslots.h2
-rw-r--r--src/corelib/doc/src/cmake/cmake-configure-variables.qdoc23
-rw-r--r--src/corelib/doc/src/cmake/cmake-properties.qdoc50
-rw-r--r--src/corelib/doc/src/cmake/qt_android_generate_deployment_settings.qdoc1
-rw-r--r--src/corelib/doc/src/foreach-keyword.qdoc3
-rw-r--r--src/corelib/doc/src/jni.qdoc215
-rw-r--r--src/corelib/doc/src/objectmodel/metaobjects.qdoc3
-rw-r--r--src/corelib/doc/src/objectmodel/properties.qdoc25
-rw-r--r--src/corelib/global/qassert.cpp30
-rw-r--r--src/corelib/global/qcompare.cpp56
-rw-r--r--src/corelib/global/qcomparehelpers.h116
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h2
-rw-r--r--src/corelib/global/qexceptionhandling.h6
-rw-r--r--src/corelib/global/qglobal.cpp13
-rw-r--r--src/corelib/global/qglobal.h3
-rw-r--r--src/corelib/global/qlibraryinfo.cpp181
-rw-r--r--src/corelib/global/qlibraryinfo.h1
-rw-r--r--src/corelib/global/qlibraryinfo_p.h1
-rw-r--r--src/corelib/global/qlogging.cpp10
-rw-r--r--src/corelib/global/qlogging.h3
-rw-r--r--src/corelib/global/qminmax.h23
-rw-r--r--src/corelib/global/qnamespace.h6
-rw-r--r--src/corelib/global/qnamespace.qdoc12
-rw-r--r--src/corelib/global/qtconfigmacros.h1
-rw-r--r--src/corelib/global/qtdeprecationdefinitions.h.in28
-rw-r--r--src/corelib/global/qtdeprecationmarkers.h23
-rw-r--r--src/corelib/global/qttypetraits.h20
-rw-r--r--src/corelib/global/qversiontagging.h2
-rw-r--r--src/corelib/io/qbuffer.cpp3
-rw-r--r--src/corelib/io/qdir.cpp5
-rw-r--r--src/corelib/io/qdirlisting.cpp85
-rw-r--r--src/corelib/io/qfile.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp34
-rw-r--r--src/corelib/io/qresource.cpp142
-rw-r--r--src/corelib/io/qstorageinfo_linux.cpp134
-rw-r--r--src/corelib/io/qstorageinfo_linux_p.h9
-rw-r--r--src/corelib/io/qstorageinfo_p.h1
-rw-r--r--src/corelib/io/qurl.cpp21
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp100
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.h42
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.h2
-rw-r--r--src/corelib/kernel/qapplicationstatic.h4
-rw-r--r--src/corelib/kernel/qcore_foundation.mm11
-rw-r--r--src/corelib/kernel/qcore_mac.mm2
-rw-r--r--src/corelib/kernel/qcore_mac_p.h5
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp2
-rw-r--r--src/corelib/kernel/qelapsedtimer.cpp5
-rw-r--r--src/corelib/kernel/qelapsedtimer.h39
-rw-r--r--src/corelib/kernel/qjniarray.h6
-rw-r--r--src/corelib/kernel/qjniobject.cpp52
-rw-r--r--src/corelib/kernel/qjniobject.h4
-rw-r--r--src/corelib/kernel/qjnitypes.h14
-rw-r--r--src/corelib/kernel/qmetaobject.cpp4
-rw-r--r--src/corelib/kernel/qmetaobject_p.h20
-rw-r--r--src/corelib/kernel/qmetatype.cpp63
-rw-r--r--src/corelib/kernel/qmetatype.h40
-rw-r--r--src/corelib/kernel/qobject.cpp41
-rw-r--r--src/corelib/kernel/qpointer.h37
-rw-r--r--src/corelib/kernel/qpointer.qdoc48
-rw-r--r--src/corelib/kernel/qproperty_p.h5
-rw-r--r--src/corelib/kernel/qpropertyprivate.h34
-rw-r--r--src/corelib/kernel/qsocketnotifier.h16
-rw-r--r--src/corelib/kernel/qvariant.h1
-rw-r--r--src/corelib/mimetypes/mime/packages/freedesktop.org.xml62
-rw-r--r--src/corelib/platform/android/qandroidnativeinterface.cpp2
-rw-r--r--src/corelib/plugin/quuid.cpp88
-rw-r--r--src/corelib/plugin/quuid.h90
-rw-r--r--src/corelib/serialization/qdatastream.cpp4
-rw-r--r--src/corelib/text/qanystringview.h21
-rw-r--r--src/corelib/text/qbytearray.cpp116
-rw-r--r--src/corelib/text/qbytearrayalgorithms.h6
-rw-r--r--src/corelib/text/qbytearraymatcher.cpp71
-rw-r--r--src/corelib/text/qbytearrayview.h12
-rw-r--r--src/corelib/text/qchar.cpp51
-rw-r--r--src/corelib/text/qchar.h14
-rw-r--r--src/corelib/text/qlatin1stringmatcher.cpp42
-rw-r--r--src/corelib/text/qlatin1stringmatcher.h9
-rw-r--r--src/corelib/text/qlocale.cpp5
-rw-r--r--src/corelib/text/qlocale_tools.cpp86
-rw-r--r--src/corelib/text/qlocale_tools_p.h20
-rw-r--r--src/corelib/text/qregularexpression.cpp17
-rw-r--r--src/corelib/text/qregularexpression.h34
-rw-r--r--src/corelib/text/qstaticlatin1stringmatcher.h23
-rw-r--r--src/corelib/text/qstaticlatin1stringmatcher.qdoc1
-rw-r--r--src/corelib/text/qstring.cpp73
-rw-r--r--src/corelib/text/qstringconverter_p.h1
-rw-r--r--src/corelib/thread/qfuture.h8
-rw-r--r--src/corelib/thread/qfuture.qdoc8
-rw-r--r--src/corelib/thread/qfutureinterface.h5
-rw-r--r--src/corelib/thread/qresultstore.cpp10
-rw-r--r--src/corelib/thread/qresultstore.h9
-rw-r--r--src/corelib/thread/qthread.cpp16
-rw-r--r--src/corelib/thread/qthread_unix.cpp18
-rw-r--r--src/corelib/thread/qthreadpool.cpp39
-rw-r--r--src/corelib/thread/qthreadpool.h13
-rw-r--r--src/corelib/thread/qthreadpool_p.h3
-rw-r--r--src/corelib/time/qdatetime.cpp31
-rw-r--r--src/corelib/time/qdatetime.h51
-rw-r--r--src/corelib/time/qdatetimeparser.cpp6
-rw-r--r--src/corelib/time/qdatetimeparser_p.h4
-rw-r--r--src/corelib/time/qtimezone.cpp39
-rw-r--r--src/corelib/time/qtimezone.h1
-rw-r--r--src/corelib/time/qtimezonelocale.cpp99
-rw-r--r--src/corelib/time/qtimezonelocale_p.h13
-rw-r--r--src/corelib/time/qtimezoneprivate.cpp127
-rw-r--r--src/corelib/time/qtimezoneprivate_data_p.h1939
-rw-r--r--src/corelib/time/qtimezoneprivate_icu.cpp73
-rw-r--r--src/corelib/time/qtimezoneprivate_p.h36
-rw-r--r--src/corelib/time/qtimezoneprivate_tz.cpp150
-rw-r--r--src/corelib/tools/qcryptographichash.cpp83
-rw-r--r--src/corelib/tools/qcryptographichash.h14
-rw-r--r--src/corelib/tools/qeasingcurve.cpp33
-rw-r--r--src/corelib/tools/qeasingcurve.h8
-rw-r--r--src/corelib/tools/qline.cpp41
-rw-r--r--src/corelib/tools/qline.h42
-rw-r--r--src/corelib/tools/qmargins.cpp32
-rw-r--r--src/corelib/tools/qmargins.h49
-rw-r--r--src/corelib/tools/qmessageauthenticationcode.h24
-rw-r--r--src/corelib/tools/qpoint.cpp47
-rw-r--r--src/corelib/tools/qpoint.h26
-rw-r--r--src/corelib/tools/qrect.cpp44
-rw-r--r--src/corelib/tools/qrect.h28
-rw-r--r--src/corelib/tools/qsize.cpp33
-rw-r--r--src/corelib/tools/qsize.h23
-rw-r--r--src/corelib/tools/qspan.h23
-rw-r--r--src/corelib/tools/qspan.qdoc36
-rw-r--r--src/corelib/tools/qversionnumber.cpp1
-rw-r--r--src/corelib/tools/qversionnumber.h32
-rw-r--r--src/dbus/qdbusextratypes.cpp2
-rw-r--r--src/dbus/qdbusextratypes.h5
-rw-r--r--src/dbus/qdbusmarshaller.cpp2
-rw-r--r--src/dbus/qdbusutil.cpp8
-rw-r--r--src/gui/CMakeLists.txt28
-rw-r--r--src/gui/accessible/linux/atspiadaptor.cpp77
-rw-r--r--src/gui/accessible/linux/atspiadaptor_p.h10
-rw-r--r--src/gui/accessible/linux/dbusconnection.cpp16
-rw-r--r--src/gui/accessible/linux/dbusconnection_p.h4
-rw-r--r--src/gui/accessible/linux/qspiaccessiblebridge.cpp2
-rw-r--r--src/gui/accessible/linux/qspiaccessiblebridge_p.h4
-rw-r--r--src/gui/accessible/qaccessible.cpp83
-rw-r--r--src/gui/accessible/qaccessible.h32
-rw-r--r--src/gui/accessible/qaccessible_base.h7
-rw-r--r--src/gui/accessible/qaccessiblebridge.cpp2
-rw-r--r--src/gui/accessible/qaccessiblebridge.h4
-rw-r--r--src/gui/configure.cmake2
-rw-r--r--src/gui/image/qbitmap.cpp1
-rw-r--r--src/gui/image/qicon.cpp154
-rw-r--r--src/gui/image/qicon_p.h39
-rw-r--r--src/gui/image/qiconengine.cpp7
-rw-r--r--src/gui/image/qiconengine.h1
-rw-r--r--src/gui/image/qiconloader.cpp32
-rw-r--r--src/gui/image/qiconloader_p.h4
-rw-r--r--src/gui/image/qimage.cpp90
-rw-r--r--src/gui/image/qimage_conversions.cpp8
-rw-r--r--src/gui/image/qimage_p.h26
-rw-r--r--src/gui/image/qimagereader.cpp18
-rw-r--r--src/gui/image/qimagewriter.cpp4
-rw-r--r--src/gui/image/qmovie.cpp7
-rw-r--r--src/gui/image/qpicture.cpp1
-rw-r--r--src/gui/image/qpixmap.cpp9
-rw-r--r--src/gui/image/qpixmap_blitter.cpp4
-rw-r--r--src/gui/image/qpixmap_raster.cpp4
-rw-r--r--src/gui/image/qpixmapcache.cpp11
-rw-r--r--src/gui/kernel/qguiapplication.cpp130
-rw-r--r--src/gui/kernel/qguiapplication.h2
-rw-r--r--src/gui/kernel/qguiapplication_p.h13
-rw-r--r--src/gui/kernel/qguiapplication_platform.h31
-rw-r--r--src/gui/kernel/qguivariant.cpp2
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h4
-rw-r--r--src/gui/kernel/qpaintdevicewindow.cpp5
-rw-r--r--src/gui/kernel/qpalette.cpp5
-rw-r--r--src/gui/kernel/qplatformtheme.cpp5
-rw-r--r--src/gui/kernel/qplatformtheme.h1
-rw-r--r--src/gui/kernel/qplatformwindow_p.h2
-rw-r--r--src/gui/kernel/qstylehints.cpp83
-rw-r--r--src/gui/kernel/qstylehints.h10
-rw-r--r--src/gui/kernel/qstylehints_p.h1
-rw-r--r--src/gui/kernel/qwindow.cpp73
-rw-r--r--src/gui/kernel/qwindow_p.h4
-rw-r--r--src/gui/painting/qbackingstore.cpp29
-rw-r--r--src/gui/painting/qbackingstorerhisupport.cpp4
-rw-r--r--src/gui/painting/qcmyk_p.h6
-rw-r--r--src/gui/painting/qcolormatrix_p.h6
-rw-r--r--src/gui/painting/qcolorspace.cpp103
-rw-r--r--src/gui/painting/qcolorspace.h13
-rw-r--r--src/gui/painting/qcolortransferfunction_p.h5
-rw-r--r--src/gui/painting/qcolortransfergeneric_p.h109
-rw-r--r--src/gui/painting/qcolortransform.cpp509
-rw-r--r--src/gui/painting/qcolortransform_p.h12
-rw-r--r--src/gui/painting/qcolortrc_p.h101
-rw-r--r--src/gui/painting/qcolortrclut.cpp67
-rw-r--r--src/gui/painting/qcolortrclut_p.h11
-rw-r--r--src/gui/painting/qdrawhelper.cpp8
-rw-r--r--src/gui/painting/qicc.cpp894
-rw-r--r--src/gui/painting/qimagescale.cpp2
-rw-r--r--src/gui/painting/qpaintdevice.cpp35
-rw-r--r--src/gui/painting/qpaintdevice.h16
-rw-r--r--src/gui/painting/qpaintdevice.qdoc20
-rw-r--r--src/gui/painting/qpdf.cpp70
-rw-r--r--src/gui/painting/qpdf_p.h4
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp65
-rw-r--r--src/gui/painting/qplatformbackingstore.h9
-rw-r--r--src/gui/painting/qregion.cpp64
-rw-r--r--src/gui/painting/qregion.h4
-rw-r--r--src/gui/painting/qrhibackingstore.cpp23
-rw-r--r--src/gui/platform/darwin/qmetallayer.mm73
-rw-r--r--src/gui/platform/darwin/qmetallayer_p.h41
-rw-r--r--src/gui/platform/ios/qiosnativeinterface.cpp26
-rw-r--r--src/gui/platform/unix/qgenericunixthemes.cpp290
-rw-r--r--src/gui/qt_cmdline.cmake3
-rw-r--r--src/gui/rhi/qrhigles2.cpp10
-rw-r--r--src/gui/rhi/qrhimetal.mm147
-rw-r--r--src/gui/text/coretext/qfontengine_coretext.mm5
-rw-r--r--src/gui/text/qcssparser.cpp62
-rw-r--r--src/gui/text/qcssparser_p.h17
-rw-r--r--src/gui/text/qfont.cpp21
-rw-r--r--src/gui/text/qfont.h27
-rw-r--r--src/gui/text/qfontdatabase.cpp31
-rw-r--r--src/gui/text/qfontengine.cpp7
-rw-r--r--src/gui/text/qfontengine_p.h1
-rw-r--r--src/gui/text/qtextdocument.cpp65
-rw-r--r--src/gui/text/qtextdocument.h6
-rw-r--r--src/gui/text/qtextengine.cpp6
-rw-r--r--src/gui/text/qtextformat.cpp21
-rw-r--r--src/gui/text/qtextformat.h8
-rw-r--r--src/gui/text/qtexthtmlparser.cpp62
-rw-r--r--src/gui/text/qtextimagehandler.cpp26
-rw-r--r--src/gui/util/qdesktopservices.cpp42
-rw-r--r--src/network/CMakeLists.txt2
-rw-r--r--src/network/access/http2/http2protocol_p.h2
-rw-r--r--src/network/access/qformdatabuilder.cpp313
-rw-r--r--src/network/access/qformdatabuilder.h126
-rw-r--r--src/network/access/qhttpmultipart.cpp51
-rw-r--r--src/network/access/qhttpmultipart.h4
-rw-r--r--src/network/access/qhttpmultipart_p.h7
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp67
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h7
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp151
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel_p.h5
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp10
-rw-r--r--src/network/access/qhttpnetworkrequest_p.h4
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp36
-rw-r--r--src/network/access/qnetworkaccessbackend.cpp37
-rw-r--r--src/network/access/qnetworkaccessbackend_p.h3
-rw-r--r--src/network/access/qnetworkaccesscachebackend.cpp28
-rw-r--r--src/network/access/qnetworkaccessdebugpipebackend.cpp4
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp37
-rw-r--r--src/network/access/qnetworkfile.cpp7
-rw-r--r--src/network/access/qnetworkfile_p.h2
-rw-r--r--src/network/access/qnetworkreply.cpp8
-rw-r--r--src/network/access/qnetworkreplydataimpl.cpp7
-rw-r--r--src/network/access/qnetworkreplyfileimpl.cpp16
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp259
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp43
-rw-r--r--src/network/access/qnetworkreplywasmimpl.cpp177
-rw-r--r--src/network/access/qnetworkreplywasmimpl_p.h26
-rw-r--r--src/network/access/qnetworkrequest.cpp435
-rw-r--r--src/network/access/qnetworkrequest.h4
-rw-r--r--src/network/access/qnetworkrequest_p.h30
-rw-r--r--src/network/access/qnetworkrequestfactory.cpp12
-rw-r--r--src/network/access/qrestaccessmanager_p.h8
-rw-r--r--src/network/access/qrestreply.cpp4
-rw-r--r--src/network/android/jar/build.gradle4
-rw-r--r--src/network/compat/removed_api.cpp3
-rw-r--r--src/network/kernel/qdnslookup.cpp554
-rw-r--r--src/network/kernel/qdnslookup.h110
-rw-r--r--src/network/kernel/qdnslookup_p.h44
-rw-r--r--src/network/kernel/qdnslookup_unix.cpp142
-rw-r--r--src/network/kernel/qdnslookup_win.cpp90
-rw-r--r--src/network/kernel/qnetworkinterface_unix.cpp26
-rw-r--r--src/network/kernel/qnetworkproxy.cpp55
-rw-r--r--src/network/kernel/qnetworkproxy.h4
-rw-r--r--src/network/socket/qhttpsocketengine.cpp11
-rw-r--r--src/opengl/qopenglcompositorbackingstore.cpp12
-rw-r--r--src/opengl/qopenglpaintdevice.cpp4
-rw-r--r--src/opengl/qopenglpaintengine_p.h2
-rw-r--r--src/openglwidgets/qopenglwidget.cpp4
-rw-r--r--src/plugins/networkinformation/android/jar/build.gradle4
-rw-r--r--src/plugins/platforms/android/CMakeLists.txt3
-rw-r--r--src/plugins/platforms/android/androidbackendregister.cpp52
-rw-r--r--src/plugins/platforms/android/androidbackendregister.h67
-rw-r--r--src/plugins/platforms/android/androidjniaccessibility.cpp2
-rw-r--r--src/plugins/platforms/android/androidjniinput.cpp52
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp78
-rw-r--r--src/plugins/platforms/android/androidjnimain.h6
-rw-r--r--src/plugins/platforms/android/androidjnimenu.cpp18
-rw-r--r--src/plugins/platforms/android/qandroidplatformscreen.cpp20
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.cpp15
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.h3
-rw-r--r--src/plugins/platforms/android/qandroidplatformwindow.cpp13
-rw-r--r--src/plugins/platforms/cocoa/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.mm17
-rw-r--r--src/plugins/platforms/cocoa/qcocoascreen.mm19
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm17
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h8
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm94
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm3
-rw-r--r--src/plugins/platforms/cocoa/qnsview_drawing.mm40
-rw-r--r--src/plugins/platforms/cocoa/qnswindow.mm2
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp4
-rw-r--r--src/plugins/platforms/eglfs/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/ios/CMakeLists.txt19
-rw-r--r--src/plugins/platforms/ios/SwiftIntegration.cmake78
-rw-r--r--src/plugins/platforms/ios/module.modulemap4
-rw-r--r--src/plugins/platforms/ios/qiosapplication.swift198
-rw-r--r--src/plugins/platforms/ios/qiosapplicationdelegate.h5
-rw-r--r--src/plugins/platforms/ios/qiosdocumentpickercontroller.mm8
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.h2
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.mm21
-rw-r--r--src/plugins/platforms/ios/qiosglobal.mm20
-rw-r--r--src/plugins/platforms/ios/qiosintegration.h31
-rw-r--r--src/plugins/platforms/ios/qiosintegration.mm50
-rw-r--r--src/plugins/platforms/ios/qiostextinputoverlay.mm2
-rw-r--r--src/plugins/platforms/ios/qiostheme.h5
-rw-r--r--src/plugins/platforms/ios/qiostheme.mm35
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm6
-rw-r--r--src/plugins/platforms/ios/quiwindow.mm9
-rw-r--r--src/plugins/platforms/linuxfb/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/minimal/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/minimalegl/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/offscreen/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/qnx/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp16
-rw-r--r--src/plugins/platforms/vkkhrdisplay/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/vnc/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/wasm/CMakeLists.txt3
-rw-r--r--src/plugins/platforms/wasm/qwasmdom.cpp11
-rw-r--r--src/plugins/platforms/wasm/qwasmevent.cpp2
-rw-r--r--src/plugins/platforms/wasm/qwasmevent.h1
-rw-r--r--src/plugins/platforms/wasm/qwasmscreen.cpp12
-rw-r--r--src/plugins/platforms/wasm/qwasmwindow.cpp2
-rw-r--r--src/plugins/platforms/wasm/wasm_shell.html5
-rw-r--r--src/plugins/platforms/windows/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsmimeregistry.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.h1
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp84
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.h3
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp21
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp3
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp111
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h5
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiautomation.cpp8
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiautomation.h11
-rw-r--r--src/plugins/platforms/xcb/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp27
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.h6
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp19
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp5
-rw-r--r--src/plugins/sqldrivers/ibase/qsql_ibase.cpp140
-rw-r--r--src/plugins/styles/modernwindows/qwindows11style.cpp135
-rw-r--r--src/plugins/styles/modernwindows/qwindows11style_p.h1
-rw-r--r--src/printsupport/CMakeLists.txt4
-rw-r--r--src/printsupport/configure.cmake2
-rw-r--r--src/printsupport/dialogs/qabstractprintdialog.cpp10
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog.cpp2
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog.h2
-rw-r--r--src/printsupport/dialogs/qprintdialog.h4
-rw-r--r--src/printsupport/dialogs/qprintpreviewdialog.cpp8
-rw-r--r--src/printsupport/kernel/qprintengine.cpp15
-rw-r--r--src/printsupport/kernel/qprintengine.h3
-rw-r--r--src/printsupport/widgets/qprintpreviewwidget.cpp2
-rw-r--r--src/sql/kernel/qsqldatabase.cpp4
-rw-r--r--src/sql/kernel/qsqldatabase.h4
-rw-r--r--src/sql/kernel/qsqlrecord.cpp47
-rw-r--r--src/sql/models/qsqlquerymodel.cpp7
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.cpp18
-rw-r--r--src/sql/models/qsqltablemodel.cpp33
-rw-r--r--src/sql/models/qsqltablemodel_p.h6
-rw-r--r--src/testlib/qsignalspy.cpp7
-rw-r--r--src/testlib/qsignalspy.h5
-rw-r--r--src/testlib/qtestaccessible.h11
-rw-r--r--src/testlib/qtestcase.cpp25
-rw-r--r--src/testlib/qtestcase.h1
-rw-r--r--src/testlib/qtestevent.h15
-rw-r--r--src/testlib/qtestlog.cpp5
-rw-r--r--src/testlib/qtestlog_p.h1
-rw-r--r--src/tools/androiddeployqt/main.cpp745
-rw-r--r--src/tools/moc/main.cpp69
-rw-r--r--src/tools/qlalr/cppgenerator.cpp5
-rw-r--r--src/tools/rcc/rcc.cpp18
-rw-r--r--src/tools/rcc/rcc.h4
-rw-r--r--src/tools/syncqt/CMakeLists.txt2
-rw-r--r--src/tools/syncqt/main.cpp15
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp2
-rw-r--r--src/tools/uic/ui4.cpp3
-rw-r--r--src/tools/uic/uic.cpp4
-rw-r--r--src/tools/windeployqt/main.cpp22
-rw-r--r--src/widgets/Qt6WidgetsMacros.cmake290
-rw-r--r--src/widgets/doc/snippets/cmake-macros/examples.cmake27
-rw-r--r--src/widgets/doc/snippets/cmake-macros/examples.cpp26
-rw-r--r--src/widgets/doc/src/cmake-macros.qdoc133
-rw-r--r--src/widgets/itemviews/qtreeview.cpp45
-rw-r--r--src/widgets/kernel/qapplication.cpp86
-rw-r--r--src/widgets/kernel/qapplication_p.h2
-rw-r--r--src/widgets/kernel/qwidget.cpp227
-rw-r--r--src/widgets/kernel/qwidgetrepaintmanager.cpp79
-rw-r--r--src/widgets/kernel/qwidgetrepaintmanager_p.h4
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp80
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp2
-rw-r--r--src/widgets/styles/images/standardbutton-apply-128.pngbin5395 -> 5298 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-apply-16.pngbin611 -> 567 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-apply-32.pngbin1279 -> 1219 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-no-128.pngbin6520 -> 6437 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-no-16.pngbin701 -> 673 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-no-32.pngbin1445 -> 1476 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-ok-128.pngbin4232 -> 4414 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-yes-128.pngbin6554 -> 6484 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-yes-16.pngbin687 -> 661 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-yes-32.pngbin1504 -> 1529 bytes
-rw-r--r--src/widgets/styles/qcommonstyle.cpp58
-rw-r--r--src/widgets/styles/qfusionstyle.cpp2
-rw-r--r--src/widgets/styles/qstylehelper.cpp2
-rw-r--r--src/widgets/util/qcompleter.cpp1
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp17
-rw-r--r--src/widgets/widgets/qcheckbox.cpp5
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp18
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h2
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp58
-rw-r--r--src/widgets/widgets/qdialogbuttonbox_p.h5
-rw-r--r--src/widgets/widgets/qdockwidget.cpp56
-rw-r--r--src/widgets/widgets/qdockwidget_p.h1
-rw-r--r--src/widgets/widgets/qframe.cpp6
-rw-r--r--src/widgets/widgets/qlineedit.cpp7
523 files changed, 20509 insertions, 9049 deletions
diff --git a/src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.properties b/src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.properties
index ac72c34e8a..b82aa23a4f 100644
--- a/src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.properties
+++ b/src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/src/3rdparty/gradle/qt_attribution.json b/src/3rdparty/gradle/qt_attribution.json
index 8e759c8877..bbb069c2fb 100644
--- a/src/3rdparty/gradle/qt_attribution.json
+++ b/src/3rdparty/gradle/qt_attribution.json
@@ -4,11 +4,11 @@
"QDocModule": "qtcore",
"QtParts": ["tools"],
"Homepage": "https://gradle.org",
- "Version": "8.3",
- "DownloadLocation": "https://github.com/gradle/gradle/releases/tag/v8.3.0",
+ "Version": "8.7",
+ "DownloadLocation": "https://github.com/gradle/gradle/releases/tag/v8.7.0",
"QtUsage": "Needed to create Android packages",
"License": "Apache License 2.0",
"LicenseId": "Apache-2.0",
"LicenseFile": "LICENSE",
- "Copyright": "Copyright (C) 2023 Gradle Inc."
+ "Copyright": "Copyright (C) 2024 Gradle Inc."
}
diff --git a/src/3rdparty/harfbuzz-ng/import_from_tarball.sh b/src/3rdparty/harfbuzz-ng/import_from_tarball.sh
index 00d069fd79..717383e0b6 100644
--- a/src/3rdparty/harfbuzz-ng/import_from_tarball.sh
+++ b/src/3rdparty/harfbuzz-ng/import_from_tarball.sh
@@ -6,9 +6,10 @@
# This is a small script to copy the required files from a harfbuzz tarball
# into 3rdparty/harfbuzz-ng/ . Documentation, tests, demos etc. are not imported.
# Steps:
-# 1. rm $QTDIR/src/3rdparty/harfbuzz-ng/src/* && rm $QTDIR/src/3rdparty/harfbuzz-ng/src/OT/Layout/GSUB
+# 1. rm -rf $QTDIR/src/3rdparty/harfbuzz-ng/src/ && mkdir src
# 2. source import_from_tarball.sh harfbuzz_tarball_dir/ $QTDIR/src/3rdparty/harfbuzz-ng/
-# 3. Check that CMakeLists contains everything
+# 3. If there are new files, check if they need to be added (just source files and no test stuff)
+# 4. Check that CMakeLists contains everything new
if [ $# -ne 2 ]; then
echo "Usage: $0 harfbuzz_tarball_dir/ \$QTDIR/src/3rdparty/harfbuzz-ng/"
diff --git a/src/3rdparty/harfbuzz-ng/qt_attribution.json b/src/3rdparty/harfbuzz-ng/qt_attribution.json
index 8b862c418a..6762b22093 100644
--- a/src/3rdparty/harfbuzz-ng/qt_attribution.json
+++ b/src/3rdparty/harfbuzz-ng/qt_attribution.json
@@ -7,8 +7,8 @@
"Description": "HarfBuzz is an OpenType text shaping engine.",
"Homepage": "http://harfbuzz.org",
- "Version": "8.4.0",
- "DownloadLocation": "https://github.com/harfbuzz/harfbuzz/releases/tag/8.4.0",
+ "Version": "8.5.0",
+ "DownloadLocation": "https://github.com/harfbuzz/harfbuzz/releases/tag/8.5.0",
"License": "MIT License",
"LicenseId": "MIT",
diff --git a/src/3rdparty/harfbuzz-ng/src/OT/Color/COLR/COLR.hh b/src/3rdparty/harfbuzz-ng/src/OT/Color/COLR/COLR.hh
index 623775a771..835d87f8c6 100644
--- a/src/3rdparty/harfbuzz-ng/src/OT/Color/COLR/COLR.hh
+++ b/src/3rdparty/harfbuzz-ng/src/OT/Color/COLR/COLR.hh
@@ -159,23 +159,35 @@ struct hb_colrv1_closure_context_t :
void add_palette_index (unsigned palette_index)
{ palette_indices->add (palette_index); }
+ void add_var_idxes (unsigned first_var_idx, unsigned num_idxes)
+ {
+ if (!num_idxes || first_var_idx == VarIdx::NO_VARIATION) return;
+ variation_indices->add_range (first_var_idx, first_var_idx + num_idxes - 1);
+ }
+
public:
const void *base;
hb_set_t visited_paint;
hb_set_t *glyphs;
hb_set_t *layer_indices;
hb_set_t *palette_indices;
+ hb_set_t *variation_indices;
+ unsigned num_var_idxes;
unsigned nesting_level_left;
hb_colrv1_closure_context_t (const void *base_,
hb_set_t *glyphs_,
hb_set_t *layer_indices_,
hb_set_t *palette_indices_,
+ hb_set_t *variation_indices_,
+ unsigned num_var_idxes_ = 1,
unsigned nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
base (base_),
glyphs (glyphs_),
layer_indices (layer_indices_),
palette_indices (palette_indices_),
+ variation_indices (variation_indices_),
+ num_var_idxes (num_var_idxes_),
nesting_level_left (nesting_level_left_)
{}
};
@@ -242,7 +254,12 @@ struct Variable
}
void closurev1 (hb_colrv1_closure_context_t* c) const
- { value.closurev1 (c); }
+ {
+ c->num_var_idxes = 0;
+ // update c->num_var_idxes during value closure
+ value.closurev1 (c);
+ c->add_var_idxes (varIdxBase, c->num_var_idxes);
+ }
bool subset (hb_subset_context_t *c,
const ItemVarStoreInstancer &instancer) const
@@ -252,8 +269,18 @@ struct Variable
if (c->plan->all_axes_pinned)
return_trace (true);
- //TODO: update varIdxBase for partial-instancing
- return_trace (c->serializer->embed (varIdxBase));
+ VarIdx new_varidx;
+ new_varidx = varIdxBase;
+ if (varIdxBase != VarIdx::NO_VARIATION)
+ {
+ hb_pair_t<unsigned, int> *new_varidx_delta;
+ if (!c->plan->colrv1_variation_idx_delta_map.has (varIdxBase, &new_varidx_delta))
+ return_trace (false);
+
+ new_varidx = hb_first (*new_varidx_delta);
+ }
+
+ return_trace (c->serializer->embed (new_varidx));
}
bool sanitize (hb_sanitize_context_t *c) const
@@ -345,7 +372,10 @@ struct NoVariable
struct ColorStop
{
void closurev1 (hb_colrv1_closure_context_t* c) const
- { c->add_palette_index (paletteIndex); }
+ {
+ c->add_palette_index (paletteIndex);
+ c->num_var_idxes = 2;
+ }
bool subset (hb_subset_context_t *c,
const ItemVarStoreInstancer &instancer,
@@ -542,6 +572,9 @@ struct Affine2x3
return_trace (c->check_struct (this));
}
+ void closurev1 (hb_colrv1_closure_context_t* c) const
+ { c->num_var_idxes = 6; }
+
bool subset (hb_subset_context_t *c,
const ItemVarStoreInstancer &instancer,
uint32_t varIdxBase) const
@@ -617,7 +650,10 @@ struct PaintColrLayers
struct PaintSolid
{
void closurev1 (hb_colrv1_closure_context_t* c) const
- { c->add_palette_index (paletteIndex); }
+ {
+ c->add_palette_index (paletteIndex);
+ c->num_var_idxes = 1;
+ }
bool subset (hb_subset_context_t *c,
const ItemVarStoreInstancer &instancer,
@@ -666,7 +702,10 @@ template <template<typename> class Var>
struct PaintLinearGradient
{
void closurev1 (hb_colrv1_closure_context_t* c) const
- { (this+colorLine).closurev1 (c); }
+ {
+ (this+colorLine).closurev1 (c);
+ c->num_var_idxes = 6;
+ }
bool subset (hb_subset_context_t *c,
const ItemVarStoreInstancer &instancer,
@@ -733,7 +772,10 @@ template <template<typename> class Var>
struct PaintRadialGradient
{
void closurev1 (hb_colrv1_closure_context_t* c) const
- { (this+colorLine).closurev1 (c); }
+ {
+ (this+colorLine).closurev1 (c);
+ c->num_var_idxes = 6;
+ }
bool subset (hb_subset_context_t *c,
const ItemVarStoreInstancer &instancer,
@@ -800,7 +842,10 @@ template <template<typename> class Var>
struct PaintSweepGradient
{
void closurev1 (hb_colrv1_closure_context_t* c) const
- { (this+colorLine).closurev1 (c); }
+ {
+ (this+colorLine).closurev1 (c);
+ c->num_var_idxes = 4;
+ }
bool subset (hb_subset_context_t *c,
const ItemVarStoreInstancer &instancer,
@@ -1544,6 +1589,9 @@ struct ClipBoxFormat2 : Variable<ClipBoxFormat1>
clip_box.yMax += roundf (instancer (varIdxBase, 3));
}
}
+
+ void closurev1 (hb_colrv1_closure_context_t* c) const
+ { c->variation_indices->add_range (varIdxBase, varIdxBase + 3); }
};
struct ClipBox
@@ -1559,6 +1607,14 @@ struct ClipBox
}
}
+ void closurev1 (hb_colrv1_closure_context_t* c) const
+ {
+ switch (u.format) {
+ case 2: u.format2.closurev1 (c);
+ default:return;
+ }
+ }
+
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
@@ -1606,6 +1662,12 @@ struct ClipRecord
int cmp (hb_codepoint_t g) const
{ return g < startGlyphID ? -1 : g <= endGlyphID ? 0 : +1; }
+ void closurev1 (hb_colrv1_closure_context_t* c, const void *base) const
+ {
+ if (!c->glyphs->intersects (startGlyphID, endGlyphID)) return;
+ (base+clipBox).closurev1 (c);
+ }
+
bool subset (hb_subset_context_t *c,
const void *base,
const ItemVarStoreInstancer &instancer) const
@@ -1941,6 +2003,76 @@ struct LayerList : Array32OfOffset32To<Paint>
}
};
+struct delta_set_index_map_subset_plan_t
+{
+ unsigned get_inner_bit_count () const { return inner_bit_count; }
+ unsigned get_width () const { return ((outer_bit_count + inner_bit_count + 7) / 8); }
+ hb_array_t<const uint32_t> get_output_map () const { return output_map.as_array (); }
+
+ delta_set_index_map_subset_plan_t (const hb_map_t &new_deltaset_idx_varidx_map)
+ {
+ map_count = 0;
+ outer_bit_count = 0;
+ inner_bit_count = 1;
+ output_map.init ();
+
+ /* search backwards */
+ unsigned count = new_deltaset_idx_varidx_map.get_population ();
+ if (!count) return;
+
+ unsigned last_idx = (unsigned)-1;
+ unsigned last_varidx = (unsigned)-1;
+
+ for (unsigned i = count; i; i--)
+ {
+ unsigned delta_set_idx = i - 1;
+ unsigned var_idx = new_deltaset_idx_varidx_map.get (delta_set_idx);
+ if (i == count)
+ {
+ last_idx = delta_set_idx;
+ last_varidx = var_idx;
+ continue;
+ }
+ if (var_idx != last_varidx)
+ break;
+ last_idx = delta_set_idx;
+ }
+
+ map_count = last_idx + 1;
+ }
+
+ bool remap (const hb_map_t &new_deltaset_idx_varidx_map)
+ {
+ /* recalculate bit_count */
+ outer_bit_count = 1;
+ inner_bit_count = 1;
+
+ if (unlikely (!output_map.resize (map_count, false))) return false;
+
+ for (unsigned idx = 0; idx < map_count; idx++)
+ {
+ uint32_t *var_idx;
+ if (!new_deltaset_idx_varidx_map.has (idx, &var_idx)) return false;
+ output_map.arrayZ[idx] = *var_idx;
+
+ unsigned outer = (*var_idx) >> 16;
+ unsigned bit_count = (outer == 0) ? 1 : hb_bit_storage (outer);
+ outer_bit_count = hb_max (bit_count, outer_bit_count);
+
+ unsigned inner = (*var_idx) & 0xFFFF;
+ bit_count = (inner == 0) ? 1 : hb_bit_storage (inner);
+ inner_bit_count = hb_max (bit_count, inner_bit_count);
+ }
+ return true;
+ }
+
+ private:
+ unsigned map_count;
+ unsigned outer_bit_count;
+ unsigned inner_bit_count;
+ hb_vector_t<uint32_t> output_map;
+};
+
struct COLR
{
static constexpr hb_tag_t tableTag = HB_OT_TAG_COLR;
@@ -1992,8 +2124,22 @@ struct COLR
void closure_forV1 (hb_set_t *glyphset,
hb_set_t *layer_indices,
- hb_set_t *palette_indices) const
- { colr->closure_forV1 (glyphset, layer_indices, palette_indices); }
+ hb_set_t *palette_indices,
+ hb_set_t *variation_indices,
+ hb_set_t *delta_set_indices) const
+ { colr->closure_forV1 (glyphset, layer_indices, palette_indices, variation_indices, delta_set_indices); }
+
+ bool has_var_store () const
+ { return colr->has_var_store (); }
+
+ const ItemVariationStore &get_var_store () const
+ { return colr->get_var_store (); }
+
+ bool has_delta_set_index_map () const
+ { return colr->has_delta_set_index_map (); }
+
+ const DeltaSetIndexMap &get_delta_set_index_map () const
+ { return colr->get_delta_set_index_map (); }
private:
hb_blob_ptr_t<COLR> colr;
@@ -2030,14 +2176,16 @@ struct COLR
void closure_forV1 (hb_set_t *glyphset,
hb_set_t *layer_indices,
- hb_set_t *palette_indices) const
+ hb_set_t *palette_indices,
+ hb_set_t *variation_indices,
+ hb_set_t *delta_set_indices) const
{
if (version != 1) return;
hb_barrier ();
hb_set_t visited_glyphs;
- hb_colrv1_closure_context_t c (this, &visited_glyphs, layer_indices, palette_indices);
+ hb_colrv1_closure_context_t c (this, &visited_glyphs, layer_indices, palette_indices, variation_indices);
const BaseGlyphList &baseglyph_paintrecords = this+baseGlyphList;
for (const BaseGlyphPaintRecord &baseglyph_paintrecord: baseglyph_paintrecords.iter ())
@@ -2049,6 +2197,22 @@ struct COLR
paint.dispatch (&c);
}
hb_set_union (glyphset, &visited_glyphs);
+
+ const ClipList &cliplist = this+clipList;
+ c.glyphs = glyphset;
+ for (const ClipRecord &clip_record : cliplist.clips.iter())
+ clip_record.closurev1 (&c, &cliplist);
+
+ // if a DeltaSetIndexMap is included, collected variation indices are
+ // actually delta set indices, we need to map them into variation indices
+ if (has_delta_set_index_map ())
+ {
+ const DeltaSetIndexMap &var_idx_map = this+varIdxMap;
+ delta_set_indices->set (*variation_indices);
+ variation_indices->clear ();
+ for (unsigned delta_set_idx : *delta_set_indices)
+ variation_indices->add (var_idx_map.map (delta_set_idx));
+ }
}
const LayerList& get_layerList () const
@@ -2057,6 +2221,18 @@ struct COLR
const BaseGlyphList& get_baseglyphList () const
{ return (this+baseGlyphList); }
+ bool has_var_store () const
+ { return version >= 1 && varStore != 0; }
+
+ bool has_delta_set_index_map () const
+ { return version >= 1 && varIdxMap != 0; }
+
+ const DeltaSetIndexMap &get_delta_set_index_map () const
+ { return (version == 0 || varIdxMap == 0) ? Null (DeltaSetIndexMap) : this+varIdxMap; }
+
+ const ItemVariationStore &get_var_store () const
+ { return (version == 0 || varStore == 0) ? Null (ItemVariationStore) : this+varStore; }
+
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -2132,6 +2308,88 @@ struct COLR
return record;
}
+ bool downgrade_to_V0 (const hb_set_t &glyphset) const
+ {
+ //no more COLRv1 glyphs, downgrade to version 0
+ for (const BaseGlyphPaintRecord& _ : get_baseglyphList ())
+ if (glyphset.has (_.glyphId))
+ return false;
+
+ return true;
+ }
+
+ bool subset_varstore (hb_subset_context_t *c,
+ COLR* out /* OUT */) const
+ {
+ TRACE_SUBSET (this);
+ if (!varStore || c->plan->all_axes_pinned ||
+ !c->plan->colrv1_variation_idx_delta_map)
+ return_trace (true);
+
+ const ItemVariationStore& var_store = this+varStore;
+ if (c->plan->normalized_coords)
+ {
+ item_variations_t item_vars;
+ /* turn off varstore optimization when varIdxMap is null, so we maintain
+ * original var_idx sequence */
+ bool optimize = (varIdxMap != 0) ? true : false;
+ if (!item_vars.instantiate (var_store, c->plan,
+ optimize, /* optimization */
+ optimize, /* use_no_variation_idx = false */
+ c->plan->colrv1_varstore_inner_maps.as_array ()))
+ return_trace (false);
+
+ if (!out->varStore.serialize_serialize (c->serializer,
+ item_vars.has_long_word (),
+ c->plan->axis_tags,
+ item_vars.get_region_list (),
+ item_vars.get_vardata_encodings ()))
+ return_trace (false);
+
+ /* if varstore is optimized, update colrv1_new_deltaset_idx_varidx_map in
+ * subset plan */
+ if (optimize)
+ {
+ const hb_map_t &varidx_map = item_vars.get_varidx_map ();
+ for (auto _ : c->plan->colrv1_new_deltaset_idx_varidx_map.iter_ref ())
+ {
+ uint32_t varidx = _.second;
+ uint32_t *new_varidx;
+ if (varidx_map.has (varidx, &new_varidx))
+ _.second = *new_varidx;
+ else
+ _.second = VarIdx::NO_VARIATION;
+ }
+ }
+ }
+ else
+ {
+ if (unlikely (!out->varStore.serialize_serialize (c->serializer,
+ &var_store,
+ c->plan->colrv1_varstore_inner_maps.as_array ())))
+ return_trace (false);
+ }
+
+ return_trace (true);
+ }
+
+ bool subset_delta_set_index_map (hb_subset_context_t *c,
+ COLR* out /* OUT */) const
+ {
+ TRACE_SUBSET (this);
+ if (!varIdxMap || c->plan->all_axes_pinned ||
+ !c->plan->colrv1_new_deltaset_idx_varidx_map)
+ return_trace (true);
+
+ const hb_map_t &deltaset_idx_varidx_map = c->plan->colrv1_new_deltaset_idx_varidx_map;
+ delta_set_index_map_subset_plan_t index_map_plan (deltaset_idx_varidx_map);
+
+ if (unlikely (!index_map_plan.remap (deltaset_idx_varidx_map)))
+ return_trace (false);
+
+ return_trace (out->varIdxMap.serialize_serialize (c->serializer, index_map_plan));
+ }
+
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
@@ -2200,34 +2458,28 @@ struct COLR
auto *colr_prime = c->serializer->start_embed<COLR> ();
if (unlikely (!c->serializer->extend_min (colr_prime))) return_trace (false);
- if (version == 0)
- return_trace (colr_prime->serialize_V0 (c->serializer, version, base_it, layer_it));
+ if (version == 0 || downgrade_to_V0 (glyphset))
+ return_trace (colr_prime->serialize_V0 (c->serializer, 0, base_it, layer_it));
- auto snap = c->serializer->snapshot ();
+ //start version 1
if (!c->serializer->allocate_size<void> (5 * HBUINT32::static_size)) return_trace (false);
+ if (!colr_prime->serialize_V0 (c->serializer, version, base_it, layer_it)) return_trace (false);
+
+ /* subset ItemVariationStore first, cause varidx_map needs to be updated
+ * after instancing */
+ if (!subset_varstore (c, colr_prime)) return_trace (false);
ItemVarStoreInstancer instancer (varStore ? &(this+varStore) : nullptr,
varIdxMap ? &(this+varIdxMap) : nullptr,
c->plan->normalized_coords.as_array ());
if (!colr_prime->baseGlyphList.serialize_subset (c, baseGlyphList, this, instancer))
- {
- if (c->serializer->in_error ()) return_trace (false);
- //no more COLRv1 glyphs: downgrade to version 0
- c->serializer->revert (snap);
- return_trace (colr_prime->serialize_V0 (c->serializer, 0, base_it, layer_it));
- }
-
- if (!colr_prime->serialize_V0 (c->serializer, version, base_it, layer_it)) return_trace (false);
+ return_trace (false);
colr_prime->layerList.serialize_subset (c, layerList, this, instancer);
colr_prime->clipList.serialize_subset (c, clipList, this, instancer);
- if (!varStore || c->plan->all_axes_pinned)
- return_trace (true);
- colr_prime->varIdxMap.serialize_copy (c->serializer, varIdxMap, this);
- colr_prime->varStore.serialize_copy (c->serializer, varStore, this);
- return_trace (true);
+ return_trace (subset_delta_set_index_map (c, colr_prime));
}
const Paint *get_base_glyph_paint (hb_codepoint_t glyph) const
diff --git a/src/3rdparty/harfbuzz-ng/src/OT/Color/COLR/colrv1-closure.hh b/src/3rdparty/harfbuzz-ng/src/OT/Color/COLR/colrv1-closure.hh
index 705863d4ad..9ed0aa5632 100644
--- a/src/3rdparty/harfbuzz-ng/src/OT/Color/COLR/colrv1-closure.hh
+++ b/src/3rdparty/harfbuzz-ng/src/OT/Color/COLR/colrv1-closure.hh
@@ -66,34 +66,64 @@ HB_INTERNAL void PaintColrGlyph::closurev1 (hb_colrv1_closure_context_t* c) cons
template <template<typename> class Var>
HB_INTERNAL void PaintTransform<Var>::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+ (this+src).dispatch (c);
+ (this+transform).closurev1 (c);
+}
HB_INTERNAL void PaintTranslate::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+ (this+src).dispatch (c);
+ c->num_var_idxes = 2;
+}
HB_INTERNAL void PaintScale::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+ (this+src).dispatch (c);
+ c->num_var_idxes = 2;
+}
HB_INTERNAL void PaintScaleAroundCenter::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+ (this+src).dispatch (c);
+ c->num_var_idxes = 4;
+}
HB_INTERNAL void PaintScaleUniform::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+ (this+src).dispatch (c);
+ c->num_var_idxes = 1;
+}
HB_INTERNAL void PaintScaleUniformAroundCenter::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+ (this+src).dispatch (c);
+ c->num_var_idxes = 3;
+}
HB_INTERNAL void PaintRotate::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+ (this+src).dispatch (c);
+ c->num_var_idxes = 1;
+}
HB_INTERNAL void PaintRotateAroundCenter::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+ (this+src).dispatch (c);
+ c->num_var_idxes = 3;
+}
HB_INTERNAL void PaintSkew::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+ (this+src).dispatch (c);
+ c->num_var_idxes = 2;
+}
HB_INTERNAL void PaintSkewAroundCenter::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+ (this+src).dispatch (c);
+ c->num_var_idxes = 4;
+}
HB_INTERNAL void PaintComposite::closurev1 (hb_colrv1_closure_context_t* c) const
{
diff --git a/src/3rdparty/harfbuzz-ng/src/OT/Layout/GDEF/GDEF.hh b/src/3rdparty/harfbuzz-ng/src/OT/Layout/GDEF/GDEF.hh
index 317b96c714..45baeb4ec5 100644
--- a/src/3rdparty/harfbuzz-ng/src/OT/Layout/GDEF/GDEF.hh
+++ b/src/3rdparty/harfbuzz-ng/src/OT/Layout/GDEF/GDEF.hh
@@ -1022,47 +1022,6 @@ struct GDEF
void collect_variation_indices (hb_collect_variation_indices_context_t *c) const
{ get_lig_caret_list ().collect_variation_indices (c); }
- void remap_layout_variation_indices (const hb_set_t *layout_variation_indices,
- const hb_vector_t<int>& normalized_coords,
- bool calculate_delta, /* not pinned at default */
- bool no_variations, /* all axes pinned */
- hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> *layout_variation_idx_delta_map /* OUT */) const
- {
- if (!has_var_store ()) return;
- const ItemVariationStore &var_store = get_var_store ();
- float *store_cache = var_store.create_cache ();
-
- unsigned new_major = 0, new_minor = 0;
- unsigned last_major = (layout_variation_indices->get_min ()) >> 16;
- for (unsigned idx : layout_variation_indices->iter ())
- {
- int delta = 0;
- if (calculate_delta)
- delta = roundf (var_store.get_delta (idx, normalized_coords.arrayZ,
- normalized_coords.length, store_cache));
-
- if (no_variations)
- {
- layout_variation_idx_delta_map->set (idx, hb_pair_t<unsigned, int> (HB_OT_LAYOUT_NO_VARIATIONS_INDEX, delta));
- continue;
- }
-
- uint16_t major = idx >> 16;
- if (major >= var_store.get_sub_table_count ()) break;
- if (major != last_major)
- {
- new_minor = 0;
- ++new_major;
- }
-
- unsigned new_idx = (new_major << 16) + new_minor;
- layout_variation_idx_delta_map->set (idx, hb_pair_t<unsigned, int> (new_idx, delta));
- ++new_minor;
- last_major = major;
- }
- var_store.destroy_cache (store_cache);
- }
-
protected:
union {
FixedVersion<> version; /* Version identifier */
diff --git a/src/3rdparty/harfbuzz-ng/src/OT/Layout/GSUB/Ligature.hh b/src/3rdparty/harfbuzz-ng/src/OT/Layout/GSUB/Ligature.hh
index 402ed12ae2..e0ec82a236 100644
--- a/src/3rdparty/harfbuzz-ng/src/OT/Layout/GSUB/Ligature.hh
+++ b/src/3rdparty/harfbuzz-ng/src/OT/Layout/GSUB/Ligature.hh
@@ -90,8 +90,17 @@ struct Ligature
unsigned int total_component_count = 0;
+ if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return false;
+ unsigned match_positions_stack[4];
+ unsigned *match_positions = match_positions_stack;
+ if (unlikely (count > ARRAY_LENGTH (match_positions_stack)))
+ {
+ match_positions = (unsigned *) hb_malloc (hb_max (count, 1u) * sizeof (unsigned));
+ if (unlikely (!match_positions))
+ return_trace (false);
+ }
+
unsigned int match_end = 0;
- unsigned int match_positions[HB_MAX_CONTEXT_LENGTH];
if (likely (!match_input (c, count,
&component[1],
@@ -102,6 +111,8 @@ struct Ligature
&total_component_count)))
{
c->buffer->unsafe_to_concat (c->buffer->idx, match_end);
+ if (match_positions != match_positions_stack)
+ hb_free (match_positions);
return_trace (false);
}
@@ -145,6 +156,8 @@ struct Ligature
pos);
}
+ if (match_positions != match_positions_stack)
+ hb_free (match_positions);
return_trace (true);
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-aat-layout-common.hh b/src/3rdparty/harfbuzz-ng/src/hb-aat-layout-common.hh
index 05dd58c6df..c26f376aa6 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-aat-layout-common.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-aat-layout-common.hh
@@ -46,8 +46,9 @@ struct hb_aat_apply_context_t :
hb_dispatch_context_t<hb_aat_apply_context_t, bool, HB_DEBUG_APPLY>
{
const char *get_name () { return "APPLY"; }
- template <typename T>
- return_t dispatch (const T &obj) { return obj.apply (this); }
+ template <typename T, typename ...Ts>
+ return_t dispatch (const T &obj, Ts&&... ds)
+ { return obj.apply (this, std::forward<Ts> (ds)...); }
static return_t default_return_value () { return false; }
bool stop_sublookup_iteration (return_t r) const { return r; }
@@ -59,6 +60,9 @@ struct hb_aat_apply_context_t :
const ankr *ankr_table;
const OT::GDEF *gdef_table;
const hb_sorted_vector_t<hb_aat_map_t::range_flags_t> *range_flags = nullptr;
+ hb_set_digest_t machine_glyph_set = hb_set_digest_t::full ();
+ hb_set_digest_t left_set = hb_set_digest_t::full ();
+ hb_set_digest_t right_set = hb_set_digest_t::full ();
hb_mask_t subtable_flags = 0;
/* Unused. For debug tracing only. */
@@ -81,6 +85,8 @@ struct hb_aat_apply_context_t :
* Lookup Table
*/
+enum { DELETED_GLYPH = 0xFFFF };
+
template <typename T> struct Lookup;
template <typename T>
@@ -95,6 +101,12 @@ struct LookupFormat0
return &arrayZ[glyph_id];
}
+ template <typename set_t>
+ void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const
+ {
+ glyphs.add_range (0, num_glyphs - 1);
+ }
+
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -123,6 +135,14 @@ struct LookupSegmentSingle
int cmp (hb_codepoint_t g) const
{ return g < first ? -1 : g <= last ? 0 : +1 ; }
+ template <typename set_t>
+ void collect_glyphs (set_t &glyphs) const
+ {
+ if (first == DELETED_GLYPH)
+ return;
+ glyphs.add_range (first, last);
+ }
+
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -153,6 +173,14 @@ struct LookupFormat2
return v ? &v->value : nullptr;
}
+ template <typename set_t>
+ void collect_glyphs (set_t &glyphs) const
+ {
+ unsigned count = segments.get_length ();
+ for (unsigned int i = 0; i < count; i++)
+ segments[i].collect_glyphs (glyphs);
+ }
+
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -184,6 +212,14 @@ struct LookupSegmentArray
return first <= glyph_id && glyph_id <= last ? &(base+valuesZ)[glyph_id - first] : nullptr;
}
+ template <typename set_t>
+ void collect_glyphs (set_t &glyphs) const
+ {
+ if (first == DELETED_GLYPH)
+ return;
+ glyphs.add_range (first, last);
+ }
+
int cmp (hb_codepoint_t g) const
{ return g < first ? -1 : g <= last ? 0 : +1; }
@@ -226,6 +262,14 @@ struct LookupFormat4
return v ? v->get_value (glyph_id, this) : nullptr;
}
+ template <typename set_t>
+ void collect_glyphs (set_t &glyphs) const
+ {
+ unsigned count = segments.get_length ();
+ for (unsigned i = 0; i < count; i++)
+ segments[i].collect_glyphs (glyphs);
+ }
+
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -254,6 +298,14 @@ struct LookupSingle
int cmp (hb_codepoint_t g) const { return glyph.cmp (g); }
+ template <typename set_t>
+ void collect_glyphs (set_t &glyphs) const
+ {
+ if (glyph == DELETED_GLYPH)
+ return;
+ glyphs.add (glyph);
+ }
+
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -283,6 +335,14 @@ struct LookupFormat6
return v ? &v->value : nullptr;
}
+ template <typename set_t>
+ void collect_glyphs (set_t &glyphs) const
+ {
+ unsigned count = entries.get_length ();
+ for (unsigned i = 0; i < count; i++)
+ entries[i].collect_glyphs (glyphs);
+ }
+
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -314,6 +374,16 @@ struct LookupFormat8
&valueArrayZ[glyph_id - firstGlyph] : nullptr;
}
+ template <typename set_t>
+ void collect_glyphs (set_t &glyphs) const
+ {
+ if (unlikely (!glyphCount))
+ return;
+ if (firstGlyph == DELETED_GLYPH)
+ return;
+ glyphs.add_range (firstGlyph, firstGlyph + glyphCount - 1);
+ }
+
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -358,6 +428,16 @@ struct LookupFormat10
return v;
}
+ template <typename set_t>
+ void collect_glyphs (set_t &glyphs) const
+ {
+ if (unlikely (!glyphCount))
+ return;
+ if (firstGlyph == DELETED_GLYPH)
+ return;
+ glyphs.add_range (firstGlyph, firstGlyph + glyphCount - 1);
+ }
+
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -406,6 +486,20 @@ struct Lookup
}
}
+ template <typename set_t>
+ void collect_glyphs (set_t &glyphs, unsigned int num_glyphs) const
+ {
+ switch (u.format) {
+ case 0: u.format0.collect_glyphs (glyphs, num_glyphs); return;
+ case 2: u.format2.collect_glyphs (glyphs); return;
+ case 4: u.format4.collect_glyphs (glyphs); return;
+ case 6: u.format6.collect_glyphs (glyphs); return;
+ case 8: u.format8.collect_glyphs (glyphs); return;
+ case 10: u.format10.collect_glyphs (glyphs); return;
+ default:return;
+ }
+ }
+
typename T::type get_class (hb_codepoint_t glyph_id,
unsigned int num_glyphs,
unsigned int outOfRange) const
@@ -460,8 +554,6 @@ struct Lookup
};
DECLARE_NULL_NAMESPACE_BYTES_TEMPLATE1 (AAT, Lookup, 2);
-enum { DELETED_GLYPH = 0xFFFF };
-
/*
* (Extended) State Table
*/
@@ -512,6 +604,14 @@ struct Entry<void>
DEFINE_SIZE_STATIC (4);
};
+enum Class
+{
+ CLASS_END_OF_TEXT = 0,
+ CLASS_OUT_OF_BOUNDS = 1,
+ CLASS_DELETED_GLYPH = 2,
+ CLASS_END_OF_LINE = 3,
+};
+
template <typename Types, typename Extra>
struct StateTable
{
@@ -524,21 +624,24 @@ struct StateTable
STATE_START_OF_TEXT = 0,
STATE_START_OF_LINE = 1,
};
- enum Class
+
+ template <typename set_t>
+ void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const
{
- CLASS_END_OF_TEXT = 0,
- CLASS_OUT_OF_BOUNDS = 1,
- CLASS_DELETED_GLYPH = 2,
- CLASS_END_OF_LINE = 3,
- };
+ (this+classTable).collect_glyphs (glyphs, num_glyphs);
+ }
int new_state (unsigned int newState) const
{ return Types::extended ? newState : ((int) newState - (int) stateArrayTable) / (int) nClasses; }
- unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
+ template <typename set_t>
+ unsigned int get_class (hb_codepoint_t glyph_id,
+ unsigned int num_glyphs,
+ const set_t &glyphs) const
{
if (unlikely (glyph_id == DELETED_GLYPH)) return CLASS_DELETED_GLYPH;
- return (this+classTable).get_class (glyph_id, num_glyphs, 1);
+ if (!glyphs[glyph_id]) return CLASS_OUT_OF_BOUNDS;
+ return (this+classTable).get_class (glyph_id, num_glyphs, CLASS_OUT_OF_BOUNDS);
}
const Entry<Extra> *get_entries () const
@@ -547,7 +650,7 @@ struct StateTable
const Entry<Extra> &get_entry (int state, unsigned int klass) const
{
if (unlikely (klass >= nClasses))
- klass = StateTable::CLASS_OUT_OF_BOUNDS;
+ klass = CLASS_OUT_OF_BOUNDS;
const HBUSHORT *states = (this+stateArrayTable).arrayZ;
const Entry<Extra> *entries = (this+entryTable).arrayZ;
@@ -690,6 +793,15 @@ struct ClassTable
{
return get_class (glyph_id, outOfRange);
}
+
+ template <typename set_t>
+ void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const
+ {
+ for (unsigned i = 0; i < classArray.len; i++)
+ if (classArray.arrayZ[i] != CLASS_OUT_OF_BOUNDS)
+ glyphs.add (firstGlyph + i);
+ }
+
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -703,6 +815,38 @@ struct ClassTable
DEFINE_SIZE_ARRAY (4, classArray);
};
+struct SubtableGlyphCoverage
+{
+ bool sanitize (hb_sanitize_context_t *c, unsigned subtable_count) const
+ {
+ TRACE_SANITIZE (this);
+
+ if (unlikely (!c->check_array (&subtableOffsets, subtable_count)))
+ return_trace (false);
+
+ unsigned bytes = (c->get_num_glyphs () + CHAR_BIT - 1) / CHAR_BIT;
+ for (unsigned i = 0; i < subtable_count; i++)
+ {
+ uint32_t offset = (uint32_t) subtableOffsets[i];
+ if (offset == 0 || offset == 0xFFFFFFFF)
+ continue;
+ if (unlikely (!subtableOffsets[i].sanitize (c, this, bytes)))
+ return_trace (false);
+ }
+
+ return_trace (true);
+ }
+ protected:
+ UnsizedArrayOf<NNOffset32To<UnsizedArrayOf<HBUINT8>>> subtableOffsets;
+ /* Array of offsets from the beginning of the
+ * subtable glyph coverage table to the glyph
+ * coverage bitfield for a given subtable; there
+ * is one offset for each subtable in the chain */
+ /* UnsizedArrayOf<HBUINT8> coverageBitfields; *//* The individual coverage bitfields. */
+ public:
+ DEFINE_SIZE_ARRAY (0, subtableOffsets);
+};
+
struct ObsoleteTypes
{
static constexpr bool extended = false;
@@ -779,15 +923,15 @@ struct StateTableDriver
using EntryT = Entry<EntryData>;
StateTableDriver (const StateTableT &machine_,
- hb_buffer_t *buffer_,
hb_face_t *face_) :
machine (machine_),
- buffer (buffer_),
num_glyphs (face_->get_num_glyphs ()) {}
- template <typename context_t>
+ template <typename context_t, typename set_t = hb_set_digest_t>
void drive (context_t *c, hb_aat_apply_context_t *ac)
{
+ hb_buffer_t *buffer = ac->buffer;
+
if (!c->in_place)
buffer->clear_output ();
@@ -822,9 +966,9 @@ struct StateTableDriver
}
}
- unsigned int klass = buffer->idx < buffer->len ?
- machine.get_class (buffer->cur().codepoint, num_glyphs) :
- (unsigned) StateTableT::CLASS_END_OF_TEXT;
+ unsigned int klass = likely (buffer->idx < buffer->len) ?
+ machine.get_class (buffer->cur().codepoint, num_glyphs, ac->machine_glyph_set) :
+ (unsigned) CLASS_END_OF_TEXT;
DEBUG_MSG (APPLY, nullptr, "c%u at %u", klass, buffer->idx);
const EntryT &entry = machine.get_entry (state, klass);
const int next_state = machine.new_state (entry.newState);
@@ -862,22 +1006,22 @@ struct StateTableDriver
{
/* 2c. */
const auto wouldbe_entry = machine.get_entry(StateTableT::STATE_START_OF_TEXT, klass);
-
+
/* 2c'. */
- if (c->is_actionable (this, wouldbe_entry))
- return false;
-
+ if (c->is_actionable (buffer, this, wouldbe_entry))
+ return false;
+
/* 2c". */
return next_state == machine.new_state(wouldbe_entry.newState)
&& (entry.flags & context_t::DontAdvance) == (wouldbe_entry.flags & context_t::DontAdvance);
};
-
+
const auto is_safe_to_break = [&]()
{
/* 1. */
- if (c->is_actionable (this, entry))
+ if (c->is_actionable (buffer, this, entry))
return false;
-
+
/* 2. */
// This one is meh, I know...
const auto ok =
@@ -886,15 +1030,15 @@ struct StateTableDriver
|| is_safe_to_break_extra();
if (!ok)
return false;
-
+
/* 3. */
- return !c->is_actionable (this, machine.get_entry (state, StateTableT::CLASS_END_OF_TEXT));
+ return !c->is_actionable (buffer, this, machine.get_entry (state, CLASS_END_OF_TEXT));
};
if (!is_safe_to_break () && buffer->backtrack_len () && buffer->idx < buffer->len)
buffer->unsafe_to_break_from_outbuffer (buffer->backtrack_len () - 1, buffer->idx + 1);
- c->transition (this, entry);
+ c->transition (buffer, this, entry);
state = next_state;
DEBUG_MSG (APPLY, nullptr, "s%d", state);
@@ -912,7 +1056,6 @@ struct StateTableDriver
public:
const StateTableT &machine;
- hb_buffer_t *buffer;
unsigned int num_glyphs;
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-aat-layout-kerx-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-aat-layout-kerx-table.hh
index 0de54e0a02..8d0d87af02 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-aat-layout-kerx-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-aat-layout-kerx-table.hh
@@ -30,6 +30,7 @@
#include "hb-kern.hh"
#include "hb-aat-layout-ankr-table.hh"
+#include "hb-set-digest.hh"
/*
* kerx -- Extended Kerning
@@ -82,7 +83,7 @@ struct KernPair
return_trace (c->check_struct (this));
}
- protected:
+ public:
HBGlyphID16 left;
HBGlyphID16 right;
FWORD value;
@@ -118,6 +119,16 @@ struct KerxSubTableFormat0
return_trace (true);
}
+ template <typename set_t>
+ void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+ {
+ for (const KernPair& pair : pairs)
+ {
+ left_set.add (pair.left);
+ right_set.add (pair.right);
+ }
+ }
+
struct accelerator_t
{
const KerxSubTableFormat0 &table;
@@ -128,7 +139,10 @@ struct KerxSubTableFormat0
table (table_), c (c_) {}
int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
- { return table.get_kerning (left, right, c); }
+ {
+ if (!c->left_set[left] || !c->right_set[right]) return 0;
+ return table.get_kerning (left, right, c);
+ }
};
@@ -228,13 +242,14 @@ struct KerxSubTableFormat1
depth (0),
crossStream (table->header.coverage & table->header.CrossStream) {}
- bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
+ bool is_actionable (hb_buffer_t *buffer HB_UNUSED,
+ StateTableDriver<Types, EntryData> *driver HB_UNUSED,
const Entry<EntryData> &entry)
{ return Format1EntryT::performAction (entry); }
- void transition (StateTableDriver<Types, EntryData> *driver,
+ void transition (hb_buffer_t *buffer,
+ StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> &entry)
{
- hb_buffer_t *buffer = driver->buffer;
unsigned int flags = entry.flags;
if (flags & Format1EntryT::Reset)
@@ -351,7 +366,7 @@ struct KerxSubTableFormat1
driver_context_t dc (this, c);
- StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->font->face);
+ StateTableDriver<Types, EntryData> driver (machine, c->font->face);
driver.drive (&dc, c);
return_trace (true);
@@ -365,12 +380,21 @@ struct KerxSubTableFormat1
machine.sanitize (c)));
}
+ template <typename set_t>
+ void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+ {
+ set_t set;
+ machine.collect_glyphs (set, num_glyphs);
+ left_set.union_ (set);
+ right_set.union_ (set);
+ }
+
protected:
KernSubTableHeader header;
StateTable<Types, EntryData> machine;
NNOffsetTo<UnsizedArrayOf<FWORD>, HBUINT> kernAction;
public:
- DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + 5 * sizeof (HBUINT));
+ DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + (StateTable<Types, EntryData>::static_size + HBUINT::static_size));
};
template <typename KernSubTableHeader>
@@ -413,6 +437,13 @@ struct KerxSubTableFormat2
return_trace (true);
}
+ template <typename set_t>
+ void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+ {
+ (this+leftClassTable).collect_glyphs (left_set, num_glyphs);
+ (this+rightClassTable).collect_glyphs (right_set, num_glyphs);
+ }
+
struct accelerator_t
{
const KerxSubTableFormat2 &table;
@@ -423,7 +454,10 @@ struct KerxSubTableFormat2
table (table_), c (c_) {}
int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
- { return table.get_kerning (left, right, c); }
+ {
+ if (!c->left_set[left] || !c->right_set[right]) return 0;
+ return table.get_kerning (left, right, c);
+ }
};
bool sanitize (hb_sanitize_context_t *c) const
@@ -493,14 +527,14 @@ struct KerxSubTableFormat4
mark_set (false),
mark (0) {}
- bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
+ bool is_actionable (hb_buffer_t *buffer HB_UNUSED,
+ StateTableDriver<Types, EntryData> *driver HB_UNUSED,
const Entry<EntryData> &entry)
{ return entry.data.ankrActionIndex != 0xFFFF; }
- void transition (StateTableDriver<Types, EntryData> *driver,
+ void transition (hb_buffer_t *buffer,
+ StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> &entry)
{
- hb_buffer_t *buffer = driver->buffer;
-
if (mark_set && entry.data.ankrActionIndex != 0xFFFF && buffer->idx < buffer->len)
{
hb_glyph_position_t &o = buffer->cur_pos();
@@ -600,7 +634,7 @@ struct KerxSubTableFormat4
driver_context_t dc (this, c);
- StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->font->face);
+ StateTableDriver<Types, EntryData> driver (machine, c->font->face);
driver.drive (&dc, c);
return_trace (true);
@@ -614,12 +648,21 @@ struct KerxSubTableFormat4
machine.sanitize (c)));
}
+ template <typename set_t>
+ void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+ {
+ set_t set;
+ machine.collect_glyphs (set, num_glyphs);
+ left_set.union_ (set);
+ right_set.union_ (set);
+ }
+
protected:
KernSubTableHeader header;
StateTable<Types, EntryData> machine;
HBUINT32 flags;
public:
- DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + 20);
+ DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + (StateTable<Types, EntryData>::static_size + HBUINT32::static_size));
};
template <typename KernSubTableHeader>
@@ -638,7 +681,7 @@ struct KerxSubTableFormat6
unsigned int num_glyphs = c->sanitizer.get_num_glyphs ();
if (is_long ())
{
- const typename U::Long &t = u.l;
+ const auto &t = u.l;
unsigned int l = (this+t.rowIndexTable).get_value_or_null (left, num_glyphs);
unsigned int r = (this+t.columnIndexTable).get_value_or_null (right, num_glyphs);
unsigned int offset = l + r;
@@ -651,7 +694,7 @@ struct KerxSubTableFormat6
}
else
{
- const typename U::Short &t = u.s;
+ const auto &t = u.s;
unsigned int l = (this+t.rowIndexTable).get_value_or_null (left, num_glyphs);
unsigned int r = (this+t.columnIndexTable).get_value_or_null (right, num_glyphs);
unsigned int offset = l + r;
@@ -698,6 +741,23 @@ struct KerxSubTableFormat6
c->check_range (this, vector))));
}
+ template <typename set_t>
+ void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+ {
+ if (is_long ())
+ {
+ const auto &t = u.l;
+ (this+t.rowIndexTable).collect_glyphs (left_set, num_glyphs);
+ (this+t.columnIndexTable).collect_glyphs (right_set, num_glyphs);
+ }
+ else
+ {
+ const auto &t = u.s;
+ (this+t.rowIndexTable).collect_glyphs (left_set, num_glyphs);
+ (this+t.columnIndexTable).collect_glyphs (right_set, num_glyphs);
+ }
+ }
+
struct accelerator_t
{
const KerxSubTableFormat6 &table;
@@ -708,7 +768,10 @@ struct KerxSubTableFormat6
table (table_), c (c_) {}
int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
- { return table.get_kerning (left, right, c); }
+ {
+ if (!c->left_set[left] || !c->right_set[right]) return 0;
+ return table.get_kerning (left, right, c);
+ }
};
protected:
@@ -794,6 +857,20 @@ struct KerxSubTable
}
}
+ template <typename set_t>
+ void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+ {
+ unsigned int subtable_type = get_type ();
+ switch (subtable_type) {
+ case 0: u.format0.collect_glyphs (left_set, right_set, num_glyphs); return;
+ case 1: u.format1.collect_glyphs (left_set, right_set, num_glyphs); return;
+ case 2: u.format2.collect_glyphs (left_set, right_set, num_glyphs); return;
+ case 4: u.format4.collect_glyphs (left_set, right_set, num_glyphs); return;
+ case 6: u.format6.collect_glyphs (left_set, right_set, num_glyphs); return;
+ default: return;
+ }
+ }
+
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -824,6 +901,8 @@ struct KerxSubTable
* The 'kerx' Table
*/
+using kern_accelerator_data_t = hb_vector_t<hb_pair_t<hb_set_digest_t, hb_set_digest_t>>;
+
template <typename T>
struct KerxTable
{
@@ -878,7 +957,8 @@ struct KerxTable
return v;
}
- bool apply (AAT::hb_aat_apply_context_t *c) const
+ bool apply (AAT::hb_aat_apply_context_t *c,
+ const kern_accelerator_data_t *accel_data = nullptr) const
{
c->buffer->unsafe_to_concat ();
@@ -925,6 +1005,16 @@ struct KerxTable
if (reverse)
c->buffer->reverse ();
+ if (accel_data)
+ {
+ c->left_set = (*accel_data)[i].first;
+ c->right_set = (*accel_data)[i].second;
+ }
+ else
+ {
+ c->left_set = c->right_set = hb_set_digest_t::full ();
+ }
+
{
/* See comment in sanitize() for conditional here. */
hb_sanitize_with_object_t with (&c->sanitizer, i < count - 1 ? st : (const SubTable *) nullptr);
@@ -977,8 +1067,61 @@ struct KerxTable
st = &StructAfter<SubTable> (*st);
}
+ unsigned majorVersion = thiz()->version;
+ if (sizeof (thiz()->version) == 4)
+ majorVersion = majorVersion >> 16;
+ if (majorVersion >= 3)
+ {
+ const SubtableGlyphCoverage *coverage = (const SubtableGlyphCoverage *) st;
+ if (!coverage->sanitize (c, count))
+ return_trace (false);
+ }
+
return_trace (true);
}
+
+ kern_accelerator_data_t create_accelerator_data (unsigned num_glyphs) const
+ {
+ kern_accelerator_data_t accel_data;
+
+ typedef typename T::SubTable SubTable;
+
+ const SubTable *st = &thiz()->firstSubTable;
+ unsigned int count = thiz()->tableCount;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ hb_set_digest_t left_set, right_set;
+ st->collect_glyphs (left_set, right_set, num_glyphs);
+ accel_data.push (hb_pair (left_set, right_set));
+ st = &StructAfter<SubTable> (*st);
+ }
+
+ return accel_data;
+ }
+
+ struct accelerator_t
+ {
+ accelerator_t (hb_face_t *face)
+ {
+ hb_sanitize_context_t sc;
+ this->table = sc.reference_table<T> (face);
+ this->accel_data = this->table->create_accelerator_data (face->get_num_glyphs ());
+ }
+ ~accelerator_t ()
+ {
+ this->table.destroy ();
+ }
+
+ hb_blob_t *get_blob () const { return table.get_blob (); }
+
+ bool apply (AAT::hb_aat_apply_context_t *c) const
+ {
+ return table->apply (c, &accel_data);
+ }
+
+ hb_blob_ptr_t<T> table;
+ kern_accelerator_data_t accel_data;
+ };
};
struct kerx : KerxTable<kerx>
@@ -1007,8 +1150,10 @@ struct kerx : KerxTable<kerx>
DEFINE_SIZE_MIN (8);
};
+struct kerx_accelerator_t : kerx::accelerator_t {
+ kerx_accelerator_t (hb_face_t *face) : kerx::accelerator_t (face) {}
+};
} /* namespace AAT */
-
#endif /* HB_AAT_LAYOUT_KERX_TABLE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-aat-layout-morx-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-aat-layout-morx-table.hh
index 8436551324..4a94e6a8ff 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-aat-layout-morx-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-aat-layout-morx-table.hh
@@ -74,15 +74,16 @@ struct RearrangementSubtable
ret (false),
start (0), end (0) {}
- bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
- const Entry<EntryData> &entry)
+ bool is_actionable (hb_buffer_t *buffer HB_UNUSED,
+ StateTableDriver<Types, EntryData> *driver HB_UNUSED,
+ const Entry<EntryData> &entry) const
{
return (entry.flags & Verb) && start < end;
}
- void transition (StateTableDriver<Types, EntryData> *driver,
+ void transition (hb_buffer_t *buffer,
+ StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> &entry)
{
- hb_buffer_t *buffer = driver->buffer;
unsigned int flags = entry.flags;
if (flags & MarkFirst)
@@ -168,7 +169,7 @@ struct RearrangementSubtable
driver_context_t dc (this);
- StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->face);
+ StateTableDriver<Types, EntryData> driver (machine, c->face);
driver.drive (&dc, c);
return_trace (dc.ret);
@@ -180,10 +181,10 @@ struct RearrangementSubtable
return_trace (machine.sanitize (c));
}
- protected:
+ public:
StateTable<Types, EntryData> machine;
public:
- DEFINE_SIZE_STATIC (16);
+ DEFINE_SIZE_STATIC ((StateTable<Types, EntryData>::static_size));
};
template <typename Types>
@@ -223,21 +224,19 @@ struct ContextualSubtable
table (table_),
subs (table+table->substitutionTables) {}
- bool is_actionable (StateTableDriver<Types, EntryData> *driver,
- const Entry<EntryData> &entry)
+ bool is_actionable (hb_buffer_t *buffer,
+ StateTableDriver<Types, EntryData> *driver,
+ const Entry<EntryData> &entry) const
{
- hb_buffer_t *buffer = driver->buffer;
-
if (buffer->idx == buffer->len && !mark_set)
return false;
return entry.data.markIndex != 0xFFFF || entry.data.currentIndex != 0xFFFF;
}
- void transition (StateTableDriver<Types, EntryData> *driver,
+ void transition (hb_buffer_t *buffer,
+ StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> &entry)
{
- hb_buffer_t *buffer = driver->buffer;
-
/* Looks like CoreText applies neither mark nor current substitution for
* end-of-text if mark was not explicitly set. */
if (buffer->idx == buffer->len && !mark_set)
@@ -328,7 +327,7 @@ struct ContextualSubtable
driver_context_t dc (this, c);
- StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->face);
+ StateTableDriver<Types, EntryData> driver (machine, c->face);
driver.drive (&dc, c);
return_trace (dc.ret);
@@ -361,13 +360,14 @@ struct ContextualSubtable
return_trace (substitutionTables.sanitize (c, this, num_lookups));
}
- protected:
+ public:
StateTable<Types, EntryData>
machine;
+ protected:
NNOffsetTo<UnsizedListOfOffset16To<Lookup<HBGlyphID16>, HBUINT, void, false>, HBUINT>
substitutionTables;
public:
- DEFINE_SIZE_STATIC (20);
+ DEFINE_SIZE_STATIC ((StateTable<Types, EntryData>::static_size + HBUINT::static_size));
};
@@ -464,16 +464,16 @@ struct LigatureSubtable
ligature (table+table->ligature),
match_length (0) {}
- bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
- const Entry<EntryData> &entry)
+ bool is_actionable (hb_buffer_t *buffer HB_UNUSED,
+ StateTableDriver<Types, EntryData> *driver HB_UNUSED,
+ const Entry<EntryData> &entry) const
{
return LigatureEntryT::performAction (entry);
}
- void transition (StateTableDriver<Types, EntryData> *driver,
+ void transition (hb_buffer_t *buffer,
+ StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> &entry)
{
- hb_buffer_t *buffer = driver->buffer;
-
DEBUG_MSG (APPLY, nullptr, "Ligature transition at %u", buffer->idx);
if (entry.flags & LigatureEntryT::SetComponent)
{
@@ -585,7 +585,7 @@ struct LigatureSubtable
driver_context_t dc (this, c);
- StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->face);
+ StateTableDriver<Types, EntryData> driver (machine, c->face);
driver.drive (&dc, c);
return_trace (dc.ret);
@@ -600,9 +600,10 @@ struct LigatureSubtable
ligAction && component && ligature);
}
- protected:
+ public:
StateTable<Types, EntryData>
machine;
+ protected:
NNOffsetTo<UnsizedArrayOf<HBUINT32>, HBUINT>
ligAction; /* Offset to the ligature action table. */
NNOffsetTo<UnsizedArrayOf<HBUINT16>, HBUINT>
@@ -610,7 +611,7 @@ struct LigatureSubtable
NNOffsetTo<UnsizedArrayOf<HBGlyphID16>, HBUINT>
ligature; /* Offset to the actual ligature lists. */
public:
- DEFINE_SIZE_STATIC (28);
+ DEFINE_SIZE_STATIC ((StateTable<Types, EntryData>::static_size + 3 * HBUINT::static_size));
};
template <typename Types>
@@ -754,16 +755,17 @@ struct InsertionSubtable
mark (0),
insertionAction (table+table->insertionAction) {}
- bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
- const Entry<EntryData> &entry)
+ bool is_actionable (hb_buffer_t *buffer HB_UNUSED,
+ StateTableDriver<Types, EntryData> *driver HB_UNUSED,
+ const Entry<EntryData> &entry) const
{
return (entry.flags & (CurrentInsertCount | MarkedInsertCount)) &&
(entry.data.currentInsertIndex != 0xFFFF ||entry.data.markedInsertIndex != 0xFFFF);
}
- void transition (StateTableDriver<Types, EntryData> *driver,
+ void transition (hb_buffer_t *buffer,
+ StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> &entry)
{
- hb_buffer_t *buffer = driver->buffer;
unsigned int flags = entry.flags;
unsigned mark_loc = buffer->out_len;
@@ -850,7 +852,7 @@ struct InsertionSubtable
driver_context_t dc (this, c);
- StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->face);
+ StateTableDriver<Types, EntryData> driver (machine, c->face);
driver.drive (&dc, c);
return_trace (dc.ret);
@@ -865,14 +867,15 @@ struct InsertionSubtable
insertionAction);
}
- protected:
+ public:
StateTable<Types, EntryData>
machine;
+ protected:
NNOffsetTo<UnsizedArrayOf<HBGlyphID16>, HBUINT>
insertionAction; /* Byte offset from stateHeader to the start of
* the insertion glyph table. */
public:
- DEFINE_SIZE_STATIC (20);
+ DEFINE_SIZE_STATIC ((StateTable<Types, EntryData>::static_size + HBUINT::static_size));
};
@@ -896,6 +899,89 @@ struct Feature
DEFINE_SIZE_STATIC (12);
};
+
+struct hb_accelerate_subtables_context_t :
+ hb_dispatch_context_t<hb_accelerate_subtables_context_t>
+{
+ struct hb_applicable_t
+ {
+ friend struct hb_accelerate_subtables_context_t;
+ friend struct hb_aat_layout_lookup_accelerator_t;
+
+ public:
+ hb_set_digest_t digest;
+
+ template <typename T>
+ auto init_ (const T &obj_, unsigned num_glyphs, hb_priority<1>) HB_AUTO_RETURN
+ (
+ obj_.machine.collect_glyphs (this->digest, num_glyphs)
+ )
+
+ template <typename T>
+ void init_ (const T &obj_, unsigned num_glyphs, hb_priority<0>)
+ {
+ digest = digest.full ();
+ }
+
+ template <typename T>
+ void init (const T &obj_, unsigned num_glyphs)
+ {
+ init_ (obj_, num_glyphs, hb_prioritize);
+ }
+ };
+
+ /* Dispatch interface. */
+ template <typename T>
+ return_t dispatch (const T &obj)
+ {
+ hb_applicable_t *entry = &array[i++];
+
+ entry->init (obj, num_glyphs);
+
+ return hb_empty_t ();
+ }
+ static return_t default_return_value () { return hb_empty_t (); }
+
+ bool stop_sublookup_iteration (return_t r) const { return false; }
+
+ hb_accelerate_subtables_context_t (hb_applicable_t *array_, unsigned num_glyphs_) :
+ hb_dispatch_context_t<hb_accelerate_subtables_context_t> (),
+ array (array_), num_glyphs (num_glyphs_) {}
+
+ hb_applicable_t *array;
+ unsigned num_glyphs;
+ unsigned i = 0;
+};
+
+struct hb_aat_layout_chain_accelerator_t
+{
+ template <typename TChain>
+ static hb_aat_layout_chain_accelerator_t *create (const TChain &chain, unsigned num_glyphs)
+ {
+ unsigned count = chain.get_subtable_count ();
+
+ unsigned size = sizeof (hb_aat_layout_chain_accelerator_t) -
+ HB_VAR_ARRAY * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t) +
+ count * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t);
+
+ /* The following is a calloc because when we are collecting subtables,
+ * some of them might be invalid and hence not collect; as a result,
+ * we might not fill in all the count entries of the subtables array.
+ * Zeroing it allows the set digest to gatekeep it without having to
+ * initialize it further. */
+ auto *thiz = (hb_aat_layout_chain_accelerator_t *) hb_calloc (1, size);
+ if (unlikely (!thiz))
+ return nullptr;
+
+ hb_accelerate_subtables_context_t c_accelerate_subtables (thiz->subtables, num_glyphs);
+ chain.dispatch (&c_accelerate_subtables);
+
+ return thiz;
+ }
+
+ hb_accelerate_subtables_context_t::hb_applicable_t subtables[HB_VAR_ARRAY];
+};
+
template <typename Types>
struct ChainSubtable
{
@@ -987,6 +1073,8 @@ struct Chain
{
typedef typename Types::HBUINT HBUINT;
+ unsigned get_subtable_count () const { return subtableCount; }
+
hb_mask_t compile_flags (const hb_aat_map_builder_t *map) const
{
hb_mask_t flags = defaultFlags;
@@ -1027,7 +1115,8 @@ struct Chain
return flags;
}
- void apply (hb_aat_apply_context_t *c) const
+ void apply (hb_aat_apply_context_t *c,
+ const hb_aat_layout_chain_accelerator_t *accel) const
{
const ChainSubtable<Types> *subtable = &StructAfter<ChainSubtable<Types>> (featureZ.as_array (featureCount));
unsigned int count = subtableCount;
@@ -1039,6 +1128,7 @@ struct Chain
hb_map ([&subtable] (const hb_aat_map_t::range_flags_t _) -> bool { return subtable->subFeatureFlags & (_.flags); })))
goto skip;
c->subtable_flags = subtable->subFeatureFlags;
+ c->machine_glyph_set = accel ? accel->subtables[i].digest : hb_set_digest_t::full ();
if (!(subtable->get_coverage() & ChainSubtable<Types>::AllDirections) &&
HB_DIRECTION_IS_VERTICAL (c->buffer->props.direction) !=
@@ -1100,7 +1190,22 @@ struct Chain
unsigned int get_size () const { return length; }
- bool sanitize (hb_sanitize_context_t *c, unsigned int version HB_UNUSED) const
+ template <typename context_t, typename ...Ts>
+ typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
+ {
+ const ChainSubtable<Types> *subtable = &StructAfter<ChainSubtable<Types>> (featureZ.as_array (featureCount));
+ unsigned int count = subtableCount;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ typename context_t::return_t ret = subtable->dispatch (c, std::forward<Ts> (ds)...);
+ if (c->stop_sublookup_iteration (ret))
+ return ret;
+ subtable = &StructAfter<ChainSubtable<Types>> (*subtable);
+ }
+ return c->default_return_value ();
+ }
+
+ bool sanitize (hb_sanitize_context_t *c, unsigned int version) const
{
TRACE_SANITIZE (this);
if (!(length.sanitize (c) &&
@@ -1122,6 +1227,13 @@ struct Chain
subtable = &StructAfter<ChainSubtable<Types>> (*subtable);
}
+ if (version >= 3)
+ {
+ const SubtableGlyphCoverage *coverage = (const SubtableGlyphCoverage *) subtable;
+ if (!coverage->sanitize (c, count))
+ return_trace (false);
+ }
+
return_trace (true);
}
@@ -1133,7 +1245,7 @@ struct Chain
UnsizedArrayOf<Feature> featureZ; /* Features. */
/*ChainSubtable firstSubtable;*//* Subtables. */
-/*subtableGlyphCoverageArray*/ /* Only if version >= 3. We don't use. */
+/*SubtableGlyphCoverage coverages*//* Only if version >= 3. */
public:
DEFINE_SIZE_MIN (8 + 2 * sizeof (HBUINT));
@@ -1144,13 +1256,69 @@ struct Chain
* The 'mort'/'morx' Table
*/
-template <typename Types, hb_tag_t TAG>
+template <typename T, typename Types, hb_tag_t TAG>
struct mortmorx
{
static constexpr hb_tag_t tableTag = TAG;
bool has_data () const { return version != 0; }
+ struct accelerator_t
+ {
+ accelerator_t (hb_face_t *face)
+ {
+ hb_sanitize_context_t sc;
+ this->table = sc.reference_table<T> (face);
+
+ this->chain_count = table->get_chain_count ();
+
+ this->accels = (hb_atomic_ptr_t<hb_aat_layout_chain_accelerator_t> *) hb_calloc (this->chain_count, sizeof (*accels));
+ if (unlikely (!this->accels))
+ {
+ this->chain_count = 0;
+ this->table.destroy ();
+ this->table = hb_blob_get_empty ();
+ }
+ }
+ ~accelerator_t ()
+ {
+ for (unsigned int i = 0; i < this->chain_count; i++)
+ hb_free (this->accels[i]);
+ hb_free (this->accels);
+ this->table.destroy ();
+ }
+
+ hb_blob_t *get_blob () const { return table.get_blob (); }
+
+ template <typename Chain>
+ hb_aat_layout_chain_accelerator_t *get_accel (unsigned chain_index, const Chain &chain, unsigned num_glyphs) const
+ {
+ if (unlikely (chain_index >= chain_count)) return nullptr;
+
+ retry:
+ auto *accel = accels[chain_index].get_acquire ();
+ if (unlikely (!accel))
+ {
+ accel = hb_aat_layout_chain_accelerator_t::create (chain, num_glyphs);
+ if (unlikely (!accel))
+ return nullptr;
+
+ if (unlikely (!accels[chain_index].cmpexch (nullptr, accel)))
+ {
+ hb_free (accel);
+ goto retry;
+ }
+ }
+
+ return accel;
+ }
+
+ hb_blob_ptr_t<T> table;
+ unsigned int chain_count;
+ hb_atomic_ptr_t<hb_aat_layout_chain_accelerator_t> *accels;
+ };
+
+
void compile_flags (const hb_aat_map_builder_t *mapper,
hb_aat_map_t *map) const
{
@@ -1167,8 +1335,14 @@ struct mortmorx
}
}
+ unsigned get_chain_count () const
+ {
+ return chainCount;
+ }
+
void apply (hb_aat_apply_context_t *c,
- const hb_aat_map_t &map) const
+ const hb_aat_map_t &map,
+ const accelerator_t &accel) const
{
if (unlikely (!c->buffer->successful)) return;
@@ -1179,8 +1353,9 @@ struct mortmorx
unsigned int count = chainCount;
for (unsigned int i = 0; i < count; i++)
{
+ auto *chain_accel = accel.get_accel (i, *chain, c->face->get_num_glyphs ());
c->range_flags = &map.chain_flags[i];
- chain->apply (c);
+ chain->apply (c, chain_accel);
if (unlikely (!c->buffer->successful)) return;
chain = &StructAfter<Chain<Types>> (*chain);
}
@@ -1220,8 +1395,15 @@ struct mortmorx
DEFINE_SIZE_MIN (8);
};
-struct morx : mortmorx<ExtendedTypes, HB_AAT_TAG_morx> {};
-struct mort : mortmorx<ObsoleteTypes, HB_AAT_TAG_mort> {};
+struct morx : mortmorx<morx, ExtendedTypes, HB_AAT_TAG_morx> {};
+struct mort : mortmorx<mort, ObsoleteTypes, HB_AAT_TAG_mort> {};
+
+struct morx_accelerator_t : morx::accelerator_t {
+ morx_accelerator_t (hb_face_t *face) : morx::accelerator_t (face) {}
+};
+struct mort_accelerator_t : mort::accelerator_t {
+ mort_accelerator_t (hb_face_t *face) : mort::accelerator_t (face) {}
+};
} /* namespace AAT */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-aat-layout.cc b/src/3rdparty/harfbuzz-ng/src/hb-aat-layout.cc
index 5e4cea2224..9da29e51c9 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-aat-layout.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-aat-layout.cc
@@ -211,14 +211,14 @@ void
hb_aat_layout_compile_map (const hb_aat_map_builder_t *mapper,
hb_aat_map_t *map)
{
- const AAT::morx& morx = *mapper->face->table.morx;
+ const AAT::morx& morx = *mapper->face->table.morx->table;
if (morx.has_data ())
{
morx.compile_flags (mapper, map);
return;
}
- const AAT::mort& mort = *mapper->face->table.mort;
+ const AAT::mort& mort = *mapper->face->table.mort->table;
if (mort.has_data ())
{
mort.compile_flags (mapper, map);
@@ -243,8 +243,8 @@ hb_aat_layout_compile_map (const hb_aat_map_builder_t *mapper,
hb_bool_t
hb_aat_layout_has_substitution (hb_face_t *face)
{
- return face->table.morx->has_data () ||
- face->table.mort->has_data ();
+ return face->table.morx->table->has_data () ||
+ face->table.mort->table->has_data ();
}
void
@@ -260,26 +260,30 @@ hb_aat_layout_substitute (const hb_ot_shape_plan_t *plan,
hb_aat_map_t map;
builder.compile (map);
- hb_blob_t *morx_blob = font->face->table.morx.get_blob ();
- const AAT::morx& morx = *morx_blob->as<AAT::morx> ();
- if (morx.has_data ())
{
- AAT::hb_aat_apply_context_t c (plan, font, buffer, morx_blob);
- if (!buffer->message (font, "start table morx")) return;
- morx.apply (&c, map);
- (void) buffer->message (font, "end table morx");
- return;
+ auto &accel = *font->face->table.morx;
+ const AAT::morx& morx = *accel.table;
+ if (morx.has_data ())
+ {
+ AAT::hb_aat_apply_context_t c (plan, font, buffer, accel.get_blob ());
+ if (!buffer->message (font, "start table morx")) return;
+ morx.apply (&c, map, accel);
+ (void) buffer->message (font, "end table morx");
+ return;
+ }
}
- hb_blob_t *mort_blob = font->face->table.mort.get_blob ();
- const AAT::mort& mort = *mort_blob->as<AAT::mort> ();
- if (mort.has_data ())
{
- AAT::hb_aat_apply_context_t c (plan, font, buffer, mort_blob);
- if (!buffer->message (font, "start table mort")) return;
- mort.apply (&c, map);
- (void) buffer->message (font, "end table mort");
- return;
+ auto &accel = *font->face->table.mort;
+ const AAT::mort& mort = *accel.table;
+ if (mort.has_data ())
+ {
+ AAT::hb_aat_apply_context_t c (plan, font, buffer, accel.get_blob ());
+ if (!buffer->message (font, "start table mort")) return;
+ mort.apply (&c, map, accel);
+ (void) buffer->message (font, "end table mort");
+ return;
+ }
}
}
@@ -322,7 +326,7 @@ hb_aat_layout_remove_deleted_glyphs (hb_buffer_t *buffer)
hb_bool_t
hb_aat_layout_has_positioning (hb_face_t *face)
{
- return face->table.kerx->has_data ();
+ return face->table.kerx->table->has_data ();
}
void
@@ -330,13 +334,12 @@ hb_aat_layout_position (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer)
{
- hb_blob_t *kerx_blob = font->face->table.kerx.get_blob ();
- const AAT::kerx& kerx = *kerx_blob->as<AAT::kerx> ();
+ auto &accel = *font->face->table.kerx;
- AAT::hb_aat_apply_context_t c (plan, font, buffer, kerx_blob);
+ AAT::hb_aat_apply_context_t c (plan, font, buffer, accel.get_blob ());
if (!buffer->message (font, "start table kerx")) return;
c.set_ankr_table (font->face->table.ankr.get ());
- kerx.apply (&c);
+ accel.apply (&c);
(void) buffer->message (font, "end table kerx");
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-algs.hh b/src/3rdparty/harfbuzz-ng/src/hb-algs.hh
index efa6074a42..b02793a09f 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-algs.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-algs.hh
@@ -202,8 +202,12 @@ struct BEInt<Type, 4>
/* Floats. */
/* We want our rounding towards +infinity. */
+static inline double
+_hb_roundf (double x) { return floor (x + .5); }
+
static inline float
_hb_roundf (float x) { return floorf (x + .5f); }
+
#define roundf(x) _hb_roundf(x)
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-cff2-interp-cs.hh b/src/3rdparty/harfbuzz-ng/src/hb-cff2-interp-cs.hh
index 55b1d3bf8d..06fbb72c61 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-cff2-interp-cs.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-cff2-interp-cs.hh
@@ -76,16 +76,12 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<ELEM, CFF2Subrs>
coords = coords_;
num_coords = num_coords_;
varStore = acc.varStore;
- seen_blend = false;
- seen_vsindex_ = false;
- scalars.init ();
do_blend = num_coords && coords && varStore->size;
set_ivs (acc.privateDicts[fd].ivs);
}
void fini ()
{
- scalars.fini ();
SUPER::fini ();
}
@@ -173,8 +169,8 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<ELEM, CFF2Subrs>
unsigned int ivs;
hb_vector_t<float> scalars;
bool do_blend;
- bool seen_vsindex_;
- bool seen_blend;
+ bool seen_vsindex_ = false;
+ bool seen_blend = false;
typedef cs_interp_env_t<ELEM, CFF2Subrs> SUPER;
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-cplusplus.hh b/src/3rdparty/harfbuzz-ng/src/hb-cplusplus.hh
index a640e192de..b6b5c8f781 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-cplusplus.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-cplusplus.hh
@@ -27,9 +27,6 @@
#include "hb.h"
-HB_BEGIN_DECLS
-HB_END_DECLS
-
#ifdef __cplusplus
#include <functional>
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-face-table-list.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-face-table-list.hh
index b552dfdd9d..db1c55490c 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-face-table-list.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-face-table-list.hh
@@ -100,7 +100,7 @@ HB_OT_CORE_TABLE (OT, MVAR)
/* Legacy kern. */
#ifndef HB_NO_OT_KERN
-HB_OT_CORE_TABLE (OT, kern)
+HB_OT_ACCELERATOR (OT, kern)
#endif
/* OpenType shaping. */
@@ -118,9 +118,9 @@ HB_OT_CORE_TABLE (OT, BASE)
/* AAT shaping. */
#ifndef HB_NO_AAT
-HB_OT_TABLE (AAT, morx)
-HB_OT_TABLE (AAT, mort)
-HB_OT_TABLE (AAT, kerx)
+HB_OT_ACCELERATOR (AAT, morx)
+HB_OT_ACCELERATOR (AAT, mort)
+HB_OT_ACCELERATOR (AAT, kerx)
HB_OT_TABLE (AAT, ankr)
HB_OT_TABLE (AAT, trak)
HB_OT_TABLE (AAT, ltag)
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-face.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-face.cc
index 2243ee0287..b0c927979e 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-face.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-face.cc
@@ -41,6 +41,8 @@
#include "hb-ot-layout-gdef-table.hh"
#include "hb-ot-layout-gsub-table.hh"
#include "hb-ot-layout-gpos-table.hh"
+#include "hb-aat-layout-kerx-table.hh"
+#include "hb-aat-layout-morx-table.hh"
void hb_ot_face_t::init0 (hb_face_t *face)
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh
index 48bd536121..e259b33748 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh
@@ -410,7 +410,8 @@ struct hmtxvmtx
font->coords, font->num_coords,
store_cache));
- return _glyf_get_advance_with_var_unscaled (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
+ unsigned glyf_advance = _glyf_get_advance_with_var_unscaled (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
+ return glyf_advance ? glyf_advance : advance;
#else
return advance;
#endif
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-kern-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-kern-table.hh
index 39444d803f..b87ac8f494 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-kern-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-kern-table.hh
@@ -86,6 +86,16 @@ struct KernSubTableFormat3
leftClassCount * rightClassCount));
}
+ template <typename set_t>
+ void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+ {
+ set_t set;
+ if (likely (glyphCount))
+ set.add_range (0, glyphCount - 1);
+ left_set.union_ (set);
+ right_set.union_ (set);
+ }
+
protected:
KernSubTableHeader
header;
@@ -135,16 +145,29 @@ struct KernSubTable
switch (subtable_type) {
case 0: return_trace (c->dispatch (u.format0));
#ifndef HB_NO_AAT_SHAPE
- case 1: return_trace (u.header.apple ? c->dispatch (u.format1, std::forward<Ts> (ds)...) : c->default_return_value ());
+ case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#endif
case 2: return_trace (c->dispatch (u.format2));
#ifndef HB_NO_AAT_SHAPE
- case 3: return_trace (u.header.apple ? c->dispatch (u.format3, std::forward<Ts> (ds)...) : c->default_return_value ());
+ case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
#endif
default: return_trace (c->default_return_value ());
}
}
+ template <typename set_t>
+ void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+ {
+ unsigned int subtable_type = get_type ();
+ switch (subtable_type) {
+ case 0: u.format0.collect_glyphs (left_set, right_set, num_glyphs); return;
+ case 1: u.format1.collect_glyphs (left_set, right_set, num_glyphs); return;
+ case 2: u.format2.collect_glyphs (left_set, right_set, num_glyphs); return;
+ case 3: u.format3.collect_glyphs (left_set, right_set, num_glyphs); return;
+ default: return;
+ }
+ }
+
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -318,8 +341,9 @@ struct kern
}
}
- bool apply (AAT::hb_aat_apply_context_t *c) const
- { return dispatch (c); }
+ bool apply (AAT::hb_aat_apply_context_t *c,
+ const AAT::kern_accelerator_data_t *accel_data = nullptr) const
+ { return dispatch (c, accel_data); }
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
@@ -343,6 +367,41 @@ struct kern
return_trace (dispatch (c));
}
+ AAT::kern_accelerator_data_t create_accelerator_data (unsigned num_glyphs) const
+ {
+ switch (get_type ()) {
+ case 0: return u.ot.create_accelerator_data (num_glyphs);
+#ifndef HB_NO_AAT_SHAPE
+ case 1: return u.aat.create_accelerator_data (num_glyphs);
+#endif
+ default:return AAT::kern_accelerator_data_t ();
+ }
+ }
+
+ struct accelerator_t
+ {
+ accelerator_t (hb_face_t *face)
+ {
+ hb_sanitize_context_t sc;
+ this->table = sc.reference_table<kern> (face);
+ this->accel_data = this->table->create_accelerator_data (face->get_num_glyphs ());
+ }
+ ~accelerator_t ()
+ {
+ this->table.destroy ();
+ }
+
+ hb_blob_t *get_blob () const { return table.get_blob (); }
+
+ bool apply (AAT::hb_aat_apply_context_t *c) const
+ {
+ return table->apply (c, &accel_data);
+ }
+
+ hb_blob_ptr_t<kern> table;
+ AAT::kern_accelerator_data_t accel_data;
+ };
+
protected:
union {
HBUINT32 version32;
@@ -356,6 +415,10 @@ struct kern
DEFINE_SIZE_UNION (4, version32);
};
+struct kern_accelerator_t : kern::accelerator_t {
+ kern_accelerator_t (hb_face_t *face) : kern::accelerator_t (face) {}
+};
+
} /* namespace OT */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-base-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-base-table.hh
index 0278399069..56290905ce 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-base-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-base-table.hh
@@ -125,6 +125,20 @@ struct BaseCoordFormat3
auto *out = c->serializer->embed (*this);
if (unlikely (!out)) return_trace (false);
+ if (!c->plan->pinned_at_default)
+ {
+ unsigned var_idx = (this+deviceTable).get_variation_index ();
+ if (var_idx != VarIdx::NO_VARIATION)
+ {
+ hb_pair_t<unsigned, int> *v;
+ if (!c->plan->base_variation_idx_map.has (var_idx, &v))
+ return_trace (false);
+
+ if (unlikely (!c->serializer->check_assign (out->coordinate, coordinate + hb_second (*v),
+ HB_SERIALIZE_ERROR_INT_OVERFLOW)))
+ return_trace (false);
+ }
+ }
return_trace (out->deviceTable.serialize_copy (c->serializer, deviceTable,
this, 0,
hb_serialize_context_t::Head,
@@ -401,11 +415,12 @@ struct BaseLangSysRecord
bool has_data () const { return baseLangSysTag; }
- const MinMax &get_min_max () const { return this+minMax; }
+ const MinMax &get_min_max (const void* base) const { return base+minMax; }
- void collect_variation_indices (const hb_subset_plan_t* plan,
+ void collect_variation_indices (const void* base,
+ const hb_subset_plan_t* plan,
hb_set_t& varidx_set /* OUT */) const
- { (this+minMax).collect_variation_indices (plan, varidx_set); }
+ { (base+minMax).collect_variation_indices (plan, varidx_set); }
bool subset (hb_subset_context_t *c,
const void *base) const
@@ -438,7 +453,7 @@ struct BaseScript
const MinMax &get_min_max (hb_tag_t language_tag) const
{
const BaseLangSysRecord& record = baseLangSysRecords.bsearch (language_tag);
- return record.has_data () ? record.get_min_max () : this+defaultMinMax;
+ return record.has_data () ? record.get_min_max (this) : this+defaultMinMax;
}
const BaseCoord &get_base_coord (int baseline_tag_index) const
@@ -454,7 +469,7 @@ struct BaseScript
(this+defaultMinMax).collect_variation_indices (plan, varidx_set);
for (const BaseLangSysRecord& _ : baseLangSysRecords)
- _.collect_variation_indices (plan, varidx_set);
+ _.collect_variation_indices (this, plan, varidx_set);
}
bool subset (hb_subset_context_t *c) const
@@ -705,6 +720,46 @@ struct BASE
(this+vAxis).collect_variation_indices (plan, varidx_set);
}
+ bool subset_varstore (hb_subset_context_t *c,
+ BASE *out /* OUT */) const
+ {
+ TRACE_SUBSET (this);
+ if (!c->serializer->allocate_size<Offset32To<ItemVariationStore>> (Offset32To<ItemVariationStore>::static_size))
+ return_trace (false);
+ if (!c->plan->normalized_coords)
+ return_trace (out->varStore.serialize_subset (c, varStore, this, c->plan->base_varstore_inner_maps.as_array ()));
+
+ if (c->plan->all_axes_pinned)
+ return_trace (true);
+
+ item_variations_t item_vars;
+ if (!item_vars.instantiate (this+varStore, c->plan, true, true,
+ c->plan->base_varstore_inner_maps.as_array ()))
+ return_trace (false);
+
+ if (!out->varStore.serialize_serialize (c->serializer,
+ item_vars.has_long_word (),
+ c->plan->axis_tags,
+ item_vars.get_region_list (),
+ item_vars.get_vardata_encodings ()))
+ return_trace (false);
+
+ const hb_map_t &varidx_map = item_vars.get_varidx_map ();
+ /* base_variation_idx_map in the plan is old_varidx->(varidx, delta)
+ * mapping, new varidx is generated for subsetting, we need to remap this
+ * after instancing */
+ for (auto _ : c->plan->base_variation_idx_map.iter_ref ())
+ {
+ uint32_t varidx = _.second.first;
+ uint32_t *new_varidx;
+ if (varidx_map.has (varidx, &new_varidx))
+ _.second.first = *new_varidx;
+ else
+ _.second.first = HB_OT_LAYOUT_NO_VARIATIONS_INDEX;
+ }
+ return_trace (true);
+ }
+
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
@@ -712,19 +767,15 @@ struct BASE
if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false);
out->version = version;
+ if (has_var_store () && !subset_varstore (c, out))
+ return_trace (false);
+
if (hAxis && !out->hAxis.serialize_subset (c, hAxis, this))
return_trace (false);
if (vAxis && !out->vAxis.serialize_subset (c, vAxis, this))
return_trace (false);
- if (has_var_store ())
- {
- if (!c->serializer->allocate_size<Offset32To<ItemVariationStore>> (Offset32To<ItemVariationStore>::static_size))
- return_trace (false);
- return_trace (out->varStore.serialize_subset (c, varStore, this, c->plan->base_varstore_inner_maps.as_array ()));
- }
-
return_trace (true);
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common.hh
index aba427368c..65c8309573 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common.hh
@@ -2641,7 +2641,7 @@ struct VarRegionList
float max_val = axis_region->endCoord.to_float ();
if (def_val != 0.f)
- axis_tuples.set (*axis_tag, Triple (min_val, def_val, max_val));
+ axis_tuples.set (*axis_tag, Triple ((double) min_val, (double) def_val, (double) max_val));
axis_region++;
}
return !axis_tuples.in_error ();
@@ -3208,6 +3208,8 @@ struct ItemVariationStore
for (unsigned i = 0; i < count; i++)
{
hb_inc_bimap_t *map = inner_maps.push ();
+ if (!c->propagate_error(inner_maps))
+ return_trace(nullptr);
auto &data = this+dataSets[i];
unsigned itemCount = data.get_item_count ();
@@ -3326,19 +3328,19 @@ struct ConditionFormat1
return_trace (false);
const hb_hashmap_t<hb_tag_t, Triple>& normalized_axes_location = c->plan->axes_location;
- Triple axis_limit{-1.f, 0.f, 1.f};
+ Triple axis_limit{-1.0, 0.0, 1.0};
Triple *normalized_limit;
if (normalized_axes_location.has (*axis_tag, &normalized_limit))
axis_limit = *normalized_limit;
const hb_hashmap_t<hb_tag_t, TripleDistances>& axes_triple_distances = c->plan->axes_triple_distances;
- TripleDistances axis_triple_distances{1.f, 1.f};
+ TripleDistances axis_triple_distances{1.0, 1.0};
TripleDistances *triple_dists;
if (axes_triple_distances.has (*axis_tag, &triple_dists))
axis_triple_distances = *triple_dists;
- float normalized_min = renormalizeValue (filterRangeMinValue.to_float (), axis_limit, axis_triple_distances, false);
- float normalized_max = renormalizeValue (filterRangeMaxValue.to_float (), axis_limit, axis_triple_distances, false);
+ float normalized_min = renormalizeValue ((double) filterRangeMinValue.to_float (), axis_limit, axis_triple_distances, false);
+ float normalized_max = renormalizeValue ((double) filterRangeMaxValue.to_float (), axis_limit, axis_triple_distances, false);
out->filterRangeMinValue.set_float (normalized_min);
out->filterRangeMaxValue.set_float (normalized_max);
@@ -3356,7 +3358,7 @@ struct ConditionFormat1
hb_tag_t axis_tag = c->axes_index_tag_map->get (axisIndex);
- Triple axis_range (-1.f, 0.f, 1.f);
+ Triple axis_range (-1.0, 0.0, 1.0);
Triple *axis_limit;
bool axis_set_by_user = false;
if (c->axes_location->has (axis_tag, &axis_limit))
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos.hh
index c65ea32b8a..6b760b1108 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos.hh
@@ -1254,7 +1254,7 @@ static bool match_input (hb_ot_apply_context_t *c,
match_func_t match_func,
const void *match_data,
unsigned int *end_position,
- unsigned int match_positions[HB_MAX_CONTEXT_LENGTH],
+ unsigned int *match_positions,
unsigned int *p_total_component_count = nullptr)
{
TRACE_APPLY (nullptr);
@@ -1378,7 +1378,7 @@ static bool match_input (hb_ot_apply_context_t *c,
}
static inline bool ligate_input (hb_ot_apply_context_t *c,
unsigned int count, /* Including the first glyph */
- const unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
+ const unsigned int *match_positions, /* Including the first glyph */
unsigned int match_end,
hb_codepoint_t lig_glyph,
unsigned int total_component_count)
@@ -1686,7 +1686,7 @@ static inline void recurse_lookups (context_t *c,
static inline void apply_lookup (hb_ot_apply_context_t *c,
unsigned int count, /* Including the first glyph */
- unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
+ unsigned int *match_positions, /* Including the first glyph */
unsigned int lookupCount,
const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
unsigned int match_end)
@@ -1694,6 +1694,9 @@ static inline void apply_lookup (hb_ot_apply_context_t *c,
hb_buffer_t *buffer = c->buffer;
int end;
+ unsigned int *match_positions_input = match_positions;
+ unsigned int match_positions_count = count;
+
/* All positions are distance from beginning of *output* buffer.
* Adjust. */
{
@@ -1797,6 +1800,27 @@ static inline void apply_lookup (hb_ot_apply_context_t *c,
{
if (unlikely (delta + count > HB_MAX_CONTEXT_LENGTH))
break;
+ if (unlikely (delta + count > match_positions_count))
+ {
+ unsigned new_match_positions_count = hb_max (delta + count, hb_max(match_positions_count, 4u) * 1.5);
+ if (match_positions == match_positions_input)
+ {
+ match_positions = (unsigned int *) hb_malloc (new_match_positions_count * sizeof (match_positions[0]));
+ if (unlikely (!match_positions))
+ break;
+ memcpy (match_positions, match_positions_input, count * sizeof (match_positions[0]));
+ match_positions_count = new_match_positions_count;
+ }
+ else
+ {
+ unsigned int *new_match_positions = (unsigned int *) hb_realloc (match_positions, new_match_positions_count * sizeof (match_positions[0]));
+ if (unlikely (!new_match_positions))
+ break;
+ match_positions = new_match_positions;
+ match_positions_count = new_match_positions_count;
+ }
+ }
+
}
else
{
@@ -1820,6 +1844,9 @@ static inline void apply_lookup (hb_ot_apply_context_t *c,
match_positions[next] += delta;
}
+ if (match_positions != match_positions_input)
+ hb_free (match_positions);
+
(void) buffer->move_to (end);
}
@@ -1920,8 +1947,18 @@ static bool context_apply_lookup (hb_ot_apply_context_t *c,
const LookupRecord lookupRecord[],
const ContextApplyLookupContext &lookup_context)
{
+ if (unlikely (inputCount > HB_MAX_CONTEXT_LENGTH)) return false;
+ unsigned match_positions_stack[4];
+ unsigned *match_positions = match_positions_stack;
+ if (unlikely (inputCount > ARRAY_LENGTH (match_positions_stack)))
+ {
+ match_positions = (unsigned *) hb_malloc (hb_max (inputCount, 1u) * sizeof (match_positions[0]));
+ if (unlikely (!match_positions))
+ return false;
+ }
+
unsigned match_end = 0;
- unsigned match_positions[HB_MAX_CONTEXT_LENGTH];
+ bool ret = false;
if (match_input (c,
inputCount, input,
lookup_context.funcs.match, lookup_context.match_data,
@@ -1932,13 +1969,18 @@ static bool context_apply_lookup (hb_ot_apply_context_t *c,
inputCount, match_positions,
lookupCount, lookupRecord,
match_end);
- return true;
+ ret = true;
}
else
{
c->buffer->unsafe_to_concat (c->buffer->idx, match_end);
- return false;
+ ret = false;
}
+
+ if (unlikely (match_positions != match_positions_stack))
+ hb_free (match_positions);
+
+ return ret;
}
template <typename Types>
@@ -3018,9 +3060,20 @@ static bool chain_context_apply_lookup (hb_ot_apply_context_t *c,
const LookupRecord lookupRecord[],
const ChainContextApplyLookupContext &lookup_context)
{
+ if (unlikely (inputCount > HB_MAX_CONTEXT_LENGTH)) return false;
+ unsigned match_positions_stack[4];
+ unsigned *match_positions = match_positions_stack;
+ if (unlikely (inputCount > ARRAY_LENGTH (match_positions_stack)))
+ {
+ match_positions = (unsigned *) hb_malloc (hb_max (inputCount, 1u) * sizeof (match_positions[0]));
+ if (unlikely (!match_positions))
+ return false;
+ }
+
+ unsigned start_index = c->buffer->out_len;
unsigned end_index = c->buffer->idx;
unsigned match_end = 0;
- unsigned match_positions[HB_MAX_CONTEXT_LENGTH];
+ bool ret = true;
if (!(match_input (c,
inputCount, input,
lookup_context.funcs.match[1], lookup_context.match_data[1],
@@ -3031,17 +3084,18 @@ static bool chain_context_apply_lookup (hb_ot_apply_context_t *c,
match_end, &end_index)))
{
c->buffer->unsafe_to_concat (c->buffer->idx, end_index);
- return false;
+ ret = false;
+ goto done;
}
- unsigned start_index = c->buffer->out_len;
if (!match_backtrack (c,
backtrackCount, backtrack,
lookup_context.funcs.match[0], lookup_context.match_data[0],
&start_index))
{
c->buffer->unsafe_to_concat_from_outbuffer (start_index, end_index);
- return false;
+ ret = false;
+ goto done;
}
c->buffer->unsafe_to_break_from_outbuffer (start_index, end_index);
@@ -3049,7 +3103,12 @@ static bool chain_context_apply_lookup (hb_ot_apply_context_t *c,
inputCount, match_positions,
lookupCount, lookupRecord,
match_end);
- return true;
+ done:
+
+ if (unlikely (match_positions != match_positions_stack))
+ hb_free (match_positions);
+
+ return ret;
}
template <typename Types>
@@ -4328,7 +4387,7 @@ struct hb_ot_layout_lookup_accelerator_t
thiz->digest.init ();
for (auto& subtable : hb_iter (thiz->subtables, count))
- thiz->digest.add (subtable.digest);
+ thiz->digest.union_ (subtable.digest);
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
thiz->cache_user_idx = c_accelerate_subtables.cache_user_idx;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc
index a4c13abadf..613c97fd9e 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc
@@ -87,7 +87,7 @@ using OT::Layout::GPOS;
bool
hb_ot_layout_has_kerning (hb_face_t *face)
{
- return face->table.kern->has_data ();
+ return face->table.kern->table->has_data ();
}
/**
@@ -103,7 +103,7 @@ hb_ot_layout_has_kerning (hb_face_t *face)
bool
hb_ot_layout_has_machine_kerning (hb_face_t *face)
{
- return face->table.kern->has_state_machine ();
+ return face->table.kern->table->has_state_machine ();
}
/**
@@ -123,7 +123,7 @@ hb_ot_layout_has_machine_kerning (hb_face_t *face)
bool
hb_ot_layout_has_cross_kerning (hb_face_t *face)
{
- return face->table.kern->has_cross_stream ();
+ return face->table.kern->table->has_cross_stream ();
}
void
@@ -132,7 +132,7 @@ hb_ot_layout_kern (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer)
{
hb_blob_t *blob = font->face->table.kern.get_blob ();
- const AAT::kern& kern = *blob->as<AAT::kern> ();
+ const auto& kern = *font->face->table.kern;
AAT::hb_aat_apply_context_t c (plan, font, buffer, blob);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh
index 43b58d9bbf..6c91402269 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh
@@ -272,7 +272,7 @@ struct OS2
Triple *axis_range;
if (c->plan->user_axes_location.has (HB_TAG ('w','g','h','t'), &axis_range))
{
- unsigned weight_class = static_cast<unsigned> (roundf (hb_clamp (axis_range->middle, 1.0f, 1000.0f)));
+ unsigned weight_class = static_cast<unsigned> (roundf (hb_clamp (axis_range->middle, 1.0, 1000.0)));
if (os2_prime->usWeightClass != weight_class)
os2_prime->usWeightClass = weight_class;
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh
index 8132dcfb91..4191879037 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh
@@ -116,7 +116,7 @@ struct post
Triple *axis_range;
if (c->plan->user_axes_location.has (HB_TAG ('s','l','n','t'), &axis_range))
{
- float italic_angle = hb_max (-90.f, hb_min (axis_range->middle, 90.f));
+ float italic_angle = hb_max (-90.0, hb_min (axis_range->middle, 90.0));
if (post_prime->italicAngle.to_float () != italic_angle)
post_prime->italicAngle.set_float (italic_angle);
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-stat-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-stat-table.hh
index e88c82a13c..ea5459ef4e 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-stat-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-stat-table.hh
@@ -63,8 +63,9 @@ static bool axis_value_is_outside_axis_range (hb_tag_t axis_tag, float axis_valu
if (!user_axes_location->has (axis_tag))
return false;
+ double axis_value_double = static_cast<double>(axis_value);
Triple axis_range = user_axes_location->get (axis_tag);
- return (axis_value < axis_range.minimum || axis_value > axis_range.maximum);
+ return (axis_value_double < axis_range.minimum || axis_value_double > axis_range.maximum);
}
struct StatAxisRecord
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-tag-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-tag-table.hh
index db92f4664a..920b06b9c9 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-tag-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-tag-table.hh
@@ -2818,9 +2818,10 @@ out:
* @tag: A language tag.
*
* Converts @tag to a BCP 47 language tag if it is ambiguous (it corresponds to
- * many language tags) and the best tag is not the alphabetically first, or if
- * the best tag consists of multiple subtags, or if the best tag does not appear
- * in #ot_languages.
+ * many language tags) and the best tag is not the first (sorted alphabetically,
+ * with two-letter tags having priority over all three-letter tags), or if the
+ * best tag consists of multiple subtags, or if the best tag does not appear in
+ * #ot_languages2 or #ot_languages3.
*
* Return value: The #hb_language_t corresponding to the BCP 47 language tag,
* or #HB_LANGUAGE_INVALID if @tag is not ambiguous.
@@ -2834,8 +2835,6 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag)
return hb_language_from_string ("alt", -1); /* Southern Altai */
case HB_TAG('A','P','P','H'): /* Phonetic transcription—Americanist conventions */
return hb_language_from_string ("und-fonnapa", -1); /* Undetermined; North American Phonetic Alphabet */
- case HB_TAG('A','R','A',' '): /* Arabic */
- return hb_language_from_string ("ar", -1); /* Arabic [macrolanguage] */
case HB_TAG('A','R','K',' '): /* Rakhine */
return hb_language_from_string ("rki", -1); /* Rakhine */
case HB_TAG('A','T','H',' '): /* Athapaskan */
@@ -2856,12 +2855,6 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag)
return hb_language_from_string ("din", -1); /* Dinka [macrolanguage] */
case HB_TAG('D','R','I',' '): /* Dari */
return hb_language_from_string ("prs", -1); /* Dari */
- case HB_TAG('D','Z','N',' '): /* Dzongkha */
- return hb_language_from_string ("dz", -1); /* Dzongkha */
- case HB_TAG('E','T','I',' '): /* Estonian */
- return hb_language_from_string ("et", -1); /* Estonian [macrolanguage] */
- case HB_TAG('F','A','R',' '): /* Persian */
- return hb_language_from_string ("fa", -1); /* Persian [macrolanguage] */
case HB_TAG('G','O','N',' '): /* Gondi */
return hb_language_from_string ("gon", -1); /* Gondi [macrolanguage] */
case HB_TAG('H','M','A',' '): /* High Mari */
@@ -2876,10 +2869,6 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag)
return hb_language_from_string ("iba", -1); /* Iban */
case HB_TAG('I','J','O',' '): /* Ijo */
return hb_language_from_string ("ijo", -1); /* Ijo [collection] */
- case HB_TAG('I','N','U',' '): /* Inuktitut */
- return hb_language_from_string ("iu", -1); /* Inuktitut [macrolanguage] */
- case HB_TAG('I','P','K',' '): /* Inupiat */
- return hb_language_from_string ("ik", -1); /* Inupiaq [macrolanguage] */
case HB_TAG('I','P','P','H'): /* Phonetic transcription—IPA conventions */
return hb_language_from_string ("und-fonipa", -1); /* Undetermined; International Phonetic Alphabet */
case HB_TAG('I','R','T',' '): /* Irish Traditional */
@@ -2890,36 +2879,24 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag)
return hb_language_from_string ("kln", -1); /* Kalenjin [macrolanguage] */
case HB_TAG('K','G','E',' '): /* Khutsuri Georgian */
return hb_language_from_string ("und-Geok", -1); /* Undetermined; Khutsuri (Asomtavruli and Nuskhuri) */
- case HB_TAG('K','N','R',' '): /* Kanuri */
- return hb_language_from_string ("kr", -1); /* Kanuri [macrolanguage] */
case HB_TAG('K','O','H',' '): /* Korean Old Hangul */
return hb_language_from_string ("okm", -1); /* Middle Korean (10th-16th cent.) */
case HB_TAG('K','O','K',' '): /* Konkani */
return hb_language_from_string ("kok", -1); /* Konkani [macrolanguage] */
- case HB_TAG('K','O','M',' '): /* Komi */
- return hb_language_from_string ("kv", -1); /* Komi [macrolanguage] */
case HB_TAG('K','P','L',' '): /* Kpelle */
return hb_language_from_string ("kpe", -1); /* Kpelle [macrolanguage] */
case HB_TAG('K','R','N',' '): /* Karen */
return hb_language_from_string ("kar", -1); /* Karen [collection] */
case HB_TAG('K','U','I',' '): /* Kui */
return hb_language_from_string ("uki", -1); /* Kui (India) */
- case HB_TAG('K','U','R',' '): /* Kurdish */
- return hb_language_from_string ("ku", -1); /* Kurdish [macrolanguage] */
case HB_TAG('L','M','A',' '): /* Low Mari */
return hb_language_from_string ("mhr", -1); /* Eastern Mari */
case HB_TAG('L','U','H',' '): /* Luyia */
return hb_language_from_string ("luy", -1); /* Luyia [macrolanguage] */
- case HB_TAG('L','V','I',' '): /* Latvian */
- return hb_language_from_string ("lv", -1); /* Latvian [macrolanguage] */
case HB_TAG('M','A','W',' '): /* Marwari */
return hb_language_from_string ("mwr", -1); /* Marwari [macrolanguage] */
- case HB_TAG('M','L','G',' '): /* Malagasy */
- return hb_language_from_string ("mg", -1); /* Malagasy [macrolanguage] */
case HB_TAG('M','L','Y',' '): /* Malay */
return hb_language_from_string ("ms", -1); /* Malay [macrolanguage] */
- case HB_TAG('M','N','G',' '): /* Mongolian */
- return hb_language_from_string ("mn", -1); /* Mongolian [macrolanguage] */
case HB_TAG('M','N','K',' '): /* Maninka */
return hb_language_from_string ("man", -1); /* Mandingo [macrolanguage] */
case HB_TAG('M','O','L',' '): /* Romanian (Moldova) */
@@ -2930,26 +2907,16 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag)
return hb_language_from_string ("myn", -1); /* Mayan [collection] */
case HB_TAG('N','A','H',' '): /* Nahuatl */
return hb_language_from_string ("nah", -1); /* Nahuatl [collection] */
- case HB_TAG('N','E','P',' '): /* Nepali */
- return hb_language_from_string ("ne", -1); /* Nepali [macrolanguage] */
case HB_TAG('N','I','S',' '): /* Nisi */
return hb_language_from_string ("njz", -1); /* Nyishi */
case HB_TAG('N','O','R',' '): /* Norwegian */
return hb_language_from_string ("no", -1); /* Norwegian [macrolanguage] */
- case HB_TAG('O','J','B',' '): /* Ojibway */
- return hb_language_from_string ("oj", -1); /* Ojibwa [macrolanguage] */
- case HB_TAG('O','R','O',' '): /* Oromo */
- return hb_language_from_string ("om", -1); /* Oromo [macrolanguage] */
- case HB_TAG('P','A','S',' '): /* Pashto */
- return hb_language_from_string ("ps", -1); /* Pashto [macrolanguage] */
case HB_TAG('P','G','R',' '): /* Polytonic Greek */
return hb_language_from_string ("el-polyton", -1); /* Modern Greek (1453-); Polytonic Greek */
case HB_TAG('P','R','O',' '): /* Provençal / Old Provençal */
return hb_language_from_string ("pro", -1); /* Old Provençal (to 1500) */
case HB_TAG('Q','U','H',' '): /* Quechua (Bolivia) */
return hb_language_from_string ("quh", -1); /* South Bolivian Quechua */
- case HB_TAG('Q','U','Z',' '): /* Quechua */
- return hb_language_from_string ("qu", -1); /* Quechua [macrolanguage] */
case HB_TAG('Q','V','I',' '): /* Quechua (Ecuador) */
return hb_language_from_string ("qvi", -1); /* Imbabura Highland Quichua */
case HB_TAG('Q','W','H',' '): /* Quechua (Peru) */
@@ -2960,10 +2927,6 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag)
return hb_language_from_string ("ro", -1); /* Romanian */
case HB_TAG('R','O','Y',' '): /* Romany */
return hb_language_from_string ("rom", -1); /* Romany [macrolanguage] */
- case HB_TAG('S','A','N',' '): /* Sanskrit */
- return hb_language_from_string ("sa", -1); /* Sanskrit [macrolanguage] */
- case HB_TAG('S','Q','I',' '): /* Albanian */
- return hb_language_from_string ("sq", -1); /* Albanian [macrolanguage] */
case HB_TAG('S','R','B',' '): /* Serbian */
return hb_language_from_string ("sr", -1); /* Serbian */
case HB_TAG('S','X','T',' '): /* Sutu */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-avar-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-avar-table.hh
index 9149959d79..75ea338e2a 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-avar-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-avar-table.hh
@@ -80,7 +80,7 @@ struct AxisValueMap
bool is_outside_axis_range (const Triple& axis_range) const
{
- float from_coord = coords[0].to_float ();
+ double from_coord = (double) coords[0].to_float ();
return !axis_range.contains (from_coord);
}
@@ -100,8 +100,8 @@ struct AxisValueMap
float from_coord = coords[0].to_float ();
float to_coord = coords[1].to_float ();
- from_coord = renormalizeValue (from_coord, unmapped_range, triple_distances);
- to_coord = renormalizeValue (to_coord, axis_range, triple_distances);
+ from_coord = renormalizeValue ((double) from_coord, unmapped_range, triple_distances);
+ to_coord = renormalizeValue ((double) to_coord, axis_range, triple_distances);
coords[0].set_float (from_coord);
coords[1].set_float (to_coord);
@@ -197,7 +197,7 @@ struct SegmentMaps : Array16Of<AxisValueMap>
unmapped_val.set_int (unmap (val.to_int ()));
float unmapped_max = unmapped_val.to_float ();
- return Triple{unmapped_min, unmapped_middle, unmapped_max};
+ return Triple{(double) unmapped_min, (double) unmapped_middle, (double) unmapped_max};
}
bool subset (hb_subset_context_t *c, hb_tag_t axis_tag) const
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-common.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-common.hh
index 379e164059..08227aa1df 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-common.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-common.hh
@@ -299,13 +299,13 @@ struct TupleVariationHeader
start = hb_min (peak, 0.f);
end = hb_max (peak, 0.f);
}
- axis_tuples.set (*axis_tag, Triple (start, peak, end));
+ axis_tuples.set (*axis_tag, Triple ((double) start, (double) peak, (double) end));
}
return true;
}
- float calculate_scalar (hb_array_t<int> coords, unsigned int coord_count,
+ double calculate_scalar (hb_array_t<int> coords, unsigned int coord_count,
const hb_array_t<const F2DOT14> shared_tuples,
const hb_vector_t<hb_pair_t<int,int>> *shared_tuple_active_idx = nullptr) const
{
@@ -321,13 +321,13 @@ struct TupleVariationHeader
{
unsigned int index = get_index ();
if (unlikely ((index + 1) * coord_count > shared_tuples.length))
- return 0.f;
+ return 0.0;
peak_tuple = shared_tuples.sub_array (coord_count * index, coord_count).arrayZ;
if (shared_tuple_active_idx)
{
if (unlikely (index >= shared_tuple_active_idx->length))
- return 0.f;
+ return 0.0;
auto _ = (*shared_tuple_active_idx).arrayZ[index];
if (_.second != -1)
{
@@ -352,7 +352,7 @@ struct TupleVariationHeader
end_tuple = get_end_tuple (coord_count).arrayZ;
}
- float scalar = 1.f;
+ double scalar = 1.0;
for (unsigned int i = start_idx; i < end_idx; i += step)
{
int peak = peak_tuple[i].to_int ();
@@ -367,15 +367,15 @@ struct TupleVariationHeader
int end = end_tuple[i].to_int ();
if (unlikely (start > peak || peak > end ||
(start < 0 && end > 0 && peak))) continue;
- if (v < start || v > end) return 0.f;
+ if (v < start || v > end) return 0.0;
if (v < peak)
- { if (peak != start) scalar *= (float) (v - start) / (peak - start); }
+ { if (peak != start) scalar *= (double) (v - start) / (peak - start); }
else
- { if (peak != end) scalar *= (float) (end - v) / (end - peak); }
+ { if (peak != end) scalar *= (double) (end - v) / (end - peak); }
}
- else if (!v || v < hb_min (0, peak) || v > hb_max (0, peak)) return 0.f;
+ else if (!v || v < hb_min (0, peak) || v > hb_max (0, peak)) return 0.0;
else
- scalar *= (float) v / peak;
+ scalar *= (double) v / peak;
}
return scalar;
}
@@ -444,10 +444,10 @@ struct tuple_delta_t
/* indices_length = point_count, indice[i] = 1 means point i is referenced */
hb_vector_t<bool> indices;
-
- hb_vector_t<float> deltas_x;
+
+ hb_vector_t<double> deltas_x;
/* empty for cvar tuples */
- hb_vector_t<float> deltas_y;
+ hb_vector_t<double> deltas_y;
/* compiled data: header and deltas
* compiled point data is saved in a hashmap within tuple_variations_t cause
@@ -513,9 +513,9 @@ struct tuple_delta_t
return *this;
}
- tuple_delta_t& operator *= (float scalar)
+ tuple_delta_t& operator *= (double scalar)
{
- if (scalar == 1.0f)
+ if (scalar == 1.0)
return *this;
unsigned num = indices.length;
@@ -546,18 +546,18 @@ struct tuple_delta_t
return out;
}
- if ((tent->minimum < 0.f && tent->maximum > 0.f) ||
+ if ((tent->minimum < 0.0 && tent->maximum > 0.0) ||
!(tent->minimum <= tent->middle && tent->middle <= tent->maximum))
return out;
- if (tent->middle == 0.f)
+ if (tent->middle == 0.0)
{
out.push (*this);
return out;
}
- result_t solutions = rebase_tent (*tent, axis_limit, axis_triple_distances);
- for (auto t : solutions)
+ rebase_tent_result_t solutions = rebase_tent (*tent, axis_limit, axis_triple_distances);
+ for (auto &t : solutions)
{
tuple_delta_t new_var = *this;
if (t.second == Triple ())
@@ -729,8 +729,8 @@ struct tuple_delta_t
{ return compile_deltas (indices, deltas_x, deltas_y, compiled_deltas); }
bool compile_deltas (const hb_vector_t<bool> &point_indices,
- const hb_vector_t<float> &x_deltas,
- const hb_vector_t<float> &y_deltas,
+ const hb_vector_t<double> &x_deltas,
+ const hb_vector_t<double> &y_deltas,
hb_vector_t<char> &compiled_deltas /* OUT */)
{
hb_vector_t<int> rounded_deltas;
@@ -1000,9 +1000,13 @@ struct tuple_delta_t
{
i = next_index (i, start_point, end_point);
if (i == next) break;
- deltas_x.arrayZ[i] = infer_delta (orig_points.arrayZ[i].x, orig_points.arrayZ[prev].x, orig_points.arrayZ[next].x,
+ deltas_x.arrayZ[i] = infer_delta ((double) orig_points.arrayZ[i].x,
+ (double) orig_points.arrayZ[prev].x,
+ (double) orig_points.arrayZ[next].x,
deltas_x.arrayZ[prev], deltas_x.arrayZ[next]);
- deltas_y.arrayZ[i] = infer_delta (orig_points.arrayZ[i].y, orig_points.arrayZ[prev].y, orig_points.arrayZ[next].y,
+ deltas_y.arrayZ[i] = infer_delta ((double) orig_points.arrayZ[i].y,
+ (double) orig_points.arrayZ[prev].y,
+ (double) orig_points.arrayZ[next].y,
deltas_y.arrayZ[prev], deltas_y.arrayZ[next]);
inferred_idxes.add (i);
if (--unref_count == 0) goto no_more_gaps;
@@ -1020,8 +1024,8 @@ struct tuple_delta_t
{
if (!inferred_idxes.has (i))
{
- deltas_x.arrayZ[i] = 0.f;
- deltas_y.arrayZ[i] = 0.f;
+ deltas_x.arrayZ[i] = 0.0;
+ deltas_y.arrayZ[i] = 0.0;
}
indices[i] = true;
}
@@ -1031,7 +1035,7 @@ struct tuple_delta_t
bool optimize (const contour_point_vector_t& contour_points,
bool is_composite,
- float tolerance = 0.5f)
+ double tolerance = 0.5 + 1e-10)
{
unsigned count = contour_points.length;
if (deltas_x.length != count ||
@@ -1062,7 +1066,7 @@ struct tuple_delta_t
if (ref_count == count) return true;
- hb_vector_t<float> opt_deltas_x, opt_deltas_y;
+ hb_vector_t<double> opt_deltas_x, opt_deltas_y;
bool is_comp_glyph_wo_deltas = (is_composite && ref_count == 0);
if (is_comp_glyph_wo_deltas)
{
@@ -1194,16 +1198,16 @@ struct tuple_delta_t
return compiled_points.resize (pos, false);
}
- static float infer_delta (float target_val, float prev_val, float next_val, float prev_delta, float next_delta)
+ static double infer_delta (double target_val, double prev_val, double next_val, double prev_delta, double next_delta)
{
if (prev_val == next_val)
- return (prev_delta == next_delta) ? prev_delta : 0.f;
+ return (prev_delta == next_delta) ? prev_delta : 0.0;
else if (target_val <= hb_min (prev_val, next_val))
return (prev_val < next_val) ? prev_delta : next_delta;
else if (target_val >= hb_max (prev_val, next_val))
return (prev_val > next_val) ? prev_delta : next_delta;
- float r = (target_val - prev_val) / (next_val - prev_val);
+ double r = (target_val - prev_val) / (next_val - prev_val);
return prev_delta + r * (next_delta - prev_delta);
}
@@ -1347,9 +1351,9 @@ struct TupleVariationData
unsigned idx = apply_to_all ? i : indices[i];
if (idx >= point_count) continue;
var.indices[idx] = true;
- var.deltas_x[idx] = static_cast<float> (deltas_x[i]);
+ var.deltas_x[idx] = deltas_x[i];
if (is_gvar)
- var.deltas_y[idx] = static_cast<float> (deltas_y[i]);
+ var.deltas_y[idx] = deltas_y[i];
}
tuple_vars.push (std::move (var));
} while (iterator.move_to_next ());
@@ -1367,15 +1371,15 @@ struct TupleVariationData
/* NULL offset, to keep original varidx valid, just return */
if (&var_data == &Null (VarData))
return true;
-
+
unsigned num_regions = var_data.get_region_index_count ();
if (!tuple_vars.alloc (num_regions)) return false;
-
+
item_count = inner_map ? inner_map->get_population () : var_data.get_item_count ();
if (!item_count) return true;
unsigned row_size = var_data.get_row_size ();
const HBUINT8 *delta_bytes = var_data.get_delta_bytes ();
-
+
for (unsigned r = 0; r < num_regions; r++)
{
/* In VarData, deltas are organized in rows, convert them into
@@ -1384,14 +1388,14 @@ struct TupleVariationData
if (!tuple.deltas_x.resize (item_count, false) ||
!tuple.indices.resize (item_count, false))
return false;
-
+
for (unsigned i = 0; i < item_count; i++)
{
tuple.indices.arrayZ[i] = true;
tuple.deltas_x.arrayZ[i] = var_data.get_item_delta_fast (inner_map ? inner_map->backward (i) : i,
r, delta_bytes, row_size);
}
-
+
unsigned region_index = var_data.get_region_index (r);
if (region_index >= regions.length) return false;
tuple.axis_tuples = regions.arrayZ[region_index];
@@ -1425,7 +1429,7 @@ struct TupleVariationData
Triple *axis_limit;
if (!normalized_axes_location.has (axis_tag, &axis_limit))
return false;
- TripleDistances axis_triple_distances{1.f, 1.f};
+ TripleDistances axis_triple_distances{1.0, 1.0};
if (axes_triple_distances.has (axis_tag))
axis_triple_distances = axes_triple_distances.get (axis_tag);
@@ -1503,11 +1507,11 @@ struct TupleVariationData
return false;
continue;
}
-
+
hb_vector_t<char> compiled_point_data;
if (!tuple_delta_t::compile_point_set (*points_set, compiled_point_data))
return false;
-
+
if (!point_data_map.set (points_set, std::move (compiled_point_data)) ||
!point_set_count_map.set (points_set, 1))
return false;
@@ -1547,7 +1551,7 @@ struct TupleVariationData
for (tuple_delta_t& var : tuple_vars)
if (!var.calc_inferred_deltas (contour_points))
return false;
-
+
return true;
}
@@ -1874,7 +1878,7 @@ struct TupleVariationData
if (!tuple_variations.serialize_var_headers (c, total_header_len))
return_trace (false);
-
+
unsigned data_offset = min_size + total_header_len;
if (!is_gvar) data_offset += 4;
if (!c->check_assign (out->data, data_offset, HB_SERIALIZE_ERROR_INT_OVERFLOW)) return_trace (false);
@@ -2335,12 +2339,12 @@ struct item_variations_t
/* just sanity check, this shouldn't happen */
if (encoding.is_empty ())
return false;
-
+
unsigned num_rows = encoding.items.length;
-
+
/* sort rows, make result deterministic */
encoding.items.qsort (_cmp_row);
-
+
/* compile old to new var_idxes mapping */
for (unsigned minor = 0; minor < num_rows; minor++)
{
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-fvar-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-fvar-table.hh
index 07d7586baa..2cd9afbb70 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-fvar-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-fvar-table.hh
@@ -43,7 +43,7 @@ static bool axis_coord_pinned_or_within_axis_range (const hb_array_t<const F16DO
unsigned axis_index,
Triple axis_limit)
{
- float axis_coord = coords[axis_index].to_float ();
+ double axis_coord = static_cast<double>(coords[axis_index].to_float ());
if (axis_limit.is_point ())
{
if (axis_limit.minimum != axis_coord)
@@ -233,7 +233,10 @@ struct AxisRecord
{
float min, default_, max;
get_coordinates (min, default_, max);
- return TripleDistances (min, default_, max);
+ return TripleDistances (
+ static_cast<double>(min),
+ static_cast<double>(default_),
+ static_cast<double>(max));
}
bool subset (hb_subset_context_t *c) const
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-gvar-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-gvar-table.hh
index 59aad57e37..d713084faf 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-gvar-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-gvar-table.hh
@@ -102,9 +102,8 @@ struct glyph_variations_t
}
bool is_composite_glyph = false;
-#ifdef HB_EXPERIMENTAL_API
is_composite_glyph = plan->composite_new_gids.has (new_gid);
-#endif
+
if (!p->decompile_tuple_variations (all_contour_points->length, true /* is_gvar */,
iterator, &(plan->axes_old_index_tag_map),
shared_indices, shared_tuples,
@@ -120,9 +119,7 @@ struct glyph_variations_t
{
unsigned count = plan->new_to_old_gid_list.length;
bool iup_optimize = false;
-#ifdef HB_EXPERIMENTAL_API
iup_optimize = plan->flags & HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS;
-#endif
for (unsigned i = 0; i < count; i++)
{
hb_codepoint_t new_gid = plan->new_to_old_gid_list[i].first;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-repacker.hh b/src/3rdparty/harfbuzz-ng/src/hb-repacker.hh
index ed40f271cc..cb4fdeead2 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-repacker.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-repacker.hh
@@ -337,9 +337,10 @@ bool _process_overflows (const hb_vector_t<graph::overflow_record_t>& overflows,
inline bool
hb_resolve_graph_overflows (hb_tag_t table_tag,
unsigned max_rounds ,
- bool recalculate_extensions,
+ bool always_recalculate_extensions,
graph_t& sorted_graph /* IN/OUT */)
{
+ DEBUG_MSG (SUBSET_REPACK, nullptr, "Repacking %c%c%c%c.", HB_UNTAG(table_tag));
sorted_graph.sort_shortest_distance ();
if (sorted_graph.in_error ())
{
@@ -351,12 +352,12 @@ hb_resolve_graph_overflows (hb_tag_t table_tag,
if (!will_overflow)
return true;
+ bool is_gsub_or_gpos = (table_tag == HB_OT_TAG_GPOS || table_tag == HB_OT_TAG_GSUB);
graph::gsubgpos_graph_context_t ext_context (table_tag, sorted_graph);
- if ((table_tag == HB_OT_TAG_GPOS
- || table_tag == HB_OT_TAG_GSUB)
- && will_overflow)
+ if (is_gsub_or_gpos && will_overflow)
{
- if (recalculate_extensions)
+ DEBUG_MSG (SUBSET_REPACK, nullptr, "Applying GSUB/GPOS repacking specializations.");
+ if (always_recalculate_extensions)
{
DEBUG_MSG (SUBSET_REPACK, nullptr, "Splitting subtables if needed.");
if (!_presplit_subtables_if_needed (ext_context)) {
@@ -412,6 +413,13 @@ hb_resolve_graph_overflows (hb_tag_t table_tag,
if (graph::will_overflow (sorted_graph))
{
+ if (is_gsub_or_gpos && !always_recalculate_extensions) {
+ // If this a GSUB/GPOS table and we didn't try to extension promotion and table splitting then
+ // as a last ditch effort, re-run the repacker with it enabled.
+ DEBUG_MSG (SUBSET_REPACK, nullptr, "Failed to find a resolution. Re-running with extension promotion and table splitting enabled.");
+ return hb_resolve_graph_overflows (table_tag, max_rounds, true, sorted_graph);
+ }
+
DEBUG_MSG (SUBSET_REPACK, nullptr, "Offset overflow resolution failed.");
return false;
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-set-digest.hh b/src/3rdparty/harfbuzz-ng/src/hb-set-digest.hh
index 5681641baa..b718b94e69 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-set-digest.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-set-digest.hh
@@ -82,7 +82,9 @@ struct hb_set_digest_bits_pattern_t
void init () { mask = 0; }
- void add (const hb_set_digest_bits_pattern_t &o) { mask |= o.mask; }
+ static hb_set_digest_bits_pattern_t full () { hb_set_digest_bits_pattern_t d; d.mask = (mask_t) -1; return d; }
+
+ void union_ (const hb_set_digest_bits_pattern_t &o) { mask |= o.mask; }
void add (hb_codepoint_t g) { mask |= mask_for (g); }
@@ -129,11 +131,14 @@ struct hb_set_digest_bits_pattern_t
bool may_have (hb_codepoint_t g) const
{ return mask & mask_for (g); }
+ bool operator [] (hb_codepoint_t g) const
+ { return may_have (g); }
+
private:
static mask_t mask_for (hb_codepoint_t g)
{ return ((mask_t) 1) << ((g >> shift) & (mask_bits - 1)); }
- mask_t mask;
+ mask_t mask = 0;
};
template <typename head_t, typename tail_t>
@@ -145,10 +150,12 @@ struct hb_set_digest_combiner_t
tail.init ();
}
- void add (const hb_set_digest_combiner_t &o)
+ static hb_set_digest_combiner_t full () { hb_set_digest_combiner_t d; d.head = head_t::full(); d.tail = tail_t::full (); return d; }
+
+ void union_ (const hb_set_digest_combiner_t &o)
{
- head.add (o.head);
- tail.add (o.tail);
+ head.union_ (o.head);
+ tail.union_(o.tail);
}
void add (hb_codepoint_t g)
@@ -188,6 +195,9 @@ struct hb_set_digest_combiner_t
return head.may_have (g) && tail.may_have (g);
}
+ bool operator [] (hb_codepoint_t g) const
+ { return may_have (g); }
+
private:
head_t head;
tail_t tail;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-set.hh b/src/3rdparty/harfbuzz-ng/src/hb-set.hh
index ce69ea2c9b..f6013a4141 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-set.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-set.hh
@@ -86,7 +86,7 @@ struct hb_sparseset_t
uint32_t hash () const { return s.hash (); }
void add (hb_codepoint_t g) { s.add (g); }
- bool add_range (hb_codepoint_t a, hb_codepoint_t b) { return s.add_range (a, b); }
+ bool add_range (hb_codepoint_t first, hb_codepoint_t last) { return s.add_range (first, last); }
template <typename T>
void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-subset-cff-common.hh b/src/3rdparty/harfbuzz-ng/src/hb-subset-cff-common.hh
index 462e99cf8c..4039f9c959 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-subset-cff-common.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-subset-cff-common.hh
@@ -115,7 +115,7 @@ struct str_encoder_t
encode_byte (OpCode_BCD);
// Based on:
- // https://github.com/fonttools/fonttools/blob/97ed3a61cde03e17b8be36f866192fbd56f1d1a7/Lib/fontTools/misc/psCharStrings.py#L265-L294
+ // https://github.com/fonttools/fonttools/blob/0738c41dfbcbc213ab9263f486ef0cccc6eb5ce5/Lib/fontTools/misc/psCharStrings.py#L267-L316
char buf[16];
/* FontTools has the following comment:
@@ -133,6 +133,10 @@ struct str_encoder_t
(void) hb_uselocale (((void) freelocale (clocale), oldlocale));
char *s = buf;
+ size_t len;
+ char *comma = strchr (s, ',');
+ if (comma) // Comma for some European locales in case no uselocale available.
+ *comma = '.';
if (s[0] == '0' && s[1] == '.')
s++;
else if (s[0] == '-' && s[1] == '0' && s[2] == '.')
@@ -140,6 +144,45 @@ struct str_encoder_t
s[1] = '-';
s++;
}
+ else if ((len = strlen (s)) > 3 && !strcmp (s + len - 3, "000"))
+ {
+ unsigned exponent = len - 3;
+ char *s2 = s + exponent - 1;
+ while (*s2 == '0' && exponent > 1)
+ {
+ s2--;
+ exponent++;
+ }
+ snprintf (s2 + 1, sizeof (buf) - (s2 + 1 - buf), "E%u", exponent);
+ }
+ else
+ {
+ char *dot = strchr (s, '.');
+ char *e = strchr (s, 'E');
+ if (dot && e)
+ {
+ memmove (dot, dot + 1, e - (dot + 1));
+ int exponent = atoi (e + 1);
+ int new_exponent = exponent - (e - (dot + 1));
+ if (new_exponent == 1)
+ {
+ e[-1] = '0';
+ e[0] = '\0';
+ }
+ else
+ snprintf (e - 1, sizeof (buf) - (e - 1 - buf), "E%d", new_exponent);
+ }
+ }
+ if ((s[0] == '.' && s[1] == '0') || (s[0] == '-' && s[1] == '.' && s[2] == '0'))
+ {
+ int sign = s[0] == '-';
+ char *s2 = s + sign + 1;
+ while (*s2 == '0')
+ s2++;
+ len = strlen (s2);
+ memmove (s + sign, s2, len);
+ snprintf (s + sign + len, sizeof (buf) - (s + sign + len - buf), "E-%u", (unsigned) (strlen (s + sign) - 1));
+ }
hb_vector_t<char> nibbles;
while (*s)
{
@@ -155,20 +198,22 @@ struct str_encoder_t
{
s++;
nibbles.push (0x0C); // E-
- continue;
+ } else {
+ if (c2 == '+')
+ s++;
+ nibbles.push (0x0B); // E
}
- if (c2 == '+')
+ if (*s == '0')
s++;
- nibbles.push (0x0B); // E
continue;
}
- case '.': case ',': // Comma for some European locales in case no uselocale available.
+ case '.':
nibbles.push (0x0A); // .
continue;
case '-':
- nibbles.push (0x0E); // .
+ nibbles.push (0x0E); // -
continue;
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-subset-cff2.cc b/src/3rdparty/harfbuzz-ng/src/hb-subset-cff2.cc
index eb5cb0c625..9c9117d52f 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-subset-cff2.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-subset-cff2.cc
@@ -666,6 +666,9 @@ OT::cff2::accelerator_subset_t::serialize (hb_serialize_context_t *c,
bool
OT::cff2::accelerator_subset_t::subset (hb_subset_context_t *c) const
{
+ if (c->plan->normalized_coords && !c->plan->all_axes_pinned)
+ fprintf (stdout, "warning: CFF partial instancing is not supported.\n");
+
cff2_subset_plan cff2_plan;
if (unlikely (!cff2_plan.create (*this, c->plan))) return false;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-subset-input.cc b/src/3rdparty/harfbuzz-ng/src/hb-subset-input.cc
index 68a3e77788..8974755a75 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-subset-input.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-subset-input.cc
@@ -446,7 +446,7 @@ hb_subset_input_pin_all_axes_to_default (hb_subset_input_t *input,
for (unsigned i = 0; i < axis_count; i++)
{
hb_tag_t axis_tag = axis_infos[i].tag;
- float default_val = axis_infos[i].default_value;
+ double default_val = (double) axis_infos[i].default_value;
if (!input->axes_location.set (axis_tag, Triple (default_val, default_val, default_val)))
{
hb_free (axis_infos);
@@ -481,7 +481,7 @@ hb_subset_input_pin_axis_to_default (hb_subset_input_t *input,
if (!hb_ot_var_find_axis_info (face, axis_tag, &axis_info))
return false;
- float default_val = axis_info.default_value;
+ double default_val = (double) axis_info.default_value;
return input->axes_location.set (axis_tag, Triple (default_val, default_val, default_val));
}
@@ -511,11 +511,10 @@ hb_subset_input_pin_axis_location (hb_subset_input_t *input,
if (!hb_ot_var_find_axis_info (face, axis_tag, &axis_info))
return false;
- float val = hb_clamp(axis_value, axis_info.min_value, axis_info.max_value);
+ double val = hb_clamp((double) axis_value, (double) axis_info.min_value, (double) axis_info.max_value);
return input->axes_location.set (axis_tag, Triple (val, val, val));
}
-#ifdef HB_EXPERIMENTAL_API
/**
* hb_subset_input_set_axis_range: (skip)
* @input: a #hb_subset_input_t object.
@@ -538,7 +537,7 @@ hb_subset_input_pin_axis_location (hb_subset_input_t *input,
*
* Return value: `true` if success, `false` otherwise
*
- * XSince: EXPERIMENTAL
+ * Since: 8.5.0
**/
HB_EXTERN hb_bool_t
hb_subset_input_set_axis_range (hb_subset_input_t *input,
@@ -562,7 +561,7 @@ hb_subset_input_set_axis_range (hb_subset_input_t *input,
float new_min_val = hb_clamp(min, axis_info.min_value, axis_info.max_value);
float new_max_val = hb_clamp(max, axis_info.min_value, axis_info.max_value);
float new_default_val = hb_clamp(def, new_min_val, new_max_val);
- return input->axes_location.set (axis_tag, Triple (new_min_val, new_default_val, new_max_val));
+ return input->axes_location.set (axis_tag, Triple ((double) new_min_val, (double) new_default_val, (double) new_max_val));
}
/**
@@ -577,7 +576,7 @@ hb_subset_input_set_axis_range (hb_subset_input_t *input,
*
* Return value: `true` if a range has been set for this axis tag, `false` otherwise.
*
- * XSince: EXPERIMENTAL
+ * Since: 8.5.0
**/
HB_EXTERN hb_bool_t
hb_subset_input_get_axis_range (hb_subset_input_t *input,
@@ -598,7 +597,6 @@ hb_subset_input_get_axis_range (hb_subset_input_t *input,
return true;
}
#endif
-#endif
/**
* hb_subset_preprocess:
@@ -746,5 +744,4 @@ hb_subset_input_override_name_table (hb_subset_input_t *input,
input->name_table_overrides.set (hb_ot_name_record_ids_t (platform_id, encoding_id, language_id, name_id), name_bytes);
return true;
}
-
#endif
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-iup.cc b/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-iup.cc
index 35a964d082..074657acaf 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-iup.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-iup.cc
@@ -38,7 +38,7 @@ static void _iup_contour_bound_forced_set (const hb_array_t<const contour_point_
const hb_array_t<const int> x_deltas,
const hb_array_t<const int> y_deltas,
hb_set_t& forced_set, /* OUT */
- float tolerance = 0.f)
+ double tolerance = 0.0)
{
unsigned len = contour_points.length;
unsigned next_i = 0;
@@ -47,28 +47,28 @@ static void _iup_contour_bound_forced_set (const hb_array_t<const contour_point_
unsigned last_i = (len + i -1) % len;
for (unsigned j = 0; j < 2; j++)
{
- float cj, lcj, ncj;
+ double cj, lcj, ncj;
int dj, ldj, ndj;
if (j == 0)
{
- cj = contour_points.arrayZ[i].x;
+ cj = static_cast<double> (contour_points.arrayZ[i].x);
dj = x_deltas.arrayZ[i];
- lcj = contour_points.arrayZ[last_i].x;
+ lcj = static_cast<double> (contour_points.arrayZ[last_i].x);
ldj = x_deltas.arrayZ[last_i];
- ncj = contour_points.arrayZ[next_i].x;
+ ncj = static_cast<double> (contour_points.arrayZ[next_i].x);
ndj = x_deltas.arrayZ[next_i];
}
else
{
- cj = contour_points.arrayZ[i].y;
+ cj = static_cast<double> (contour_points.arrayZ[i].y);
dj = y_deltas.arrayZ[i];
- lcj = contour_points.arrayZ[last_i].y;
+ lcj = static_cast<double> (contour_points.arrayZ[last_i].y);
ldj = y_deltas.arrayZ[last_i];
- ncj = contour_points.arrayZ[next_i].y;
+ ncj = static_cast<double> (contour_points.arrayZ[next_i].y);
ndj = y_deltas.arrayZ[next_i];
}
- float c1, c2;
+ double c1, c2;
int d1, d2;
if (lcj <= ncj)
{
@@ -180,8 +180,8 @@ static bool _iup_segment (const hb_array_t<const contour_point_t> contour_points
const contour_point_t& p1, const contour_point_t& p2,
int p1_dx, int p2_dx,
int p1_dy, int p2_dy,
- hb_vector_t<float>& interp_x_deltas, /* OUT */
- hb_vector_t<float>& interp_y_deltas /* OUT */)
+ hb_vector_t<double>& interp_x_deltas, /* OUT */
+ hb_vector_t<double>& interp_y_deltas /* OUT */)
{
unsigned n = contour_points.length;
if (unlikely (!interp_x_deltas.resize (n, false) ||
@@ -190,20 +190,20 @@ static bool _iup_segment (const hb_array_t<const contour_point_t> contour_points
for (unsigned j = 0; j < 2; j++)
{
- float x1, x2, d1, d2;
- float *out;
+ double x1, x2, d1, d2;
+ double *out;
if (j == 0)
{
- x1 = p1.x;
- x2 = p2.x;
+ x1 = static_cast<double> (p1.x);
+ x2 = static_cast<double> (p2.x);
d1 = p1_dx;
d2 = p2_dx;
out = interp_x_deltas.arrayZ;
}
else
{
- x1 = p1.y;
- x2 = p2.y;
+ x1 = static_cast<double> (p1.y);
+ x2 = static_cast<double> (p2.y);
d1 = p1_dy;
d2 = p2_dy;
out = interp_y_deltas.arrayZ;
@@ -219,7 +219,7 @@ static bool _iup_segment (const hb_array_t<const contour_point_t> contour_points
else
{
for (unsigned i = 0; i < n; i++)
- out[i] = 0.f;
+ out[i] = 0.0;
}
continue;
}
@@ -230,11 +230,11 @@ static bool _iup_segment (const hb_array_t<const contour_point_t> contour_points
hb_swap (d1, d2);
}
- float scale = (d2 - d1) / (x2 - x1);
+ double scale = (d2 - d1) / (x2 - x1);
for (unsigned i = 0; i < n; i++)
{
- float x = j == 0 ? contour_points.arrayZ[i].x : contour_points.arrayZ[i].y;
- float d;
+ double x = (j == 0 ? static_cast<double> (contour_points.arrayZ[i].x) : static_cast<double> (contour_points.arrayZ[i].y));
+ double d;
if (x <= x1)
d = d1;
else if (x >= x2)
@@ -254,9 +254,9 @@ static bool _can_iup_in_between (const hb_array_t<const contour_point_t> contour
const contour_point_t& p1, const contour_point_t& p2,
int p1_dx, int p2_dx,
int p1_dy, int p2_dy,
- float tolerance)
+ double tolerance)
{
- hb_vector_t<float> interp_x_deltas, interp_y_deltas;
+ hb_vector_t<double> interp_x_deltas, interp_y_deltas;
if (!_iup_segment (contour_points, x_deltas, y_deltas,
p1, p2, p1_dx, p2_dx, p1_dy, p2_dy,
interp_x_deltas, interp_y_deltas))
@@ -266,10 +266,10 @@ static bool _can_iup_in_between (const hb_array_t<const contour_point_t> contour
for (unsigned i = 0; i < num; i++)
{
- float dx = x_deltas.arrayZ[i] - interp_x_deltas.arrayZ[i];
- float dy = y_deltas.arrayZ[i] - interp_y_deltas.arrayZ[i];
+ double dx = static_cast<double> (x_deltas.arrayZ[i]) - interp_x_deltas.arrayZ[i];
+ double dy = static_cast<double> (y_deltas.arrayZ[i]) - interp_y_deltas.arrayZ[i];
- if (sqrtf ((float)dx * dx + (float)dy * dy) > tolerance)
+ if (sqrt (dx * dx + dy * dy) > tolerance)
return false;
}
return true;
@@ -279,7 +279,7 @@ static bool _iup_contour_optimize_dp (const contour_point_vector_t& contour_poin
const hb_vector_t<int>& x_deltas,
const hb_vector_t<int>& y_deltas,
const hb_set_t& forced_set,
- float tolerance,
+ double tolerance,
unsigned lookback,
hb_vector_t<unsigned>& costs, /* OUT */
hb_vector_t<int>& chain /* OUT */)
@@ -333,7 +333,7 @@ static bool _iup_contour_optimize (const hb_array_t<const contour_point_t> conto
const hb_array_t<const int> x_deltas,
const hb_array_t<const int> y_deltas,
hb_array_t<bool> opt_indices, /* OUT */
- float tolerance = 0.f)
+ double tolerance = 0.0)
{
unsigned n = contour_points.length;
if (opt_indices.length != n ||
@@ -346,7 +346,7 @@ static bool _iup_contour_optimize (const hb_array_t<const contour_point_t> conto
{
int dx = x_deltas.arrayZ[i];
int dy = y_deltas.arrayZ[i];
- if (sqrtf ((float)dx * dx + (float)dy * dy) > tolerance)
+ if (sqrt ((double) dx * dx + (double) dy * dy) > tolerance)
{
all_within_tolerance = false;
break;
@@ -443,11 +443,11 @@ static bool _iup_contour_optimize (const hb_array_t<const contour_point_t> conto
unsigned contour_point_size = hb_static_size (contour_point_t);
for (unsigned i = 0; i < n; i++)
{
- hb_memcpy ((void *) repeat_x_deltas.arrayZ, (const void *) x_deltas.arrayZ, n * sizeof (float));
- hb_memcpy ((void *) (repeat_x_deltas.arrayZ + n), (const void *) x_deltas.arrayZ, n * sizeof (float));
+ hb_memcpy ((void *) repeat_x_deltas.arrayZ, (const void *) x_deltas.arrayZ, n * sizeof (repeat_x_deltas[0]));
+ hb_memcpy ((void *) (repeat_x_deltas.arrayZ + n), (const void *) x_deltas.arrayZ, n * sizeof (repeat_x_deltas[0]));
- hb_memcpy ((void *) repeat_y_deltas.arrayZ, (const void *) y_deltas.arrayZ, n * sizeof (float));
- hb_memcpy ((void *) (repeat_y_deltas.arrayZ + n), (const void *) y_deltas.arrayZ, n * sizeof (float));
+ hb_memcpy ((void *) repeat_y_deltas.arrayZ, (const void *) y_deltas.arrayZ, n * sizeof (repeat_x_deltas[0]));
+ hb_memcpy ((void *) (repeat_y_deltas.arrayZ + n), (const void *) y_deltas.arrayZ, n * sizeof (repeat_x_deltas[0]));
hb_memcpy ((void *) repeat_points.arrayZ, (const void *) contour_points.arrayZ, n * contour_point_size);
hb_memcpy ((void *) (repeat_points.arrayZ + n), (const void *) contour_points.arrayZ, n * contour_point_size);
@@ -496,7 +496,7 @@ bool iup_delta_optimize (const contour_point_vector_t& contour_points,
const hb_vector_t<int>& x_deltas,
const hb_vector_t<int>& y_deltas,
hb_vector_t<bool>& opt_indices, /* OUT */
- float tolerance)
+ double tolerance)
{
if (!opt_indices.resize (contour_points.length))
return false;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-iup.hh b/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-iup.hh
index 7eac5935a4..01987bd258 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-iup.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-iup.hh
@@ -32,6 +32,6 @@ HB_INTERNAL bool iup_delta_optimize (const contour_point_vector_t& contour_point
const hb_vector_t<int>& x_deltas,
const hb_vector_t<int>& y_deltas,
hb_vector_t<bool>& opt_indices, /* OUT */
- float tolerance = 0.f);
+ double tolerance = 0.0);
#endif /* HB_SUBSET_INSTANCER_IUP_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-solver.cc b/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-solver.cc
index 70783c0a0d..ca903e2707 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-solver.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-solver.cc
@@ -32,17 +32,17 @@
* This should be safe.
*/
-constexpr static float EPSILON = 1.f / (1 << 14);
-constexpr static float MAX_F2DOT14 = float (0x7FFF) / (1 << 14);
+constexpr static double EPSILON = 1.0 / (1 << 14);
+constexpr static double MAX_F2DOT14 = double (0x7FFF) / (1 << 14);
static inline Triple _reverse_negate(const Triple &v)
{ return {-v.maximum, -v.middle, -v.minimum}; }
-static inline float supportScalar (float coord, const Triple &tent)
+static inline double supportScalar (double coord, const Triple &tent)
{
/* Copied from VarRegionAxis::evaluate() */
- float start = tent.minimum, peak = tent.middle, end = tent.maximum;
+ double start = tent.minimum, peak = tent.middle, end = tent.maximum;
if (unlikely (start > peak || peak > end))
return 1.;
@@ -62,20 +62,20 @@ static inline float supportScalar (float coord, const Triple &tent)
return (end - coord) / (end - peak);
}
-static inline result_t
+static inline rebase_tent_result_t
_solve (Triple tent, Triple axisLimit, bool negative = false)
{
- float axisMin = axisLimit.minimum;
- float axisDef = axisLimit.middle;
- float axisMax = axisLimit.maximum;
- float lower = tent.minimum;
- float peak = tent.middle;
- float upper = tent.maximum;
+ double axisMin = axisLimit.minimum;
+ double axisDef = axisLimit.middle;
+ double axisMax = axisLimit.maximum;
+ double lower = tent.minimum;
+ double peak = tent.middle;
+ double upper = tent.maximum;
// Mirror the problem such that axisDef <= peak
if (axisDef > peak)
{
- result_t vec = _solve (_reverse_negate (tent),
+ rebase_tent_result_t vec = _solve (_reverse_negate (tent),
_reverse_negate (axisLimit),
!negative);
@@ -98,7 +98,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
* axisMin axisDef axisMax lower upper
*/
if (axisMax <= lower && axisMax < peak)
- return result_t{}; // No overlap
+ return rebase_tent_result_t{}; // No overlap
/* case 2: Only the peak and outermost bound fall outside the new limit;
* we keep the deltaset, update peak and outermost bound and scale deltas
@@ -130,10 +130,10 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
*/
if (axisMax < peak)
{
- float mult = supportScalar (axisMax, tent);
+ double mult = supportScalar (axisMax, tent);
tent = Triple{lower, axisMax, axisMax};
- result_t vec = _solve (tent, axisLimit);
+ rebase_tent_result_t vec = _solve (tent, axisLimit);
for (auto &p : vec)
p = hb_pair (p.first * mult, p.second);
@@ -143,13 +143,13 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
// lower <= axisDef <= peak <= axisMax
- float gain = supportScalar (axisDef, tent);
- result_t out {hb_pair (gain, Triple{})};
+ double gain = supportScalar (axisDef, tent);
+ rebase_tent_result_t out {hb_pair (gain, Triple{})};
// First, the positive side
// outGain is the scalar of axisMax at the tent.
- float outGain = supportScalar (axisMax, tent);
+ double outGain = supportScalar (axisMax, tent);
/* Case 3a: Gain is more than outGain. The tent down-slope crosses
* the axis into negative. We have to split it into multiples.
@@ -173,10 +173,10 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
// Note that this is the branch taken if both gain and outGain are 0.
// Crossing point on the axis.
- float crossing = peak + (1 - gain) * (upper - peak);
+ double crossing = peak + (1 - gain) * (upper - peak);
Triple loc{hb_max (lower, axisDef), peak, crossing};
- float scalar = 1.f;
+ double scalar = 1.0;
// The part before the crossing point.
out.push (hb_pair (scalar - gain, loc));
@@ -191,7 +191,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
if (upper >= axisMax)
{
Triple loc {crossing, axisMax, axisMax};
- float scalar = outGain;
+ double scalar = outGain;
out.push (hb_pair (scalar - gain, loc));
}
@@ -221,11 +221,11 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
// Downslope.
Triple loc1 {crossing, upper, axisMax};
- float scalar1 = 0.f;
+ double scalar1 = 0.0;
// Eternity justify.
Triple loc2 {upper, axisMax, axisMax};
- float scalar2 = 0.f;
+ double scalar2 = 0.0;
out.push (hb_pair (scalar1 - gain, loc1));
out.push (hb_pair (scalar2 - gain, loc2));
@@ -254,11 +254,11 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
* | | newUpper
* axisDef axisMax
*/
- float newUpper = peak + (1 - gain) * (upper - peak);
+ double newUpper = peak + (1 - gain) * (upper - peak);
assert (axisMax <= newUpper); // Because outGain > gain
/* Disabled because ots doesn't like us:
* https://github.com/fonttools/fonttools/issues/3350 */
-
+
if (false && (newUpper <= axisDef + (axisMax - axisDef) * 2))
{
upper = newUpper;
@@ -270,7 +270,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
}
Triple loc {hb_max (axisDef, lower), peak, upper};
- float scalar = 1.f;
+ double scalar = 1.0;
out.push (hb_pair (scalar - gain, loc));
}
@@ -294,10 +294,10 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
else
{
Triple loc1 {hb_max (axisDef, lower), peak, axisMax};
- float scalar1 = 1.f;
+ double scalar1 = 1.0;
Triple loc2 {peak, axisMax, axisMax};
- float scalar2 = outGain;
+ double scalar2 = outGain;
out.push (hb_pair (scalar1 - gain, loc1));
// Don't add a dirac delta!
@@ -325,7 +325,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
if (lower <= axisMin)
{
Triple loc {axisMin, axisMin, axisDef};
- float scalar = supportScalar (axisMin, tent);
+ double scalar = supportScalar (axisMin, tent);
out.push (hb_pair (scalar - gain, loc));
}
@@ -353,11 +353,11 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
// Downslope.
Triple loc1 {axisMin, lower, axisDef};
- float scalar1 = 0.f;
+ double scalar1 = 0.0;
// Eternity justify.
Triple loc2 {axisMin, axisMin, lower};
- float scalar2 = 0.f;
+ double scalar2 = 0.0;
out.push (hb_pair (scalar1 - gain, loc1));
out.push (hb_pair (scalar2 - gain, loc2));
@@ -369,19 +369,19 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
static inline TripleDistances _reverse_triple_distances (const TripleDistances &v)
{ return TripleDistances (v.positive, v.negative); }
-float renormalizeValue (float v, const Triple &triple,
- const TripleDistances &triple_distances, bool extrapolate)
+double renormalizeValue (double v, const Triple &triple,
+ const TripleDistances &triple_distances, bool extrapolate)
{
- float lower = triple.minimum, def = triple.middle, upper = triple.maximum;
+ double lower = triple.minimum, def = triple.middle, upper = triple.maximum;
assert (lower <= def && def <= upper);
if (!extrapolate)
v = hb_max (hb_min (v, upper), lower);
if (v == def)
- return 0.f;
+ return 0.0;
- if (def < 0.f)
+ if (def < 0.0)
return -renormalizeValue (-v, _reverse_negate (triple),
_reverse_triple_distances (triple_distances), extrapolate);
@@ -390,14 +390,14 @@ float renormalizeValue (float v, const Triple &triple,
return (v - def) / (upper - def);
/* v < def */
- if (lower >= 0.f)
+ if (lower >= 0.0)
return (v - def) / (def - lower);
/* lower < 0 and v < default */
- float total_distance = triple_distances.negative * (-lower) + triple_distances.positive * def;
+ double total_distance = triple_distances.negative * (-lower) + triple_distances.positive * def;
- float v_distance;
- if (v >= 0.f)
+ double v_distance;
+ if (v >= 0.0)
v_distance = (def - v) * triple_distances.positive;
else
v_distance = (-v) * triple_distances.negative + triple_distances.positive * def;
@@ -405,18 +405,18 @@ float renormalizeValue (float v, const Triple &triple,
return (-v_distance) /total_distance;
}
-result_t
+rebase_tent_result_t
rebase_tent (Triple tent, Triple axisLimit, TripleDistances axis_triple_distances)
{
- assert (-1.f <= axisLimit.minimum && axisLimit.minimum <= axisLimit.middle && axisLimit.middle <= axisLimit.maximum && axisLimit.maximum <= +1.f);
- assert (-2.f <= tent.minimum && tent.minimum <= tent.middle && tent.middle <= tent.maximum && tent.maximum <= +2.f);
- assert (tent.middle != 0.f);
+ assert (-1.0 <= axisLimit.minimum && axisLimit.minimum <= axisLimit.middle && axisLimit.middle <= axisLimit.maximum && axisLimit.maximum <= +1.0);
+ assert (-2.0 <= tent.minimum && tent.minimum <= tent.middle && tent.middle <= tent.maximum && tent.maximum <= +2.0);
+ assert (tent.middle != 0.0);
- result_t sols = _solve (tent, axisLimit);
+ rebase_tent_result_t sols = _solve (tent, axisLimit);
- auto n = [&axisLimit, &axis_triple_distances] (float v) { return renormalizeValue (v, axisLimit, axis_triple_distances); };
+ auto n = [&axisLimit, &axis_triple_distances] (double v) { return renormalizeValue (v, axisLimit, axis_triple_distances); };
- result_t out;
+ rebase_tent_result_t out;
for (auto &p : sols)
{
if (!p.first) continue;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-solver.hh b/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-solver.hh
index 563fccbb59..9aac9fcc7e 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-solver.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-subset-instancer-solver.hh
@@ -30,24 +30,24 @@
/* pre-normalized distances */
struct TripleDistances
{
- TripleDistances (): negative (1.f), positive (1.f) {}
- TripleDistances (float neg_, float pos_): negative (neg_), positive (pos_) {}
- TripleDistances (float min, float default_, float max)
+ TripleDistances (): negative (1.0), positive (1.0) {}
+ TripleDistances (double neg_, double pos_): negative (neg_), positive (pos_) {}
+ TripleDistances (double min, double default_, double max)
{
negative = default_ - min;
positive = max - default_;
}
- float negative;
- float positive;
+ double negative;
+ double positive;
};
struct Triple {
Triple () :
- minimum (0.f), middle (0.f), maximum (0.f) {}
+ minimum (0.0), middle (0.0), maximum (0.0) {}
- Triple (float minimum_, float middle_, float maximum_) :
+ Triple (double minimum_, double middle_, double maximum_) :
minimum (minimum_), middle (middle_), maximum (maximum_) {}
bool operator == (const Triple &o) const
@@ -63,7 +63,7 @@ struct Triple {
bool is_point () const
{ return minimum == middle && middle == maximum; }
- bool contains (float point) const
+ bool contains (double point) const
{ return minimum <= point && point <= maximum; }
/* from hb_array_t hash ()*/
@@ -82,18 +82,18 @@ struct Triple {
}
- float minimum;
- float middle;
- float maximum;
+ double minimum;
+ double middle;
+ double maximum;
};
-using result_item_t = hb_pair_t<float, Triple>;
-using result_t = hb_vector_t<result_item_t>;
+using rebase_tent_result_item_t = hb_pair_t<double, Triple>;
+using rebase_tent_result_t = hb_vector_t<rebase_tent_result_item_t>;
/* renormalize a normalized value v to the range of an axis,
* considering the prenormalized distances as well as the new axis limits.
* Ported from fonttools */
-HB_INTERNAL float renormalizeValue (float v, const Triple &triple,
+HB_INTERNAL double renormalizeValue (double v, const Triple &triple,
const TripleDistances &triple_distances,
bool extrapolate = true);
/* Given a tuple (lower,peak,upper) "tent" and new axis limits
@@ -107,6 +107,8 @@ HB_INTERNAL float renormalizeValue (float v, const Triple &triple,
* If tent value is Triple{}, that is a special deltaset that should
* be always-enabled (called "gain").
*/
-HB_INTERNAL result_t rebase_tent (Triple tent, Triple axisLimit, TripleDistances axis_triple_distances);
+HB_INTERNAL rebase_tent_result_t rebase_tent (Triple tent,
+ Triple axisLimit,
+ TripleDistances axis_triple_distances);
#endif /* HB_SUBSET_INSTANCER_SOLVER_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-subset-plan-member-list.hh b/src/3rdparty/harfbuzz-ng/src/hb-subset-plan-member-list.hh
index 74416b92f9..ade8278c40 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-subset-plan-member-list.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-subset-plan-member-list.hh
@@ -102,6 +102,12 @@ HB_SUBSET_PLAN_MEMBER (hb_hashmap_t E(<unsigned, hb_pair_t E(<const void*, const
//active layers/palettes we'd like to retain
HB_SUBSET_PLAN_MEMBER (hb_map_t, colrv1_layers)
HB_SUBSET_PLAN_MEMBER (hb_map_t, colr_palettes)
+//colrv1 varstore retained varidx mapping
+HB_SUBSET_PLAN_MEMBER (hb_vector_t<hb_inc_bimap_t>, colrv1_varstore_inner_maps)
+//colrv1 retained varidx -> (new varidx, delta) mapping
+HB_SUBSET_PLAN_MEMBER (mutable hb_hashmap_t E(<unsigned, hb_pair_t E(<unsigned, int>)>), colrv1_variation_idx_delta_map)
+//colrv1 retained new delta set index -> new varidx mapping
+HB_SUBSET_PLAN_MEMBER (hb_map_t, colrv1_new_deltaset_idx_varidx_map)
//Old layout item variation index -> (New varidx, delta) mapping
HB_SUBSET_PLAN_MEMBER (mutable hb_hashmap_t E(<unsigned, hb_pair_t E(<unsigned, int>)>), layout_variation_idx_delta_map)
@@ -144,7 +150,7 @@ HB_SUBSET_PLAN_MEMBER (mutable hb_hashmap_t E(<hb_codepoint_t, contour_point_vec
HB_SUBSET_PLAN_MEMBER (hb_set_t, composite_new_gids)
//Old BASE item variation index -> (New varidx, 0) mapping
-HB_SUBSET_PLAN_MEMBER (hb_hashmap_t E(<unsigned, hb_pair_t E(<unsigned, int>)>), base_variation_idx_map)
+HB_SUBSET_PLAN_MEMBER (mutable hb_hashmap_t E(<unsigned, hb_pair_t E(<unsigned, int>)>), base_variation_idx_map)
//BASE table varstore retained varidx mapping
HB_SUBSET_PLAN_MEMBER (hb_vector_t<hb_inc_bimap_t>, base_varstore_inner_maps)
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-subset-plan.cc b/src/3rdparty/harfbuzz-ng/src/hb-subset-plan.cc
index 068fddaedd..d657790d54 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-subset-plan.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-subset-plan.cc
@@ -399,12 +399,55 @@ _get_hb_font_with_variations (const hb_subset_plan_t *plan)
}
static inline void
+_remap_variation_indices (const OT::ItemVariationStore &var_store,
+ const hb_set_t &variation_indices,
+ const hb_vector_t<int>& normalized_coords,
+ bool calculate_delta, /* not pinned at default */
+ bool no_variations, /* all axes pinned */
+ hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> &variation_idx_delta_map /* OUT */)
+{
+ if (&var_store == &Null (OT::ItemVariationStore)) return;
+ unsigned subtable_count = var_store.get_sub_table_count ();
+ float *store_cache = var_store.create_cache ();
+
+ unsigned new_major = 0, new_minor = 0;
+ unsigned last_major = (variation_indices.get_min ()) >> 16;
+ for (unsigned idx : variation_indices)
+ {
+ int delta = 0;
+ if (calculate_delta)
+ delta = roundf (var_store.get_delta (idx, normalized_coords.arrayZ,
+ normalized_coords.length, store_cache));
+
+ if (no_variations)
+ {
+ variation_idx_delta_map.set (idx, hb_pair_t<unsigned, int> (HB_OT_LAYOUT_NO_VARIATIONS_INDEX, delta));
+ continue;
+ }
+
+ uint16_t major = idx >> 16;
+ if (major >= subtable_count) break;
+ if (major != last_major)
+ {
+ new_minor = 0;
+ ++new_major;
+ }
+
+ unsigned new_idx = (new_major << 16) + new_minor;
+ variation_idx_delta_map.set (idx, hb_pair_t<unsigned, int> (new_idx, delta));
+ ++new_minor;
+ last_major = major;
+ }
+ var_store.destroy_cache (store_cache);
+}
+
+static inline void
_collect_layout_variation_indices (hb_subset_plan_t* plan)
{
hb_blob_ptr_t<OT::GDEF> gdef = plan->source_table<OT::GDEF> ();
hb_blob_ptr_t<GPOS> gpos = plan->source_table<GPOS> ();
- if (!gdef->has_data ())
+ if (!gdef->has_data () || !gdef->has_var_store ())
{
gdef.destroy ();
gpos.destroy ();
@@ -420,13 +463,13 @@ _collect_layout_variation_indices (hb_subset_plan_t* plan)
if (hb_ot_layout_has_positioning (plan->source))
gpos->collect_variation_indices (&c);
- gdef->remap_layout_variation_indices (&varidx_set,
- plan->normalized_coords,
- !plan->pinned_at_default,
- plan->all_axes_pinned,
- &plan->layout_variation_idx_delta_map);
+ _remap_variation_indices (gdef->get_var_store (),
+ varidx_set, plan->normalized_coords,
+ !plan->pinned_at_default,
+ plan->all_axes_pinned,
+ plan->layout_variation_idx_delta_map);
- unsigned subtable_count = gdef->has_var_store () ? gdef->get_var_store ().get_sub_table_count () : 0;
+ unsigned subtable_count = gdef->get_var_store ().get_sub_table_count ();
_generate_varstore_inner_maps (varidx_set, subtable_count, plan->gdef_varstore_inner_maps);
gdef.destroy ();
@@ -434,31 +477,6 @@ _collect_layout_variation_indices (hb_subset_plan_t* plan)
}
#ifndef HB_NO_BASE
-/* used by BASE table only, delta is always set to 0 in the output map */
-static inline void
-_remap_variation_indices (const hb_set_t& indices,
- unsigned subtable_count,
- hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>>& variation_idx_delta_map /* OUT */)
-{
- unsigned new_major = 0, new_minor = 0;
- unsigned last_major = (indices.get_min ()) >> 16;
- for (unsigned idx : indices)
- {
- uint16_t major = idx >> 16;
- if (major >= subtable_count) break;
- if (major != last_major)
- {
- new_minor = 0;
- ++new_major;
- }
-
- unsigned new_idx = (new_major << 16) + new_minor;
- variation_idx_delta_map.set (idx, hb_pair_t<unsigned, int> (new_idx, 0));
- ++new_minor;
- last_major = major;
- }
-}
-
static inline void
_collect_base_variation_indices (hb_subset_plan_t* plan)
{
@@ -471,12 +489,20 @@ _collect_base_variation_indices (hb_subset_plan_t* plan)
hb_set_t varidx_set;
base->collect_variation_indices (plan, varidx_set);
- unsigned subtable_count = base->get_var_store ().get_sub_table_count ();
- base.destroy ();
-
- _remap_variation_indices (varidx_set, subtable_count, plan->base_variation_idx_map);
+ const OT::ItemVariationStore &var_store = base->get_var_store ();
+ unsigned subtable_count = var_store.get_sub_table_count ();
+
+
+ _remap_variation_indices (var_store, varidx_set,
+ plan->normalized_coords,
+ !plan->pinned_at_default,
+ plan->all_axes_pinned,
+ plan->base_variation_idx_map);
_generate_varstore_inner_maps (varidx_set, subtable_count, plan->base_varstore_inner_maps);
+
+ base.destroy ();
}
+
#endif
#endif
@@ -489,12 +515,43 @@ _cmap_closure (hb_face_t *face,
cmap.table->closure_glyphs (unicodes, glyphset);
}
-static void _colr_closure (hb_face_t *face,
- hb_map_t *layers_map,
- hb_map_t *palettes_map,
+static void
+_remap_colrv1_delta_set_index_indices (const OT::DeltaSetIndexMap &index_map,
+ const hb_set_t &delta_set_idxes,
+ hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> &variation_idx_delta_map, /* IN/OUT */
+ hb_map_t &new_deltaset_idx_varidx_map /* OUT */)
+{
+ if (!index_map.get_map_count ())
+ return;
+
+ hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> delta_set_idx_delta_map;
+ unsigned new_delta_set_idx = 0;
+ for (unsigned delta_set_idx : delta_set_idxes)
+ {
+ unsigned var_idx = index_map.map (delta_set_idx);
+ unsigned new_varidx = HB_OT_LAYOUT_NO_VARIATIONS_INDEX;
+ int delta = 0;
+
+ if (var_idx != HB_OT_LAYOUT_NO_VARIATIONS_INDEX)
+ {
+ hb_pair_t<unsigned, int> *new_varidx_delta;
+ if (!variation_idx_delta_map.has (var_idx, &new_varidx_delta)) continue;
+
+ new_varidx = hb_first (*new_varidx_delta);
+ delta = hb_second (*new_varidx_delta);
+ }
+
+ new_deltaset_idx_varidx_map.set (new_delta_set_idx, new_varidx);
+ delta_set_idx_delta_map.set (delta_set_idx, hb_pair_t<unsigned, int> (new_delta_set_idx, delta));
+ new_delta_set_idx++;
+ }
+ variation_idx_delta_map = std::move (delta_set_idx_delta_map);
+}
+
+static void _colr_closure (hb_subset_plan_t* plan,
hb_set_t *glyphs_colred)
{
- OT::COLR::accelerator_t colr (face);
+ OT::COLR::accelerator_t colr (plan->source);
if (!colr.is_valid ()) return;
hb_set_t palette_indices, layer_indices;
@@ -506,11 +563,43 @@ static void _colr_closure (hb_face_t *face,
glyphs_colred->union_ (glyphset_colrv0);
//closure for COLRv1
- colr.closure_forV1 (glyphs_colred, &layer_indices, &palette_indices);
+ hb_set_t variation_indices, delta_set_indices;
+ colr.closure_forV1 (glyphs_colred, &layer_indices, &palette_indices, &variation_indices, &delta_set_indices);
colr.closure_V0palette_indices (glyphs_colred, &palette_indices);
- _remap_indexes (&layer_indices, layers_map);
- _remap_palette_indexes (&palette_indices, palettes_map);
+ _remap_indexes (&layer_indices, &plan->colrv1_layers);
+ _remap_palette_indexes (&palette_indices, &plan->colr_palettes);
+
+ if (!colr.has_var_store () || !variation_indices) return;
+
+ const OT::ItemVariationStore &var_store = colr.get_var_store ();
+ // generated inner_maps is used by ItemVariationStore serialize(), which is subset only
+ unsigned subtable_count = var_store.get_sub_table_count ();
+ _generate_varstore_inner_maps (variation_indices, subtable_count, plan->colrv1_varstore_inner_maps);
+
+ /* colr variation indices mapping during planning phase:
+ * generate colrv1_variation_idx_delta_map. When delta set index map is not
+ * included, it's a mapping from varIdx-> (new varIdx,delta). Otherwise, it's
+ * a mapping from old delta set idx-> (new delta set idx, delta). Mapping
+ * delta set indices is the same as gid mapping.
+ * Besides, we need to generate a delta set idx-> new var_idx map for updating
+ * delta set index map if exists. This map will be updated again after
+ * instancing. */
+ if (!plan->all_axes_pinned)
+ {
+ _remap_variation_indices (var_store,
+ variation_indices,
+ plan->normalized_coords,
+ false, /* no need to calculate delta for COLR during planning */
+ plan->all_axes_pinned,
+ plan->colrv1_variation_idx_delta_map);
+
+ if (colr.has_delta_set_index_map ())
+ _remap_colrv1_delta_set_index_indices (colr.get_delta_set_index_map (),
+ delta_set_indices,
+ plan->colrv1_variation_idx_delta_map,
+ plan->colrv1_new_deltaset_idx_varidx_map);
+ }
}
static inline void
@@ -821,7 +910,7 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
hb_set_t cur_glyphset = plan->_glyphset_mathed;
if (!drop_tables->has (HB_OT_TAG_COLR))
{
- _colr_closure (plan->source, &plan->colrv1_layers, &plan->colr_palettes, &cur_glyphset);
+ _colr_closure (plan, &cur_glyphset);
_remove_invalid_gids (&cur_glyphset, plan->source->get_num_glyphs ());
}
@@ -1016,9 +1105,9 @@ _normalize_axes_location (hb_face_t *face, hb_subset_plan_t *plan)
normalized_default = seg_maps->map (normalized_default);
normalized_max = seg_maps->map (normalized_max);
}
- plan->axes_location.set (axis_tag, Triple (static_cast<float> (normalized_min / 16384.f),
- static_cast<float> (normalized_default / 16384.f),
- static_cast<float> (normalized_max / 16384.f)));
+ plan->axes_location.set (axis_tag, Triple (static_cast<double> (normalized_min / 16384.0),
+ static_cast<double> (normalized_default / 16384.0),
+ static_cast<double> (normalized_max / 16384.0)));
if (normalized_default != 0)
plan->pinned_at_default = false;
@@ -1145,11 +1234,9 @@ _get_instance_glyphs_contour_points (hb_subset_plan_t *plan)
if (unlikely (!plan->new_gid_contour_points_map.set (new_gid, all_points)))
return false;
-#ifdef HB_EXPERIMENTAL_API
/* composite new gids are only needed by iup delta optimization */
if ((plan->flags & HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS) && glyph.is_composite ())
plan->composite_new_gids.add (new_gid);
-#endif
}
return true;
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-subset.h b/src/3rdparty/harfbuzz-ng/src/hb-subset.h
index 73dcae4660..365c21a630 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-subset.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-subset.h
@@ -73,11 +73,11 @@ typedef struct hb_subset_plan_t hb_subset_plan_t;
* OS/2 will not be recalculated.
* @HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE: If set don't perform glyph closure on layout
* substitution rules (GSUB). Since: 7.2.0.
+ * @HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS: If set perform IUP delta optimization on the
+ * remaining gvar table's deltas. Since: 8.5.0
* @HB_SUBSET_FLAGS_IFTB_REQUIREMENTS: If set enforce requirements on the output subset
* to allow it to be used with incremental font transfer IFTB patches. Primarily,
* this forces all outline data to use long (32 bit) offsets. Since: EXPERIMENTAL
- * @HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS: If set perform IUP delta optimization on the
- * remaining gvar table's deltas. Since: EXPERIMENTAL
*
* List of boolean properties that can be configured on the subset input.
*
@@ -95,9 +95,9 @@ typedef enum { /*< flags >*/
HB_SUBSET_FLAGS_GLYPH_NAMES = 0x00000080u,
HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES = 0x00000100u,
HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE = 0x00000200u,
+ HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS = 0x00000400u,
#ifdef HB_EXPERIMENTAL_API
- HB_SUBSET_FLAGS_IFTB_REQUIREMENTS = 0x00000400u,
- HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS = 0x00000800u,
+ HB_SUBSET_FLAGS_IFTB_REQUIREMENTS = 0x00000800u,
#endif
} hb_subset_flags_t;
@@ -188,7 +188,6 @@ hb_subset_input_pin_axis_location (hb_subset_input_t *input,
hb_tag_t axis_tag,
float axis_value);
-#ifdef HB_EXPERIMENTAL_API
HB_EXTERN hb_bool_t
hb_subset_input_get_axis_range (hb_subset_input_t *input,
hb_tag_t axis_tag,
@@ -204,6 +203,7 @@ hb_subset_input_set_axis_range (hb_subset_input_t *input,
float axis_max_value,
float axis_def_value);
+#ifdef HB_EXPERIMENTAL_API
HB_EXTERN hb_bool_t
hb_subset_input_override_name_table (hb_subset_input_t *input,
hb_ot_name_id_t name_id,
@@ -212,7 +212,6 @@ hb_subset_input_override_name_table (hb_subset_input_t *input,
unsigned language_id,
const char *name_str,
int str_len);
-
#endif
HB_EXTERN hb_face_t *
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-version.h b/src/3rdparty/harfbuzz-ng/src/hb-version.h
index 68681874ca..abffbdae9c 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-version.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-version.h
@@ -47,7 +47,7 @@ HB_BEGIN_DECLS
*
* The minor component of the library version available at compile-time.
*/
-#define HB_VERSION_MINOR 4
+#define HB_VERSION_MINOR 5
/**
* HB_VERSION_MICRO:
*
@@ -60,7 +60,7 @@ HB_BEGIN_DECLS
*
* A string literal containing the library version available at compile-time.
*/
-#define HB_VERSION_STRING "8.4.0"
+#define HB_VERSION_STRING "8.5.0"
/**
* HB_VERSION_ATLEAST:
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-wasm-api.h b/src/3rdparty/harfbuzz-ng/src/hb-wasm-api.h
index f9bd98e5ea..bb977eeb13 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-wasm-api.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-wasm-api.h
@@ -27,6 +27,9 @@
/*
#include "hb.h"
+
+HB_BEGIN_DECLS
+HB_END_DECLS
*/
#include <stdint.h>
diff --git a/src/3rdparty/libjpeg/LICENSE b/src/3rdparty/libjpeg/LICENSE
index bf8a7fda7f..2204864fa1 100644
--- a/src/3rdparty/libjpeg/LICENSE
+++ b/src/3rdparty/libjpeg/LICENSE
@@ -1,30 +1,33 @@
libjpeg-turbo Licenses
======================
-libjpeg-turbo is covered by three compatible BSD-style open source licenses:
+libjpeg-turbo is covered by two compatible BSD-style open source licenses:
- The IJG (Independent JPEG Group) License, which is listed in
[README.ijg](README.ijg)
- This license applies to the libjpeg API library and associated programs
- (any code inherited from libjpeg, and any modifications to that code.)
+ This license applies to the libjpeg API library and associated programs,
+ including any code inherited from libjpeg and any modifications to that
+ code. Note that the libjpeg-turbo SIMD source code bears the
+ [zlib License](https://opensource.org/licenses/Zlib), but in the context of
+ the overall libjpeg API library, the terms of the zlib License are subsumed
+ by the terms of the IJG License.
- The Modified (3-clause) BSD License, which is listed below
- This license covers the TurboJPEG API library and associated programs, as
- well as the build system.
-
-- The [zlib License](https://opensource.org/licenses/Zlib)
-
- This license is a subset of the other two, and it covers the libjpeg-turbo
- SIMD extensions.
+ This license applies to the TurboJPEG API library and associated programs, as
+ well as the build system. Note that the TurboJPEG API library wraps the
+ libjpeg API library, so in the context of the overall TurboJPEG API library,
+ both the terms of the IJG License and the terms of the Modified (3-clause)
+ BSD License apply.
Complying with the libjpeg-turbo Licenses
=========================================
This section provides a roll-up of the libjpeg-turbo licensing terms, to the
-best of our understanding.
+best of our understanding. This is not a license in and of itself. It is
+intended solely for clarification.
1. If you are distributing a modified version of the libjpeg-turbo source,
then:
@@ -38,7 +41,7 @@ best of our understanding.
- Clauses 1 and 3 of the zlib License
2. You must add your own copyright notice to the header of each source
- file you modified, so others can tell that you modified that file (if
+ file you modified, so others can tell that you modified that file. (If
there is not an existing copyright header in that file, then you can
simply add a notice stating that you modified the file.)
@@ -119,8 +122,8 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-Why Three Licenses?
-===================
+Why Two Licenses?
+=================
The zlib License could have been used instead of the Modified (3-clause) BSD
License, and since the IJG License effectively subsumes the distribution
diff --git a/src/3rdparty/libjpeg/import_from_libjpeg_tarball.sh b/src/3rdparty/libjpeg/import_from_libjpeg_tarball.sh
index fea6c5c9b4..0c984a8eed 100755
--- a/src/3rdparty/libjpeg/import_from_libjpeg_tarball.sh
+++ b/src/3rdparty/libjpeg/import_from_libjpeg_tarball.sh
@@ -145,7 +145,7 @@ sed -i -e "s/@COPYRIGHT_YEAR@/$cyear/" $TARGET_DIR/src/jversion.h
sed -n -e 's/^[ ]*"//
s/\(\\n\)*"[ ]*\\*$//
- /JCOPYRIGHT\ /,/^[ ]*$/ {
+ /JCOPYRIGHT.\ /,/^[ ]*$/ {
/Copyright/p
}
' $TARGET_DIR/src/jversion.h > $TARGET_DIR/COPYRIGHT.txt
diff --git a/src/3rdparty/libjpeg/qt_attribution.json b/src/3rdparty/libjpeg/qt_attribution.json
index 0b06d5c01e..ae2fa94e73 100644
--- a/src/3rdparty/libjpeg/qt_attribution.json
+++ b/src/3rdparty/libjpeg/qt_attribution.json
@@ -7,11 +7,11 @@
"Description": "The Independent JPEG Group's JPEG software",
"Homepage": "http://libjpeg-turbo.virtualgl.org/",
- "Version": "3.0.2",
- "DownloadLocation": "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.2/libjpeg-turbo-3.0.2.tar.gz",
+ "Version": "3.0.3",
+ "DownloadLocation": "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.3/libjpeg-turbo-3.0.3.tar.gz",
- "License": "Independent JPEG Group License and BSD 3-Clause \"New\" or \"Revised\" License and zlib License",
- "LicenseId": "IJG AND BSD-3-Clause AND Zlib",
- "LicenseFiles": [ "LICENSE", "ijg-license.txt", "zlib-license.txt"],
+ "License": "Independent JPEG Group License and BSD 3-Clause \"New\" or \"Revised\" License",
+ "LicenseId": "IJG AND BSD-3-Clause",
+ "LicenseFiles": [ "LICENSE", "ijg-license.txt" ],
"CopyrightFile": "COPYRIGHT.txt"
}
diff --git a/src/3rdparty/libjpeg/src/ChangeLog.md b/src/3rdparty/libjpeg/src/ChangeLog.md
index a929b62a8c..8039c5536d 100644
--- a/src/3rdparty/libjpeg/src/ChangeLog.md
+++ b/src/3rdparty/libjpeg/src/ChangeLog.md
@@ -1,3 +1,27 @@
+3.0.3
+=====
+
+### Significant changes relative to 3.0.2:
+
+1. Fixed an issue in the build system, introduced in 3.0.2, that caused all
+libjpeg-turbo components to depend on the Visual C++ run-time DLL when built
+with Visual C++ and CMake 3.15 or later, regardless of value of the
+`WITH_CRT_DLL` CMake variable.
+
+2. The x86-64 SIMD extensions now include support for Intel Control-flow
+Enforcement Technology (CET), which is enabled automatically if CET is enabled
+in the C compiler.
+
+3. Fixed a regression introduced by 3.0 beta2[6] that made it impossible for
+calling applications to supply custom Huffman tables when generating
+12-bit-per-component lossy JPEG images using the libjpeg API.
+
+4. Fixed a segfault that occurred when attempting to use the jpegtran `-drop`
+option with a specially-crafted malformed input image or drop image
+(specifically an image in which all of the scans contain fewer components than
+the number of components specified in the Start Of Frame segment.)
+
+
3.0.2
=====
diff --git a/src/3rdparty/libjpeg/src/jcmaster.c b/src/3rdparty/libjpeg/src/jcmaster.c
index 7e1408fcc9..161019763d 100644
--- a/src/3rdparty/libjpeg/src/jcmaster.c
+++ b/src/3rdparty/libjpeg/src/jcmaster.c
@@ -7,7 +7,7 @@
* Lossless JPEG Modifications:
* Copyright (C) 1999, Ken Murchison.
* libjpeg-turbo Modifications:
- * Copyright (C) 2010, 2016, 2018, 2022-2023, D. R. Commander.
+ * Copyright (C) 2010, 2016, 2018, 2022-2024, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -50,6 +50,113 @@ jpeg_calc_jpeg_dimensions(j_compress_ptr cinfo)
#endif
+LOCAL(boolean)
+using_std_huff_tables(j_compress_ptr cinfo)
+{
+ int i;
+
+ static const UINT8 bits_dc_luminance[17] = {
+ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
+ };
+ static const UINT8 val_dc_luminance[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
+ };
+
+ static const UINT8 bits_dc_chrominance[17] = {
+ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
+ };
+ static const UINT8 val_dc_chrominance[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
+ };
+
+ static const UINT8 bits_ac_luminance[17] = {
+ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d
+ };
+ static const UINT8 val_ac_luminance[] = {
+ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
+ 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
+ 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
+ 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
+ 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
+ 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
+ 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
+ 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
+ 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
+ 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
+ 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
+ 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
+ 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
+ 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
+ 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
+ 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
+ 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
+ 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
+ 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+ 0xf9, 0xfa
+ };
+
+ static const UINT8 bits_ac_chrominance[17] = {
+ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77
+ };
+ static const UINT8 val_ac_chrominance[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
+ 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
+ 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
+ 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
+ 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
+ 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
+ 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
+ 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+ 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+ 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
+ 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
+ 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
+ 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
+ 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
+ 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
+ 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
+ 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
+ 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+ 0xf9, 0xfa
+ };
+
+ if (cinfo->dc_huff_tbl_ptrs[0] == NULL ||
+ cinfo->ac_huff_tbl_ptrs[0] == NULL ||
+ cinfo->dc_huff_tbl_ptrs[1] == NULL ||
+ cinfo->ac_huff_tbl_ptrs[1] == NULL)
+ return FALSE;
+
+ for (i = 2; i < NUM_HUFF_TBLS; i++) {
+ if (cinfo->dc_huff_tbl_ptrs[i] != NULL ||
+ cinfo->ac_huff_tbl_ptrs[i] != NULL)
+ return FALSE;
+ }
+
+ if (memcmp(cinfo->dc_huff_tbl_ptrs[0]->bits, bits_dc_luminance,
+ sizeof(bits_dc_luminance)) ||
+ memcmp(cinfo->dc_huff_tbl_ptrs[0]->huffval, val_dc_luminance,
+ sizeof(val_dc_luminance)) ||
+ memcmp(cinfo->ac_huff_tbl_ptrs[0]->bits, bits_ac_luminance,
+ sizeof(bits_ac_luminance)) ||
+ memcmp(cinfo->ac_huff_tbl_ptrs[0]->huffval, val_ac_luminance,
+ sizeof(val_ac_luminance)) ||
+ memcmp(cinfo->dc_huff_tbl_ptrs[1]->bits, bits_dc_chrominance,
+ sizeof(bits_dc_chrominance)) ||
+ memcmp(cinfo->dc_huff_tbl_ptrs[1]->huffval, val_dc_chrominance,
+ sizeof(val_dc_chrominance)) ||
+ memcmp(cinfo->ac_huff_tbl_ptrs[1]->bits, bits_ac_chrominance,
+ sizeof(bits_ac_chrominance)) ||
+ memcmp(cinfo->ac_huff_tbl_ptrs[1]->huffval, val_ac_chrominance,
+ sizeof(val_ac_chrominance)))
+ return FALSE;
+
+ return TRUE;
+}
+
+
LOCAL(void)
initial_setup(j_compress_ptr cinfo, boolean transcode_only)
/* Do computations that are needed before master selection phase */
@@ -605,6 +712,8 @@ GLOBAL(void)
jinit_c_master_control(j_compress_ptr cinfo, boolean transcode_only)
{
my_master_ptr master = (my_master_ptr)cinfo->master;
+ boolean empty_huff_tables = TRUE;
+ int i;
master->pub.prepare_for_pass = prepare_for_pass;
master->pub.pass_startup = pass_startup;
@@ -646,7 +755,16 @@ jinit_c_master_control(j_compress_ptr cinfo, boolean transcode_only)
(cinfo->progressive_mode && !cinfo->arith_code))
cinfo->optimize_coding = TRUE; /* assume default tables no good for
progressive mode or lossless mode */
- if (cinfo->data_precision == 12 && !cinfo->arith_code)
+ for (i = 0; i < NUM_HUFF_TBLS; i++) {
+ if (cinfo->dc_huff_tbl_ptrs[i] != NULL ||
+ cinfo->ac_huff_tbl_ptrs[i] != NULL) {
+ empty_huff_tables = FALSE;
+ break;
+ }
+ }
+ if (cinfo->data_precision == 12 && !cinfo->arith_code &&
+ !cinfo->optimize_coding &&
+ (empty_huff_tables || using_std_huff_tables(cinfo)))
cinfo->optimize_coding = TRUE; /* assume default tables no good for 12-bit
data precision */
diff --git a/src/3rdparty/libjpeg/src/jconfig.h b/src/3rdparty/libjpeg/src/jconfig.h
index 1e03e166e7..e81574b9a4 100644
--- a/src/3rdparty/libjpeg/src/jconfig.h
+++ b/src/3rdparty/libjpeg/src/jconfig.h
@@ -2,9 +2,9 @@
#define JPEG_LIB_VERSION 80
-#define LIBJPEG_TURBO_VERSION 3.0.2
+#define LIBJPEG_TURBO_VERSION 3.0.3
-#define LIBJPEG_TURBO_VERSION_NUMBER 3000002
+#define LIBJPEG_TURBO_VERSION_NUMBER 3000003
#define C_ARITH_CODING_SUPPORTED 1
diff --git a/src/3rdparty/libjpeg/src/jconfigint.h b/src/3rdparty/libjpeg/src/jconfigint.h
index afcb25d247..6e7dbd75a1 100644
--- a/src/3rdparty/libjpeg/src/jconfigint.h
+++ b/src/3rdparty/libjpeg/src/jconfigint.h
@@ -10,7 +10,7 @@
#define PACKAGE_NAME "libjpeg-turbo"
-#define VERSION "3.0.2"
+#define VERSION "3.0.3"
#if SIZE_MAX == 0xffffffff
#define SIZEOF_SIZE_T 4
diff --git a/src/3rdparty/libjpeg/src/jerror.c b/src/3rdparty/libjpeg/src/jerror.c
index d0ab5b88b0..3a75fec02c 100644
--- a/src/3rdparty/libjpeg/src/jerror.c
+++ b/src/3rdparty/libjpeg/src/jerror.c
@@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1998, Thomas G. Lane.
* libjpeg-turbo Modifications:
- * Copyright (C) 2022, D. R. Commander.
+ * Copyright (C) 2022, 2024, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -46,7 +46,7 @@
#define JMESSAGE(code, string) string,
-const char * const jpeg_std_message_table[] = {
+static const char * const jpeg_std_message_table[] = {
#include "jerror.h"
NULL
};
@@ -229,23 +229,17 @@ reset_error_mgr(j_common_ptr cinfo)
GLOBAL(struct jpeg_error_mgr *)
jpeg_std_error(struct jpeg_error_mgr *err)
{
+ memset(err, 0, sizeof(struct jpeg_error_mgr));
+
err->error_exit = error_exit;
err->emit_message = emit_message;
err->output_message = output_message;
err->format_message = format_message;
err->reset_error_mgr = reset_error_mgr;
- err->trace_level = 0; /* default = no tracing */
- err->num_warnings = 0; /* no warnings emitted yet */
- err->msg_code = 0; /* may be useful as a flag for "no error" */
-
/* Initialize message table pointers */
err->jpeg_message_table = jpeg_std_message_table;
err->last_jpeg_message = (int)JMSG_LASTMSGCODE - 1;
- err->addon_message_table = NULL;
- err->first_addon_message = 0; /* for safety */
- err->last_addon_message = 0;
-
return err;
}
diff --git a/src/3rdparty/libjpeg/src/jversion.h b/src/3rdparty/libjpeg/src/jversion.h
index 5c127dc635..3b21737362 100644
--- a/src/3rdparty/libjpeg/src/jversion.h
+++ b/src/3rdparty/libjpeg/src/jversion.h
@@ -36,20 +36,21 @@
* their code
*/
-#define JCOPYRIGHT \
+#define JCOPYRIGHT1 \
"Copyright (C) 2009-2024 D. R. Commander\n" \
"Copyright (C) 2015, 2020 Google, Inc.\n" \
"Copyright (C) 2019-2020 Arm Limited\n" \
"Copyright (C) 2015-2016, 2018 Matthieu Darbois\n" \
"Copyright (C) 2011-2016 Siarhei Siamashka\n" \
- "Copyright (C) 2015 Intel Corporation\n" \
+ "Copyright (C) 2015 Intel Corporation\n"
+#define JCOPYRIGHT2 \
"Copyright (C) 2013-2014 Linaro Limited\n" \
"Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \
"Copyright (C) 2009, 2012 Pierre Ossman for Cendio AB\n" \
"Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \
"Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
"Copyright (C) 1999 Ken Murchison\n" \
- "Copyright (C) 1991-2020 Thomas G. Lane, Guido Vollbeding"
+ "Copyright (C) 1991-2020 Thomas G. Lane, Guido Vollbeding\n"
#define JCOPYRIGHT_SHORT \
"Copyright (C) 1991-2024 The libjpeg-turbo Project and many others"
diff --git a/src/3rdparty/libjpeg/zlib-license.txt b/src/3rdparty/libjpeg/zlib-license.txt
deleted file mode 100644
index 480c61edca..0000000000
--- a/src/3rdparty/libjpeg/zlib-license.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, 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 notice may not be removed or altered from any source distribution.
diff --git a/src/3rdparty/sqlite/qt_attribution.json b/src/3rdparty/sqlite/qt_attribution.json
index c5a5b12062..0910c709e2 100644
--- a/src/3rdparty/sqlite/qt_attribution.json
+++ b/src/3rdparty/sqlite/qt_attribution.json
@@ -7,8 +7,8 @@
"Description": "SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.",
"Homepage": "https://www.sqlite.org/",
- "Version": "3.45.3",
- "DownloadLocation": "https://www.sqlite.org/2024/sqlite-amalgamation-3450300.zip",
+ "Version": "3.46.0",
+ "DownloadLocation": "https://www.sqlite.org/2024/sqlite-amalgamation-3460000.zip",
"License": "SQLite Blessing",
"LicenseId": "blessing",
"Copyright": "The authors disclaim copyright to the source code. However, a license can be obtained if needed."
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
index 08c593e55c..eaa24a1310 100644
--- a/src/3rdparty/sqlite/sqlite3.c
+++ b/src/3rdparty/sqlite/sqlite3.c
@@ -1,6 +1,6 @@
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
-** version 3.45.3. By combining all the individual C code files into this
+** version 3.46.0. By combining all the individual C code files into this
** single large file, the entire code can be compiled as a single translation
** unit. This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately. Performance improvements
@@ -18,7 +18,7 @@
** separate file. This file contains only code for the core SQLite library.
**
** The content in this amalgamation comes from Fossil check-in
-** 8653b758870e6ef0c98d46b3ace27849054a.
+** 96c92aba00c8375bc32fafcdf12429c58bd8.
*/
#define SQLITE_CORE 1
#define SQLITE_AMALGAMATION 1
@@ -459,9 +459,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
-#define SQLITE_VERSION "3.45.3"
-#define SQLITE_VERSION_NUMBER 3045003
-#define SQLITE_SOURCE_ID "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355"
+#define SQLITE_VERSION "3.46.0"
+#define SQLITE_VERSION_NUMBER 3046000
+#define SQLITE_SOURCE_ID "2024-05-23 13:25:27 96c92aba00c8375bc32fafcdf12429c58bd8aabfcadab6683e35bbb9cdebf19e"
/*
** CAPI3REF: Run-Time Library Version Numbers
@@ -1077,11 +1077,11 @@ struct sqlite3_file {
** </ul>
** xLock() upgrades the database file lock. In other words, xLock() moves the
** database file lock in the direction NONE toward EXCLUSIVE. The argument to
-** xLock() is always on of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
+** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
** SQLITE_LOCK_NONE. If the database file lock is already at or above the
** requested lock, then the call to xLock() is a no-op.
** xUnlock() downgrades the database file lock to either SHARED or NONE.
-* If the lock is already at or below the requested lock state, then the call
+** If the lock is already at or below the requested lock state, then the call
** to xUnlock() is a no-op.
** The xCheckReservedLock() method checks whether any database connection,
** either in this process or in some other process, is holding a RESERVED,
@@ -3618,8 +3618,8 @@ SQLITE_API int sqlite3_set_authorizer(
#define SQLITE_RECURSIVE 33 /* NULL NULL */
/*
-** CAPI3REF: Tracing And Profiling Functions
-** METHOD: sqlite3
+** CAPI3REF: Deprecated Tracing And Profiling Functions
+** DEPRECATED
**
** These routines are deprecated. Use the [sqlite3_trace_v2()] interface
** instead of the routines described here.
@@ -7200,6 +7200,12 @@ SQLITE_API int sqlite3_autovacuum_pages(
** The exceptions defined in this paragraph might change in a future
** release of SQLite.
**
+** Whether the update hook is invoked before or after the
+** corresponding change is currently unspecified and may differ
+** depending on the type of change. Do not rely on the order of the
+** hook call with regards to the final result of the operation which
+** triggers the hook.
+**
** The update hook implementation must not do anything that will modify
** the database connection that invoked the update hook. Any actions
** to modify the database connection must be deferred until after the
@@ -8670,7 +8676,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
** The sqlite3_keyword_count() interface returns the number of distinct
** keywords understood by SQLite.
**
-** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and
+** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and
** makes *Z point to that keyword expressed as UTF8 and writes the number
** of bytes in the keyword into *L. The string that *Z points to is not
** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
@@ -10249,24 +10255,45 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
** <li value="2"><p>
** ^(If the sqlite3_vtab_distinct() interface returns 2, that means
** that the query planner does not need the rows returned in any particular
-** order, as long as rows with the same values in all "aOrderBy" columns
-** are adjacent.)^ ^(Furthermore, only a single row for each particular
-** combination of values in the columns identified by the "aOrderBy" field
-** needs to be returned.)^ ^It is always ok for two or more rows with the same
-** values in all "aOrderBy" columns to be returned, as long as all such rows
-** are adjacent. ^The virtual table may, if it chooses, omit extra rows
-** that have the same value for all columns identified by "aOrderBy".
-** ^However omitting the extra rows is optional.
+** order, as long as rows with the same values in all columns identified
+** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows
+** contain the same values for all columns identified by "colUsed", all but
+** one such row may optionally be omitted from the result.)^
+** The virtual table is not required to omit rows that are duplicates
+** over the "colUsed" columns, but if the virtual table can do that without
+** too much extra effort, it could potentially help the query to run faster.
** This mode is used for a DISTINCT query.
** <li value="3"><p>
-** ^(If the sqlite3_vtab_distinct() interface returns 3, that means
-** that the query planner needs only distinct rows but it does need the
-** rows to be sorted.)^ ^The virtual table implementation is free to omit
-** rows that are identical in all aOrderBy columns, if it wants to, but
-** it is not required to omit any rows. This mode is used for queries
+** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the
+** virtual table must return rows in the order defined by "aOrderBy" as
+** if the sqlite3_vtab_distinct() interface had returned 0. However if
+** two or more rows in the result have the same values for all columns
+** identified by "colUsed", then all but one such row may optionally be
+** omitted.)^ Like when the return value is 2, the virtual table
+** is not required to omit rows that are duplicates over the "colUsed"
+** columns, but if the virtual table can do that without
+** too much extra effort, it could potentially help the query to run faster.
+** This mode is used for queries
** that have both DISTINCT and ORDER BY clauses.
** </ol>
**
+** <p>The following table summarizes the conditions under which the
+** virtual table is allowed to set the "orderByConsumed" flag based on
+** the value returned by sqlite3_vtab_distinct(). This table is a
+** restatement of the previous four paragraphs:
+**
+** <table border=1 cellspacing=0 cellpadding=10 width="90%">
+** <tr>
+** <td valign="top">sqlite3_vtab_distinct() return value
+** <td valign="top">Rows are returned in aOrderBy order
+** <td valign="top">Rows with the same value in all aOrderBy columns are adjacent
+** <td valign="top">Duplicates over all colUsed columns may be omitted
+** <tr><td>0<td>yes<td>yes<td>no
+** <tr><td>1<td>no<td>yes<td>no
+** <tr><td>2<td>no<td>yes<td>yes
+** <tr><td>3<td>yes<td>yes<td>yes
+** </table>
+**
** ^For the purposes of comparing virtual table output values to see if the
** values are same value for sorting purposes, two NULL values are considered
** to be the same. In other words, the comparison operator is "IS"
@@ -12312,6 +12339,30 @@ SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const c
SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
/*
+** CAPI3REF: Add A Single Change To A Changegroup
+** METHOD: sqlite3_changegroup
+**
+** This function adds the single change currently indicated by the iterator
+** passed as the second argument to the changegroup object. The rules for
+** adding the change are just as described for [sqlite3changegroup_add()].
+**
+** If the change is successfully added to the changegroup, SQLITE_OK is
+** returned. Otherwise, an SQLite error code is returned.
+**
+** The iterator must point to a valid entry when this function is called.
+** If it does not, SQLITE_ERROR is returned and no change is added to the
+** changegroup. Additionally, the iterator must not have been opened with
+** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also
+** returned.
+*/
+SQLITE_API int sqlite3changegroup_add_change(
+ sqlite3_changegroup*,
+ sqlite3_changeset_iter*
+);
+
+
+
+/*
** CAPI3REF: Obtain A Composite Changeset From A Changegroup
** METHOD: sqlite3_changegroup
**
@@ -13115,8 +13166,8 @@ struct Fts5PhraseIter {
** EXTENSION API FUNCTIONS
**
** xUserData(pFts):
-** Return a copy of the context pointer the extension function was
-** registered with.
+** Return a copy of the pUserData pointer passed to the xCreateFunction()
+** API when the extension function was registered.
**
** xColumnTotalSize(pFts, iCol, pnToken):
** If parameter iCol is less than zero, set output variable *pnToken
@@ -14314,6 +14365,8 @@ struct fts5_api {
# define SQLITE_OMIT_ALTERTABLE
#endif
+#define SQLITE_DIGIT_SEPARATOR '_'
+
/*
** Return true (non-zero) if the input is an integer that is too large
** to fit in 32-bits. This macro is used inside of various testcase()
@@ -14606,8 +14659,8 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
#define TK_TRUEFALSE 170
#define TK_ISNOT 171
#define TK_FUNCTION 172
-#define TK_UMINUS 173
-#define TK_UPLUS 174
+#define TK_UPLUS 173
+#define TK_UMINUS 174
#define TK_TRUTH 175
#define TK_REGISTER 176
#define TK_VECTOR 177
@@ -14616,8 +14669,9 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
#define TK_ASTERISK 180
#define TK_SPAN 181
#define TK_ERROR 182
-#define TK_SPACE 183
-#define TK_ILLEGAL 184
+#define TK_QNUMBER 183
+#define TK_SPACE 184
+#define TK_ILLEGAL 185
/************** End of parse.h ***********************************************/
/************** Continuing where we left off in sqliteInt.h ******************/
@@ -14879,7 +14933,7 @@ typedef INT16_TYPE LogEst;
# define SQLITE_PTRSIZE __SIZEOF_POINTER__
# elif defined(i386) || defined(__i386__) || defined(_M_IX86) || \
defined(_M_ARM) || defined(__arm__) || defined(__x86) || \
- (defined(__APPLE__) && defined(__POWERPC__)) || \
+ (defined(__APPLE__) && defined(__ppc__)) || \
(defined(__TOS_AIX__) && !defined(__64BIT__))
# define SQLITE_PTRSIZE 4
# else
@@ -15147,7 +15201,7 @@ SQLITE_PRIVATE u32 sqlite3WhereTrace;
** 0x00000010 Display sqlite3_index_info xBestIndex calls
** 0x00000020 Range an equality scan metrics
** 0x00000040 IN operator decisions
-** 0x00000080 WhereLoop cost adjustements
+** 0x00000080 WhereLoop cost adjustments
** 0x00000100
** 0x00000200 Covering index decisions
** 0x00000400 OR optimization
@@ -16296,6 +16350,7 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck(
sqlite3 *db, /* Database connection that is running the check */
Btree *p, /* The btree to be checked */
Pgno *aRoot, /* An array of root pages numbers for individual trees */
+ sqlite3_value *aCnt, /* OUT: entry counts for each btree in aRoot[] */
int nRoot, /* Number of entries in aRoot[] */
int mxErr, /* Stop reporting errors after this many */
int *pnErr, /* OUT: Write number of errors seen to this variable */
@@ -16566,12 +16621,12 @@ typedef struct VdbeOpList VdbeOpList;
#define OP_Vacuum 5
#define OP_VFilter 6 /* jump, synopsis: iplan=r[P3] zplan='P4' */
#define OP_VUpdate 7 /* synopsis: data=r[P3@P2] */
-#define OP_Init 8 /* jump, synopsis: Start at P2 */
+#define OP_Init 8 /* jump0, synopsis: Start at P2 */
#define OP_Goto 9 /* jump */
#define OP_Gosub 10 /* jump */
-#define OP_InitCoroutine 11 /* jump */
-#define OP_Yield 12 /* jump */
-#define OP_MustBeInt 13 /* jump */
+#define OP_InitCoroutine 11 /* jump0 */
+#define OP_Yield 12 /* jump0 */
+#define OP_MustBeInt 13 /* jump0 */
#define OP_Jump 14 /* jump */
#define OP_Once 15 /* jump */
#define OP_If 16 /* jump */
@@ -16579,22 +16634,22 @@ typedef struct VdbeOpList VdbeOpList;
#define OP_IsType 18 /* jump, synopsis: if typeof(P1.P3) in P5 goto P2 */
#define OP_Not 19 /* same as TK_NOT, synopsis: r[P2]= !r[P1] */
#define OP_IfNullRow 20 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */
-#define OP_SeekLT 21 /* jump, synopsis: key=r[P3@P4] */
-#define OP_SeekLE 22 /* jump, synopsis: key=r[P3@P4] */
-#define OP_SeekGE 23 /* jump, synopsis: key=r[P3@P4] */
-#define OP_SeekGT 24 /* jump, synopsis: key=r[P3@P4] */
+#define OP_SeekLT 21 /* jump0, synopsis: key=r[P3@P4] */
+#define OP_SeekLE 22 /* jump0, synopsis: key=r[P3@P4] */
+#define OP_SeekGE 23 /* jump0, synopsis: key=r[P3@P4] */
+#define OP_SeekGT 24 /* jump0, synopsis: key=r[P3@P4] */
#define OP_IfNotOpen 25 /* jump, synopsis: if( !csr[P1] ) goto P2 */
#define OP_IfNoHope 26 /* jump, synopsis: key=r[P3@P4] */
#define OP_NoConflict 27 /* jump, synopsis: key=r[P3@P4] */
#define OP_NotFound 28 /* jump, synopsis: key=r[P3@P4] */
#define OP_Found 29 /* jump, synopsis: key=r[P3@P4] */
-#define OP_SeekRowid 30 /* jump, synopsis: intkey=r[P3] */
+#define OP_SeekRowid 30 /* jump0, synopsis: intkey=r[P3] */
#define OP_NotExists 31 /* jump, synopsis: intkey=r[P3] */
-#define OP_Last 32 /* jump */
-#define OP_IfSmaller 33 /* jump */
+#define OP_Last 32 /* jump0 */
+#define OP_IfSizeBetween 33 /* jump */
#define OP_SorterSort 34 /* jump */
#define OP_Sort 35 /* jump */
-#define OP_Rewind 36 /* jump */
+#define OP_Rewind 36 /* jump0 */
#define OP_SorterNext 37 /* jump */
#define OP_Prev 38 /* jump */
#define OP_Next 39 /* jump */
@@ -16606,7 +16661,7 @@ typedef struct VdbeOpList VdbeOpList;
#define OP_IdxGE 45 /* jump, synopsis: key=r[P3@P4] */
#define OP_RowSetRead 46 /* jump, synopsis: r[P3]=rowset(P1) */
#define OP_RowSetTest 47 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */
-#define OP_Program 48 /* jump */
+#define OP_Program 48 /* jump0 */
#define OP_FkIfZero 49 /* jump, synopsis: if fkctr[P1]==0 goto P2 */
#define OP_IsNull 50 /* jump, same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
#define OP_NotNull 51 /* jump, same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
@@ -16636,7 +16691,7 @@ typedef struct VdbeOpList VdbeOpList;
#define OP_Null 75 /* synopsis: r[P2..P3]=NULL */
#define OP_SoftNull 76 /* synopsis: r[P1]=NULL */
#define OP_Blob 77 /* synopsis: r[P2]=P4 (len=P1) */
-#define OP_Variable 78 /* synopsis: r[P2]=parameter(P1,P4) */
+#define OP_Variable 78 /* synopsis: r[P2]=parameter(P1) */
#define OP_Move 79 /* synopsis: r[P2@P3]=r[P1@P3] */
#define OP_Copy 80 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
#define OP_SCopy 81 /* synopsis: r[P2]=r[P1] */
@@ -16760,14 +16815,15 @@ typedef struct VdbeOpList VdbeOpList;
#define OPFLG_OUT2 0x10 /* out2: P2 is an output */
#define OPFLG_OUT3 0x20 /* out3: P3 is an output */
#define OPFLG_NCYCLE 0x40 /* ncycle:Cycles count against P1 */
+#define OPFLG_JUMP0 0x80 /* jump0: P2 might be zero */
#define OPFLG_INITIALIZER {\
/* 0 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x41, 0x00,\
-/* 8 */ 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x01, 0x01,\
-/* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0x49, 0x49, 0x49,\
-/* 24 */ 0x49, 0x01, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,\
-/* 32 */ 0x41, 0x01, 0x41, 0x41, 0x41, 0x01, 0x41, 0x41,\
+/* 8 */ 0x81, 0x01, 0x01, 0x81, 0x83, 0x83, 0x01, 0x01,\
+/* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0xc9, 0xc9, 0xc9,\
+/* 24 */ 0xc9, 0x01, 0x49, 0x49, 0x49, 0x49, 0xc9, 0x49,\
+/* 32 */ 0xc1, 0x01, 0x41, 0x41, 0xc1, 0x01, 0x41, 0x41,\
/* 40 */ 0x41, 0x41, 0x41, 0x26, 0x26, 0x41, 0x23, 0x0b,\
-/* 48 */ 0x01, 0x01, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
+/* 48 */ 0x81, 0x01, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
/* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x03, 0x01, 0x41,\
/* 64 */ 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10,\
/* 72 */ 0x10, 0x10, 0x00, 0x10, 0x00, 0x10, 0x10, 0x00,\
@@ -16927,6 +16983,8 @@ SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord*);
SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);
SQLITE_PRIVATE int sqlite3VdbeHasSubProgram(Vdbe*);
+SQLITE_PRIVATE void sqlite3MemSetArrayInt64(sqlite3_value *aMem, int iIdx, i64 val);
+
SQLITE_PRIVATE int sqlite3NotPureFunc(sqlite3_context*);
#ifdef SQLITE_ENABLE_BYTECODE_VTAB
SQLITE_PRIVATE int sqlite3VdbeBytecodeVtabInit(sqlite3*);
@@ -17514,6 +17572,10 @@ struct FuncDefHash {
};
#define SQLITE_FUNC_HASH(C,L) (((C)+(L))%SQLITE_FUNC_HASH_SZ)
+#if defined(SQLITE_USER_AUTHENTICATION)
+# warning "The SQLITE_USER_AUTHENTICATION extension is deprecated. \
+ See ext/userauth/user-auth.txt for details."
+#endif
#ifdef SQLITE_USER_AUTHENTICATION
/*
** Information held in the "sqlite3" database connection object and used
@@ -17817,7 +17879,7 @@ struct sqlite3 {
#define SQLITE_CursorHints 0x00000400 /* Add OP_CursorHint opcodes */
#define SQLITE_Stat4 0x00000800 /* Use STAT4 data */
/* TH3 expects this value ^^^^^^^^^^ to be 0x0000800. Don't change it */
-#define SQLITE_PushDown 0x00001000 /* The push-down optimization */
+#define SQLITE_PushDown 0x00001000 /* WHERE-clause push-down opt */
#define SQLITE_SimplifyJoin 0x00002000 /* Convert LEFT JOIN to JOIN */
#define SQLITE_SkipScan 0x00004000 /* Skip-scans */
#define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */
@@ -18390,8 +18452,7 @@ struct Table {
#define TF_HasStored 0x00000040 /* Has one or more STORED columns */
#define TF_HasGenerated 0x00000060 /* Combo: HasVirtual + HasStored */
#define TF_WithoutRowid 0x00000080 /* No rowid. PRIMARY KEY is the key */
-#define TF_StatsUsed 0x00000100 /* Query planner decisions affected by
- ** Index.aiRowLogEst[] values */
+#define TF_MaybeReanalyze 0x00000100 /* Maybe run ANALYZE on this table */
#define TF_NoVisibleRowid 0x00000200 /* No user-visible "rowid" column */
#define TF_OOOHidden 0x00000400 /* Out-of-Order hidden columns */
#define TF_HasNotNull 0x00000800 /* Contains NOT NULL constraints */
@@ -19191,10 +19252,12 @@ struct IdList {
**
** Union member validity:
**
-** u1.zIndexedBy fg.isIndexedBy && !fg.isTabFunc
-** u1.pFuncArg fg.isTabFunc && !fg.isIndexedBy
-** u2.pIBIndex fg.isIndexedBy && !fg.isCte
-** u2.pCteUse fg.isCte && !fg.isIndexedBy
+** u1.zIndexedBy fg.isIndexedBy && !fg.isTabFunc
+** u1.pFuncArg fg.isTabFunc && !fg.isIndexedBy
+** u1.nRow !fg.isTabFunc && !fg.isIndexedBy
+**
+** u2.pIBIndex fg.isIndexedBy && !fg.isCte
+** u2.pCteUse fg.isCte && !fg.isIndexedBy
*/
struct SrcItem {
Schema *pSchema; /* Schema to which this item is fixed */
@@ -19222,6 +19285,7 @@ struct SrcItem {
unsigned isOn :1; /* u3.pOn was once valid and non-NULL */
unsigned isSynthUsing :1; /* u3.pUsing is synthesized from NATURAL */
unsigned isNestedFrom :1; /* pSelect is a SF_NestedFrom subquery */
+ unsigned rowidUsed :1; /* The ROWID of this table is referenced */
} fg;
int iCursor; /* The VDBE cursor number used to access this table */
union {
@@ -19232,6 +19296,7 @@ struct SrcItem {
union {
char *zIndexedBy; /* Identifier from "INDEXED BY <zIndex>" clause */
ExprList *pFuncArg; /* Arguments to table-valued-function */
+ u32 nRow; /* Number of rows in a VALUES clause */
} u1;
union {
Index *pIBIndex; /* Index structure corresponding to u1.zIndexedBy */
@@ -19489,11 +19554,12 @@ struct Select {
#define SF_View 0x0200000 /* SELECT statement is a view */
#define SF_NoopOrderBy 0x0400000 /* ORDER BY is ignored for this query */
#define SF_UFSrcCheck 0x0800000 /* Check pSrc as required by UPDATE...FROM */
-#define SF_PushDown 0x1000000 /* SELECT has be modified by push-down opt */
+#define SF_PushDown 0x1000000 /* Modified by WHERE-clause push-down opt */
#define SF_MultiPart 0x2000000 /* Has multiple incompatible PARTITIONs */
#define SF_CopyCte 0x4000000 /* SELECT statement is a copy of a CTE */
#define SF_OrderByReqd 0x8000000 /* The ORDER BY clause may not be omitted */
#define SF_UpdateFrom 0x10000000 /* Query originates with UPDATE FROM */
+#define SF_Correlated 0x20000000 /* True if references the outer context */
/* True if S exists and has SF_NestedFrom */
#define IsNestedFrom(S) ((S)!=0 && ((S)->selFlags&SF_NestedFrom)!=0)
@@ -19733,6 +19799,7 @@ struct Parse {
u8 disableLookaside; /* Number of times lookaside has been disabled */
u8 prepFlags; /* SQLITE_PREPARE_* flags */
u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */
+ u8 bHasWith; /* True if statement contains WITH */
#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
#endif
@@ -20412,6 +20479,9 @@ struct Window {
** due to the SQLITE_SUBTYPE flag */
};
+SQLITE_PRIVATE Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow);
+SQLITE_PRIVATE void sqlite3MultiValuesEnd(Parse *pParse, Select *pVal);
+
#ifndef SQLITE_OMIT_WINDOWFUNC
SQLITE_PRIVATE void sqlite3WindowDelete(sqlite3*, Window*);
SQLITE_PRIVATE void sqlite3WindowUnlinkFromSelect(Window*);
@@ -20729,6 +20799,7 @@ SQLITE_PRIVATE int sqlite3ErrorToParser(sqlite3*,int);
SQLITE_PRIVATE void sqlite3Dequote(char*);
SQLITE_PRIVATE void sqlite3DequoteExpr(Expr*);
SQLITE_PRIVATE void sqlite3DequoteToken(Token*);
+SQLITE_PRIVATE void sqlite3DequoteNumber(Parse*, Expr*);
SQLITE_PRIVATE void sqlite3TokenInit(Token*,char*);
SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int);
SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*);
@@ -20759,7 +20830,7 @@ SQLITE_PRIVATE void sqlite3ExprFunctionUsable(Parse*,const Expr*,const FuncDef*)
SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);
SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*);
SQLITE_PRIVATE void sqlite3ExprDeleteGeneric(sqlite3*,void*);
-SQLITE_PRIVATE void sqlite3ExprDeferredDelete(Parse*, Expr*);
+SQLITE_PRIVATE int sqlite3ExprDeferredDelete(Parse*, Expr*);
SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse*, Expr*);
SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*);
@@ -20982,12 +21053,10 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3*);
SQLITE_PRIVATE u32 sqlite3IsTrueOrFalse(const char*);
SQLITE_PRIVATE int sqlite3ExprIdToTrueFalse(Expr*);
SQLITE_PRIVATE int sqlite3ExprTruthValue(const Expr*);
-SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*);
-SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
+SQLITE_PRIVATE int sqlite3ExprIsConstant(Parse*,Expr*);
SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8);
SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*);
-SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int);
-SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr*,const SrcList*,int);
+SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr*,const SrcList*,int,int);
#ifdef SQLITE_ENABLE_CURSOR_HINTS
SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr*);
#endif
@@ -21172,7 +21241,9 @@ SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...);
SQLITE_PRIVATE void sqlite3Error(sqlite3*,int);
SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3*);
SQLITE_PRIVATE void sqlite3SystemError(sqlite3*,int);
+#if !defined(SQLITE_OMIT_BLOB_LITERAL)
SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
+#endif
SQLITE_PRIVATE u8 sqlite3HexToInt(int h);
SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
@@ -24219,13 +24290,14 @@ struct DateTime {
int tz; /* Timezone offset in minutes */
double s; /* Seconds */
char validJD; /* True (1) if iJD is valid */
- char rawS; /* Raw numeric value stored in s */
char validYMD; /* True (1) if Y,M,D are valid */
char validHMS; /* True (1) if h,m,s are valid */
- char validTZ; /* True (1) if tz is valid */
- char tzSet; /* Timezone was set explicitly */
- char isError; /* An overflow has occurred */
- char useSubsec; /* Display subsecond precision */
+ char nFloor; /* Days to implement "floor" */
+ unsigned rawS : 1; /* Raw numeric value stored in s */
+ unsigned isError : 1; /* An overflow has occurred */
+ unsigned useSubsec : 1; /* Display subsecond precision */
+ unsigned isUtc : 1; /* Time is known to be UTC */
+ unsigned isLocal : 1; /* Time is known to be localtime */
};
@@ -24323,6 +24395,8 @@ static int parseTimezone(const char *zDate, DateTime *p){
sgn = +1;
}else if( c=='Z' || c=='z' ){
zDate++;
+ p->isLocal = 0;
+ p->isUtc = 1;
goto zulu_time;
}else{
return c!=0;
@@ -24335,7 +24409,6 @@ static int parseTimezone(const char *zDate, DateTime *p){
p->tz = sgn*(nMn + nHr*60);
zulu_time:
while( sqlite3Isspace(*zDate) ){ zDate++; }
- p->tzSet = 1;
return *zDate!=0;
}
@@ -24379,7 +24452,6 @@ static int parseHhMmSs(const char *zDate, DateTime *p){
p->m = m;
p->s = s + ms;
if( parseTimezone(zDate, p) ) return 1;
- p->validTZ = (p->tz!=0)?1:0;
return 0;
}
@@ -24426,16 +24498,41 @@ static void computeJD(DateTime *p){
p->validJD = 1;
if( p->validHMS ){
p->iJD += p->h*3600000 + p->m*60000 + (sqlite3_int64)(p->s*1000 + 0.5);
- if( p->validTZ ){
+ if( p->tz ){
p->iJD -= p->tz*60000;
p->validYMD = 0;
p->validHMS = 0;
- p->validTZ = 0;
+ p->tz = 0;
+ p->isUtc = 1;
+ p->isLocal = 0;
}
}
}
/*
+** Given the YYYY-MM-DD information current in p, determine if there
+** is day-of-month overflow and set nFloor to the number of days that
+** would need to be subtracted from the date in order to bring the
+** date back to the end of the month.
+*/
+static void computeFloor(DateTime *p){
+ assert( p->validYMD || p->isError );
+ assert( p->D>=0 && p->D<=31 );
+ assert( p->M>=0 && p->M<=12 );
+ if( p->D<=28 ){
+ p->nFloor = 0;
+ }else if( (1<<p->M) & 0x15aa ){
+ p->nFloor = 0;
+ }else if( p->M!=2 ){
+ p->nFloor = (p->D==31);
+ }else if( p->Y%4!=0 || (p->Y%100==0 && p->Y%400!=0) ){
+ p->nFloor = p->D - 28;
+ }else{
+ p->nFloor = p->D - 29;
+ }
+}
+
+/*
** Parse dates of the form
**
** YYYY-MM-DD HH:MM:SS.FFF
@@ -24473,12 +24570,16 @@ static int parseYyyyMmDd(const char *zDate, DateTime *p){
p->Y = neg ? -Y : Y;
p->M = M;
p->D = D;
- if( p->validTZ ){
+ computeFloor(p);
+ if( p->tz ){
computeJD(p);
}
return 0;
}
+
+static void clearYMD_HMS_TZ(DateTime *p); /* Forward declaration */
+
/*
** Set the time to the current time reported by the VFS.
**
@@ -24488,6 +24589,9 @@ static int setDateTimeToCurrent(sqlite3_context *context, DateTime *p){
p->iJD = sqlite3StmtCurrentTime(context);
if( p->iJD>0 ){
p->validJD = 1;
+ p->isUtc = 1;
+ p->isLocal = 0;
+ clearYMD_HMS_TZ(p);
return 0;
}else{
return 1;
@@ -24626,7 +24730,7 @@ static void computeYMD_HMS(DateTime *p){
static void clearYMD_HMS_TZ(DateTime *p){
p->validYMD = 0;
p->validHMS = 0;
- p->validTZ = 0;
+ p->tz = 0;
}
#ifndef SQLITE_OMIT_LOCALTIME
@@ -24758,7 +24862,7 @@ static int toLocaltime(
p->validHMS = 1;
p->validJD = 0;
p->rawS = 0;
- p->validTZ = 0;
+ p->tz = 0;
p->isError = 0;
return SQLITE_OK;
}
@@ -24778,12 +24882,12 @@ static const struct {
float rLimit; /* Maximum NNN value for this transform */
float rXform; /* Constant used for this transform */
} aXformType[] = {
- { 6, "second", 4.6427e+14, 1.0 },
- { 6, "minute", 7.7379e+12, 60.0 },
- { 4, "hour", 1.2897e+11, 3600.0 },
- { 3, "day", 5373485.0, 86400.0 },
- { 5, "month", 176546.0, 2592000.0 },
- { 4, "year", 14713.0, 31536000.0 },
+ /* 0 */ { 6, "second", 4.6427e+14, 1.0 },
+ /* 1 */ { 6, "minute", 7.7379e+12, 60.0 },
+ /* 2 */ { 4, "hour", 1.2897e+11, 3600.0 },
+ /* 3 */ { 3, "day", 5373485.0, 86400.0 },
+ /* 4 */ { 5, "month", 176546.0, 30.0*86400.0 },
+ /* 5 */ { 4, "year", 14713.0, 365.0*86400.0 },
};
/*
@@ -24815,14 +24919,20 @@ static void autoAdjustDate(DateTime *p){
** NNN.NNNN seconds
** NNN months
** NNN years
+** +/-YYYY-MM-DD HH:MM:SS.SSS
+** ceiling
+** floor
** start of month
** start of year
** start of week
** start of day
** weekday N
** unixepoch
+** auto
** localtime
** utc
+** subsec
+** subsecond
**
** Return 0 on success and 1 if there is any kind of error. If the error
** is in a system call (i.e. localtime()), then an error message is written
@@ -24853,6 +24963,37 @@ static int parseModifier(
}
break;
}
+ case 'c': {
+ /*
+ ** ceiling
+ **
+ ** Resolve day-of-month overflow by rolling forward into the next
+ ** month. As this is the default action, this modifier is really
+ ** a no-op that is only included for symmetry. See "floor".
+ */
+ if( sqlite3_stricmp(z, "ceiling")==0 ){
+ computeJD(p);
+ clearYMD_HMS_TZ(p);
+ rc = 0;
+ p->nFloor = 0;
+ }
+ break;
+ }
+ case 'f': {
+ /*
+ ** floor
+ **
+ ** Resolve day-of-month overflow by rolling back to the end of the
+ ** previous month.
+ */
+ if( sqlite3_stricmp(z, "floor")==0 ){
+ computeJD(p);
+ p->iJD -= p->nFloor*86400000;
+ clearYMD_HMS_TZ(p);
+ rc = 0;
+ }
+ break;
+ }
case 'j': {
/*
** julianday
@@ -24879,7 +25020,9 @@ static int parseModifier(
** show local time.
*/
if( sqlite3_stricmp(z, "localtime")==0 && sqlite3NotPureFunc(pCtx) ){
- rc = toLocaltime(p, pCtx);
+ rc = p->isLocal ? SQLITE_OK : toLocaltime(p, pCtx);
+ p->isUtc = 0;
+ p->isLocal = 1;
}
break;
}
@@ -24904,7 +25047,7 @@ static int parseModifier(
}
#ifndef SQLITE_OMIT_LOCALTIME
else if( sqlite3_stricmp(z, "utc")==0 && sqlite3NotPureFunc(pCtx) ){
- if( p->tzSet==0 ){
+ if( p->isUtc==0 ){
i64 iOrigJD; /* Original localtime */
i64 iGuess; /* Guess at the corresponding utc time */
int cnt = 0; /* Safety to prevent infinite loop */
@@ -24927,7 +25070,8 @@ static int parseModifier(
memset(p, 0, sizeof(*p));
p->iJD = iGuess;
p->validJD = 1;
- p->tzSet = 1;
+ p->isUtc = 1;
+ p->isLocal = 0;
}
rc = SQLITE_OK;
}
@@ -24947,7 +25091,7 @@ static int parseModifier(
&& r>=0.0 && r<7.0 && (n=(int)r)==r ){
sqlite3_int64 Z;
computeYMD_HMS(p);
- p->validTZ = 0;
+ p->tz = 0;
p->validJD = 0;
computeJD(p);
Z = ((p->iJD + 129600000)/86400000) % 7;
@@ -24987,7 +25131,7 @@ static int parseModifier(
p->h = p->m = 0;
p->s = 0.0;
p->rawS = 0;
- p->validTZ = 0;
+ p->tz = 0;
p->validJD = 0;
if( sqlite3_stricmp(z,"month")==0 ){
p->D = 1;
@@ -25058,6 +25202,7 @@ static int parseModifier(
x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;
p->Y += x;
p->M -= x*12;
+ computeFloor(p);
computeJD(p);
p->validHMS = 0;
p->validYMD = 0;
@@ -25104,11 +25249,12 @@ static int parseModifier(
z += n;
while( sqlite3Isspace(*z) ) z++;
n = sqlite3Strlen30(z);
- if( n>10 || n<3 ) break;
+ if( n<3 || n>10 ) break;
if( sqlite3UpperToLower[(u8)z[n-1]]=='s' ) n--;
computeJD(p);
assert( rc==1 );
rRounder = r<0 ? -0.5 : +0.5;
+ p->nFloor = 0;
for(i=0; i<ArraySize(aXformType); i++){
if( aXformType[i].nName==n
&& sqlite3_strnicmp(aXformType[i].zName, z, n)==0
@@ -25116,21 +25262,24 @@ static int parseModifier(
){
switch( i ){
case 4: { /* Special processing to add months */
- assert( strcmp(aXformType[i].zName,"month")==0 );
+ assert( strcmp(aXformType[4].zName,"month")==0 );
computeYMD_HMS(p);
p->M += (int)r;
x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;
p->Y += x;
p->M -= x*12;
+ computeFloor(p);
p->validJD = 0;
r -= (int)r;
break;
}
case 5: { /* Special processing to add years */
int y = (int)r;
- assert( strcmp(aXformType[i].zName,"year")==0 );
+ assert( strcmp(aXformType[5].zName,"year")==0 );
computeYMD_HMS(p);
+ assert( p->M>=0 && p->M<=12 );
p->Y += y;
+ computeFloor(p);
p->validJD = 0;
r -= (int)r;
break;
@@ -25385,21 +25534,82 @@ static void dateFunc(
}
/*
+** Compute the number of days after the most recent January 1.
+**
+** In other words, compute the zero-based day number for the
+** current year:
+**
+** Jan01 = 0, Jan02 = 1, ..., Jan31 = 30, Feb01 = 31, ...
+** Dec31 = 364 or 365.
+*/
+static int daysAfterJan01(DateTime *pDate){
+ DateTime jan01 = *pDate;
+ assert( jan01.validYMD );
+ assert( jan01.validHMS );
+ assert( pDate->validJD );
+ jan01.validJD = 0;
+ jan01.M = 1;
+ jan01.D = 1;
+ computeJD(&jan01);
+ return (int)((pDate->iJD-jan01.iJD+43200000)/86400000);
+}
+
+/*
+** Return the number of days after the most recent Monday.
+**
+** In other words, return the day of the week according
+** to this code:
+**
+** 0=Monday, 1=Tuesday, 2=Wednesday, ..., 6=Sunday.
+*/
+static int daysAfterMonday(DateTime *pDate){
+ assert( pDate->validJD );
+ return (int)((pDate->iJD+43200000)/86400000) % 7;
+}
+
+/*
+** Return the number of days after the most recent Sunday.
+**
+** In other words, return the day of the week according
+** to this code:
+**
+** 0=Sunday, 1=Monday, 2=Tues, ..., 6=Saturday
+*/
+static int daysAfterSunday(DateTime *pDate){
+ assert( pDate->validJD );
+ return (int)((pDate->iJD+129600000)/86400000) % 7;
+}
+
+/*
** strftime( FORMAT, TIMESTRING, MOD, MOD, ...)
**
** Return a string described by FORMAT. Conversions as follows:
**
-** %d day of month
+** %d day of month 01-31
+** %e day of month 1-31
** %f ** fractional seconds SS.SSS
+** %F ISO date. YYYY-MM-DD
+** %G ISO year corresponding to %V 0000-9999.
+** %g 2-digit ISO year corresponding to %V 00-99
** %H hour 00-24
-** %j day of year 000-366
+** %k hour 0-24 (leading zero converted to space)
+** %I hour 01-12
+** %j day of year 001-366
** %J ** julian day number
+** %l hour 1-12 (leading zero converted to space)
** %m month 01-12
** %M minute 00-59
+** %p "am" or "pm"
+** %P "AM" or "PM"
+** %R time as HH:MM
** %s seconds since 1970-01-01
** %S seconds 00-59
-** %w day of week 0-6 Sunday==0
-** %W week of year 00-53
+** %T time as HH:MM:SS
+** %u day of week 1-7 Monday==1, Sunday==7
+** %w day of week 0-6 Sunday==0, Monday==1
+** %U week of year 00-53 (First Sunday is start of week 01)
+** %V week of year 01-53 (First week containing Thursday is week 01)
+** %W week of year 00-53 (First Monday is start of week 01)
** %Y year 0000-9999
** %% %
*/
@@ -25436,7 +25646,7 @@ static void strftimeFunc(
sqlite3_str_appendf(&sRes, cf=='d' ? "%02d" : "%2d", x.D);
break;
}
- case 'f': {
+ case 'f': { /* Fractional seconds. (Non-standard) */
double s = x.s;
if( s>59.999 ) s = 59.999;
sqlite3_str_appendf(&sRes, "%06.3f", s);
@@ -25446,6 +25656,21 @@ static void strftimeFunc(
sqlite3_str_appendf(&sRes, "%04d-%02d-%02d", x.Y, x.M, x.D);
break;
}
+ case 'G': /* Fall thru */
+ case 'g': {
+ DateTime y = x;
+ assert( y.validJD );
+ /* Move y so that it is the Thursday in the same week as x */
+ y.iJD += (3 - daysAfterMonday(&x))*86400000;
+ y.validYMD = 0;
+ computeYMD(&y);
+ if( cf=='g' ){
+ sqlite3_str_appendf(&sRes, "%02d", y.Y%100);
+ }else{
+ sqlite3_str_appendf(&sRes, "%04d", y.Y);
+ }
+ break;
+ }
case 'H':
case 'k': {
sqlite3_str_appendf(&sRes, cf=='H' ? "%02d" : "%2d", x.h);
@@ -25459,25 +25684,11 @@ static void strftimeFunc(
sqlite3_str_appendf(&sRes, cf=='I' ? "%02d" : "%2d", h);
break;
}
- case 'W': /* Fall thru */
- case 'j': {
- int nDay; /* Number of days since 1st day of year */
- DateTime y = x;
- y.validJD = 0;
- y.M = 1;
- y.D = 1;
- computeJD(&y);
- nDay = (int)((x.iJD-y.iJD+43200000)/86400000);
- if( cf=='W' ){
- int wd; /* 0=Monday, 1=Tuesday, ... 6=Sunday */
- wd = (int)(((x.iJD+43200000)/86400000)%7);
- sqlite3_str_appendf(&sRes,"%02d",(nDay+7-wd)/7);
- }else{
- sqlite3_str_appendf(&sRes,"%03d",nDay+1);
- }
+ case 'j': { /* Day of year. Jan01==1, Jan02==2, and so forth */
+ sqlite3_str_appendf(&sRes,"%03d",daysAfterJan01(&x)+1);
break;
}
- case 'J': {
+ case 'J': { /* Julian day number. (Non-standard) */
sqlite3_str_appendf(&sRes,"%.16g",x.iJD/86400000.0);
break;
}
@@ -25520,13 +25731,33 @@ static void strftimeFunc(
sqlite3_str_appendf(&sRes,"%02d:%02d:%02d", x.h, x.m, (int)x.s);
break;
}
- case 'u': /* Fall thru */
- case 'w': {
- char c = (char)(((x.iJD+129600000)/86400000) % 7) + '0';
+ case 'u': /* Day of week. 1 to 7. Monday==1, Sunday==7 */
+ case 'w': { /* Day of week. 0 to 6. Sunday==0, Monday==1 */
+ char c = (char)daysAfterSunday(&x) + '0';
if( c=='0' && cf=='u' ) c = '7';
sqlite3_str_appendchar(&sRes, 1, c);
break;
}
+ case 'U': { /* Week num. 00-53. First Sun of the year is week 01 */
+ sqlite3_str_appendf(&sRes,"%02d",
+ (daysAfterJan01(&x)-daysAfterSunday(&x)+7)/7);
+ break;
+ }
+ case 'V': { /* Week num. 01-53. First week with a Thur is week 01 */
+ DateTime y = x;
+ /* Adjust y so that is the Thursday in the same week as x */
+ assert( y.validJD );
+ y.iJD += (3 - daysAfterMonday(&x))*86400000;
+ y.validYMD = 0;
+ computeYMD(&y);
+ sqlite3_str_appendf(&sRes,"%02d", daysAfterJan01(&y)/7+1);
+ break;
+ }
+ case 'W': { /* Week num. 00-53. First Mon of the year is week 01 */
+ sqlite3_str_appendf(&sRes,"%02d",
+ (daysAfterJan01(&x)-daysAfterMonday(&x)+7)/7);
+ break;
+ }
case 'Y': {
sqlite3_str_appendf(&sRes,"%04d",x.Y);
break;
@@ -25673,9 +25904,7 @@ static void timediffFunc(
d1.iJD = d2.iJD - d1.iJD;
d1.iJD += (u64)1486995408 * (u64)100000;
}
- d1.validYMD = 0;
- d1.validHMS = 0;
- d1.validTZ = 0;
+ clearYMD_HMS_TZ(&d1);
computeYMD_HMS(&d1);
sqlite3StrAccumInit(&sRes, 0, 0, 0, 100);
sqlite3_str_appendf(&sRes, "%c%04d-%02d-%02d %02d:%02d:%06.3f",
@@ -25744,6 +25973,36 @@ static void currentTimeFunc(
}
#endif
+#if !defined(SQLITE_OMIT_DATETIME_FUNCS) && defined(SQLITE_DEBUG)
+/*
+** datedebug(...)
+**
+** This routine returns JSON that describes the internal DateTime object.
+** Used for debugging and testing only. Subject to change.
+*/
+static void datedebugFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ DateTime x;
+ if( isDate(context, argc, argv, &x)==0 ){
+ char *zJson;
+ zJson = sqlite3_mprintf(
+ "{iJD:%lld,Y:%d,M:%d,D:%d,h:%d,m:%d,tz:%d,"
+ "s:%.3f,validJD:%d,validYMS:%d,validHMS:%d,"
+ "nFloor:%d,rawS:%d,isError:%d,useSubsec:%d,"
+ "isUtc:%d,isLocal:%d}",
+ x.iJD, x.Y, x.M, x.D, x.h, x.m, x.tz,
+ x.s, x.validJD, x.validYMD, x.validHMS,
+ x.nFloor, x.rawS, x.isError, x.useSubsec,
+ x.isUtc, x.isLocal);
+ sqlite3_result_text(context, zJson, -1, sqlite3_free);
+ }
+}
+#endif /* !SQLITE_OMIT_DATETIME_FUNCS && SQLITE_DEBUG */
+
+
/*
** This function registered all of the above C functions as SQL
** functions. This should be the only routine in this file with
@@ -25759,6 +26018,9 @@ SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){
PURE_DATE(datetime, -1, 0, 0, datetimeFunc ),
PURE_DATE(strftime, -1, 0, 0, strftimeFunc ),
PURE_DATE(timediff, 2, 0, 0, timediffFunc ),
+#ifdef SQLITE_DEBUG
+ PURE_DATE(datedebug, -1, 0, 0, datedebugFunc ),
+#endif
DFUNCTION(current_time, 0, 0, 0, ctimeFunc ),
DFUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc),
DFUNCTION(current_date, 0, 0, 0, cdateFunc ),
@@ -30174,6 +30436,24 @@ static void sqlite3MallocAlarm(int nByte){
sqlite3_mutex_enter(mem0.mutex);
}
+#ifdef SQLITE_DEBUG
+/*
+** This routine is called whenever an out-of-memory condition is seen,
+** It's only purpose to to serve as a breakpoint for gdb or similar
+** code debuggers when working on out-of-memory conditions, for example
+** caused by PRAGMA hard_heap_limit=N.
+*/
+static SQLITE_NOINLINE void test_oom_breakpoint(u64 n){
+ static u64 nOomFault = 0;
+ nOomFault += n;
+ /* The assert() is never reached in a human lifetime. It is here mostly
+ ** to prevent code optimizers from optimizing out this function. */
+ assert( (nOomFault>>32) < 0xffffffff );
+}
+#else
+# define test_oom_breakpoint(X) /* No-op for production builds */
+#endif
+
/*
** Do a memory allocation with statistics and alarms. Assume the
** lock is already held.
@@ -30200,6 +30480,7 @@ static void mallocWithAlarm(int n, void **pp){
if( mem0.hardLimit ){
nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
if( nUsed >= mem0.hardLimit - nFull ){
+ test_oom_breakpoint(1);
*pp = 0;
return;
}
@@ -30488,6 +30769,7 @@ SQLITE_PRIVATE void *sqlite3Realloc(void *pOld, u64 nBytes){
sqlite3MallocAlarm(nDiff);
if( mem0.hardLimit>0 && nUsed >= mem0.hardLimit - nDiff ){
sqlite3_mutex_leave(mem0.mutex);
+ test_oom_breakpoint(1);
return 0;
}
}
@@ -31390,13 +31672,14 @@ SQLITE_API void sqlite3_str_vappendf(
}
exp = s.iDP-1;
- if( xtype==etGENERIC && precision>0 ) precision--;
/*
** If the field type is etGENERIC, then convert to either etEXP
** or etFLOAT, as appropriate.
*/
if( xtype==etGENERIC ){
+ assert( precision>0 );
+ precision--;
flag_rtz = !flag_alternateform;
if( exp<-4 || exp>precision ){
xtype = etEXP;
@@ -31712,9 +31995,13 @@ SQLITE_API void sqlite3_str_vappendf(
sqlite3_str_appendall(pAccum, pItem->zAlias);
}else{
Select *pSel = pItem->pSelect;
- assert( pSel!=0 );
+ assert( pSel!=0 ); /* Because of tag-20240424-1 */
if( pSel->selFlags & SF_NestedFrom ){
sqlite3_str_appendf(pAccum, "(join-%u)", pSel->selId);
+ }else if( pSel->selFlags & SF_MultiValue ){
+ assert( !pItem->fg.isTabFunc && !pItem->fg.isIndexedBy );
+ sqlite3_str_appendf(pAccum, "%u-ROW VALUES CLAUSE",
+ pItem->u1.nRow);
}else{
sqlite3_str_appendf(pAccum, "(subquery-%u)", pSel->selId);
}
@@ -32491,8 +32778,10 @@ SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc)
x.printfFlags |= SQLITE_PRINTF_INTERNAL;
sqlite3_str_appendf(&x, "{%d:*} %!S", pItem->iCursor, pItem);
if( pItem->pTab ){
- sqlite3_str_appendf(&x, " tab=%Q nCol=%d ptr=%p used=%llx",
- pItem->pTab->zName, pItem->pTab->nCol, pItem->pTab, pItem->colUsed);
+ sqlite3_str_appendf(&x, " tab=%Q nCol=%d ptr=%p used=%llx%s",
+ pItem->pTab->zName, pItem->pTab->nCol, pItem->pTab,
+ pItem->colUsed,
+ pItem->fg.rowidUsed ? "+rowid" : "");
}
if( (pItem->fg.jointype & (JT_LEFT|JT_RIGHT))==(JT_LEFT|JT_RIGHT) ){
sqlite3_str_appendf(&x, " FULL-OUTER-JOIN");
@@ -32532,12 +32821,14 @@ SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc)
sqlite3TreeViewIdList(pView, pItem->u3.pUsing, (--n)>0, "USING");
}
if( pItem->pSelect ){
+ sqlite3TreeViewPush(&pView, i+1<pSrc->nSrc);
if( pItem->pTab ){
Table *pTab = pItem->pTab;
sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, 1);
}
assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem->pSelect) );
sqlite3TreeViewSelect(pView, pItem->pSelect, (--n)>0);
+ sqlite3TreeViewPop(&pView);
}
if( pItem->fg.isTabFunc ){
sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:");
@@ -32641,7 +32932,7 @@ SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 m
sqlite3TreeViewItem(pView, "LIMIT", (n--)>0);
sqlite3TreeViewExpr(pView, p->pLimit->pLeft, p->pLimit->pRight!=0);
if( p->pLimit->pRight ){
- sqlite3TreeViewItem(pView, "OFFSET", (n--)>0);
+ sqlite3TreeViewItem(pView, "OFFSET", 0);
sqlite3TreeViewExpr(pView, p->pLimit->pRight, 0);
sqlite3TreeViewPop(&pView);
}
@@ -34943,6 +35234,44 @@ SQLITE_PRIVATE void sqlite3DequoteExpr(Expr *p){
}
/*
+** Expression p is a QNUMBER (quoted number). Dequote the value in p->u.zToken
+** and set the type to INTEGER or FLOAT. "Quoted" integers or floats are those
+** that contain '_' characters that must be removed before further processing.
+*/
+SQLITE_PRIVATE void sqlite3DequoteNumber(Parse *pParse, Expr *p){
+ assert( p!=0 || pParse->db->mallocFailed );
+ if( p ){
+ const char *pIn = p->u.zToken;
+ char *pOut = p->u.zToken;
+ int bHex = (pIn[0]=='0' && (pIn[1]=='x' || pIn[1]=='X'));
+ int iValue;
+ assert( p->op==TK_QNUMBER );
+ p->op = TK_INTEGER;
+ do {
+ if( *pIn!=SQLITE_DIGIT_SEPARATOR ){
+ *pOut++ = *pIn;
+ if( *pIn=='e' || *pIn=='E' || *pIn=='.' ) p->op = TK_FLOAT;
+ }else{
+ if( (bHex==0 && (!sqlite3Isdigit(pIn[-1]) || !sqlite3Isdigit(pIn[1])))
+ || (bHex==1 && (!sqlite3Isxdigit(pIn[-1]) || !sqlite3Isxdigit(pIn[1])))
+ ){
+ sqlite3ErrorMsg(pParse, "unrecognized token: \"%s\"", p->u.zToken);
+ }
+ }
+ }while( *pIn++ );
+ if( bHex ) p->op = TK_INTEGER;
+
+ /* tag-20240227-a: If after dequoting, the number is an integer that
+ ** fits in 32 bits, then it must be converted into EP_IntValue. Other
+ ** parts of the code expect this. See also tag-20240227-b. */
+ if( p->op==TK_INTEGER && sqlite3GetInt32(p->u.zToken, &iValue) ){
+ p->u.iValue = iValue;
+ p->flags |= EP_IntValue;
+ }
+ }
+}
+
+/*
** If the input token p is quoted, try to adjust the token to remove
** the quotes. This is not always possible:
**
@@ -36881,7 +37210,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
/* 30 */ "SeekRowid" OpHelp("intkey=r[P3]"),
/* 31 */ "NotExists" OpHelp("intkey=r[P3]"),
/* 32 */ "Last" OpHelp(""),
- /* 33 */ "IfSmaller" OpHelp(""),
+ /* 33 */ "IfSizeBetween" OpHelp(""),
/* 34 */ "SorterSort" OpHelp(""),
/* 35 */ "Sort" OpHelp(""),
/* 36 */ "Rewind" OpHelp(""),
@@ -36926,7 +37255,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
/* 75 */ "Null" OpHelp("r[P2..P3]=NULL"),
/* 76 */ "SoftNull" OpHelp("r[P1]=NULL"),
/* 77 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
- /* 78 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
+ /* 78 */ "Variable" OpHelp("r[P2]=parameter(P1)"),
/* 79 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
/* 80 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
/* 81 */ "SCopy" OpHelp("r[P2]=r[P1]"),
@@ -39324,8 +39653,12 @@ static int unixLogErrorAtLine(
** available, the error message will often be an empty string. Not a
** huge problem. Incorrectly concluding that the GNU version is available
** could lead to a segfault though.
+ **
+ ** Forum post 3f13857fa4062301 reports that the Android SDK may use
+ ** int-type return, depending on its version.
*/
-#if defined(STRERROR_R_CHAR_P) || defined(__USE_GNU)
+#if (defined(STRERROR_R_CHAR_P) || defined(__USE_GNU)) \
+ && !defined(ANDROID) && !defined(__ANDROID__)
zErr =
# endif
strerror_r(iErrno, aErr, sizeof(aErr)-1);
@@ -44423,12 +44756,19 @@ static int unixOpen(
rc = SQLITE_READONLY_DIRECTORY;
}else if( errno!=EISDIR && isReadWrite ){
/* Failed to open the file for read/write access. Try read-only. */
+ UnixUnusedFd *pReadonly = 0;
flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
openFlags &= ~(O_RDWR|O_CREAT);
flags |= SQLITE_OPEN_READONLY;
openFlags |= O_RDONLY;
isReadonly = 1;
- fd = robust_open(zName, openFlags, openMode);
+ pReadonly = findReusableFd(zName, flags);
+ if( pReadonly ){
+ fd = pReadonly->fd;
+ sqlite3_free(pReadonly);
+ }else{
+ fd = robust_open(zName, openFlags, openMode);
+ }
}
}
if( fd<0 ){
@@ -69879,6 +70219,7 @@ struct IntegrityCk {
StrAccum errMsg; /* Accumulate the error message text here */
u32 *heap; /* Min-heap used for analyzing cell coverage */
sqlite3 *db; /* Database connection running the check */
+ i64 nRow; /* Number of rows visited in current tree */
};
/*
@@ -70353,8 +70694,47 @@ int corruptPageError(int lineno, MemPage *p){
# define SQLITE_CORRUPT_PAGE(pMemPage) SQLITE_CORRUPT_PGNO(pMemPage->pgno)
#endif
+/* Default value for SHARED_LOCK_TRACE macro if shared-cache is disabled
+** or if the lock tracking is disabled. This is always the value for
+** release builds.
+*/
+#define SHARED_LOCK_TRACE(X,MSG,TAB,TYPE) /*no-op*/
+
#ifndef SQLITE_OMIT_SHARED_CACHE
+#if 0
+/* ^---- Change to 1 and recompile to enable shared-lock tracing
+** for debugging purposes.
+**
+** Print all shared-cache locks on a BtShared. Debugging use only.
+*/
+static void sharedLockTrace(
+ BtShared *pBt,
+ const char *zMsg,
+ int iRoot,
+ int eLockType
+){
+ BtLock *pLock;
+ if( iRoot>0 ){
+ printf("%s-%p %u%s:", zMsg, pBt, iRoot, eLockType==READ_LOCK?"R":"W");
+ }else{
+ printf("%s-%p:", zMsg, pBt);
+ }
+ for(pLock=pBt->pLock; pLock; pLock=pLock->pNext){
+ printf(" %p/%u%s", pLock->pBtree, pLock->iTable,
+ pLock->eLock==READ_LOCK ? "R" : "W");
+ while( pLock->pNext && pLock->pBtree==pLock->pNext->pBtree ){
+ pLock = pLock->pNext;
+ printf(",%u%s", pLock->iTable, pLock->eLock==READ_LOCK ? "R" : "W");
+ }
+ }
+ printf("\n");
+ fflush(stdout);
+}
+#undef SHARED_LOCK_TRACE
+#define SHARED_LOCK_TRACE(X,MSG,TAB,TYPE) sharedLockTrace(X,MSG,TAB,TYPE)
+#endif /* Shared-lock tracing */
+
#ifdef SQLITE_DEBUG
/*
**** This function is only used as part of an assert() statement. ***
@@ -70431,6 +70811,8 @@ static int hasSharedCacheTableLock(
iTab = iRoot;
}
+ SHARED_LOCK_TRACE(pBtree->pBt,"hasLock",iRoot,eLockType);
+
/* Search for the required lock. Either a write-lock on root-page iTab, a
** write-lock on the schema table, or (if the client is reading) a
** read-lock on iTab will suffice. Return 1 if any of these are found. */
@@ -70564,6 +70946,8 @@ static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
BtLock *pLock = 0;
BtLock *pIter;
+ SHARED_LOCK_TRACE(pBt,"setLock", iTable, eLock);
+
assert( sqlite3BtreeHoldsMutex(p) );
assert( eLock==READ_LOCK || eLock==WRITE_LOCK );
assert( p->db!=0 );
@@ -70631,6 +71015,8 @@ static void clearAllSharedCacheTableLocks(Btree *p){
assert( p->sharable || 0==*ppIter );
assert( p->inTrans>0 );
+ SHARED_LOCK_TRACE(pBt, "clearAllLocks", 0, 0);
+
while( *ppIter ){
BtLock *pLock = *ppIter;
assert( (pBt->btsFlags & BTS_EXCLUSIVE)==0 || pBt->pWriter==pLock->pBtree );
@@ -70669,6 +71055,9 @@ static void clearAllSharedCacheTableLocks(Btree *p){
*/
static void downgradeAllSharedCacheTableLocks(Btree *p){
BtShared *pBt = p->pBt;
+
+ SHARED_LOCK_TRACE(pBt, "downgradeLocks", 0, 0);
+
if( pBt->pWriter==p ){
BtLock *pLock;
pBt->pWriter = 0;
@@ -75282,9 +75671,12 @@ static int accessPayload(
if( pCur->aOverflow==0
|| nOvfl*(int)sizeof(Pgno) > sqlite3MallocSize(pCur->aOverflow)
){
- Pgno *aNew = (Pgno*)sqlite3Realloc(
- pCur->aOverflow, nOvfl*2*sizeof(Pgno)
- );
+ Pgno *aNew;
+ if( sqlite3FaultSim(413) ){
+ aNew = 0;
+ }else{
+ aNew = (Pgno*)sqlite3Realloc(pCur->aOverflow, nOvfl*2*sizeof(Pgno));
+ }
if( aNew==0 ){
return SQLITE_NOMEM_BKPT;
}else{
@@ -75294,6 +75686,12 @@ static int accessPayload(
memset(pCur->aOverflow, 0, nOvfl*sizeof(Pgno));
pCur->curFlags |= BTCF_ValidOvfl;
}else{
+ /* Sanity check the validity of the overflow page cache */
+ assert( pCur->aOverflow[0]==nextPage
+ || pCur->aOverflow[0]==0
+ || CORRUPT_DB );
+ assert( pCur->aOverflow[0]!=0 || pCur->aOverflow[offset/ovflSize]==0 );
+
/* If the overflow page-list cache has been allocated and the
** entry for the first required overflow page is valid, skip
** directly to it.
@@ -75775,6 +76173,23 @@ SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){
return rc;
}
+#ifdef SQLITE_DEBUG
+/* The cursors is CURSOR_VALID and has BTCF_AtLast set. Verify that
+** this flags are true for a consistent database.
+**
+** This routine is is called from within assert() statements only.
+** It is an internal verification routine and does not appear in production
+** builds.
+*/
+static int cursorIsAtLastEntry(BtCursor *pCur){
+ int ii;
+ for(ii=0; ii<pCur->iPage; ii++){
+ if( pCur->aiIdx[ii]!=pCur->apPage[ii]->nCell ) return 0;
+ }
+ return pCur->ix==pCur->pPage->nCell-1 && pCur->pPage->leaf!=0;
+}
+#endif
+
/* Move the cursor to the last entry in the table. Return SQLITE_OK
** on success. Set *pRes to 0 if the cursor actually points to something
** or set *pRes to 1 if the table is empty.
@@ -75803,18 +76218,7 @@ SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor *pCur, int *pRes){
/* If the cursor already points to the last entry, this is a no-op. */
if( CURSOR_VALID==pCur->eState && (pCur->curFlags & BTCF_AtLast)!=0 ){
-#ifdef SQLITE_DEBUG
- /* This block serves to assert() that the cursor really does point
- ** to the last entry in the b-tree. */
- int ii;
- for(ii=0; ii<pCur->iPage; ii++){
- assert( pCur->aiIdx[ii]==pCur->apPage[ii]->nCell );
- }
- assert( pCur->ix==pCur->pPage->nCell-1 || CORRUPT_DB );
- testcase( pCur->ix!=pCur->pPage->nCell-1 );
- /* ^-- dbsqlfuzz b92b72e4de80b5140c30ab71372ca719b8feb618 */
- assert( pCur->pPage->leaf );
-#endif
+ assert( cursorIsAtLastEntry(pCur) || CORRUPT_DB );
*pRes = 0;
return SQLITE_OK;
}
@@ -75867,6 +76271,7 @@ SQLITE_PRIVATE int sqlite3BtreeTableMoveto(
}
if( pCur->info.nKey<intKey ){
if( (pCur->curFlags & BTCF_AtLast)!=0 ){
+ assert( cursorIsAtLastEntry(pCur) || CORRUPT_DB );
*pRes = -1;
return SQLITE_OK;
}
@@ -76333,10 +76738,10 @@ SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor *pCur){
assert( cursorOwnsBtShared(pCur) );
assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
- /* Currently this interface is only called by the OP_IfSmaller
- ** opcode, and it that case the cursor will always be valid and
- ** will always point to a leaf node. */
- if( NEVER(pCur->eState!=CURSOR_VALID) ) return -1;
+ /* Currently this interface is only called by the OP_IfSizeBetween
+ ** opcode and the OP_Count opcode with P3=1. In either case,
+ ** the cursor will always be valid unless the btree is empty. */
+ if( pCur->eState!=CURSOR_VALID ) return 0;
if( NEVER(pCur->pPage->leaf==0) ) return -1;
n = pCur->pPage->nCell;
@@ -78467,7 +78872,7 @@ static int balance_nonroot(
** table-interior, index-leaf, or index-interior).
*/
if( pOld->aData[0]!=apOld[0]->aData[0] ){
- rc = SQLITE_CORRUPT_BKPT;
+ rc = SQLITE_CORRUPT_PAGE(pOld);
goto balance_cleanup;
}
@@ -78491,7 +78896,7 @@ static int balance_nonroot(
memset(&b.szCell[b.nCell], 0, sizeof(b.szCell[0])*(limit+pOld->nOverflow));
if( pOld->nOverflow>0 ){
if( NEVER(limit<pOld->aiOvfl[0]) ){
- rc = SQLITE_CORRUPT_BKPT;
+ rc = SQLITE_CORRUPT_PAGE(pOld);
goto balance_cleanup;
}
limit = pOld->aiOvfl[0];
@@ -79134,7 +79539,7 @@ static int anotherValidCursor(BtCursor *pCur){
&& pOther->eState==CURSOR_VALID
&& pOther->pPage==pCur->pPage
){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PAGE(pCur->pPage);
}
}
return SQLITE_OK;
@@ -79194,7 +79599,7 @@ static int balance(BtCursor *pCur){
/* The page being written is not a root page, and there is currently
** more than one reference to it. This only happens if the page is one
** of its own ancestor pages. Corruption. */
- rc = SQLITE_CORRUPT_BKPT;
+ rc = SQLITE_CORRUPT_PAGE(pPage);
}else{
MemPage * const pParent = pCur->apPage[iPage-1];
int const iIdx = pCur->aiIdx[iPage-1];
@@ -79358,7 +79763,7 @@ static SQLITE_NOINLINE int btreeOverwriteOverflowCell(
rc = btreeGetPage(pBt, ovflPgno, &pPage, 0);
if( rc ) return rc;
if( sqlite3PagerPageRefcount(pPage->pDbPage)!=1 || pPage->isInit ){
- rc = SQLITE_CORRUPT_BKPT;
+ rc = SQLITE_CORRUPT_PAGE(pPage);
}else{
if( iOffset+ovflPageSize<(u32)nTotal ){
ovflPgno = get4byte(pPage->aData);
@@ -79386,7 +79791,7 @@ static int btreeOverwriteCell(BtCursor *pCur, const BtreePayload *pX){
if( pCur->info.pPayload + pCur->info.nLocal > pPage->aDataEnd
|| pCur->info.pPayload < pPage->aData + pPage->cellOffset
){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PAGE(pPage);
}
if( pCur->info.nLocal==nTotal ){
/* The entire cell is local */
@@ -79467,7 +79872,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
** Which can only happen if the SQLITE_NoSchemaError flag was set when
** the schema was loaded. This cannot be asserted though, as a user might
** set the flag, load the schema, and then unset the flag. */
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pCur->pgnoRoot);
}
}
@@ -79590,7 +79995,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
if( pPage->nFree<0 ){
if( NEVER(pCur->eState>CURSOR_INVALID) ){
/* ^^^^^--- due to the moveToRoot() call above */
- rc = SQLITE_CORRUPT_BKPT;
+ rc = SQLITE_CORRUPT_PAGE(pPage);
}else{
rc = btreeComputeFreeSpace(pPage);
}
@@ -79632,7 +80037,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
CellInfo info;
assert( idx>=0 );
if( idx>=pPage->nCell ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PAGE(pPage);
}
rc = sqlite3PagerWrite(pPage->pDbPage);
if( rc ){
@@ -79659,10 +80064,10 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */
assert( rc==SQLITE_OK ); /* clearCell never fails when nLocal==nPayload */
if( oldCell < pPage->aData+pPage->hdrOffset+10 ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PAGE(pPage);
}
if( oldCell+szNew > pPage->aDataEnd ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PAGE(pPage);
}
memcpy(oldCell, newCell, szNew);
return SQLITE_OK;
@@ -79764,7 +80169,7 @@ SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64
nIn = pSrc->info.nLocal;
aIn = pSrc->info.pPayload;
if( aIn+nIn>pSrc->pPage->aDataEnd ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PAGE(pSrc->pPage);
}
nRem = pSrc->info.nPayload;
if( nIn==nRem && nIn<pDest->pPage->maxLocal ){
@@ -79789,7 +80194,7 @@ SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64
if( nRem>nIn ){
if( aIn+nIn+4>pSrc->pPage->aDataEnd ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PAGE(pSrc->pPage);
}
ovflIn = get4byte(&pSrc->info.pPayload[nIn]);
}
@@ -79885,7 +80290,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
assert( rc!=SQLITE_OK || CORRUPT_DB || pCur->eState==CURSOR_VALID );
if( rc || pCur->eState!=CURSOR_VALID ) return rc;
}else{
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pCur->pgnoRoot);
}
}
assert( pCur->eState==CURSOR_VALID );
@@ -79894,14 +80299,14 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
iCellIdx = pCur->ix;
pPage = pCur->pPage;
if( pPage->nCell<=iCellIdx ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PAGE(pPage);
}
pCell = findCell(pPage, iCellIdx);
if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PAGE(pPage);
}
if( pCell<&pPage->aCellIdx[pPage->nCell] ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PAGE(pPage);
}
/* If the BTREE_SAVEPOSITION bit is on, then the cursor position must
@@ -79992,7 +80397,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
n = pCur->pPage->pgno;
}
pCell = findCell(pLeaf, pLeaf->nCell-1);
- if( pCell<&pLeaf->aData[4] ) return SQLITE_CORRUPT_BKPT;
+ if( pCell<&pLeaf->aData[4] ) return SQLITE_CORRUPT_PAGE(pLeaf);
nCell = pLeaf->xCellSize(pLeaf, pCell);
assert( MX_CELL_SIZE(pBt) >= nCell );
pTmp = pBt->pTmpSpace;
@@ -80108,7 +80513,7 @@ static int btreeCreateTable(Btree *p, Pgno *piTable, int createTabFlags){
*/
sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &pgnoRoot);
if( pgnoRoot>btreePagecount(pBt) ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pgnoRoot);
}
pgnoRoot++;
@@ -80156,7 +80561,7 @@ static int btreeCreateTable(Btree *p, Pgno *piTable, int createTabFlags){
}
rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage);
if( eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){
- rc = SQLITE_CORRUPT_BKPT;
+ rc = SQLITE_CORRUPT_PGNO(pgnoRoot);
}
if( rc!=SQLITE_OK ){
releasePage(pRoot);
@@ -80246,14 +80651,14 @@ static int clearDatabasePage(
assert( sqlite3_mutex_held(pBt->mutex) );
if( pgno>btreePagecount(pBt) ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pgno);
}
rc = getAndInitPage(pBt, pgno, &pPage, 0);
if( rc ) return rc;
if( (pBt->openFlags & BTREE_SINGLE)==0
&& sqlite3PagerPageRefcount(pPage->pDbPage) != (1 + (pgno==1))
){
- rc = SQLITE_CORRUPT_BKPT;
+ rc = SQLITE_CORRUPT_PAGE(pPage);
goto cleardatabasepage_out;
}
hdr = pPage->hdrOffset;
@@ -80357,7 +80762,7 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){
assert( p->inTrans==TRANS_WRITE );
assert( iTable>=2 );
if( iTable>btreePagecount(pBt) ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(iTable);
}
rc = sqlite3BtreeClearTable(p, iTable, 0);
@@ -80951,6 +81356,9 @@ static int checkTreePage(
** number of cells on the page. */
nCell = get2byte(&data[hdr+3]);
assert( pPage->nCell==nCell );
+ if( pPage->leaf || pPage->intKey==0 ){
+ pCheck->nRow += nCell;
+ }
/* EVIDENCE-OF: R-23882-45353 The cell pointer array of a b-tree page
** immediately follows the b-tree page header. */
@@ -81062,6 +81470,7 @@ static int checkTreePage(
btreeHeapInsert(heap, (pc<<16)|(pc+size-1));
}
}
+ assert( heap!=0 );
/* Add the freeblocks to the min-heap
**
** EVIDENCE-OF: R-20690-50594 The second field of the b-tree page header
@@ -81161,6 +81570,7 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck(
sqlite3 *db, /* Database connection that is running the check */
Btree *p, /* The btree to be checked */
Pgno *aRoot, /* An array of root pages numbers for individual trees */
+ Mem *aCnt, /* Memory cells to write counts for each tree to */
int nRoot, /* Number of entries in aRoot[] */
int mxErr, /* Stop reporting errors after this many */
int *pnErr, /* OUT: Write number of errors seen to this variable */
@@ -81174,7 +81584,9 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck(
int bPartial = 0; /* True if not checking all btrees */
int bCkFreelist = 1; /* True to scan the freelist */
VVA_ONLY( int nRef );
+
assert( nRoot>0 );
+ assert( aCnt!=0 );
/* aRoot[0]==0 means this is a partial check */
if( aRoot[0]==0 ){
@@ -81247,15 +81659,18 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck(
testcase( pBt->db->flags & SQLITE_CellSizeCk );
pBt->db->flags &= ~(u64)SQLITE_CellSizeCk;
for(i=0; (int)i<nRoot && sCheck.mxErr; i++){
- i64 notUsed;
- if( aRoot[i]==0 ) continue;
+ sCheck.nRow = 0;
+ if( aRoot[i] ){
+ i64 notUsed;
#ifndef SQLITE_OMIT_AUTOVACUUM
- if( pBt->autoVacuum && aRoot[i]>1 && !bPartial ){
- checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0);
- }
+ if( pBt->autoVacuum && aRoot[i]>1 && !bPartial ){
+ checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0);
+ }
#endif
- sCheck.v0 = aRoot[i];
- checkTreePage(&sCheck, aRoot[i], &notUsed, LARGEST_INT64);
+ sCheck.v0 = aRoot[i];
+ checkTreePage(&sCheck, aRoot[i], &notUsed, LARGEST_INT64);
+ }
+ sqlite3MemSetArrayInt64(aCnt, i, sCheck.nRow);
}
pBt->db->flags = savedDbFlags;
@@ -83310,6 +83725,13 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){
}
}
+/*
+** Set the iIdx'th entry of array aMem[] to contain integer value val.
+*/
+SQLITE_PRIVATE void sqlite3MemSetArrayInt64(sqlite3_value *aMem, int iIdx, i64 val){
+ sqlite3VdbeMemSetInt64(&aMem[iIdx], val);
+}
+
/* A no-op destructor */
SQLITE_PRIVATE void sqlite3NoopDestructor(void *p){ UNUSED_PARAMETER(p); }
@@ -83998,14 +84420,20 @@ static int valueFromExpr(
}
/* Handle negative integers in a single step. This is needed in the
- ** case when the value is -9223372036854775808.
- */
- if( op==TK_UMINUS
- && (pExpr->pLeft->op==TK_INTEGER || pExpr->pLeft->op==TK_FLOAT) ){
- pExpr = pExpr->pLeft;
- op = pExpr->op;
- negInt = -1;
- zNeg = "-";
+ ** case when the value is -9223372036854775808. Except - do not do this
+ ** for hexadecimal literals. */
+ if( op==TK_UMINUS ){
+ Expr *pLeft = pExpr->pLeft;
+ if( (pLeft->op==TK_INTEGER || pLeft->op==TK_FLOAT) ){
+ if( ExprHasProperty(pLeft, EP_IntValue)
+ || pLeft->u.zToken[0]!='0' || (pLeft->u.zToken[1] & ~0x20)!='X'
+ ){
+ pExpr = pLeft;
+ op = pExpr->op;
+ negInt = -1;
+ zNeg = "-";
+ }
+ }
}
if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){
@@ -84014,12 +84442,26 @@ static int valueFromExpr(
if( ExprHasProperty(pExpr, EP_IntValue) ){
sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue*negInt);
}else{
- zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken);
- if( zVal==0 ) goto no_mem;
- sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC);
+ i64 iVal;
+ if( op==TK_INTEGER && 0==sqlite3DecOrHexToI64(pExpr->u.zToken, &iVal) ){
+ sqlite3VdbeMemSetInt64(pVal, iVal*negInt);
+ }else{
+ zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken);
+ if( zVal==0 ) goto no_mem;
+ sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC);
+ }
}
- if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){
- sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8);
+ if( affinity==SQLITE_AFF_BLOB ){
+ if( op==TK_FLOAT ){
+ assert( pVal && pVal->z && pVal->flags==(MEM_Str|MEM_Term) );
+ sqlite3AtoF(pVal->z, &pVal->u.r, pVal->n, SQLITE_UTF8);
+ pVal->flags = MEM_Real;
+ }else if( op==TK_INTEGER ){
+ /* This case is required by -9223372036854775808 and other strings
+ ** that look like integers but cannot be handled by the
+ ** sqlite3DecOrHexToI64() call above. */
+ sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8);
+ }
}else{
sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8);
}
@@ -84289,17 +84731,17 @@ SQLITE_PRIVATE int sqlite3Stat4Column(
sqlite3_value **ppVal /* OUT: Extracted value */
){
u32 t = 0; /* a column type code */
- int nHdr; /* Size of the header in the record */
- int iHdr; /* Next unread header byte */
- int iField; /* Next unread data byte */
- int szField = 0; /* Size of the current data field */
+ u32 nHdr; /* Size of the header in the record */
+ u32 iHdr; /* Next unread header byte */
+ i64 iField; /* Next unread data byte */
+ u32 szField = 0; /* Size of the current data field */
int i; /* Column index */
u8 *a = (u8*)pRec; /* Typecast byte array */
Mem *pMem = *ppVal; /* Write result into this Mem object */
assert( iCol>0 );
iHdr = getVarint32(a, nHdr);
- if( nHdr>nRec || iHdr>=nHdr ) return SQLITE_CORRUPT_BKPT;
+ if( nHdr>(u32)nRec || iHdr>=nHdr ) return SQLITE_CORRUPT_BKPT;
iField = nHdr;
for(i=0; i<=iCol; i++){
iHdr += getVarint32(&a[iHdr], t);
@@ -85334,6 +85776,15 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
assert( aLabel!=0 ); /* True because of tag-20230419-1 */
pOp->p2 = aLabel[ADDR(pOp->p2)];
}
+
+ /* OPFLG_JUMP opcodes never have P2==0, though OPFLG_JUMP0 opcodes
+ ** might */
+ assert( pOp->p2>0
+ || (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP0)!=0 );
+
+ /* Jumps never go off the end of the bytecode array */
+ assert( pOp->p2<p->nOp
+ || (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)==0 );
break;
}
}
@@ -87741,7 +88192,7 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){
/* Check for immediate foreign key violations. */
if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){
- sqlite3VdbeCheckFk(p, 0);
+ (void)sqlite3VdbeCheckFk(p, 0);
}
/* If the auto-commit flag is set and this is the only active writer
@@ -88911,17 +89362,15 @@ SQLITE_PRIVATE int sqlite3IntFloatCompare(i64 i, double r){
return (x<r) ? -1 : (x>r);
}else{
i64 y;
- double s;
if( r<-9223372036854775808.0 ) return +1;
if( r>=9223372036854775808.0 ) return -1;
y = (i64)r;
if( i<y ) return -1;
if( i>y ) return +1;
- s = (double)i;
- testcase( doubleLt(s,r) );
- testcase( doubleLt(r,s) );
- testcase( doubleEq(r,s) );
- return (s<r) ? -1 : (s>r);
+ testcase( doubleLt(((double)i),r) );
+ testcase( doubleLt(r,((double)i)) );
+ testcase( doubleEq(r,((double)i)) );
+ return (((double)i)<r) ? -1 : (((double)i)>r);
}
}
@@ -92329,7 +92778,6 @@ SQLITE_API int sqlite3_stmt_scanstatus_v2(
}
if( flags & SQLITE_SCANSTAT_COMPLEX ){
idx = iScan;
- pScan = &p->aScan[idx];
}else{
/* If the COMPLEX flag is clear, then this function must ignore any
** ScanStatus structures with ScanStatus.addrLoop set to 0. */
@@ -92342,6 +92790,8 @@ SQLITE_API int sqlite3_stmt_scanstatus_v2(
}
}
if( idx>=p->nScan ) return 1;
+ assert( pScan==0 || pScan==&p->aScan[idx] );
+ pScan = &p->aScan[idx];
switch( iScanStatusOp ){
case SQLITE_SCANSTAT_NLOOP: {
@@ -93790,7 +94240,7 @@ case OP_Return: { /* in1 */
**
** See also: EndCoroutine
*/
-case OP_InitCoroutine: { /* jump */
+case OP_InitCoroutine: { /* jump0 */
assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );
assert( pOp->p2>=0 && pOp->p2<p->nOp );
assert( pOp->p3>=0 && pOp->p3<p->nOp );
@@ -93813,7 +94263,9 @@ jump_to_p2:
**
** The instruction at the address in register P1 is a Yield.
** Jump to the P2 parameter of that Yield.
-** After the jump, register P1 becomes undefined.
+** After the jump, the value register P1 is left with a value
+** such that subsequent OP_Yields go back to the this same
+** OP_EndCoroutine instruction.
**
** See also: InitCoroutine
*/
@@ -93825,8 +94277,8 @@ case OP_EndCoroutine: { /* in1 */
pCaller = &aOp[pIn1->u.i];
assert( pCaller->opcode==OP_Yield );
assert( pCaller->p2>=0 && pCaller->p2<p->nOp );
+ pIn1->u.i = (int)(pOp - p->aOp) - 1;
pOp = &aOp[pCaller->p2 - 1];
- pIn1->flags = MEM_Undefined;
break;
}
@@ -93843,7 +94295,7 @@ case OP_EndCoroutine: { /* in1 */
**
** See also: InitCoroutine
*/
-case OP_Yield: { /* in1, jump */
+case OP_Yield: { /* in1, jump0 */
int pcDest;
pIn1 = &aMem[pOp->p1];
assert( VdbeMemDynamic(pIn1)==0 );
@@ -94173,19 +94625,15 @@ case OP_Blob: { /* out2 */
break;
}
-/* Opcode: Variable P1 P2 * P4 *
-** Synopsis: r[P2]=parameter(P1,P4)
+/* Opcode: Variable P1 P2 * * *
+** Synopsis: r[P2]=parameter(P1)
**
** Transfer the values of bound parameter P1 into register P2
-**
-** If the parameter is named, then its name appears in P4.
-** The P4 value is used by sqlite3_bind_parameter_name().
*/
case OP_Variable: { /* out2 */
Mem *pVar; /* Value being transferred */
assert( pOp->p1>0 && pOp->p1<=p->nVar );
- assert( pOp->p4.z==0 || pOp->p4.z==sqlite3VListNumToName(p->pVList,pOp->p1) );
pVar = &p->aVar[pOp->p1 - 1];
if( sqlite3VdbeMemTooBig(pVar) ){
goto too_big;
@@ -94706,7 +95154,7 @@ case OP_AddImm: { /* in1 */
** without data loss, then jump immediately to P2, or if P2==0
** raise an SQLITE_MISMATCH exception.
*/
-case OP_MustBeInt: { /* jump, in1 */
+case OP_MustBeInt: { /* jump0, in1 */
pIn1 = &aMem[pOp->p1];
if( (pIn1->flags & MEM_Int)==0 ){
applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding);
@@ -94747,7 +95195,7 @@ case OP_RealAffinity: { /* in1 */
}
#endif
-#ifndef SQLITE_OMIT_CAST
+#if !defined(SQLITE_OMIT_CAST) && !defined(SQLITE_OMIT_ANALYZE)
/* Opcode: Cast P1 P2 * * *
** Synopsis: affinity(r[P1])
**
@@ -96319,11 +96767,16 @@ case OP_MakeRecord: {
switch( len ){
default: zPayload[7] = (u8)(v&0xff); v >>= 8;
zPayload[6] = (u8)(v&0xff); v >>= 8;
+ /* no break */ deliberate_fall_through
case 6: zPayload[5] = (u8)(v&0xff); v >>= 8;
zPayload[4] = (u8)(v&0xff); v >>= 8;
+ /* no break */ deliberate_fall_through
case 4: zPayload[3] = (u8)(v&0xff); v >>= 8;
+ /* no break */ deliberate_fall_through
case 3: zPayload[2] = (u8)(v&0xff); v >>= 8;
+ /* no break */ deliberate_fall_through
case 2: zPayload[1] = (u8)(v&0xff); v >>= 8;
+ /* no break */ deliberate_fall_through
case 1: zPayload[0] = (u8)(v&0xff);
}
zPayload += len;
@@ -97242,7 +97695,8 @@ case OP_SequenceTest: {
** is the only cursor opcode that works with a pseudo-table.
**
** P3 is the number of fields in the records that will be stored by
-** the pseudo-table.
+** the pseudo-table. If P2 is 0 or negative then the pseudo-cursor
+** will return NULL for every column.
*/
case OP_OpenPseudo: {
VdbeCursor *pCx;
@@ -97385,10 +97839,10 @@ case OP_ColumnsUsed: {
**
** See also: Found, NotFound, SeekGt, SeekGe, SeekLt
*/
-case OP_SeekLT: /* jump, in3, group, ncycle */
-case OP_SeekLE: /* jump, in3, group, ncycle */
-case OP_SeekGE: /* jump, in3, group, ncycle */
-case OP_SeekGT: { /* jump, in3, group, ncycle */
+case OP_SeekLT: /* jump0, in3, group, ncycle */
+case OP_SeekLE: /* jump0, in3, group, ncycle */
+case OP_SeekGE: /* jump0, in3, group, ncycle */
+case OP_SeekGT: { /* jump0, in3, group, ncycle */
int res; /* Comparison result */
int oc; /* Opcode */
VdbeCursor *pC; /* The cursor to seek */
@@ -98055,7 +98509,7 @@ case OP_Found: { /* jump, in3, ncycle */
**
** See also: Found, NotFound, NoConflict, SeekRowid
*/
-case OP_SeekRowid: { /* jump, in3, ncycle */
+case OP_SeekRowid: { /* jump0, in3, ncycle */
VdbeCursor *pC;
BtCursor *pCrsr;
int res;
@@ -98814,7 +99268,7 @@ case OP_NullRow: {
** configured to use Prev, not Next.
*/
case OP_SeekEnd: /* ncycle */
-case OP_Last: { /* jump, ncycle */
+case OP_Last: { /* jump0, ncycle */
VdbeCursor *pC;
BtCursor *pCrsr;
int res;
@@ -98848,28 +99302,38 @@ case OP_Last: { /* jump, ncycle */
break;
}
-/* Opcode: IfSmaller P1 P2 P3 * *
+/* Opcode: IfSizeBetween P1 P2 P3 P4 *
**
-** Estimate the number of rows in the table P1. Jump to P2 if that
-** estimate is less than approximately 2**(0.1*P3).
+** Let N be the approximate number of rows in the table or index
+** with cursor P1 and let X be 10*log2(N) if N is positive or -1
+** if N is zero.
+**
+** Jump to P2 if X is in between P3 and P4, inclusive.
*/
-case OP_IfSmaller: { /* jump */
+case OP_IfSizeBetween: { /* jump */
VdbeCursor *pC;
BtCursor *pCrsr;
int res;
i64 sz;
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
+ assert( pOp->p4type==P4_INT32 );
+ assert( pOp->p3>=-1 && pOp->p3<=640*2 );
+ assert( pOp->p4.i>=-1 && pOp->p4.i<=640*2 );
pC = p->apCsr[pOp->p1];
assert( pC!=0 );
pCrsr = pC->uc.pCursor;
assert( pCrsr );
rc = sqlite3BtreeFirst(pCrsr, &res);
if( rc ) goto abort_due_to_error;
- if( res==0 ){
+ if( res!=0 ){
+ sz = -1; /* -Infinity encoding */
+ }else{
sz = sqlite3BtreeRowCountEst(pCrsr);
- if( ALWAYS(sz>=0) && sqlite3LogEst((u64)sz)<pOp->p3 ) res = 1;
+ assert( sz>0 );
+ sz = sqlite3LogEst((u64)sz);
}
+ res = sz>=pOp->p3 && sz<=pOp->p4.i;
VdbeBranchTaken(res!=0,2);
if( res ) goto jump_to_p2;
break;
@@ -98922,7 +99386,7 @@ case OP_Sort: { /* jump ncycle */
** from the beginning toward the end. In other words, the cursor is
** configured to use Next, not Prev.
*/
-case OP_Rewind: { /* jump, ncycle */
+case OP_Rewind: { /* jump0, ncycle */
VdbeCursor *pC;
BtCursor *pCrsr;
int res;
@@ -99569,11 +100033,18 @@ case OP_CreateBtree: { /* out2 */
break;
}
-/* Opcode: SqlExec * * * P4 *
+/* Opcode: SqlExec P1 P2 * P4 *
**
** Run the SQL statement or statements specified in the P4 string.
-** Disable Auth and Trace callbacks while those statements are running if
-** P1 is true.
+**
+** The P1 parameter is a bitmask of options:
+**
+** 0x0001 Disable Auth and Trace callbacks while the statements
+** in P4 are running.
+**
+** 0x0002 Set db->nAnalysisLimit to P2 while the statements in
+** P4 are running.
+**
*/
case OP_SqlExec: {
char *zErr;
@@ -99581,6 +100052,7 @@ case OP_SqlExec: {
sqlite3_xauth xAuth;
#endif
u8 mTrace;
+ int savedAnalysisLimit;
sqlite3VdbeIncrWriteCounter(p, 0);
db->nSqlExec++;
@@ -99589,18 +100061,23 @@ case OP_SqlExec: {
xAuth = db->xAuth;
#endif
mTrace = db->mTrace;
- if( pOp->p1 ){
+ savedAnalysisLimit = db->nAnalysisLimit;
+ if( pOp->p1 & 0x0001 ){
#ifndef SQLITE_OMIT_AUTHORIZATION
db->xAuth = 0;
#endif
db->mTrace = 0;
}
+ if( pOp->p1 & 0x0002 ){
+ db->nAnalysisLimit = pOp->p2;
+ }
rc = sqlite3_exec(db, pOp->p4.z, 0, 0, &zErr);
db->nSqlExec--;
#ifndef SQLITE_OMIT_AUTHORIZATION
db->xAuth = xAuth;
#endif
db->mTrace = mTrace;
+ db->nAnalysisLimit = savedAnalysisLimit;
if( zErr || rc ){
sqlite3VdbeError(p, "%s", zErr);
sqlite3_free(zErr);
@@ -99752,11 +100229,11 @@ case OP_DropTrigger: {
/* Opcode: IntegrityCk P1 P2 P3 P4 P5
**
** Do an analysis of the currently open database. Store in
-** register P1 the text of an error message describing any problems.
-** If no problems are found, store a NULL in register P1.
+** register (P1+1) the text of an error message describing any problems.
+** If no problems are found, store a NULL in register (P1+1).
**
-** The register P3 contains one less than the maximum number of allowed errors.
-** At most reg(P3) errors will be reported.
+** The register (P1) contains one less than the maximum number of allowed
+** errors. At most reg(P1) errors will be reported.
** In other words, the analysis stops as soon as reg(P1) errors are
** seen. Reg(P1) is updated with the number of errors remaining.
**
@@ -99776,19 +100253,21 @@ case OP_IntegrityCk: {
Mem *pnErr; /* Register keeping track of errors remaining */
assert( p->bIsReader );
+ assert( pOp->p4type==P4_INTARRAY );
nRoot = pOp->p2;
aRoot = pOp->p4.ai;
assert( nRoot>0 );
+ assert( aRoot!=0 );
assert( aRoot[0]==(Pgno)nRoot );
- assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );
- pnErr = &aMem[pOp->p3];
+ assert( pOp->p1>0 && (pOp->p1+1)<=(p->nMem+1 - p->nCursor) );
+ pnErr = &aMem[pOp->p1];
assert( (pnErr->flags & MEM_Int)!=0 );
assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 );
- pIn1 = &aMem[pOp->p1];
+ pIn1 = &aMem[pOp->p1+1];
assert( pOp->p5<db->nDb );
assert( DbMaskTest(p->btreeMask, pOp->p5) );
- rc = sqlite3BtreeIntegrityCheck(db, db->aDb[pOp->p5].pBt, &aRoot[1], nRoot,
- (int)pnErr->u.i+1, &nErr, &z);
+ rc = sqlite3BtreeIntegrityCheck(db, db->aDb[pOp->p5].pBt, &aRoot[1],
+ &aMem[pOp->p3], nRoot, (int)pnErr->u.i+1, &nErr, &z);
sqlite3VdbeMemSetNull(pIn1);
if( nErr==0 ){
assert( z==0 );
@@ -99915,7 +100394,9 @@ case OP_RowSetTest: { /* jump, in1, in3 */
** P1 contains the address of the memory cell that contains the first memory
** cell in an array of values used as arguments to the sub-program. P2
** contains the address to jump to if the sub-program throws an IGNORE
-** exception using the RAISE() function. Register P3 contains the address
+** exception using the RAISE() function. P2 might be zero, if there is
+** no possibility that an IGNORE exception will be raised.
+** Register P3 contains the address
** of a memory cell in this (the parent) VM that is used to allocate the
** memory required by the sub-vdbe at runtime.
**
@@ -99923,7 +100404,7 @@ case OP_RowSetTest: { /* jump, in1, in3 */
**
** If P5 is non-zero, then recursive program invocation is enabled.
*/
-case OP_Program: { /* jump */
+case OP_Program: { /* jump0 */
int nMem; /* Number of memory registers for sub-program */
int nByte; /* Bytes of runtime space required for sub-program */
Mem *pRt; /* Register to allocate runtime space */
@@ -101472,7 +101953,7 @@ case OP_Filter: { /* jump */
** error is encountered.
*/
case OP_Trace:
-case OP_Init: { /* jump */
+case OP_Init: { /* jump0 */
int i;
#ifndef SQLITE_OMIT_TRACE
char *zTrace;
@@ -105373,10 +105854,10 @@ static int bytecodevtabColumn(
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
case 9: /* nexec */
- sqlite3_result_int(ctx, pOp->nExec);
+ sqlite3_result_int64(ctx, pOp->nExec);
break;
case 10: /* ncycle */
- sqlite3_result_int(ctx, pOp->nCycle);
+ sqlite3_result_int64(ctx, pOp->nCycle);
break;
#else
case 9: /* nexec */
@@ -106520,7 +107001,7 @@ static int lookupName(
Parse *pParse, /* The parsing context */
const char *zDb, /* Name of the database containing table, or NULL */
const char *zTab, /* Name of table containing column, or NULL */
- const char *zCol, /* Name of the column. */
+ const Expr *pRight, /* Name of the column. */
NameContext *pNC, /* The name context used to resolve the name */
Expr *pExpr /* Make this EXPR node point to the selected column */
){
@@ -106537,6 +107018,7 @@ static int lookupName(
Table *pTab = 0; /* Table holding the row */
Column *pCol; /* A column of pTab */
ExprList *pFJMatch = 0; /* Matches for FULL JOIN .. USING */
+ const char *zCol = pRight->u.zToken;
assert( pNC ); /* the name context cannot be NULL. */
assert( zCol ); /* The Z in X.Y.Z cannot be NULL */
@@ -106768,7 +107250,8 @@ static int lookupName(
if( pParse->bReturning ){
if( (pNC->ncFlags & NC_UBaseReg)!=0
&& ALWAYS(zTab==0
- || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
+ || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0
+ || isValidSchemaTableName(zTab, pParse->pTriggerTab, 0))
){
pExpr->iTable = op!=TK_DELETE;
pTab = pParse->pTriggerTab;
@@ -106872,6 +107355,11 @@ static int lookupName(
&& ALWAYS(VisibleRowid(pMatch->pTab) || pMatch->fg.isNestedFrom)
){
cnt = cntTab;
+#if SQLITE_ALLOW_ROWID_IN_VIEW+0==2
+ if( pMatch->pTab!=0 && IsView(pMatch->pTab) ){
+ eNewExprOp = TK_NULL;
+ }
+#endif
if( pMatch->fg.isNestedFrom==0 ) pExpr->iColumn = -1;
pExpr->affExpr = SQLITE_AFF_INTEGER;
}
@@ -107025,6 +107513,10 @@ static int lookupName(
sqlite3ErrorMsg(pParse, "%s: %s.%s.%s", zErr, zDb, zTab, zCol);
}else if( zTab ){
sqlite3ErrorMsg(pParse, "%s: %s.%s", zErr, zTab, zCol);
+ }else if( cnt==0 && ExprHasProperty(pRight,EP_DblQuoted) ){
+ sqlite3ErrorMsg(pParse, "%s: \"%s\" - should this be a"
+ " string literal in single-quotes?",
+ zErr, zCol);
}else{
sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol);
}
@@ -107058,8 +107550,12 @@ static int lookupName(
** If a generated column is referenced, set bits for every column
** of the table.
*/
- if( pExpr->iColumn>=0 && cnt==1 && pMatch!=0 ){
- pMatch->colUsed |= sqlite3ExprColUsed(pExpr);
+ if( pMatch ){
+ if( pExpr->iColumn>=0 ){
+ pMatch->colUsed |= sqlite3ExprColUsed(pExpr);
+ }else{
+ pMatch->fg.rowidUsed = 1;
+ }
}
pExpr->op = eNewExprOp;
@@ -107302,7 +107798,6 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
*/
case TK_ID:
case TK_DOT: {
- const char *zColumn;
const char *zTable;
const char *zDb;
Expr *pRight;
@@ -107311,7 +107806,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
zDb = 0;
zTable = 0;
assert( !ExprHasProperty(pExpr, EP_IntValue) );
- zColumn = pExpr->u.zToken;
+ pRight = pExpr;
}else{
Expr *pLeft = pExpr->pLeft;
testcase( pNC->ncFlags & NC_IdxExpr );
@@ -107330,14 +107825,13 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
}
assert( ExprUseUToken(pLeft) && ExprUseUToken(pRight) );
zTable = pLeft->u.zToken;
- zColumn = pRight->u.zToken;
assert( ExprUseYTab(pExpr) );
if( IN_RENAME_OBJECT ){
sqlite3RenameTokenRemap(pParse, (void*)pExpr, (void*)pRight);
sqlite3RenameTokenRemap(pParse, (void*)&pExpr->y.pTab, (void*)pLeft);
}
}
- return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr);
+ return lookupName(pParse, zDb, zTable, pRight, pNC, pExpr);
}
/* Resolve function names
@@ -107513,11 +108007,9 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
#endif
}
}
-#ifndef SQLITE_OMIT_WINDOWFUNC
- else if( ExprHasProperty(pExpr, EP_WinFunc) ){
+ else if( ExprHasProperty(pExpr, EP_WinFunc) || pExpr->pLeft ){
is_agg = 1;
}
-#endif
sqlite3WalkExprList(pWalker, pList);
if( is_agg ){
if( pExpr->pLeft ){
@@ -107587,6 +108079,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
testcase( pNC->ncFlags & NC_PartIdx );
testcase( pNC->ncFlags & NC_IdxExpr );
testcase( pNC->ncFlags & NC_GenCol );
+ assert( pExpr->x.pSelect );
if( pNC->ncFlags & NC_SelfRef ){
notValidImpl(pParse, pNC, "subqueries", pExpr, pExpr);
}else{
@@ -107595,6 +108088,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
assert( pNC->nRef>=nRef );
if( nRef!=pNC->nRef ){
ExprSetProperty(pExpr, EP_VarSelect);
+ pExpr->x.pSelect->selFlags |= SF_Correlated;
}
pNC->ncFlags |= NC_Subquery;
}
@@ -108120,6 +108614,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
if( pOuterNC ) pOuterNC->nNestedSelect++;
for(i=0; i<p->pSrc->nSrc; i++){
SrcItem *pItem = &p->pSrc->a[i];
+ assert( pItem->zName!=0 || pItem->pSelect!=0 );/* Test of tag-20240424-1*/
if( pItem->pSelect && (pItem->pSelect->selFlags & SF_Resolved)==0 ){
int nRef = pOuterNC ? pOuterNC->nRef : 0;
const char *zSavedContext = pParse->zAuthContext;
@@ -109426,11 +109921,12 @@ SQLITE_PRIVATE void sqlite3ExprSetErrorOffset(Expr *pExpr, int iOfst){
** appear to be quoted. If the quotes were of the form "..." (double-quotes)
** then the EP_DblQuoted flag is set on the expression node.
**
-** Special case: If op==TK_INTEGER and pToken points to a string that
-** can be translated into a 32-bit integer, then the token is not
-** stored in u.zToken. Instead, the integer values is written
-** into u.iValue and the EP_IntValue flag is set. No extra storage
+** Special case (tag-20240227-a): If op==TK_INTEGER and pToken points to
+** a string that can be translated into a 32-bit integer, then the token is
+** not stored in u.zToken. Instead, the integer values is written
+** into u.iValue and the EP_IntValue flag is set. No extra storage
** is allocated to hold the integer text and the dequote flag is ignored.
+** See also tag-20240227-b.
*/
SQLITE_PRIVATE Expr *sqlite3ExprAlloc(
sqlite3 *db, /* Handle for sqlite3DbMallocRawNN() */
@@ -109446,7 +109942,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprAlloc(
if( pToken ){
if( op!=TK_INTEGER || pToken->z==0
|| sqlite3GetInt32(pToken->z, &iValue)==0 ){
- nExtra = pToken->n+1;
+ nExtra = pToken->n+1; /* tag-20240227-a */
assert( iValue>=0 );
}
}
@@ -109878,6 +110374,7 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n
static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){
assert( p!=0 );
assert( db!=0 );
+exprDeleteRestart:
assert( !ExprUseUValue(p) || p->u.iValue>=0 );
assert( !ExprUseYWin(p) || !ExprUseYSub(p) );
assert( !ExprUseYWin(p) || p->y.pWin!=0 || db->mallocFailed );
@@ -109893,7 +110390,6 @@ static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){
if( !ExprHasProperty(p, (EP_TokenOnly|EP_Leaf)) ){
/* The Expr.x union is never used at the same time as Expr.pRight */
assert( (ExprUseXList(p) && p->x.pList==0) || p->pRight==0 );
- if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft);
if( p->pRight ){
assert( !ExprHasProperty(p, EP_WinFunc) );
sqlite3ExprDeleteNN(db, p->pRight);
@@ -109908,6 +110404,19 @@ static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){
}
#endif
}
+ if( p->pLeft && p->op!=TK_SELECT_COLUMN ){
+ Expr *pLeft = p->pLeft;
+ if( !ExprHasProperty(p, EP_Static)
+ && !ExprHasProperty(pLeft, EP_Static)
+ ){
+ /* Avoid unnecessary recursion on unary operators */
+ sqlite3DbNNFreeNN(db, p);
+ p = pLeft;
+ goto exprDeleteRestart;
+ }else{
+ sqlite3ExprDeleteNN(db, pLeft);
+ }
+ }
}
if( !ExprHasProperty(p, EP_Static) ){
sqlite3DbNNFreeNN(db, p);
@@ -109940,11 +110449,11 @@ SQLITE_PRIVATE void sqlite3ClearOnOrUsing(sqlite3 *db, OnOrUsing *p){
**
** The pExpr might be deleted immediately on an OOM error.
**
-** The deferred delete is (currently) implemented by adding the
-** pExpr to the pParse->pConstExpr list with a register number of 0.
+** Return 0 if the delete was successfully deferred. Return non-zero
+** if the delete happened immediately because of an OOM.
*/
-SQLITE_PRIVATE void sqlite3ExprDeferredDelete(Parse *pParse, Expr *pExpr){
- sqlite3ParserAddCleanup(pParse, sqlite3ExprDeleteGeneric, pExpr);
+SQLITE_PRIVATE int sqlite3ExprDeferredDelete(Parse *pParse, Expr *pExpr){
+ return 0==sqlite3ParserAddCleanup(pParse, sqlite3ExprDeleteGeneric, pExpr);
}
/* Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the
@@ -110380,17 +110889,19 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3 *db, const SrcList *p, int fla
pNewItem->iCursor = pOldItem->iCursor;
pNewItem->addrFillSub = pOldItem->addrFillSub;
pNewItem->regReturn = pOldItem->regReturn;
+ pNewItem->regResult = pOldItem->regResult;
if( pNewItem->fg.isIndexedBy ){
pNewItem->u1.zIndexedBy = sqlite3DbStrDup(db, pOldItem->u1.zIndexedBy);
+ }else if( pNewItem->fg.isTabFunc ){
+ pNewItem->u1.pFuncArg =
+ sqlite3ExprListDup(db, pOldItem->u1.pFuncArg, flags);
+ }else{
+ pNewItem->u1.nRow = pOldItem->u1.nRow;
}
pNewItem->u2 = pOldItem->u2;
if( pNewItem->fg.isCte ){
pNewItem->u2.pCteUse->nUse++;
}
- if( pNewItem->fg.isTabFunc ){
- pNewItem->u1.pFuncArg =
- sqlite3ExprListDup(db, pOldItem->u1.pFuncArg, flags);
- }
pTab = pNewItem->pTab = pOldItem->pTab;
if( pTab ){
pTab->nTabRef++;
@@ -110856,6 +111367,54 @@ SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){
return pExpr;
}
+/*
+** pExpr is a TK_FUNCTION node. Try to determine whether or not the
+** function is a constant function. A function is constant if all of
+** the following are true:
+**
+** (1) It is a scalar function (not an aggregate or window function)
+** (2) It has either the SQLITE_FUNC_CONSTANT or SQLITE_FUNC_SLOCHNG
+** property.
+** (3) All of its arguments are constants
+**
+** This routine sets pWalker->eCode to 0 if pExpr is not a constant.
+** It makes no changes to pWalker->eCode if pExpr is constant. In
+** every case, it returns WRC_Abort.
+**
+** Called as a service subroutine from exprNodeIsConstant().
+*/
+static SQLITE_NOINLINE int exprNodeIsConstantFunction(
+ Walker *pWalker,
+ Expr *pExpr
+){
+ int n; /* Number of arguments */
+ ExprList *pList; /* List of arguments */
+ FuncDef *pDef; /* The function */
+ sqlite3 *db; /* The database */
+
+ assert( pExpr->op==TK_FUNCTION );
+ if( ExprHasProperty(pExpr, EP_TokenOnly)
+ || (pList = pExpr->x.pList)==0
+ ){;
+ n = 0;
+ }else{
+ n = pList->nExpr;
+ sqlite3WalkExprList(pWalker, pList);
+ if( pWalker->eCode==0 ) return WRC_Abort;
+ }
+ db = pWalker->pParse->db;
+ pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0);
+ if( pDef==0
+ || pDef->xFinalize!=0
+ || (pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0
+ || ExprHasProperty(pExpr, EP_WinFunc)
+ ){
+ pWalker->eCode = 0;
+ return WRC_Abort;
+ }
+ return WRC_Prune;
+}
+
/*
** These routines are Walker callbacks used to check expressions to
@@ -110884,6 +111443,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){
** malformed schema error.
*/
static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){
+ assert( pWalker->eCode>0 );
/* If pWalker->eCode is 2 then any term of the expression that comes from
** the ON or USING clauses of an outer join disqualifies the expression
@@ -110903,6 +111463,8 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){
){
if( pWalker->eCode==5 ) ExprSetProperty(pExpr, EP_FromDDL);
return WRC_Continue;
+ }else if( pWalker->pParse ){
+ return exprNodeIsConstantFunction(pWalker, pExpr);
}else{
pWalker->eCode = 0;
return WRC_Abort;
@@ -110931,9 +111493,11 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){
case TK_IF_NULL_ROW:
case TK_REGISTER:
case TK_DOT:
+ case TK_RAISE:
testcase( pExpr->op==TK_REGISTER );
testcase( pExpr->op==TK_IF_NULL_ROW );
testcase( pExpr->op==TK_DOT );
+ testcase( pExpr->op==TK_RAISE );
pWalker->eCode = 0;
return WRC_Abort;
case TK_VARIABLE:
@@ -110955,15 +111519,15 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){
return WRC_Continue;
}
}
-static int exprIsConst(Expr *p, int initFlag, int iCur){
+static int exprIsConst(Parse *pParse, Expr *p, int initFlag){
Walker w;
w.eCode = initFlag;
+ w.pParse = pParse;
w.xExprCallback = exprNodeIsConstant;
w.xSelectCallback = sqlite3SelectWalkFail;
#ifdef SQLITE_DEBUG
w.xSelectCallback2 = sqlite3SelectWalkAssert2;
#endif
- w.u.iCur = iCur;
sqlite3WalkExpr(&w, p);
return w.eCode;
}
@@ -110975,9 +111539,15 @@ static int exprIsConst(Expr *p, int initFlag, int iCur){
** For the purposes of this function, a double-quoted string (ex: "abc")
** is considered a variable but a single-quoted string (ex: 'abc') is
** a constant.
+**
+** The pParse parameter may be NULL. But if it is NULL, there is no way
+** to determine if function calls are constant or not, and hence all
+** function calls will be considered to be non-constant. If pParse is
+** not NULL, then a function call might be constant, depending on the
+** function and on its parameters.
*/
-SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){
- return exprIsConst(p, 1, 0);
+SQLITE_PRIVATE int sqlite3ExprIsConstant(Parse *pParse, Expr *p){
+ return exprIsConst(pParse, p, 1);
}
/*
@@ -110993,8 +111563,24 @@ SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){
** can be added to the pParse->pConstExpr list and evaluated once when
** the prepared statement starts up. See sqlite3ExprCodeRunJustOnce().
*/
-SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){
- return exprIsConst(p, 2, 0);
+static int sqlite3ExprIsConstantNotJoin(Parse *pParse, Expr *p){
+ return exprIsConst(pParse, p, 2);
+}
+
+/*
+** This routine examines sub-SELECT statements as an expression is being
+** walked as part of sqlite3ExprIsTableConstant(). Sub-SELECTs are considered
+** constant as long as they are uncorrelated - meaning that they do not
+** contain any terms from outer contexts.
+*/
+static int exprSelectWalkTableConstant(Walker *pWalker, Select *pSelect){
+ assert( pSelect!=0 );
+ assert( pWalker->eCode==3 || pWalker->eCode==0 );
+ if( (pSelect->selFlags & SF_Correlated)!=0 ){
+ pWalker->eCode = 0;
+ return WRC_Abort;
+ }
+ return WRC_Prune;
}
/*
@@ -111002,9 +111588,26 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){
** for any single row of the table with cursor iCur. In other words, the
** expression must not refer to any non-deterministic function nor any
** table other than iCur.
+**
+** Consider uncorrelated subqueries to be constants if the bAllowSubq
+** parameter is true.
*/
-SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){
- return exprIsConst(p, 3, iCur);
+static int sqlite3ExprIsTableConstant(Expr *p, int iCur, int bAllowSubq){
+ Walker w;
+ w.eCode = 3;
+ w.pParse = 0;
+ w.xExprCallback = exprNodeIsConstant;
+ if( bAllowSubq ){
+ w.xSelectCallback = exprSelectWalkTableConstant;
+ }else{
+ w.xSelectCallback = sqlite3SelectWalkFail;
+#ifdef SQLITE_DEBUG
+ w.xSelectCallback2 = sqlite3SelectWalkAssert2;
+#endif
+ }
+ w.u.iCur = iCur;
+ sqlite3WalkExpr(&w, p);
+ return w.eCode;
}
/*
@@ -111022,7 +111625,10 @@ SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){
**
** (1) pExpr cannot refer to any table other than pSrc->iCursor.
**
-** (2) pExpr cannot use subqueries or non-deterministic functions.
+** (2a) pExpr cannot use subqueries unless the bAllowSubq parameter is
+** true and the subquery is non-correlated
+**
+** (2b) pExpr cannot use non-deterministic functions.
**
** (3) pSrc cannot be part of the left operand for a RIGHT JOIN.
** (Is there some way to relax this constraint?)
@@ -111051,7 +111657,8 @@ SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){
SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(
Expr *pExpr, /* The constraint */
const SrcList *pSrcList, /* Complete FROM clause */
- int iSrc /* Which element of pSrcList to use */
+ int iSrc, /* Which element of pSrcList to use */
+ int bAllowSubq /* Allow non-correlated subqueries */
){
const SrcItem *pSrc = &pSrcList->a[iSrc];
if( pSrc->fg.jointype & JT_LTORJ ){
@@ -111076,7 +111683,8 @@ SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(
}
}
}
- return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor); /* rules (1), (2) */
+ /* Rules (1), (2a), and (2b) handled by the following: */
+ return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor, bAllowSubq);
}
@@ -111161,7 +111769,7 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse *pParse, Expr *p, ExprLi
*/
SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr *p, u8 isInit){
assert( isInit==0 || isInit==1 );
- return exprIsConst(p, 4+isInit, 0);
+ return exprIsConst(0, p, 4+isInit);
}
#ifdef SQLITE_ENABLE_CURSOR_HINTS
@@ -111409,13 +112017,13 @@ static void sqlite3SetHasNullFlag(Vdbe *v, int iCur, int regHasNull){
** The argument is an IN operator with a list (not a subquery) on the
** right-hand side. Return TRUE if that list is constant.
*/
-static int sqlite3InRhsIsConstant(Expr *pIn){
+static int sqlite3InRhsIsConstant(Parse *pParse, Expr *pIn){
Expr *pLHS;
int res;
assert( !ExprHasProperty(pIn, EP_xIsSelect) );
pLHS = pIn->pLeft;
pIn->pLeft = 0;
- res = sqlite3ExprIsConstant(pIn);
+ res = sqlite3ExprIsConstant(pParse, pIn);
pIn->pLeft = pLHS;
return res;
}
@@ -111684,7 +112292,7 @@ SQLITE_PRIVATE int sqlite3FindInIndex(
if( eType==0
&& (inFlags & IN_INDEX_NOOP_OK)
&& ExprUseXList(pX)
- && (!sqlite3InRhsIsConstant(pX) || pX->x.pList->nExpr<=2)
+ && (!sqlite3InRhsIsConstant(pParse,pX) || pX->x.pList->nExpr<=2)
){
pParse->nTab--; /* Back out the allocation of the unused cursor */
iTab = -1; /* Cursor is not allocated */
@@ -111967,7 +112575,7 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
** this code only executes once. Because for a non-constant
** expression we need to rerun this code each time.
*/
- if( addrOnce && !sqlite3ExprIsConstant(pE2) ){
+ if( addrOnce && !sqlite3ExprIsConstant(pParse, pE2) ){
sqlite3VdbeChangeToNoop(v, addrOnce-1);
sqlite3VdbeChangeToNoop(v, addrOnce);
ExprClearProperty(pExpr, EP_Subrtn);
@@ -113131,12 +113739,6 @@ expr_code_doover:
assert( pExpr->u.zToken!=0 );
assert( pExpr->u.zToken[0]!=0 );
sqlite3VdbeAddOp2(v, OP_Variable, pExpr->iColumn, target);
- if( pExpr->u.zToken[1]!=0 ){
- const char *z = sqlite3VListNumToName(pParse->pVList, pExpr->iColumn);
- assert( pExpr->u.zToken[0]=='?' || (z && !strcmp(pExpr->u.zToken, z)) );
- pParse->pVList[0] = 0; /* Indicate VList may no longer be enlarged */
- sqlite3VdbeAppendP4(v, (char*)z, P4_STATIC);
- }
return target;
}
case TK_REGISTER: {
@@ -113310,7 +113912,9 @@ expr_code_doover:
}
#endif
- if( ConstFactorOk(pParse) && sqlite3ExprIsConstantNotJoin(pExpr) ){
+ if( ConstFactorOk(pParse)
+ && sqlite3ExprIsConstantNotJoin(pParse,pExpr)
+ ){
/* SQL functions can be expensive. So try to avoid running them
** multiple times if we know they always give the same result */
return sqlite3ExprCodeRunJustOnce(pParse, pExpr, -1);
@@ -113341,7 +113945,7 @@ expr_code_doover:
}
for(i=0; i<nFarg; i++){
- if( i<32 && sqlite3ExprIsConstant(pFarg->a[i].pExpr) ){
+ if( i<32 && sqlite3ExprIsConstant(pParse, pFarg->a[i].pExpr) ){
testcase( i==31 );
constMask |= MASKBIT32(i);
}
@@ -113483,8 +114087,9 @@ expr_code_doover:
if( !ExprHasProperty(pExpr, EP_Collate) ){
/* A TK_COLLATE Expr node without the EP_Collate tag is a so-called
** "SOFT-COLLATE" that is added to constraints that are pushed down
- ** from outer queries into sub-queries by the push-down optimization.
- ** Clear subtypes as subtypes may not cross a subquery boundary.
+ ** from outer queries into sub-queries by the WHERE-clause push-down
+ ** optimization. Clear subtypes as subtypes may not cross a subquery
+ ** boundary.
*/
assert( pExpr->pLeft );
sqlite3ExprCode(pParse, pExpr->pLeft, target);
@@ -113808,7 +114413,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse *pParse, Expr *pExpr, int *pReg){
if( ConstFactorOk(pParse)
&& ALWAYS(pExpr!=0)
&& pExpr->op!=TK_REGISTER
- && sqlite3ExprIsConstantNotJoin(pExpr)
+ && sqlite3ExprIsConstantNotJoin(pParse, pExpr)
){
*pReg = 0;
r2 = sqlite3ExprCodeRunJustOnce(pParse, pExpr, -1);
@@ -113872,7 +114477,7 @@ SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse *pParse, Expr *pExpr, int target){
** might choose to code the expression at initialization time.
*/
SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int target){
- if( pParse->okConstFactor && sqlite3ExprIsConstantNotJoin(pExpr) ){
+ if( pParse->okConstFactor && sqlite3ExprIsConstantNotJoin(pParse,pExpr) ){
sqlite3ExprCodeRunJustOnce(pParse, pExpr, target);
}else{
sqlite3ExprCodeCopy(pParse, pExpr, target);
@@ -113931,7 +114536,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeExprList(
sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i);
}
}else if( (flags & SQLITE_ECEL_FACTOR)!=0
- && sqlite3ExprIsConstantNotJoin(pExpr)
+ && sqlite3ExprIsConstantNotJoin(pParse,pExpr)
){
sqlite3ExprCodeRunJustOnce(pParse, pExpr, target+i);
}else{
@@ -115082,9 +115687,8 @@ static int agginfoPersistExprCb(Walker *pWalker, Expr *pExpr){
&& pAggInfo->aCol[iAgg].pCExpr==pExpr
){
pExpr = sqlite3ExprDup(db, pExpr, 0);
- if( pExpr ){
+ if( pExpr && !sqlite3ExprDeferredDelete(pParse, pExpr) ){
pAggInfo->aCol[iAgg].pCExpr = pExpr;
- sqlite3ExprDeferredDelete(pParse, pExpr);
}
}
}else{
@@ -115093,9 +115697,8 @@ static int agginfoPersistExprCb(Walker *pWalker, Expr *pExpr){
&& pAggInfo->aFunc[iAgg].pFExpr==pExpr
){
pExpr = sqlite3ExprDup(db, pExpr, 0);
- if( pExpr ){
+ if( pExpr && !sqlite3ExprDeferredDelete(pParse, pExpr) ){
pAggInfo->aFunc[iAgg].pFExpr = pExpr;
- sqlite3ExprDeferredDelete(pParse, pExpr);
}
}
}
@@ -117796,7 +118399,12 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, const T
if( i==pTab->iPKey ){
sqlite3VdbeAddOp2(v, OP_Null, 0, regOut);
}else{
+ char aff = pTab->aCol[i].affinity;
+ if( aff==SQLITE_AFF_REAL ){
+ pTab->aCol[i].affinity = SQLITE_AFF_NUMERIC;
+ }
sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, i, regOut);
+ pTab->aCol[i].affinity = aff;
}
nField++;
}
@@ -118715,7 +119323,7 @@ static void statGet(
if( iVal==2 && p->nRow*10 <= nDistinct*11 ) iVal = 1;
sqlite3_str_appendf(&sStat, " %llu", iVal);
#ifdef SQLITE_ENABLE_STAT4
- assert( p->current.anEq[i] );
+ assert( p->current.anEq[i] || p->nRow==0 );
#endif
}
sqlite3ResultStrAccum(context, &sStat);
@@ -118900,7 +119508,7 @@ static void analyzeOneTable(
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
int nCol; /* Number of columns in pIdx. "N" */
- int addrRewind; /* Address of "OP_Rewind iIdxCur" */
+ int addrGotoEnd; /* Address of "OP_Rewind iIdxCur" */
int addrNextRow; /* Address of "next_row:" */
const char *zIdxName; /* Name of the index */
int nColTest; /* Number of columns to test for changes */
@@ -118924,9 +119532,14 @@ static void analyzeOneTable(
/*
** Pseudo-code for loop that calls stat_push():
**
- ** Rewind csr
- ** if eof(csr) goto end_of_scan;
** regChng = 0
+ ** Rewind csr
+ ** if eof(csr){
+ ** stat_init() with count = 0;
+ ** goto end_of_scan;
+ ** }
+ ** count()
+ ** stat_init()
** goto chng_addr_0;
**
** next_row:
@@ -118965,41 +119578,36 @@ static void analyzeOneTable(
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
VdbeComment((v, "%s", pIdx->zName));
- /* Invoke the stat_init() function. The arguments are:
+ /* Implementation of the following:
**
+ ** regChng = 0
+ ** Rewind csr
+ ** if eof(csr){
+ ** stat_init() with count = 0;
+ ** goto end_of_scan;
+ ** }
+ ** count()
+ ** stat_init()
+ ** goto chng_addr_0;
+ */
+ assert( regTemp2==regStat+4 );
+ sqlite3VdbeAddOp2(v, OP_Integer, db->nAnalysisLimit, regTemp2);
+
+ /* Arguments to stat_init():
** (1) the number of columns in the index including the rowid
** (or for a WITHOUT ROWID table, the number of PK columns),
** (2) the number of columns in the key without the rowid/pk
- ** (3) estimated number of rows in the index,
- */
+ ** (3) estimated number of rows in the index. */
sqlite3VdbeAddOp2(v, OP_Integer, nCol, regStat+1);
assert( regRowid==regStat+2 );
sqlite3VdbeAddOp2(v, OP_Integer, pIdx->nKeyCol, regRowid);
-#ifdef SQLITE_ENABLE_STAT4
- if( OptimizationEnabled(db, SQLITE_Stat4) ){
- sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regTemp);
- addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur);
- VdbeCoverage(v);
- }else
-#endif
- {
- addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur);
- VdbeCoverage(v);
- sqlite3VdbeAddOp3(v, OP_Count, iIdxCur, regTemp, 1);
- }
- assert( regTemp2==regStat+4 );
- sqlite3VdbeAddOp2(v, OP_Integer, db->nAnalysisLimit, regTemp2);
+ sqlite3VdbeAddOp3(v, OP_Count, iIdxCur, regTemp,
+ OptimizationDisabled(db, SQLITE_Stat4));
sqlite3VdbeAddFunctionCall(pParse, 0, regStat+1, regStat, 4,
&statInitFuncdef, 0);
+ addrGotoEnd = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur);
+ VdbeCoverage(v);
- /* Implementation of the following:
- **
- ** Rewind csr
- ** if eof(csr) goto end_of_scan;
- ** regChng = 0
- ** goto next_push_0;
- **
- */
sqlite3VdbeAddOp2(v, OP_Integer, 0, regChng);
addrNextRow = sqlite3VdbeCurrentAddr(v);
@@ -119106,6 +119714,12 @@ static void analyzeOneTable(
}
/* Add the entry to the stat1 table. */
+ if( pIdx->pPartIdxWhere ){
+ /* Partial indexes might get a zero-entry in sqlite_stat1. But
+ ** an empty table is omitted from sqlite_stat1. */
+ sqlite3VdbeJumpHere(v, addrGotoEnd);
+ addrGotoEnd = 0;
+ }
callStatGet(pParse, regStat, STAT_GET_STAT1, regStat1);
assert( "BBB"[0]==SQLITE_AFF_TEXT );
sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, "BBB", 0);
@@ -119129,6 +119743,13 @@ static void analyzeOneTable(
int addrIsNull;
u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
+ /* No STAT4 data is generated if the number of rows is zero */
+ if( addrGotoEnd==0 ){
+ sqlite3VdbeAddOp2(v, OP_Cast, regStat1, SQLITE_AFF_INTEGER);
+ addrGotoEnd = sqlite3VdbeAddOp1(v, OP_IfNot, regStat1);
+ VdbeCoverage(v);
+ }
+
if( doOnce ){
int mxCol = nCol;
Index *pX;
@@ -119181,7 +119802,7 @@ static void analyzeOneTable(
#endif /* SQLITE_ENABLE_STAT4 */
/* End of analysis */
- sqlite3VdbeJumpHere(v, addrRewind);
+ if( addrGotoEnd ) sqlite3VdbeJumpHere(v, addrGotoEnd);
}
@@ -120930,7 +121551,7 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){
}
sqlite3VdbeAddOp0(v, OP_Halt);
-#if SQLITE_USER_AUTHENTICATION
+#if SQLITE_USER_AUTHENTICATION && !defined(SQLITE_OMIT_SHARED_CACHE)
if( pParse->nTableLock>0 && db->init.busy==0 ){
sqlite3UserAuthInit(db);
if( db->auth.authLevel<UAUTH_User ){
@@ -123569,20 +124190,20 @@ SQLITE_PRIVATE void sqlite3EndTable(
int regRowid; /* Rowid of the next row to insert */
int addrInsLoop; /* Top of the loop for inserting rows */
Table *pSelTab; /* A table that describes the SELECT results */
+ int iCsr; /* Write cursor on the new table */
if( IN_SPECIAL_PARSE ){
pParse->rc = SQLITE_ERROR;
pParse->nErr++;
return;
}
+ iCsr = pParse->nTab++;
regYield = ++pParse->nMem;
regRec = ++pParse->nMem;
regRowid = ++pParse->nMem;
- assert(pParse->nTab==1);
sqlite3MayAbort(pParse);
- sqlite3VdbeAddOp3(v, OP_OpenWrite, 1, pParse->regRoot, iDb);
+ sqlite3VdbeAddOp3(v, OP_OpenWrite, iCsr, pParse->regRoot, iDb);
sqlite3VdbeChangeP5(v, OPFLAG_P2ISREG);
- pParse->nTab = 2;
addrTop = sqlite3VdbeCurrentAddr(v) + 1;
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop);
if( pParse->nErr ) return;
@@ -123603,11 +124224,11 @@ SQLITE_PRIVATE void sqlite3EndTable(
VdbeCoverage(v);
sqlite3VdbeAddOp3(v, OP_MakeRecord, dest.iSdst, dest.nSdst, regRec);
sqlite3TableAffinity(v, p, 0);
- sqlite3VdbeAddOp2(v, OP_NewRowid, 1, regRowid);
- sqlite3VdbeAddOp3(v, OP_Insert, 1, regRec, regRowid);
+ sqlite3VdbeAddOp2(v, OP_NewRowid, iCsr, regRowid);
+ sqlite3VdbeAddOp3(v, OP_Insert, iCsr, regRec, regRowid);
sqlite3VdbeGoto(v, addrInsLoop);
sqlite3VdbeJumpHere(v, addrInsLoop);
- sqlite3VdbeAddOp1(v, OP_Close, 1);
+ sqlite3VdbeAddOp1(v, OP_Close, iCsr);
}
/* Compute the complete text of the CREATE statement */
@@ -123664,13 +124285,10 @@ SQLITE_PRIVATE void sqlite3EndTable(
/* Test for cycles in generated columns and illegal expressions
** in CHECK constraints and in DEFAULT clauses. */
if( p->tabFlags & TF_HasGenerated ){
- sqlite3VdbeAddOp4(v, OP_SqlExec, 1, 0, 0,
+ sqlite3VdbeAddOp4(v, OP_SqlExec, 0x0001, 0, 0,
sqlite3MPrintf(db, "SELECT*FROM\"%w\".\"%w\"",
db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC);
}
- sqlite3VdbeAddOp4(v, OP_SqlExec, 1, 0, 0,
- sqlite3MPrintf(db, "PRAGMA \"%w\".integrity_check(%Q)",
- db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC);
}
/* Add the table to the in-memory representation of the database.
@@ -132844,6 +133462,195 @@ SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse){
# define autoIncStep(A,B,C)
#endif /* SQLITE_OMIT_AUTOINCREMENT */
+/*
+** If argument pVal is a Select object returned by an sqlite3MultiValues()
+** that was able to use the co-routine optimization, finish coding the
+** co-routine.
+*/
+SQLITE_PRIVATE void sqlite3MultiValuesEnd(Parse *pParse, Select *pVal){
+ if( ALWAYS(pVal) && pVal->pSrc->nSrc>0 ){
+ SrcItem *pItem = &pVal->pSrc->a[0];
+ sqlite3VdbeEndCoroutine(pParse->pVdbe, pItem->regReturn);
+ sqlite3VdbeJumpHere(pParse->pVdbe, pItem->addrFillSub - 1);
+ }
+}
+
+/*
+** Return true if all expressions in the expression-list passed as the
+** only argument are constant.
+*/
+static int exprListIsConstant(Parse *pParse, ExprList *pRow){
+ int ii;
+ for(ii=0; ii<pRow->nExpr; ii++){
+ if( 0==sqlite3ExprIsConstant(pParse, pRow->a[ii].pExpr) ) return 0;
+ }
+ return 1;
+}
+
+/*
+** Return true if all expressions in the expression-list passed as the
+** only argument are both constant and have no affinity.
+*/
+static int exprListIsNoAffinity(Parse *pParse, ExprList *pRow){
+ int ii;
+ if( exprListIsConstant(pParse,pRow)==0 ) return 0;
+ for(ii=0; ii<pRow->nExpr; ii++){
+ Expr *pExpr = pRow->a[ii].pExpr;
+ assert( pExpr->op!=TK_RAISE );
+ assert( pExpr->affExpr==0 );
+ if( 0!=sqlite3ExprAffinity(pExpr) ) return 0;
+ }
+ return 1;
+
+}
+
+/*
+** This function is called by the parser for the second and subsequent
+** rows of a multi-row VALUES clause. Argument pLeft is the part of
+** the VALUES clause already parsed, argument pRow is the vector of values
+** for the new row. The Select object returned represents the complete
+** VALUES clause, including the new row.
+**
+** There are two ways in which this may be achieved - by incremental
+** coding of a co-routine (the "co-routine" method) or by returning a
+** Select object equivalent to the following (the "UNION ALL" method):
+**
+** "pLeft UNION ALL SELECT pRow"
+**
+** If the VALUES clause contains a lot of rows, this compound Select
+** object may consume a lot of memory.
+**
+** When the co-routine method is used, each row that will be returned
+** by the VALUES clause is coded into part of a co-routine as it is
+** passed to this function. The returned Select object is equivalent to:
+**
+** SELECT * FROM (
+** Select object to read co-routine
+** )
+**
+** The co-routine method is used in most cases. Exceptions are:
+**
+** a) If the current statement has a WITH clause. This is to avoid
+** statements like:
+**
+** WITH cte AS ( VALUES('x'), ('y') ... )
+** SELECT * FROM cte AS a, cte AS b;
+**
+** This will not work, as the co-routine uses a hard-coded register
+** for its OP_Yield instructions, and so it is not possible for two
+** cursors to iterate through it concurrently.
+**
+** b) The schema is currently being parsed (i.e. the VALUES clause is part
+** of a schema item like a VIEW or TRIGGER). In this case there is no VM
+** being generated when parsing is taking place, and so generating
+** a co-routine is not possible.
+**
+** c) There are non-constant expressions in the VALUES clause (e.g.
+** the VALUES clause is part of a correlated sub-query).
+**
+** d) One or more of the values in the first row of the VALUES clause
+** has an affinity (i.e. is a CAST expression). This causes problems
+** because the complex rules SQLite uses (see function
+** sqlite3SubqueryColumnTypes() in select.c) to determine the effective
+** affinity of such a column for all rows require access to all values in
+** the column simultaneously.
+*/
+SQLITE_PRIVATE Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){
+
+ if( pParse->bHasWith /* condition (a) above */
+ || pParse->db->init.busy /* condition (b) above */
+ || exprListIsConstant(pParse,pRow)==0 /* condition (c) above */
+ || (pLeft->pSrc->nSrc==0 &&
+ exprListIsNoAffinity(pParse,pLeft->pEList)==0) /* condition (d) above */
+ || IN_SPECIAL_PARSE
+ ){
+ /* The co-routine method cannot be used. Fall back to UNION ALL. */
+ Select *pSelect = 0;
+ int f = SF_Values | SF_MultiValue;
+ if( pLeft->pSrc->nSrc ){
+ sqlite3MultiValuesEnd(pParse, pLeft);
+ f = SF_Values;
+ }else if( pLeft->pPrior ){
+ /* In this case set the SF_MultiValue flag only if it was set on pLeft */
+ f = (f & pLeft->selFlags);
+ }
+ pSelect = sqlite3SelectNew(pParse, pRow, 0, 0, 0, 0, 0, f, 0);
+ pLeft->selFlags &= ~SF_MultiValue;
+ if( pSelect ){
+ pSelect->op = TK_ALL;
+ pSelect->pPrior = pLeft;
+ pLeft = pSelect;
+ }
+ }else{
+ SrcItem *p = 0; /* SrcItem that reads from co-routine */
+
+ if( pLeft->pSrc->nSrc==0 ){
+ /* Co-routine has not yet been started and the special Select object
+ ** that accesses the co-routine has not yet been created. This block
+ ** does both those things. */
+ Vdbe *v = sqlite3GetVdbe(pParse);
+ Select *pRet = sqlite3SelectNew(pParse, 0, 0, 0, 0, 0, 0, 0, 0);
+
+ /* Ensure the database schema has been read. This is to ensure we have
+ ** the correct text encoding. */
+ if( (pParse->db->mDbFlags & DBFLAG_SchemaKnownOk)==0 ){
+ sqlite3ReadSchema(pParse);
+ }
+
+ if( pRet ){
+ SelectDest dest;
+ pRet->pSrc->nSrc = 1;
+ pRet->pPrior = pLeft->pPrior;
+ pRet->op = pLeft->op;
+ pLeft->pPrior = 0;
+ pLeft->op = TK_SELECT;
+ assert( pLeft->pNext==0 );
+ assert( pRet->pNext==0 );
+ p = &pRet->pSrc->a[0];
+ p->pSelect = pLeft;
+ p->fg.viaCoroutine = 1;
+ p->addrFillSub = sqlite3VdbeCurrentAddr(v) + 1;
+ p->regReturn = ++pParse->nMem;
+ p->iCursor = -1;
+ p->u1.nRow = 2;
+ sqlite3VdbeAddOp3(v,OP_InitCoroutine,p->regReturn,0,p->addrFillSub);
+ sqlite3SelectDestInit(&dest, SRT_Coroutine, p->regReturn);
+
+ /* Allocate registers for the output of the co-routine. Do so so
+ ** that there are two unused registers immediately before those
+ ** used by the co-routine. This allows the code in sqlite3Insert()
+ ** to use these registers directly, instead of copying the output
+ ** of the co-routine to a separate array for processing. */
+ dest.iSdst = pParse->nMem + 3;
+ dest.nSdst = pLeft->pEList->nExpr;
+ pParse->nMem += 2 + dest.nSdst;
+
+ pLeft->selFlags |= SF_MultiValue;
+ sqlite3Select(pParse, pLeft, &dest);
+ p->regResult = dest.iSdst;
+ assert( pParse->nErr || dest.iSdst>0 );
+ pLeft = pRet;
+ }
+ }else{
+ p = &pLeft->pSrc->a[0];
+ assert( !p->fg.isTabFunc && !p->fg.isIndexedBy );
+ p->u1.nRow++;
+ }
+
+ if( pParse->nErr==0 ){
+ assert( p!=0 );
+ if( p->pSelect->pEList->nExpr!=pRow->nExpr ){
+ sqlite3SelectWrongNumTermsError(pParse, p->pSelect);
+ }else{
+ sqlite3ExprCodeExprList(pParse, pRow, p->regResult, 0, 0);
+ sqlite3VdbeAddOp1(pParse->pVdbe, OP_Yield, p->regReturn);
+ }
+ }
+ sqlite3ExprListDelete(pParse->db, pRow);
+ }
+
+ return pLeft;
+}
/* Forward declaration */
static int xferOptimization(
@@ -133180,25 +133987,40 @@ SQLITE_PRIVATE void sqlite3Insert(
if( pSelect ){
/* Data is coming from a SELECT or from a multi-row VALUES clause.
** Generate a co-routine to run the SELECT. */
- int regYield; /* Register holding co-routine entry-point */
- int addrTop; /* Top of the co-routine */
int rc; /* Result code */
- regYield = ++pParse->nMem;
- addrTop = sqlite3VdbeCurrentAddr(v) + 1;
- sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop);
- sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield);
- dest.iSdst = bIdListInOrder ? regData : 0;
- dest.nSdst = pTab->nCol;
- rc = sqlite3Select(pParse, pSelect, &dest);
- regFromSelect = dest.iSdst;
- assert( db->pParse==pParse );
- if( rc || pParse->nErr ) goto insert_cleanup;
- assert( db->mallocFailed==0 );
- sqlite3VdbeEndCoroutine(v, regYield);
- sqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */
- assert( pSelect->pEList );
- nColumn = pSelect->pEList->nExpr;
+ if( pSelect->pSrc->nSrc==1
+ && pSelect->pSrc->a[0].fg.viaCoroutine
+ && pSelect->pPrior==0
+ ){
+ SrcItem *pItem = &pSelect->pSrc->a[0];
+ dest.iSDParm = pItem->regReturn;
+ regFromSelect = pItem->regResult;
+ nColumn = pItem->pSelect->pEList->nExpr;
+ ExplainQueryPlan((pParse, 0, "SCAN %S", pItem));
+ if( bIdListInOrder && nColumn==pTab->nCol ){
+ regData = regFromSelect;
+ regRowid = regData - 1;
+ regIns = regRowid - (IsVirtual(pTab) ? 1 : 0);
+ }
+ }else{
+ int addrTop; /* Top of the co-routine */
+ int regYield = ++pParse->nMem;
+ addrTop = sqlite3VdbeCurrentAddr(v) + 1;
+ sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop);
+ sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield);
+ dest.iSdst = bIdListInOrder ? regData : 0;
+ dest.nSdst = pTab->nCol;
+ rc = sqlite3Select(pParse, pSelect, &dest);
+ regFromSelect = dest.iSdst;
+ assert( db->pParse==pParse );
+ if( rc || pParse->nErr ) goto insert_cleanup;
+ assert( db->mallocFailed==0 );
+ sqlite3VdbeEndCoroutine(v, regYield);
+ sqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */
+ assert( pSelect->pEList );
+ nColumn = pSelect->pEList->nExpr;
+ }
/* Set useTempTable to TRUE if the result of the SELECT statement
** should be written into a temporary table (template 4). Set to
@@ -137924,6 +138746,34 @@ static const PragmaName aPragmaName[] = {
/************** Continuing where we left off in pragma.c *********************/
/*
+** When the 0x10 bit of PRAGMA optimize is set, any ANALYZE commands
+** will be run with an analysis_limit set to the lessor of the value of
+** the following macro or to the actual analysis_limit if it is non-zero,
+** in order to prevent PRAGMA optimize from running for too long.
+**
+** The value of 2000 is chosen emperically so that the worst-case run-time
+** for PRAGMA optimize does not exceed 100 milliseconds against a variety
+** of test databases on a RaspberryPI-4 compiled using -Os and without
+** -DSQLITE_DEBUG. Of course, your mileage may vary. For the purpose of
+** this paragraph, "worst-case" means that ANALYZE ends up being
+** run on every table in the database. The worst case typically only
+** happens if PRAGMA optimize is run on a database file for which ANALYZE
+** has not been previously run and the 0x10000 flag is included so that
+** all tables are analyzed. The usual case for PRAGMA optimize is that
+** no ANALYZE commands will be run at all, or if any ANALYZE happens it
+** will be against a single table, so that expected timing for PRAGMA
+** optimize on a PI-4 is more like 1 millisecond or less with the 0x10000
+** flag or less than 100 microseconds without the 0x10000 flag.
+**
+** An analysis limit of 2000 is almost always sufficient for the query
+** planner to fully characterize an index. The additional accuracy from
+** a larger analysis is not usually helpful.
+*/
+#ifndef SQLITE_DEFAULT_OPTIMIZE_LIMIT
+# define SQLITE_DEFAULT_OPTIMIZE_LIMIT 2000
+#endif
+
+/*
** Interpret the given string as a safety level. Return 0 for OFF,
** 1 for ON or NORMAL, 2 for FULL, and 3 for EXTRA. Return 1 for an empty or
** unrecognized string argument. The FULL and EXTRA option is disallowed
@@ -139568,7 +140418,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
/* Set the maximum error count */
mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
if( zRight ){
- if( sqlite3GetInt32(zRight, &mxErr) ){
+ if( sqlite3GetInt32(pValue->z, &mxErr) ){
if( mxErr<=0 ){
mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
}
@@ -139585,7 +140435,6 @@ SQLITE_PRIVATE void sqlite3Pragma(
Hash *pTbls; /* Set of all tables in the schema */
int *aRoot; /* Array of root page numbers of all btrees */
int cnt = 0; /* Number of entries in aRoot[] */
- int mxIdx = 0; /* Maximum number of indexes for any table */
if( OMIT_TEMPDB && i==1 ) continue;
if( iDb>=0 && i!=iDb ) continue;
@@ -139607,7 +140456,6 @@ SQLITE_PRIVATE void sqlite3Pragma(
if( pObjTab && pObjTab!=pTab ) continue;
if( HasRowid(pTab) ) cnt++;
for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ cnt++; }
- if( nIdx>mxIdx ) mxIdx = nIdx;
}
if( cnt==0 ) continue;
if( pObjTab ) cnt++;
@@ -139627,11 +140475,11 @@ SQLITE_PRIVATE void sqlite3Pragma(
aRoot[0] = cnt;
/* Make sure sufficient number of registers have been allocated */
- sqlite3TouchRegister(pParse, 8+mxIdx);
+ sqlite3TouchRegister(pParse, 8+cnt);
sqlite3ClearTempRegCache(pParse);
/* Do the b-tree integrity checks */
- sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY);
+ sqlite3VdbeAddOp4(v, OP_IntegrityCk, 1, cnt, 8, (char*)aRoot,P4_INTARRAY);
sqlite3VdbeChangeP5(v, (u8)i);
addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v);
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,
@@ -139641,6 +140489,36 @@ SQLITE_PRIVATE void sqlite3Pragma(
integrityCheckResultRow(v);
sqlite3VdbeJumpHere(v, addr);
+ /* Check that the indexes all have the right number of rows */
+ cnt = pObjTab ? 1 : 0;
+ sqlite3VdbeLoadString(v, 2, "wrong # of entries in index ");
+ for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
+ int iTab = 0;
+ Table *pTab = sqliteHashData(x);
+ Index *pIdx;
+ if( pObjTab && pObjTab!=pTab ) continue;
+ if( HasRowid(pTab) ){
+ iTab = cnt++;
+ }else{
+ iTab = cnt;
+ for(pIdx=pTab->pIndex; ALWAYS(pIdx); pIdx=pIdx->pNext){
+ if( IsPrimaryKeyIndex(pIdx) ) break;
+ iTab++;
+ }
+ }
+ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
+ if( pIdx->pPartIdxWhere==0 ){
+ addr = sqlite3VdbeAddOp3(v, OP_Eq, 8+cnt, 0, 8+iTab);
+ VdbeCoverageNeverNull(v);
+ sqlite3VdbeLoadString(v, 4, pIdx->zName);
+ sqlite3VdbeAddOp3(v, OP_Concat, 4, 2, 3);
+ integrityCheckResultRow(v);
+ sqlite3VdbeJumpHere(v, addr);
+ }
+ cnt++;
+ }
+ }
+
/* Make sure all the indices are constructed correctly.
*/
for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
@@ -139964,21 +140842,9 @@ SQLITE_PRIVATE void sqlite3Pragma(
}
sqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); VdbeCoverage(v);
sqlite3VdbeJumpHere(v, loopTop-1);
- if( !isQuick ){
- sqlite3VdbeLoadString(v, 2, "wrong # of entries in index ");
- for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
- if( pPk==pIdx ) continue;
- sqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3);
- addr = sqlite3VdbeAddOp3(v, OP_Eq, 8+j, 0, 3); VdbeCoverage(v);
- sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);
- sqlite3VdbeLoadString(v, 4, pIdx->zName);
- sqlite3VdbeAddOp3(v, OP_Concat, 4, 2, 3);
- integrityCheckResultRow(v);
- sqlite3VdbeJumpHere(v, addr);
- }
- if( pPk ){
- sqlite3ReleaseTempRange(pParse, r2, pPk->nKeyCol);
- }
+ if( pPk ){
+ assert( !isQuick );
+ sqlite3ReleaseTempRange(pParse, r2, pPk->nKeyCol);
}
}
@@ -140276,44 +141142,63 @@ SQLITE_PRIVATE void sqlite3Pragma(
**
** The optional argument is a bitmask of optimizations to perform:
**
- ** 0x0001 Debugging mode. Do not actually perform any optimizations
- ** but instead return one line of text for each optimization
- ** that would have been done. Off by default.
+ ** 0x00001 Debugging mode. Do not actually perform any optimizations
+ ** but instead return one line of text for each optimization
+ ** that would have been done. Off by default.
**
- ** 0x0002 Run ANALYZE on tables that might benefit. On by default.
- ** See below for additional information.
+ ** 0x00002 Run ANALYZE on tables that might benefit. On by default.
+ ** See below for additional information.
**
- ** 0x0004 (Not yet implemented) Record usage and performance
- ** information from the current session in the
- ** database file so that it will be available to "optimize"
- ** pragmas run by future database connections.
+ ** 0x00010 Run all ANALYZE operations using an analysis_limit that
+ ** is the lessor of the current analysis_limit and the
+ ** SQLITE_DEFAULT_OPTIMIZE_LIMIT compile-time option.
+ ** The default value of SQLITE_DEFAULT_OPTIMIZE_LIMIT is
+ ** currently (2024-02-19) set to 2000, which is such that
+ ** the worst case run-time for PRAGMA optimize on a 100MB
+ ** database will usually be less than 100 milliseconds on
+ ** a RaspberryPI-4 class machine. On by default.
**
- ** 0x0008 (Not yet implemented) Create indexes that might have
- ** been helpful to recent queries
+ ** 0x10000 Look at tables to see if they need to be reanalyzed
+ ** due to growth or shrinkage even if they have not been
+ ** queried during the current connection. Off by default.
**
- ** The default MASK is and always shall be 0xfffe. 0xfffe means perform all
- ** of the optimizations listed above except Debug Mode, including new
- ** optimizations that have not yet been invented. If new optimizations are
- ** ever added that should be off by default, those off-by-default
- ** optimizations will have bitmasks of 0x10000 or larger.
+ ** The default MASK is and always shall be 0x0fffe. In the current
+ ** implementation, the default mask only covers the 0x00002 optimization,
+ ** though additional optimizations that are covered by 0x0fffe might be
+ ** added in the future. Optimizations that are off by default and must
+ ** be explicitly requested have masks of 0x10000 or greater.
**
** DETERMINATION OF WHEN TO RUN ANALYZE
**
** In the current implementation, a table is analyzed if only if all of
** the following are true:
**
- ** (1) MASK bit 0x02 is set.
+ ** (1) MASK bit 0x00002 is set.
**
- ** (2) The query planner used sqlite_stat1-style statistics for one or
- ** more indexes of the table at some point during the lifetime of
- ** the current connection.
+ ** (2) The table is an ordinary table, not a virtual table or view.
**
- ** (3) One or more indexes of the table are currently unanalyzed OR
- ** the number of rows in the table has increased by 25 times or more
- ** since the last time ANALYZE was run.
+ ** (3) The table name does not begin with "sqlite_".
+ **
+ ** (4) One or more of the following is true:
+ ** (4a) The 0x10000 MASK bit is set.
+ ** (4b) One or more indexes on the table lacks an entry
+ ** in the sqlite_stat1 table.
+ ** (4c) The query planner used sqlite_stat1-style statistics for one
+ ** or more indexes of the table at some point during the lifetime
+ ** of the current connection.
+ **
+ ** (5) One or more of the following is true:
+ ** (5a) One or more indexes on the table lacks an entry
+ ** in the sqlite_stat1 table. (Same as 4a)
+ ** (5b) The number of rows in the table has increased or decreased by
+ ** 10-fold. In other words, the current size of the table is
+ ** 10 times larger than the size in sqlite_stat1 or else the
+ ** current size is less than 1/10th the size in sqlite_stat1.
**
** The rules for when tables are analyzed are likely to change in
- ** future releases.
+ ** future releases. Future versions of SQLite might accept a string
+ ** literal argument to this pragma that contains a mnemonic description
+ ** of the options rather than a bitmap.
*/
case PragTyp_OPTIMIZE: {
int iDbLast; /* Loop termination point for the schema loop */
@@ -140325,6 +141210,10 @@ SQLITE_PRIVATE void sqlite3Pragma(
LogEst szThreshold; /* Size threshold above which reanalysis needed */
char *zSubSql; /* SQL statement for the OP_SqlExec opcode */
u32 opMask; /* Mask of operations to perform */
+ int nLimit; /* Analysis limit to use */
+ int nCheck = 0; /* Number of tables to be optimized */
+ int nBtree = 0; /* Number of btrees to scan */
+ int nIndex; /* Number of indexes on the current table */
if( zRight ){
opMask = (u32)sqlite3Atoi(zRight);
@@ -140332,6 +141221,14 @@ SQLITE_PRIVATE void sqlite3Pragma(
}else{
opMask = 0xfffe;
}
+ if( (opMask & 0x10)==0 ){
+ nLimit = 0;
+ }else if( db->nAnalysisLimit>0
+ && db->nAnalysisLimit<SQLITE_DEFAULT_OPTIMIZE_LIMIT ){
+ nLimit = 0;
+ }else{
+ nLimit = SQLITE_DEFAULT_OPTIMIZE_LIMIT;
+ }
iTabCur = pParse->nTab++;
for(iDbLast = zDb?iDb:db->nDb-1; iDb<=iDbLast; iDb++){
if( iDb==1 ) continue;
@@ -140340,23 +141237,61 @@ SQLITE_PRIVATE void sqlite3Pragma(
for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
pTab = (Table*)sqliteHashData(k);
- /* If table pTab has not been used in a way that would benefit from
- ** having analysis statistics during the current session, then skip it.
- ** This also has the effect of skipping virtual tables and views */
- if( (pTab->tabFlags & TF_StatsUsed)==0 ) continue;
+ /* This only works for ordinary tables */
+ if( !IsOrdinaryTable(pTab) ) continue;
- /* Reanalyze if the table is 25 times larger than the last analysis */
- szThreshold = pTab->nRowLogEst + 46; assert( sqlite3LogEst(25)==46 );
+ /* Do not scan system tables */
+ if( 0==sqlite3StrNICmp(pTab->zName, "sqlite_", 7) ) continue;
+
+ /* Find the size of the table as last recorded in sqlite_stat1.
+ ** If any index is unanalyzed, then the threshold is -1 to
+ ** indicate a new, unanalyzed index
+ */
+ szThreshold = pTab->nRowLogEst;
+ nIndex = 0;
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
+ nIndex++;
if( !pIdx->hasStat1 ){
- szThreshold = 0; /* Always analyze if any index lacks statistics */
- break;
+ szThreshold = -1; /* Always analyze if any index lacks statistics */
}
}
- if( szThreshold ){
- sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead);
- sqlite3VdbeAddOp3(v, OP_IfSmaller, iTabCur,
- sqlite3VdbeCurrentAddr(v)+2+(opMask&1), szThreshold);
+
+ /* If table pTab has not been used in a way that would benefit from
+ ** having analysis statistics during the current session, then skip it,
+ ** unless the 0x10000 MASK bit is set. */
+ if( (pTab->tabFlags & TF_MaybeReanalyze)!=0 ){
+ /* Check for size change if stat1 has been used for a query */
+ }else if( opMask & 0x10000 ){
+ /* Check for size change if 0x10000 is set */
+ }else if( pTab->pIndex!=0 && szThreshold<0 ){
+ /* Do analysis if unanalyzed indexes exists */
+ }else{
+ /* Otherwise, we can skip this table */
+ continue;
+ }
+
+ nCheck++;
+ if( nCheck==2 ){
+ /* If ANALYZE might be invoked two or more times, hold a write
+ ** transaction for efficiency */
+ sqlite3BeginWriteOperation(pParse, 0, iDb);
+ }
+ nBtree += nIndex+1;
+
+ /* Reanalyze if the table is 10 times larger or smaller than
+ ** the last analysis. Unconditional reanalysis if there are
+ ** unanalyzed indexes. */
+ sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead);
+ if( szThreshold>=0 ){
+ const LogEst iRange = 33; /* 10x size change */
+ sqlite3VdbeAddOp4Int(v, OP_IfSizeBetween, iTabCur,
+ sqlite3VdbeCurrentAddr(v)+2+(opMask&1),
+ szThreshold>=iRange ? szThreshold-iRange : -1,
+ szThreshold+iRange);
+ VdbeCoverage(v);
+ }else{
+ sqlite3VdbeAddOp2(v, OP_Rewind, iTabCur,
+ sqlite3VdbeCurrentAddr(v)+2+(opMask&1));
VdbeCoverage(v);
}
zSubSql = sqlite3MPrintf(db, "ANALYZE \"%w\".\"%w\"",
@@ -140366,11 +141301,27 @@ SQLITE_PRIVATE void sqlite3Pragma(
sqlite3VdbeAddOp4(v, OP_String8, 0, r1, 0, zSubSql, P4_DYNAMIC);
sqlite3VdbeAddOp2(v, OP_ResultRow, r1, 1);
}else{
- sqlite3VdbeAddOp4(v, OP_SqlExec, 0, 0, 0, zSubSql, P4_DYNAMIC);
+ sqlite3VdbeAddOp4(v, OP_SqlExec, nLimit ? 0x02 : 00, nLimit, 0,
+ zSubSql, P4_DYNAMIC);
}
}
}
sqlite3VdbeAddOp0(v, OP_Expire);
+
+ /* In a schema with a large number of tables and indexes, scale back
+ ** the analysis_limit to avoid excess run-time in the worst case.
+ */
+ if( !db->mallocFailed && nLimit>0 && nBtree>100 ){
+ int iAddr, iEnd;
+ VdbeOp *aOp;
+ nLimit = 100*nLimit/nBtree;
+ if( nLimit<100 ) nLimit = 100;
+ aOp = sqlite3VdbeGetOp(v, 0);
+ iEnd = sqlite3VdbeCurrentAddr(v);
+ for(iAddr=0; iAddr<iEnd; iAddr++){
+ if( aOp[iAddr].opcode==OP_SqlExec ) aOp[iAddr].p2 = nLimit;
+ }
+ }
break;
}
@@ -140634,9 +141585,9 @@ static int pragmaVtabBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
seen[0] = 0;
seen[1] = 0;
for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
- if( pConstraint->usable==0 ) continue;
- if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
if( pConstraint->iColumn < pTab->iHidden ) continue;
+ if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
+ if( pConstraint->usable==0 ) return SQLITE_CONSTRAINT;
j = pConstraint->iColumn - pTab->iHidden;
assert( j < 2 );
seen[j] = i+1;
@@ -140649,16 +141600,13 @@ static int pragmaVtabBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
j = seen[0]-1;
pIdxInfo->aConstraintUsage[j].argvIndex = 1;
pIdxInfo->aConstraintUsage[j].omit = 1;
- if( seen[1]==0 ){
- pIdxInfo->estimatedCost = (double)1000;
- pIdxInfo->estimatedRows = 1000;
- return SQLITE_OK;
- }
pIdxInfo->estimatedCost = (double)20;
pIdxInfo->estimatedRows = 20;
- j = seen[1]-1;
- pIdxInfo->aConstraintUsage[j].argvIndex = 2;
- pIdxInfo->aConstraintUsage[j].omit = 1;
+ if( seen[1] ){
+ j = seen[1]-1;
+ pIdxInfo->aConstraintUsage[j].argvIndex = 2;
+ pIdxInfo->aConstraintUsage[j].omit = 1;
+ }
return SQLITE_OK;
}
@@ -140678,6 +141626,7 @@ static void pragmaVtabCursorClear(PragmaVtabCursor *pCsr){
int i;
sqlite3_finalize(pCsr->pPragma);
pCsr->pPragma = 0;
+ pCsr->iRowid = 0;
for(i=0; i<ArraySize(pCsr->azArg); i++){
sqlite3_free(pCsr->azArg[i]);
pCsr->azArg[i] = 0;
@@ -141478,7 +142427,13 @@ SQLITE_PRIVATE void *sqlite3ParserAddCleanup(
void (*xCleanup)(sqlite3*,void*), /* The cleanup routine */
void *pPtr /* Pointer to object to be cleaned up */
){
- ParseCleanup *pCleanup = sqlite3DbMallocRaw(pParse->db, sizeof(*pCleanup));
+ ParseCleanup *pCleanup;
+ if( sqlite3FaultSim(300) ){
+ pCleanup = 0;
+ sqlite3OomFault(pParse->db);
+ }else{
+ pCleanup = sqlite3DbMallocRaw(pParse->db, sizeof(*pCleanup));
+ }
if( pCleanup ){
pCleanup->pNext = pParse->pCleanup;
pParse->pCleanup = pCleanup;
@@ -143600,9 +144555,16 @@ static void generateSortTail(
int addrExplain; /* Address of OP_Explain instruction */
#endif
- ExplainQueryPlan2(addrExplain, (pParse, 0,
- "USE TEMP B-TREE FOR %sORDER BY", pSort->nOBSat>0?"RIGHT PART OF ":"")
- );
+ nKey = pOrderBy->nExpr - pSort->nOBSat;
+ if( pSort->nOBSat==0 || nKey==1 ){
+ ExplainQueryPlan2(addrExplain, (pParse, 0,
+ "USE TEMP B-TREE FOR %sORDER BY", pSort->nOBSat?"LAST TERM OF ":""
+ ));
+ }else{
+ ExplainQueryPlan2(addrExplain, (pParse, 0,
+ "USE TEMP B-TREE FOR LAST %d TERMS OF ORDER BY", nKey
+ ));
+ }
sqlite3VdbeScanStatusRange(v, addrExplain,pSort->addrPush,pSort->addrPushEnd);
sqlite3VdbeScanStatusCounters(v, addrExplain, addrExplain, pSort->addrPush);
@@ -143640,7 +144602,6 @@ static void generateSortTail(
regRow = sqlite3GetTempRange(pParse, nColumn);
}
}
- nKey = pOrderBy->nExpr - pSort->nOBSat;
if( pSort->sortFlags & SORTFLAG_UseSorter ){
int regSortOut = ++pParse->nMem;
iSortTab = pParse->nTab++;
@@ -144245,8 +145206,7 @@ SQLITE_PRIVATE void sqlite3SubqueryColumnTypes(
NameContext sNC;
assert( pSelect!=0 );
- testcase( (pSelect->selFlags & SF_Resolved)==0 );
- assert( (pSelect->selFlags & SF_Resolved)!=0 || IN_RENAME_OBJECT );
+ assert( (pSelect->selFlags & SF_Resolved)!=0 );
assert( pTab->nCol==pSelect->pEList->nExpr || pParse->nErr>0 );
assert( aff==SQLITE_AFF_NONE || aff==SQLITE_AFF_BLOB );
if( db->mallocFailed || IN_RENAME_OBJECT ) return;
@@ -144257,17 +145217,22 @@ SQLITE_PRIVATE void sqlite3SubqueryColumnTypes(
for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
const char *zType;
i64 n;
+ int m = 0;
+ Select *pS2 = pSelect;
pTab->tabFlags |= (pCol->colFlags & COLFLAG_NOINSERT);
p = a[i].pExpr;
/* pCol->szEst = ... // Column size est for SELECT tables never used */
pCol->affinity = sqlite3ExprAffinity(p);
+ while( pCol->affinity<=SQLITE_AFF_NONE && pS2->pNext!=0 ){
+ m |= sqlite3ExprDataType(pS2->pEList->a[i].pExpr);
+ pS2 = pS2->pNext;
+ pCol->affinity = sqlite3ExprAffinity(pS2->pEList->a[i].pExpr);
+ }
if( pCol->affinity<=SQLITE_AFF_NONE ){
pCol->affinity = aff;
}
- if( pCol->affinity>=SQLITE_AFF_TEXT && pSelect->pNext ){
- int m = 0;
- Select *pS2;
- for(m=0, pS2=pSelect->pNext; pS2; pS2=pS2->pNext){
+ if( pCol->affinity>=SQLITE_AFF_TEXT && (pS2->pNext || pS2!=pSelect) ){
+ for(pS2=pS2->pNext; pS2; pS2=pS2->pNext){
m |= sqlite3ExprDataType(pS2->pEList->a[i].pExpr);
}
if( pCol->affinity==SQLITE_AFF_TEXT && (m&0x01)!=0 ){
@@ -144297,12 +145262,12 @@ SQLITE_PRIVATE void sqlite3SubqueryColumnTypes(
}
}
if( zType ){
- i64 m = sqlite3Strlen30(zType);
+ const i64 k = sqlite3Strlen30(zType);
n = sqlite3Strlen30(pCol->zCnName);
- pCol->zCnName = sqlite3DbReallocOrFree(db, pCol->zCnName, n+m+2);
+ pCol->zCnName = sqlite3DbReallocOrFree(db, pCol->zCnName, n+k+2);
pCol->colFlags &= ~(COLFLAG_HASTYPE|COLFLAG_HASCOLL);
if( pCol->zCnName ){
- memcpy(&pCol->zCnName[n+1], zType, m+1);
+ memcpy(&pCol->zCnName[n+1], zType, k+1);
pCol->colFlags |= COLFLAG_HASTYPE;
}
}
@@ -146699,7 +147664,7 @@ static void constInsert(
){
int i;
assert( pColumn->op==TK_COLUMN );
- assert( sqlite3ExprIsConstant(pValue) );
+ assert( sqlite3ExprIsConstant(pConst->pParse, pValue) );
if( ExprHasProperty(pColumn, EP_FixedCol) ) return;
if( sqlite3ExprAffinity(pValue)!=0 ) return;
@@ -146757,10 +147722,10 @@ static void findConstInWhere(WhereConst *pConst, Expr *pExpr){
pLeft = pExpr->pLeft;
assert( pRight!=0 );
assert( pLeft!=0 );
- if( pRight->op==TK_COLUMN && sqlite3ExprIsConstant(pLeft) ){
+ if( pRight->op==TK_COLUMN && sqlite3ExprIsConstant(pConst->pParse, pLeft) ){
constInsert(pConst,pRight,pLeft,pExpr);
}
- if( pLeft->op==TK_COLUMN && sqlite3ExprIsConstant(pRight) ){
+ if( pLeft->op==TK_COLUMN && sqlite3ExprIsConstant(pConst->pParse, pRight) ){
constInsert(pConst,pLeft,pRight,pExpr);
}
}
@@ -146981,6 +147946,18 @@ static int pushDownWindowCheck(Parse *pParse, Select *pSubq, Expr *pExpr){
** The hope is that the terms added to the inner query will make it more
** efficient.
**
+** NAME AMBIGUITY
+**
+** This optimization is called the "WHERE-clause push-down optimization".
+**
+** Do not confuse this optimization with another unrelated optimization
+** with a similar name: The "MySQL push-down optimization" causes WHERE
+** clause terms that can be evaluated using only the index and without
+** reference to the table are run first, so that if they are false,
+** unnecessary table seeks are avoided.
+**
+** RULES
+**
** Do not attempt this optimization if:
**
** (1) (** This restriction was removed on 2017-09-29. We used to
@@ -147046,10 +148023,10 @@ static int pushDownWindowCheck(Parse *pParse, Select *pSubq, Expr *pExpr){
** (9c) There is a RIGHT JOIN (or FULL JOIN) in between the ON/USING
** clause and the subquery.
**
-** Without this restriction, the push-down optimization might move
-** the ON/USING filter expression from the left side of a RIGHT JOIN
-** over to the right side, which leads to incorrect answers. See
-** also restriction (6) in sqlite3ExprIsSingleTableConstraint().
+** Without this restriction, the WHERE-clause push-down optimization
+** might move the ON/USING filter expression from the left side of a
+** RIGHT JOIN over to the right side, which leads to incorrect answers.
+** See also restriction (6) in sqlite3ExprIsSingleTableConstraint().
**
** (10) The inner query is not the right-hand table of a RIGHT JOIN.
**
@@ -147181,7 +148158,7 @@ static int pushDownWhereTerms(
}
#endif
- if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrcList, iSrc) ){
+ if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrcList, iSrc, 1) ){
nChng++;
pSubq->selFlags |= SF_PushDown;
while( pSubq ){
@@ -148316,8 +149293,7 @@ static void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){
if( p->selFlags & SF_HasTypeInfo ) return;
p->selFlags |= SF_HasTypeInfo;
pParse = pWalker->pParse;
- testcase( (p->selFlags & SF_Resolved)==0 );
- assert( (p->selFlags & SF_Resolved) || IN_RENAME_OBJECT );
+ assert( (p->selFlags & SF_Resolved) );
pTabList = p->pSrc;
for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){
Table *pTab = pFrom->pTab;
@@ -148387,6 +149363,8 @@ SQLITE_PRIVATE void sqlite3SelectPrep(
*/
static void printAggInfo(AggInfo *pAggInfo){
int ii;
+ sqlite3DebugPrintf("AggInfo %d/%p:\n",
+ pAggInfo->selId, pAggInfo);
for(ii=0; ii<pAggInfo->nColumn; ii++){
struct AggInfo_col *pCol = &pAggInfo->aCol[ii];
sqlite3DebugPrintf(
@@ -149577,7 +150555,7 @@ SQLITE_PRIVATE int sqlite3Select(
/* Generate code for all sub-queries in the FROM clause
*/
pSub = pItem->pSelect;
- if( pSub==0 ) continue;
+ if( pSub==0 || pItem->addrFillSub!=0 ) continue;
/* The code for a subquery should only be generated once. */
assert( pItem->addrFillSub==0 );
@@ -149608,7 +150586,7 @@ SQLITE_PRIVATE int sqlite3Select(
#endif
assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 );
}else{
- TREETRACE(0x4000,pParse,p,("Push-down not possible\n"));
+ TREETRACE(0x4000,pParse,p,("WHERE-lcause push-down not possible\n"));
}
/* Convert unused result columns of the subquery into simple NULL
@@ -150489,6 +151467,12 @@ select_end:
sqlite3ExprListDelete(db, pMinMaxOrderBy);
#ifdef SQLITE_DEBUG
if( pAggInfo && !db->mallocFailed ){
+#if TREETRACE_ENABLED
+ if( sqlite3TreeTrace & 0x20 ){
+ TREETRACE(0x20,pParse,p,("Finished with AggInfo\n"));
+ printAggInfo(pAggInfo);
+ }
+#endif
for(i=0; i<pAggInfo->nColumn; i++){
Expr *pExpr = pAggInfo->aCol[i].pCExpr;
if( pExpr==0 ) continue;
@@ -151670,6 +152654,72 @@ static ExprList *sqlite3ExpandReturning(
return pNew;
}
+/* If the Expr node is a subquery or an EXISTS operator or an IN operator that
+** uses a subquery, and if the subquery is SF_Correlated, then mark the
+** expression as EP_VarSelect.
+*/
+static int sqlite3ReturningSubqueryVarSelect(Walker *NotUsed, Expr *pExpr){
+ UNUSED_PARAMETER(NotUsed);
+ if( ExprUseXSelect(pExpr)
+ && (pExpr->x.pSelect->selFlags & SF_Correlated)!=0
+ ){
+ testcase( ExprHasProperty(pExpr, EP_VarSelect) );
+ ExprSetProperty(pExpr, EP_VarSelect);
+ }
+ return WRC_Continue;
+}
+
+
+/*
+** If the SELECT references the table pWalker->u.pTab, then do two things:
+**
+** (1) Mark the SELECT as as SF_Correlated.
+** (2) Set pWalker->eCode to non-zero so that the caller will know
+** that (1) has happened.
+*/
+static int sqlite3ReturningSubqueryCorrelated(Walker *pWalker, Select *pSelect){
+ int i;
+ SrcList *pSrc;
+ assert( pSelect!=0 );
+ pSrc = pSelect->pSrc;
+ assert( pSrc!=0 );
+ for(i=0; i<pSrc->nSrc; i++){
+ if( pSrc->a[i].pTab==pWalker->u.pTab ){
+ testcase( pSelect->selFlags & SF_Correlated );
+ pSelect->selFlags |= SF_Correlated;
+ pWalker->eCode = 1;
+ break;
+ }
+ }
+ return WRC_Continue;
+}
+
+/*
+** Scan the expression list that is the argument to RETURNING looking
+** for subqueries that depend on the table which is being modified in the
+** statement that is hosting the RETURNING clause (pTab). Mark all such
+** subqueries as SF_Correlated. If the subqueries are part of an
+** expression, mark the expression as EP_VarSelect.
+**
+** https://sqlite.org/forum/forumpost/2c83569ce8945d39
+*/
+static void sqlite3ProcessReturningSubqueries(
+ ExprList *pEList,
+ Table *pTab
+){
+ Walker w;
+ memset(&w, 0, sizeof(w));
+ w.xExprCallback = sqlite3ExprWalkNoop;
+ w.xSelectCallback = sqlite3ReturningSubqueryCorrelated;
+ w.u.pTab = pTab;
+ sqlite3WalkExprList(&w, pEList);
+ if( w.eCode ){
+ w.xExprCallback = sqlite3ReturningSubqueryVarSelect;
+ w.xSelectCallback = sqlite3SelectWalkNoop;
+ sqlite3WalkExprList(&w, pEList);
+ }
+}
+
/*
** Generate code for the RETURNING trigger. Unlike other triggers
** that invoke a subprogram in the bytecode, the code for RETURNING
@@ -151706,6 +152756,7 @@ static void codeReturningTrigger(
sSelect.pSrc = &sFrom;
sFrom.nSrc = 1;
sFrom.a[0].pTab = pTab;
+ sFrom.a[0].zName = pTab->zName; /* tag-20240424-1 */
sFrom.a[0].iCursor = -1;
sqlite3SelectPrep(pParse, &sSelect, 0);
if( pParse->nErr==0 ){
@@ -151732,6 +152783,7 @@ static void codeReturningTrigger(
int i;
int nCol = pNew->nExpr;
int reg = pParse->nMem+1;
+ sqlite3ProcessReturningSubqueries(pNew, pTab);
pParse->nMem += nCol+2;
pReturning->iRetReg = reg;
for(i=0; i<nCol; i++){
@@ -154942,6 +155994,8 @@ static int vtabCallConstructor(
db->pVtabCtx = &sCtx;
pTab->nTabRef++;
rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);
+ assert( pTab!=0 );
+ assert( pTab->nTabRef>1 || rc!=SQLITE_OK );
sqlite3DeleteTable(db, pTab);
db->pVtabCtx = sCtx.pPrior;
if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
@@ -154964,7 +156018,7 @@ static int vtabCallConstructor(
pVTable->nRef = 1;
if( sCtx.bDeclared==0 ){
const char *zFormat = "vtable constructor did not declare schema: %s";
- *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName);
+ *pzErr = sqlite3MPrintf(db, zFormat, zModuleName);
sqlite3VtabUnlock(pVTable);
rc = SQLITE_ERROR;
}else{
@@ -155142,12 +156196,30 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
Table *pTab;
Parse sParse;
int initBusy;
+ int i;
+ const unsigned char *z;
+ static const u8 aKeyword[] = { TK_CREATE, TK_TABLE, 0 };
#ifdef SQLITE_ENABLE_API_ARMOR
if( !sqlite3SafetyCheckOk(db) || zCreateTable==0 ){
return SQLITE_MISUSE_BKPT;
}
#endif
+
+ /* Verify that the first two keywords in the CREATE TABLE statement
+ ** really are "CREATE" and "TABLE". If this is not the case, then
+ ** sqlite3_declare_vtab() is being misused.
+ */
+ z = (const unsigned char*)zCreateTable;
+ for(i=0; aKeyword[i]; i++){
+ int tokenType = 0;
+ do{ z += sqlite3GetToken(z, &tokenType); }while( tokenType==TK_SPACE );
+ if( tokenType!=aKeyword[i] ){
+ sqlite3ErrorWithMsg(db, SQLITE_ERROR, "syntax error");
+ return SQLITE_ERROR;
+ }
+ }
+
sqlite3_mutex_enter(db->mutex);
pCtx = db->pVtabCtx;
if( !pCtx || pCtx->bDeclared ){
@@ -155155,6 +156227,7 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
sqlite3_mutex_leave(db->mutex);
return SQLITE_MISUSE_BKPT;
}
+
pTab = pCtx->pTab;
assert( IsVirtual(pTab) );
@@ -155168,11 +156241,10 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
initBusy = db->init.busy;
db->init.busy = 0;
sParse.nQueryLoop = 1;
- if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable)
- && ALWAYS(sParse.pNewTable!=0)
- && ALWAYS(!db->mallocFailed)
- && IsOrdinaryTable(sParse.pNewTable)
- ){
+ if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable) ){
+ assert( sParse.pNewTable!=0 );
+ assert( !db->mallocFailed );
+ assert( IsOrdinaryTable(sParse.pNewTable) );
assert( sParse.zErrMsg==0 );
if( !pTab->aCol ){
Table *pNew = sParse.pNewTable;
@@ -157668,6 +158740,27 @@ static SQLITE_NOINLINE void filterPullDown(
}
/*
+** Loop pLoop is a WHERE_INDEXED level that uses at least one IN(...)
+** operator. Return true if level pLoop is guaranteed to visit only one
+** row for each key generated for the index.
+*/
+static int whereLoopIsOneRow(WhereLoop *pLoop){
+ if( pLoop->u.btree.pIndex->onError
+ && pLoop->nSkip==0
+ && pLoop->u.btree.nEq==pLoop->u.btree.pIndex->nKeyCol
+ ){
+ int ii;
+ for(ii=0; ii<pLoop->u.btree.nEq; ii++){
+ if( pLoop->aLTerm[ii]->eOperator & (WO_IS|WO_ISNULL) ){
+ return 0;
+ }
+ }
+ return 1;
+ }
+ return 0;
+}
+
+/*
** Generate code for the start of the iLevel-th loop in the WHERE clause
** implementation described by pWInfo.
*/
@@ -157745,7 +158838,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){
pLevel->iLeftJoin = ++pParse->nMem;
sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin);
- VdbeComment((v, "init LEFT JOIN no-match flag"));
+ VdbeComment((v, "init LEFT JOIN match flag"));
}
/* Compute a safe address to jump to if we discover that the table for
@@ -158414,7 +159507,9 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
}
/* Record the instruction used to terminate the loop. */
- if( pLoop->wsFlags & WHERE_ONEROW ){
+ if( (pLoop->wsFlags & WHERE_ONEROW)
+ || (pLevel->u.in.nIn && regBignull==0 && whereLoopIsOneRow(pLoop))
+ ){
pLevel->op = OP_Noop;
}else if( bRev ){
pLevel->op = OP_Prev;
@@ -158804,6 +159899,12 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
** iLoop==3: Code all remaining expressions.
**
** An effort is made to skip unnecessary iterations of the loop.
+ **
+ ** This optimization of causing simple query restrictions to occur before
+ ** more complex one is call the "push-down" optimization in MySQL. Here
+ ** in SQLite, the name is "MySQL push-down", since there is also another
+ ** totally unrelated optimization called "WHERE-clause push-down".
+ ** Sometimes the qualifier is omitted, resulting in an ambiguity, so beware.
*/
iLoop = (pIdx ? 1 : 2);
do{
@@ -159054,7 +160155,16 @@ SQLITE_PRIVATE SQLITE_NOINLINE void sqlite3WhereRightJoinLoop(
pRJ->regReturn);
for(k=0; k<iLevel; k++){
int iIdxCur;
+ SrcItem *pRight;
+ assert( pWInfo->a[k].pWLoop->iTab == pWInfo->a[k].iFrom );
+ pRight = &pWInfo->pTabList->a[pWInfo->a[k].iFrom];
mAll |= pWInfo->a[k].pWLoop->maskSelf;
+ if( pRight->fg.viaCoroutine ){
+ sqlite3VdbeAddOp3(
+ v, OP_Null, 0, pRight->regResult,
+ pRight->regResult + pRight->pSelect->pEList->nExpr-1
+ );
+ }
sqlite3VdbeAddOp1(v, OP_NullRow, pWInfo->a[k].iTabCur);
iIdxCur = pWInfo->a[k].iIdxCur;
if( iIdxCur ){
@@ -160111,7 +161221,7 @@ static SQLITE_NOINLINE int exprMightBeIndexed2(
if( pIdx->aiColumn[i]!=XN_EXPR ) continue;
assert( pIdx->bHasExpr );
if( sqlite3ExprCompareSkip(pExpr,pIdx->aColExpr->a[i].pExpr,iCur)==0
- && pExpr->op!=TK_STRING
+ && !sqlite3ExprIsConstant(0,pIdx->aColExpr->a[i].pExpr)
){
aiCurCol[0] = iCur;
aiCurCol[1] = XN_EXPR;
@@ -160760,6 +161870,7 @@ SQLITE_PRIVATE void SQLITE_NOINLINE sqlite3WhereAddLimit(WhereClause *pWC, Selec
continue;
}
if( pWC->a[ii].leftCursor!=iCsr ) return;
+ if( pWC->a[ii].prereqRight!=0 ) return;
}
/* Check condition (5). Return early if it is not met. */
@@ -160774,12 +161885,14 @@ SQLITE_PRIVATE void SQLITE_NOINLINE sqlite3WhereAddLimit(WhereClause *pWC, Selec
/* All conditions are met. Add the terms to the where-clause object. */
assert( p->pLimit->op==TK_LIMIT );
- whereAddLimitExpr(pWC, p->iLimit, p->pLimit->pLeft,
- iCsr, SQLITE_INDEX_CONSTRAINT_LIMIT);
- if( p->iOffset>0 ){
+ if( p->iOffset!=0 && (p->selFlags & SF_Compound)==0 ){
whereAddLimitExpr(pWC, p->iOffset, p->pLimit->pRight,
iCsr, SQLITE_INDEX_CONSTRAINT_OFFSET);
}
+ if( p->iOffset==0 || (p->selFlags & SF_Compound)==0 ){
+ whereAddLimitExpr(pWC, p->iLimit, p->pLimit->pLeft,
+ iCsr, SQLITE_INDEX_CONSTRAINT_LIMIT);
+ }
}
}
@@ -161298,6 +162411,42 @@ static Expr *whereRightSubexprIsColumn(Expr *p){
}
/*
+** Term pTerm is guaranteed to be a WO_IN term. It may be a component term
+** of a vector IN expression of the form "(x, y, ...) IN (SELECT ...)".
+** This function checks to see if the term is compatible with an index
+** column with affinity idxaff (one of the SQLITE_AFF_XYZ values). If so,
+** it returns a pointer to the name of the collation sequence (e.g. "BINARY"
+** or "NOCASE") used by the comparison in pTerm. If it is not compatible
+** with affinity idxaff, NULL is returned.
+*/
+static SQLITE_NOINLINE const char *indexInAffinityOk(
+ Parse *pParse,
+ WhereTerm *pTerm,
+ u8 idxaff
+){
+ Expr *pX = pTerm->pExpr;
+ Expr inexpr;
+
+ assert( pTerm->eOperator & WO_IN );
+
+ if( sqlite3ExprIsVector(pX->pLeft) ){
+ int iField = pTerm->u.x.iField - 1;
+ inexpr.flags = 0;
+ inexpr.op = TK_EQ;
+ inexpr.pLeft = pX->pLeft->x.pList->a[iField].pExpr;
+ assert( ExprUseXSelect(pX) );
+ inexpr.pRight = pX->x.pSelect->pEList->a[iField].pExpr;
+ pX = &inexpr;
+ }
+
+ if( sqlite3IndexAffinityOk(pX, idxaff) ){
+ CollSeq *pRet = sqlite3ExprCompareCollSeq(pParse, pX);
+ return pRet ? pRet->zName : sqlite3StrBINARY;
+ }
+ return 0;
+}
+
+/*
** Advance to the next WhereTerm that matches according to the criteria
** established when the pScan object was initialized by whereScanInit().
** Return NULL if there are no more matching WhereTerms.
@@ -161347,16 +162496,24 @@ static WhereTerm *whereScanNext(WhereScan *pScan){
if( (pTerm->eOperator & pScan->opMask)!=0 ){
/* Verify the affinity and collating sequence match */
if( pScan->zCollName && (pTerm->eOperator & WO_ISNULL)==0 ){
- CollSeq *pColl;
+ const char *zCollName;
Parse *pParse = pWC->pWInfo->pParse;
pX = pTerm->pExpr;
- if( !sqlite3IndexAffinityOk(pX, pScan->idxaff) ){
- continue;
+
+ if( (pTerm->eOperator & WO_IN) ){
+ zCollName = indexInAffinityOk(pParse, pTerm, pScan->idxaff);
+ if( !zCollName ) continue;
+ }else{
+ CollSeq *pColl;
+ if( !sqlite3IndexAffinityOk(pX, pScan->idxaff) ){
+ continue;
+ }
+ assert(pX->pLeft);
+ pColl = sqlite3ExprCompareCollSeq(pParse, pX);
+ zCollName = pColl ? pColl->zName : sqlite3StrBINARY;
}
- assert(pX->pLeft);
- pColl = sqlite3ExprCompareCollSeq(pParse, pX);
- if( pColl==0 ) pColl = pParse->db->pDfltColl;
- if( sqlite3StrICmp(pColl->zName, pScan->zCollName) ){
+
+ if( sqlite3StrICmp(zCollName, pScan->zCollName) ){
continue;
}
}
@@ -161708,9 +162865,13 @@ static void translateColumnToCopy(
** are no-ops.
*/
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(WHERETRACE_ENABLED)
-static void whereTraceIndexInfoInputs(sqlite3_index_info *p){
+static void whereTraceIndexInfoInputs(
+ sqlite3_index_info *p, /* The IndexInfo object */
+ Table *pTab /* The TABLE that is the virtual table */
+){
int i;
if( (sqlite3WhereTrace & 0x10)==0 ) return;
+ sqlite3DebugPrintf("sqlite3_index_info inputs for %s:\n", pTab->zName);
for(i=0; i<p->nConstraint; i++){
sqlite3DebugPrintf(
" constraint[%d]: col=%d termid=%d op=%d usabled=%d collseq=%s\n",
@@ -161728,9 +162889,13 @@ static void whereTraceIndexInfoInputs(sqlite3_index_info *p){
p->aOrderBy[i].desc);
}
}
-static void whereTraceIndexInfoOutputs(sqlite3_index_info *p){
+static void whereTraceIndexInfoOutputs(
+ sqlite3_index_info *p, /* The IndexInfo object */
+ Table *pTab /* The TABLE that is the virtual table */
+){
int i;
if( (sqlite3WhereTrace & 0x10)==0 ) return;
+ sqlite3DebugPrintf("sqlite3_index_info outputs for %s:\n", pTab->zName);
for(i=0; i<p->nConstraint; i++){
sqlite3DebugPrintf(" usage[%d]: argvIdx=%d omit=%d\n",
i,
@@ -161744,8 +162909,8 @@ static void whereTraceIndexInfoOutputs(sqlite3_index_info *p){
sqlite3DebugPrintf(" estimatedRows=%lld\n", p->estimatedRows);
}
#else
-#define whereTraceIndexInfoInputs(A)
-#define whereTraceIndexInfoOutputs(A)
+#define whereTraceIndexInfoInputs(A,B)
+#define whereTraceIndexInfoOutputs(A,B)
#endif
/*
@@ -161929,7 +163094,7 @@ static SQLITE_NOINLINE void constructAutomaticIndex(
** WHERE clause (or the ON clause of a LEFT join) that constrain which
** rows of the target table (pSrc) that can be used. */
if( (pTerm->wtFlags & TERM_VIRTUAL)==0
- && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, pLevel->iFrom)
+ && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, pLevel->iFrom, 0)
){
pPartial = sqlite3ExprAnd(pParse, pPartial,
sqlite3ExprDup(pParse->db, pExpr, 0));
@@ -161971,7 +163136,7 @@ static SQLITE_NOINLINE void constructAutomaticIndex(
** if they go out of sync.
*/
if( IsView(pTable) ){
- extraCols = ALLBITS;
+ extraCols = ALLBITS & ~idxCols;
}else{
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
}
@@ -162198,7 +163363,7 @@ static SQLITE_NOINLINE void sqlite3ConstructBloomFilter(
for(pTerm=pWInfo->sWC.a; pTerm<pWCEnd; pTerm++){
Expr *pExpr = pTerm->pExpr;
if( (pTerm->wtFlags & TERM_VIRTUAL)==0
- && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, iSrc)
+ && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, iSrc, 0)
){
sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);
}
@@ -162324,7 +163489,7 @@ static sqlite3_index_info *allocateIndexInfo(
Expr *pE2;
/* Skip over constant terms in the ORDER BY clause */
- if( sqlite3ExprIsConstant(pExpr) ){
+ if( sqlite3ExprIsConstant(0, pExpr) ){
continue;
}
@@ -162359,7 +163524,7 @@ static sqlite3_index_info *allocateIndexInfo(
}
if( i==n ){
nOrderBy = n;
- if( (pWInfo->wctrlFlags & WHERE_DISTINCTBY) ){
+ if( (pWInfo->wctrlFlags & WHERE_DISTINCTBY) && !pSrc->fg.rowidUsed ){
eDistinct = 2 + ((pWInfo->wctrlFlags & WHERE_SORTBYGROUP)!=0);
}else if( pWInfo->wctrlFlags & WHERE_GROUPBY ){
eDistinct = 1;
@@ -162436,7 +163601,7 @@ static sqlite3_index_info *allocateIndexInfo(
pIdxInfo->nConstraint = j;
for(i=j=0; i<nOrderBy; i++){
Expr *pExpr = pOrderBy->a[i].pExpr;
- if( sqlite3ExprIsConstant(pExpr) ) continue;
+ if( sqlite3ExprIsConstant(0, pExpr) ) continue;
assert( pExpr->op==TK_COLUMN
|| (pExpr->op==TK_COLLATE && pExpr->pLeft->op==TK_COLUMN
&& pExpr->iColumn==pExpr->pLeft->iColumn) );
@@ -162488,11 +163653,11 @@ static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){
sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab;
int rc;
- whereTraceIndexInfoInputs(p);
+ whereTraceIndexInfoInputs(p, pTab);
pParse->db->nSchemaLock++;
rc = pVtab->pModule->xBestIndex(pVtab, p);
pParse->db->nSchemaLock--;
- whereTraceIndexInfoOutputs(p);
+ whereTraceIndexInfoOutputs(p, pTab);
if( rc!=SQLITE_OK && rc!=SQLITE_CONSTRAINT ){
if( rc==SQLITE_NOMEM ){
@@ -163970,7 +165135,9 @@ static int whereLoopAddBtreeIndex(
}
if( pProbe->bUnordered || pProbe->bLowQual ){
if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE);
- if( pProbe->bLowQual ) opMask &= ~(WO_EQ|WO_IN|WO_IS);
+ if( pProbe->bLowQual && pSrc->fg.isIndexedBy==0 ){
+ opMask &= ~(WO_EQ|WO_IN|WO_IS);
+ }
}
assert( pNew->u.btree.nEq<pProbe->nColumn );
@@ -164237,10 +165404,13 @@ static int whereLoopAddBtreeIndex(
}
}
- /* Set rCostIdx to the cost of visiting selected rows in index. Add
- ** it to pNew->rRun, which is currently set to the cost of the index
- ** seek only. Then, if this is a non-covering index, add the cost of
- ** visiting the rows in the main table. */
+ /* Set rCostIdx to the estimated cost of visiting selected rows in the
+ ** index. The estimate is the sum of two values:
+ ** 1. The cost of doing one search-by-key to find the first matching
+ ** entry
+ ** 2. Stepping forward in the index pNew->nOut times to find all
+ ** additional matching entries.
+ */
assert( pSrc->pTab->szTabRow>0 );
if( pProbe->idxType==SQLITE_IDXTYPE_IPK ){
/* The pProbe->szIdxRow is low for an IPK table since the interior
@@ -164251,7 +165421,15 @@ static int whereLoopAddBtreeIndex(
}else{
rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow;
}
- pNew->rRun = sqlite3LogEstAdd(rLogSize, rCostIdx);
+ rCostIdx = sqlite3LogEstAdd(rLogSize, rCostIdx);
+
+ /* Estimate the cost of running the loop. If all data is coming
+ ** from the index, then this is just the cost of doing the index
+ ** lookup and scan. But if some data is coming out of the main table,
+ ** we also have to add in the cost of doing pNew->nOut searches to
+ ** locate the row in the main table that corresponds to the index entry.
+ */
+ pNew->rRun = rCostIdx;
if( (pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK|WHERE_EXPRIDX))==0 ){
pNew->rRun = sqlite3LogEstAdd(pNew->rRun, pNew->nOut + 16);
}
@@ -164357,7 +165535,9 @@ static int indexMightHelpWithOrderBy(
for(ii=0; ii<pOB->nExpr; ii++){
Expr *pExpr = sqlite3ExprSkipCollateAndLikely(pOB->a[ii].pExpr);
if( NEVER(pExpr==0) ) continue;
- if( pExpr->op==TK_COLUMN && pExpr->iTable==iCursor ){
+ if( (pExpr->op==TK_COLUMN || pExpr->op==TK_AGG_COLUMN)
+ && pExpr->iTable==iCursor
+ ){
if( pExpr->iColumn<0 ) return 1;
for(jj=0; jj<pIndex->nKeyCol; jj++){
if( pExpr->iColumn==pIndex->aiColumn[jj] ) return 1;
@@ -164614,7 +165794,7 @@ static void wherePartIdxExpr(
u8 aff;
if( pLeft->op!=TK_COLUMN ) return;
- if( !sqlite3ExprIsConstant(pRight) ) return;
+ if( !sqlite3ExprIsConstant(0, pRight) ) return;
if( !sqlite3IsBinary(sqlite3ExprCompareCollSeq(pParse, pPart)) ) return;
if( pLeft->iColumn<0 ) return;
aff = pIdx->pTable->aCol[pLeft->iColumn].affinity;
@@ -164963,7 +166143,7 @@ static int whereLoopAddBtree(
** unique index is used (making the index functionally non-unique)
** then the sqlite_stat1 data becomes important for scoring the
** plan */
- pTab->tabFlags |= TF_StatsUsed;
+ pTab->tabFlags |= TF_MaybeReanalyze;
}
#ifdef SQLITE_ENABLE_STAT4
sqlite3Stat4ProbeFree(pBuilder->pRec);
@@ -164986,6 +166166,21 @@ static int isLimitTerm(WhereTerm *pTerm){
}
/*
+** Return true if the first nCons constraints in the pUsage array are
+** marked as in-use (have argvIndex>0). False otherwise.
+*/
+static int allConstraintsUsed(
+ struct sqlite3_index_constraint_usage *aUsage,
+ int nCons
+){
+ int ii;
+ for(ii=0; ii<nCons; ii++){
+ if( aUsage[ii].argvIndex<=0 ) return 0;
+ }
+ return 1;
+}
+
+/*
** Argument pIdxInfo is already populated with all constraints that may
** be used by the virtual table identified by pBuilder->pNew->iTab. This
** function marks a subset of those constraints usable, invokes the
@@ -165125,13 +166320,20 @@ static int whereLoopAddVirtualOne(
*pbIn = 1; assert( (mExclude & WO_IN)==0 );
}
+ /* Unless pbRetryLimit is non-NULL, there should be no LIMIT/OFFSET
+ ** terms. And if there are any, they should follow all other terms. */
assert( pbRetryLimit || !isLimitTerm(pTerm) );
- if( isLimitTerm(pTerm) && *pbIn ){
+ assert( !isLimitTerm(pTerm) || i>=nConstraint-2 );
+ assert( !isLimitTerm(pTerm) || i==nConstraint-1 || isLimitTerm(pTerm+1) );
+
+ if( isLimitTerm(pTerm) && (*pbIn || !allConstraintsUsed(pUsage, i)) ){
/* If there is an IN(...) term handled as an == (separate call to
** xFilter for each value on the RHS of the IN) and a LIMIT or
- ** OFFSET term handled as well, the plan is unusable. Set output
- ** variable *pbRetryLimit to true to tell the caller to retry with
- ** LIMIT and OFFSET disabled. */
+ ** OFFSET term handled as well, the plan is unusable. Similarly,
+ ** if there is a LIMIT/OFFSET and there are other unused terms,
+ ** the plan cannot be used. In these cases set variable *pbRetryLimit
+ ** to true to tell the caller to retry with LIMIT and OFFSET
+ ** disabled. */
if( pIdxInfo->needToFreeIdxStr ){
sqlite3_free(pIdxInfo->idxStr);
pIdxInfo->idxStr = 0;
@@ -165988,7 +167190,7 @@ static i8 wherePathSatisfiesOrderBy(
if( MASKBIT(i) & obSat ) continue;
p = pOrderBy->a[i].pExpr;
mTerm = sqlite3WhereExprUsage(&pWInfo->sMaskSet,p);
- if( mTerm==0 && !sqlite3ExprIsConstant(p) ) continue;
+ if( mTerm==0 && !sqlite3ExprIsConstant(0,p) ) continue;
if( (mTerm&~orderDistinctMask)==0 ){
obSat |= MASKBIT(i);
}
@@ -166457,10 +167659,9 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){
pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
}
- if( pWInfo->pSelect->pOrderBy
- && pWInfo->nOBSat > pWInfo->pSelect->pOrderBy->nExpr ){
- pWInfo->nOBSat = pWInfo->pSelect->pOrderBy->nExpr;
- }
+ /* vvv--- See check-in [12ad822d9b827777] on 2023-03-16 ---vvv */
+ assert( pWInfo->pSelect->pOrderBy==0
+ || pWInfo->nOBSat <= pWInfo->pSelect->pOrderBy->nExpr );
}else{
pWInfo->revMask = pFrom->revLoop;
if( pWInfo->nOBSat<=0 ){
@@ -166503,7 +167704,6 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
}
}
-
pWInfo->nRowOut = pFrom->nRow;
/* Free temporary memory and return success */
@@ -166512,6 +167712,83 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
}
/*
+** This routine implements a heuristic designed to improve query planning.
+** This routine is called in between the first and second call to
+** wherePathSolver(). Hence the name "Interstage" "Heuristic".
+**
+** The first call to wherePathSolver() (hereafter just "solver()") computes
+** the best path without regard to the order of the outputs. The second call
+** to the solver() builds upon the first call to try to find an alternative
+** path that satisfies the ORDER BY clause.
+**
+** This routine looks at the results of the first solver() run, and for
+** every FROM clause term in the resulting query plan that uses an equality
+** constraint against an index, disable other WhereLoops for that same
+** FROM clause term that would try to do a full-table scan. This prevents
+** an index search from being converted into a full-table scan in order to
+** satisfy an ORDER BY clause, since even though we might get slightly better
+** performance using the full-scan without sorting if the output size
+** estimates are very precise, we might also get severe performance
+** degradation using the full-scan if the output size estimate is too large.
+** It is better to err on the side of caution.
+**
+** Except, if the first solver() call generated a full-table scan in an outer
+** loop then stop this analysis at the first full-scan, since the second
+** solver() run might try to swap that full-scan for another in order to
+** get the output into the correct order. In other words, we allow a
+** rewrite like this:
+**
+** First Solver() Second Solver()
+** |-- SCAN t1 |-- SCAN t2
+** |-- SEARCH t2 `-- SEARCH t1
+** `-- SORT USING B-TREE
+**
+** The purpose of this routine is to disallow rewrites such as:
+**
+** First Solver() Second Solver()
+** |-- SEARCH t1 |-- SCAN t2 <--- bad!
+** |-- SEARCH t2 `-- SEARCH t1
+** `-- SORT USING B-TREE
+**
+** See test cases in test/whereN.test for the real-world query that
+** originally provoked this heuristic.
+*/
+static SQLITE_NOINLINE void whereInterstageHeuristic(WhereInfo *pWInfo){
+ int i;
+#ifdef WHERETRACE_ENABLED
+ int once = 0;
+#endif
+ for(i=0; i<pWInfo->nLevel; i++){
+ WhereLoop *p = pWInfo->a[i].pWLoop;
+ if( p==0 ) break;
+ if( (p->wsFlags & WHERE_VIRTUALTABLE)!=0 ) continue;
+ if( (p->wsFlags & (WHERE_COLUMN_EQ|WHERE_COLUMN_NULL|WHERE_COLUMN_IN))!=0 ){
+ u8 iTab = p->iTab;
+ WhereLoop *pLoop;
+ for(pLoop=pWInfo->pLoops; pLoop; pLoop=pLoop->pNextLoop){
+ if( pLoop->iTab!=iTab ) continue;
+ if( (pLoop->wsFlags & (WHERE_CONSTRAINT|WHERE_AUTO_INDEX))!=0 ){
+ /* Auto-index and index-constrained loops allowed to remain */
+ continue;
+ }
+#ifdef WHERETRACE_ENABLED
+ if( sqlite3WhereTrace & 0x80 ){
+ if( once==0 ){
+ sqlite3DebugPrintf("Loops disabled by interstage heuristic:\n");
+ once = 1;
+ }
+ sqlite3WhereLoopPrint(pLoop, &pWInfo->sWC);
+ }
+#endif /* WHERETRACE_ENABLED */
+ pLoop->prereq = ALLBITS; /* Prevent 2nd solver() from using this one */
+ }
+ }else{
+ break;
+ }
+ }
+}
+
+/*
** Most queries use only a single table (they are not joins) and have
** simple == constraints against indexed fields. This routine attempts
** to plan those simple cases using much less ceremony than the
@@ -166799,7 +168076,7 @@ static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful(
SrcItem *pItem = &pWInfo->pTabList->a[pLoop->iTab];
Table *pTab = pItem->pTab;
if( (pTab->tabFlags & TF_HasStat1)==0 ) break;
- pTab->tabFlags |= TF_StatsUsed;
+ pTab->tabFlags |= TF_MaybeReanalyze;
if( i>=1
&& (pLoop->wsFlags & reqFlags)==reqFlags
/* vvvvvv--- Always the case if WHERE_COLUMN_EQ is defined */
@@ -166821,6 +168098,58 @@ static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful(
}
/*
+** Expression Node callback for sqlite3ExprCanReturnSubtype().
+**
+** Only a function call is able to return a subtype. So if the node
+** is not a function call, return WRC_Prune immediately.
+**
+** A function call is able to return a subtype if it has the
+** SQLITE_RESULT_SUBTYPE property.
+**
+** Assume that every function is able to pass-through a subtype from
+** one of its argument (using sqlite3_result_value()). Most functions
+** are not this way, but we don't have a mechanism to distinguish those
+** that are from those that are not, so assume they all work this way.
+** That means that if one of its arguments is another function and that
+** other function is able to return a subtype, then this function is
+** able to return a subtype.
+*/
+static int exprNodeCanReturnSubtype(Walker *pWalker, Expr *pExpr){
+ int n;
+ FuncDef *pDef;
+ sqlite3 *db;
+ if( pExpr->op!=TK_FUNCTION ){
+ return WRC_Prune;
+ }
+ assert( ExprUseXList(pExpr) );
+ db = pWalker->pParse->db;
+ n = pExpr->x.pList ? pExpr->x.pList->nExpr : 0;
+ pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0);
+ if( pDef==0 || (pDef->funcFlags & SQLITE_RESULT_SUBTYPE)!=0 ){
+ pWalker->eCode = 1;
+ return WRC_Prune;
+ }
+ return WRC_Continue;
+}
+
+/*
+** Return TRUE if expression pExpr is able to return a subtype.
+**
+** A TRUE return does not guarantee that a subtype will be returned.
+** It only indicates that a subtype return is possible. False positives
+** are acceptable as they only disable an optimization. False negatives,
+** on the other hand, can lead to incorrect answers.
+*/
+static int sqlite3ExprCanReturnSubtype(Parse *pParse, Expr *pExpr){
+ Walker w;
+ memset(&w, 0, sizeof(w));
+ w.pParse = pParse;
+ w.xExprCallback = exprNodeCanReturnSubtype;
+ sqlite3WalkExpr(&w, pExpr);
+ return w.eCode;
+}
+
+/*
** The index pIdx is used by a query and contains one or more expressions.
** In other words pIdx is an index on an expression. iIdxCur is the cursor
** number for the index and iDataCur is the cursor number for the corresponding
@@ -166852,20 +168181,12 @@ static SQLITE_NOINLINE void whereAddIndexedExpr(
}else{
continue;
}
- if( sqlite3ExprIsConstant(pExpr) ) continue;
- if( pExpr->op==TK_FUNCTION ){
+ if( sqlite3ExprIsConstant(0,pExpr) ) continue;
+ if( pExpr->op==TK_FUNCTION && sqlite3ExprCanReturnSubtype(pParse,pExpr) ){
/* Functions that might set a subtype should not be replaced by the
** value taken from an expression index since the index omits the
** subtype. https://sqlite.org/forum/forumpost/68d284c86b082c3e */
- int n;
- FuncDef *pDef;
- sqlite3 *db = pParse->db;
- assert( ExprUseXList(pExpr) );
- n = pExpr->x.pList ? pExpr->x.pList->nExpr : 0;
- pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0);
- if( pDef==0 || (pDef->funcFlags & SQLITE_RESULT_SUBTYPE)!=0 ){
- continue;
- }
+ continue;
}
p = sqlite3DbMallocRaw(pParse->db, sizeof(IndexedExpr));
if( p==0 ) break;
@@ -167130,7 +168451,11 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
){
pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
}
- ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW"));
+ if( ALWAYS(pWInfo->pSelect)
+ && (pWInfo->pSelect->selFlags & SF_MultiValue)==0
+ ){
+ ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW"));
+ }
}else{
/* Assign a bit from the bitmask to every term in the FROM clause.
**
@@ -167283,6 +168608,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
wherePathSolver(pWInfo, 0);
if( db->mallocFailed ) goto whereBeginError;
if( pWInfo->pOrderBy ){
+ whereInterstageHeuristic(pWInfo);
wherePathSolver(pWInfo, pWInfo->nRowOut+1);
if( db->mallocFailed ) goto whereBeginError;
}
@@ -167832,7 +169158,15 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); VdbeCoverage(v);
assert( (ws & WHERE_IDX_ONLY)==0 || (ws & WHERE_INDEXED)!=0 );
if( (ws & WHERE_IDX_ONLY)==0 ){
- assert( pLevel->iTabCur==pTabList->a[pLevel->iFrom].iCursor );
+ SrcItem *pSrc = &pTabList->a[pLevel->iFrom];
+ assert( pLevel->iTabCur==pSrc->iCursor );
+ if( pSrc->fg.viaCoroutine ){
+ int m, n;
+ n = pSrc->regResult;
+ assert( pSrc->pTab!=0 );
+ m = pSrc->pTab->nCol;
+ sqlite3VdbeAddOp3(v, OP_Null, 0, n, n+m-1);
+ }
sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iTabCur);
}
if( (ws & WHERE_INDEXED)
@@ -167882,6 +169216,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
*/
if( pTabItem->fg.viaCoroutine ){
testcase( pParse->db->mallocFailed );
+ assert( pTabItem->regResult>=0 );
translateColumnToCopy(pParse, pLevel->addrBody, pLevel->iTabCur,
pTabItem->regResult, 0);
continue;
@@ -169186,7 +170521,7 @@ SQLITE_PRIVATE void sqlite3WindowListDelete(sqlite3 *db, Window *p){
** variable values in the expression tree.
*/
static Expr *sqlite3WindowOffsetExpr(Parse *pParse, Expr *pExpr){
- if( 0==sqlite3ExprIsConstant(pExpr) ){
+ if( 0==sqlite3ExprIsConstant(0,pExpr) ){
if( IN_RENAME_OBJECT ) sqlite3RenameExprUnmap(pParse, pExpr);
sqlite3ExprDelete(pParse->db, pExpr);
pExpr = sqlite3ExprAlloc(pParse->db, TK_NULL, 0, 0);
@@ -171278,6 +172613,14 @@ static void updateDeleteLimitError(
return pSelect;
}
+ /* Memory allocator for parser stack resizing. This is a thin wrapper around
+ ** sqlite3_realloc() that includes a call to sqlite3FaultSim() to facilitate
+ ** testing.
+ */
+ static void *parserStackRealloc(void *pOld, sqlite3_uint64 newSize){
+ return sqlite3FaultSim(700) ? 0 : sqlite3_realloc(pOld, newSize);
+ }
+
/* Construct a new Expr object from a single token */
static Expr *tokenExpr(Parse *pParse, int op, Token t){
@@ -171527,8 +172870,8 @@ static void updateDeleteLimitError(
#define TK_TRUEFALSE 170
#define TK_ISNOT 171
#define TK_FUNCTION 172
-#define TK_UMINUS 173
-#define TK_UPLUS 174
+#define TK_UPLUS 173
+#define TK_UMINUS 174
#define TK_TRUTH 175
#define TK_REGISTER 176
#define TK_VECTOR 177
@@ -171537,8 +172880,9 @@ static void updateDeleteLimitError(
#define TK_ASTERISK 180
#define TK_SPAN 181
#define TK_ERROR 182
-#define TK_SPACE 183
-#define TK_ILLEGAL 184
+#define TK_QNUMBER 183
+#define TK_SPACE 184
+#define TK_ILLEGAL 185
#endif
/**************** End token definitions ***************************************/
@@ -171579,6 +172923,9 @@ static void updateDeleteLimitError(
** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser
** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser
** sqlite3ParserCTX_* As sqlite3ParserARG_ except for %extra_context
+** YYREALLOC Name of the realloc() function to use
+** YYFREE Name of the free() function to use
+** YYDYNSTACK True if stack space should be extended on heap
** YYERRORSYMBOL is the code number of the error symbol. If not
** defined, then do no error processing.
** YYNSTATE the combined number of states.
@@ -171592,37 +172939,39 @@ static void updateDeleteLimitError(
** YY_NO_ACTION The yy_action[] code for no-op
** YY_MIN_REDUCE Minimum value for reduce actions
** YY_MAX_REDUCE Maximum value for reduce actions
+** YY_MIN_DSTRCTR Minimum symbol value that has a destructor
+** YY_MAX_DSTRCTR Maximum symbol value that has a destructor
*/
#ifndef INTERFACE
# define INTERFACE 1
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 319
+#define YYNOCODE 322
#define YYACTIONTYPE unsigned short int
#define YYWILDCARD 101
#define sqlite3ParserTOKENTYPE Token
typedef union {
int yyinit;
sqlite3ParserTOKENTYPE yy0;
- TriggerStep* yy33;
- Window* yy41;
- Select* yy47;
- SrcList* yy131;
- struct TrigEvent yy180;
- struct {int value; int mask;} yy231;
- IdList* yy254;
- u32 yy285;
- ExprList* yy322;
- Cte* yy385;
- int yy394;
- Upsert* yy444;
- u8 yy516;
- With* yy521;
- const char* yy522;
- Expr* yy528;
- OnOrUsing yy561;
- struct FrameBound yy595;
+ ExprList* yy14;
+ With* yy59;
+ Cte* yy67;
+ Upsert* yy122;
+ IdList* yy132;
+ int yy144;
+ const char* yy168;
+ SrcList* yy203;
+ Window* yy211;
+ OnOrUsing yy269;
+ struct TrigEvent yy286;
+ struct {int value; int mask;} yy383;
+ u32 yy391;
+ TriggerStep* yy427;
+ Expr* yy454;
+ u8 yy462;
+ struct FrameBound yy509;
+ Select* yy555;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -171632,24 +172981,29 @@ typedef union {
#define sqlite3ParserARG_PARAM
#define sqlite3ParserARG_FETCH
#define sqlite3ParserARG_STORE
+#define YYREALLOC parserStackRealloc
+#define YYFREE sqlite3_free
+#define YYDYNSTACK 1
#define sqlite3ParserCTX_SDECL Parse *pParse;
#define sqlite3ParserCTX_PDECL ,Parse *pParse
#define sqlite3ParserCTX_PARAM ,pParse
#define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
#define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
#define YYFALLBACK 1
-#define YYNSTATE 579
-#define YYNRULE 405
-#define YYNRULE_WITH_ACTION 340
-#define YYNTOKEN 185
-#define YY_MAX_SHIFT 578
-#define YY_MIN_SHIFTREDUCE 838
-#define YY_MAX_SHIFTREDUCE 1242
-#define YY_ERROR_ACTION 1243
-#define YY_ACCEPT_ACTION 1244
-#define YY_NO_ACTION 1245
-#define YY_MIN_REDUCE 1246
-#define YY_MAX_REDUCE 1650
+#define YYNSTATE 583
+#define YYNRULE 409
+#define YYNRULE_WITH_ACTION 344
+#define YYNTOKEN 186
+#define YY_MAX_SHIFT 582
+#define YY_MIN_SHIFTREDUCE 845
+#define YY_MAX_SHIFTREDUCE 1253
+#define YY_ERROR_ACTION 1254
+#define YY_ACCEPT_ACTION 1255
+#define YY_NO_ACTION 1256
+#define YY_MIN_REDUCE 1257
+#define YY_MAX_REDUCE 1665
+#define YY_MIN_DSTRCTR 205
+#define YY_MAX_DSTRCTR 319
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -171665,6 +173019,22 @@ typedef union {
# define yytestcase(X)
#endif
+/* Macro to determine if stack space has the ability to grow using
+** heap memory.
+*/
+#if YYSTACKDEPTH<=0 || YYDYNSTACK
+# define YYGROWABLESTACK 1
+#else
+# define YYGROWABLESTACK 0
+#endif
+
+/* Guarantee a minimum number of initial stack slots.
+*/
+#if YYSTACKDEPTH<=0
+# undef YYSTACKDEPTH
+# define YYSTACKDEPTH 2 /* Need a minimum stack size */
+#endif
+
/* Next are the tables used to determine what action to take based on the
** current state and lookahead token. These tables are used to implement
@@ -171716,619 +173086,630 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (2100)
+#define YY_ACTTAB_COUNT (2142)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 572, 210, 572, 119, 116, 231, 572, 119, 116, 231,
- /* 10 */ 572, 1317, 379, 1296, 410, 566, 566, 566, 572, 411,
- /* 20 */ 380, 1317, 1279, 42, 42, 42, 42, 210, 1529, 72,
- /* 30 */ 72, 974, 421, 42, 42, 495, 305, 281, 305, 975,
- /* 40 */ 399, 72, 72, 126, 127, 81, 1217, 1217, 1054, 1057,
- /* 50 */ 1044, 1044, 124, 124, 125, 125, 125, 125, 480, 411,
- /* 60 */ 1244, 1, 1, 578, 2, 1248, 554, 119, 116, 231,
- /* 70 */ 319, 484, 147, 484, 528, 119, 116, 231, 533, 1330,
- /* 80 */ 419, 527, 143, 126, 127, 81, 1217, 1217, 1054, 1057,
- /* 90 */ 1044, 1044, 124, 124, 125, 125, 125, 125, 119, 116,
- /* 100 */ 231, 329, 123, 123, 123, 123, 122, 122, 121, 121,
- /* 110 */ 121, 120, 117, 448, 286, 286, 286, 286, 446, 446,
- /* 120 */ 446, 1568, 378, 1570, 1193, 377, 1164, 569, 1164, 569,
- /* 130 */ 411, 1568, 541, 261, 228, 448, 102, 146, 453, 318,
- /* 140 */ 563, 242, 123, 123, 123, 123, 122, 122, 121, 121,
- /* 150 */ 121, 120, 117, 448, 126, 127, 81, 1217, 1217, 1054,
- /* 160 */ 1057, 1044, 1044, 124, 124, 125, 125, 125, 125, 143,
- /* 170 */ 296, 1193, 341, 452, 121, 121, 121, 120, 117, 448,
- /* 180 */ 128, 1193, 1194, 1193, 149, 445, 444, 572, 120, 117,
- /* 190 */ 448, 125, 125, 125, 125, 118, 123, 123, 123, 123,
- /* 200 */ 122, 122, 121, 121, 121, 120, 117, 448, 458, 114,
- /* 210 */ 13, 13, 550, 123, 123, 123, 123, 122, 122, 121,
- /* 220 */ 121, 121, 120, 117, 448, 424, 318, 563, 1193, 1194,
- /* 230 */ 1193, 150, 1225, 411, 1225, 125, 125, 125, 125, 123,
- /* 240 */ 123, 123, 123, 122, 122, 121, 121, 121, 120, 117,
- /* 250 */ 448, 469, 344, 1041, 1041, 1055, 1058, 126, 127, 81,
- /* 260 */ 1217, 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125,
- /* 270 */ 125, 125, 1282, 526, 224, 1193, 572, 411, 226, 519,
- /* 280 */ 177, 83, 84, 123, 123, 123, 123, 122, 122, 121,
- /* 290 */ 121, 121, 120, 117, 448, 1010, 16, 16, 1193, 134,
- /* 300 */ 134, 126, 127, 81, 1217, 1217, 1054, 1057, 1044, 1044,
- /* 310 */ 124, 124, 125, 125, 125, 125, 123, 123, 123, 123,
- /* 320 */ 122, 122, 121, 121, 121, 120, 117, 448, 1045, 550,
- /* 330 */ 1193, 375, 1193, 1194, 1193, 254, 1438, 401, 508, 505,
- /* 340 */ 504, 112, 564, 570, 4, 929, 929, 435, 503, 342,
- /* 350 */ 464, 330, 362, 396, 1238, 1193, 1194, 1193, 567, 572,
- /* 360 */ 123, 123, 123, 123, 122, 122, 121, 121, 121, 120,
- /* 370 */ 117, 448, 286, 286, 371, 1581, 1607, 445, 444, 155,
- /* 380 */ 411, 449, 72, 72, 1289, 569, 1222, 1193, 1194, 1193,
- /* 390 */ 86, 1224, 273, 561, 547, 520, 520, 572, 99, 1223,
- /* 400 */ 6, 1281, 476, 143, 126, 127, 81, 1217, 1217, 1054,
- /* 410 */ 1057, 1044, 1044, 124, 124, 125, 125, 125, 125, 554,
- /* 420 */ 13, 13, 1031, 511, 1225, 1193, 1225, 553, 110, 110,
- /* 430 */ 224, 572, 1239, 177, 572, 429, 111, 199, 449, 573,
- /* 440 */ 449, 432, 1555, 1019, 327, 555, 1193, 272, 289, 370,
- /* 450 */ 514, 365, 513, 259, 72, 72, 547, 72, 72, 361,
- /* 460 */ 318, 563, 1613, 123, 123, 123, 123, 122, 122, 121,
- /* 470 */ 121, 121, 120, 117, 448, 1019, 1019, 1021, 1022, 28,
- /* 480 */ 286, 286, 1193, 1194, 1193, 1159, 572, 1612, 411, 904,
- /* 490 */ 192, 554, 358, 569, 554, 940, 537, 521, 1159, 437,
- /* 500 */ 415, 1159, 556, 1193, 1194, 1193, 572, 548, 548, 52,
- /* 510 */ 52, 216, 126, 127, 81, 1217, 1217, 1054, 1057, 1044,
- /* 520 */ 1044, 124, 124, 125, 125, 125, 125, 1193, 478, 136,
- /* 530 */ 136, 411, 286, 286, 1493, 509, 122, 122, 121, 121,
- /* 540 */ 121, 120, 117, 448, 1010, 569, 522, 219, 545, 545,
- /* 550 */ 318, 563, 143, 6, 536, 126, 127, 81, 1217, 1217,
- /* 560 */ 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, 125,
- /* 570 */ 1557, 123, 123, 123, 123, 122, 122, 121, 121, 121,
- /* 580 */ 120, 117, 448, 489, 1193, 1194, 1193, 486, 283, 1270,
- /* 590 */ 960, 254, 1193, 375, 508, 505, 504, 1193, 342, 574,
- /* 600 */ 1193, 574, 411, 294, 503, 960, 879, 193, 484, 318,
- /* 610 */ 563, 386, 292, 382, 123, 123, 123, 123, 122, 122,
- /* 620 */ 121, 121, 121, 120, 117, 448, 126, 127, 81, 1217,
- /* 630 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125,
- /* 640 */ 125, 411, 396, 1139, 1193, 872, 101, 286, 286, 1193,
- /* 650 */ 1194, 1193, 375, 1096, 1193, 1194, 1193, 1193, 1194, 1193,
- /* 660 */ 569, 459, 33, 375, 235, 126, 127, 81, 1217, 1217,
- /* 670 */ 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, 125,
- /* 680 */ 1437, 962, 572, 230, 961, 123, 123, 123, 123, 122,
- /* 690 */ 122, 121, 121, 121, 120, 117, 448, 1159, 230, 1193,
- /* 700 */ 158, 1193, 1194, 1193, 1556, 13, 13, 303, 960, 1233,
- /* 710 */ 1159, 154, 411, 1159, 375, 1584, 1177, 5, 371, 1581,
- /* 720 */ 431, 1239, 3, 960, 123, 123, 123, 123, 122, 122,
- /* 730 */ 121, 121, 121, 120, 117, 448, 126, 127, 81, 1217,
- /* 740 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125,
- /* 750 */ 125, 411, 210, 571, 1193, 1032, 1193, 1194, 1193, 1193,
- /* 760 */ 390, 855, 156, 1555, 376, 404, 1101, 1101, 492, 572,
- /* 770 */ 469, 344, 1322, 1322, 1555, 126, 127, 81, 1217, 1217,
- /* 780 */ 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, 125,
- /* 790 */ 130, 572, 13, 13, 532, 123, 123, 123, 123, 122,
- /* 800 */ 122, 121, 121, 121, 120, 117, 448, 304, 572, 457,
- /* 810 */ 229, 1193, 1194, 1193, 13, 13, 1193, 1194, 1193, 1300,
- /* 820 */ 467, 1270, 411, 1320, 1320, 1555, 1015, 457, 456, 436,
- /* 830 */ 301, 72, 72, 1268, 123, 123, 123, 123, 122, 122,
- /* 840 */ 121, 121, 121, 120, 117, 448, 126, 127, 81, 1217,
- /* 850 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125,
- /* 860 */ 125, 411, 384, 1076, 1159, 286, 286, 421, 314, 280,
- /* 870 */ 280, 287, 287, 461, 408, 407, 1539, 1159, 569, 572,
- /* 880 */ 1159, 1196, 569, 409, 569, 126, 127, 81, 1217, 1217,
- /* 890 */ 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125, 125,
- /* 900 */ 457, 1485, 13, 13, 1541, 123, 123, 123, 123, 122,
- /* 910 */ 122, 121, 121, 121, 120, 117, 448, 202, 572, 462,
- /* 920 */ 1587, 578, 2, 1248, 843, 844, 845, 1563, 319, 409,
- /* 930 */ 147, 6, 411, 257, 256, 255, 208, 1330, 9, 1196,
- /* 940 */ 264, 72, 72, 1436, 123, 123, 123, 123, 122, 122,
- /* 950 */ 121, 121, 121, 120, 117, 448, 126, 127, 81, 1217,
- /* 960 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125,
- /* 970 */ 125, 572, 286, 286, 572, 1213, 411, 577, 315, 1248,
- /* 980 */ 421, 371, 1581, 356, 319, 569, 147, 495, 529, 1644,
- /* 990 */ 397, 935, 495, 1330, 71, 71, 934, 72, 72, 242,
- /* 1000 */ 1328, 105, 81, 1217, 1217, 1054, 1057, 1044, 1044, 124,
- /* 1010 */ 124, 125, 125, 125, 125, 123, 123, 123, 123, 122,
- /* 1020 */ 122, 121, 121, 121, 120, 117, 448, 1117, 286, 286,
- /* 1030 */ 1422, 452, 1528, 1213, 443, 286, 286, 1492, 1355, 313,
- /* 1040 */ 478, 569, 1118, 454, 351, 495, 354, 1266, 569, 209,
- /* 1050 */ 572, 418, 179, 572, 1031, 242, 385, 1119, 523, 123,
- /* 1060 */ 123, 123, 123, 122, 122, 121, 121, 121, 120, 117,
- /* 1070 */ 448, 1020, 108, 72, 72, 1019, 13, 13, 915, 572,
- /* 1080 */ 1498, 572, 286, 286, 98, 530, 1537, 452, 916, 1334,
- /* 1090 */ 1329, 203, 411, 286, 286, 569, 152, 211, 1498, 1500,
- /* 1100 */ 426, 569, 56, 56, 57, 57, 569, 1019, 1019, 1021,
- /* 1110 */ 447, 572, 411, 531, 12, 297, 126, 127, 81, 1217,
- /* 1120 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125,
- /* 1130 */ 125, 572, 411, 867, 15, 15, 126, 127, 81, 1217,
- /* 1140 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125,
- /* 1150 */ 125, 373, 529, 264, 44, 44, 126, 115, 81, 1217,
- /* 1160 */ 1217, 1054, 1057, 1044, 1044, 124, 124, 125, 125, 125,
- /* 1170 */ 125, 1498, 478, 1271, 417, 123, 123, 123, 123, 122,
- /* 1180 */ 122, 121, 121, 121, 120, 117, 448, 205, 1213, 495,
- /* 1190 */ 430, 867, 468, 322, 495, 123, 123, 123, 123, 122,
- /* 1200 */ 122, 121, 121, 121, 120, 117, 448, 572, 557, 1140,
- /* 1210 */ 1642, 1422, 1642, 543, 572, 123, 123, 123, 123, 122,
- /* 1220 */ 122, 121, 121, 121, 120, 117, 448, 572, 1422, 572,
- /* 1230 */ 13, 13, 542, 323, 1325, 411, 334, 58, 58, 349,
- /* 1240 */ 1422, 1170, 326, 286, 286, 549, 1213, 300, 895, 530,
- /* 1250 */ 45, 45, 59, 59, 1140, 1643, 569, 1643, 565, 417,
- /* 1260 */ 127, 81, 1217, 1217, 1054, 1057, 1044, 1044, 124, 124,
- /* 1270 */ 125, 125, 125, 125, 1367, 373, 500, 290, 1193, 512,
- /* 1280 */ 1366, 427, 394, 394, 393, 275, 391, 896, 1138, 852,
- /* 1290 */ 478, 258, 1422, 1170, 463, 1159, 12, 331, 428, 333,
- /* 1300 */ 1117, 460, 236, 258, 325, 460, 544, 1544, 1159, 1098,
- /* 1310 */ 491, 1159, 324, 1098, 440, 1118, 335, 516, 123, 123,
- /* 1320 */ 123, 123, 122, 122, 121, 121, 121, 120, 117, 448,
- /* 1330 */ 1119, 318, 563, 1138, 572, 1193, 1194, 1193, 112, 564,
- /* 1340 */ 201, 4, 238, 433, 935, 490, 285, 228, 1517, 934,
- /* 1350 */ 170, 560, 572, 142, 1516, 567, 572, 60, 60, 572,
- /* 1360 */ 416, 572, 441, 572, 535, 302, 875, 8, 487, 572,
- /* 1370 */ 237, 572, 416, 572, 485, 61, 61, 572, 449, 62,
- /* 1380 */ 62, 332, 63, 63, 46, 46, 47, 47, 361, 572,
- /* 1390 */ 561, 572, 48, 48, 50, 50, 51, 51, 572, 295,
- /* 1400 */ 64, 64, 482, 295, 539, 412, 471, 1031, 572, 538,
- /* 1410 */ 318, 563, 65, 65, 66, 66, 409, 475, 572, 1031,
- /* 1420 */ 572, 14, 14, 875, 1020, 110, 110, 409, 1019, 572,
- /* 1430 */ 474, 67, 67, 111, 455, 449, 573, 449, 98, 317,
- /* 1440 */ 1019, 132, 132, 133, 133, 572, 1561, 572, 974, 409,
- /* 1450 */ 6, 1562, 68, 68, 1560, 6, 975, 572, 6, 1559,
- /* 1460 */ 1019, 1019, 1021, 6, 346, 218, 101, 531, 53, 53,
- /* 1470 */ 69, 69, 1019, 1019, 1021, 1022, 28, 1586, 1181, 451,
- /* 1480 */ 70, 70, 290, 87, 215, 31, 1363, 394, 394, 393,
- /* 1490 */ 275, 391, 350, 109, 852, 107, 572, 112, 564, 483,
- /* 1500 */ 4, 1212, 572, 239, 153, 572, 39, 236, 1299, 325,
- /* 1510 */ 112, 564, 1298, 4, 567, 572, 32, 324, 572, 54,
- /* 1520 */ 54, 572, 1135, 353, 398, 165, 165, 567, 166, 166,
- /* 1530 */ 572, 291, 355, 572, 17, 357, 572, 449, 77, 77,
- /* 1540 */ 1313, 55, 55, 1297, 73, 73, 572, 238, 470, 561,
- /* 1550 */ 449, 472, 364, 135, 135, 170, 74, 74, 142, 163,
- /* 1560 */ 163, 374, 561, 539, 572, 321, 572, 886, 540, 137,
- /* 1570 */ 137, 339, 1353, 422, 298, 237, 539, 572, 1031, 572,
- /* 1580 */ 340, 538, 101, 369, 110, 110, 162, 131, 131, 164,
- /* 1590 */ 164, 1031, 111, 368, 449, 573, 449, 110, 110, 1019,
- /* 1600 */ 157, 157, 141, 141, 572, 111, 572, 449, 573, 449,
- /* 1610 */ 412, 288, 1019, 572, 882, 318, 563, 572, 219, 572,
- /* 1620 */ 241, 1012, 477, 263, 263, 894, 893, 140, 140, 138,
- /* 1630 */ 138, 1019, 1019, 1021, 1022, 28, 139, 139, 525, 455,
- /* 1640 */ 76, 76, 78, 78, 1019, 1019, 1021, 1022, 28, 1181,
- /* 1650 */ 451, 572, 1083, 290, 112, 564, 1575, 4, 394, 394,
- /* 1660 */ 393, 275, 391, 572, 1023, 852, 572, 479, 345, 263,
- /* 1670 */ 101, 567, 882, 1376, 75, 75, 1421, 501, 236, 260,
- /* 1680 */ 325, 112, 564, 359, 4, 101, 43, 43, 324, 49,
- /* 1690 */ 49, 901, 902, 161, 449, 101, 977, 978, 567, 1079,
- /* 1700 */ 1349, 260, 965, 932, 263, 114, 561, 1095, 517, 1095,
- /* 1710 */ 1083, 1094, 865, 1094, 151, 933, 1144, 114, 238, 1361,
- /* 1720 */ 558, 449, 1023, 559, 1426, 1278, 170, 1269, 1257, 142,
- /* 1730 */ 1601, 1256, 1258, 561, 1594, 1031, 496, 278, 213, 1346,
- /* 1740 */ 310, 110, 110, 939, 311, 312, 237, 11, 234, 111,
- /* 1750 */ 221, 449, 573, 449, 293, 395, 1019, 1408, 337, 1403,
- /* 1760 */ 1396, 338, 1031, 299, 343, 1413, 1412, 481, 110, 110,
- /* 1770 */ 506, 402, 225, 1296, 206, 367, 111, 1358, 449, 573,
- /* 1780 */ 449, 412, 1359, 1019, 1489, 1488, 318, 563, 1019, 1019,
- /* 1790 */ 1021, 1022, 28, 562, 207, 220, 80, 564, 389, 4,
- /* 1800 */ 1597, 1357, 552, 1356, 1233, 181, 267, 232, 1536, 1534,
- /* 1810 */ 455, 1230, 420, 567, 82, 1019, 1019, 1021, 1022, 28,
- /* 1820 */ 86, 217, 85, 1494, 190, 175, 183, 465, 185, 466,
- /* 1830 */ 36, 1409, 186, 187, 188, 499, 449, 244, 37, 99,
- /* 1840 */ 400, 1415, 1414, 488, 1417, 194, 473, 403, 561, 1483,
- /* 1850 */ 248, 92, 1505, 494, 198, 279, 112, 564, 250, 4,
- /* 1860 */ 348, 497, 405, 352, 1259, 251, 252, 515, 1316, 434,
- /* 1870 */ 1315, 1314, 94, 567, 1307, 886, 1306, 1031, 226, 406,
- /* 1880 */ 1611, 1610, 438, 110, 110, 1580, 1286, 524, 439, 308,
- /* 1890 */ 266, 111, 1285, 449, 573, 449, 449, 309, 1019, 366,
- /* 1900 */ 1284, 1609, 265, 1566, 1565, 442, 372, 1381, 561, 129,
- /* 1910 */ 550, 1380, 10, 1470, 383, 106, 316, 551, 100, 35,
- /* 1920 */ 534, 575, 212, 1339, 381, 387, 1187, 1338, 274, 276,
- /* 1930 */ 1019, 1019, 1021, 1022, 28, 277, 413, 1031, 576, 1254,
- /* 1940 */ 388, 1521, 1249, 110, 110, 167, 1522, 168, 148, 1520,
- /* 1950 */ 1519, 111, 306, 449, 573, 449, 222, 223, 1019, 839,
- /* 1960 */ 169, 79, 450, 214, 414, 233, 320, 145, 1093, 1091,
- /* 1970 */ 328, 182, 171, 1212, 918, 184, 240, 336, 243, 1107,
- /* 1980 */ 189, 172, 173, 423, 425, 88, 180, 191, 89, 90,
- /* 1990 */ 1019, 1019, 1021, 1022, 28, 91, 174, 1110, 245, 1106,
- /* 2000 */ 246, 159, 18, 247, 347, 1099, 263, 195, 1227, 493,
- /* 2010 */ 249, 196, 38, 854, 498, 368, 253, 360, 897, 197,
- /* 2020 */ 502, 93, 19, 20, 507, 884, 363, 510, 95, 307,
- /* 2030 */ 160, 96, 518, 97, 1175, 1060, 1146, 40, 21, 227,
- /* 2040 */ 176, 1145, 282, 284, 969, 200, 963, 114, 262, 1165,
- /* 2050 */ 22, 23, 24, 1161, 1169, 25, 1163, 1150, 34, 26,
- /* 2060 */ 1168, 546, 27, 204, 101, 103, 104, 1074, 7, 1061,
- /* 2070 */ 1059, 1063, 1116, 1064, 1115, 268, 269, 29, 41, 270,
- /* 2080 */ 1024, 866, 113, 30, 568, 392, 1183, 144, 178, 1182,
- /* 2090 */ 271, 928, 1245, 1245, 1245, 1245, 1245, 1245, 1245, 1602,
+ /* 0 */ 576, 128, 125, 232, 1622, 549, 576, 1290, 1281, 576,
+ /* 10 */ 328, 576, 1300, 212, 576, 128, 125, 232, 578, 412,
+ /* 20 */ 578, 391, 1542, 51, 51, 523, 405, 1293, 529, 51,
+ /* 30 */ 51, 983, 51, 51, 81, 81, 1107, 61, 61, 984,
+ /* 40 */ 1107, 1292, 380, 135, 136, 90, 1228, 1228, 1063, 1066,
+ /* 50 */ 1053, 1053, 133, 133, 134, 134, 134, 134, 1577, 412,
+ /* 60 */ 287, 287, 7, 287, 287, 422, 1050, 1050, 1064, 1067,
+ /* 70 */ 289, 556, 492, 573, 524, 561, 573, 497, 561, 482,
+ /* 80 */ 530, 262, 229, 135, 136, 90, 1228, 1228, 1063, 1066,
+ /* 90 */ 1053, 1053, 133, 133, 134, 134, 134, 134, 128, 125,
+ /* 100 */ 232, 1506, 132, 132, 132, 132, 131, 131, 130, 130,
+ /* 110 */ 130, 129, 126, 450, 1204, 1255, 1, 1, 582, 2,
+ /* 120 */ 1259, 1571, 420, 1582, 379, 320, 1174, 153, 1174, 1584,
+ /* 130 */ 412, 378, 1582, 543, 1341, 330, 111, 570, 570, 570,
+ /* 140 */ 293, 1054, 132, 132, 132, 132, 131, 131, 130, 130,
+ /* 150 */ 130, 129, 126, 450, 135, 136, 90, 1228, 1228, 1063,
+ /* 160 */ 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, 287,
+ /* 170 */ 287, 1204, 1205, 1204, 255, 287, 287, 510, 507, 506,
+ /* 180 */ 137, 455, 573, 212, 561, 447, 446, 505, 573, 1616,
+ /* 190 */ 561, 134, 134, 134, 134, 127, 400, 243, 132, 132,
+ /* 200 */ 132, 132, 131, 131, 130, 130, 130, 129, 126, 450,
+ /* 210 */ 282, 471, 345, 132, 132, 132, 132, 131, 131, 130,
+ /* 220 */ 130, 130, 129, 126, 450, 574, 155, 936, 936, 454,
+ /* 230 */ 227, 521, 1236, 412, 1236, 134, 134, 134, 134, 132,
+ /* 240 */ 132, 132, 132, 131, 131, 130, 130, 130, 129, 126,
+ /* 250 */ 450, 130, 130, 130, 129, 126, 450, 135, 136, 90,
+ /* 260 */ 1228, 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134,
+ /* 270 */ 134, 134, 128, 125, 232, 450, 576, 412, 397, 1249,
+ /* 280 */ 180, 92, 93, 132, 132, 132, 132, 131, 131, 130,
+ /* 290 */ 130, 130, 129, 126, 450, 381, 387, 1204, 383, 81,
+ /* 300 */ 81, 135, 136, 90, 1228, 1228, 1063, 1066, 1053, 1053,
+ /* 310 */ 133, 133, 134, 134, 134, 134, 132, 132, 132, 132,
+ /* 320 */ 131, 131, 130, 130, 130, 129, 126, 450, 131, 131,
+ /* 330 */ 130, 130, 130, 129, 126, 450, 556, 1204, 302, 319,
+ /* 340 */ 567, 121, 568, 480, 4, 555, 1149, 1657, 1628, 1657,
+ /* 350 */ 45, 128, 125, 232, 1204, 1205, 1204, 1250, 571, 1169,
+ /* 360 */ 132, 132, 132, 132, 131, 131, 130, 130, 130, 129,
+ /* 370 */ 126, 450, 1169, 287, 287, 1169, 1019, 576, 422, 1019,
+ /* 380 */ 412, 451, 1602, 582, 2, 1259, 573, 44, 561, 95,
+ /* 390 */ 320, 110, 153, 565, 1204, 1205, 1204, 522, 522, 1341,
+ /* 400 */ 81, 81, 7, 44, 135, 136, 90, 1228, 1228, 1063,
+ /* 410 */ 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, 295,
+ /* 420 */ 1149, 1658, 1040, 1658, 1204, 1147, 319, 567, 119, 119,
+ /* 430 */ 343, 466, 331, 343, 287, 287, 120, 556, 451, 577,
+ /* 440 */ 451, 1169, 1169, 1028, 319, 567, 438, 573, 210, 561,
+ /* 450 */ 1339, 1451, 546, 531, 1169, 1169, 1598, 1169, 1169, 416,
+ /* 460 */ 319, 567, 243, 132, 132, 132, 132, 131, 131, 130,
+ /* 470 */ 130, 130, 129, 126, 450, 1028, 1028, 1030, 1031, 35,
+ /* 480 */ 44, 1204, 1205, 1204, 472, 287, 287, 1328, 412, 1307,
+ /* 490 */ 372, 1595, 359, 225, 454, 1204, 195, 1328, 573, 1147,
+ /* 500 */ 561, 1333, 1333, 274, 576, 1188, 576, 340, 46, 196,
+ /* 510 */ 537, 217, 135, 136, 90, 1228, 1228, 1063, 1066, 1053,
+ /* 520 */ 1053, 133, 133, 134, 134, 134, 134, 19, 19, 19,
+ /* 530 */ 19, 412, 581, 1204, 1259, 511, 1204, 319, 567, 320,
+ /* 540 */ 944, 153, 425, 491, 430, 943, 1204, 488, 1341, 1450,
+ /* 550 */ 532, 1277, 1204, 1205, 1204, 135, 136, 90, 1228, 1228,
+ /* 560 */ 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, 134,
+ /* 570 */ 575, 132, 132, 132, 132, 131, 131, 130, 130, 130,
+ /* 580 */ 129, 126, 450, 287, 287, 528, 287, 287, 372, 1595,
+ /* 590 */ 1204, 1205, 1204, 1204, 1205, 1204, 573, 486, 561, 573,
+ /* 600 */ 889, 561, 412, 1204, 1205, 1204, 886, 40, 22, 22,
+ /* 610 */ 220, 243, 525, 1449, 132, 132, 132, 132, 131, 131,
+ /* 620 */ 130, 130, 130, 129, 126, 450, 135, 136, 90, 1228,
+ /* 630 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134,
+ /* 640 */ 134, 412, 180, 454, 1204, 879, 255, 287, 287, 510,
+ /* 650 */ 507, 506, 372, 1595, 1568, 1331, 1331, 576, 889, 505,
+ /* 660 */ 573, 44, 561, 559, 1207, 135, 136, 90, 1228, 1228,
+ /* 670 */ 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, 134,
+ /* 680 */ 81, 81, 422, 576, 377, 132, 132, 132, 132, 131,
+ /* 690 */ 131, 130, 130, 130, 129, 126, 450, 297, 287, 287,
+ /* 700 */ 460, 1204, 1205, 1204, 1204, 534, 19, 19, 448, 448,
+ /* 710 */ 448, 573, 412, 561, 230, 436, 1187, 535, 319, 567,
+ /* 720 */ 363, 432, 1207, 1435, 132, 132, 132, 132, 131, 131,
+ /* 730 */ 130, 130, 130, 129, 126, 450, 135, 136, 90, 1228,
+ /* 740 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134,
+ /* 750 */ 134, 412, 211, 949, 1169, 1041, 1110, 1110, 494, 547,
+ /* 760 */ 547, 1204, 1205, 1204, 7, 539, 1570, 1169, 376, 576,
+ /* 770 */ 1169, 5, 1204, 486, 3, 135, 136, 90, 1228, 1228,
+ /* 780 */ 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, 134,
+ /* 790 */ 576, 513, 19, 19, 427, 132, 132, 132, 132, 131,
+ /* 800 */ 131, 130, 130, 130, 129, 126, 450, 305, 1204, 433,
+ /* 810 */ 225, 1204, 385, 19, 19, 273, 290, 371, 516, 366,
+ /* 820 */ 515, 260, 412, 538, 1568, 549, 1024, 362, 437, 1204,
+ /* 830 */ 1205, 1204, 902, 1552, 132, 132, 132, 132, 131, 131,
+ /* 840 */ 130, 130, 130, 129, 126, 450, 135, 136, 90, 1228,
+ /* 850 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134,
+ /* 860 */ 134, 412, 1435, 514, 1281, 1204, 1205, 1204, 1204, 1205,
+ /* 870 */ 1204, 903, 48, 342, 1568, 1568, 1279, 1627, 1568, 911,
+ /* 880 */ 576, 129, 126, 450, 110, 135, 136, 90, 1228, 1228,
+ /* 890 */ 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, 134,
+ /* 900 */ 265, 576, 459, 19, 19, 132, 132, 132, 132, 131,
+ /* 910 */ 131, 130, 130, 130, 129, 126, 450, 1345, 204, 576,
+ /* 920 */ 459, 458, 50, 47, 19, 19, 49, 434, 1105, 573,
+ /* 930 */ 497, 561, 412, 428, 108, 1224, 1569, 1554, 376, 205,
+ /* 940 */ 550, 550, 81, 81, 132, 132, 132, 132, 131, 131,
+ /* 950 */ 130, 130, 130, 129, 126, 450, 135, 136, 90, 1228,
+ /* 960 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134,
+ /* 970 */ 134, 480, 576, 1204, 576, 1541, 412, 1435, 969, 315,
+ /* 980 */ 1659, 398, 284, 497, 969, 893, 1569, 1569, 376, 376,
+ /* 990 */ 1569, 461, 376, 1224, 459, 80, 80, 81, 81, 497,
+ /* 1000 */ 374, 114, 90, 1228, 1228, 1063, 1066, 1053, 1053, 133,
+ /* 1010 */ 133, 134, 134, 134, 134, 132, 132, 132, 132, 131,
+ /* 1020 */ 131, 130, 130, 130, 129, 126, 450, 1204, 1505, 576,
+ /* 1030 */ 1204, 1205, 1204, 1366, 316, 486, 281, 281, 497, 431,
+ /* 1040 */ 557, 288, 288, 402, 1340, 471, 345, 298, 429, 573,
+ /* 1050 */ 576, 561, 81, 81, 573, 374, 561, 971, 386, 132,
+ /* 1060 */ 132, 132, 132, 131, 131, 130, 130, 130, 129, 126,
+ /* 1070 */ 450, 231, 117, 81, 81, 287, 287, 231, 287, 287,
+ /* 1080 */ 576, 1511, 576, 1336, 1204, 1205, 1204, 139, 573, 556,
+ /* 1090 */ 561, 573, 412, 561, 441, 456, 969, 213, 558, 1511,
+ /* 1100 */ 1513, 1550, 969, 143, 143, 145, 145, 1368, 314, 478,
+ /* 1110 */ 444, 970, 412, 850, 851, 852, 135, 136, 90, 1228,
+ /* 1120 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134,
+ /* 1130 */ 134, 357, 412, 397, 1148, 304, 135, 136, 90, 1228,
+ /* 1140 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134,
+ /* 1150 */ 134, 1575, 323, 6, 862, 7, 135, 124, 90, 1228,
+ /* 1160 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134,
+ /* 1170 */ 134, 409, 408, 1511, 212, 132, 132, 132, 132, 131,
+ /* 1180 */ 131, 130, 130, 130, 129, 126, 450, 411, 118, 1204,
+ /* 1190 */ 116, 10, 352, 265, 355, 132, 132, 132, 132, 131,
+ /* 1200 */ 131, 130, 130, 130, 129, 126, 450, 576, 324, 306,
+ /* 1210 */ 576, 306, 1250, 469, 158, 132, 132, 132, 132, 131,
+ /* 1220 */ 131, 130, 130, 130, 129, 126, 450, 207, 1224, 1126,
+ /* 1230 */ 65, 65, 470, 66, 66, 412, 447, 446, 882, 531,
+ /* 1240 */ 335, 258, 257, 256, 1127, 1233, 1204, 1205, 1204, 327,
+ /* 1250 */ 1235, 874, 159, 576, 16, 480, 1085, 1040, 1234, 1128,
+ /* 1260 */ 136, 90, 1228, 1228, 1063, 1066, 1053, 1053, 133, 133,
+ /* 1270 */ 134, 134, 134, 134, 1029, 576, 81, 81, 1028, 1040,
+ /* 1280 */ 922, 576, 463, 1236, 576, 1236, 1224, 502, 107, 1435,
+ /* 1290 */ 923, 6, 576, 410, 1498, 882, 1029, 480, 21, 21,
+ /* 1300 */ 1028, 332, 1380, 334, 53, 53, 497, 81, 81, 874,
+ /* 1310 */ 1028, 1028, 1030, 445, 259, 19, 19, 533, 132, 132,
+ /* 1320 */ 132, 132, 131, 131, 130, 130, 130, 129, 126, 450,
+ /* 1330 */ 551, 301, 1028, 1028, 1030, 107, 532, 545, 121, 568,
+ /* 1340 */ 1188, 4, 1126, 1576, 449, 576, 462, 7, 1282, 418,
+ /* 1350 */ 462, 350, 1435, 576, 518, 571, 544, 1127, 121, 568,
+ /* 1360 */ 442, 4, 1188, 464, 533, 1180, 1223, 9, 67, 67,
+ /* 1370 */ 487, 576, 1128, 303, 410, 571, 54, 54, 451, 576,
+ /* 1380 */ 123, 944, 576, 417, 576, 333, 943, 1379, 576, 236,
+ /* 1390 */ 565, 576, 1574, 564, 68, 68, 7, 576, 451, 362,
+ /* 1400 */ 419, 182, 69, 69, 541, 70, 70, 71, 71, 540,
+ /* 1410 */ 565, 72, 72, 484, 55, 55, 473, 1180, 296, 1040,
+ /* 1420 */ 56, 56, 296, 493, 541, 119, 119, 410, 1573, 542,
+ /* 1430 */ 569, 418, 7, 120, 1244, 451, 577, 451, 465, 1040,
+ /* 1440 */ 1028, 576, 1557, 552, 476, 119, 119, 527, 259, 121,
+ /* 1450 */ 568, 240, 4, 120, 576, 451, 577, 451, 576, 477,
+ /* 1460 */ 1028, 576, 156, 576, 57, 57, 571, 576, 286, 229,
+ /* 1470 */ 410, 336, 1028, 1028, 1030, 1031, 35, 59, 59, 219,
+ /* 1480 */ 983, 60, 60, 220, 73, 73, 74, 74, 984, 451,
+ /* 1490 */ 75, 75, 1028, 1028, 1030, 1031, 35, 96, 216, 291,
+ /* 1500 */ 552, 565, 1188, 318, 395, 395, 394, 276, 392, 576,
+ /* 1510 */ 485, 859, 474, 1311, 410, 541, 576, 417, 1530, 1144,
+ /* 1520 */ 540, 399, 1188, 292, 237, 1153, 326, 38, 23, 576,
+ /* 1530 */ 1040, 576, 20, 20, 325, 299, 119, 119, 164, 76,
+ /* 1540 */ 76, 1529, 121, 568, 120, 4, 451, 577, 451, 203,
+ /* 1550 */ 576, 1028, 141, 141, 142, 142, 576, 322, 39, 571,
+ /* 1560 */ 341, 1021, 110, 264, 239, 901, 900, 423, 242, 908,
+ /* 1570 */ 909, 370, 173, 77, 77, 43, 479, 1310, 264, 62,
+ /* 1580 */ 62, 369, 451, 1028, 1028, 1030, 1031, 35, 1601, 1192,
+ /* 1590 */ 453, 1092, 238, 291, 565, 163, 1309, 110, 395, 395,
+ /* 1600 */ 394, 276, 392, 986, 987, 859, 481, 346, 264, 110,
+ /* 1610 */ 1032, 489, 576, 1188, 503, 1088, 261, 261, 237, 576,
+ /* 1620 */ 326, 121, 568, 1040, 4, 347, 1376, 413, 325, 119,
+ /* 1630 */ 119, 948, 319, 567, 351, 78, 78, 120, 571, 451,
+ /* 1640 */ 577, 451, 79, 79, 1028, 354, 356, 576, 360, 1092,
+ /* 1650 */ 110, 576, 974, 942, 264, 123, 457, 358, 239, 576,
+ /* 1660 */ 519, 451, 939, 1104, 123, 1104, 173, 576, 1032, 43,
+ /* 1670 */ 63, 63, 1324, 565, 168, 168, 1028, 1028, 1030, 1031,
+ /* 1680 */ 35, 576, 169, 169, 1308, 872, 238, 157, 1589, 576,
+ /* 1690 */ 86, 86, 365, 89, 568, 375, 4, 1103, 941, 1103,
+ /* 1700 */ 123, 576, 1040, 1389, 64, 64, 1188, 1434, 119, 119,
+ /* 1710 */ 571, 576, 82, 82, 563, 576, 120, 165, 451, 577,
+ /* 1720 */ 451, 413, 1362, 1028, 144, 144, 319, 567, 576, 1374,
+ /* 1730 */ 562, 498, 279, 451, 83, 83, 1439, 576, 166, 166,
+ /* 1740 */ 576, 1289, 554, 576, 1280, 565, 576, 12, 576, 1268,
+ /* 1750 */ 457, 146, 146, 1267, 576, 1028, 1028, 1030, 1031, 35,
+ /* 1760 */ 140, 140, 1269, 167, 167, 1609, 160, 160, 1359, 150,
+ /* 1770 */ 150, 149, 149, 311, 1040, 576, 312, 147, 147, 313,
+ /* 1780 */ 119, 119, 222, 235, 576, 1188, 396, 576, 120, 576,
+ /* 1790 */ 451, 577, 451, 1192, 453, 1028, 508, 291, 148, 148,
+ /* 1800 */ 1421, 1612, 395, 395, 394, 276, 392, 85, 85, 859,
+ /* 1810 */ 87, 87, 84, 84, 553, 576, 294, 576, 1426, 338,
+ /* 1820 */ 339, 1425, 237, 300, 326, 1416, 1409, 1028, 1028, 1030,
+ /* 1830 */ 1031, 35, 325, 344, 403, 483, 226, 1307, 52, 52,
+ /* 1840 */ 58, 58, 368, 1371, 1502, 566, 1501, 121, 568, 221,
+ /* 1850 */ 4, 208, 268, 209, 390, 1244, 1549, 1188, 1372, 1370,
+ /* 1860 */ 1369, 1547, 239, 184, 571, 233, 421, 1241, 95, 218,
+ /* 1870 */ 173, 1507, 193, 43, 91, 94, 178, 186, 467, 188,
+ /* 1880 */ 468, 1422, 13, 189, 190, 191, 501, 451, 245, 108,
+ /* 1890 */ 238, 401, 1428, 1427, 1430, 475, 404, 1496, 197, 565,
+ /* 1900 */ 14, 490, 249, 101, 1518, 496, 349, 280, 251, 201,
+ /* 1910 */ 353, 499, 252, 406, 1270, 253, 517, 1327, 1326, 435,
+ /* 1920 */ 1325, 1318, 103, 893, 1296, 413, 227, 407, 1040, 1626,
+ /* 1930 */ 319, 567, 1625, 1297, 119, 119, 439, 367, 1317, 1295,
+ /* 1940 */ 1624, 526, 120, 440, 451, 577, 451, 1594, 309, 1028,
+ /* 1950 */ 310, 373, 266, 267, 457, 1580, 1579, 443, 138, 1394,
+ /* 1960 */ 552, 1393, 11, 1483, 384, 115, 317, 1350, 109, 536,
+ /* 1970 */ 42, 579, 382, 214, 1349, 388, 1198, 389, 275, 277,
+ /* 1980 */ 278, 1028, 1028, 1030, 1031, 35, 580, 1265, 414, 1260,
+ /* 1990 */ 170, 415, 183, 1534, 1535, 1533, 171, 154, 307, 1532,
+ /* 2000 */ 846, 223, 224, 88, 452, 215, 172, 321, 234, 1102,
+ /* 2010 */ 152, 1188, 1100, 329, 185, 174, 1223, 925, 187, 241,
+ /* 2020 */ 337, 244, 1116, 192, 175, 176, 424, 426, 97, 194,
+ /* 2030 */ 98, 99, 100, 177, 1119, 1115, 246, 247, 161, 24,
+ /* 2040 */ 248, 348, 1238, 264, 1108, 250, 495, 199, 198, 15,
+ /* 2050 */ 861, 500, 369, 254, 504, 509, 512, 200, 102, 25,
+ /* 2060 */ 179, 361, 26, 364, 104, 891, 308, 162, 105, 904,
+ /* 2070 */ 520, 106, 1185, 1069, 1155, 17, 228, 27, 1154, 283,
+ /* 2080 */ 285, 263, 978, 202, 972, 123, 28, 1175, 29, 30,
+ /* 2090 */ 1179, 1171, 31, 1173, 1160, 41, 32, 206, 548, 33,
+ /* 2100 */ 110, 1178, 1083, 8, 112, 1070, 113, 1068, 1072, 34,
+ /* 2110 */ 1073, 560, 1125, 269, 1124, 270, 36, 18, 1194, 1033,
+ /* 2120 */ 873, 151, 122, 37, 393, 271, 272, 572, 181, 1193,
+ /* 2130 */ 1256, 1256, 1256, 935, 1256, 1256, 1256, 1256, 1256, 1256,
+ /* 2140 */ 1256, 1617,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 193, 193, 193, 274, 275, 276, 193, 274, 275, 276,
- /* 10 */ 193, 223, 219, 225, 206, 210, 211, 212, 193, 19,
- /* 20 */ 219, 233, 216, 216, 217, 216, 217, 193, 295, 216,
- /* 30 */ 217, 31, 193, 216, 217, 193, 228, 213, 230, 39,
- /* 40 */ 206, 216, 217, 43, 44, 45, 46, 47, 48, 49,
- /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 193, 19,
- /* 60 */ 185, 186, 187, 188, 189, 190, 253, 274, 275, 276,
- /* 70 */ 195, 193, 197, 193, 261, 274, 275, 276, 253, 204,
- /* 80 */ 238, 204, 81, 43, 44, 45, 46, 47, 48, 49,
- /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 274, 275,
- /* 100 */ 276, 262, 102, 103, 104, 105, 106, 107, 108, 109,
- /* 110 */ 110, 111, 112, 113, 239, 240, 239, 240, 210, 211,
- /* 120 */ 212, 314, 315, 314, 59, 316, 86, 252, 88, 252,
- /* 130 */ 19, 314, 315, 256, 257, 113, 25, 72, 296, 138,
- /* 140 */ 139, 266, 102, 103, 104, 105, 106, 107, 108, 109,
+ /* 0 */ 194, 276, 277, 278, 216, 194, 194, 217, 194, 194,
+ /* 10 */ 194, 194, 224, 194, 194, 276, 277, 278, 204, 19,
+ /* 20 */ 206, 202, 297, 217, 218, 205, 207, 217, 205, 217,
+ /* 30 */ 218, 31, 217, 218, 217, 218, 29, 217, 218, 39,
+ /* 40 */ 33, 217, 220, 43, 44, 45, 46, 47, 48, 49,
+ /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 312, 19,
+ /* 60 */ 240, 241, 316, 240, 241, 194, 46, 47, 48, 49,
+ /* 70 */ 22, 254, 65, 253, 254, 255, 253, 194, 255, 194,
+ /* 80 */ 263, 258, 259, 43, 44, 45, 46, 47, 48, 49,
+ /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 276, 277,
+ /* 100 */ 278, 285, 102, 103, 104, 105, 106, 107, 108, 109,
+ /* 110 */ 110, 111, 112, 113, 59, 186, 187, 188, 189, 190,
+ /* 120 */ 191, 310, 239, 317, 318, 196, 86, 198, 88, 317,
+ /* 130 */ 19, 319, 317, 318, 205, 264, 25, 211, 212, 213,
+ /* 140 */ 205, 121, 102, 103, 104, 105, 106, 107, 108, 109,
/* 150 */ 110, 111, 112, 113, 43, 44, 45, 46, 47, 48,
- /* 160 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 81,
- /* 170 */ 292, 59, 292, 298, 108, 109, 110, 111, 112, 113,
- /* 180 */ 69, 116, 117, 118, 72, 106, 107, 193, 111, 112,
- /* 190 */ 113, 54, 55, 56, 57, 58, 102, 103, 104, 105,
- /* 200 */ 106, 107, 108, 109, 110, 111, 112, 113, 120, 25,
- /* 210 */ 216, 217, 145, 102, 103, 104, 105, 106, 107, 108,
- /* 220 */ 109, 110, 111, 112, 113, 231, 138, 139, 116, 117,
- /* 230 */ 118, 164, 153, 19, 155, 54, 55, 56, 57, 102,
+ /* 160 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 240,
+ /* 170 */ 241, 116, 117, 118, 119, 240, 241, 122, 123, 124,
+ /* 180 */ 69, 298, 253, 194, 255, 106, 107, 132, 253, 141,
+ /* 190 */ 255, 54, 55, 56, 57, 58, 207, 268, 102, 103,
+ /* 200 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
+ /* 210 */ 214, 128, 129, 102, 103, 104, 105, 106, 107, 108,
+ /* 220 */ 109, 110, 111, 112, 113, 134, 25, 136, 137, 300,
+ /* 230 */ 165, 166, 153, 19, 155, 54, 55, 56, 57, 102,
/* 240 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
- /* 250 */ 113, 128, 129, 46, 47, 48, 49, 43, 44, 45,
+ /* 250 */ 113, 108, 109, 110, 111, 112, 113, 43, 44, 45,
/* 260 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- /* 270 */ 56, 57, 216, 193, 25, 59, 193, 19, 165, 166,
- /* 280 */ 193, 67, 24, 102, 103, 104, 105, 106, 107, 108,
- /* 290 */ 109, 110, 111, 112, 113, 73, 216, 217, 59, 216,
- /* 300 */ 217, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ /* 270 */ 56, 57, 276, 277, 278, 113, 194, 19, 22, 23,
+ /* 280 */ 194, 67, 24, 102, 103, 104, 105, 106, 107, 108,
+ /* 290 */ 109, 110, 111, 112, 113, 220, 250, 59, 252, 217,
+ /* 300 */ 218, 43, 44, 45, 46, 47, 48, 49, 50, 51,
/* 310 */ 52, 53, 54, 55, 56, 57, 102, 103, 104, 105,
- /* 320 */ 106, 107, 108, 109, 110, 111, 112, 113, 121, 145,
- /* 330 */ 59, 193, 116, 117, 118, 119, 273, 204, 122, 123,
- /* 340 */ 124, 19, 20, 134, 22, 136, 137, 19, 132, 127,
- /* 350 */ 128, 129, 24, 22, 23, 116, 117, 118, 36, 193,
+ /* 320 */ 106, 107, 108, 109, 110, 111, 112, 113, 106, 107,
+ /* 330 */ 108, 109, 110, 111, 112, 113, 254, 59, 205, 138,
+ /* 340 */ 139, 19, 20, 194, 22, 263, 22, 23, 231, 25,
+ /* 350 */ 72, 276, 277, 278, 116, 117, 118, 101, 36, 76,
/* 360 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- /* 370 */ 112, 113, 239, 240, 311, 312, 215, 106, 107, 241,
- /* 380 */ 19, 59, 216, 217, 223, 252, 115, 116, 117, 118,
- /* 390 */ 151, 120, 26, 71, 193, 308, 309, 193, 149, 128,
- /* 400 */ 313, 216, 269, 81, 43, 44, 45, 46, 47, 48,
- /* 410 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 253,
- /* 420 */ 216, 217, 100, 95, 153, 59, 155, 261, 106, 107,
- /* 430 */ 25, 193, 101, 193, 193, 231, 114, 25, 116, 117,
- /* 440 */ 118, 113, 304, 121, 193, 204, 59, 119, 120, 121,
- /* 450 */ 122, 123, 124, 125, 216, 217, 193, 216, 217, 131,
- /* 460 */ 138, 139, 230, 102, 103, 104, 105, 106, 107, 108,
+ /* 370 */ 112, 113, 89, 240, 241, 92, 73, 194, 194, 73,
+ /* 380 */ 19, 59, 188, 189, 190, 191, 253, 81, 255, 151,
+ /* 390 */ 196, 25, 198, 71, 116, 117, 118, 311, 312, 205,
+ /* 400 */ 217, 218, 316, 81, 43, 44, 45, 46, 47, 48,
+ /* 410 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 270,
+ /* 420 */ 22, 23, 100, 25, 59, 101, 138, 139, 106, 107,
+ /* 430 */ 127, 128, 129, 127, 240, 241, 114, 254, 116, 117,
+ /* 440 */ 118, 76, 76, 121, 138, 139, 263, 253, 264, 255,
+ /* 450 */ 205, 275, 87, 19, 89, 89, 194, 92, 92, 199,
+ /* 460 */ 138, 139, 268, 102, 103, 104, 105, 106, 107, 108,
/* 470 */ 109, 110, 111, 112, 113, 153, 154, 155, 156, 157,
- /* 480 */ 239, 240, 116, 117, 118, 76, 193, 23, 19, 25,
- /* 490 */ 22, 253, 23, 252, 253, 108, 87, 204, 89, 261,
- /* 500 */ 198, 92, 261, 116, 117, 118, 193, 306, 307, 216,
- /* 510 */ 217, 150, 43, 44, 45, 46, 47, 48, 49, 50,
- /* 520 */ 51, 52, 53, 54, 55, 56, 57, 59, 193, 216,
- /* 530 */ 217, 19, 239, 240, 283, 23, 106, 107, 108, 109,
- /* 540 */ 110, 111, 112, 113, 73, 252, 253, 142, 308, 309,
- /* 550 */ 138, 139, 81, 313, 145, 43, 44, 45, 46, 47,
+ /* 480 */ 81, 116, 117, 118, 129, 240, 241, 224, 19, 226,
+ /* 490 */ 314, 315, 23, 25, 300, 59, 22, 234, 253, 101,
+ /* 500 */ 255, 236, 237, 26, 194, 183, 194, 152, 72, 22,
+ /* 510 */ 145, 150, 43, 44, 45, 46, 47, 48, 49, 50,
+ /* 520 */ 51, 52, 53, 54, 55, 56, 57, 217, 218, 217,
+ /* 530 */ 218, 19, 189, 59, 191, 23, 59, 138, 139, 196,
+ /* 540 */ 135, 198, 232, 283, 232, 140, 59, 287, 205, 275,
+ /* 550 */ 116, 205, 116, 117, 118, 43, 44, 45, 46, 47,
/* 560 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- /* 570 */ 307, 102, 103, 104, 105, 106, 107, 108, 109, 110,
- /* 580 */ 111, 112, 113, 281, 116, 117, 118, 285, 23, 193,
- /* 590 */ 25, 119, 59, 193, 122, 123, 124, 59, 127, 203,
- /* 600 */ 59, 205, 19, 268, 132, 25, 23, 22, 193, 138,
- /* 610 */ 139, 249, 204, 251, 102, 103, 104, 105, 106, 107,
+ /* 570 */ 194, 102, 103, 104, 105, 106, 107, 108, 109, 110,
+ /* 580 */ 111, 112, 113, 240, 241, 194, 240, 241, 314, 315,
+ /* 590 */ 116, 117, 118, 116, 117, 118, 253, 194, 255, 253,
+ /* 600 */ 59, 255, 19, 116, 117, 118, 23, 22, 217, 218,
+ /* 610 */ 142, 268, 205, 275, 102, 103, 104, 105, 106, 107,
/* 620 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46,
/* 630 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- /* 640 */ 57, 19, 22, 23, 59, 23, 25, 239, 240, 116,
- /* 650 */ 117, 118, 193, 11, 116, 117, 118, 116, 117, 118,
- /* 660 */ 252, 269, 22, 193, 15, 43, 44, 45, 46, 47,
+ /* 640 */ 57, 19, 194, 300, 59, 23, 119, 240, 241, 122,
+ /* 650 */ 123, 124, 314, 315, 194, 236, 237, 194, 117, 132,
+ /* 660 */ 253, 81, 255, 205, 59, 43, 44, 45, 46, 47,
/* 670 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- /* 680 */ 273, 143, 193, 118, 143, 102, 103, 104, 105, 106,
- /* 690 */ 107, 108, 109, 110, 111, 112, 113, 76, 118, 59,
- /* 700 */ 241, 116, 117, 118, 304, 216, 217, 292, 143, 60,
- /* 710 */ 89, 241, 19, 92, 193, 193, 23, 22, 311, 312,
- /* 720 */ 231, 101, 22, 143, 102, 103, 104, 105, 106, 107,
+ /* 680 */ 217, 218, 194, 194, 194, 102, 103, 104, 105, 106,
+ /* 690 */ 107, 108, 109, 110, 111, 112, 113, 294, 240, 241,
+ /* 700 */ 120, 116, 117, 118, 59, 194, 217, 218, 211, 212,
+ /* 710 */ 213, 253, 19, 255, 194, 19, 23, 254, 138, 139,
+ /* 720 */ 24, 232, 117, 194, 102, 103, 104, 105, 106, 107,
/* 730 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46,
/* 740 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- /* 750 */ 57, 19, 193, 193, 59, 23, 116, 117, 118, 59,
- /* 760 */ 201, 21, 241, 304, 193, 206, 127, 128, 129, 193,
- /* 770 */ 128, 129, 235, 236, 304, 43, 44, 45, 46, 47,
+ /* 750 */ 57, 19, 264, 108, 76, 23, 127, 128, 129, 311,
+ /* 760 */ 312, 116, 117, 118, 316, 87, 306, 89, 308, 194,
+ /* 770 */ 92, 22, 59, 194, 22, 43, 44, 45, 46, 47,
/* 780 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- /* 790 */ 22, 193, 216, 217, 193, 102, 103, 104, 105, 106,
- /* 800 */ 107, 108, 109, 110, 111, 112, 113, 231, 193, 193,
- /* 810 */ 193, 116, 117, 118, 216, 217, 116, 117, 118, 226,
- /* 820 */ 80, 193, 19, 235, 236, 304, 23, 211, 212, 231,
- /* 830 */ 204, 216, 217, 205, 102, 103, 104, 105, 106, 107,
+ /* 790 */ 194, 95, 217, 218, 265, 102, 103, 104, 105, 106,
+ /* 800 */ 107, 108, 109, 110, 111, 112, 113, 232, 59, 113,
+ /* 810 */ 25, 59, 194, 217, 218, 119, 120, 121, 122, 123,
+ /* 820 */ 124, 125, 19, 145, 194, 194, 23, 131, 232, 116,
+ /* 830 */ 117, 118, 35, 194, 102, 103, 104, 105, 106, 107,
/* 840 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46,
/* 850 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- /* 860 */ 57, 19, 193, 123, 76, 239, 240, 193, 253, 239,
- /* 870 */ 240, 239, 240, 244, 106, 107, 193, 89, 252, 193,
- /* 880 */ 92, 59, 252, 254, 252, 43, 44, 45, 46, 47,
+ /* 860 */ 57, 19, 194, 66, 194, 116, 117, 118, 116, 117,
+ /* 870 */ 118, 74, 242, 294, 194, 194, 206, 23, 194, 25,
+ /* 880 */ 194, 111, 112, 113, 25, 43, 44, 45, 46, 47,
/* 890 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- /* 900 */ 284, 161, 216, 217, 193, 102, 103, 104, 105, 106,
- /* 910 */ 107, 108, 109, 110, 111, 112, 113, 231, 193, 244,
- /* 920 */ 187, 188, 189, 190, 7, 8, 9, 309, 195, 254,
- /* 930 */ 197, 313, 19, 127, 128, 129, 262, 204, 22, 117,
- /* 940 */ 24, 216, 217, 273, 102, 103, 104, 105, 106, 107,
+ /* 900 */ 24, 194, 194, 217, 218, 102, 103, 104, 105, 106,
+ /* 910 */ 107, 108, 109, 110, 111, 112, 113, 241, 232, 194,
+ /* 920 */ 212, 213, 242, 242, 217, 218, 242, 130, 11, 253,
+ /* 930 */ 194, 255, 19, 265, 149, 59, 306, 194, 308, 232,
+ /* 940 */ 309, 310, 217, 218, 102, 103, 104, 105, 106, 107,
/* 950 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46,
/* 960 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- /* 970 */ 57, 193, 239, 240, 193, 59, 19, 188, 253, 190,
- /* 980 */ 193, 311, 312, 16, 195, 252, 197, 193, 19, 301,
- /* 990 */ 302, 135, 193, 204, 216, 217, 140, 216, 217, 266,
- /* 1000 */ 204, 159, 45, 46, 47, 48, 49, 50, 51, 52,
+ /* 970 */ 57, 194, 194, 59, 194, 239, 19, 194, 25, 254,
+ /* 980 */ 303, 304, 23, 194, 25, 126, 306, 306, 308, 308,
+ /* 990 */ 306, 271, 308, 117, 286, 217, 218, 217, 218, 194,
+ /* 1000 */ 194, 159, 45, 46, 47, 48, 49, 50, 51, 52,
/* 1010 */ 53, 54, 55, 56, 57, 102, 103, 104, 105, 106,
- /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 12, 239, 240,
- /* 1030 */ 193, 298, 238, 117, 253, 239, 240, 238, 259, 260,
- /* 1040 */ 193, 252, 27, 193, 77, 193, 79, 204, 252, 262,
- /* 1050 */ 193, 299, 300, 193, 100, 266, 278, 42, 204, 102,
+ /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 59, 239, 194,
+ /* 1030 */ 116, 117, 118, 260, 254, 194, 240, 241, 194, 233,
+ /* 1040 */ 205, 240, 241, 205, 239, 128, 129, 270, 265, 253,
+ /* 1050 */ 194, 255, 217, 218, 253, 194, 255, 143, 280, 102,
/* 1060 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
- /* 1070 */ 113, 117, 159, 216, 217, 121, 216, 217, 63, 193,
- /* 1080 */ 193, 193, 239, 240, 115, 116, 193, 298, 73, 240,
- /* 1090 */ 238, 231, 19, 239, 240, 252, 22, 24, 211, 212,
- /* 1100 */ 263, 252, 216, 217, 216, 217, 252, 153, 154, 155,
- /* 1110 */ 253, 193, 19, 144, 213, 268, 43, 44, 45, 46,
+ /* 1070 */ 113, 118, 159, 217, 218, 240, 241, 118, 240, 241,
+ /* 1080 */ 194, 194, 194, 239, 116, 117, 118, 22, 253, 254,
+ /* 1090 */ 255, 253, 19, 255, 233, 194, 143, 24, 263, 212,
+ /* 1100 */ 213, 194, 143, 217, 218, 217, 218, 261, 262, 271,
+ /* 1110 */ 254, 143, 19, 7, 8, 9, 43, 44, 45, 46,
/* 1120 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- /* 1130 */ 57, 193, 19, 59, 216, 217, 43, 44, 45, 46,
+ /* 1130 */ 57, 16, 19, 22, 23, 294, 43, 44, 45, 46,
/* 1140 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- /* 1150 */ 57, 193, 19, 24, 216, 217, 43, 44, 45, 46,
+ /* 1150 */ 57, 312, 194, 214, 21, 316, 43, 44, 45, 46,
/* 1160 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- /* 1170 */ 57, 284, 193, 208, 209, 102, 103, 104, 105, 106,
- /* 1180 */ 107, 108, 109, 110, 111, 112, 113, 286, 59, 193,
- /* 1190 */ 232, 117, 291, 193, 193, 102, 103, 104, 105, 106,
- /* 1200 */ 107, 108, 109, 110, 111, 112, 113, 193, 204, 22,
- /* 1210 */ 23, 193, 25, 66, 193, 102, 103, 104, 105, 106,
- /* 1220 */ 107, 108, 109, 110, 111, 112, 113, 193, 193, 193,
- /* 1230 */ 216, 217, 85, 193, 238, 19, 16, 216, 217, 238,
- /* 1240 */ 193, 94, 193, 239, 240, 231, 117, 268, 35, 116,
- /* 1250 */ 216, 217, 216, 217, 22, 23, 252, 25, 208, 209,
+ /* 1170 */ 57, 106, 107, 286, 194, 102, 103, 104, 105, 106,
+ /* 1180 */ 107, 108, 109, 110, 111, 112, 113, 207, 158, 59,
+ /* 1190 */ 160, 22, 77, 24, 79, 102, 103, 104, 105, 106,
+ /* 1200 */ 107, 108, 109, 110, 111, 112, 113, 194, 194, 229,
+ /* 1210 */ 194, 231, 101, 80, 22, 102, 103, 104, 105, 106,
+ /* 1220 */ 107, 108, 109, 110, 111, 112, 113, 288, 59, 12,
+ /* 1230 */ 217, 218, 293, 217, 218, 19, 106, 107, 59, 19,
+ /* 1240 */ 16, 127, 128, 129, 27, 115, 116, 117, 118, 194,
+ /* 1250 */ 120, 59, 22, 194, 24, 194, 123, 100, 128, 42,
/* 1260 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- /* 1270 */ 54, 55, 56, 57, 193, 193, 19, 5, 59, 66,
- /* 1280 */ 193, 263, 10, 11, 12, 13, 14, 74, 101, 17,
- /* 1290 */ 193, 46, 193, 146, 193, 76, 213, 77, 263, 79,
- /* 1300 */ 12, 260, 30, 46, 32, 264, 87, 193, 89, 29,
- /* 1310 */ 263, 92, 40, 33, 232, 27, 193, 108, 102, 103,
+ /* 1270 */ 54, 55, 56, 57, 117, 194, 217, 218, 121, 100,
+ /* 1280 */ 63, 194, 245, 153, 194, 155, 117, 19, 115, 194,
+ /* 1290 */ 73, 214, 194, 256, 161, 116, 117, 194, 217, 218,
+ /* 1300 */ 121, 77, 194, 79, 217, 218, 194, 217, 218, 117,
+ /* 1310 */ 153, 154, 155, 254, 46, 217, 218, 144, 102, 103,
/* 1320 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
- /* 1330 */ 42, 138, 139, 101, 193, 116, 117, 118, 19, 20,
- /* 1340 */ 255, 22, 70, 130, 135, 65, 256, 257, 193, 140,
- /* 1350 */ 78, 63, 193, 81, 193, 36, 193, 216, 217, 193,
- /* 1360 */ 115, 193, 263, 193, 145, 268, 59, 48, 193, 193,
- /* 1370 */ 98, 193, 115, 193, 291, 216, 217, 193, 59, 216,
- /* 1380 */ 217, 161, 216, 217, 216, 217, 216, 217, 131, 193,
- /* 1390 */ 71, 193, 216, 217, 216, 217, 216, 217, 193, 260,
- /* 1400 */ 216, 217, 19, 264, 85, 133, 244, 100, 193, 90,
- /* 1410 */ 138, 139, 216, 217, 216, 217, 254, 244, 193, 100,
- /* 1420 */ 193, 216, 217, 116, 117, 106, 107, 254, 121, 193,
- /* 1430 */ 115, 216, 217, 114, 162, 116, 117, 118, 115, 244,
- /* 1440 */ 121, 216, 217, 216, 217, 193, 309, 193, 31, 254,
- /* 1450 */ 313, 309, 216, 217, 309, 313, 39, 193, 313, 309,
- /* 1460 */ 153, 154, 155, 313, 193, 150, 25, 144, 216, 217,
- /* 1470 */ 216, 217, 153, 154, 155, 156, 157, 0, 1, 2,
- /* 1480 */ 216, 217, 5, 149, 150, 22, 193, 10, 11, 12,
- /* 1490 */ 13, 14, 193, 158, 17, 160, 193, 19, 20, 116,
- /* 1500 */ 22, 25, 193, 24, 22, 193, 24, 30, 226, 32,
- /* 1510 */ 19, 20, 226, 22, 36, 193, 53, 40, 193, 216,
- /* 1520 */ 217, 193, 23, 193, 25, 216, 217, 36, 216, 217,
- /* 1530 */ 193, 99, 193, 193, 22, 193, 193, 59, 216, 217,
- /* 1540 */ 193, 216, 217, 193, 216, 217, 193, 70, 129, 71,
- /* 1550 */ 59, 129, 193, 216, 217, 78, 216, 217, 81, 216,
- /* 1560 */ 217, 193, 71, 85, 193, 133, 193, 126, 90, 216,
- /* 1570 */ 217, 152, 258, 61, 152, 98, 85, 193, 100, 193,
- /* 1580 */ 23, 90, 25, 121, 106, 107, 23, 216, 217, 216,
- /* 1590 */ 217, 100, 114, 131, 116, 117, 118, 106, 107, 121,
- /* 1600 */ 216, 217, 216, 217, 193, 114, 193, 116, 117, 118,
- /* 1610 */ 133, 22, 121, 193, 59, 138, 139, 193, 142, 193,
- /* 1620 */ 141, 23, 23, 25, 25, 120, 121, 216, 217, 216,
- /* 1630 */ 217, 153, 154, 155, 156, 157, 216, 217, 19, 162,
- /* 1640 */ 216, 217, 216, 217, 153, 154, 155, 156, 157, 1,
- /* 1650 */ 2, 193, 59, 5, 19, 20, 318, 22, 10, 11,
- /* 1660 */ 12, 13, 14, 193, 59, 17, 193, 23, 23, 25,
- /* 1670 */ 25, 36, 117, 193, 216, 217, 193, 23, 30, 25,
- /* 1680 */ 32, 19, 20, 23, 22, 25, 216, 217, 40, 216,
- /* 1690 */ 217, 7, 8, 23, 59, 25, 83, 84, 36, 23,
- /* 1700 */ 193, 25, 23, 23, 25, 25, 71, 153, 145, 155,
- /* 1710 */ 117, 153, 23, 155, 25, 23, 97, 25, 70, 193,
- /* 1720 */ 193, 59, 117, 236, 193, 193, 78, 193, 193, 81,
- /* 1730 */ 141, 193, 193, 71, 193, 100, 288, 287, 242, 255,
- /* 1740 */ 255, 106, 107, 108, 255, 255, 98, 243, 297, 114,
- /* 1750 */ 214, 116, 117, 118, 245, 191, 121, 271, 293, 267,
- /* 1760 */ 267, 246, 100, 246, 245, 271, 271, 293, 106, 107,
- /* 1770 */ 220, 271, 229, 225, 249, 219, 114, 259, 116, 117,
- /* 1780 */ 118, 133, 259, 121, 219, 219, 138, 139, 153, 154,
- /* 1790 */ 155, 156, 157, 280, 249, 243, 19, 20, 245, 22,
- /* 1800 */ 196, 259, 140, 259, 60, 297, 141, 297, 200, 200,
- /* 1810 */ 162, 38, 200, 36, 294, 153, 154, 155, 156, 157,
- /* 1820 */ 151, 150, 294, 283, 22, 43, 234, 18, 237, 200,
- /* 1830 */ 270, 272, 237, 237, 237, 18, 59, 199, 270, 149,
- /* 1840 */ 246, 272, 272, 200, 234, 234, 246, 246, 71, 246,
- /* 1850 */ 199, 158, 290, 62, 22, 200, 19, 20, 199, 22,
- /* 1860 */ 289, 221, 221, 200, 200, 199, 199, 115, 218, 64,
- /* 1870 */ 218, 218, 22, 36, 227, 126, 227, 100, 165, 221,
- /* 1880 */ 224, 224, 24, 106, 107, 312, 218, 305, 113, 282,
- /* 1890 */ 91, 114, 220, 116, 117, 118, 59, 282, 121, 218,
- /* 1900 */ 218, 218, 200, 317, 317, 82, 221, 265, 71, 148,
- /* 1910 */ 145, 265, 22, 277, 200, 158, 279, 140, 147, 25,
- /* 1920 */ 146, 202, 248, 250, 249, 247, 13, 250, 194, 194,
- /* 1930 */ 153, 154, 155, 156, 157, 6, 303, 100, 192, 192,
- /* 1940 */ 246, 213, 192, 106, 107, 207, 213, 207, 222, 213,
- /* 1950 */ 213, 114, 222, 116, 117, 118, 214, 214, 121, 4,
- /* 1960 */ 207, 213, 3, 22, 303, 15, 163, 16, 23, 23,
- /* 1970 */ 139, 151, 130, 25, 20, 142, 24, 16, 144, 1,
- /* 1980 */ 142, 130, 130, 61, 37, 53, 300, 151, 53, 53,
- /* 1990 */ 153, 154, 155, 156, 157, 53, 130, 116, 34, 1,
- /* 2000 */ 141, 5, 22, 115, 161, 68, 25, 68, 75, 41,
- /* 2010 */ 141, 115, 24, 20, 19, 131, 125, 23, 28, 22,
- /* 2020 */ 67, 22, 22, 22, 67, 59, 24, 96, 22, 67,
- /* 2030 */ 23, 149, 22, 25, 23, 23, 23, 22, 34, 141,
- /* 2040 */ 37, 97, 23, 23, 116, 22, 143, 25, 34, 75,
- /* 2050 */ 34, 34, 34, 88, 75, 34, 86, 23, 22, 34,
- /* 2060 */ 93, 24, 34, 25, 25, 142, 142, 23, 44, 23,
- /* 2070 */ 23, 23, 23, 11, 23, 25, 22, 22, 22, 141,
- /* 2080 */ 23, 23, 22, 22, 25, 15, 1, 23, 25, 1,
- /* 2090 */ 141, 135, 319, 319, 319, 319, 319, 319, 319, 141,
- /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2150 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2160 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2170 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2180 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2190 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2200 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2210 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2220 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2250 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2260 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2270 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
- /* 2280 */ 319, 319, 319, 319, 319,
+ /* 1330 */ 232, 270, 153, 154, 155, 115, 116, 66, 19, 20,
+ /* 1340 */ 183, 22, 12, 312, 254, 194, 262, 316, 209, 210,
+ /* 1350 */ 266, 239, 194, 194, 108, 36, 85, 27, 19, 20,
+ /* 1360 */ 265, 22, 183, 245, 144, 94, 25, 48, 217, 218,
+ /* 1370 */ 293, 194, 42, 270, 256, 36, 217, 218, 59, 194,
+ /* 1380 */ 25, 135, 194, 115, 194, 161, 140, 194, 194, 15,
+ /* 1390 */ 71, 194, 312, 63, 217, 218, 316, 194, 59, 131,
+ /* 1400 */ 301, 302, 217, 218, 85, 217, 218, 217, 218, 90,
+ /* 1410 */ 71, 217, 218, 19, 217, 218, 245, 146, 262, 100,
+ /* 1420 */ 217, 218, 266, 265, 85, 106, 107, 256, 312, 90,
+ /* 1430 */ 209, 210, 316, 114, 60, 116, 117, 118, 194, 100,
+ /* 1440 */ 121, 194, 194, 145, 115, 106, 107, 19, 46, 19,
+ /* 1450 */ 20, 24, 22, 114, 194, 116, 117, 118, 194, 245,
+ /* 1460 */ 121, 194, 164, 194, 217, 218, 36, 194, 258, 259,
+ /* 1470 */ 256, 194, 153, 154, 155, 156, 157, 217, 218, 150,
+ /* 1480 */ 31, 217, 218, 142, 217, 218, 217, 218, 39, 59,
+ /* 1490 */ 217, 218, 153, 154, 155, 156, 157, 149, 150, 5,
+ /* 1500 */ 145, 71, 183, 245, 10, 11, 12, 13, 14, 194,
+ /* 1510 */ 116, 17, 129, 227, 256, 85, 194, 115, 194, 23,
+ /* 1520 */ 90, 25, 183, 99, 30, 97, 32, 22, 22, 194,
+ /* 1530 */ 100, 194, 217, 218, 40, 152, 106, 107, 23, 217,
+ /* 1540 */ 218, 194, 19, 20, 114, 22, 116, 117, 118, 257,
+ /* 1550 */ 194, 121, 217, 218, 217, 218, 194, 133, 53, 36,
+ /* 1560 */ 23, 23, 25, 25, 70, 120, 121, 61, 141, 7,
+ /* 1570 */ 8, 121, 78, 217, 218, 81, 23, 227, 25, 217,
+ /* 1580 */ 218, 131, 59, 153, 154, 155, 156, 157, 0, 1,
+ /* 1590 */ 2, 59, 98, 5, 71, 23, 227, 25, 10, 11,
+ /* 1600 */ 12, 13, 14, 83, 84, 17, 23, 23, 25, 25,
+ /* 1610 */ 59, 194, 194, 183, 23, 23, 25, 25, 30, 194,
+ /* 1620 */ 32, 19, 20, 100, 22, 194, 194, 133, 40, 106,
+ /* 1630 */ 107, 108, 138, 139, 194, 217, 218, 114, 36, 116,
+ /* 1640 */ 117, 118, 217, 218, 121, 194, 194, 194, 23, 117,
+ /* 1650 */ 25, 194, 23, 23, 25, 25, 162, 194, 70, 194,
+ /* 1660 */ 145, 59, 23, 153, 25, 155, 78, 194, 117, 81,
+ /* 1670 */ 217, 218, 194, 71, 217, 218, 153, 154, 155, 156,
+ /* 1680 */ 157, 194, 217, 218, 194, 23, 98, 25, 321, 194,
+ /* 1690 */ 217, 218, 194, 19, 20, 194, 22, 153, 23, 155,
+ /* 1700 */ 25, 194, 100, 194, 217, 218, 183, 194, 106, 107,
+ /* 1710 */ 36, 194, 217, 218, 237, 194, 114, 243, 116, 117,
+ /* 1720 */ 118, 133, 194, 121, 217, 218, 138, 139, 194, 194,
+ /* 1730 */ 194, 290, 289, 59, 217, 218, 194, 194, 217, 218,
+ /* 1740 */ 194, 194, 140, 194, 194, 71, 194, 244, 194, 194,
+ /* 1750 */ 162, 217, 218, 194, 194, 153, 154, 155, 156, 157,
+ /* 1760 */ 217, 218, 194, 217, 218, 194, 217, 218, 257, 217,
+ /* 1770 */ 218, 217, 218, 257, 100, 194, 257, 217, 218, 257,
+ /* 1780 */ 106, 107, 215, 299, 194, 183, 192, 194, 114, 194,
+ /* 1790 */ 116, 117, 118, 1, 2, 121, 221, 5, 217, 218,
+ /* 1800 */ 273, 197, 10, 11, 12, 13, 14, 217, 218, 17,
+ /* 1810 */ 217, 218, 217, 218, 140, 194, 246, 194, 273, 295,
+ /* 1820 */ 247, 273, 30, 247, 32, 269, 269, 153, 154, 155,
+ /* 1830 */ 156, 157, 40, 246, 273, 295, 230, 226, 217, 218,
+ /* 1840 */ 217, 218, 220, 261, 220, 282, 220, 19, 20, 244,
+ /* 1850 */ 22, 250, 141, 250, 246, 60, 201, 183, 261, 261,
+ /* 1860 */ 261, 201, 70, 299, 36, 299, 201, 38, 151, 150,
+ /* 1870 */ 78, 285, 22, 81, 296, 296, 43, 235, 18, 238,
+ /* 1880 */ 201, 274, 272, 238, 238, 238, 18, 59, 200, 149,
+ /* 1890 */ 98, 247, 274, 274, 235, 247, 247, 247, 235, 71,
+ /* 1900 */ 272, 201, 200, 158, 292, 62, 291, 201, 200, 22,
+ /* 1910 */ 201, 222, 200, 222, 201, 200, 115, 219, 219, 64,
+ /* 1920 */ 219, 228, 22, 126, 221, 133, 165, 222, 100, 225,
+ /* 1930 */ 138, 139, 225, 219, 106, 107, 24, 219, 228, 219,
+ /* 1940 */ 219, 307, 114, 113, 116, 117, 118, 315, 284, 121,
+ /* 1950 */ 284, 222, 201, 91, 162, 320, 320, 82, 148, 267,
+ /* 1960 */ 145, 267, 22, 279, 201, 158, 281, 251, 147, 146,
+ /* 1970 */ 25, 203, 250, 249, 251, 248, 13, 247, 195, 195,
+ /* 1980 */ 6, 153, 154, 155, 156, 157, 193, 193, 305, 193,
+ /* 1990 */ 208, 305, 302, 214, 214, 214, 208, 223, 223, 214,
+ /* 2000 */ 4, 215, 215, 214, 3, 22, 208, 163, 15, 23,
+ /* 2010 */ 16, 183, 23, 139, 151, 130, 25, 20, 142, 24,
+ /* 2020 */ 16, 144, 1, 142, 130, 130, 61, 37, 53, 151,
+ /* 2030 */ 53, 53, 53, 130, 116, 1, 34, 141, 5, 22,
+ /* 2040 */ 115, 161, 75, 25, 68, 141, 41, 115, 68, 24,
+ /* 2050 */ 20, 19, 131, 125, 67, 67, 96, 22, 22, 22,
+ /* 2060 */ 37, 23, 22, 24, 22, 59, 67, 23, 149, 28,
+ /* 2070 */ 22, 25, 23, 23, 23, 22, 141, 34, 97, 23,
+ /* 2080 */ 23, 34, 116, 22, 143, 25, 34, 75, 34, 34,
+ /* 2090 */ 75, 88, 34, 86, 23, 22, 34, 25, 24, 34,
+ /* 2100 */ 25, 93, 23, 44, 142, 23, 142, 23, 23, 22,
+ /* 2110 */ 11, 25, 23, 25, 23, 22, 22, 22, 1, 23,
+ /* 2120 */ 23, 23, 22, 22, 15, 141, 141, 25, 25, 1,
+ /* 2130 */ 322, 322, 322, 135, 322, 322, 322, 322, 322, 322,
+ /* 2140 */ 322, 141, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2150 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2160 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2170 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2180 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2190 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2200 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2210 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2220 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2230 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2240 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2250 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2260 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2270 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2280 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2290 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2300 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2310 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
+ /* 2320 */ 322, 322, 322, 322, 322, 322, 322, 322,
};
-#define YY_SHIFT_COUNT (578)
+#define YY_SHIFT_COUNT (582)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (2088)
+#define YY_SHIFT_MAX (2128)
static const unsigned short int yy_shift_ofst[] = {
- /* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1837,
- /* 10 */ 1837, 1837, 471, 0, 0, 214, 1093, 1837, 1837, 1837,
- /* 20 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
- /* 30 */ 1837, 271, 271, 1219, 1219, 216, 88, 1, 1, 1,
- /* 40 */ 1, 1, 40, 111, 258, 361, 469, 512, 583, 622,
- /* 50 */ 693, 732, 803, 842, 913, 1073, 1093, 1093, 1093, 1093,
- /* 60 */ 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093,
- /* 70 */ 1093, 1093, 1093, 1093, 1113, 1093, 1216, 957, 957, 1635,
- /* 80 */ 1662, 1777, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
- /* 90 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
- /* 100 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
- /* 110 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
- /* 120 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
- /* 130 */ 1837, 137, 181, 181, 181, 181, 181, 181, 181, 94,
- /* 140 */ 430, 66, 65, 112, 366, 533, 533, 740, 1257, 533,
- /* 150 */ 533, 79, 79, 533, 412, 412, 412, 77, 412, 123,
- /* 160 */ 113, 113, 113, 22, 22, 2100, 2100, 328, 328, 328,
- /* 170 */ 239, 468, 468, 468, 468, 1015, 1015, 409, 366, 1187,
- /* 180 */ 1232, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- /* 190 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- /* 200 */ 533, 969, 621, 621, 533, 642, 788, 788, 1133, 1133,
- /* 210 */ 822, 822, 67, 1193, 2100, 2100, 2100, 2100, 2100, 2100,
- /* 220 */ 2100, 1307, 954, 954, 585, 472, 640, 387, 695, 538,
- /* 230 */ 541, 700, 533, 533, 533, 533, 533, 533, 533, 533,
- /* 240 */ 533, 533, 222, 533, 533, 533, 533, 533, 533, 533,
- /* 250 */ 533, 533, 533, 533, 533, 1213, 1213, 1213, 533, 533,
- /* 260 */ 533, 565, 533, 533, 533, 916, 1147, 533, 533, 1288,
- /* 270 */ 533, 533, 533, 533, 533, 533, 533, 533, 639, 1280,
- /* 280 */ 209, 1129, 1129, 1129, 1129, 580, 209, 209, 1209, 768,
- /* 290 */ 917, 649, 1315, 1334, 405, 1334, 1383, 249, 1315, 1315,
- /* 300 */ 249, 1315, 405, 1383, 1441, 464, 1245, 1417, 1417, 1417,
- /* 310 */ 1323, 1323, 1323, 1323, 184, 184, 1335, 1476, 856, 1482,
- /* 320 */ 1744, 1744, 1665, 1665, 1773, 1773, 1665, 1669, 1671, 1802,
- /* 330 */ 1782, 1809, 1809, 1809, 1809, 1665, 1817, 1690, 1671, 1671,
- /* 340 */ 1690, 1802, 1782, 1690, 1782, 1690, 1665, 1817, 1693, 1791,
- /* 350 */ 1665, 1817, 1832, 1665, 1817, 1665, 1817, 1832, 1752, 1752,
- /* 360 */ 1752, 1805, 1850, 1850, 1832, 1752, 1749, 1752, 1805, 1752,
- /* 370 */ 1752, 1713, 1858, 1775, 1775, 1832, 1665, 1799, 1799, 1823,
- /* 380 */ 1823, 1761, 1765, 1890, 1665, 1757, 1761, 1771, 1774, 1690,
- /* 390 */ 1894, 1913, 1913, 1929, 1929, 1929, 2100, 2100, 2100, 2100,
- /* 400 */ 2100, 2100, 2100, 2100, 2100, 2100, 2100, 2100, 2100, 2100,
- /* 410 */ 2100, 207, 1220, 331, 620, 967, 806, 1074, 1499, 1432,
- /* 420 */ 1463, 1479, 1419, 1422, 1557, 1512, 1598, 1599, 1644, 1645,
- /* 430 */ 1654, 1660, 1555, 1505, 1684, 1462, 1670, 1563, 1619, 1593,
- /* 440 */ 1676, 1679, 1613, 1680, 1554, 1558, 1689, 1692, 1605, 1589,
- /* 450 */ 1955, 1959, 1941, 1803, 1950, 1951, 1945, 1946, 1831, 1820,
- /* 460 */ 1842, 1948, 1948, 1952, 1833, 1954, 1834, 1961, 1978, 1838,
- /* 470 */ 1851, 1948, 1852, 1922, 1947, 1948, 1836, 1932, 1935, 1936,
- /* 480 */ 1942, 1866, 1881, 1964, 1859, 1998, 1996, 1980, 1888, 1843,
- /* 490 */ 1937, 1981, 1939, 1933, 1968, 1869, 1896, 1988, 1993, 1995,
- /* 500 */ 1884, 1891, 1997, 1953, 1999, 2000, 1994, 2001, 1957, 1966,
- /* 510 */ 2002, 1931, 1990, 2006, 1962, 2003, 2007, 2004, 1882, 2010,
- /* 520 */ 2011, 2012, 2008, 2013, 2015, 1944, 1898, 2019, 2020, 1928,
- /* 530 */ 2014, 2023, 1903, 2022, 2016, 2017, 2018, 2021, 1965, 1974,
- /* 540 */ 1970, 2024, 1979, 1967, 2025, 2034, 2036, 2037, 2038, 2039,
- /* 550 */ 2028, 1923, 1924, 2044, 2022, 2046, 2047, 2048, 2049, 2050,
- /* 560 */ 2051, 2054, 2062, 2055, 2056, 2057, 2058, 2060, 2061, 2059,
- /* 570 */ 1956, 1938, 1949, 1958, 2063, 2064, 2070, 2085, 2088,
+ /* 0 */ 1792, 1588, 1494, 322, 322, 399, 306, 1319, 1339, 1430,
+ /* 10 */ 1828, 1828, 1828, 580, 399, 399, 399, 399, 399, 0,
+ /* 20 */ 0, 214, 1093, 1828, 1828, 1828, 1828, 1828, 1828, 1828,
+ /* 30 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1130, 1130,
+ /* 40 */ 365, 365, 55, 278, 436, 713, 713, 201, 201, 201,
+ /* 50 */ 201, 40, 111, 258, 361, 469, 512, 583, 622, 693,
+ /* 60 */ 732, 803, 842, 913, 1073, 1093, 1093, 1093, 1093, 1093,
+ /* 70 */ 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093,
+ /* 80 */ 1093, 1093, 1093, 1113, 1093, 1216, 957, 957, 1523, 1602,
+ /* 90 */ 1674, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828,
+ /* 100 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828,
+ /* 110 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828,
+ /* 120 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828,
+ /* 130 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828,
+ /* 140 */ 137, 181, 181, 181, 181, 181, 181, 181, 96, 222,
+ /* 150 */ 143, 477, 713, 1133, 1268, 713, 713, 79, 79, 713,
+ /* 160 */ 770, 83, 65, 65, 65, 288, 162, 162, 2142, 2142,
+ /* 170 */ 696, 696, 696, 238, 474, 474, 474, 474, 1217, 1217,
+ /* 180 */ 678, 477, 324, 398, 713, 713, 713, 713, 713, 713,
+ /* 190 */ 713, 713, 713, 713, 713, 713, 713, 713, 713, 713,
+ /* 200 */ 713, 713, 713, 1220, 366, 366, 713, 917, 283, 283,
+ /* 210 */ 434, 434, 605, 605, 1298, 2142, 2142, 2142, 2142, 2142,
+ /* 220 */ 2142, 2142, 1179, 1157, 1157, 487, 527, 585, 645, 749,
+ /* 230 */ 914, 968, 752, 713, 713, 713, 713, 713, 713, 713,
+ /* 240 */ 713, 713, 713, 303, 713, 713, 713, 713, 713, 713,
+ /* 250 */ 713, 713, 713, 713, 713, 713, 797, 797, 797, 713,
+ /* 260 */ 713, 713, 959, 713, 713, 713, 1169, 1271, 713, 713,
+ /* 270 */ 1330, 713, 713, 713, 713, 713, 713, 713, 713, 629,
+ /* 280 */ 7, 91, 876, 876, 876, 876, 953, 91, 91, 1246,
+ /* 290 */ 1065, 1106, 1374, 1329, 1348, 468, 1348, 1394, 785, 1329,
+ /* 300 */ 1329, 785, 1329, 468, 1394, 859, 854, 1402, 1449, 1449,
+ /* 310 */ 1449, 1173, 1173, 1173, 1173, 1355, 1355, 1030, 1341, 405,
+ /* 320 */ 1230, 1795, 1795, 1711, 1711, 1829, 1829, 1711, 1717, 1719,
+ /* 330 */ 1850, 1833, 1860, 1860, 1860, 1860, 1711, 1868, 1740, 1719,
+ /* 340 */ 1719, 1740, 1850, 1833, 1740, 1833, 1740, 1711, 1868, 1745,
+ /* 350 */ 1843, 1711, 1868, 1887, 1711, 1868, 1711, 1868, 1887, 1801,
+ /* 360 */ 1801, 1801, 1855, 1900, 1900, 1887, 1801, 1797, 1801, 1855,
+ /* 370 */ 1801, 1801, 1761, 1912, 1830, 1830, 1887, 1711, 1862, 1862,
+ /* 380 */ 1875, 1875, 1810, 1815, 1940, 1711, 1807, 1810, 1821, 1823,
+ /* 390 */ 1740, 1945, 1963, 1963, 1974, 1974, 1974, 2142, 2142, 2142,
+ /* 400 */ 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
+ /* 410 */ 2142, 2142, 20, 1224, 256, 1111, 1115, 1114, 1192, 1496,
+ /* 420 */ 1424, 1505, 1427, 355, 1383, 1537, 1506, 1538, 1553, 1583,
+ /* 430 */ 1584, 1591, 1625, 541, 1445, 1562, 1450, 1572, 1515, 1428,
+ /* 440 */ 1532, 1592, 1629, 1520, 1630, 1639, 1510, 1544, 1662, 1675,
+ /* 450 */ 1551, 48, 1996, 2001, 1983, 1844, 1993, 1994, 1986, 1989,
+ /* 460 */ 1874, 1863, 1885, 1991, 1991, 1995, 1876, 1997, 1877, 2004,
+ /* 470 */ 2021, 1881, 1894, 1991, 1895, 1965, 1990, 1991, 1878, 1975,
+ /* 480 */ 1977, 1978, 1979, 1903, 1918, 2002, 1896, 2034, 2033, 2017,
+ /* 490 */ 1925, 1880, 1976, 2018, 1980, 1967, 2005, 1904, 1932, 2025,
+ /* 500 */ 2030, 2032, 1921, 1928, 2035, 1987, 2036, 2037, 2038, 2040,
+ /* 510 */ 1988, 2006, 2039, 1960, 2041, 2042, 1999, 2023, 2044, 2043,
+ /* 520 */ 1919, 2048, 2049, 2050, 2046, 2051, 2053, 1981, 1935, 2056,
+ /* 530 */ 2057, 1966, 2047, 2061, 1941, 2060, 2052, 2054, 2055, 2058,
+ /* 540 */ 2003, 2012, 2007, 2059, 2015, 2008, 2062, 2071, 2073, 2074,
+ /* 550 */ 2072, 2075, 2065, 1962, 1964, 2079, 2060, 2082, 2084, 2085,
+ /* 560 */ 2087, 2086, 2089, 2088, 2091, 2093, 2099, 2094, 2095, 2096,
+ /* 570 */ 2097, 2100, 2101, 2102, 1998, 1984, 1985, 2000, 2103, 2098,
+ /* 580 */ 2109, 2117, 2128,
};
-#define YY_REDUCE_COUNT (410)
-#define YY_REDUCE_MIN (-271)
-#define YY_REDUCE_MAX (1753)
+#define YY_REDUCE_COUNT (411)
+#define YY_REDUCE_MIN (-275)
+#define YY_REDUCE_MAX (1798)
static const short yy_reduce_ofst[] = {
- /* 0 */ -125, 733, 789, 241, 293, -123, -193, -191, -183, -187,
- /* 10 */ 166, 238, 133, -207, -199, -267, -176, -6, 204, 489,
- /* 20 */ 576, 598, -175, 686, 860, 615, 725, 1014, 778, 781,
- /* 30 */ 857, 616, 887, 87, 240, -192, 408, 626, 796, 843,
- /* 40 */ 854, 1004, -271, -271, -271, -271, -271, -271, -271, -271,
- /* 50 */ -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,
- /* 60 */ -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,
- /* 70 */ -271, -271, -271, -271, -271, -271, -271, -271, -271, 80,
- /* 80 */ 83, 313, 886, 888, 918, 938, 1021, 1034, 1036, 1141,
- /* 90 */ 1159, 1163, 1166, 1168, 1170, 1176, 1178, 1180, 1184, 1196,
- /* 100 */ 1198, 1205, 1215, 1225, 1227, 1236, 1252, 1254, 1264, 1303,
- /* 110 */ 1309, 1312, 1322, 1325, 1328, 1337, 1340, 1343, 1353, 1371,
- /* 120 */ 1373, 1384, 1386, 1411, 1413, 1420, 1424, 1426, 1458, 1470,
- /* 130 */ 1473, -271, -271, -271, -271, -271, -271, -271, -271, -271,
- /* 140 */ -271, -271, 138, 459, 396, -158, 470, 302, -212, 521,
- /* 150 */ 201, -195, -92, 559, 630, 632, 630, -271, 632, 901,
- /* 160 */ 63, 407, 670, -271, -271, -271, -271, 161, 161, 161,
- /* 170 */ 251, 335, 847, 979, 1097, 537, 588, 618, 628, 688,
- /* 180 */ 688, -166, -161, 674, 787, 794, 799, 852, 996, -122,
- /* 190 */ 837, -120, 1018, 1035, 415, 1047, 1001, 958, 1082, 400,
- /* 200 */ 1099, 779, 1137, 1142, 263, 1083, 1145, 1150, 1041, 1139,
- /* 210 */ 965, 1050, 362, 849, 752, 629, 675, 1162, 1173, 1090,
- /* 220 */ 1195, -194, 56, 185, -135, 232, 522, 560, 571, 601,
- /* 230 */ 617, 669, 683, 711, 850, 893, 1000, 1040, 1049, 1081,
- /* 240 */ 1087, 1101, 392, 1114, 1123, 1155, 1161, 1175, 1271, 1293,
- /* 250 */ 1299, 1330, 1339, 1342, 1347, 593, 1282, 1286, 1350, 1359,
- /* 260 */ 1368, 1314, 1480, 1483, 1507, 1085, 1338, 1526, 1527, 1487,
- /* 270 */ 1531, 560, 1532, 1534, 1535, 1538, 1539, 1541, 1448, 1450,
- /* 280 */ 1496, 1484, 1485, 1489, 1490, 1314, 1496, 1496, 1504, 1536,
- /* 290 */ 1564, 1451, 1486, 1492, 1509, 1493, 1465, 1515, 1494, 1495,
- /* 300 */ 1517, 1500, 1519, 1474, 1550, 1543, 1548, 1556, 1565, 1566,
- /* 310 */ 1518, 1523, 1542, 1544, 1525, 1545, 1513, 1553, 1552, 1604,
- /* 320 */ 1508, 1510, 1608, 1609, 1520, 1528, 1612, 1540, 1559, 1560,
- /* 330 */ 1592, 1591, 1595, 1596, 1597, 1629, 1638, 1594, 1569, 1570,
- /* 340 */ 1600, 1568, 1610, 1601, 1611, 1603, 1643, 1651, 1562, 1571,
- /* 350 */ 1655, 1659, 1640, 1663, 1666, 1664, 1667, 1641, 1650, 1652,
- /* 360 */ 1653, 1647, 1656, 1657, 1658, 1668, 1672, 1681, 1649, 1682,
- /* 370 */ 1683, 1573, 1582, 1607, 1615, 1685, 1702, 1586, 1587, 1642,
- /* 380 */ 1646, 1673, 1675, 1636, 1714, 1637, 1677, 1674, 1678, 1694,
- /* 390 */ 1719, 1734, 1735, 1746, 1747, 1750, 1633, 1661, 1686, 1738,
- /* 400 */ 1728, 1733, 1736, 1737, 1740, 1726, 1730, 1742, 1743, 1748,
- /* 410 */ 1753,
+ /* 0 */ -71, 194, 343, 835, -180, -177, 838, -194, -188, -185,
+ /* 10 */ -183, 82, 183, -65, 133, 245, 346, 407, 458, -178,
+ /* 20 */ 75, -275, -4, 310, 312, 489, 575, 596, 463, 686,
+ /* 30 */ 707, 725, 780, 1098, 856, 778, 1059, 1090, 708, 887,
+ /* 40 */ 86, 448, 980, 630, 680, 681, 684, 796, 801, 796,
+ /* 50 */ 801, -261, -261, -261, -261, -261, -261, -261, -261, -261,
+ /* 60 */ -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,
+ /* 70 */ -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,
+ /* 80 */ -261, -261, -261, -261, -261, -261, -261, -261, 391, 886,
+ /* 90 */ 888, 1013, 1016, 1081, 1087, 1151, 1159, 1177, 1185, 1188,
+ /* 100 */ 1190, 1194, 1197, 1203, 1247, 1260, 1264, 1267, 1269, 1273,
+ /* 110 */ 1315, 1322, 1335, 1337, 1356, 1362, 1418, 1425, 1453, 1457,
+ /* 120 */ 1465, 1473, 1487, 1495, 1507, 1517, 1521, 1534, 1543, 1546,
+ /* 130 */ 1549, 1552, 1554, 1560, 1581, 1590, 1593, 1595, 1621, 1623,
+ /* 140 */ -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,
+ /* 150 */ -261, -186, -117, 260, 263, 460, 631, -74, 497, -181,
+ /* 160 */ -261, 939, 176, 274, 338, 676, -261, -261, -261, -261,
+ /* 170 */ -212, -212, -212, -184, 149, 777, 1061, 1103, 265, 419,
+ /* 180 */ -254, 670, 677, 677, -11, -129, 184, 488, 736, 789,
+ /* 190 */ 805, 844, 403, 529, 579, 668, 783, 841, 1158, 1112,
+ /* 200 */ 806, 861, 1095, 846, 839, 1031, -189, 1077, 1080, 1116,
+ /* 210 */ 1084, 1156, 1139, 1221, 46, 1099, 1037, 1118, 1171, 1214,
+ /* 220 */ 1210, 1258, -210, -190, -176, -115, 117, 262, 376, 490,
+ /* 230 */ 511, 520, 618, 639, 743, 901, 907, 958, 1014, 1055,
+ /* 240 */ 1108, 1193, 1244, 720, 1248, 1277, 1324, 1347, 1417, 1431,
+ /* 250 */ 1432, 1440, 1451, 1452, 1463, 1478, 1286, 1350, 1369, 1490,
+ /* 260 */ 1498, 1501, 773, 1509, 1513, 1528, 1292, 1367, 1535, 1536,
+ /* 270 */ 1477, 1542, 376, 1547, 1550, 1555, 1559, 1568, 1571, 1441,
+ /* 280 */ 1443, 1474, 1511, 1516, 1519, 1522, 773, 1474, 1474, 1503,
+ /* 290 */ 1567, 1594, 1484, 1527, 1556, 1570, 1557, 1524, 1573, 1545,
+ /* 300 */ 1548, 1576, 1561, 1587, 1540, 1575, 1606, 1611, 1622, 1624,
+ /* 310 */ 1626, 1582, 1597, 1598, 1599, 1601, 1603, 1563, 1608, 1605,
+ /* 320 */ 1604, 1564, 1566, 1655, 1660, 1578, 1579, 1665, 1586, 1607,
+ /* 330 */ 1610, 1642, 1641, 1645, 1646, 1647, 1679, 1688, 1644, 1618,
+ /* 340 */ 1619, 1648, 1628, 1659, 1649, 1663, 1650, 1700, 1702, 1612,
+ /* 350 */ 1615, 1706, 1708, 1689, 1709, 1712, 1713, 1715, 1691, 1698,
+ /* 360 */ 1699, 1701, 1693, 1704, 1707, 1705, 1714, 1703, 1718, 1710,
+ /* 370 */ 1720, 1721, 1632, 1634, 1664, 1666, 1729, 1751, 1635, 1636,
+ /* 380 */ 1692, 1694, 1716, 1722, 1684, 1763, 1685, 1723, 1724, 1727,
+ /* 390 */ 1730, 1768, 1783, 1784, 1793, 1794, 1796, 1683, 1686, 1690,
+ /* 400 */ 1782, 1779, 1780, 1781, 1785, 1788, 1774, 1775, 1786, 1787,
+ /* 410 */ 1789, 1798,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1648, 1648, 1648, 1478, 1243, 1354, 1243, 1243, 1243, 1478,
- /* 10 */ 1478, 1478, 1243, 1384, 1384, 1531, 1276, 1243, 1243, 1243,
- /* 20 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1477, 1243,
- /* 30 */ 1243, 1243, 1243, 1564, 1564, 1243, 1243, 1243, 1243, 1243,
- /* 40 */ 1243, 1243, 1243, 1393, 1243, 1400, 1243, 1243, 1243, 1243,
- /* 50 */ 1243, 1479, 1480, 1243, 1243, 1243, 1530, 1532, 1495, 1407,
- /* 60 */ 1406, 1405, 1404, 1513, 1372, 1398, 1391, 1395, 1474, 1475,
- /* 70 */ 1473, 1626, 1480, 1479, 1243, 1394, 1442, 1458, 1441, 1243,
- /* 80 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 90 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 100 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 110 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 120 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 130 */ 1243, 1450, 1457, 1456, 1455, 1464, 1454, 1451, 1444, 1443,
- /* 140 */ 1445, 1446, 1243, 1243, 1267, 1243, 1243, 1264, 1318, 1243,
- /* 150 */ 1243, 1243, 1243, 1243, 1550, 1549, 1243, 1447, 1243, 1276,
- /* 160 */ 1435, 1434, 1433, 1461, 1448, 1460, 1459, 1538, 1600, 1599,
- /* 170 */ 1496, 1243, 1243, 1243, 1243, 1243, 1243, 1564, 1243, 1243,
- /* 180 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 190 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 200 */ 1243, 1374, 1564, 1564, 1243, 1276, 1564, 1564, 1375, 1375,
- /* 210 */ 1272, 1272, 1378, 1243, 1545, 1345, 1345, 1345, 1345, 1354,
- /* 220 */ 1345, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 230 */ 1243, 1243, 1243, 1243, 1243, 1243, 1535, 1533, 1243, 1243,
- /* 240 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 250 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 260 */ 1243, 1243, 1243, 1243, 1243, 1350, 1243, 1243, 1243, 1243,
- /* 270 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1593, 1243, 1508,
- /* 280 */ 1332, 1350, 1350, 1350, 1350, 1352, 1333, 1331, 1344, 1277,
- /* 290 */ 1250, 1640, 1410, 1399, 1351, 1399, 1637, 1397, 1410, 1410,
- /* 300 */ 1397, 1410, 1351, 1637, 1293, 1615, 1288, 1384, 1384, 1384,
- /* 310 */ 1374, 1374, 1374, 1374, 1378, 1378, 1476, 1351, 1344, 1243,
- /* 320 */ 1640, 1640, 1360, 1360, 1639, 1639, 1360, 1496, 1623, 1419,
- /* 330 */ 1321, 1327, 1327, 1327, 1327, 1360, 1261, 1397, 1623, 1623,
- /* 340 */ 1397, 1419, 1321, 1397, 1321, 1397, 1360, 1261, 1512, 1634,
- /* 350 */ 1360, 1261, 1486, 1360, 1261, 1360, 1261, 1486, 1319, 1319,
- /* 360 */ 1319, 1308, 1243, 1243, 1486, 1319, 1293, 1319, 1308, 1319,
- /* 370 */ 1319, 1582, 1243, 1490, 1490, 1486, 1360, 1574, 1574, 1387,
- /* 380 */ 1387, 1392, 1378, 1481, 1360, 1243, 1392, 1390, 1388, 1397,
- /* 390 */ 1311, 1596, 1596, 1592, 1592, 1592, 1645, 1645, 1545, 1608,
- /* 400 */ 1276, 1276, 1276, 1276, 1608, 1295, 1295, 1277, 1277, 1276,
- /* 410 */ 1608, 1243, 1243, 1243, 1243, 1243, 1243, 1603, 1243, 1540,
- /* 420 */ 1497, 1364, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 430 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1551, 1243,
- /* 440 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1424,
- /* 450 */ 1243, 1246, 1542, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 460 */ 1243, 1401, 1402, 1365, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 470 */ 1243, 1416, 1243, 1243, 1243, 1411, 1243, 1243, 1243, 1243,
- /* 480 */ 1243, 1243, 1243, 1243, 1636, 1243, 1243, 1243, 1243, 1243,
- /* 490 */ 1243, 1511, 1510, 1243, 1243, 1362, 1243, 1243, 1243, 1243,
- /* 500 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1291,
- /* 510 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 520 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 530 */ 1243, 1243, 1243, 1389, 1243, 1243, 1243, 1243, 1243, 1243,
- /* 540 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1579, 1379,
- /* 550 */ 1243, 1243, 1243, 1243, 1627, 1243, 1243, 1243, 1243, 1243,
- /* 560 */ 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1619,
- /* 570 */ 1335, 1425, 1243, 1428, 1265, 1243, 1255, 1243, 1243,
+ /* 0 */ 1663, 1663, 1663, 1491, 1254, 1367, 1254, 1254, 1254, 1254,
+ /* 10 */ 1491, 1491, 1491, 1254, 1254, 1254, 1254, 1254, 1254, 1397,
+ /* 20 */ 1397, 1544, 1287, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 30 */ 1254, 1254, 1254, 1254, 1254, 1490, 1254, 1254, 1254, 1254,
+ /* 40 */ 1578, 1578, 1254, 1254, 1254, 1254, 1254, 1563, 1562, 1254,
+ /* 50 */ 1254, 1254, 1406, 1254, 1413, 1254, 1254, 1254, 1254, 1254,
+ /* 60 */ 1492, 1493, 1254, 1254, 1254, 1543, 1545, 1508, 1420, 1419,
+ /* 70 */ 1418, 1417, 1526, 1385, 1411, 1404, 1408, 1487, 1488, 1486,
+ /* 80 */ 1641, 1493, 1492, 1254, 1407, 1455, 1471, 1454, 1254, 1254,
+ /* 90 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 100 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 110 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 120 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 130 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 140 */ 1463, 1470, 1469, 1468, 1477, 1467, 1464, 1457, 1456, 1458,
+ /* 150 */ 1459, 1278, 1254, 1275, 1329, 1254, 1254, 1254, 1254, 1254,
+ /* 160 */ 1460, 1287, 1448, 1447, 1446, 1254, 1474, 1461, 1473, 1472,
+ /* 170 */ 1551, 1615, 1614, 1509, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 180 */ 1578, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 190 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 200 */ 1254, 1254, 1254, 1387, 1578, 1578, 1254, 1287, 1578, 1578,
+ /* 210 */ 1388, 1388, 1283, 1283, 1391, 1558, 1358, 1358, 1358, 1358,
+ /* 220 */ 1367, 1358, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 230 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1548, 1546, 1254,
+ /* 240 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 250 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 260 */ 1254, 1254, 1254, 1254, 1254, 1254, 1363, 1254, 1254, 1254,
+ /* 270 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1608, 1254,
+ /* 280 */ 1521, 1343, 1363, 1363, 1363, 1363, 1365, 1344, 1342, 1357,
+ /* 290 */ 1288, 1261, 1655, 1423, 1412, 1364, 1412, 1652, 1410, 1423,
+ /* 300 */ 1423, 1410, 1423, 1364, 1652, 1304, 1630, 1299, 1397, 1397,
+ /* 310 */ 1397, 1387, 1387, 1387, 1387, 1391, 1391, 1489, 1364, 1357,
+ /* 320 */ 1254, 1655, 1655, 1373, 1373, 1654, 1654, 1373, 1509, 1638,
+ /* 330 */ 1432, 1332, 1338, 1338, 1338, 1338, 1373, 1272, 1410, 1638,
+ /* 340 */ 1638, 1410, 1432, 1332, 1410, 1332, 1410, 1373, 1272, 1525,
+ /* 350 */ 1649, 1373, 1272, 1499, 1373, 1272, 1373, 1272, 1499, 1330,
+ /* 360 */ 1330, 1330, 1319, 1254, 1254, 1499, 1330, 1304, 1330, 1319,
+ /* 370 */ 1330, 1330, 1596, 1254, 1503, 1503, 1499, 1373, 1588, 1588,
+ /* 380 */ 1400, 1400, 1405, 1391, 1494, 1373, 1254, 1405, 1403, 1401,
+ /* 390 */ 1410, 1322, 1611, 1611, 1607, 1607, 1607, 1660, 1660, 1558,
+ /* 400 */ 1623, 1287, 1287, 1287, 1287, 1623, 1306, 1306, 1288, 1288,
+ /* 410 */ 1287, 1623, 1254, 1254, 1254, 1254, 1254, 1254, 1618, 1254,
+ /* 420 */ 1553, 1510, 1377, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 430 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1564,
+ /* 440 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 450 */ 1254, 1437, 1254, 1257, 1555, 1254, 1254, 1254, 1254, 1254,
+ /* 460 */ 1254, 1254, 1254, 1414, 1415, 1378, 1254, 1254, 1254, 1254,
+ /* 470 */ 1254, 1254, 1254, 1429, 1254, 1254, 1254, 1424, 1254, 1254,
+ /* 480 */ 1254, 1254, 1254, 1254, 1254, 1254, 1651, 1254, 1254, 1254,
+ /* 490 */ 1254, 1254, 1254, 1524, 1523, 1254, 1254, 1375, 1254, 1254,
+ /* 500 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 510 */ 1254, 1302, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 520 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 530 */ 1254, 1254, 1254, 1254, 1254, 1402, 1254, 1254, 1254, 1254,
+ /* 540 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 550 */ 1593, 1392, 1254, 1254, 1254, 1254, 1642, 1254, 1254, 1254,
+ /* 560 */ 1254, 1352, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254,
+ /* 570 */ 1254, 1254, 1254, 1634, 1346, 1438, 1254, 1441, 1276, 1254,
+ /* 580 */ 1266, 1254, 1254,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -172521,8 +173902,8 @@ static const YYCODETYPE yyFallback[] = {
0, /* TRUEFALSE => nothing */
0, /* ISNOT => nothing */
0, /* FUNCTION => nothing */
- 0, /* UMINUS => nothing */
0, /* UPLUS => nothing */
+ 0, /* UMINUS => nothing */
0, /* TRUTH => nothing */
0, /* REGISTER => nothing */
0, /* VECTOR => nothing */
@@ -172531,6 +173912,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* ASTERISK => nothing */
0, /* SPAN => nothing */
0, /* ERROR => nothing */
+ 0, /* QNUMBER => nothing */
0, /* SPACE => nothing */
0, /* ILLEGAL => nothing */
};
@@ -172573,14 +173955,9 @@ struct yyParser {
#endif
sqlite3ParserARG_SDECL /* A place to hold %extra_argument */
sqlite3ParserCTX_SDECL /* A place to hold %extra_context */
-#if YYSTACKDEPTH<=0
- int yystksz; /* Current side of the stack */
- yyStackEntry *yystack; /* The parser's stack */
- yyStackEntry yystk0; /* First stack entry */
-#else
- yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
- yyStackEntry *yystackEnd; /* Last entry in the stack */
-#endif
+ yyStackEntry *yystackEnd; /* Last entry in the stack */
+ yyStackEntry *yystack; /* The parser stack */
+ yyStackEntry yystk0[YYSTACKDEPTH]; /* Initial stack space */
};
typedef struct yyParser yyParser;
@@ -172794,8 +174171,8 @@ static const char *const yyTokenName[] = {
/* 170 */ "TRUEFALSE",
/* 171 */ "ISNOT",
/* 172 */ "FUNCTION",
- /* 173 */ "UMINUS",
- /* 174 */ "UPLUS",
+ /* 173 */ "UPLUS",
+ /* 174 */ "UMINUS",
/* 175 */ "TRUTH",
/* 176 */ "REGISTER",
/* 177 */ "VECTOR",
@@ -172804,142 +174181,145 @@ static const char *const yyTokenName[] = {
/* 180 */ "ASTERISK",
/* 181 */ "SPAN",
/* 182 */ "ERROR",
- /* 183 */ "SPACE",
- /* 184 */ "ILLEGAL",
- /* 185 */ "input",
- /* 186 */ "cmdlist",
- /* 187 */ "ecmd",
- /* 188 */ "cmdx",
- /* 189 */ "explain",
- /* 190 */ "cmd",
- /* 191 */ "transtype",
- /* 192 */ "trans_opt",
- /* 193 */ "nm",
- /* 194 */ "savepoint_opt",
- /* 195 */ "create_table",
- /* 196 */ "create_table_args",
- /* 197 */ "createkw",
- /* 198 */ "temp",
- /* 199 */ "ifnotexists",
- /* 200 */ "dbnm",
- /* 201 */ "columnlist",
- /* 202 */ "conslist_opt",
- /* 203 */ "table_option_set",
- /* 204 */ "select",
- /* 205 */ "table_option",
- /* 206 */ "columnname",
- /* 207 */ "carglist",
- /* 208 */ "typetoken",
- /* 209 */ "typename",
- /* 210 */ "signed",
- /* 211 */ "plus_num",
- /* 212 */ "minus_num",
- /* 213 */ "scanpt",
- /* 214 */ "scantok",
- /* 215 */ "ccons",
- /* 216 */ "term",
- /* 217 */ "expr",
- /* 218 */ "onconf",
- /* 219 */ "sortorder",
- /* 220 */ "autoinc",
- /* 221 */ "eidlist_opt",
- /* 222 */ "refargs",
- /* 223 */ "defer_subclause",
- /* 224 */ "generated",
- /* 225 */ "refarg",
- /* 226 */ "refact",
- /* 227 */ "init_deferred_pred_opt",
- /* 228 */ "conslist",
- /* 229 */ "tconscomma",
- /* 230 */ "tcons",
- /* 231 */ "sortlist",
- /* 232 */ "eidlist",
- /* 233 */ "defer_subclause_opt",
- /* 234 */ "orconf",
- /* 235 */ "resolvetype",
- /* 236 */ "raisetype",
- /* 237 */ "ifexists",
- /* 238 */ "fullname",
- /* 239 */ "selectnowith",
- /* 240 */ "oneselect",
- /* 241 */ "wqlist",
- /* 242 */ "multiselect_op",
- /* 243 */ "distinct",
- /* 244 */ "selcollist",
- /* 245 */ "from",
- /* 246 */ "where_opt",
- /* 247 */ "groupby_opt",
- /* 248 */ "having_opt",
- /* 249 */ "orderby_opt",
- /* 250 */ "limit_opt",
- /* 251 */ "window_clause",
- /* 252 */ "values",
- /* 253 */ "nexprlist",
- /* 254 */ "sclp",
- /* 255 */ "as",
- /* 256 */ "seltablist",
- /* 257 */ "stl_prefix",
- /* 258 */ "joinop",
- /* 259 */ "on_using",
- /* 260 */ "indexed_by",
- /* 261 */ "exprlist",
- /* 262 */ "xfullname",
- /* 263 */ "idlist",
- /* 264 */ "indexed_opt",
- /* 265 */ "nulls",
- /* 266 */ "with",
- /* 267 */ "where_opt_ret",
- /* 268 */ "setlist",
- /* 269 */ "insert_cmd",
- /* 270 */ "idlist_opt",
- /* 271 */ "upsert",
- /* 272 */ "returning",
- /* 273 */ "filter_over",
- /* 274 */ "likeop",
- /* 275 */ "between_op",
- /* 276 */ "in_op",
- /* 277 */ "paren_exprlist",
- /* 278 */ "case_operand",
- /* 279 */ "case_exprlist",
- /* 280 */ "case_else",
- /* 281 */ "uniqueflag",
- /* 282 */ "collate",
- /* 283 */ "vinto",
- /* 284 */ "nmnum",
- /* 285 */ "trigger_decl",
- /* 286 */ "trigger_cmd_list",
- /* 287 */ "trigger_time",
- /* 288 */ "trigger_event",
- /* 289 */ "foreach_clause",
- /* 290 */ "when_clause",
- /* 291 */ "trigger_cmd",
- /* 292 */ "trnm",
- /* 293 */ "tridxby",
- /* 294 */ "database_kw_opt",
- /* 295 */ "key_opt",
- /* 296 */ "add_column_fullname",
- /* 297 */ "kwcolumn_opt",
- /* 298 */ "create_vtab",
- /* 299 */ "vtabarglist",
- /* 300 */ "vtabarg",
- /* 301 */ "vtabargtoken",
- /* 302 */ "lp",
- /* 303 */ "anylist",
- /* 304 */ "wqitem",
- /* 305 */ "wqas",
- /* 306 */ "windowdefn_list",
- /* 307 */ "windowdefn",
- /* 308 */ "window",
- /* 309 */ "frame_opt",
- /* 310 */ "part_opt",
- /* 311 */ "filter_clause",
- /* 312 */ "over_clause",
- /* 313 */ "range_or_rows",
- /* 314 */ "frame_bound",
- /* 315 */ "frame_bound_s",
- /* 316 */ "frame_bound_e",
- /* 317 */ "frame_exclude_opt",
- /* 318 */ "frame_exclude",
+ /* 183 */ "QNUMBER",
+ /* 184 */ "SPACE",
+ /* 185 */ "ILLEGAL",
+ /* 186 */ "input",
+ /* 187 */ "cmdlist",
+ /* 188 */ "ecmd",
+ /* 189 */ "cmdx",
+ /* 190 */ "explain",
+ /* 191 */ "cmd",
+ /* 192 */ "transtype",
+ /* 193 */ "trans_opt",
+ /* 194 */ "nm",
+ /* 195 */ "savepoint_opt",
+ /* 196 */ "create_table",
+ /* 197 */ "create_table_args",
+ /* 198 */ "createkw",
+ /* 199 */ "temp",
+ /* 200 */ "ifnotexists",
+ /* 201 */ "dbnm",
+ /* 202 */ "columnlist",
+ /* 203 */ "conslist_opt",
+ /* 204 */ "table_option_set",
+ /* 205 */ "select",
+ /* 206 */ "table_option",
+ /* 207 */ "columnname",
+ /* 208 */ "carglist",
+ /* 209 */ "typetoken",
+ /* 210 */ "typename",
+ /* 211 */ "signed",
+ /* 212 */ "plus_num",
+ /* 213 */ "minus_num",
+ /* 214 */ "scanpt",
+ /* 215 */ "scantok",
+ /* 216 */ "ccons",
+ /* 217 */ "term",
+ /* 218 */ "expr",
+ /* 219 */ "onconf",
+ /* 220 */ "sortorder",
+ /* 221 */ "autoinc",
+ /* 222 */ "eidlist_opt",
+ /* 223 */ "refargs",
+ /* 224 */ "defer_subclause",
+ /* 225 */ "generated",
+ /* 226 */ "refarg",
+ /* 227 */ "refact",
+ /* 228 */ "init_deferred_pred_opt",
+ /* 229 */ "conslist",
+ /* 230 */ "tconscomma",
+ /* 231 */ "tcons",
+ /* 232 */ "sortlist",
+ /* 233 */ "eidlist",
+ /* 234 */ "defer_subclause_opt",
+ /* 235 */ "orconf",
+ /* 236 */ "resolvetype",
+ /* 237 */ "raisetype",
+ /* 238 */ "ifexists",
+ /* 239 */ "fullname",
+ /* 240 */ "selectnowith",
+ /* 241 */ "oneselect",
+ /* 242 */ "wqlist",
+ /* 243 */ "multiselect_op",
+ /* 244 */ "distinct",
+ /* 245 */ "selcollist",
+ /* 246 */ "from",
+ /* 247 */ "where_opt",
+ /* 248 */ "groupby_opt",
+ /* 249 */ "having_opt",
+ /* 250 */ "orderby_opt",
+ /* 251 */ "limit_opt",
+ /* 252 */ "window_clause",
+ /* 253 */ "values",
+ /* 254 */ "nexprlist",
+ /* 255 */ "mvalues",
+ /* 256 */ "sclp",
+ /* 257 */ "as",
+ /* 258 */ "seltablist",
+ /* 259 */ "stl_prefix",
+ /* 260 */ "joinop",
+ /* 261 */ "on_using",
+ /* 262 */ "indexed_by",
+ /* 263 */ "exprlist",
+ /* 264 */ "xfullname",
+ /* 265 */ "idlist",
+ /* 266 */ "indexed_opt",
+ /* 267 */ "nulls",
+ /* 268 */ "with",
+ /* 269 */ "where_opt_ret",
+ /* 270 */ "setlist",
+ /* 271 */ "insert_cmd",
+ /* 272 */ "idlist_opt",
+ /* 273 */ "upsert",
+ /* 274 */ "returning",
+ /* 275 */ "filter_over",
+ /* 276 */ "likeop",
+ /* 277 */ "between_op",
+ /* 278 */ "in_op",
+ /* 279 */ "paren_exprlist",
+ /* 280 */ "case_operand",
+ /* 281 */ "case_exprlist",
+ /* 282 */ "case_else",
+ /* 283 */ "uniqueflag",
+ /* 284 */ "collate",
+ /* 285 */ "vinto",
+ /* 286 */ "nmnum",
+ /* 287 */ "trigger_decl",
+ /* 288 */ "trigger_cmd_list",
+ /* 289 */ "trigger_time",
+ /* 290 */ "trigger_event",
+ /* 291 */ "foreach_clause",
+ /* 292 */ "when_clause",
+ /* 293 */ "trigger_cmd",
+ /* 294 */ "trnm",
+ /* 295 */ "tridxby",
+ /* 296 */ "database_kw_opt",
+ /* 297 */ "key_opt",
+ /* 298 */ "add_column_fullname",
+ /* 299 */ "kwcolumn_opt",
+ /* 300 */ "create_vtab",
+ /* 301 */ "vtabarglist",
+ /* 302 */ "vtabarg",
+ /* 303 */ "vtabargtoken",
+ /* 304 */ "lp",
+ /* 305 */ "anylist",
+ /* 306 */ "wqitem",
+ /* 307 */ "wqas",
+ /* 308 */ "withnm",
+ /* 309 */ "windowdefn_list",
+ /* 310 */ "windowdefn",
+ /* 311 */ "window",
+ /* 312 */ "frame_opt",
+ /* 313 */ "part_opt",
+ /* 314 */ "filter_clause",
+ /* 315 */ "over_clause",
+ /* 316 */ "range_or_rows",
+ /* 317 */ "frame_bound",
+ /* 318 */ "frame_bound_s",
+ /* 319 */ "frame_bound_e",
+ /* 320 */ "frame_exclude_opt",
+ /* 321 */ "frame_exclude",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -173042,351 +174422,363 @@ static const char *const yyRuleName[] = {
/* 92 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
/* 93 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt",
/* 94 */ "values ::= VALUES LP nexprlist RP",
- /* 95 */ "values ::= values COMMA LP nexprlist RP",
- /* 96 */ "distinct ::= DISTINCT",
- /* 97 */ "distinct ::= ALL",
- /* 98 */ "distinct ::=",
- /* 99 */ "sclp ::=",
- /* 100 */ "selcollist ::= sclp scanpt expr scanpt as",
- /* 101 */ "selcollist ::= sclp scanpt STAR",
- /* 102 */ "selcollist ::= sclp scanpt nm DOT STAR",
- /* 103 */ "as ::= AS nm",
- /* 104 */ "as ::=",
- /* 105 */ "from ::=",
- /* 106 */ "from ::= FROM seltablist",
- /* 107 */ "stl_prefix ::= seltablist joinop",
- /* 108 */ "stl_prefix ::=",
- /* 109 */ "seltablist ::= stl_prefix nm dbnm as on_using",
- /* 110 */ "seltablist ::= stl_prefix nm dbnm as indexed_by on_using",
- /* 111 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using",
- /* 112 */ "seltablist ::= stl_prefix LP select RP as on_using",
- /* 113 */ "seltablist ::= stl_prefix LP seltablist RP as on_using",
- /* 114 */ "dbnm ::=",
- /* 115 */ "dbnm ::= DOT nm",
- /* 116 */ "fullname ::= nm",
- /* 117 */ "fullname ::= nm DOT nm",
- /* 118 */ "xfullname ::= nm",
- /* 119 */ "xfullname ::= nm DOT nm",
- /* 120 */ "xfullname ::= nm DOT nm AS nm",
- /* 121 */ "xfullname ::= nm AS nm",
- /* 122 */ "joinop ::= COMMA|JOIN",
- /* 123 */ "joinop ::= JOIN_KW JOIN",
- /* 124 */ "joinop ::= JOIN_KW nm JOIN",
- /* 125 */ "joinop ::= JOIN_KW nm nm JOIN",
- /* 126 */ "on_using ::= ON expr",
- /* 127 */ "on_using ::= USING LP idlist RP",
- /* 128 */ "on_using ::=",
- /* 129 */ "indexed_opt ::=",
- /* 130 */ "indexed_by ::= INDEXED BY nm",
- /* 131 */ "indexed_by ::= NOT INDEXED",
- /* 132 */ "orderby_opt ::=",
- /* 133 */ "orderby_opt ::= ORDER BY sortlist",
- /* 134 */ "sortlist ::= sortlist COMMA expr sortorder nulls",
- /* 135 */ "sortlist ::= expr sortorder nulls",
- /* 136 */ "sortorder ::= ASC",
- /* 137 */ "sortorder ::= DESC",
- /* 138 */ "sortorder ::=",
- /* 139 */ "nulls ::= NULLS FIRST",
- /* 140 */ "nulls ::= NULLS LAST",
- /* 141 */ "nulls ::=",
- /* 142 */ "groupby_opt ::=",
- /* 143 */ "groupby_opt ::= GROUP BY nexprlist",
- /* 144 */ "having_opt ::=",
- /* 145 */ "having_opt ::= HAVING expr",
- /* 146 */ "limit_opt ::=",
- /* 147 */ "limit_opt ::= LIMIT expr",
- /* 148 */ "limit_opt ::= LIMIT expr OFFSET expr",
- /* 149 */ "limit_opt ::= LIMIT expr COMMA expr",
- /* 150 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret",
- /* 151 */ "where_opt ::=",
- /* 152 */ "where_opt ::= WHERE expr",
- /* 153 */ "where_opt_ret ::=",
- /* 154 */ "where_opt_ret ::= WHERE expr",
- /* 155 */ "where_opt_ret ::= RETURNING selcollist",
- /* 156 */ "where_opt_ret ::= WHERE expr RETURNING selcollist",
- /* 157 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret",
- /* 158 */ "setlist ::= setlist COMMA nm EQ expr",
- /* 159 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
- /* 160 */ "setlist ::= nm EQ expr",
- /* 161 */ "setlist ::= LP idlist RP EQ expr",
- /* 162 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
- /* 163 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning",
- /* 164 */ "upsert ::=",
- /* 165 */ "upsert ::= RETURNING selcollist",
- /* 166 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert",
- /* 167 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert",
- /* 168 */ "upsert ::= ON CONFLICT DO NOTHING returning",
- /* 169 */ "upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning",
- /* 170 */ "returning ::= RETURNING selcollist",
- /* 171 */ "insert_cmd ::= INSERT orconf",
- /* 172 */ "insert_cmd ::= REPLACE",
- /* 173 */ "idlist_opt ::=",
- /* 174 */ "idlist_opt ::= LP idlist RP",
- /* 175 */ "idlist ::= idlist COMMA nm",
- /* 176 */ "idlist ::= nm",
- /* 177 */ "expr ::= LP expr RP",
- /* 178 */ "expr ::= ID|INDEXED|JOIN_KW",
- /* 179 */ "expr ::= nm DOT nm",
- /* 180 */ "expr ::= nm DOT nm DOT nm",
- /* 181 */ "term ::= NULL|FLOAT|BLOB",
- /* 182 */ "term ::= STRING",
- /* 183 */ "term ::= INTEGER",
- /* 184 */ "expr ::= VARIABLE",
- /* 185 */ "expr ::= expr COLLATE ID|STRING",
- /* 186 */ "expr ::= CAST LP expr AS typetoken RP",
- /* 187 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP",
- /* 188 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP",
- /* 189 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP",
- /* 190 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over",
- /* 191 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over",
- /* 192 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over",
- /* 193 */ "term ::= CTIME_KW",
- /* 194 */ "expr ::= LP nexprlist COMMA expr RP",
- /* 195 */ "expr ::= expr AND expr",
- /* 196 */ "expr ::= expr OR expr",
- /* 197 */ "expr ::= expr LT|GT|GE|LE expr",
- /* 198 */ "expr ::= expr EQ|NE expr",
- /* 199 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
- /* 200 */ "expr ::= expr PLUS|MINUS expr",
- /* 201 */ "expr ::= expr STAR|SLASH|REM expr",
- /* 202 */ "expr ::= expr CONCAT expr",
- /* 203 */ "likeop ::= NOT LIKE_KW|MATCH",
- /* 204 */ "expr ::= expr likeop expr",
- /* 205 */ "expr ::= expr likeop expr ESCAPE expr",
- /* 206 */ "expr ::= expr ISNULL|NOTNULL",
- /* 207 */ "expr ::= expr NOT NULL",
- /* 208 */ "expr ::= expr IS expr",
- /* 209 */ "expr ::= expr IS NOT expr",
- /* 210 */ "expr ::= expr IS NOT DISTINCT FROM expr",
- /* 211 */ "expr ::= expr IS DISTINCT FROM expr",
- /* 212 */ "expr ::= NOT expr",
- /* 213 */ "expr ::= BITNOT expr",
- /* 214 */ "expr ::= PLUS|MINUS expr",
- /* 215 */ "expr ::= expr PTR expr",
- /* 216 */ "between_op ::= BETWEEN",
- /* 217 */ "between_op ::= NOT BETWEEN",
- /* 218 */ "expr ::= expr between_op expr AND expr",
- /* 219 */ "in_op ::= IN",
- /* 220 */ "in_op ::= NOT IN",
- /* 221 */ "expr ::= expr in_op LP exprlist RP",
- /* 222 */ "expr ::= LP select RP",
- /* 223 */ "expr ::= expr in_op LP select RP",
- /* 224 */ "expr ::= expr in_op nm dbnm paren_exprlist",
- /* 225 */ "expr ::= EXISTS LP select RP",
- /* 226 */ "expr ::= CASE case_operand case_exprlist case_else END",
- /* 227 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
- /* 228 */ "case_exprlist ::= WHEN expr THEN expr",
- /* 229 */ "case_else ::= ELSE expr",
- /* 230 */ "case_else ::=",
- /* 231 */ "case_operand ::=",
- /* 232 */ "exprlist ::=",
- /* 233 */ "nexprlist ::= nexprlist COMMA expr",
- /* 234 */ "nexprlist ::= expr",
- /* 235 */ "paren_exprlist ::=",
- /* 236 */ "paren_exprlist ::= LP exprlist RP",
- /* 237 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
- /* 238 */ "uniqueflag ::= UNIQUE",
- /* 239 */ "uniqueflag ::=",
- /* 240 */ "eidlist_opt ::=",
- /* 241 */ "eidlist_opt ::= LP eidlist RP",
- /* 242 */ "eidlist ::= eidlist COMMA nm collate sortorder",
- /* 243 */ "eidlist ::= nm collate sortorder",
- /* 244 */ "collate ::=",
- /* 245 */ "collate ::= COLLATE ID|STRING",
- /* 246 */ "cmd ::= DROP INDEX ifexists fullname",
- /* 247 */ "cmd ::= VACUUM vinto",
- /* 248 */ "cmd ::= VACUUM nm vinto",
- /* 249 */ "vinto ::= INTO expr",
- /* 250 */ "vinto ::=",
- /* 251 */ "cmd ::= PRAGMA nm dbnm",
- /* 252 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
- /* 253 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
- /* 254 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
- /* 255 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
- /* 256 */ "plus_num ::= PLUS INTEGER|FLOAT",
- /* 257 */ "minus_num ::= MINUS INTEGER|FLOAT",
- /* 258 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
- /* 259 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
- /* 260 */ "trigger_time ::= BEFORE|AFTER",
- /* 261 */ "trigger_time ::= INSTEAD OF",
- /* 262 */ "trigger_time ::=",
- /* 263 */ "trigger_event ::= DELETE|INSERT",
- /* 264 */ "trigger_event ::= UPDATE",
- /* 265 */ "trigger_event ::= UPDATE OF idlist",
- /* 266 */ "when_clause ::=",
- /* 267 */ "when_clause ::= WHEN expr",
- /* 268 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
- /* 269 */ "trigger_cmd_list ::= trigger_cmd SEMI",
- /* 270 */ "trnm ::= nm DOT nm",
- /* 271 */ "tridxby ::= INDEXED BY nm",
- /* 272 */ "tridxby ::= NOT INDEXED",
- /* 273 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
- /* 274 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
- /* 275 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
- /* 276 */ "trigger_cmd ::= scanpt select scanpt",
- /* 277 */ "expr ::= RAISE LP IGNORE RP",
- /* 278 */ "expr ::= RAISE LP raisetype COMMA nm RP",
- /* 279 */ "raisetype ::= ROLLBACK",
- /* 280 */ "raisetype ::= ABORT",
- /* 281 */ "raisetype ::= FAIL",
- /* 282 */ "cmd ::= DROP TRIGGER ifexists fullname",
- /* 283 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
- /* 284 */ "cmd ::= DETACH database_kw_opt expr",
- /* 285 */ "key_opt ::=",
- /* 286 */ "key_opt ::= KEY expr",
- /* 287 */ "cmd ::= REINDEX",
- /* 288 */ "cmd ::= REINDEX nm dbnm",
- /* 289 */ "cmd ::= ANALYZE",
- /* 290 */ "cmd ::= ANALYZE nm dbnm",
- /* 291 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
- /* 292 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
- /* 293 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
- /* 294 */ "add_column_fullname ::= fullname",
- /* 295 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
- /* 296 */ "cmd ::= create_vtab",
- /* 297 */ "cmd ::= create_vtab LP vtabarglist RP",
- /* 298 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
- /* 299 */ "vtabarg ::=",
- /* 300 */ "vtabargtoken ::= ANY",
- /* 301 */ "vtabargtoken ::= lp anylist RP",
- /* 302 */ "lp ::= LP",
- /* 303 */ "with ::= WITH wqlist",
- /* 304 */ "with ::= WITH RECURSIVE wqlist",
- /* 305 */ "wqas ::= AS",
- /* 306 */ "wqas ::= AS MATERIALIZED",
- /* 307 */ "wqas ::= AS NOT MATERIALIZED",
- /* 308 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
- /* 309 */ "wqlist ::= wqitem",
- /* 310 */ "wqlist ::= wqlist COMMA wqitem",
- /* 311 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
- /* 312 */ "windowdefn ::= nm AS LP window RP",
- /* 313 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
- /* 314 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
- /* 315 */ "window ::= ORDER BY sortlist frame_opt",
- /* 316 */ "window ::= nm ORDER BY sortlist frame_opt",
- /* 317 */ "window ::= nm frame_opt",
- /* 318 */ "frame_opt ::=",
- /* 319 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
- /* 320 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
- /* 321 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
- /* 322 */ "frame_bound_s ::= frame_bound",
- /* 323 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
- /* 324 */ "frame_bound_e ::= frame_bound",
- /* 325 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
- /* 326 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
- /* 327 */ "frame_bound ::= CURRENT ROW",
- /* 328 */ "frame_exclude_opt ::=",
- /* 329 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
- /* 330 */ "frame_exclude ::= NO OTHERS",
- /* 331 */ "frame_exclude ::= CURRENT ROW",
- /* 332 */ "frame_exclude ::= GROUP|TIES",
- /* 333 */ "window_clause ::= WINDOW windowdefn_list",
- /* 334 */ "filter_over ::= filter_clause over_clause",
- /* 335 */ "filter_over ::= over_clause",
- /* 336 */ "filter_over ::= filter_clause",
- /* 337 */ "over_clause ::= OVER LP window RP",
- /* 338 */ "over_clause ::= OVER nm",
- /* 339 */ "filter_clause ::= FILTER LP WHERE expr RP",
- /* 340 */ "input ::= cmdlist",
- /* 341 */ "cmdlist ::= cmdlist ecmd",
- /* 342 */ "cmdlist ::= ecmd",
- /* 343 */ "ecmd ::= SEMI",
- /* 344 */ "ecmd ::= cmdx SEMI",
- /* 345 */ "ecmd ::= explain cmdx SEMI",
- /* 346 */ "trans_opt ::=",
- /* 347 */ "trans_opt ::= TRANSACTION",
- /* 348 */ "trans_opt ::= TRANSACTION nm",
- /* 349 */ "savepoint_opt ::= SAVEPOINT",
- /* 350 */ "savepoint_opt ::=",
- /* 351 */ "cmd ::= create_table create_table_args",
- /* 352 */ "table_option_set ::= table_option",
- /* 353 */ "columnlist ::= columnlist COMMA columnname carglist",
- /* 354 */ "columnlist ::= columnname carglist",
- /* 355 */ "nm ::= ID|INDEXED|JOIN_KW",
- /* 356 */ "nm ::= STRING",
- /* 357 */ "typetoken ::= typename",
- /* 358 */ "typename ::= ID|STRING",
- /* 359 */ "signed ::= plus_num",
- /* 360 */ "signed ::= minus_num",
- /* 361 */ "carglist ::= carglist ccons",
- /* 362 */ "carglist ::=",
- /* 363 */ "ccons ::= NULL onconf",
- /* 364 */ "ccons ::= GENERATED ALWAYS AS generated",
- /* 365 */ "ccons ::= AS generated",
- /* 366 */ "conslist_opt ::= COMMA conslist",
- /* 367 */ "conslist ::= conslist tconscomma tcons",
- /* 368 */ "conslist ::= tcons",
- /* 369 */ "tconscomma ::=",
- /* 370 */ "defer_subclause_opt ::= defer_subclause",
- /* 371 */ "resolvetype ::= raisetype",
- /* 372 */ "selectnowith ::= oneselect",
- /* 373 */ "oneselect ::= values",
- /* 374 */ "sclp ::= selcollist COMMA",
- /* 375 */ "as ::= ID|STRING",
- /* 376 */ "indexed_opt ::= indexed_by",
- /* 377 */ "returning ::=",
- /* 378 */ "expr ::= term",
- /* 379 */ "likeop ::= LIKE_KW|MATCH",
- /* 380 */ "case_operand ::= expr",
- /* 381 */ "exprlist ::= nexprlist",
- /* 382 */ "nmnum ::= plus_num",
- /* 383 */ "nmnum ::= nm",
- /* 384 */ "nmnum ::= ON",
- /* 385 */ "nmnum ::= DELETE",
- /* 386 */ "nmnum ::= DEFAULT",
- /* 387 */ "plus_num ::= INTEGER|FLOAT",
- /* 388 */ "foreach_clause ::=",
- /* 389 */ "foreach_clause ::= FOR EACH ROW",
- /* 390 */ "trnm ::= nm",
- /* 391 */ "tridxby ::=",
- /* 392 */ "database_kw_opt ::= DATABASE",
- /* 393 */ "database_kw_opt ::=",
- /* 394 */ "kwcolumn_opt ::=",
- /* 395 */ "kwcolumn_opt ::= COLUMNKW",
- /* 396 */ "vtabarglist ::= vtabarg",
- /* 397 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
- /* 398 */ "vtabarg ::= vtabarg vtabargtoken",
- /* 399 */ "anylist ::=",
- /* 400 */ "anylist ::= anylist LP anylist RP",
- /* 401 */ "anylist ::= anylist ANY",
- /* 402 */ "with ::=",
- /* 403 */ "windowdefn_list ::= windowdefn",
- /* 404 */ "window ::= frame_opt",
+ /* 95 */ "oneselect ::= mvalues",
+ /* 96 */ "mvalues ::= values COMMA LP nexprlist RP",
+ /* 97 */ "mvalues ::= mvalues COMMA LP nexprlist RP",
+ /* 98 */ "distinct ::= DISTINCT",
+ /* 99 */ "distinct ::= ALL",
+ /* 100 */ "distinct ::=",
+ /* 101 */ "sclp ::=",
+ /* 102 */ "selcollist ::= sclp scanpt expr scanpt as",
+ /* 103 */ "selcollist ::= sclp scanpt STAR",
+ /* 104 */ "selcollist ::= sclp scanpt nm DOT STAR",
+ /* 105 */ "as ::= AS nm",
+ /* 106 */ "as ::=",
+ /* 107 */ "from ::=",
+ /* 108 */ "from ::= FROM seltablist",
+ /* 109 */ "stl_prefix ::= seltablist joinop",
+ /* 110 */ "stl_prefix ::=",
+ /* 111 */ "seltablist ::= stl_prefix nm dbnm as on_using",
+ /* 112 */ "seltablist ::= stl_prefix nm dbnm as indexed_by on_using",
+ /* 113 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using",
+ /* 114 */ "seltablist ::= stl_prefix LP select RP as on_using",
+ /* 115 */ "seltablist ::= stl_prefix LP seltablist RP as on_using",
+ /* 116 */ "dbnm ::=",
+ /* 117 */ "dbnm ::= DOT nm",
+ /* 118 */ "fullname ::= nm",
+ /* 119 */ "fullname ::= nm DOT nm",
+ /* 120 */ "xfullname ::= nm",
+ /* 121 */ "xfullname ::= nm DOT nm",
+ /* 122 */ "xfullname ::= nm DOT nm AS nm",
+ /* 123 */ "xfullname ::= nm AS nm",
+ /* 124 */ "joinop ::= COMMA|JOIN",
+ /* 125 */ "joinop ::= JOIN_KW JOIN",
+ /* 126 */ "joinop ::= JOIN_KW nm JOIN",
+ /* 127 */ "joinop ::= JOIN_KW nm nm JOIN",
+ /* 128 */ "on_using ::= ON expr",
+ /* 129 */ "on_using ::= USING LP idlist RP",
+ /* 130 */ "on_using ::=",
+ /* 131 */ "indexed_opt ::=",
+ /* 132 */ "indexed_by ::= INDEXED BY nm",
+ /* 133 */ "indexed_by ::= NOT INDEXED",
+ /* 134 */ "orderby_opt ::=",
+ /* 135 */ "orderby_opt ::= ORDER BY sortlist",
+ /* 136 */ "sortlist ::= sortlist COMMA expr sortorder nulls",
+ /* 137 */ "sortlist ::= expr sortorder nulls",
+ /* 138 */ "sortorder ::= ASC",
+ /* 139 */ "sortorder ::= DESC",
+ /* 140 */ "sortorder ::=",
+ /* 141 */ "nulls ::= NULLS FIRST",
+ /* 142 */ "nulls ::= NULLS LAST",
+ /* 143 */ "nulls ::=",
+ /* 144 */ "groupby_opt ::=",
+ /* 145 */ "groupby_opt ::= GROUP BY nexprlist",
+ /* 146 */ "having_opt ::=",
+ /* 147 */ "having_opt ::= HAVING expr",
+ /* 148 */ "limit_opt ::=",
+ /* 149 */ "limit_opt ::= LIMIT expr",
+ /* 150 */ "limit_opt ::= LIMIT expr OFFSET expr",
+ /* 151 */ "limit_opt ::= LIMIT expr COMMA expr",
+ /* 152 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret",
+ /* 153 */ "where_opt ::=",
+ /* 154 */ "where_opt ::= WHERE expr",
+ /* 155 */ "where_opt_ret ::=",
+ /* 156 */ "where_opt_ret ::= WHERE expr",
+ /* 157 */ "where_opt_ret ::= RETURNING selcollist",
+ /* 158 */ "where_opt_ret ::= WHERE expr RETURNING selcollist",
+ /* 159 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret",
+ /* 160 */ "setlist ::= setlist COMMA nm EQ expr",
+ /* 161 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
+ /* 162 */ "setlist ::= nm EQ expr",
+ /* 163 */ "setlist ::= LP idlist RP EQ expr",
+ /* 164 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
+ /* 165 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning",
+ /* 166 */ "upsert ::=",
+ /* 167 */ "upsert ::= RETURNING selcollist",
+ /* 168 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert",
+ /* 169 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert",
+ /* 170 */ "upsert ::= ON CONFLICT DO NOTHING returning",
+ /* 171 */ "upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning",
+ /* 172 */ "returning ::= RETURNING selcollist",
+ /* 173 */ "insert_cmd ::= INSERT orconf",
+ /* 174 */ "insert_cmd ::= REPLACE",
+ /* 175 */ "idlist_opt ::=",
+ /* 176 */ "idlist_opt ::= LP idlist RP",
+ /* 177 */ "idlist ::= idlist COMMA nm",
+ /* 178 */ "idlist ::= nm",
+ /* 179 */ "expr ::= LP expr RP",
+ /* 180 */ "expr ::= ID|INDEXED|JOIN_KW",
+ /* 181 */ "expr ::= nm DOT nm",
+ /* 182 */ "expr ::= nm DOT nm DOT nm",
+ /* 183 */ "term ::= NULL|FLOAT|BLOB",
+ /* 184 */ "term ::= STRING",
+ /* 185 */ "term ::= INTEGER",
+ /* 186 */ "expr ::= VARIABLE",
+ /* 187 */ "expr ::= expr COLLATE ID|STRING",
+ /* 188 */ "expr ::= CAST LP expr AS typetoken RP",
+ /* 189 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP",
+ /* 190 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP",
+ /* 191 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP",
+ /* 192 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over",
+ /* 193 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over",
+ /* 194 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over",
+ /* 195 */ "term ::= CTIME_KW",
+ /* 196 */ "expr ::= LP nexprlist COMMA expr RP",
+ /* 197 */ "expr ::= expr AND expr",
+ /* 198 */ "expr ::= expr OR expr",
+ /* 199 */ "expr ::= expr LT|GT|GE|LE expr",
+ /* 200 */ "expr ::= expr EQ|NE expr",
+ /* 201 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
+ /* 202 */ "expr ::= expr PLUS|MINUS expr",
+ /* 203 */ "expr ::= expr STAR|SLASH|REM expr",
+ /* 204 */ "expr ::= expr CONCAT expr",
+ /* 205 */ "likeop ::= NOT LIKE_KW|MATCH",
+ /* 206 */ "expr ::= expr likeop expr",
+ /* 207 */ "expr ::= expr likeop expr ESCAPE expr",
+ /* 208 */ "expr ::= expr ISNULL|NOTNULL",
+ /* 209 */ "expr ::= expr NOT NULL",
+ /* 210 */ "expr ::= expr IS expr",
+ /* 211 */ "expr ::= expr IS NOT expr",
+ /* 212 */ "expr ::= expr IS NOT DISTINCT FROM expr",
+ /* 213 */ "expr ::= expr IS DISTINCT FROM expr",
+ /* 214 */ "expr ::= NOT expr",
+ /* 215 */ "expr ::= BITNOT expr",
+ /* 216 */ "expr ::= PLUS|MINUS expr",
+ /* 217 */ "expr ::= expr PTR expr",
+ /* 218 */ "between_op ::= BETWEEN",
+ /* 219 */ "between_op ::= NOT BETWEEN",
+ /* 220 */ "expr ::= expr between_op expr AND expr",
+ /* 221 */ "in_op ::= IN",
+ /* 222 */ "in_op ::= NOT IN",
+ /* 223 */ "expr ::= expr in_op LP exprlist RP",
+ /* 224 */ "expr ::= LP select RP",
+ /* 225 */ "expr ::= expr in_op LP select RP",
+ /* 226 */ "expr ::= expr in_op nm dbnm paren_exprlist",
+ /* 227 */ "expr ::= EXISTS LP select RP",
+ /* 228 */ "expr ::= CASE case_operand case_exprlist case_else END",
+ /* 229 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
+ /* 230 */ "case_exprlist ::= WHEN expr THEN expr",
+ /* 231 */ "case_else ::= ELSE expr",
+ /* 232 */ "case_else ::=",
+ /* 233 */ "case_operand ::=",
+ /* 234 */ "exprlist ::=",
+ /* 235 */ "nexprlist ::= nexprlist COMMA expr",
+ /* 236 */ "nexprlist ::= expr",
+ /* 237 */ "paren_exprlist ::=",
+ /* 238 */ "paren_exprlist ::= LP exprlist RP",
+ /* 239 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
+ /* 240 */ "uniqueflag ::= UNIQUE",
+ /* 241 */ "uniqueflag ::=",
+ /* 242 */ "eidlist_opt ::=",
+ /* 243 */ "eidlist_opt ::= LP eidlist RP",
+ /* 244 */ "eidlist ::= eidlist COMMA nm collate sortorder",
+ /* 245 */ "eidlist ::= nm collate sortorder",
+ /* 246 */ "collate ::=",
+ /* 247 */ "collate ::= COLLATE ID|STRING",
+ /* 248 */ "cmd ::= DROP INDEX ifexists fullname",
+ /* 249 */ "cmd ::= VACUUM vinto",
+ /* 250 */ "cmd ::= VACUUM nm vinto",
+ /* 251 */ "vinto ::= INTO expr",
+ /* 252 */ "vinto ::=",
+ /* 253 */ "cmd ::= PRAGMA nm dbnm",
+ /* 254 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
+ /* 255 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
+ /* 256 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
+ /* 257 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
+ /* 258 */ "plus_num ::= PLUS INTEGER|FLOAT",
+ /* 259 */ "minus_num ::= MINUS INTEGER|FLOAT",
+ /* 260 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
+ /* 261 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
+ /* 262 */ "trigger_time ::= BEFORE|AFTER",
+ /* 263 */ "trigger_time ::= INSTEAD OF",
+ /* 264 */ "trigger_time ::=",
+ /* 265 */ "trigger_event ::= DELETE|INSERT",
+ /* 266 */ "trigger_event ::= UPDATE",
+ /* 267 */ "trigger_event ::= UPDATE OF idlist",
+ /* 268 */ "when_clause ::=",
+ /* 269 */ "when_clause ::= WHEN expr",
+ /* 270 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
+ /* 271 */ "trigger_cmd_list ::= trigger_cmd SEMI",
+ /* 272 */ "trnm ::= nm DOT nm",
+ /* 273 */ "tridxby ::= INDEXED BY nm",
+ /* 274 */ "tridxby ::= NOT INDEXED",
+ /* 275 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
+ /* 276 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
+ /* 277 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
+ /* 278 */ "trigger_cmd ::= scanpt select scanpt",
+ /* 279 */ "expr ::= RAISE LP IGNORE RP",
+ /* 280 */ "expr ::= RAISE LP raisetype COMMA nm RP",
+ /* 281 */ "raisetype ::= ROLLBACK",
+ /* 282 */ "raisetype ::= ABORT",
+ /* 283 */ "raisetype ::= FAIL",
+ /* 284 */ "cmd ::= DROP TRIGGER ifexists fullname",
+ /* 285 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
+ /* 286 */ "cmd ::= DETACH database_kw_opt expr",
+ /* 287 */ "key_opt ::=",
+ /* 288 */ "key_opt ::= KEY expr",
+ /* 289 */ "cmd ::= REINDEX",
+ /* 290 */ "cmd ::= REINDEX nm dbnm",
+ /* 291 */ "cmd ::= ANALYZE",
+ /* 292 */ "cmd ::= ANALYZE nm dbnm",
+ /* 293 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
+ /* 294 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
+ /* 295 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
+ /* 296 */ "add_column_fullname ::= fullname",
+ /* 297 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
+ /* 298 */ "cmd ::= create_vtab",
+ /* 299 */ "cmd ::= create_vtab LP vtabarglist RP",
+ /* 300 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
+ /* 301 */ "vtabarg ::=",
+ /* 302 */ "vtabargtoken ::= ANY",
+ /* 303 */ "vtabargtoken ::= lp anylist RP",
+ /* 304 */ "lp ::= LP",
+ /* 305 */ "with ::= WITH wqlist",
+ /* 306 */ "with ::= WITH RECURSIVE wqlist",
+ /* 307 */ "wqas ::= AS",
+ /* 308 */ "wqas ::= AS MATERIALIZED",
+ /* 309 */ "wqas ::= AS NOT MATERIALIZED",
+ /* 310 */ "wqitem ::= withnm eidlist_opt wqas LP select RP",
+ /* 311 */ "withnm ::= nm",
+ /* 312 */ "wqlist ::= wqitem",
+ /* 313 */ "wqlist ::= wqlist COMMA wqitem",
+ /* 314 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
+ /* 315 */ "windowdefn ::= nm AS LP window RP",
+ /* 316 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
+ /* 317 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
+ /* 318 */ "window ::= ORDER BY sortlist frame_opt",
+ /* 319 */ "window ::= nm ORDER BY sortlist frame_opt",
+ /* 320 */ "window ::= nm frame_opt",
+ /* 321 */ "frame_opt ::=",
+ /* 322 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
+ /* 323 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
+ /* 324 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
+ /* 325 */ "frame_bound_s ::= frame_bound",
+ /* 326 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
+ /* 327 */ "frame_bound_e ::= frame_bound",
+ /* 328 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
+ /* 329 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
+ /* 330 */ "frame_bound ::= CURRENT ROW",
+ /* 331 */ "frame_exclude_opt ::=",
+ /* 332 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
+ /* 333 */ "frame_exclude ::= NO OTHERS",
+ /* 334 */ "frame_exclude ::= CURRENT ROW",
+ /* 335 */ "frame_exclude ::= GROUP|TIES",
+ /* 336 */ "window_clause ::= WINDOW windowdefn_list",
+ /* 337 */ "filter_over ::= filter_clause over_clause",
+ /* 338 */ "filter_over ::= over_clause",
+ /* 339 */ "filter_over ::= filter_clause",
+ /* 340 */ "over_clause ::= OVER LP window RP",
+ /* 341 */ "over_clause ::= OVER nm",
+ /* 342 */ "filter_clause ::= FILTER LP WHERE expr RP",
+ /* 343 */ "term ::= QNUMBER",
+ /* 344 */ "input ::= cmdlist",
+ /* 345 */ "cmdlist ::= cmdlist ecmd",
+ /* 346 */ "cmdlist ::= ecmd",
+ /* 347 */ "ecmd ::= SEMI",
+ /* 348 */ "ecmd ::= cmdx SEMI",
+ /* 349 */ "ecmd ::= explain cmdx SEMI",
+ /* 350 */ "trans_opt ::=",
+ /* 351 */ "trans_opt ::= TRANSACTION",
+ /* 352 */ "trans_opt ::= TRANSACTION nm",
+ /* 353 */ "savepoint_opt ::= SAVEPOINT",
+ /* 354 */ "savepoint_opt ::=",
+ /* 355 */ "cmd ::= create_table create_table_args",
+ /* 356 */ "table_option_set ::= table_option",
+ /* 357 */ "columnlist ::= columnlist COMMA columnname carglist",
+ /* 358 */ "columnlist ::= columnname carglist",
+ /* 359 */ "nm ::= ID|INDEXED|JOIN_KW",
+ /* 360 */ "nm ::= STRING",
+ /* 361 */ "typetoken ::= typename",
+ /* 362 */ "typename ::= ID|STRING",
+ /* 363 */ "signed ::= plus_num",
+ /* 364 */ "signed ::= minus_num",
+ /* 365 */ "carglist ::= carglist ccons",
+ /* 366 */ "carglist ::=",
+ /* 367 */ "ccons ::= NULL onconf",
+ /* 368 */ "ccons ::= GENERATED ALWAYS AS generated",
+ /* 369 */ "ccons ::= AS generated",
+ /* 370 */ "conslist_opt ::= COMMA conslist",
+ /* 371 */ "conslist ::= conslist tconscomma tcons",
+ /* 372 */ "conslist ::= tcons",
+ /* 373 */ "tconscomma ::=",
+ /* 374 */ "defer_subclause_opt ::= defer_subclause",
+ /* 375 */ "resolvetype ::= raisetype",
+ /* 376 */ "selectnowith ::= oneselect",
+ /* 377 */ "oneselect ::= values",
+ /* 378 */ "sclp ::= selcollist COMMA",
+ /* 379 */ "as ::= ID|STRING",
+ /* 380 */ "indexed_opt ::= indexed_by",
+ /* 381 */ "returning ::=",
+ /* 382 */ "expr ::= term",
+ /* 383 */ "likeop ::= LIKE_KW|MATCH",
+ /* 384 */ "case_operand ::= expr",
+ /* 385 */ "exprlist ::= nexprlist",
+ /* 386 */ "nmnum ::= plus_num",
+ /* 387 */ "nmnum ::= nm",
+ /* 388 */ "nmnum ::= ON",
+ /* 389 */ "nmnum ::= DELETE",
+ /* 390 */ "nmnum ::= DEFAULT",
+ /* 391 */ "plus_num ::= INTEGER|FLOAT",
+ /* 392 */ "foreach_clause ::=",
+ /* 393 */ "foreach_clause ::= FOR EACH ROW",
+ /* 394 */ "trnm ::= nm",
+ /* 395 */ "tridxby ::=",
+ /* 396 */ "database_kw_opt ::= DATABASE",
+ /* 397 */ "database_kw_opt ::=",
+ /* 398 */ "kwcolumn_opt ::=",
+ /* 399 */ "kwcolumn_opt ::= COLUMNKW",
+ /* 400 */ "vtabarglist ::= vtabarg",
+ /* 401 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
+ /* 402 */ "vtabarg ::= vtabarg vtabargtoken",
+ /* 403 */ "anylist ::=",
+ /* 404 */ "anylist ::= anylist LP anylist RP",
+ /* 405 */ "anylist ::= anylist ANY",
+ /* 406 */ "with ::=",
+ /* 407 */ "windowdefn_list ::= windowdefn",
+ /* 408 */ "window ::= frame_opt",
};
#endif /* NDEBUG */
-#if YYSTACKDEPTH<=0
+#if YYGROWABLESTACK
/*
** Try to increase the size of the parser stack. Return the number
** of errors. Return 0 on success.
*/
static int yyGrowStack(yyParser *p){
+ int oldSize = 1 + (int)(p->yystackEnd - p->yystack);
int newSize;
int idx;
yyStackEntry *pNew;
- newSize = p->yystksz*2 + 100;
- idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
- if( p->yystack==&p->yystk0 ){
- pNew = malloc(newSize*sizeof(pNew[0]));
- if( pNew ) pNew[0] = p->yystk0;
+ newSize = oldSize*2 + 100;
+ idx = (int)(p->yytos - p->yystack);
+ if( p->yystack==p->yystk0 ){
+ pNew = YYREALLOC(0, newSize*sizeof(pNew[0]));
+ if( pNew==0 ) return 1;
+ memcpy(pNew, p->yystack, oldSize*sizeof(pNew[0]));
}else{
- pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
+ pNew = YYREALLOC(p->yystack, newSize*sizeof(pNew[0]));
+ if( pNew==0 ) return 1;
}
- if( pNew ){
- p->yystack = pNew;
- p->yytos = &p->yystack[idx];
+ p->yystack = pNew;
+ p->yytos = &p->yystack[idx];
#ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
- yyTracePrompt, p->yystksz, newSize);
- }
-#endif
- p->yystksz = newSize;
+ if( yyTraceFILE ){
+ fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
+ yyTracePrompt, oldSize, newSize);
}
- return pNew==0;
+#endif
+ p->yystackEnd = &p->yystack[newSize-1];
+ return 0;
}
+#endif /* YYGROWABLESTACK */
+
+#if !YYGROWABLESTACK
+/* For builds that do no have a growable stack, yyGrowStack always
+** returns an error.
+*/
+# define yyGrowStack(X) 1
#endif
/* Datatype of the argument to the memory allocated passed as the
@@ -173406,24 +174798,14 @@ SQLITE_PRIVATE void sqlite3ParserInit(void *yypRawParser sqlite3ParserCTX_PDECL)
#ifdef YYTRACKMAXSTACKDEPTH
yypParser->yyhwm = 0;
#endif
-#if YYSTACKDEPTH<=0
- yypParser->yytos = NULL;
- yypParser->yystack = NULL;
- yypParser->yystksz = 0;
- if( yyGrowStack(yypParser) ){
- yypParser->yystack = &yypParser->yystk0;
- yypParser->yystksz = 1;
- }
-#endif
+ yypParser->yystack = yypParser->yystk0;
+ yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
#ifndef YYNOERRORRECOVERY
yypParser->yyerrcnt = -1;
#endif
yypParser->yytos = yypParser->yystack;
yypParser->yystack[0].stateno = 0;
yypParser->yystack[0].major = 0;
-#if YYSTACKDEPTH>0
- yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
-#endif
}
#ifndef sqlite3Parser_ENGINEALWAYSONSTACK
@@ -173477,97 +174859,98 @@ static void yy_destructor(
** inside the C code.
*/
/********* Begin destructor definitions ***************************************/
- case 204: /* select */
- case 239: /* selectnowith */
- case 240: /* oneselect */
- case 252: /* values */
+ case 205: /* select */
+ case 240: /* selectnowith */
+ case 241: /* oneselect */
+ case 253: /* values */
+ case 255: /* mvalues */
{
-sqlite3SelectDelete(pParse->db, (yypminor->yy47));
-}
- break;
- case 216: /* term */
- case 217: /* expr */
- case 246: /* where_opt */
- case 248: /* having_opt */
- case 267: /* where_opt_ret */
- case 278: /* case_operand */
- case 280: /* case_else */
- case 283: /* vinto */
- case 290: /* when_clause */
- case 295: /* key_opt */
- case 311: /* filter_clause */
+sqlite3SelectDelete(pParse->db, (yypminor->yy555));
+}
+ break;
+ case 217: /* term */
+ case 218: /* expr */
+ case 247: /* where_opt */
+ case 249: /* having_opt */
+ case 269: /* where_opt_ret */
+ case 280: /* case_operand */
+ case 282: /* case_else */
+ case 285: /* vinto */
+ case 292: /* when_clause */
+ case 297: /* key_opt */
+ case 314: /* filter_clause */
{
-sqlite3ExprDelete(pParse->db, (yypminor->yy528));
-}
- break;
- case 221: /* eidlist_opt */
- case 231: /* sortlist */
- case 232: /* eidlist */
- case 244: /* selcollist */
- case 247: /* groupby_opt */
- case 249: /* orderby_opt */
- case 253: /* nexprlist */
- case 254: /* sclp */
- case 261: /* exprlist */
- case 268: /* setlist */
- case 277: /* paren_exprlist */
- case 279: /* case_exprlist */
- case 310: /* part_opt */
+sqlite3ExprDelete(pParse->db, (yypminor->yy454));
+}
+ break;
+ case 222: /* eidlist_opt */
+ case 232: /* sortlist */
+ case 233: /* eidlist */
+ case 245: /* selcollist */
+ case 248: /* groupby_opt */
+ case 250: /* orderby_opt */
+ case 254: /* nexprlist */
+ case 256: /* sclp */
+ case 263: /* exprlist */
+ case 270: /* setlist */
+ case 279: /* paren_exprlist */
+ case 281: /* case_exprlist */
+ case 313: /* part_opt */
{
-sqlite3ExprListDelete(pParse->db, (yypminor->yy322));
+sqlite3ExprListDelete(pParse->db, (yypminor->yy14));
}
break;
- case 238: /* fullname */
- case 245: /* from */
- case 256: /* seltablist */
- case 257: /* stl_prefix */
- case 262: /* xfullname */
+ case 239: /* fullname */
+ case 246: /* from */
+ case 258: /* seltablist */
+ case 259: /* stl_prefix */
+ case 264: /* xfullname */
{
-sqlite3SrcListDelete(pParse->db, (yypminor->yy131));
+sqlite3SrcListDelete(pParse->db, (yypminor->yy203));
}
break;
- case 241: /* wqlist */
+ case 242: /* wqlist */
{
-sqlite3WithDelete(pParse->db, (yypminor->yy521));
+sqlite3WithDelete(pParse->db, (yypminor->yy59));
}
break;
- case 251: /* window_clause */
- case 306: /* windowdefn_list */
+ case 252: /* window_clause */
+ case 309: /* windowdefn_list */
{
-sqlite3WindowListDelete(pParse->db, (yypminor->yy41));
+sqlite3WindowListDelete(pParse->db, (yypminor->yy211));
}
break;
- case 263: /* idlist */
- case 270: /* idlist_opt */
+ case 265: /* idlist */
+ case 272: /* idlist_opt */
{
-sqlite3IdListDelete(pParse->db, (yypminor->yy254));
+sqlite3IdListDelete(pParse->db, (yypminor->yy132));
}
break;
- case 273: /* filter_over */
- case 307: /* windowdefn */
- case 308: /* window */
- case 309: /* frame_opt */
- case 312: /* over_clause */
+ case 275: /* filter_over */
+ case 310: /* windowdefn */
+ case 311: /* window */
+ case 312: /* frame_opt */
+ case 315: /* over_clause */
{
-sqlite3WindowDelete(pParse->db, (yypminor->yy41));
+sqlite3WindowDelete(pParse->db, (yypminor->yy211));
}
break;
- case 286: /* trigger_cmd_list */
- case 291: /* trigger_cmd */
+ case 288: /* trigger_cmd_list */
+ case 293: /* trigger_cmd */
{
-sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy33));
+sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy427));
}
break;
- case 288: /* trigger_event */
+ case 290: /* trigger_event */
{
-sqlite3IdListDelete(pParse->db, (yypminor->yy180).b);
+sqlite3IdListDelete(pParse->db, (yypminor->yy286).b);
}
break;
- case 314: /* frame_bound */
- case 315: /* frame_bound_s */
- case 316: /* frame_bound_e */
+ case 317: /* frame_bound */
+ case 318: /* frame_bound_s */
+ case 319: /* frame_bound_e */
{
-sqlite3ExprDelete(pParse->db, (yypminor->yy595).pExpr);
+sqlite3ExprDelete(pParse->db, (yypminor->yy509).pExpr);
}
break;
/********* End destructor definitions *****************************************/
@@ -173601,9 +174984,26 @@ static void yy_pop_parser_stack(yyParser *pParser){
*/
SQLITE_PRIVATE void sqlite3ParserFinalize(void *p){
yyParser *pParser = (yyParser*)p;
- while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
-#if YYSTACKDEPTH<=0
- if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);
+
+ /* In-lined version of calling yy_pop_parser_stack() for each
+ ** element left in the stack */
+ yyStackEntry *yytos = pParser->yytos;
+ while( yytos>pParser->yystack ){
+#ifndef NDEBUG
+ if( yyTraceFILE ){
+ fprintf(yyTraceFILE,"%sPopping %s\n",
+ yyTracePrompt,
+ yyTokenName[yytos->major]);
+ }
+#endif
+ if( yytos->major>=YY_MIN_DSTRCTR ){
+ yy_destructor(pParser, yytos->major, &yytos->minor);
+ }
+ yytos--;
+ }
+
+#if YYGROWABLESTACK
+ if( pParser->yystack!=pParser->yystk0 ) YYFREE(pParser->yystack);
#endif
}
@@ -173786,7 +175186,7 @@ static void yyStackOverflow(yyParser *yypParser){
** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
- sqlite3ErrorMsg(pParse, "parser stack overflow");
+ sqlite3OomFault(pParse->db);
/******** End %stack_overflow code ********************************************/
sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument var */
sqlite3ParserCTX_STORE
@@ -173830,25 +175230,19 @@ static void yy_shift(
assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );
}
#endif
-#if YYSTACKDEPTH>0
- if( yypParser->yytos>yypParser->yystackEnd ){
- yypParser->yytos--;
- yyStackOverflow(yypParser);
- return;
- }
-#else
- if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){
+ yytos = yypParser->yytos;
+ if( yytos>yypParser->yystackEnd ){
if( yyGrowStack(yypParser) ){
yypParser->yytos--;
yyStackOverflow(yypParser);
return;
}
+ yytos = yypParser->yytos;
+ assert( yytos <= yypParser->yystackEnd );
}
-#endif
if( yyNewState > YY_MAX_SHIFT ){
yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
}
- yytos = yypParser->yytos;
yytos->stateno = yyNewState;
yytos->major = yyMajor;
yytos->minor.yy0 = yyMinor;
@@ -173858,411 +175252,415 @@ static void yy_shift(
/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
** of that rule */
static const YYCODETYPE yyRuleInfoLhs[] = {
- 189, /* (0) explain ::= EXPLAIN */
- 189, /* (1) explain ::= EXPLAIN QUERY PLAN */
- 188, /* (2) cmdx ::= cmd */
- 190, /* (3) cmd ::= BEGIN transtype trans_opt */
- 191, /* (4) transtype ::= */
- 191, /* (5) transtype ::= DEFERRED */
- 191, /* (6) transtype ::= IMMEDIATE */
- 191, /* (7) transtype ::= EXCLUSIVE */
- 190, /* (8) cmd ::= COMMIT|END trans_opt */
- 190, /* (9) cmd ::= ROLLBACK trans_opt */
- 190, /* (10) cmd ::= SAVEPOINT nm */
- 190, /* (11) cmd ::= RELEASE savepoint_opt nm */
- 190, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
- 195, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
- 197, /* (14) createkw ::= CREATE */
- 199, /* (15) ifnotexists ::= */
- 199, /* (16) ifnotexists ::= IF NOT EXISTS */
- 198, /* (17) temp ::= TEMP */
- 198, /* (18) temp ::= */
- 196, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */
- 196, /* (20) create_table_args ::= AS select */
- 203, /* (21) table_option_set ::= */
- 203, /* (22) table_option_set ::= table_option_set COMMA table_option */
- 205, /* (23) table_option ::= WITHOUT nm */
- 205, /* (24) table_option ::= nm */
- 206, /* (25) columnname ::= nm typetoken */
- 208, /* (26) typetoken ::= */
- 208, /* (27) typetoken ::= typename LP signed RP */
- 208, /* (28) typetoken ::= typename LP signed COMMA signed RP */
- 209, /* (29) typename ::= typename ID|STRING */
- 213, /* (30) scanpt ::= */
- 214, /* (31) scantok ::= */
- 215, /* (32) ccons ::= CONSTRAINT nm */
- 215, /* (33) ccons ::= DEFAULT scantok term */
- 215, /* (34) ccons ::= DEFAULT LP expr RP */
- 215, /* (35) ccons ::= DEFAULT PLUS scantok term */
- 215, /* (36) ccons ::= DEFAULT MINUS scantok term */
- 215, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */
- 215, /* (38) ccons ::= NOT NULL onconf */
- 215, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */
- 215, /* (40) ccons ::= UNIQUE onconf */
- 215, /* (41) ccons ::= CHECK LP expr RP */
- 215, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */
- 215, /* (43) ccons ::= defer_subclause */
- 215, /* (44) ccons ::= COLLATE ID|STRING */
- 224, /* (45) generated ::= LP expr RP */
- 224, /* (46) generated ::= LP expr RP ID */
- 220, /* (47) autoinc ::= */
- 220, /* (48) autoinc ::= AUTOINCR */
- 222, /* (49) refargs ::= */
- 222, /* (50) refargs ::= refargs refarg */
- 225, /* (51) refarg ::= MATCH nm */
- 225, /* (52) refarg ::= ON INSERT refact */
- 225, /* (53) refarg ::= ON DELETE refact */
- 225, /* (54) refarg ::= ON UPDATE refact */
- 226, /* (55) refact ::= SET NULL */
- 226, /* (56) refact ::= SET DEFAULT */
- 226, /* (57) refact ::= CASCADE */
- 226, /* (58) refact ::= RESTRICT */
- 226, /* (59) refact ::= NO ACTION */
- 223, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
- 223, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
- 227, /* (62) init_deferred_pred_opt ::= */
- 227, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */
- 227, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
- 202, /* (65) conslist_opt ::= */
- 229, /* (66) tconscomma ::= COMMA */
- 230, /* (67) tcons ::= CONSTRAINT nm */
- 230, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
- 230, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */
- 230, /* (70) tcons ::= CHECK LP expr RP onconf */
- 230, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
- 233, /* (72) defer_subclause_opt ::= */
- 218, /* (73) onconf ::= */
- 218, /* (74) onconf ::= ON CONFLICT resolvetype */
- 234, /* (75) orconf ::= */
- 234, /* (76) orconf ::= OR resolvetype */
- 235, /* (77) resolvetype ::= IGNORE */
- 235, /* (78) resolvetype ::= REPLACE */
- 190, /* (79) cmd ::= DROP TABLE ifexists fullname */
- 237, /* (80) ifexists ::= IF EXISTS */
- 237, /* (81) ifexists ::= */
- 190, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
- 190, /* (83) cmd ::= DROP VIEW ifexists fullname */
- 190, /* (84) cmd ::= select */
- 204, /* (85) select ::= WITH wqlist selectnowith */
- 204, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */
- 204, /* (87) select ::= selectnowith */
- 239, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */
- 242, /* (89) multiselect_op ::= UNION */
- 242, /* (90) multiselect_op ::= UNION ALL */
- 242, /* (91) multiselect_op ::= EXCEPT|INTERSECT */
- 240, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
- 240, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
- 252, /* (94) values ::= VALUES LP nexprlist RP */
- 252, /* (95) values ::= values COMMA LP nexprlist RP */
- 243, /* (96) distinct ::= DISTINCT */
- 243, /* (97) distinct ::= ALL */
- 243, /* (98) distinct ::= */
- 254, /* (99) sclp ::= */
- 244, /* (100) selcollist ::= sclp scanpt expr scanpt as */
- 244, /* (101) selcollist ::= sclp scanpt STAR */
- 244, /* (102) selcollist ::= sclp scanpt nm DOT STAR */
- 255, /* (103) as ::= AS nm */
- 255, /* (104) as ::= */
- 245, /* (105) from ::= */
- 245, /* (106) from ::= FROM seltablist */
- 257, /* (107) stl_prefix ::= seltablist joinop */
- 257, /* (108) stl_prefix ::= */
- 256, /* (109) seltablist ::= stl_prefix nm dbnm as on_using */
- 256, /* (110) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
- 256, /* (111) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
- 256, /* (112) seltablist ::= stl_prefix LP select RP as on_using */
- 256, /* (113) seltablist ::= stl_prefix LP seltablist RP as on_using */
- 200, /* (114) dbnm ::= */
- 200, /* (115) dbnm ::= DOT nm */
- 238, /* (116) fullname ::= nm */
- 238, /* (117) fullname ::= nm DOT nm */
- 262, /* (118) xfullname ::= nm */
- 262, /* (119) xfullname ::= nm DOT nm */
- 262, /* (120) xfullname ::= nm DOT nm AS nm */
- 262, /* (121) xfullname ::= nm AS nm */
- 258, /* (122) joinop ::= COMMA|JOIN */
- 258, /* (123) joinop ::= JOIN_KW JOIN */
- 258, /* (124) joinop ::= JOIN_KW nm JOIN */
- 258, /* (125) joinop ::= JOIN_KW nm nm JOIN */
- 259, /* (126) on_using ::= ON expr */
- 259, /* (127) on_using ::= USING LP idlist RP */
- 259, /* (128) on_using ::= */
- 264, /* (129) indexed_opt ::= */
- 260, /* (130) indexed_by ::= INDEXED BY nm */
- 260, /* (131) indexed_by ::= NOT INDEXED */
- 249, /* (132) orderby_opt ::= */
- 249, /* (133) orderby_opt ::= ORDER BY sortlist */
- 231, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */
- 231, /* (135) sortlist ::= expr sortorder nulls */
- 219, /* (136) sortorder ::= ASC */
- 219, /* (137) sortorder ::= DESC */
- 219, /* (138) sortorder ::= */
- 265, /* (139) nulls ::= NULLS FIRST */
- 265, /* (140) nulls ::= NULLS LAST */
- 265, /* (141) nulls ::= */
- 247, /* (142) groupby_opt ::= */
- 247, /* (143) groupby_opt ::= GROUP BY nexprlist */
- 248, /* (144) having_opt ::= */
- 248, /* (145) having_opt ::= HAVING expr */
- 250, /* (146) limit_opt ::= */
- 250, /* (147) limit_opt ::= LIMIT expr */
- 250, /* (148) limit_opt ::= LIMIT expr OFFSET expr */
- 250, /* (149) limit_opt ::= LIMIT expr COMMA expr */
- 190, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
- 246, /* (151) where_opt ::= */
- 246, /* (152) where_opt ::= WHERE expr */
- 267, /* (153) where_opt_ret ::= */
- 267, /* (154) where_opt_ret ::= WHERE expr */
- 267, /* (155) where_opt_ret ::= RETURNING selcollist */
- 267, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */
- 190, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
- 268, /* (158) setlist ::= setlist COMMA nm EQ expr */
- 268, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */
- 268, /* (160) setlist ::= nm EQ expr */
- 268, /* (161) setlist ::= LP idlist RP EQ expr */
- 190, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
- 190, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
- 271, /* (164) upsert ::= */
- 271, /* (165) upsert ::= RETURNING selcollist */
- 271, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
- 271, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
- 271, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */
- 271, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
- 272, /* (170) returning ::= RETURNING selcollist */
- 269, /* (171) insert_cmd ::= INSERT orconf */
- 269, /* (172) insert_cmd ::= REPLACE */
- 270, /* (173) idlist_opt ::= */
- 270, /* (174) idlist_opt ::= LP idlist RP */
- 263, /* (175) idlist ::= idlist COMMA nm */
- 263, /* (176) idlist ::= nm */
- 217, /* (177) expr ::= LP expr RP */
- 217, /* (178) expr ::= ID|INDEXED|JOIN_KW */
- 217, /* (179) expr ::= nm DOT nm */
- 217, /* (180) expr ::= nm DOT nm DOT nm */
- 216, /* (181) term ::= NULL|FLOAT|BLOB */
- 216, /* (182) term ::= STRING */
- 216, /* (183) term ::= INTEGER */
- 217, /* (184) expr ::= VARIABLE */
- 217, /* (185) expr ::= expr COLLATE ID|STRING */
- 217, /* (186) expr ::= CAST LP expr AS typetoken RP */
- 217, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
- 217, /* (188) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
- 217, /* (189) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
- 217, /* (190) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
- 217, /* (191) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
- 217, /* (192) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
- 216, /* (193) term ::= CTIME_KW */
- 217, /* (194) expr ::= LP nexprlist COMMA expr RP */
- 217, /* (195) expr ::= expr AND expr */
- 217, /* (196) expr ::= expr OR expr */
- 217, /* (197) expr ::= expr LT|GT|GE|LE expr */
- 217, /* (198) expr ::= expr EQ|NE expr */
- 217, /* (199) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
- 217, /* (200) expr ::= expr PLUS|MINUS expr */
- 217, /* (201) expr ::= expr STAR|SLASH|REM expr */
- 217, /* (202) expr ::= expr CONCAT expr */
- 274, /* (203) likeop ::= NOT LIKE_KW|MATCH */
- 217, /* (204) expr ::= expr likeop expr */
- 217, /* (205) expr ::= expr likeop expr ESCAPE expr */
- 217, /* (206) expr ::= expr ISNULL|NOTNULL */
- 217, /* (207) expr ::= expr NOT NULL */
- 217, /* (208) expr ::= expr IS expr */
- 217, /* (209) expr ::= expr IS NOT expr */
- 217, /* (210) expr ::= expr IS NOT DISTINCT FROM expr */
- 217, /* (211) expr ::= expr IS DISTINCT FROM expr */
- 217, /* (212) expr ::= NOT expr */
- 217, /* (213) expr ::= BITNOT expr */
- 217, /* (214) expr ::= PLUS|MINUS expr */
- 217, /* (215) expr ::= expr PTR expr */
- 275, /* (216) between_op ::= BETWEEN */
- 275, /* (217) between_op ::= NOT BETWEEN */
- 217, /* (218) expr ::= expr between_op expr AND expr */
- 276, /* (219) in_op ::= IN */
- 276, /* (220) in_op ::= NOT IN */
- 217, /* (221) expr ::= expr in_op LP exprlist RP */
- 217, /* (222) expr ::= LP select RP */
- 217, /* (223) expr ::= expr in_op LP select RP */
- 217, /* (224) expr ::= expr in_op nm dbnm paren_exprlist */
- 217, /* (225) expr ::= EXISTS LP select RP */
- 217, /* (226) expr ::= CASE case_operand case_exprlist case_else END */
- 279, /* (227) case_exprlist ::= case_exprlist WHEN expr THEN expr */
- 279, /* (228) case_exprlist ::= WHEN expr THEN expr */
- 280, /* (229) case_else ::= ELSE expr */
- 280, /* (230) case_else ::= */
- 278, /* (231) case_operand ::= */
- 261, /* (232) exprlist ::= */
- 253, /* (233) nexprlist ::= nexprlist COMMA expr */
- 253, /* (234) nexprlist ::= expr */
- 277, /* (235) paren_exprlist ::= */
- 277, /* (236) paren_exprlist ::= LP exprlist RP */
- 190, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
- 281, /* (238) uniqueflag ::= UNIQUE */
- 281, /* (239) uniqueflag ::= */
- 221, /* (240) eidlist_opt ::= */
- 221, /* (241) eidlist_opt ::= LP eidlist RP */
- 232, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
- 232, /* (243) eidlist ::= nm collate sortorder */
- 282, /* (244) collate ::= */
- 282, /* (245) collate ::= COLLATE ID|STRING */
- 190, /* (246) cmd ::= DROP INDEX ifexists fullname */
- 190, /* (247) cmd ::= VACUUM vinto */
- 190, /* (248) cmd ::= VACUUM nm vinto */
- 283, /* (249) vinto ::= INTO expr */
- 283, /* (250) vinto ::= */
- 190, /* (251) cmd ::= PRAGMA nm dbnm */
- 190, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
- 190, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
- 190, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
- 190, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
- 211, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
- 212, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
- 190, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
- 285, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
- 287, /* (260) trigger_time ::= BEFORE|AFTER */
- 287, /* (261) trigger_time ::= INSTEAD OF */
- 287, /* (262) trigger_time ::= */
- 288, /* (263) trigger_event ::= DELETE|INSERT */
- 288, /* (264) trigger_event ::= UPDATE */
- 288, /* (265) trigger_event ::= UPDATE OF idlist */
- 290, /* (266) when_clause ::= */
- 290, /* (267) when_clause ::= WHEN expr */
- 286, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
- 286, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
- 292, /* (270) trnm ::= nm DOT nm */
- 293, /* (271) tridxby ::= INDEXED BY nm */
- 293, /* (272) tridxby ::= NOT INDEXED */
- 291, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
- 291, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
- 291, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
- 291, /* (276) trigger_cmd ::= scanpt select scanpt */
- 217, /* (277) expr ::= RAISE LP IGNORE RP */
- 217, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
- 236, /* (279) raisetype ::= ROLLBACK */
- 236, /* (280) raisetype ::= ABORT */
- 236, /* (281) raisetype ::= FAIL */
- 190, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
- 190, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
- 190, /* (284) cmd ::= DETACH database_kw_opt expr */
- 295, /* (285) key_opt ::= */
- 295, /* (286) key_opt ::= KEY expr */
- 190, /* (287) cmd ::= REINDEX */
- 190, /* (288) cmd ::= REINDEX nm dbnm */
- 190, /* (289) cmd ::= ANALYZE */
- 190, /* (290) cmd ::= ANALYZE nm dbnm */
- 190, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
- 190, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
- 190, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
- 296, /* (294) add_column_fullname ::= fullname */
- 190, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
- 190, /* (296) cmd ::= create_vtab */
- 190, /* (297) cmd ::= create_vtab LP vtabarglist RP */
- 298, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
- 300, /* (299) vtabarg ::= */
- 301, /* (300) vtabargtoken ::= ANY */
- 301, /* (301) vtabargtoken ::= lp anylist RP */
- 302, /* (302) lp ::= LP */
- 266, /* (303) with ::= WITH wqlist */
- 266, /* (304) with ::= WITH RECURSIVE wqlist */
- 305, /* (305) wqas ::= AS */
- 305, /* (306) wqas ::= AS MATERIALIZED */
- 305, /* (307) wqas ::= AS NOT MATERIALIZED */
- 304, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
- 241, /* (309) wqlist ::= wqitem */
- 241, /* (310) wqlist ::= wqlist COMMA wqitem */
- 306, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */
- 307, /* (312) windowdefn ::= nm AS LP window RP */
- 308, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
- 308, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
- 308, /* (315) window ::= ORDER BY sortlist frame_opt */
- 308, /* (316) window ::= nm ORDER BY sortlist frame_opt */
- 308, /* (317) window ::= nm frame_opt */
- 309, /* (318) frame_opt ::= */
- 309, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
- 309, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
- 313, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */
- 315, /* (322) frame_bound_s ::= frame_bound */
- 315, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */
- 316, /* (324) frame_bound_e ::= frame_bound */
- 316, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */
- 314, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */
- 314, /* (327) frame_bound ::= CURRENT ROW */
- 317, /* (328) frame_exclude_opt ::= */
- 317, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */
- 318, /* (330) frame_exclude ::= NO OTHERS */
- 318, /* (331) frame_exclude ::= CURRENT ROW */
- 318, /* (332) frame_exclude ::= GROUP|TIES */
- 251, /* (333) window_clause ::= WINDOW windowdefn_list */
- 273, /* (334) filter_over ::= filter_clause over_clause */
- 273, /* (335) filter_over ::= over_clause */
- 273, /* (336) filter_over ::= filter_clause */
- 312, /* (337) over_clause ::= OVER LP window RP */
- 312, /* (338) over_clause ::= OVER nm */
- 311, /* (339) filter_clause ::= FILTER LP WHERE expr RP */
- 185, /* (340) input ::= cmdlist */
- 186, /* (341) cmdlist ::= cmdlist ecmd */
- 186, /* (342) cmdlist ::= ecmd */
- 187, /* (343) ecmd ::= SEMI */
- 187, /* (344) ecmd ::= cmdx SEMI */
- 187, /* (345) ecmd ::= explain cmdx SEMI */
- 192, /* (346) trans_opt ::= */
- 192, /* (347) trans_opt ::= TRANSACTION */
- 192, /* (348) trans_opt ::= TRANSACTION nm */
- 194, /* (349) savepoint_opt ::= SAVEPOINT */
- 194, /* (350) savepoint_opt ::= */
- 190, /* (351) cmd ::= create_table create_table_args */
- 203, /* (352) table_option_set ::= table_option */
- 201, /* (353) columnlist ::= columnlist COMMA columnname carglist */
- 201, /* (354) columnlist ::= columnname carglist */
- 193, /* (355) nm ::= ID|INDEXED|JOIN_KW */
- 193, /* (356) nm ::= STRING */
- 208, /* (357) typetoken ::= typename */
- 209, /* (358) typename ::= ID|STRING */
- 210, /* (359) signed ::= plus_num */
- 210, /* (360) signed ::= minus_num */
- 207, /* (361) carglist ::= carglist ccons */
- 207, /* (362) carglist ::= */
- 215, /* (363) ccons ::= NULL onconf */
- 215, /* (364) ccons ::= GENERATED ALWAYS AS generated */
- 215, /* (365) ccons ::= AS generated */
- 202, /* (366) conslist_opt ::= COMMA conslist */
- 228, /* (367) conslist ::= conslist tconscomma tcons */
- 228, /* (368) conslist ::= tcons */
- 229, /* (369) tconscomma ::= */
- 233, /* (370) defer_subclause_opt ::= defer_subclause */
- 235, /* (371) resolvetype ::= raisetype */
- 239, /* (372) selectnowith ::= oneselect */
- 240, /* (373) oneselect ::= values */
- 254, /* (374) sclp ::= selcollist COMMA */
- 255, /* (375) as ::= ID|STRING */
- 264, /* (376) indexed_opt ::= indexed_by */
- 272, /* (377) returning ::= */
- 217, /* (378) expr ::= term */
- 274, /* (379) likeop ::= LIKE_KW|MATCH */
- 278, /* (380) case_operand ::= expr */
- 261, /* (381) exprlist ::= nexprlist */
- 284, /* (382) nmnum ::= plus_num */
- 284, /* (383) nmnum ::= nm */
- 284, /* (384) nmnum ::= ON */
- 284, /* (385) nmnum ::= DELETE */
- 284, /* (386) nmnum ::= DEFAULT */
- 211, /* (387) plus_num ::= INTEGER|FLOAT */
- 289, /* (388) foreach_clause ::= */
- 289, /* (389) foreach_clause ::= FOR EACH ROW */
- 292, /* (390) trnm ::= nm */
- 293, /* (391) tridxby ::= */
- 294, /* (392) database_kw_opt ::= DATABASE */
- 294, /* (393) database_kw_opt ::= */
- 297, /* (394) kwcolumn_opt ::= */
- 297, /* (395) kwcolumn_opt ::= COLUMNKW */
- 299, /* (396) vtabarglist ::= vtabarg */
- 299, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */
- 300, /* (398) vtabarg ::= vtabarg vtabargtoken */
- 303, /* (399) anylist ::= */
- 303, /* (400) anylist ::= anylist LP anylist RP */
- 303, /* (401) anylist ::= anylist ANY */
- 266, /* (402) with ::= */
- 306, /* (403) windowdefn_list ::= windowdefn */
- 308, /* (404) window ::= frame_opt */
+ 190, /* (0) explain ::= EXPLAIN */
+ 190, /* (1) explain ::= EXPLAIN QUERY PLAN */
+ 189, /* (2) cmdx ::= cmd */
+ 191, /* (3) cmd ::= BEGIN transtype trans_opt */
+ 192, /* (4) transtype ::= */
+ 192, /* (5) transtype ::= DEFERRED */
+ 192, /* (6) transtype ::= IMMEDIATE */
+ 192, /* (7) transtype ::= EXCLUSIVE */
+ 191, /* (8) cmd ::= COMMIT|END trans_opt */
+ 191, /* (9) cmd ::= ROLLBACK trans_opt */
+ 191, /* (10) cmd ::= SAVEPOINT nm */
+ 191, /* (11) cmd ::= RELEASE savepoint_opt nm */
+ 191, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
+ 196, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
+ 198, /* (14) createkw ::= CREATE */
+ 200, /* (15) ifnotexists ::= */
+ 200, /* (16) ifnotexists ::= IF NOT EXISTS */
+ 199, /* (17) temp ::= TEMP */
+ 199, /* (18) temp ::= */
+ 197, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */
+ 197, /* (20) create_table_args ::= AS select */
+ 204, /* (21) table_option_set ::= */
+ 204, /* (22) table_option_set ::= table_option_set COMMA table_option */
+ 206, /* (23) table_option ::= WITHOUT nm */
+ 206, /* (24) table_option ::= nm */
+ 207, /* (25) columnname ::= nm typetoken */
+ 209, /* (26) typetoken ::= */
+ 209, /* (27) typetoken ::= typename LP signed RP */
+ 209, /* (28) typetoken ::= typename LP signed COMMA signed RP */
+ 210, /* (29) typename ::= typename ID|STRING */
+ 214, /* (30) scanpt ::= */
+ 215, /* (31) scantok ::= */
+ 216, /* (32) ccons ::= CONSTRAINT nm */
+ 216, /* (33) ccons ::= DEFAULT scantok term */
+ 216, /* (34) ccons ::= DEFAULT LP expr RP */
+ 216, /* (35) ccons ::= DEFAULT PLUS scantok term */
+ 216, /* (36) ccons ::= DEFAULT MINUS scantok term */
+ 216, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */
+ 216, /* (38) ccons ::= NOT NULL onconf */
+ 216, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */
+ 216, /* (40) ccons ::= UNIQUE onconf */
+ 216, /* (41) ccons ::= CHECK LP expr RP */
+ 216, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */
+ 216, /* (43) ccons ::= defer_subclause */
+ 216, /* (44) ccons ::= COLLATE ID|STRING */
+ 225, /* (45) generated ::= LP expr RP */
+ 225, /* (46) generated ::= LP expr RP ID */
+ 221, /* (47) autoinc ::= */
+ 221, /* (48) autoinc ::= AUTOINCR */
+ 223, /* (49) refargs ::= */
+ 223, /* (50) refargs ::= refargs refarg */
+ 226, /* (51) refarg ::= MATCH nm */
+ 226, /* (52) refarg ::= ON INSERT refact */
+ 226, /* (53) refarg ::= ON DELETE refact */
+ 226, /* (54) refarg ::= ON UPDATE refact */
+ 227, /* (55) refact ::= SET NULL */
+ 227, /* (56) refact ::= SET DEFAULT */
+ 227, /* (57) refact ::= CASCADE */
+ 227, /* (58) refact ::= RESTRICT */
+ 227, /* (59) refact ::= NO ACTION */
+ 224, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
+ 224, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
+ 228, /* (62) init_deferred_pred_opt ::= */
+ 228, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */
+ 228, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
+ 203, /* (65) conslist_opt ::= */
+ 230, /* (66) tconscomma ::= COMMA */
+ 231, /* (67) tcons ::= CONSTRAINT nm */
+ 231, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
+ 231, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */
+ 231, /* (70) tcons ::= CHECK LP expr RP onconf */
+ 231, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
+ 234, /* (72) defer_subclause_opt ::= */
+ 219, /* (73) onconf ::= */
+ 219, /* (74) onconf ::= ON CONFLICT resolvetype */
+ 235, /* (75) orconf ::= */
+ 235, /* (76) orconf ::= OR resolvetype */
+ 236, /* (77) resolvetype ::= IGNORE */
+ 236, /* (78) resolvetype ::= REPLACE */
+ 191, /* (79) cmd ::= DROP TABLE ifexists fullname */
+ 238, /* (80) ifexists ::= IF EXISTS */
+ 238, /* (81) ifexists ::= */
+ 191, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
+ 191, /* (83) cmd ::= DROP VIEW ifexists fullname */
+ 191, /* (84) cmd ::= select */
+ 205, /* (85) select ::= WITH wqlist selectnowith */
+ 205, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */
+ 205, /* (87) select ::= selectnowith */
+ 240, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */
+ 243, /* (89) multiselect_op ::= UNION */
+ 243, /* (90) multiselect_op ::= UNION ALL */
+ 243, /* (91) multiselect_op ::= EXCEPT|INTERSECT */
+ 241, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
+ 241, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
+ 253, /* (94) values ::= VALUES LP nexprlist RP */
+ 241, /* (95) oneselect ::= mvalues */
+ 255, /* (96) mvalues ::= values COMMA LP nexprlist RP */
+ 255, /* (97) mvalues ::= mvalues COMMA LP nexprlist RP */
+ 244, /* (98) distinct ::= DISTINCT */
+ 244, /* (99) distinct ::= ALL */
+ 244, /* (100) distinct ::= */
+ 256, /* (101) sclp ::= */
+ 245, /* (102) selcollist ::= sclp scanpt expr scanpt as */
+ 245, /* (103) selcollist ::= sclp scanpt STAR */
+ 245, /* (104) selcollist ::= sclp scanpt nm DOT STAR */
+ 257, /* (105) as ::= AS nm */
+ 257, /* (106) as ::= */
+ 246, /* (107) from ::= */
+ 246, /* (108) from ::= FROM seltablist */
+ 259, /* (109) stl_prefix ::= seltablist joinop */
+ 259, /* (110) stl_prefix ::= */
+ 258, /* (111) seltablist ::= stl_prefix nm dbnm as on_using */
+ 258, /* (112) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
+ 258, /* (113) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
+ 258, /* (114) seltablist ::= stl_prefix LP select RP as on_using */
+ 258, /* (115) seltablist ::= stl_prefix LP seltablist RP as on_using */
+ 201, /* (116) dbnm ::= */
+ 201, /* (117) dbnm ::= DOT nm */
+ 239, /* (118) fullname ::= nm */
+ 239, /* (119) fullname ::= nm DOT nm */
+ 264, /* (120) xfullname ::= nm */
+ 264, /* (121) xfullname ::= nm DOT nm */
+ 264, /* (122) xfullname ::= nm DOT nm AS nm */
+ 264, /* (123) xfullname ::= nm AS nm */
+ 260, /* (124) joinop ::= COMMA|JOIN */
+ 260, /* (125) joinop ::= JOIN_KW JOIN */
+ 260, /* (126) joinop ::= JOIN_KW nm JOIN */
+ 260, /* (127) joinop ::= JOIN_KW nm nm JOIN */
+ 261, /* (128) on_using ::= ON expr */
+ 261, /* (129) on_using ::= USING LP idlist RP */
+ 261, /* (130) on_using ::= */
+ 266, /* (131) indexed_opt ::= */
+ 262, /* (132) indexed_by ::= INDEXED BY nm */
+ 262, /* (133) indexed_by ::= NOT INDEXED */
+ 250, /* (134) orderby_opt ::= */
+ 250, /* (135) orderby_opt ::= ORDER BY sortlist */
+ 232, /* (136) sortlist ::= sortlist COMMA expr sortorder nulls */
+ 232, /* (137) sortlist ::= expr sortorder nulls */
+ 220, /* (138) sortorder ::= ASC */
+ 220, /* (139) sortorder ::= DESC */
+ 220, /* (140) sortorder ::= */
+ 267, /* (141) nulls ::= NULLS FIRST */
+ 267, /* (142) nulls ::= NULLS LAST */
+ 267, /* (143) nulls ::= */
+ 248, /* (144) groupby_opt ::= */
+ 248, /* (145) groupby_opt ::= GROUP BY nexprlist */
+ 249, /* (146) having_opt ::= */
+ 249, /* (147) having_opt ::= HAVING expr */
+ 251, /* (148) limit_opt ::= */
+ 251, /* (149) limit_opt ::= LIMIT expr */
+ 251, /* (150) limit_opt ::= LIMIT expr OFFSET expr */
+ 251, /* (151) limit_opt ::= LIMIT expr COMMA expr */
+ 191, /* (152) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
+ 247, /* (153) where_opt ::= */
+ 247, /* (154) where_opt ::= WHERE expr */
+ 269, /* (155) where_opt_ret ::= */
+ 269, /* (156) where_opt_ret ::= WHERE expr */
+ 269, /* (157) where_opt_ret ::= RETURNING selcollist */
+ 269, /* (158) where_opt_ret ::= WHERE expr RETURNING selcollist */
+ 191, /* (159) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
+ 270, /* (160) setlist ::= setlist COMMA nm EQ expr */
+ 270, /* (161) setlist ::= setlist COMMA LP idlist RP EQ expr */
+ 270, /* (162) setlist ::= nm EQ expr */
+ 270, /* (163) setlist ::= LP idlist RP EQ expr */
+ 191, /* (164) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
+ 191, /* (165) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
+ 273, /* (166) upsert ::= */
+ 273, /* (167) upsert ::= RETURNING selcollist */
+ 273, /* (168) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
+ 273, /* (169) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
+ 273, /* (170) upsert ::= ON CONFLICT DO NOTHING returning */
+ 273, /* (171) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
+ 274, /* (172) returning ::= RETURNING selcollist */
+ 271, /* (173) insert_cmd ::= INSERT orconf */
+ 271, /* (174) insert_cmd ::= REPLACE */
+ 272, /* (175) idlist_opt ::= */
+ 272, /* (176) idlist_opt ::= LP idlist RP */
+ 265, /* (177) idlist ::= idlist COMMA nm */
+ 265, /* (178) idlist ::= nm */
+ 218, /* (179) expr ::= LP expr RP */
+ 218, /* (180) expr ::= ID|INDEXED|JOIN_KW */
+ 218, /* (181) expr ::= nm DOT nm */
+ 218, /* (182) expr ::= nm DOT nm DOT nm */
+ 217, /* (183) term ::= NULL|FLOAT|BLOB */
+ 217, /* (184) term ::= STRING */
+ 217, /* (185) term ::= INTEGER */
+ 218, /* (186) expr ::= VARIABLE */
+ 218, /* (187) expr ::= expr COLLATE ID|STRING */
+ 218, /* (188) expr ::= CAST LP expr AS typetoken RP */
+ 218, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
+ 218, /* (190) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
+ 218, /* (191) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
+ 218, /* (192) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
+ 218, /* (193) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
+ 218, /* (194) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
+ 217, /* (195) term ::= CTIME_KW */
+ 218, /* (196) expr ::= LP nexprlist COMMA expr RP */
+ 218, /* (197) expr ::= expr AND expr */
+ 218, /* (198) expr ::= expr OR expr */
+ 218, /* (199) expr ::= expr LT|GT|GE|LE expr */
+ 218, /* (200) expr ::= expr EQ|NE expr */
+ 218, /* (201) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
+ 218, /* (202) expr ::= expr PLUS|MINUS expr */
+ 218, /* (203) expr ::= expr STAR|SLASH|REM expr */
+ 218, /* (204) expr ::= expr CONCAT expr */
+ 276, /* (205) likeop ::= NOT LIKE_KW|MATCH */
+ 218, /* (206) expr ::= expr likeop expr */
+ 218, /* (207) expr ::= expr likeop expr ESCAPE expr */
+ 218, /* (208) expr ::= expr ISNULL|NOTNULL */
+ 218, /* (209) expr ::= expr NOT NULL */
+ 218, /* (210) expr ::= expr IS expr */
+ 218, /* (211) expr ::= expr IS NOT expr */
+ 218, /* (212) expr ::= expr IS NOT DISTINCT FROM expr */
+ 218, /* (213) expr ::= expr IS DISTINCT FROM expr */
+ 218, /* (214) expr ::= NOT expr */
+ 218, /* (215) expr ::= BITNOT expr */
+ 218, /* (216) expr ::= PLUS|MINUS expr */
+ 218, /* (217) expr ::= expr PTR expr */
+ 277, /* (218) between_op ::= BETWEEN */
+ 277, /* (219) between_op ::= NOT BETWEEN */
+ 218, /* (220) expr ::= expr between_op expr AND expr */
+ 278, /* (221) in_op ::= IN */
+ 278, /* (222) in_op ::= NOT IN */
+ 218, /* (223) expr ::= expr in_op LP exprlist RP */
+ 218, /* (224) expr ::= LP select RP */
+ 218, /* (225) expr ::= expr in_op LP select RP */
+ 218, /* (226) expr ::= expr in_op nm dbnm paren_exprlist */
+ 218, /* (227) expr ::= EXISTS LP select RP */
+ 218, /* (228) expr ::= CASE case_operand case_exprlist case_else END */
+ 281, /* (229) case_exprlist ::= case_exprlist WHEN expr THEN expr */
+ 281, /* (230) case_exprlist ::= WHEN expr THEN expr */
+ 282, /* (231) case_else ::= ELSE expr */
+ 282, /* (232) case_else ::= */
+ 280, /* (233) case_operand ::= */
+ 263, /* (234) exprlist ::= */
+ 254, /* (235) nexprlist ::= nexprlist COMMA expr */
+ 254, /* (236) nexprlist ::= expr */
+ 279, /* (237) paren_exprlist ::= */
+ 279, /* (238) paren_exprlist ::= LP exprlist RP */
+ 191, /* (239) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
+ 283, /* (240) uniqueflag ::= UNIQUE */
+ 283, /* (241) uniqueflag ::= */
+ 222, /* (242) eidlist_opt ::= */
+ 222, /* (243) eidlist_opt ::= LP eidlist RP */
+ 233, /* (244) eidlist ::= eidlist COMMA nm collate sortorder */
+ 233, /* (245) eidlist ::= nm collate sortorder */
+ 284, /* (246) collate ::= */
+ 284, /* (247) collate ::= COLLATE ID|STRING */
+ 191, /* (248) cmd ::= DROP INDEX ifexists fullname */
+ 191, /* (249) cmd ::= VACUUM vinto */
+ 191, /* (250) cmd ::= VACUUM nm vinto */
+ 285, /* (251) vinto ::= INTO expr */
+ 285, /* (252) vinto ::= */
+ 191, /* (253) cmd ::= PRAGMA nm dbnm */
+ 191, /* (254) cmd ::= PRAGMA nm dbnm EQ nmnum */
+ 191, /* (255) cmd ::= PRAGMA nm dbnm LP nmnum RP */
+ 191, /* (256) cmd ::= PRAGMA nm dbnm EQ minus_num */
+ 191, /* (257) cmd ::= PRAGMA nm dbnm LP minus_num RP */
+ 212, /* (258) plus_num ::= PLUS INTEGER|FLOAT */
+ 213, /* (259) minus_num ::= MINUS INTEGER|FLOAT */
+ 191, /* (260) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
+ 287, /* (261) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
+ 289, /* (262) trigger_time ::= BEFORE|AFTER */
+ 289, /* (263) trigger_time ::= INSTEAD OF */
+ 289, /* (264) trigger_time ::= */
+ 290, /* (265) trigger_event ::= DELETE|INSERT */
+ 290, /* (266) trigger_event ::= UPDATE */
+ 290, /* (267) trigger_event ::= UPDATE OF idlist */
+ 292, /* (268) when_clause ::= */
+ 292, /* (269) when_clause ::= WHEN expr */
+ 288, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
+ 288, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */
+ 294, /* (272) trnm ::= nm DOT nm */
+ 295, /* (273) tridxby ::= INDEXED BY nm */
+ 295, /* (274) tridxby ::= NOT INDEXED */
+ 293, /* (275) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
+ 293, /* (276) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
+ 293, /* (277) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
+ 293, /* (278) trigger_cmd ::= scanpt select scanpt */
+ 218, /* (279) expr ::= RAISE LP IGNORE RP */
+ 218, /* (280) expr ::= RAISE LP raisetype COMMA nm RP */
+ 237, /* (281) raisetype ::= ROLLBACK */
+ 237, /* (282) raisetype ::= ABORT */
+ 237, /* (283) raisetype ::= FAIL */
+ 191, /* (284) cmd ::= DROP TRIGGER ifexists fullname */
+ 191, /* (285) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
+ 191, /* (286) cmd ::= DETACH database_kw_opt expr */
+ 297, /* (287) key_opt ::= */
+ 297, /* (288) key_opt ::= KEY expr */
+ 191, /* (289) cmd ::= REINDEX */
+ 191, /* (290) cmd ::= REINDEX nm dbnm */
+ 191, /* (291) cmd ::= ANALYZE */
+ 191, /* (292) cmd ::= ANALYZE nm dbnm */
+ 191, /* (293) cmd ::= ALTER TABLE fullname RENAME TO nm */
+ 191, /* (294) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
+ 191, /* (295) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
+ 298, /* (296) add_column_fullname ::= fullname */
+ 191, /* (297) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
+ 191, /* (298) cmd ::= create_vtab */
+ 191, /* (299) cmd ::= create_vtab LP vtabarglist RP */
+ 300, /* (300) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
+ 302, /* (301) vtabarg ::= */
+ 303, /* (302) vtabargtoken ::= ANY */
+ 303, /* (303) vtabargtoken ::= lp anylist RP */
+ 304, /* (304) lp ::= LP */
+ 268, /* (305) with ::= WITH wqlist */
+ 268, /* (306) with ::= WITH RECURSIVE wqlist */
+ 307, /* (307) wqas ::= AS */
+ 307, /* (308) wqas ::= AS MATERIALIZED */
+ 307, /* (309) wqas ::= AS NOT MATERIALIZED */
+ 306, /* (310) wqitem ::= withnm eidlist_opt wqas LP select RP */
+ 308, /* (311) withnm ::= nm */
+ 242, /* (312) wqlist ::= wqitem */
+ 242, /* (313) wqlist ::= wqlist COMMA wqitem */
+ 309, /* (314) windowdefn_list ::= windowdefn_list COMMA windowdefn */
+ 310, /* (315) windowdefn ::= nm AS LP window RP */
+ 311, /* (316) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
+ 311, /* (317) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
+ 311, /* (318) window ::= ORDER BY sortlist frame_opt */
+ 311, /* (319) window ::= nm ORDER BY sortlist frame_opt */
+ 311, /* (320) window ::= nm frame_opt */
+ 312, /* (321) frame_opt ::= */
+ 312, /* (322) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
+ 312, /* (323) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
+ 316, /* (324) range_or_rows ::= RANGE|ROWS|GROUPS */
+ 318, /* (325) frame_bound_s ::= frame_bound */
+ 318, /* (326) frame_bound_s ::= UNBOUNDED PRECEDING */
+ 319, /* (327) frame_bound_e ::= frame_bound */
+ 319, /* (328) frame_bound_e ::= UNBOUNDED FOLLOWING */
+ 317, /* (329) frame_bound ::= expr PRECEDING|FOLLOWING */
+ 317, /* (330) frame_bound ::= CURRENT ROW */
+ 320, /* (331) frame_exclude_opt ::= */
+ 320, /* (332) frame_exclude_opt ::= EXCLUDE frame_exclude */
+ 321, /* (333) frame_exclude ::= NO OTHERS */
+ 321, /* (334) frame_exclude ::= CURRENT ROW */
+ 321, /* (335) frame_exclude ::= GROUP|TIES */
+ 252, /* (336) window_clause ::= WINDOW windowdefn_list */
+ 275, /* (337) filter_over ::= filter_clause over_clause */
+ 275, /* (338) filter_over ::= over_clause */
+ 275, /* (339) filter_over ::= filter_clause */
+ 315, /* (340) over_clause ::= OVER LP window RP */
+ 315, /* (341) over_clause ::= OVER nm */
+ 314, /* (342) filter_clause ::= FILTER LP WHERE expr RP */
+ 217, /* (343) term ::= QNUMBER */
+ 186, /* (344) input ::= cmdlist */
+ 187, /* (345) cmdlist ::= cmdlist ecmd */
+ 187, /* (346) cmdlist ::= ecmd */
+ 188, /* (347) ecmd ::= SEMI */
+ 188, /* (348) ecmd ::= cmdx SEMI */
+ 188, /* (349) ecmd ::= explain cmdx SEMI */
+ 193, /* (350) trans_opt ::= */
+ 193, /* (351) trans_opt ::= TRANSACTION */
+ 193, /* (352) trans_opt ::= TRANSACTION nm */
+ 195, /* (353) savepoint_opt ::= SAVEPOINT */
+ 195, /* (354) savepoint_opt ::= */
+ 191, /* (355) cmd ::= create_table create_table_args */
+ 204, /* (356) table_option_set ::= table_option */
+ 202, /* (357) columnlist ::= columnlist COMMA columnname carglist */
+ 202, /* (358) columnlist ::= columnname carglist */
+ 194, /* (359) nm ::= ID|INDEXED|JOIN_KW */
+ 194, /* (360) nm ::= STRING */
+ 209, /* (361) typetoken ::= typename */
+ 210, /* (362) typename ::= ID|STRING */
+ 211, /* (363) signed ::= plus_num */
+ 211, /* (364) signed ::= minus_num */
+ 208, /* (365) carglist ::= carglist ccons */
+ 208, /* (366) carglist ::= */
+ 216, /* (367) ccons ::= NULL onconf */
+ 216, /* (368) ccons ::= GENERATED ALWAYS AS generated */
+ 216, /* (369) ccons ::= AS generated */
+ 203, /* (370) conslist_opt ::= COMMA conslist */
+ 229, /* (371) conslist ::= conslist tconscomma tcons */
+ 229, /* (372) conslist ::= tcons */
+ 230, /* (373) tconscomma ::= */
+ 234, /* (374) defer_subclause_opt ::= defer_subclause */
+ 236, /* (375) resolvetype ::= raisetype */
+ 240, /* (376) selectnowith ::= oneselect */
+ 241, /* (377) oneselect ::= values */
+ 256, /* (378) sclp ::= selcollist COMMA */
+ 257, /* (379) as ::= ID|STRING */
+ 266, /* (380) indexed_opt ::= indexed_by */
+ 274, /* (381) returning ::= */
+ 218, /* (382) expr ::= term */
+ 276, /* (383) likeop ::= LIKE_KW|MATCH */
+ 280, /* (384) case_operand ::= expr */
+ 263, /* (385) exprlist ::= nexprlist */
+ 286, /* (386) nmnum ::= plus_num */
+ 286, /* (387) nmnum ::= nm */
+ 286, /* (388) nmnum ::= ON */
+ 286, /* (389) nmnum ::= DELETE */
+ 286, /* (390) nmnum ::= DEFAULT */
+ 212, /* (391) plus_num ::= INTEGER|FLOAT */
+ 291, /* (392) foreach_clause ::= */
+ 291, /* (393) foreach_clause ::= FOR EACH ROW */
+ 294, /* (394) trnm ::= nm */
+ 295, /* (395) tridxby ::= */
+ 296, /* (396) database_kw_opt ::= DATABASE */
+ 296, /* (397) database_kw_opt ::= */
+ 299, /* (398) kwcolumn_opt ::= */
+ 299, /* (399) kwcolumn_opt ::= COLUMNKW */
+ 301, /* (400) vtabarglist ::= vtabarg */
+ 301, /* (401) vtabarglist ::= vtabarglist COMMA vtabarg */
+ 302, /* (402) vtabarg ::= vtabarg vtabargtoken */
+ 305, /* (403) anylist ::= */
+ 305, /* (404) anylist ::= anylist LP anylist RP */
+ 305, /* (405) anylist ::= anylist ANY */
+ 268, /* (406) with ::= */
+ 309, /* (407) windowdefn_list ::= windowdefn */
+ 311, /* (408) window ::= frame_opt */
};
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
@@ -174363,316 +175761,320 @@ static const signed char yyRuleInfoNRhs[] = {
-9, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
-10, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
-4, /* (94) values ::= VALUES LP nexprlist RP */
- -5, /* (95) values ::= values COMMA LP nexprlist RP */
- -1, /* (96) distinct ::= DISTINCT */
- -1, /* (97) distinct ::= ALL */
- 0, /* (98) distinct ::= */
- 0, /* (99) sclp ::= */
- -5, /* (100) selcollist ::= sclp scanpt expr scanpt as */
- -3, /* (101) selcollist ::= sclp scanpt STAR */
- -5, /* (102) selcollist ::= sclp scanpt nm DOT STAR */
- -2, /* (103) as ::= AS nm */
- 0, /* (104) as ::= */
- 0, /* (105) from ::= */
- -2, /* (106) from ::= FROM seltablist */
- -2, /* (107) stl_prefix ::= seltablist joinop */
- 0, /* (108) stl_prefix ::= */
- -5, /* (109) seltablist ::= stl_prefix nm dbnm as on_using */
- -6, /* (110) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
- -8, /* (111) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
- -6, /* (112) seltablist ::= stl_prefix LP select RP as on_using */
- -6, /* (113) seltablist ::= stl_prefix LP seltablist RP as on_using */
- 0, /* (114) dbnm ::= */
- -2, /* (115) dbnm ::= DOT nm */
- -1, /* (116) fullname ::= nm */
- -3, /* (117) fullname ::= nm DOT nm */
- -1, /* (118) xfullname ::= nm */
- -3, /* (119) xfullname ::= nm DOT nm */
- -5, /* (120) xfullname ::= nm DOT nm AS nm */
- -3, /* (121) xfullname ::= nm AS nm */
- -1, /* (122) joinop ::= COMMA|JOIN */
- -2, /* (123) joinop ::= JOIN_KW JOIN */
- -3, /* (124) joinop ::= JOIN_KW nm JOIN */
- -4, /* (125) joinop ::= JOIN_KW nm nm JOIN */
- -2, /* (126) on_using ::= ON expr */
- -4, /* (127) on_using ::= USING LP idlist RP */
- 0, /* (128) on_using ::= */
- 0, /* (129) indexed_opt ::= */
- -3, /* (130) indexed_by ::= INDEXED BY nm */
- -2, /* (131) indexed_by ::= NOT INDEXED */
- 0, /* (132) orderby_opt ::= */
- -3, /* (133) orderby_opt ::= ORDER BY sortlist */
- -5, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */
- -3, /* (135) sortlist ::= expr sortorder nulls */
- -1, /* (136) sortorder ::= ASC */
- -1, /* (137) sortorder ::= DESC */
- 0, /* (138) sortorder ::= */
- -2, /* (139) nulls ::= NULLS FIRST */
- -2, /* (140) nulls ::= NULLS LAST */
- 0, /* (141) nulls ::= */
- 0, /* (142) groupby_opt ::= */
- -3, /* (143) groupby_opt ::= GROUP BY nexprlist */
- 0, /* (144) having_opt ::= */
- -2, /* (145) having_opt ::= HAVING expr */
- 0, /* (146) limit_opt ::= */
- -2, /* (147) limit_opt ::= LIMIT expr */
- -4, /* (148) limit_opt ::= LIMIT expr OFFSET expr */
- -4, /* (149) limit_opt ::= LIMIT expr COMMA expr */
- -6, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
- 0, /* (151) where_opt ::= */
- -2, /* (152) where_opt ::= WHERE expr */
- 0, /* (153) where_opt_ret ::= */
- -2, /* (154) where_opt_ret ::= WHERE expr */
- -2, /* (155) where_opt_ret ::= RETURNING selcollist */
- -4, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */
- -9, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
- -5, /* (158) setlist ::= setlist COMMA nm EQ expr */
- -7, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */
- -3, /* (160) setlist ::= nm EQ expr */
- -5, /* (161) setlist ::= LP idlist RP EQ expr */
- -7, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
- -8, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
- 0, /* (164) upsert ::= */
- -2, /* (165) upsert ::= RETURNING selcollist */
- -12, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
- -9, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
- -5, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */
- -8, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
- -2, /* (170) returning ::= RETURNING selcollist */
- -2, /* (171) insert_cmd ::= INSERT orconf */
- -1, /* (172) insert_cmd ::= REPLACE */
- 0, /* (173) idlist_opt ::= */
- -3, /* (174) idlist_opt ::= LP idlist RP */
- -3, /* (175) idlist ::= idlist COMMA nm */
- -1, /* (176) idlist ::= nm */
- -3, /* (177) expr ::= LP expr RP */
- -1, /* (178) expr ::= ID|INDEXED|JOIN_KW */
- -3, /* (179) expr ::= nm DOT nm */
- -5, /* (180) expr ::= nm DOT nm DOT nm */
- -1, /* (181) term ::= NULL|FLOAT|BLOB */
- -1, /* (182) term ::= STRING */
- -1, /* (183) term ::= INTEGER */
- -1, /* (184) expr ::= VARIABLE */
- -3, /* (185) expr ::= expr COLLATE ID|STRING */
- -6, /* (186) expr ::= CAST LP expr AS typetoken RP */
- -5, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
- -8, /* (188) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
- -4, /* (189) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
- -6, /* (190) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
- -9, /* (191) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
- -5, /* (192) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
- -1, /* (193) term ::= CTIME_KW */
- -5, /* (194) expr ::= LP nexprlist COMMA expr RP */
- -3, /* (195) expr ::= expr AND expr */
- -3, /* (196) expr ::= expr OR expr */
- -3, /* (197) expr ::= expr LT|GT|GE|LE expr */
- -3, /* (198) expr ::= expr EQ|NE expr */
- -3, /* (199) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
- -3, /* (200) expr ::= expr PLUS|MINUS expr */
- -3, /* (201) expr ::= expr STAR|SLASH|REM expr */
- -3, /* (202) expr ::= expr CONCAT expr */
- -2, /* (203) likeop ::= NOT LIKE_KW|MATCH */
- -3, /* (204) expr ::= expr likeop expr */
- -5, /* (205) expr ::= expr likeop expr ESCAPE expr */
- -2, /* (206) expr ::= expr ISNULL|NOTNULL */
- -3, /* (207) expr ::= expr NOT NULL */
- -3, /* (208) expr ::= expr IS expr */
- -4, /* (209) expr ::= expr IS NOT expr */
- -6, /* (210) expr ::= expr IS NOT DISTINCT FROM expr */
- -5, /* (211) expr ::= expr IS DISTINCT FROM expr */
- -2, /* (212) expr ::= NOT expr */
- -2, /* (213) expr ::= BITNOT expr */
- -2, /* (214) expr ::= PLUS|MINUS expr */
- -3, /* (215) expr ::= expr PTR expr */
- -1, /* (216) between_op ::= BETWEEN */
- -2, /* (217) between_op ::= NOT BETWEEN */
- -5, /* (218) expr ::= expr between_op expr AND expr */
- -1, /* (219) in_op ::= IN */
- -2, /* (220) in_op ::= NOT IN */
- -5, /* (221) expr ::= expr in_op LP exprlist RP */
- -3, /* (222) expr ::= LP select RP */
- -5, /* (223) expr ::= expr in_op LP select RP */
- -5, /* (224) expr ::= expr in_op nm dbnm paren_exprlist */
- -4, /* (225) expr ::= EXISTS LP select RP */
- -5, /* (226) expr ::= CASE case_operand case_exprlist case_else END */
- -5, /* (227) case_exprlist ::= case_exprlist WHEN expr THEN expr */
- -4, /* (228) case_exprlist ::= WHEN expr THEN expr */
- -2, /* (229) case_else ::= ELSE expr */
- 0, /* (230) case_else ::= */
- 0, /* (231) case_operand ::= */
- 0, /* (232) exprlist ::= */
- -3, /* (233) nexprlist ::= nexprlist COMMA expr */
- -1, /* (234) nexprlist ::= expr */
- 0, /* (235) paren_exprlist ::= */
- -3, /* (236) paren_exprlist ::= LP exprlist RP */
- -12, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
- -1, /* (238) uniqueflag ::= UNIQUE */
- 0, /* (239) uniqueflag ::= */
- 0, /* (240) eidlist_opt ::= */
- -3, /* (241) eidlist_opt ::= LP eidlist RP */
- -5, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
- -3, /* (243) eidlist ::= nm collate sortorder */
- 0, /* (244) collate ::= */
- -2, /* (245) collate ::= COLLATE ID|STRING */
- -4, /* (246) cmd ::= DROP INDEX ifexists fullname */
- -2, /* (247) cmd ::= VACUUM vinto */
- -3, /* (248) cmd ::= VACUUM nm vinto */
- -2, /* (249) vinto ::= INTO expr */
- 0, /* (250) vinto ::= */
- -3, /* (251) cmd ::= PRAGMA nm dbnm */
- -5, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
- -6, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
- -5, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
- -6, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
- -2, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
- -2, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
- -5, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
- -11, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
- -1, /* (260) trigger_time ::= BEFORE|AFTER */
- -2, /* (261) trigger_time ::= INSTEAD OF */
- 0, /* (262) trigger_time ::= */
- -1, /* (263) trigger_event ::= DELETE|INSERT */
- -1, /* (264) trigger_event ::= UPDATE */
- -3, /* (265) trigger_event ::= UPDATE OF idlist */
- 0, /* (266) when_clause ::= */
- -2, /* (267) when_clause ::= WHEN expr */
- -3, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
- -2, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
- -3, /* (270) trnm ::= nm DOT nm */
- -3, /* (271) tridxby ::= INDEXED BY nm */
- -2, /* (272) tridxby ::= NOT INDEXED */
- -9, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
- -8, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
- -6, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
- -3, /* (276) trigger_cmd ::= scanpt select scanpt */
- -4, /* (277) expr ::= RAISE LP IGNORE RP */
- -6, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
- -1, /* (279) raisetype ::= ROLLBACK */
- -1, /* (280) raisetype ::= ABORT */
- -1, /* (281) raisetype ::= FAIL */
- -4, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
- -6, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
- -3, /* (284) cmd ::= DETACH database_kw_opt expr */
- 0, /* (285) key_opt ::= */
- -2, /* (286) key_opt ::= KEY expr */
- -1, /* (287) cmd ::= REINDEX */
- -3, /* (288) cmd ::= REINDEX nm dbnm */
- -1, /* (289) cmd ::= ANALYZE */
- -3, /* (290) cmd ::= ANALYZE nm dbnm */
- -6, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
- -7, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
- -6, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
- -1, /* (294) add_column_fullname ::= fullname */
- -8, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
- -1, /* (296) cmd ::= create_vtab */
- -4, /* (297) cmd ::= create_vtab LP vtabarglist RP */
- -8, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
- 0, /* (299) vtabarg ::= */
- -1, /* (300) vtabargtoken ::= ANY */
- -3, /* (301) vtabargtoken ::= lp anylist RP */
- -1, /* (302) lp ::= LP */
- -2, /* (303) with ::= WITH wqlist */
- -3, /* (304) with ::= WITH RECURSIVE wqlist */
- -1, /* (305) wqas ::= AS */
- -2, /* (306) wqas ::= AS MATERIALIZED */
- -3, /* (307) wqas ::= AS NOT MATERIALIZED */
- -6, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
- -1, /* (309) wqlist ::= wqitem */
- -3, /* (310) wqlist ::= wqlist COMMA wqitem */
- -3, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */
- -5, /* (312) windowdefn ::= nm AS LP window RP */
- -5, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
- -6, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
- -4, /* (315) window ::= ORDER BY sortlist frame_opt */
- -5, /* (316) window ::= nm ORDER BY sortlist frame_opt */
- -2, /* (317) window ::= nm frame_opt */
- 0, /* (318) frame_opt ::= */
- -3, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
- -6, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
- -1, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */
- -1, /* (322) frame_bound_s ::= frame_bound */
- -2, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */
- -1, /* (324) frame_bound_e ::= frame_bound */
- -2, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */
- -2, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */
- -2, /* (327) frame_bound ::= CURRENT ROW */
- 0, /* (328) frame_exclude_opt ::= */
- -2, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */
- -2, /* (330) frame_exclude ::= NO OTHERS */
- -2, /* (331) frame_exclude ::= CURRENT ROW */
- -1, /* (332) frame_exclude ::= GROUP|TIES */
- -2, /* (333) window_clause ::= WINDOW windowdefn_list */
- -2, /* (334) filter_over ::= filter_clause over_clause */
- -1, /* (335) filter_over ::= over_clause */
- -1, /* (336) filter_over ::= filter_clause */
- -4, /* (337) over_clause ::= OVER LP window RP */
- -2, /* (338) over_clause ::= OVER nm */
- -5, /* (339) filter_clause ::= FILTER LP WHERE expr RP */
- -1, /* (340) input ::= cmdlist */
- -2, /* (341) cmdlist ::= cmdlist ecmd */
- -1, /* (342) cmdlist ::= ecmd */
- -1, /* (343) ecmd ::= SEMI */
- -2, /* (344) ecmd ::= cmdx SEMI */
- -3, /* (345) ecmd ::= explain cmdx SEMI */
- 0, /* (346) trans_opt ::= */
- -1, /* (347) trans_opt ::= TRANSACTION */
- -2, /* (348) trans_opt ::= TRANSACTION nm */
- -1, /* (349) savepoint_opt ::= SAVEPOINT */
- 0, /* (350) savepoint_opt ::= */
- -2, /* (351) cmd ::= create_table create_table_args */
- -1, /* (352) table_option_set ::= table_option */
- -4, /* (353) columnlist ::= columnlist COMMA columnname carglist */
- -2, /* (354) columnlist ::= columnname carglist */
- -1, /* (355) nm ::= ID|INDEXED|JOIN_KW */
- -1, /* (356) nm ::= STRING */
- -1, /* (357) typetoken ::= typename */
- -1, /* (358) typename ::= ID|STRING */
- -1, /* (359) signed ::= plus_num */
- -1, /* (360) signed ::= minus_num */
- -2, /* (361) carglist ::= carglist ccons */
- 0, /* (362) carglist ::= */
- -2, /* (363) ccons ::= NULL onconf */
- -4, /* (364) ccons ::= GENERATED ALWAYS AS generated */
- -2, /* (365) ccons ::= AS generated */
- -2, /* (366) conslist_opt ::= COMMA conslist */
- -3, /* (367) conslist ::= conslist tconscomma tcons */
- -1, /* (368) conslist ::= tcons */
- 0, /* (369) tconscomma ::= */
- -1, /* (370) defer_subclause_opt ::= defer_subclause */
- -1, /* (371) resolvetype ::= raisetype */
- -1, /* (372) selectnowith ::= oneselect */
- -1, /* (373) oneselect ::= values */
- -2, /* (374) sclp ::= selcollist COMMA */
- -1, /* (375) as ::= ID|STRING */
- -1, /* (376) indexed_opt ::= indexed_by */
- 0, /* (377) returning ::= */
- -1, /* (378) expr ::= term */
- -1, /* (379) likeop ::= LIKE_KW|MATCH */
- -1, /* (380) case_operand ::= expr */
- -1, /* (381) exprlist ::= nexprlist */
- -1, /* (382) nmnum ::= plus_num */
- -1, /* (383) nmnum ::= nm */
- -1, /* (384) nmnum ::= ON */
- -1, /* (385) nmnum ::= DELETE */
- -1, /* (386) nmnum ::= DEFAULT */
- -1, /* (387) plus_num ::= INTEGER|FLOAT */
- 0, /* (388) foreach_clause ::= */
- -3, /* (389) foreach_clause ::= FOR EACH ROW */
- -1, /* (390) trnm ::= nm */
- 0, /* (391) tridxby ::= */
- -1, /* (392) database_kw_opt ::= DATABASE */
- 0, /* (393) database_kw_opt ::= */
- 0, /* (394) kwcolumn_opt ::= */
- -1, /* (395) kwcolumn_opt ::= COLUMNKW */
- -1, /* (396) vtabarglist ::= vtabarg */
- -3, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */
- -2, /* (398) vtabarg ::= vtabarg vtabargtoken */
- 0, /* (399) anylist ::= */
- -4, /* (400) anylist ::= anylist LP anylist RP */
- -2, /* (401) anylist ::= anylist ANY */
- 0, /* (402) with ::= */
- -1, /* (403) windowdefn_list ::= windowdefn */
- -1, /* (404) window ::= frame_opt */
+ -1, /* (95) oneselect ::= mvalues */
+ -5, /* (96) mvalues ::= values COMMA LP nexprlist RP */
+ -5, /* (97) mvalues ::= mvalues COMMA LP nexprlist RP */
+ -1, /* (98) distinct ::= DISTINCT */
+ -1, /* (99) distinct ::= ALL */
+ 0, /* (100) distinct ::= */
+ 0, /* (101) sclp ::= */
+ -5, /* (102) selcollist ::= sclp scanpt expr scanpt as */
+ -3, /* (103) selcollist ::= sclp scanpt STAR */
+ -5, /* (104) selcollist ::= sclp scanpt nm DOT STAR */
+ -2, /* (105) as ::= AS nm */
+ 0, /* (106) as ::= */
+ 0, /* (107) from ::= */
+ -2, /* (108) from ::= FROM seltablist */
+ -2, /* (109) stl_prefix ::= seltablist joinop */
+ 0, /* (110) stl_prefix ::= */
+ -5, /* (111) seltablist ::= stl_prefix nm dbnm as on_using */
+ -6, /* (112) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
+ -8, /* (113) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
+ -6, /* (114) seltablist ::= stl_prefix LP select RP as on_using */
+ -6, /* (115) seltablist ::= stl_prefix LP seltablist RP as on_using */
+ 0, /* (116) dbnm ::= */
+ -2, /* (117) dbnm ::= DOT nm */
+ -1, /* (118) fullname ::= nm */
+ -3, /* (119) fullname ::= nm DOT nm */
+ -1, /* (120) xfullname ::= nm */
+ -3, /* (121) xfullname ::= nm DOT nm */
+ -5, /* (122) xfullname ::= nm DOT nm AS nm */
+ -3, /* (123) xfullname ::= nm AS nm */
+ -1, /* (124) joinop ::= COMMA|JOIN */
+ -2, /* (125) joinop ::= JOIN_KW JOIN */
+ -3, /* (126) joinop ::= JOIN_KW nm JOIN */
+ -4, /* (127) joinop ::= JOIN_KW nm nm JOIN */
+ -2, /* (128) on_using ::= ON expr */
+ -4, /* (129) on_using ::= USING LP idlist RP */
+ 0, /* (130) on_using ::= */
+ 0, /* (131) indexed_opt ::= */
+ -3, /* (132) indexed_by ::= INDEXED BY nm */
+ -2, /* (133) indexed_by ::= NOT INDEXED */
+ 0, /* (134) orderby_opt ::= */
+ -3, /* (135) orderby_opt ::= ORDER BY sortlist */
+ -5, /* (136) sortlist ::= sortlist COMMA expr sortorder nulls */
+ -3, /* (137) sortlist ::= expr sortorder nulls */
+ -1, /* (138) sortorder ::= ASC */
+ -1, /* (139) sortorder ::= DESC */
+ 0, /* (140) sortorder ::= */
+ -2, /* (141) nulls ::= NULLS FIRST */
+ -2, /* (142) nulls ::= NULLS LAST */
+ 0, /* (143) nulls ::= */
+ 0, /* (144) groupby_opt ::= */
+ -3, /* (145) groupby_opt ::= GROUP BY nexprlist */
+ 0, /* (146) having_opt ::= */
+ -2, /* (147) having_opt ::= HAVING expr */
+ 0, /* (148) limit_opt ::= */
+ -2, /* (149) limit_opt ::= LIMIT expr */
+ -4, /* (150) limit_opt ::= LIMIT expr OFFSET expr */
+ -4, /* (151) limit_opt ::= LIMIT expr COMMA expr */
+ -6, /* (152) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
+ 0, /* (153) where_opt ::= */
+ -2, /* (154) where_opt ::= WHERE expr */
+ 0, /* (155) where_opt_ret ::= */
+ -2, /* (156) where_opt_ret ::= WHERE expr */
+ -2, /* (157) where_opt_ret ::= RETURNING selcollist */
+ -4, /* (158) where_opt_ret ::= WHERE expr RETURNING selcollist */
+ -9, /* (159) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
+ -5, /* (160) setlist ::= setlist COMMA nm EQ expr */
+ -7, /* (161) setlist ::= setlist COMMA LP idlist RP EQ expr */
+ -3, /* (162) setlist ::= nm EQ expr */
+ -5, /* (163) setlist ::= LP idlist RP EQ expr */
+ -7, /* (164) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
+ -8, /* (165) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
+ 0, /* (166) upsert ::= */
+ -2, /* (167) upsert ::= RETURNING selcollist */
+ -12, /* (168) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
+ -9, /* (169) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
+ -5, /* (170) upsert ::= ON CONFLICT DO NOTHING returning */
+ -8, /* (171) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
+ -2, /* (172) returning ::= RETURNING selcollist */
+ -2, /* (173) insert_cmd ::= INSERT orconf */
+ -1, /* (174) insert_cmd ::= REPLACE */
+ 0, /* (175) idlist_opt ::= */
+ -3, /* (176) idlist_opt ::= LP idlist RP */
+ -3, /* (177) idlist ::= idlist COMMA nm */
+ -1, /* (178) idlist ::= nm */
+ -3, /* (179) expr ::= LP expr RP */
+ -1, /* (180) expr ::= ID|INDEXED|JOIN_KW */
+ -3, /* (181) expr ::= nm DOT nm */
+ -5, /* (182) expr ::= nm DOT nm DOT nm */
+ -1, /* (183) term ::= NULL|FLOAT|BLOB */
+ -1, /* (184) term ::= STRING */
+ -1, /* (185) term ::= INTEGER */
+ -1, /* (186) expr ::= VARIABLE */
+ -3, /* (187) expr ::= expr COLLATE ID|STRING */
+ -6, /* (188) expr ::= CAST LP expr AS typetoken RP */
+ -5, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
+ -8, /* (190) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
+ -4, /* (191) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
+ -6, /* (192) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
+ -9, /* (193) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
+ -5, /* (194) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
+ -1, /* (195) term ::= CTIME_KW */
+ -5, /* (196) expr ::= LP nexprlist COMMA expr RP */
+ -3, /* (197) expr ::= expr AND expr */
+ -3, /* (198) expr ::= expr OR expr */
+ -3, /* (199) expr ::= expr LT|GT|GE|LE expr */
+ -3, /* (200) expr ::= expr EQ|NE expr */
+ -3, /* (201) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
+ -3, /* (202) expr ::= expr PLUS|MINUS expr */
+ -3, /* (203) expr ::= expr STAR|SLASH|REM expr */
+ -3, /* (204) expr ::= expr CONCAT expr */
+ -2, /* (205) likeop ::= NOT LIKE_KW|MATCH */
+ -3, /* (206) expr ::= expr likeop expr */
+ -5, /* (207) expr ::= expr likeop expr ESCAPE expr */
+ -2, /* (208) expr ::= expr ISNULL|NOTNULL */
+ -3, /* (209) expr ::= expr NOT NULL */
+ -3, /* (210) expr ::= expr IS expr */
+ -4, /* (211) expr ::= expr IS NOT expr */
+ -6, /* (212) expr ::= expr IS NOT DISTINCT FROM expr */
+ -5, /* (213) expr ::= expr IS DISTINCT FROM expr */
+ -2, /* (214) expr ::= NOT expr */
+ -2, /* (215) expr ::= BITNOT expr */
+ -2, /* (216) expr ::= PLUS|MINUS expr */
+ -3, /* (217) expr ::= expr PTR expr */
+ -1, /* (218) between_op ::= BETWEEN */
+ -2, /* (219) between_op ::= NOT BETWEEN */
+ -5, /* (220) expr ::= expr between_op expr AND expr */
+ -1, /* (221) in_op ::= IN */
+ -2, /* (222) in_op ::= NOT IN */
+ -5, /* (223) expr ::= expr in_op LP exprlist RP */
+ -3, /* (224) expr ::= LP select RP */
+ -5, /* (225) expr ::= expr in_op LP select RP */
+ -5, /* (226) expr ::= expr in_op nm dbnm paren_exprlist */
+ -4, /* (227) expr ::= EXISTS LP select RP */
+ -5, /* (228) expr ::= CASE case_operand case_exprlist case_else END */
+ -5, /* (229) case_exprlist ::= case_exprlist WHEN expr THEN expr */
+ -4, /* (230) case_exprlist ::= WHEN expr THEN expr */
+ -2, /* (231) case_else ::= ELSE expr */
+ 0, /* (232) case_else ::= */
+ 0, /* (233) case_operand ::= */
+ 0, /* (234) exprlist ::= */
+ -3, /* (235) nexprlist ::= nexprlist COMMA expr */
+ -1, /* (236) nexprlist ::= expr */
+ 0, /* (237) paren_exprlist ::= */
+ -3, /* (238) paren_exprlist ::= LP exprlist RP */
+ -12, /* (239) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
+ -1, /* (240) uniqueflag ::= UNIQUE */
+ 0, /* (241) uniqueflag ::= */
+ 0, /* (242) eidlist_opt ::= */
+ -3, /* (243) eidlist_opt ::= LP eidlist RP */
+ -5, /* (244) eidlist ::= eidlist COMMA nm collate sortorder */
+ -3, /* (245) eidlist ::= nm collate sortorder */
+ 0, /* (246) collate ::= */
+ -2, /* (247) collate ::= COLLATE ID|STRING */
+ -4, /* (248) cmd ::= DROP INDEX ifexists fullname */
+ -2, /* (249) cmd ::= VACUUM vinto */
+ -3, /* (250) cmd ::= VACUUM nm vinto */
+ -2, /* (251) vinto ::= INTO expr */
+ 0, /* (252) vinto ::= */
+ -3, /* (253) cmd ::= PRAGMA nm dbnm */
+ -5, /* (254) cmd ::= PRAGMA nm dbnm EQ nmnum */
+ -6, /* (255) cmd ::= PRAGMA nm dbnm LP nmnum RP */
+ -5, /* (256) cmd ::= PRAGMA nm dbnm EQ minus_num */
+ -6, /* (257) cmd ::= PRAGMA nm dbnm LP minus_num RP */
+ -2, /* (258) plus_num ::= PLUS INTEGER|FLOAT */
+ -2, /* (259) minus_num ::= MINUS INTEGER|FLOAT */
+ -5, /* (260) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
+ -11, /* (261) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
+ -1, /* (262) trigger_time ::= BEFORE|AFTER */
+ -2, /* (263) trigger_time ::= INSTEAD OF */
+ 0, /* (264) trigger_time ::= */
+ -1, /* (265) trigger_event ::= DELETE|INSERT */
+ -1, /* (266) trigger_event ::= UPDATE */
+ -3, /* (267) trigger_event ::= UPDATE OF idlist */
+ 0, /* (268) when_clause ::= */
+ -2, /* (269) when_clause ::= WHEN expr */
+ -3, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
+ -2, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */
+ -3, /* (272) trnm ::= nm DOT nm */
+ -3, /* (273) tridxby ::= INDEXED BY nm */
+ -2, /* (274) tridxby ::= NOT INDEXED */
+ -9, /* (275) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
+ -8, /* (276) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
+ -6, /* (277) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
+ -3, /* (278) trigger_cmd ::= scanpt select scanpt */
+ -4, /* (279) expr ::= RAISE LP IGNORE RP */
+ -6, /* (280) expr ::= RAISE LP raisetype COMMA nm RP */
+ -1, /* (281) raisetype ::= ROLLBACK */
+ -1, /* (282) raisetype ::= ABORT */
+ -1, /* (283) raisetype ::= FAIL */
+ -4, /* (284) cmd ::= DROP TRIGGER ifexists fullname */
+ -6, /* (285) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
+ -3, /* (286) cmd ::= DETACH database_kw_opt expr */
+ 0, /* (287) key_opt ::= */
+ -2, /* (288) key_opt ::= KEY expr */
+ -1, /* (289) cmd ::= REINDEX */
+ -3, /* (290) cmd ::= REINDEX nm dbnm */
+ -1, /* (291) cmd ::= ANALYZE */
+ -3, /* (292) cmd ::= ANALYZE nm dbnm */
+ -6, /* (293) cmd ::= ALTER TABLE fullname RENAME TO nm */
+ -7, /* (294) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
+ -6, /* (295) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
+ -1, /* (296) add_column_fullname ::= fullname */
+ -8, /* (297) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
+ -1, /* (298) cmd ::= create_vtab */
+ -4, /* (299) cmd ::= create_vtab LP vtabarglist RP */
+ -8, /* (300) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
+ 0, /* (301) vtabarg ::= */
+ -1, /* (302) vtabargtoken ::= ANY */
+ -3, /* (303) vtabargtoken ::= lp anylist RP */
+ -1, /* (304) lp ::= LP */
+ -2, /* (305) with ::= WITH wqlist */
+ -3, /* (306) with ::= WITH RECURSIVE wqlist */
+ -1, /* (307) wqas ::= AS */
+ -2, /* (308) wqas ::= AS MATERIALIZED */
+ -3, /* (309) wqas ::= AS NOT MATERIALIZED */
+ -6, /* (310) wqitem ::= withnm eidlist_opt wqas LP select RP */
+ -1, /* (311) withnm ::= nm */
+ -1, /* (312) wqlist ::= wqitem */
+ -3, /* (313) wqlist ::= wqlist COMMA wqitem */
+ -3, /* (314) windowdefn_list ::= windowdefn_list COMMA windowdefn */
+ -5, /* (315) windowdefn ::= nm AS LP window RP */
+ -5, /* (316) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
+ -6, /* (317) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
+ -4, /* (318) window ::= ORDER BY sortlist frame_opt */
+ -5, /* (319) window ::= nm ORDER BY sortlist frame_opt */
+ -2, /* (320) window ::= nm frame_opt */
+ 0, /* (321) frame_opt ::= */
+ -3, /* (322) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
+ -6, /* (323) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
+ -1, /* (324) range_or_rows ::= RANGE|ROWS|GROUPS */
+ -1, /* (325) frame_bound_s ::= frame_bound */
+ -2, /* (326) frame_bound_s ::= UNBOUNDED PRECEDING */
+ -1, /* (327) frame_bound_e ::= frame_bound */
+ -2, /* (328) frame_bound_e ::= UNBOUNDED FOLLOWING */
+ -2, /* (329) frame_bound ::= expr PRECEDING|FOLLOWING */
+ -2, /* (330) frame_bound ::= CURRENT ROW */
+ 0, /* (331) frame_exclude_opt ::= */
+ -2, /* (332) frame_exclude_opt ::= EXCLUDE frame_exclude */
+ -2, /* (333) frame_exclude ::= NO OTHERS */
+ -2, /* (334) frame_exclude ::= CURRENT ROW */
+ -1, /* (335) frame_exclude ::= GROUP|TIES */
+ -2, /* (336) window_clause ::= WINDOW windowdefn_list */
+ -2, /* (337) filter_over ::= filter_clause over_clause */
+ -1, /* (338) filter_over ::= over_clause */
+ -1, /* (339) filter_over ::= filter_clause */
+ -4, /* (340) over_clause ::= OVER LP window RP */
+ -2, /* (341) over_clause ::= OVER nm */
+ -5, /* (342) filter_clause ::= FILTER LP WHERE expr RP */
+ -1, /* (343) term ::= QNUMBER */
+ -1, /* (344) input ::= cmdlist */
+ -2, /* (345) cmdlist ::= cmdlist ecmd */
+ -1, /* (346) cmdlist ::= ecmd */
+ -1, /* (347) ecmd ::= SEMI */
+ -2, /* (348) ecmd ::= cmdx SEMI */
+ -3, /* (349) ecmd ::= explain cmdx SEMI */
+ 0, /* (350) trans_opt ::= */
+ -1, /* (351) trans_opt ::= TRANSACTION */
+ -2, /* (352) trans_opt ::= TRANSACTION nm */
+ -1, /* (353) savepoint_opt ::= SAVEPOINT */
+ 0, /* (354) savepoint_opt ::= */
+ -2, /* (355) cmd ::= create_table create_table_args */
+ -1, /* (356) table_option_set ::= table_option */
+ -4, /* (357) columnlist ::= columnlist COMMA columnname carglist */
+ -2, /* (358) columnlist ::= columnname carglist */
+ -1, /* (359) nm ::= ID|INDEXED|JOIN_KW */
+ -1, /* (360) nm ::= STRING */
+ -1, /* (361) typetoken ::= typename */
+ -1, /* (362) typename ::= ID|STRING */
+ -1, /* (363) signed ::= plus_num */
+ -1, /* (364) signed ::= minus_num */
+ -2, /* (365) carglist ::= carglist ccons */
+ 0, /* (366) carglist ::= */
+ -2, /* (367) ccons ::= NULL onconf */
+ -4, /* (368) ccons ::= GENERATED ALWAYS AS generated */
+ -2, /* (369) ccons ::= AS generated */
+ -2, /* (370) conslist_opt ::= COMMA conslist */
+ -3, /* (371) conslist ::= conslist tconscomma tcons */
+ -1, /* (372) conslist ::= tcons */
+ 0, /* (373) tconscomma ::= */
+ -1, /* (374) defer_subclause_opt ::= defer_subclause */
+ -1, /* (375) resolvetype ::= raisetype */
+ -1, /* (376) selectnowith ::= oneselect */
+ -1, /* (377) oneselect ::= values */
+ -2, /* (378) sclp ::= selcollist COMMA */
+ -1, /* (379) as ::= ID|STRING */
+ -1, /* (380) indexed_opt ::= indexed_by */
+ 0, /* (381) returning ::= */
+ -1, /* (382) expr ::= term */
+ -1, /* (383) likeop ::= LIKE_KW|MATCH */
+ -1, /* (384) case_operand ::= expr */
+ -1, /* (385) exprlist ::= nexprlist */
+ -1, /* (386) nmnum ::= plus_num */
+ -1, /* (387) nmnum ::= nm */
+ -1, /* (388) nmnum ::= ON */
+ -1, /* (389) nmnum ::= DELETE */
+ -1, /* (390) nmnum ::= DEFAULT */
+ -1, /* (391) plus_num ::= INTEGER|FLOAT */
+ 0, /* (392) foreach_clause ::= */
+ -3, /* (393) foreach_clause ::= FOR EACH ROW */
+ -1, /* (394) trnm ::= nm */
+ 0, /* (395) tridxby ::= */
+ -1, /* (396) database_kw_opt ::= DATABASE */
+ 0, /* (397) database_kw_opt ::= */
+ 0, /* (398) kwcolumn_opt ::= */
+ -1, /* (399) kwcolumn_opt ::= COLUMNKW */
+ -1, /* (400) vtabarglist ::= vtabarg */
+ -3, /* (401) vtabarglist ::= vtabarglist COMMA vtabarg */
+ -2, /* (402) vtabarg ::= vtabarg vtabargtoken */
+ 0, /* (403) anylist ::= */
+ -4, /* (404) anylist ::= anylist LP anylist RP */
+ -2, /* (405) anylist ::= anylist ANY */
+ 0, /* (406) with ::= */
+ -1, /* (407) windowdefn_list ::= windowdefn */
+ -1, /* (408) window ::= frame_opt */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -174724,16 +176126,16 @@ static YYACTIONTYPE yy_reduce(
{ sqlite3FinishCoding(pParse); }
break;
case 3: /* cmd ::= BEGIN transtype trans_opt */
-{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy394);}
+{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy144);}
break;
case 4: /* transtype ::= */
-{yymsp[1].minor.yy394 = TK_DEFERRED;}
+{yymsp[1].minor.yy144 = TK_DEFERRED;}
break;
case 5: /* transtype ::= DEFERRED */
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
- case 321: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==321);
-{yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/}
+ case 324: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==324);
+{yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/}
break;
case 8: /* cmd ::= COMMIT|END trans_opt */
case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
@@ -174756,7 +176158,7 @@ static YYACTIONTYPE yy_reduce(
break;
case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
{
- sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy394,0,0,yymsp[-2].minor.yy394);
+ sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy144,0,0,yymsp[-2].minor.yy144);
}
break;
case 14: /* createkw ::= CREATE */
@@ -174768,40 +176170,40 @@ static YYACTIONTYPE yy_reduce(
case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
- case 98: /* distinct ::= */ yytestcase(yyruleno==98);
- case 244: /* collate ::= */ yytestcase(yyruleno==244);
-{yymsp[1].minor.yy394 = 0;}
+ case 100: /* distinct ::= */ yytestcase(yyruleno==100);
+ case 246: /* collate ::= */ yytestcase(yyruleno==246);
+{yymsp[1].minor.yy144 = 0;}
break;
case 16: /* ifnotexists ::= IF NOT EXISTS */
-{yymsp[-2].minor.yy394 = 1;}
+{yymsp[-2].minor.yy144 = 1;}
break;
case 17: /* temp ::= TEMP */
-{yymsp[0].minor.yy394 = pParse->db->init.busy==0;}
+{yymsp[0].minor.yy144 = pParse->db->init.busy==0;}
break;
case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */
{
- sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy285,0);
+ sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy391,0);
}
break;
case 20: /* create_table_args ::= AS select */
{
- sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy47);
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47);
+ sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy555);
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555);
}
break;
case 21: /* table_option_set ::= */
-{yymsp[1].minor.yy285 = 0;}
+{yymsp[1].minor.yy391 = 0;}
break;
case 22: /* table_option_set ::= table_option_set COMMA table_option */
-{yylhsminor.yy285 = yymsp[-2].minor.yy285|yymsp[0].minor.yy285;}
- yymsp[-2].minor.yy285 = yylhsminor.yy285;
+{yylhsminor.yy391 = yymsp[-2].minor.yy391|yymsp[0].minor.yy391;}
+ yymsp[-2].minor.yy391 = yylhsminor.yy391;
break;
case 23: /* table_option ::= WITHOUT nm */
{
if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
- yymsp[-1].minor.yy285 = TF_WithoutRowid | TF_NoVisibleRowid;
+ yymsp[-1].minor.yy391 = TF_WithoutRowid | TF_NoVisibleRowid;
}else{
- yymsp[-1].minor.yy285 = 0;
+ yymsp[-1].minor.yy391 = 0;
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
}
}
@@ -174809,20 +176211,20 @@ static YYACTIONTYPE yy_reduce(
case 24: /* table_option ::= nm */
{
if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){
- yylhsminor.yy285 = TF_Strict;
+ yylhsminor.yy391 = TF_Strict;
}else{
- yylhsminor.yy285 = 0;
+ yylhsminor.yy391 = 0;
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
}
}
- yymsp[0].minor.yy285 = yylhsminor.yy285;
+ yymsp[0].minor.yy391 = yylhsminor.yy391;
break;
case 25: /* columnname ::= nm typetoken */
{sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);}
break;
case 26: /* typetoken ::= */
case 65: /* conslist_opt ::= */ yytestcase(yyruleno==65);
- case 104: /* as ::= */ yytestcase(yyruleno==104);
+ case 106: /* as ::= */ yytestcase(yyruleno==106);
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
break;
case 27: /* typetoken ::= typename LP signed RP */
@@ -174841,7 +176243,7 @@ static YYACTIONTYPE yy_reduce(
case 30: /* scanpt ::= */
{
assert( yyLookahead!=YYNOCODE );
- yymsp[1].minor.yy522 = yyLookaheadToken.z;
+ yymsp[1].minor.yy168 = yyLookaheadToken.z;
}
break;
case 31: /* scantok ::= */
@@ -174855,17 +176257,17 @@ static YYACTIONTYPE yy_reduce(
{pParse->constraintName = yymsp[0].minor.yy0;}
break;
case 33: /* ccons ::= DEFAULT scantok term */
-{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
+{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
break;
case 34: /* ccons ::= DEFAULT LP expr RP */
-{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
+{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
break;
case 35: /* ccons ::= DEFAULT PLUS scantok term */
-{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
+{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
break;
case 36: /* ccons ::= DEFAULT MINUS scantok term */
{
- Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy528, 0);
+ Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy454, 0);
sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
}
break;
@@ -174880,151 +176282,151 @@ static YYACTIONTYPE yy_reduce(
}
break;
case 38: /* ccons ::= NOT NULL onconf */
-{sqlite3AddNotNull(pParse, yymsp[0].minor.yy394);}
+{sqlite3AddNotNull(pParse, yymsp[0].minor.yy144);}
break;
case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
-{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy394,yymsp[0].minor.yy394,yymsp[-2].minor.yy394);}
+{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy144,yymsp[0].minor.yy144,yymsp[-2].minor.yy144);}
break;
case 40: /* ccons ::= UNIQUE onconf */
-{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy394,0,0,0,0,
+{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy144,0,0,0,0,
SQLITE_IDXTYPE_UNIQUE);}
break;
case 41: /* ccons ::= CHECK LP expr RP */
-{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
+{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
break;
case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */
-{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy394);}
+{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy14,yymsp[0].minor.yy144);}
break;
case 43: /* ccons ::= defer_subclause */
-{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy394);}
+{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy144);}
break;
case 44: /* ccons ::= COLLATE ID|STRING */
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
break;
case 45: /* generated ::= LP expr RP */
-{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy528,0);}
+{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy454,0);}
break;
case 46: /* generated ::= LP expr RP ID */
-{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy528,&yymsp[0].minor.yy0);}
+{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy454,&yymsp[0].minor.yy0);}
break;
case 48: /* autoinc ::= AUTOINCR */
-{yymsp[0].minor.yy394 = 1;}
+{yymsp[0].minor.yy144 = 1;}
break;
case 49: /* refargs ::= */
-{ yymsp[1].minor.yy394 = OE_None*0x0101; /* EV: R-19803-45884 */}
+{ yymsp[1].minor.yy144 = OE_None*0x0101; /* EV: R-19803-45884 */}
break;
case 50: /* refargs ::= refargs refarg */
-{ yymsp[-1].minor.yy394 = (yymsp[-1].minor.yy394 & ~yymsp[0].minor.yy231.mask) | yymsp[0].minor.yy231.value; }
+{ yymsp[-1].minor.yy144 = (yymsp[-1].minor.yy144 & ~yymsp[0].minor.yy383.mask) | yymsp[0].minor.yy383.value; }
break;
case 51: /* refarg ::= MATCH nm */
-{ yymsp[-1].minor.yy231.value = 0; yymsp[-1].minor.yy231.mask = 0x000000; }
+{ yymsp[-1].minor.yy383.value = 0; yymsp[-1].minor.yy383.mask = 0x000000; }
break;
case 52: /* refarg ::= ON INSERT refact */
-{ yymsp[-2].minor.yy231.value = 0; yymsp[-2].minor.yy231.mask = 0x000000; }
+{ yymsp[-2].minor.yy383.value = 0; yymsp[-2].minor.yy383.mask = 0x000000; }
break;
case 53: /* refarg ::= ON DELETE refact */
-{ yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394; yymsp[-2].minor.yy231.mask = 0x0000ff; }
+{ yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144; yymsp[-2].minor.yy383.mask = 0x0000ff; }
break;
case 54: /* refarg ::= ON UPDATE refact */
-{ yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394<<8; yymsp[-2].minor.yy231.mask = 0x00ff00; }
+{ yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144<<8; yymsp[-2].minor.yy383.mask = 0x00ff00; }
break;
case 55: /* refact ::= SET NULL */
-{ yymsp[-1].minor.yy394 = OE_SetNull; /* EV: R-33326-45252 */}
+{ yymsp[-1].minor.yy144 = OE_SetNull; /* EV: R-33326-45252 */}
break;
case 56: /* refact ::= SET DEFAULT */
-{ yymsp[-1].minor.yy394 = OE_SetDflt; /* EV: R-33326-45252 */}
+{ yymsp[-1].minor.yy144 = OE_SetDflt; /* EV: R-33326-45252 */}
break;
case 57: /* refact ::= CASCADE */
-{ yymsp[0].minor.yy394 = OE_Cascade; /* EV: R-33326-45252 */}
+{ yymsp[0].minor.yy144 = OE_Cascade; /* EV: R-33326-45252 */}
break;
case 58: /* refact ::= RESTRICT */
-{ yymsp[0].minor.yy394 = OE_Restrict; /* EV: R-33326-45252 */}
+{ yymsp[0].minor.yy144 = OE_Restrict; /* EV: R-33326-45252 */}
break;
case 59: /* refact ::= NO ACTION */
-{ yymsp[-1].minor.yy394 = OE_None; /* EV: R-33326-45252 */}
+{ yymsp[-1].minor.yy144 = OE_None; /* EV: R-33326-45252 */}
break;
case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
-{yymsp[-2].minor.yy394 = 0;}
+{yymsp[-2].minor.yy144 = 0;}
break;
case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76);
- case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171);
-{yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;}
+ case 173: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==173);
+{yymsp[-1].minor.yy144 = yymsp[0].minor.yy144;}
break;
case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
- case 217: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==217);
- case 220: /* in_op ::= NOT IN */ yytestcase(yyruleno==220);
- case 245: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==245);
-{yymsp[-1].minor.yy394 = 1;}
+ case 219: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==219);
+ case 222: /* in_op ::= NOT IN */ yytestcase(yyruleno==222);
+ case 247: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==247);
+{yymsp[-1].minor.yy144 = 1;}
break;
case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
-{yymsp[-1].minor.yy394 = 0;}
+{yymsp[-1].minor.yy144 = 0;}
break;
case 66: /* tconscomma ::= COMMA */
{pParse->constraintName.n = 0;}
break;
case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
-{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy394,yymsp[-2].minor.yy394,0);}
+{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy14,yymsp[0].minor.yy144,yymsp[-2].minor.yy144,0);}
break;
case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */
-{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy394,0,0,0,0,
+{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy14,yymsp[0].minor.yy144,0,0,0,0,
SQLITE_IDXTYPE_UNIQUE);}
break;
case 70: /* tcons ::= CHECK LP expr RP onconf */
-{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy528,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
+{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy454,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
break;
case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
{
- sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy394);
- sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy394);
+ sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy14, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[-1].minor.yy144);
+ sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy144);
}
break;
case 73: /* onconf ::= */
case 75: /* orconf ::= */ yytestcase(yyruleno==75);
-{yymsp[1].minor.yy394 = OE_Default;}
+{yymsp[1].minor.yy144 = OE_Default;}
break;
case 74: /* onconf ::= ON CONFLICT resolvetype */
-{yymsp[-2].minor.yy394 = yymsp[0].minor.yy394;}
+{yymsp[-2].minor.yy144 = yymsp[0].minor.yy144;}
break;
case 77: /* resolvetype ::= IGNORE */
-{yymsp[0].minor.yy394 = OE_Ignore;}
+{yymsp[0].minor.yy144 = OE_Ignore;}
break;
case 78: /* resolvetype ::= REPLACE */
- case 172: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==172);
-{yymsp[0].minor.yy394 = OE_Replace;}
+ case 174: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==174);
+{yymsp[0].minor.yy144 = OE_Replace;}
break;
case 79: /* cmd ::= DROP TABLE ifexists fullname */
{
- sqlite3DropTable(pParse, yymsp[0].minor.yy131, 0, yymsp[-1].minor.yy394);
+ sqlite3DropTable(pParse, yymsp[0].minor.yy203, 0, yymsp[-1].minor.yy144);
}
break;
case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
{
- sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[0].minor.yy47, yymsp[-7].minor.yy394, yymsp[-5].minor.yy394);
+ sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[0].minor.yy555, yymsp[-7].minor.yy144, yymsp[-5].minor.yy144);
}
break;
case 83: /* cmd ::= DROP VIEW ifexists fullname */
{
- sqlite3DropTable(pParse, yymsp[0].minor.yy131, 1, yymsp[-1].minor.yy394);
+ sqlite3DropTable(pParse, yymsp[0].minor.yy203, 1, yymsp[-1].minor.yy144);
}
break;
case 84: /* cmd ::= select */
{
SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
- sqlite3Select(pParse, yymsp[0].minor.yy47, &dest);
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47);
+ sqlite3Select(pParse, yymsp[0].minor.yy555, &dest);
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555);
}
break;
case 85: /* select ::= WITH wqlist selectnowith */
-{yymsp[-2].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);}
+{yymsp[-2].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);}
break;
case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */
-{yymsp[-3].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);}
+{yymsp[-3].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);}
break;
case 87: /* select ::= selectnowith */
{
- Select *p = yymsp[0].minor.yy47;
+ Select *p = yymsp[0].minor.yy555;
if( p ){
parserDoubleLinkSelect(pParse, p);
}
@@ -175032,8 +176434,8 @@ static YYACTIONTYPE yy_reduce(
break;
case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */
{
- Select *pRhs = yymsp[0].minor.yy47;
- Select *pLhs = yymsp[-2].minor.yy47;
+ Select *pRhs = yymsp[0].minor.yy555;
+ Select *pLhs = yymsp[-2].minor.yy555;
if( pRhs && pRhs->pPrior ){
SrcList *pFrom;
Token x;
@@ -175043,148 +176445,145 @@ static YYACTIONTYPE yy_reduce(
pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
}
if( pRhs ){
- pRhs->op = (u8)yymsp[-1].minor.yy394;
+ pRhs->op = (u8)yymsp[-1].minor.yy144;
pRhs->pPrior = pLhs;
if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
pRhs->selFlags &= ~SF_MultiValue;
- if( yymsp[-1].minor.yy394!=TK_ALL ) pParse->hasCompound = 1;
+ if( yymsp[-1].minor.yy144!=TK_ALL ) pParse->hasCompound = 1;
}else{
sqlite3SelectDelete(pParse->db, pLhs);
}
- yymsp[-2].minor.yy47 = pRhs;
+ yymsp[-2].minor.yy555 = pRhs;
}
break;
case 89: /* multiselect_op ::= UNION */
case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91);
-{yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-OP*/}
+{yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-OP*/}
break;
case 90: /* multiselect_op ::= UNION ALL */
-{yymsp[-1].minor.yy394 = TK_ALL;}
+{yymsp[-1].minor.yy144 = TK_ALL;}
break;
case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
{
- yymsp[-8].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy322,yymsp[-5].minor.yy131,yymsp[-4].minor.yy528,yymsp[-3].minor.yy322,yymsp[-2].minor.yy528,yymsp[-1].minor.yy322,yymsp[-7].minor.yy394,yymsp[0].minor.yy528);
+ yymsp[-8].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy14,yymsp[-5].minor.yy203,yymsp[-4].minor.yy454,yymsp[-3].minor.yy14,yymsp[-2].minor.yy454,yymsp[-1].minor.yy14,yymsp[-7].minor.yy144,yymsp[0].minor.yy454);
}
break;
case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
{
- yymsp[-9].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy322,yymsp[-6].minor.yy131,yymsp[-5].minor.yy528,yymsp[-4].minor.yy322,yymsp[-3].minor.yy528,yymsp[-1].minor.yy322,yymsp[-8].minor.yy394,yymsp[0].minor.yy528);
- if( yymsp[-9].minor.yy47 ){
- yymsp[-9].minor.yy47->pWinDefn = yymsp[-2].minor.yy41;
+ yymsp[-9].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy14,yymsp[-6].minor.yy203,yymsp[-5].minor.yy454,yymsp[-4].minor.yy14,yymsp[-3].minor.yy454,yymsp[-1].minor.yy14,yymsp[-8].minor.yy144,yymsp[0].minor.yy454);
+ if( yymsp[-9].minor.yy555 ){
+ yymsp[-9].minor.yy555->pWinDefn = yymsp[-2].minor.yy211;
}else{
- sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy41);
+ sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy211);
}
}
break;
case 94: /* values ::= VALUES LP nexprlist RP */
{
- yymsp[-3].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values,0);
+ yymsp[-3].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy14,0,0,0,0,0,SF_Values,0);
}
break;
- case 95: /* values ::= values COMMA LP nexprlist RP */
+ case 95: /* oneselect ::= mvalues */
{
- Select *pRight, *pLeft = yymsp[-4].minor.yy47;
- pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values|SF_MultiValue,0);
- if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
- if( pRight ){
- pRight->op = TK_ALL;
- pRight->pPrior = pLeft;
- yymsp[-4].minor.yy47 = pRight;
- }else{
- yymsp[-4].minor.yy47 = pLeft;
- }
+ sqlite3MultiValuesEnd(pParse, yymsp[0].minor.yy555);
+}
+ break;
+ case 96: /* mvalues ::= values COMMA LP nexprlist RP */
+ case 97: /* mvalues ::= mvalues COMMA LP nexprlist RP */ yytestcase(yyruleno==97);
+{
+ yymsp[-4].minor.yy555 = sqlite3MultiValues(pParse, yymsp[-4].minor.yy555, yymsp[-1].minor.yy14);
}
break;
- case 96: /* distinct ::= DISTINCT */
-{yymsp[0].minor.yy394 = SF_Distinct;}
+ case 98: /* distinct ::= DISTINCT */
+{yymsp[0].minor.yy144 = SF_Distinct;}
break;
- case 97: /* distinct ::= ALL */
-{yymsp[0].minor.yy394 = SF_All;}
+ case 99: /* distinct ::= ALL */
+{yymsp[0].minor.yy144 = SF_All;}
break;
- case 99: /* sclp ::= */
- case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132);
- case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142);
- case 232: /* exprlist ::= */ yytestcase(yyruleno==232);
- case 235: /* paren_exprlist ::= */ yytestcase(yyruleno==235);
- case 240: /* eidlist_opt ::= */ yytestcase(yyruleno==240);
-{yymsp[1].minor.yy322 = 0;}
+ case 101: /* sclp ::= */
+ case 134: /* orderby_opt ::= */ yytestcase(yyruleno==134);
+ case 144: /* groupby_opt ::= */ yytestcase(yyruleno==144);
+ case 234: /* exprlist ::= */ yytestcase(yyruleno==234);
+ case 237: /* paren_exprlist ::= */ yytestcase(yyruleno==237);
+ case 242: /* eidlist_opt ::= */ yytestcase(yyruleno==242);
+{yymsp[1].minor.yy14 = 0;}
break;
- case 100: /* selcollist ::= sclp scanpt expr scanpt as */
+ case 102: /* selcollist ::= sclp scanpt expr scanpt as */
{
- yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
- if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[0].minor.yy0, 1);
- sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy322,yymsp[-3].minor.yy522,yymsp[-1].minor.yy522);
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[-2].minor.yy454);
+ if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[0].minor.yy0, 1);
+ sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy14,yymsp[-3].minor.yy168,yymsp[-1].minor.yy168);
}
break;
- case 101: /* selcollist ::= sclp scanpt STAR */
+ case 103: /* selcollist ::= sclp scanpt STAR */
{
Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
sqlite3ExprSetErrorOffset(p, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
- yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, p);
+ yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy14, p);
}
break;
- case 102: /* selcollist ::= sclp scanpt nm DOT STAR */
+ case 104: /* selcollist ::= sclp scanpt nm DOT STAR */
{
Expr *pRight, *pLeft, *pDot;
pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
sqlite3ExprSetErrorOffset(pRight, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
pLeft = tokenExpr(pParse, TK_ID, yymsp[-2].minor.yy0);
pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
- yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, pDot);
}
break;
- case 103: /* as ::= AS nm */
- case 115: /* dbnm ::= DOT nm */ yytestcase(yyruleno==115);
- case 256: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==256);
- case 257: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==257);
+ case 105: /* as ::= AS nm */
+ case 117: /* dbnm ::= DOT nm */ yytestcase(yyruleno==117);
+ case 258: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==258);
+ case 259: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==259);
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
break;
- case 105: /* from ::= */
- case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108);
-{yymsp[1].minor.yy131 = 0;}
+ case 107: /* from ::= */
+ case 110: /* stl_prefix ::= */ yytestcase(yyruleno==110);
+{yymsp[1].minor.yy203 = 0;}
break;
- case 106: /* from ::= FROM seltablist */
+ case 108: /* from ::= FROM seltablist */
{
- yymsp[-1].minor.yy131 = yymsp[0].minor.yy131;
- sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy131);
+ yymsp[-1].minor.yy203 = yymsp[0].minor.yy203;
+ sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy203);
}
break;
- case 107: /* stl_prefix ::= seltablist joinop */
+ case 109: /* stl_prefix ::= seltablist joinop */
{
- if( ALWAYS(yymsp[-1].minor.yy131 && yymsp[-1].minor.yy131->nSrc>0) ) yymsp[-1].minor.yy131->a[yymsp[-1].minor.yy131->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy394;
+ if( ALWAYS(yymsp[-1].minor.yy203 && yymsp[-1].minor.yy203->nSrc>0) ) yymsp[-1].minor.yy203->a[yymsp[-1].minor.yy203->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy144;
}
break;
- case 109: /* seltablist ::= stl_prefix nm dbnm as on_using */
+ case 111: /* seltablist ::= stl_prefix nm dbnm as on_using */
{
- yymsp[-4].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy131,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy561);
+ yymsp[-4].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy203,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
}
break;
- case 110: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
+ case 112: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
{
- yymsp[-5].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy131,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy561);
- sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy131, &yymsp[-1].minor.yy0);
+ yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy269);
+ sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-1].minor.yy0);
}
break;
- case 111: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
+ case 113: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
{
- yymsp[-7].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy131,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy561);
- sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy131, yymsp[-3].minor.yy322);
+ yymsp[-7].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy203,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
+ sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy203, yymsp[-3].minor.yy14);
}
break;
- case 112: /* seltablist ::= stl_prefix LP select RP as on_using */
+ case 114: /* seltablist ::= stl_prefix LP select RP as on_using */
{
- yymsp[-5].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy131,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy47,&yymsp[0].minor.yy561);
+ yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy555,&yymsp[0].minor.yy269);
}
break;
- case 113: /* seltablist ::= stl_prefix LP seltablist RP as on_using */
+ case 115: /* seltablist ::= stl_prefix LP seltablist RP as on_using */
{
- if( yymsp[-5].minor.yy131==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy561.pOn==0 && yymsp[0].minor.yy561.pUsing==0 ){
- yymsp[-5].minor.yy131 = yymsp[-3].minor.yy131;
- }else if( ALWAYS(yymsp[-3].minor.yy131!=0) && yymsp[-3].minor.yy131->nSrc==1 ){
- yymsp[-5].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy131,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy561);
- if( yymsp[-5].minor.yy131 ){
- SrcItem *pNew = &yymsp[-5].minor.yy131->a[yymsp[-5].minor.yy131->nSrc-1];
- SrcItem *pOld = yymsp[-3].minor.yy131->a;
+ if( yymsp[-5].minor.yy203==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy269.pOn==0 && yymsp[0].minor.yy269.pUsing==0 ){
+ yymsp[-5].minor.yy203 = yymsp[-3].minor.yy203;
+ }else if( ALWAYS(yymsp[-3].minor.yy203!=0) && yymsp[-3].minor.yy203->nSrc==1 ){
+ yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
+ if( yymsp[-5].minor.yy203 ){
+ SrcItem *pNew = &yymsp[-5].minor.yy203->a[yymsp[-5].minor.yy203->nSrc-1];
+ SrcItem *pOld = yymsp[-3].minor.yy203->a;
pNew->zName = pOld->zName;
pNew->zDatabase = pOld->zDatabase;
pNew->pSelect = pOld->pSelect;
@@ -175200,153 +176599,153 @@ static YYACTIONTYPE yy_reduce(
pOld->zName = pOld->zDatabase = 0;
pOld->pSelect = 0;
}
- sqlite3SrcListDelete(pParse->db, yymsp[-3].minor.yy131);
+ sqlite3SrcListDelete(pParse->db, yymsp[-3].minor.yy203);
}else{
Select *pSubquery;
- sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy131);
- pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy131,0,0,0,0,SF_NestedFrom,0);
- yymsp[-5].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy131,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy561);
+ sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy203);
+ pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy203,0,0,0,0,SF_NestedFrom,0);
+ yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy269);
}
}
break;
- case 114: /* dbnm ::= */
- case 129: /* indexed_opt ::= */ yytestcase(yyruleno==129);
+ case 116: /* dbnm ::= */
+ case 131: /* indexed_opt ::= */ yytestcase(yyruleno==131);
{yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
break;
- case 116: /* fullname ::= nm */
+ case 118: /* fullname ::= nm */
{
- yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
- if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0);
+ yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
+ if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0);
}
- yymsp[0].minor.yy131 = yylhsminor.yy131;
+ yymsp[0].minor.yy203 = yylhsminor.yy203;
break;
- case 117: /* fullname ::= nm DOT nm */
+ case 119: /* fullname ::= nm DOT nm */
{
- yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
- if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0);
+ yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
+ if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0);
}
- yymsp[-2].minor.yy131 = yylhsminor.yy131;
+ yymsp[-2].minor.yy203 = yylhsminor.yy203;
break;
- case 118: /* xfullname ::= nm */
-{yymsp[0].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
+ case 120: /* xfullname ::= nm */
+{yymsp[0].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
break;
- case 119: /* xfullname ::= nm DOT nm */
-{yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
+ case 121: /* xfullname ::= nm DOT nm */
+{yymsp[-2].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
break;
- case 120: /* xfullname ::= nm DOT nm AS nm */
+ case 122: /* xfullname ::= nm DOT nm AS nm */
{
- yymsp[-4].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
- if( yymsp[-4].minor.yy131 ) yymsp[-4].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
+ yymsp[-4].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
+ if( yymsp[-4].minor.yy203 ) yymsp[-4].minor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
}
break;
- case 121: /* xfullname ::= nm AS nm */
+ case 123: /* xfullname ::= nm AS nm */
{
- yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
- if( yymsp[-2].minor.yy131 ) yymsp[-2].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
+ yymsp[-2].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
+ if( yymsp[-2].minor.yy203 ) yymsp[-2].minor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
}
break;
- case 122: /* joinop ::= COMMA|JOIN */
-{ yymsp[0].minor.yy394 = JT_INNER; }
+ case 124: /* joinop ::= COMMA|JOIN */
+{ yymsp[0].minor.yy144 = JT_INNER; }
break;
- case 123: /* joinop ::= JOIN_KW JOIN */
-{yymsp[-1].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
+ case 125: /* joinop ::= JOIN_KW JOIN */
+{yymsp[-1].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
break;
- case 124: /* joinop ::= JOIN_KW nm JOIN */
-{yymsp[-2].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
+ case 126: /* joinop ::= JOIN_KW nm JOIN */
+{yymsp[-2].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
break;
- case 125: /* joinop ::= JOIN_KW nm nm JOIN */
-{yymsp[-3].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
+ case 127: /* joinop ::= JOIN_KW nm nm JOIN */
+{yymsp[-3].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
break;
- case 126: /* on_using ::= ON expr */
-{yymsp[-1].minor.yy561.pOn = yymsp[0].minor.yy528; yymsp[-1].minor.yy561.pUsing = 0;}
+ case 128: /* on_using ::= ON expr */
+{yymsp[-1].minor.yy269.pOn = yymsp[0].minor.yy454; yymsp[-1].minor.yy269.pUsing = 0;}
break;
- case 127: /* on_using ::= USING LP idlist RP */
-{yymsp[-3].minor.yy561.pOn = 0; yymsp[-3].minor.yy561.pUsing = yymsp[-1].minor.yy254;}
+ case 129: /* on_using ::= USING LP idlist RP */
+{yymsp[-3].minor.yy269.pOn = 0; yymsp[-3].minor.yy269.pUsing = yymsp[-1].minor.yy132;}
break;
- case 128: /* on_using ::= */
-{yymsp[1].minor.yy561.pOn = 0; yymsp[1].minor.yy561.pUsing = 0;}
+ case 130: /* on_using ::= */
+{yymsp[1].minor.yy269.pOn = 0; yymsp[1].minor.yy269.pUsing = 0;}
break;
- case 130: /* indexed_by ::= INDEXED BY nm */
+ case 132: /* indexed_by ::= INDEXED BY nm */
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
break;
- case 131: /* indexed_by ::= NOT INDEXED */
+ case 133: /* indexed_by ::= NOT INDEXED */
{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
break;
- case 133: /* orderby_opt ::= ORDER BY sortlist */
- case 143: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==143);
-{yymsp[-2].minor.yy322 = yymsp[0].minor.yy322;}
+ case 135: /* orderby_opt ::= ORDER BY sortlist */
+ case 145: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==145);
+{yymsp[-2].minor.yy14 = yymsp[0].minor.yy14;}
break;
- case 134: /* sortlist ::= sortlist COMMA expr sortorder nulls */
+ case 136: /* sortlist ::= sortlist COMMA expr sortorder nulls */
{
- yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322,yymsp[-2].minor.yy528);
- sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394);
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14,yymsp[-2].minor.yy454);
+ sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144);
}
break;
- case 135: /* sortlist ::= expr sortorder nulls */
+ case 137: /* sortlist ::= expr sortorder nulls */
{
- yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy528); /*A-overwrites-Y*/
- sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394);
+ yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy454); /*A-overwrites-Y*/
+ sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144);
}
break;
- case 136: /* sortorder ::= ASC */
-{yymsp[0].minor.yy394 = SQLITE_SO_ASC;}
+ case 138: /* sortorder ::= ASC */
+{yymsp[0].minor.yy144 = SQLITE_SO_ASC;}
break;
- case 137: /* sortorder ::= DESC */
-{yymsp[0].minor.yy394 = SQLITE_SO_DESC;}
+ case 139: /* sortorder ::= DESC */
+{yymsp[0].minor.yy144 = SQLITE_SO_DESC;}
break;
- case 138: /* sortorder ::= */
- case 141: /* nulls ::= */ yytestcase(yyruleno==141);
-{yymsp[1].minor.yy394 = SQLITE_SO_UNDEFINED;}
+ case 140: /* sortorder ::= */
+ case 143: /* nulls ::= */ yytestcase(yyruleno==143);
+{yymsp[1].minor.yy144 = SQLITE_SO_UNDEFINED;}
break;
- case 139: /* nulls ::= NULLS FIRST */
-{yymsp[-1].minor.yy394 = SQLITE_SO_ASC;}
+ case 141: /* nulls ::= NULLS FIRST */
+{yymsp[-1].minor.yy144 = SQLITE_SO_ASC;}
break;
- case 140: /* nulls ::= NULLS LAST */
-{yymsp[-1].minor.yy394 = SQLITE_SO_DESC;}
+ case 142: /* nulls ::= NULLS LAST */
+{yymsp[-1].minor.yy144 = SQLITE_SO_DESC;}
break;
- case 144: /* having_opt ::= */
- case 146: /* limit_opt ::= */ yytestcase(yyruleno==146);
- case 151: /* where_opt ::= */ yytestcase(yyruleno==151);
- case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153);
- case 230: /* case_else ::= */ yytestcase(yyruleno==230);
- case 231: /* case_operand ::= */ yytestcase(yyruleno==231);
- case 250: /* vinto ::= */ yytestcase(yyruleno==250);
-{yymsp[1].minor.yy528 = 0;}
+ case 146: /* having_opt ::= */
+ case 148: /* limit_opt ::= */ yytestcase(yyruleno==148);
+ case 153: /* where_opt ::= */ yytestcase(yyruleno==153);
+ case 155: /* where_opt_ret ::= */ yytestcase(yyruleno==155);
+ case 232: /* case_else ::= */ yytestcase(yyruleno==232);
+ case 233: /* case_operand ::= */ yytestcase(yyruleno==233);
+ case 252: /* vinto ::= */ yytestcase(yyruleno==252);
+{yymsp[1].minor.yy454 = 0;}
break;
- case 145: /* having_opt ::= HAVING expr */
- case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152);
- case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154);
- case 229: /* case_else ::= ELSE expr */ yytestcase(yyruleno==229);
- case 249: /* vinto ::= INTO expr */ yytestcase(yyruleno==249);
-{yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;}
+ case 147: /* having_opt ::= HAVING expr */
+ case 154: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==154);
+ case 156: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==156);
+ case 231: /* case_else ::= ELSE expr */ yytestcase(yyruleno==231);
+ case 251: /* vinto ::= INTO expr */ yytestcase(yyruleno==251);
+{yymsp[-1].minor.yy454 = yymsp[0].minor.yy454;}
break;
- case 147: /* limit_opt ::= LIMIT expr */
-{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);}
+ case 149: /* limit_opt ::= LIMIT expr */
+{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,0);}
break;
- case 148: /* limit_opt ::= LIMIT expr OFFSET expr */
-{yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
+ case 150: /* limit_opt ::= LIMIT expr OFFSET expr */
+{yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
break;
- case 149: /* limit_opt ::= LIMIT expr COMMA expr */
-{yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,yymsp[-2].minor.yy528);}
+ case 151: /* limit_opt ::= LIMIT expr COMMA expr */
+{yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,yymsp[-2].minor.yy454);}
break;
- case 150: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
+ case 152: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
{
- sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy131, &yymsp[-1].minor.yy0);
- sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy131,yymsp[0].minor.yy528,0,0);
+ sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy203, &yymsp[-1].minor.yy0);
+ sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy203,yymsp[0].minor.yy454,0,0);
}
break;
- case 155: /* where_opt_ret ::= RETURNING selcollist */
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-1].minor.yy528 = 0;}
+ case 157: /* where_opt_ret ::= RETURNING selcollist */
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-1].minor.yy454 = 0;}
break;
- case 156: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-3].minor.yy528 = yymsp[-2].minor.yy528;}
+ case 158: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-3].minor.yy454 = yymsp[-2].minor.yy454;}
break;
- case 157: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
+ case 159: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
{
- sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy131, &yymsp[-4].minor.yy0);
- sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy322,"set list");
- if( yymsp[-1].minor.yy131 ){
- SrcList *pFromClause = yymsp[-1].minor.yy131;
+ sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-4].minor.yy0);
+ sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy14,"set list");
+ if( yymsp[-1].minor.yy203 ){
+ SrcList *pFromClause = yymsp[-1].minor.yy203;
if( pFromClause->nSrc>1 ){
Select *pSubquery;
Token as;
@@ -175355,92 +176754,92 @@ static YYACTIONTYPE yy_reduce(
as.z = 0;
pFromClause = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0);
}
- yymsp[-5].minor.yy131 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy131, pFromClause);
+ yymsp[-5].minor.yy203 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy203, pFromClause);
}
- sqlite3Update(pParse,yymsp[-5].minor.yy131,yymsp[-2].minor.yy322,yymsp[0].minor.yy528,yymsp[-6].minor.yy394,0,0,0);
+ sqlite3Update(pParse,yymsp[-5].minor.yy203,yymsp[-2].minor.yy14,yymsp[0].minor.yy454,yymsp[-6].minor.yy144,0,0,0);
}
break;
- case 158: /* setlist ::= setlist COMMA nm EQ expr */
+ case 160: /* setlist ::= setlist COMMA nm EQ expr */
{
- yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
- sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, 1);
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[0].minor.yy454);
+ sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, 1);
}
break;
- case 159: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
+ case 161: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
{
- yymsp[-6].minor.yy322 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy322, yymsp[-3].minor.yy254, yymsp[0].minor.yy528);
+ yymsp[-6].minor.yy14 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy14, yymsp[-3].minor.yy132, yymsp[0].minor.yy454);
}
break;
- case 160: /* setlist ::= nm EQ expr */
+ case 162: /* setlist ::= nm EQ expr */
{
- yylhsminor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy528);
- sqlite3ExprListSetName(pParse, yylhsminor.yy322, &yymsp[-2].minor.yy0, 1);
+ yylhsminor.yy14 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy454);
+ sqlite3ExprListSetName(pParse, yylhsminor.yy14, &yymsp[-2].minor.yy0, 1);
}
- yymsp[-2].minor.yy322 = yylhsminor.yy322;
+ yymsp[-2].minor.yy14 = yylhsminor.yy14;
break;
- case 161: /* setlist ::= LP idlist RP EQ expr */
+ case 163: /* setlist ::= LP idlist RP EQ expr */
{
- yymsp[-4].minor.yy322 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy254, yymsp[0].minor.yy528);
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy132, yymsp[0].minor.yy454);
}
break;
- case 162: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
+ case 164: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
{
- sqlite3Insert(pParse, yymsp[-3].minor.yy131, yymsp[-1].minor.yy47, yymsp[-2].minor.yy254, yymsp[-5].minor.yy394, yymsp[0].minor.yy444);
+ sqlite3Insert(pParse, yymsp[-3].minor.yy203, yymsp[-1].minor.yy555, yymsp[-2].minor.yy132, yymsp[-5].minor.yy144, yymsp[0].minor.yy122);
}
break;
- case 163: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
+ case 165: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
{
- sqlite3Insert(pParse, yymsp[-4].minor.yy131, 0, yymsp[-3].minor.yy254, yymsp[-6].minor.yy394, 0);
+ sqlite3Insert(pParse, yymsp[-4].minor.yy203, 0, yymsp[-3].minor.yy132, yymsp[-6].minor.yy144, 0);
}
break;
- case 164: /* upsert ::= */
-{ yymsp[1].minor.yy444 = 0; }
+ case 166: /* upsert ::= */
+{ yymsp[1].minor.yy122 = 0; }
break;
- case 165: /* upsert ::= RETURNING selcollist */
-{ yymsp[-1].minor.yy444 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy322); }
+ case 167: /* upsert ::= RETURNING selcollist */
+{ yymsp[-1].minor.yy122 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy14); }
break;
- case 166: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
-{ yymsp[-11].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy322,yymsp[-6].minor.yy528,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,yymsp[0].minor.yy444);}
+ case 168: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
+{ yymsp[-11].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy14,yymsp[-6].minor.yy454,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,yymsp[0].minor.yy122);}
break;
- case 167: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
-{ yymsp[-8].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy322,yymsp[-3].minor.yy528,0,0,yymsp[0].minor.yy444); }
+ case 169: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
+{ yymsp[-8].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy14,yymsp[-3].minor.yy454,0,0,yymsp[0].minor.yy122); }
break;
- case 168: /* upsert ::= ON CONFLICT DO NOTHING returning */
-{ yymsp[-4].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
+ case 170: /* upsert ::= ON CONFLICT DO NOTHING returning */
+{ yymsp[-4].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
break;
- case 169: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
-{ yymsp[-7].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,0);}
+ case 171: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
+{ yymsp[-7].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,0);}
break;
- case 170: /* returning ::= RETURNING selcollist */
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy322);}
+ case 172: /* returning ::= RETURNING selcollist */
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy14);}
break;
- case 173: /* idlist_opt ::= */
-{yymsp[1].minor.yy254 = 0;}
+ case 175: /* idlist_opt ::= */
+{yymsp[1].minor.yy132 = 0;}
break;
- case 174: /* idlist_opt ::= LP idlist RP */
-{yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;}
+ case 176: /* idlist_opt ::= LP idlist RP */
+{yymsp[-2].minor.yy132 = yymsp[-1].minor.yy132;}
break;
- case 175: /* idlist ::= idlist COMMA nm */
-{yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
+ case 177: /* idlist ::= idlist COMMA nm */
+{yymsp[-2].minor.yy132 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy132,&yymsp[0].minor.yy0);}
break;
- case 176: /* idlist ::= nm */
-{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
+ case 178: /* idlist ::= nm */
+{yymsp[0].minor.yy132 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
break;
- case 177: /* expr ::= LP expr RP */
-{yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;}
+ case 179: /* expr ::= LP expr RP */
+{yymsp[-2].minor.yy454 = yymsp[-1].minor.yy454;}
break;
- case 178: /* expr ::= ID|INDEXED|JOIN_KW */
-{yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
+ case 180: /* expr ::= ID|INDEXED|JOIN_KW */
+{yymsp[0].minor.yy454=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
break;
- case 179: /* expr ::= nm DOT nm */
+ case 181: /* expr ::= nm DOT nm */
{
Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
- yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
+ yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
}
- yymsp[-2].minor.yy528 = yylhsminor.yy528;
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
- case 180: /* expr ::= nm DOT nm DOT nm */
+ case 182: /* expr ::= nm DOT nm DOT nm */
{
Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
@@ -175449,27 +176848,27 @@ static YYACTIONTYPE yy_reduce(
if( IN_RENAME_OBJECT ){
sqlite3RenameTokenRemap(pParse, 0, temp1);
}
- yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
+ yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
}
- yymsp[-4].minor.yy528 = yylhsminor.yy528;
+ yymsp[-4].minor.yy454 = yylhsminor.yy454;
break;
- case 181: /* term ::= NULL|FLOAT|BLOB */
- case 182: /* term ::= STRING */ yytestcase(yyruleno==182);
-{yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
+ case 183: /* term ::= NULL|FLOAT|BLOB */
+ case 184: /* term ::= STRING */ yytestcase(yyruleno==184);
+{yymsp[0].minor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
break;
- case 183: /* term ::= INTEGER */
+ case 185: /* term ::= INTEGER */
{
- yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
- if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
+ yylhsminor.yy454 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
+ if( yylhsminor.yy454 ) yylhsminor.yy454->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
}
- yymsp[0].minor.yy528 = yylhsminor.yy528;
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
break;
- case 184: /* expr ::= VARIABLE */
+ case 186: /* expr ::= VARIABLE */
{
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
u32 n = yymsp[0].minor.yy0.n;
- yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
- sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n);
+ yymsp[0].minor.yy454 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
+ sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy454, n);
}else{
/* When doing a nested parse, one can include terms in an expression
** that look like this: #1 #2 ... These terms refer to registers
@@ -175478,194 +176877,203 @@ static YYACTIONTYPE yy_reduce(
assert( t.n>=2 );
if( pParse->nested==0 ){
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);
- yymsp[0].minor.yy528 = 0;
+ yymsp[0].minor.yy454 = 0;
}else{
- yymsp[0].minor.yy528 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
- if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable);
+ yymsp[0].minor.yy454 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
+ if( yymsp[0].minor.yy454 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy454->iTable);
}
}
}
break;
- case 185: /* expr ::= expr COLLATE ID|STRING */
+ case 187: /* expr ::= expr COLLATE ID|STRING */
{
- yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1);
+ yymsp[-2].minor.yy454 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy454, &yymsp[0].minor.yy0, 1);
}
break;
- case 186: /* expr ::= CAST LP expr AS typetoken RP */
+ case 188: /* expr ::= CAST LP expr AS typetoken RP */
{
- yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
- sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0);
+ yymsp[-5].minor.yy454 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
+ sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy454, yymsp[-3].minor.yy454, 0);
}
break;
- case 187: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
+ case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
{
- yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394);
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy144);
}
- yymsp[-4].minor.yy528 = yylhsminor.yy528;
+ yymsp[-4].minor.yy454 = yylhsminor.yy454;
break;
- case 188: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
+ case 190: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
{
- yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy322, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy394);
- sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy528, yymsp[-1].minor.yy322);
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy14, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy144);
+ sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-1].minor.yy14);
}
- yymsp[-7].minor.yy528 = yylhsminor.yy528;
+ yymsp[-7].minor.yy454 = yylhsminor.yy454;
break;
- case 189: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
+ case 191: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
{
- yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
}
- yymsp[-3].minor.yy528 = yylhsminor.yy528;
+ yymsp[-3].minor.yy454 = yylhsminor.yy454;
break;
- case 190: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
+ case 192: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
{
- yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394);
- sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy14, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy144);
+ sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
}
- yymsp[-5].minor.yy528 = yylhsminor.yy528;
+ yymsp[-5].minor.yy454 = yylhsminor.yy454;
break;
- case 191: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
+ case 193: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
{
- yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy322, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy394);
- sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
- sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy528, yymsp[-2].minor.yy322);
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy14, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy144);
+ sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
+ sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-2].minor.yy14);
}
- yymsp[-8].minor.yy528 = yylhsminor.yy528;
+ yymsp[-8].minor.yy454 = yylhsminor.yy454;
break;
- case 192: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
+ case 194: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
{
- yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
- sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
+ sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
}
- yymsp[-4].minor.yy528 = yylhsminor.yy528;
+ yymsp[-4].minor.yy454 = yylhsminor.yy454;
break;
- case 193: /* term ::= CTIME_KW */
+ case 195: /* term ::= CTIME_KW */
{
- yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
}
- yymsp[0].minor.yy528 = yylhsminor.yy528;
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
break;
- case 194: /* expr ::= LP nexprlist COMMA expr RP */
+ case 196: /* expr ::= LP nexprlist COMMA expr RP */
{
- ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528);
- yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
- if( yymsp[-4].minor.yy528 ){
- yymsp[-4].minor.yy528->x.pList = pList;
+ ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454);
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
+ if( yymsp[-4].minor.yy454 ){
+ yymsp[-4].minor.yy454->x.pList = pList;
if( ALWAYS(pList->nExpr) ){
- yymsp[-4].minor.yy528->flags |= pList->a[0].pExpr->flags & EP_Propagate;
+ yymsp[-4].minor.yy454->flags |= pList->a[0].pExpr->flags & EP_Propagate;
}
}else{
sqlite3ExprListDelete(pParse->db, pList);
}
}
break;
- case 195: /* expr ::= expr AND expr */
-{yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
+ case 197: /* expr ::= expr AND expr */
+{yymsp[-2].minor.yy454=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
break;
- case 196: /* expr ::= expr OR expr */
- case 197: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==197);
- case 198: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==198);
- case 199: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==199);
- case 200: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==200);
- case 201: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==201);
- case 202: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==202);
-{yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
+ case 198: /* expr ::= expr OR expr */
+ case 199: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==199);
+ case 200: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==200);
+ case 201: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==201);
+ case 202: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==202);
+ case 203: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==203);
+ case 204: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==204);
+{yymsp[-2].minor.yy454=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
break;
- case 203: /* likeop ::= NOT LIKE_KW|MATCH */
+ case 205: /* likeop ::= NOT LIKE_KW|MATCH */
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
break;
- case 204: /* expr ::= expr likeop expr */
+ case 206: /* expr ::= expr likeop expr */
{
ExprList *pList;
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
yymsp[-1].minor.yy0.n &= 0x7fffffff;
- pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528);
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy528);
- yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
- if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0);
- if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc;
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy454);
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy454);
+ yymsp[-2].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
+ if( bNot ) yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy454, 0);
+ if( yymsp[-2].minor.yy454 ) yymsp[-2].minor.yy454->flags |= EP_InfixFunc;
}
break;
- case 205: /* expr ::= expr likeop expr ESCAPE expr */
+ case 207: /* expr ::= expr likeop expr ESCAPE expr */
{
ExprList *pList;
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
yymsp[-3].minor.yy0.n &= 0x7fffffff;
- pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy528);
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
- yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
- if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
- if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc;
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy454);
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
+ yymsp[-4].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
+ if( bNot ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
+ if( yymsp[-4].minor.yy454 ) yymsp[-4].minor.yy454->flags |= EP_InfixFunc;
}
break;
- case 206: /* expr ::= expr ISNULL|NOTNULL */
-{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);}
+ case 208: /* expr ::= expr ISNULL|NOTNULL */
+{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy454,0);}
break;
- case 207: /* expr ::= expr NOT NULL */
-{yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);}
+ case 209: /* expr ::= expr NOT NULL */
+{yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy454,0);}
break;
- case 208: /* expr ::= expr IS expr */
+ case 210: /* expr ::= expr IS expr */
{
- yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL);
+ yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-2].minor.yy454, TK_ISNULL);
}
break;
- case 209: /* expr ::= expr IS NOT expr */
+ case 211: /* expr ::= expr IS NOT expr */
{
- yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528);
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL);
+ yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy454,yymsp[0].minor.yy454);
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-3].minor.yy454, TK_NOTNULL);
}
break;
- case 210: /* expr ::= expr IS NOT DISTINCT FROM expr */
+ case 212: /* expr ::= expr IS NOT DISTINCT FROM expr */
{
- yymsp[-5].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy528,yymsp[0].minor.yy528);
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-5].minor.yy528, TK_ISNULL);
+ yymsp[-5].minor.yy454 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy454,yymsp[0].minor.yy454);
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-5].minor.yy454, TK_ISNULL);
}
break;
- case 211: /* expr ::= expr IS DISTINCT FROM expr */
+ case 213: /* expr ::= expr IS DISTINCT FROM expr */
{
- yymsp[-4].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy528,yymsp[0].minor.yy528);
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-4].minor.yy528, TK_NOTNULL);
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy454,yymsp[0].minor.yy454);
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-4].minor.yy454, TK_NOTNULL);
}
break;
- case 212: /* expr ::= NOT expr */
- case 213: /* expr ::= BITNOT expr */ yytestcase(yyruleno==213);
-{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/}
+ case 214: /* expr ::= NOT expr */
+ case 215: /* expr ::= BITNOT expr */ yytestcase(yyruleno==215);
+{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy454, 0);/*A-overwrites-B*/}
break;
- case 214: /* expr ::= PLUS|MINUS expr */
+ case 216: /* expr ::= PLUS|MINUS expr */
{
- yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0);
- /*A-overwrites-B*/
+ Expr *p = yymsp[0].minor.yy454;
+ u8 op = yymsp[-1].major + (TK_UPLUS-TK_PLUS);
+ assert( TK_UPLUS>TK_PLUS );
+ assert( TK_UMINUS == TK_MINUS + (TK_UPLUS - TK_PLUS) );
+ if( p && p->op==TK_UPLUS ){
+ p->op = op;
+ yymsp[-1].minor.yy454 = p;
+ }else{
+ yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, op, p, 0);
+ /*A-overwrites-B*/
+ }
}
break;
- case 215: /* expr ::= expr PTR expr */
+ case 217: /* expr ::= expr PTR expr */
{
- ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528);
- pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528);
- yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
+ ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy454);
+ pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy454);
+ yylhsminor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
}
- yymsp[-2].minor.yy528 = yylhsminor.yy528;
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
- case 216: /* between_op ::= BETWEEN */
- case 219: /* in_op ::= IN */ yytestcase(yyruleno==219);
-{yymsp[0].minor.yy394 = 0;}
+ case 218: /* between_op ::= BETWEEN */
+ case 221: /* in_op ::= IN */ yytestcase(yyruleno==221);
+{yymsp[0].minor.yy144 = 0;}
break;
- case 218: /* expr ::= expr between_op expr AND expr */
+ case 220: /* expr ::= expr between_op expr AND expr */
{
- ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
- yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0);
- if( yymsp[-4].minor.yy528 ){
- yymsp[-4].minor.yy528->x.pList = pList;
+ ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy454, 0);
+ if( yymsp[-4].minor.yy454 ){
+ yymsp[-4].minor.yy454->x.pList = pList;
}else{
sqlite3ExprListDelete(pParse->db, pList);
}
- if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
+ if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
}
break;
- case 221: /* expr ::= expr in_op LP exprlist RP */
+ case 223: /* expr ::= expr in_op LP exprlist RP */
{
- if( yymsp[-1].minor.yy322==0 ){
+ if( yymsp[-1].minor.yy14==0 ){
/* Expressions of the form
**
** expr1 IN ()
@@ -175674,208 +177082,208 @@ static YYACTIONTYPE yy_reduce(
** simplify to constants 0 (false) and 1 (true), respectively,
** regardless of the value of expr1.
*/
- sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy528);
- yymsp[-4].minor.yy528 = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy394 ? "true" : "false");
- if( yymsp[-4].minor.yy528 ) sqlite3ExprIdToTrueFalse(yymsp[-4].minor.yy528);
- }else{
- Expr *pRHS = yymsp[-1].minor.yy322->a[0].pExpr;
- if( yymsp[-1].minor.yy322->nExpr==1 && sqlite3ExprIsConstant(pRHS) && yymsp[-4].minor.yy528->op!=TK_VECTOR ){
- yymsp[-1].minor.yy322->a[0].pExpr = 0;
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
+ sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy454);
+ yymsp[-4].minor.yy454 = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy144 ? "true" : "false");
+ if( yymsp[-4].minor.yy454 ) sqlite3ExprIdToTrueFalse(yymsp[-4].minor.yy454);
+ }else{
+ Expr *pRHS = yymsp[-1].minor.yy14->a[0].pExpr;
+ if( yymsp[-1].minor.yy14->nExpr==1 && sqlite3ExprIsConstant(pParse,pRHS) && yymsp[-4].minor.yy454->op!=TK_VECTOR ){
+ yymsp[-1].minor.yy14->a[0].pExpr = 0;
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14);
pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
- yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy528, pRHS);
- }else if( yymsp[-1].minor.yy322->nExpr==1 && pRHS->op==TK_SELECT ){
- yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pRHS->x.pSelect);
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy454, pRHS);
+ }else if( yymsp[-1].minor.yy14->nExpr==1 && pRHS->op==TK_SELECT ){
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pRHS->x.pSelect);
pRHS->x.pSelect = 0;
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
- }else{
- yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
- if( yymsp[-4].minor.yy528==0 ){
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
- }else if( yymsp[-4].minor.yy528->pLeft->op==TK_VECTOR ){
- int nExpr = yymsp[-4].minor.yy528->pLeft->x.pList->nExpr;
- Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy322);
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14);
+ }else{
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
+ if( yymsp[-4].minor.yy454==0 ){
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14);
+ }else if( yymsp[-4].minor.yy454->pLeft->op==TK_VECTOR ){
+ int nExpr = yymsp[-4].minor.yy454->pLeft->x.pList->nExpr;
+ Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy14);
if( pSelectRHS ){
parserDoubleLinkSelect(pParse, pSelectRHS);
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelectRHS);
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelectRHS);
}
}else{
- yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy322;
- sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
+ yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy14;
+ sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454);
}
}
- if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
+ if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
}
}
break;
- case 222: /* expr ::= LP select RP */
+ case 224: /* expr ::= LP select RP */
{
- yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
- sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47);
+ yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
+ sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy454, yymsp[-1].minor.yy555);
}
break;
- case 223: /* expr ::= expr in_op LP select RP */
+ case 225: /* expr ::= expr in_op LP select RP */
{
- yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47);
- if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, yymsp[-1].minor.yy555);
+ if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
}
break;
- case 224: /* expr ::= expr in_op nm dbnm paren_exprlist */
+ case 226: /* expr ::= expr in_op nm dbnm paren_exprlist */
{
SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
- if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
- yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect);
- if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
+ if( yymsp[0].minor.yy14 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy14);
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelect);
+ if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
}
break;
- case 225: /* expr ::= EXISTS LP select RP */
+ case 227: /* expr ::= EXISTS LP select RP */
{
Expr *p;
- p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
- sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47);
+ p = yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
+ sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy555);
}
break;
- case 226: /* expr ::= CASE case_operand case_exprlist case_else END */
+ case 228: /* expr ::= CASE case_operand case_exprlist case_else END */
{
- yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0);
- if( yymsp[-4].minor.yy528 ){
- yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322;
- sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
+ yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy454, 0);
+ if( yymsp[-4].minor.yy454 ){
+ yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy454 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454) : yymsp[-2].minor.yy14;
+ sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454);
}else{
- sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
- sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
+ sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy14);
+ sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454);
}
}
break;
- case 227: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
+ case 229: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
{
- yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
- yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[-2].minor.yy454);
+ yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[0].minor.yy454);
}
break;
- case 228: /* case_exprlist ::= WHEN expr THEN expr */
+ case 230: /* case_exprlist ::= WHEN expr THEN expr */
{
- yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
- yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528);
+ yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
+ yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy14, yymsp[0].minor.yy454);
}
break;
- case 233: /* nexprlist ::= nexprlist COMMA expr */
-{yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);}
+ case 235: /* nexprlist ::= nexprlist COMMA expr */
+{yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[0].minor.yy454);}
break;
- case 234: /* nexprlist ::= expr */
-{yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/}
+ case 236: /* nexprlist ::= expr */
+{yymsp[0].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy454); /*A-overwrites-Y*/}
break;
- case 236: /* paren_exprlist ::= LP exprlist RP */
- case 241: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==241);
-{yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
+ case 238: /* paren_exprlist ::= LP exprlist RP */
+ case 243: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==243);
+{yymsp[-2].minor.yy14 = yymsp[-1].minor.yy14;}
break;
- case 237: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
+ case 239: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
{
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
- sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394,
- &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF);
+ sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy14, yymsp[-10].minor.yy144,
+ &yymsp[-11].minor.yy0, yymsp[0].minor.yy454, SQLITE_SO_ASC, yymsp[-8].minor.yy144, SQLITE_IDXTYPE_APPDEF);
if( IN_RENAME_OBJECT && pParse->pNewIndex ){
sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
}
}
break;
- case 238: /* uniqueflag ::= UNIQUE */
- case 280: /* raisetype ::= ABORT */ yytestcase(yyruleno==280);
-{yymsp[0].minor.yy394 = OE_Abort;}
+ case 240: /* uniqueflag ::= UNIQUE */
+ case 282: /* raisetype ::= ABORT */ yytestcase(yyruleno==282);
+{yymsp[0].minor.yy144 = OE_Abort;}
break;
- case 239: /* uniqueflag ::= */
-{yymsp[1].minor.yy394 = OE_None;}
+ case 241: /* uniqueflag ::= */
+{yymsp[1].minor.yy144 = OE_None;}
break;
- case 242: /* eidlist ::= eidlist COMMA nm collate sortorder */
+ case 244: /* eidlist ::= eidlist COMMA nm collate sortorder */
{
- yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394);
+ yymsp[-4].minor.yy14 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144);
}
break;
- case 243: /* eidlist ::= nm collate sortorder */
+ case 245: /* eidlist ::= nm collate sortorder */
{
- yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/
+ yymsp[-2].minor.yy14 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144); /*A-overwrites-Y*/
}
break;
- case 246: /* cmd ::= DROP INDEX ifexists fullname */
-{sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);}
+ case 248: /* cmd ::= DROP INDEX ifexists fullname */
+{sqlite3DropIndex(pParse, yymsp[0].minor.yy203, yymsp[-1].minor.yy144);}
break;
- case 247: /* cmd ::= VACUUM vinto */
-{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);}
+ case 249: /* cmd ::= VACUUM vinto */
+{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy454);}
break;
- case 248: /* cmd ::= VACUUM nm vinto */
-{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);}
+ case 250: /* cmd ::= VACUUM nm vinto */
+{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy454);}
break;
- case 251: /* cmd ::= PRAGMA nm dbnm */
+ case 253: /* cmd ::= PRAGMA nm dbnm */
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
break;
- case 252: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
+ case 254: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
break;
- case 253: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
+ case 255: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
break;
- case 254: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
+ case 256: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
break;
- case 255: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
+ case 257: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
break;
- case 258: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
+ case 260: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
{
Token all;
all.z = yymsp[-3].minor.yy0.z;
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
- sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all);
+ sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy427, &all);
}
break;
- case 259: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
+ case 261: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
{
- sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394);
+ sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy144, yymsp[-4].minor.yy286.a, yymsp[-4].minor.yy286.b, yymsp[-2].minor.yy203, yymsp[0].minor.yy454, yymsp[-10].minor.yy144, yymsp[-8].minor.yy144);
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
}
break;
- case 260: /* trigger_time ::= BEFORE|AFTER */
-{ yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ }
+ case 262: /* trigger_time ::= BEFORE|AFTER */
+{ yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/ }
break;
- case 261: /* trigger_time ::= INSTEAD OF */
-{ yymsp[-1].minor.yy394 = TK_INSTEAD;}
+ case 263: /* trigger_time ::= INSTEAD OF */
+{ yymsp[-1].minor.yy144 = TK_INSTEAD;}
break;
- case 262: /* trigger_time ::= */
-{ yymsp[1].minor.yy394 = TK_BEFORE; }
+ case 264: /* trigger_time ::= */
+{ yymsp[1].minor.yy144 = TK_BEFORE; }
break;
- case 263: /* trigger_event ::= DELETE|INSERT */
- case 264: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==264);
-{yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;}
+ case 265: /* trigger_event ::= DELETE|INSERT */
+ case 266: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==266);
+{yymsp[0].minor.yy286.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy286.b = 0;}
break;
- case 265: /* trigger_event ::= UPDATE OF idlist */
-{yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;}
+ case 267: /* trigger_event ::= UPDATE OF idlist */
+{yymsp[-2].minor.yy286.a = TK_UPDATE; yymsp[-2].minor.yy286.b = yymsp[0].minor.yy132;}
break;
- case 266: /* when_clause ::= */
- case 285: /* key_opt ::= */ yytestcase(yyruleno==285);
-{ yymsp[1].minor.yy528 = 0; }
+ case 268: /* when_clause ::= */
+ case 287: /* key_opt ::= */ yytestcase(yyruleno==287);
+{ yymsp[1].minor.yy454 = 0; }
break;
- case 267: /* when_clause ::= WHEN expr */
- case 286: /* key_opt ::= KEY expr */ yytestcase(yyruleno==286);
-{ yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; }
+ case 269: /* when_clause ::= WHEN expr */
+ case 288: /* key_opt ::= KEY expr */ yytestcase(yyruleno==288);
+{ yymsp[-1].minor.yy454 = yymsp[0].minor.yy454; }
break;
- case 268: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
+ case 270: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
{
- assert( yymsp[-2].minor.yy33!=0 );
- yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33;
- yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33;
+ assert( yymsp[-2].minor.yy427!=0 );
+ yymsp[-2].minor.yy427->pLast->pNext = yymsp[-1].minor.yy427;
+ yymsp[-2].minor.yy427->pLast = yymsp[-1].minor.yy427;
}
break;
- case 269: /* trigger_cmd_list ::= trigger_cmd SEMI */
+ case 271: /* trigger_cmd_list ::= trigger_cmd SEMI */
{
- assert( yymsp[-1].minor.yy33!=0 );
- yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33;
+ assert( yymsp[-1].minor.yy427!=0 );
+ yymsp[-1].minor.yy427->pLast = yymsp[-1].minor.yy427;
}
break;
- case 270: /* trnm ::= nm DOT nm */
+ case 272: /* trnm ::= nm DOT nm */
{
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
sqlite3ErrorMsg(pParse,
@@ -175883,367 +177291,377 @@ static YYACTIONTYPE yy_reduce(
"statements within triggers");
}
break;
- case 271: /* tridxby ::= INDEXED BY nm */
+ case 273: /* tridxby ::= INDEXED BY nm */
{
sqlite3ErrorMsg(pParse,
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
"within triggers");
}
break;
- case 272: /* tridxby ::= NOT INDEXED */
+ case 274: /* tridxby ::= NOT INDEXED */
{
sqlite3ErrorMsg(pParse,
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
"within triggers");
}
break;
- case 273: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
-{yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);}
- yymsp[-8].minor.yy33 = yylhsminor.yy33;
+ case 275: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
+{yylhsminor.yy427 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy203, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454, yymsp[-7].minor.yy144, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy168);}
+ yymsp[-8].minor.yy427 = yylhsminor.yy427;
break;
- case 274: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
+ case 276: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
{
- yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/
+ yylhsminor.yy427 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy132,yymsp[-2].minor.yy555,yymsp[-6].minor.yy144,yymsp[-1].minor.yy122,yymsp[-7].minor.yy168,yymsp[0].minor.yy168);/*yylhsminor.yy427-overwrites-yymsp[-6].minor.yy144*/
}
- yymsp[-7].minor.yy33 = yylhsminor.yy33;
+ yymsp[-7].minor.yy427 = yylhsminor.yy427;
break;
- case 275: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
-{yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);}
- yymsp[-5].minor.yy33 = yylhsminor.yy33;
+ case 277: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
+{yylhsminor.yy427 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy454, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy168);}
+ yymsp[-5].minor.yy427 = yylhsminor.yy427;
break;
- case 276: /* trigger_cmd ::= scanpt select scanpt */
-{yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/}
- yymsp[-2].minor.yy33 = yylhsminor.yy33;
+ case 278: /* trigger_cmd ::= scanpt select scanpt */
+{yylhsminor.yy427 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy555, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); /*yylhsminor.yy427-overwrites-yymsp[-1].minor.yy555*/}
+ yymsp[-2].minor.yy427 = yylhsminor.yy427;
break;
- case 277: /* expr ::= RAISE LP IGNORE RP */
+ case 279: /* expr ::= RAISE LP IGNORE RP */
{
- yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
- if( yymsp[-3].minor.yy528 ){
- yymsp[-3].minor.yy528->affExpr = OE_Ignore;
+ yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
+ if( yymsp[-3].minor.yy454 ){
+ yymsp[-3].minor.yy454->affExpr = OE_Ignore;
}
}
break;
- case 278: /* expr ::= RAISE LP raisetype COMMA nm RP */
+ case 280: /* expr ::= RAISE LP raisetype COMMA nm RP */
{
- yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
- if( yymsp[-5].minor.yy528 ) {
- yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394;
+ yymsp[-5].minor.yy454 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
+ if( yymsp[-5].minor.yy454 ) {
+ yymsp[-5].minor.yy454->affExpr = (char)yymsp[-3].minor.yy144;
}
}
break;
- case 279: /* raisetype ::= ROLLBACK */
-{yymsp[0].minor.yy394 = OE_Rollback;}
+ case 281: /* raisetype ::= ROLLBACK */
+{yymsp[0].minor.yy144 = OE_Rollback;}
break;
- case 281: /* raisetype ::= FAIL */
-{yymsp[0].minor.yy394 = OE_Fail;}
+ case 283: /* raisetype ::= FAIL */
+{yymsp[0].minor.yy144 = OE_Fail;}
break;
- case 282: /* cmd ::= DROP TRIGGER ifexists fullname */
+ case 284: /* cmd ::= DROP TRIGGER ifexists fullname */
{
- sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394);
+ sqlite3DropTrigger(pParse,yymsp[0].minor.yy203,yymsp[-1].minor.yy144);
}
break;
- case 283: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
+ case 285: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
{
- sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528);
+ sqlite3Attach(pParse, yymsp[-3].minor.yy454, yymsp[-1].minor.yy454, yymsp[0].minor.yy454);
}
break;
- case 284: /* cmd ::= DETACH database_kw_opt expr */
+ case 286: /* cmd ::= DETACH database_kw_opt expr */
{
- sqlite3Detach(pParse, yymsp[0].minor.yy528);
+ sqlite3Detach(pParse, yymsp[0].minor.yy454);
}
break;
- case 287: /* cmd ::= REINDEX */
+ case 289: /* cmd ::= REINDEX */
{sqlite3Reindex(pParse, 0, 0);}
break;
- case 288: /* cmd ::= REINDEX nm dbnm */
+ case 290: /* cmd ::= REINDEX nm dbnm */
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
break;
- case 289: /* cmd ::= ANALYZE */
+ case 291: /* cmd ::= ANALYZE */
{sqlite3Analyze(pParse, 0, 0);}
break;
- case 290: /* cmd ::= ANALYZE nm dbnm */
+ case 292: /* cmd ::= ANALYZE nm dbnm */
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
break;
- case 291: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
+ case 293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
{
- sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0);
+ sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy203,&yymsp[0].minor.yy0);
}
break;
- case 292: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
+ case 294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
{
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
}
break;
- case 293: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
+ case 295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
{
- sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0);
+ sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy203, &yymsp[0].minor.yy0);
}
break;
- case 294: /* add_column_fullname ::= fullname */
+ case 296: /* add_column_fullname ::= fullname */
{
disableLookaside(pParse);
- sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131);
+ sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy203);
}
break;
- case 295: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
+ case 297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
{
- sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
+ sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy203, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
break;
- case 296: /* cmd ::= create_vtab */
+ case 298: /* cmd ::= create_vtab */
{sqlite3VtabFinishParse(pParse,0);}
break;
- case 297: /* cmd ::= create_vtab LP vtabarglist RP */
+ case 299: /* cmd ::= create_vtab LP vtabarglist RP */
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
break;
- case 298: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
+ case 300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
{
- sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394);
+ sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy144);
}
break;
- case 299: /* vtabarg ::= */
+ case 301: /* vtabarg ::= */
{sqlite3VtabArgInit(pParse);}
break;
- case 300: /* vtabargtoken ::= ANY */
- case 301: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==301);
- case 302: /* lp ::= LP */ yytestcase(yyruleno==302);
+ case 302: /* vtabargtoken ::= ANY */
+ case 303: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==303);
+ case 304: /* lp ::= LP */ yytestcase(yyruleno==304);
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
break;
- case 303: /* with ::= WITH wqlist */
- case 304: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==304);
-{ sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); }
+ case 305: /* with ::= WITH wqlist */
+ case 306: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==306);
+{ sqlite3WithPush(pParse, yymsp[0].minor.yy59, 1); }
break;
- case 305: /* wqas ::= AS */
-{yymsp[0].minor.yy516 = M10d_Any;}
+ case 307: /* wqas ::= AS */
+{yymsp[0].minor.yy462 = M10d_Any;}
break;
- case 306: /* wqas ::= AS MATERIALIZED */
-{yymsp[-1].minor.yy516 = M10d_Yes;}
+ case 308: /* wqas ::= AS MATERIALIZED */
+{yymsp[-1].minor.yy462 = M10d_Yes;}
break;
- case 307: /* wqas ::= AS NOT MATERIALIZED */
-{yymsp[-2].minor.yy516 = M10d_No;}
+ case 309: /* wqas ::= AS NOT MATERIALIZED */
+{yymsp[-2].minor.yy462 = M10d_No;}
break;
- case 308: /* wqitem ::= nm eidlist_opt wqas LP select RP */
+ case 310: /* wqitem ::= withnm eidlist_opt wqas LP select RP */
{
- yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/
+ yymsp[-5].minor.yy67 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy14, yymsp[-1].minor.yy555, yymsp[-3].minor.yy462); /*A-overwrites-X*/
}
break;
- case 309: /* wqlist ::= wqitem */
+ case 311: /* withnm ::= nm */
+{pParse->bHasWith = 1;}
+ break;
+ case 312: /* wqlist ::= wqitem */
{
- yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/
+ yymsp[0].minor.yy59 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy67); /*A-overwrites-X*/
}
break;
- case 310: /* wqlist ::= wqlist COMMA wqitem */
+ case 313: /* wqlist ::= wqlist COMMA wqitem */
{
- yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385);
+ yymsp[-2].minor.yy59 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy59, yymsp[0].minor.yy67);
}
break;
- case 311: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
+ case 314: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
{
- assert( yymsp[0].minor.yy41!=0 );
- sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41);
- yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41;
- yylhsminor.yy41 = yymsp[0].minor.yy41;
+ assert( yymsp[0].minor.yy211!=0 );
+ sqlite3WindowChain(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy211);
+ yymsp[0].minor.yy211->pNextWin = yymsp[-2].minor.yy211;
+ yylhsminor.yy211 = yymsp[0].minor.yy211;
}
- yymsp[-2].minor.yy41 = yylhsminor.yy41;
+ yymsp[-2].minor.yy211 = yylhsminor.yy211;
break;
- case 312: /* windowdefn ::= nm AS LP window RP */
+ case 315: /* windowdefn ::= nm AS LP window RP */
{
- if( ALWAYS(yymsp[-1].minor.yy41) ){
- yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
+ if( ALWAYS(yymsp[-1].minor.yy211) ){
+ yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
}
- yylhsminor.yy41 = yymsp[-1].minor.yy41;
+ yylhsminor.yy211 = yymsp[-1].minor.yy211;
}
- yymsp[-4].minor.yy41 = yylhsminor.yy41;
+ yymsp[-4].minor.yy211 = yylhsminor.yy211;
break;
- case 313: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
+ case 316: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
{
- yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0);
+ yymsp[-4].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, 0);
}
break;
- case 314: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
+ case 317: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
{
- yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0);
+ yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, &yymsp[-5].minor.yy0);
}
- yymsp[-5].minor.yy41 = yylhsminor.yy41;
+ yymsp[-5].minor.yy211 = yylhsminor.yy211;
break;
- case 315: /* window ::= ORDER BY sortlist frame_opt */
+ case 318: /* window ::= ORDER BY sortlist frame_opt */
{
- yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0);
+ yymsp[-3].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, 0);
}
break;
- case 316: /* window ::= nm ORDER BY sortlist frame_opt */
+ case 319: /* window ::= nm ORDER BY sortlist frame_opt */
{
- yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
+ yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0);
}
- yymsp[-4].minor.yy41 = yylhsminor.yy41;
+ yymsp[-4].minor.yy211 = yylhsminor.yy211;
break;
- case 317: /* window ::= nm frame_opt */
+ case 320: /* window ::= nm frame_opt */
{
- yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0);
+ yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, 0, &yymsp[-1].minor.yy0);
}
- yymsp[-1].minor.yy41 = yylhsminor.yy41;
+ yymsp[-1].minor.yy211 = yylhsminor.yy211;
break;
- case 318: /* frame_opt ::= */
+ case 321: /* frame_opt ::= */
{
- yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
+ yymsp[1].minor.yy211 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
}
break;
- case 319: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
+ case 322: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
{
- yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516);
+ yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy144, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy462);
}
- yymsp[-2].minor.yy41 = yylhsminor.yy41;
+ yymsp[-2].minor.yy211 = yylhsminor.yy211;
break;
- case 320: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
+ case 323: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
{
- yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516);
+ yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy144, yymsp[-3].minor.yy509.eType, yymsp[-3].minor.yy509.pExpr, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, yymsp[0].minor.yy462);
}
- yymsp[-5].minor.yy41 = yylhsminor.yy41;
+ yymsp[-5].minor.yy211 = yylhsminor.yy211;
break;
- case 322: /* frame_bound_s ::= frame_bound */
- case 324: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==324);
-{yylhsminor.yy595 = yymsp[0].minor.yy595;}
- yymsp[0].minor.yy595 = yylhsminor.yy595;
+ case 325: /* frame_bound_s ::= frame_bound */
+ case 327: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==327);
+{yylhsminor.yy509 = yymsp[0].minor.yy509;}
+ yymsp[0].minor.yy509 = yylhsminor.yy509;
break;
- case 323: /* frame_bound_s ::= UNBOUNDED PRECEDING */
- case 325: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==325);
- case 327: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==327);
-{yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;}
- yymsp[-1].minor.yy595 = yylhsminor.yy595;
+ case 326: /* frame_bound_s ::= UNBOUNDED PRECEDING */
+ case 328: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==328);
+ case 330: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==330);
+{yylhsminor.yy509.eType = yymsp[-1].major; yylhsminor.yy509.pExpr = 0;}
+ yymsp[-1].minor.yy509 = yylhsminor.yy509;
break;
- case 326: /* frame_bound ::= expr PRECEDING|FOLLOWING */
-{yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;}
- yymsp[-1].minor.yy595 = yylhsminor.yy595;
+ case 329: /* frame_bound ::= expr PRECEDING|FOLLOWING */
+{yylhsminor.yy509.eType = yymsp[0].major; yylhsminor.yy509.pExpr = yymsp[-1].minor.yy454;}
+ yymsp[-1].minor.yy509 = yylhsminor.yy509;
break;
- case 328: /* frame_exclude_opt ::= */
-{yymsp[1].minor.yy516 = 0;}
+ case 331: /* frame_exclude_opt ::= */
+{yymsp[1].minor.yy462 = 0;}
break;
- case 329: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
-{yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;}
+ case 332: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
+{yymsp[-1].minor.yy462 = yymsp[0].minor.yy462;}
break;
- case 330: /* frame_exclude ::= NO OTHERS */
- case 331: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==331);
-{yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/}
+ case 333: /* frame_exclude ::= NO OTHERS */
+ case 334: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==334);
+{yymsp[-1].minor.yy462 = yymsp[-1].major; /*A-overwrites-X*/}
break;
- case 332: /* frame_exclude ::= GROUP|TIES */
-{yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/}
+ case 335: /* frame_exclude ::= GROUP|TIES */
+{yymsp[0].minor.yy462 = yymsp[0].major; /*A-overwrites-X*/}
break;
- case 333: /* window_clause ::= WINDOW windowdefn_list */
-{ yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; }
+ case 336: /* window_clause ::= WINDOW windowdefn_list */
+{ yymsp[-1].minor.yy211 = yymsp[0].minor.yy211; }
break;
- case 334: /* filter_over ::= filter_clause over_clause */
+ case 337: /* filter_over ::= filter_clause over_clause */
{
- if( yymsp[0].minor.yy41 ){
- yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528;
+ if( yymsp[0].minor.yy211 ){
+ yymsp[0].minor.yy211->pFilter = yymsp[-1].minor.yy454;
}else{
- sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
+ sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454);
}
- yylhsminor.yy41 = yymsp[0].minor.yy41;
+ yylhsminor.yy211 = yymsp[0].minor.yy211;
}
- yymsp[-1].minor.yy41 = yylhsminor.yy41;
+ yymsp[-1].minor.yy211 = yylhsminor.yy211;
break;
- case 335: /* filter_over ::= over_clause */
+ case 338: /* filter_over ::= over_clause */
{
- yylhsminor.yy41 = yymsp[0].minor.yy41;
+ yylhsminor.yy211 = yymsp[0].minor.yy211;
}
- yymsp[0].minor.yy41 = yylhsminor.yy41;
+ yymsp[0].minor.yy211 = yylhsminor.yy211;
break;
- case 336: /* filter_over ::= filter_clause */
+ case 339: /* filter_over ::= filter_clause */
{
- yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
- if( yylhsminor.yy41 ){
- yylhsminor.yy41->eFrmType = TK_FILTER;
- yylhsminor.yy41->pFilter = yymsp[0].minor.yy528;
+ yylhsminor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
+ if( yylhsminor.yy211 ){
+ yylhsminor.yy211->eFrmType = TK_FILTER;
+ yylhsminor.yy211->pFilter = yymsp[0].minor.yy454;
}else{
- sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528);
+ sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy454);
}
}
- yymsp[0].minor.yy41 = yylhsminor.yy41;
+ yymsp[0].minor.yy211 = yylhsminor.yy211;
break;
- case 337: /* over_clause ::= OVER LP window RP */
+ case 340: /* over_clause ::= OVER LP window RP */
{
- yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41;
- assert( yymsp[-3].minor.yy41!=0 );
+ yymsp[-3].minor.yy211 = yymsp[-1].minor.yy211;
+ assert( yymsp[-3].minor.yy211!=0 );
}
break;
- case 338: /* over_clause ::= OVER nm */
+ case 341: /* over_clause ::= OVER nm */
{
- yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
- if( yymsp[-1].minor.yy41 ){
- yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
+ yymsp[-1].minor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
+ if( yymsp[-1].minor.yy211 ){
+ yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
}
}
break;
- case 339: /* filter_clause ::= FILTER LP WHERE expr RP */
-{ yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; }
+ case 342: /* filter_clause ::= FILTER LP WHERE expr RP */
+{ yymsp[-4].minor.yy454 = yymsp[-1].minor.yy454; }
+ break;
+ case 343: /* term ::= QNUMBER */
+{
+ yylhsminor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0);
+ sqlite3DequoteNumber(pParse, yylhsminor.yy454);
+}
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
break;
default:
- /* (340) input ::= cmdlist */ yytestcase(yyruleno==340);
- /* (341) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==341);
- /* (342) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=342);
- /* (343) ecmd ::= SEMI */ yytestcase(yyruleno==343);
- /* (344) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==344);
- /* (345) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=345);
- /* (346) trans_opt ::= */ yytestcase(yyruleno==346);
- /* (347) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==347);
- /* (348) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==348);
- /* (349) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==349);
- /* (350) savepoint_opt ::= */ yytestcase(yyruleno==350);
- /* (351) cmd ::= create_table create_table_args */ yytestcase(yyruleno==351);
- /* (352) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=352);
- /* (353) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==353);
- /* (354) columnlist ::= columnname carglist */ yytestcase(yyruleno==354);
- /* (355) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==355);
- /* (356) nm ::= STRING */ yytestcase(yyruleno==356);
- /* (357) typetoken ::= typename */ yytestcase(yyruleno==357);
- /* (358) typename ::= ID|STRING */ yytestcase(yyruleno==358);
- /* (359) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=359);
- /* (360) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=360);
- /* (361) carglist ::= carglist ccons */ yytestcase(yyruleno==361);
- /* (362) carglist ::= */ yytestcase(yyruleno==362);
- /* (363) ccons ::= NULL onconf */ yytestcase(yyruleno==363);
- /* (364) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==364);
- /* (365) ccons ::= AS generated */ yytestcase(yyruleno==365);
- /* (366) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==366);
- /* (367) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==367);
- /* (368) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=368);
- /* (369) tconscomma ::= */ yytestcase(yyruleno==369);
- /* (370) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=370);
- /* (371) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=371);
- /* (372) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=372);
- /* (373) oneselect ::= values */ yytestcase(yyruleno==373);
- /* (374) sclp ::= selcollist COMMA */ yytestcase(yyruleno==374);
- /* (375) as ::= ID|STRING */ yytestcase(yyruleno==375);
- /* (376) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=376);
- /* (377) returning ::= */ yytestcase(yyruleno==377);
- /* (378) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=378);
- /* (379) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==379);
- /* (380) case_operand ::= expr */ yytestcase(yyruleno==380);
- /* (381) exprlist ::= nexprlist */ yytestcase(yyruleno==381);
- /* (382) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=382);
- /* (383) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=383);
- /* (384) nmnum ::= ON */ yytestcase(yyruleno==384);
- /* (385) nmnum ::= DELETE */ yytestcase(yyruleno==385);
- /* (386) nmnum ::= DEFAULT */ yytestcase(yyruleno==386);
- /* (387) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==387);
- /* (388) foreach_clause ::= */ yytestcase(yyruleno==388);
- /* (389) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==389);
- /* (390) trnm ::= nm */ yytestcase(yyruleno==390);
- /* (391) tridxby ::= */ yytestcase(yyruleno==391);
- /* (392) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==392);
- /* (393) database_kw_opt ::= */ yytestcase(yyruleno==393);
- /* (394) kwcolumn_opt ::= */ yytestcase(yyruleno==394);
- /* (395) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==395);
- /* (396) vtabarglist ::= vtabarg */ yytestcase(yyruleno==396);
- /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==397);
- /* (398) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==398);
- /* (399) anylist ::= */ yytestcase(yyruleno==399);
- /* (400) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==400);
- /* (401) anylist ::= anylist ANY */ yytestcase(yyruleno==401);
- /* (402) with ::= */ yytestcase(yyruleno==402);
- /* (403) windowdefn_list ::= windowdefn (OPTIMIZED OUT) */ assert(yyruleno!=403);
- /* (404) window ::= frame_opt (OPTIMIZED OUT) */ assert(yyruleno!=404);
+ /* (344) input ::= cmdlist */ yytestcase(yyruleno==344);
+ /* (345) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==345);
+ /* (346) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=346);
+ /* (347) ecmd ::= SEMI */ yytestcase(yyruleno==347);
+ /* (348) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==348);
+ /* (349) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=349);
+ /* (350) trans_opt ::= */ yytestcase(yyruleno==350);
+ /* (351) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==351);
+ /* (352) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==352);
+ /* (353) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==353);
+ /* (354) savepoint_opt ::= */ yytestcase(yyruleno==354);
+ /* (355) cmd ::= create_table create_table_args */ yytestcase(yyruleno==355);
+ /* (356) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=356);
+ /* (357) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==357);
+ /* (358) columnlist ::= columnname carglist */ yytestcase(yyruleno==358);
+ /* (359) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==359);
+ /* (360) nm ::= STRING */ yytestcase(yyruleno==360);
+ /* (361) typetoken ::= typename */ yytestcase(yyruleno==361);
+ /* (362) typename ::= ID|STRING */ yytestcase(yyruleno==362);
+ /* (363) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=363);
+ /* (364) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=364);
+ /* (365) carglist ::= carglist ccons */ yytestcase(yyruleno==365);
+ /* (366) carglist ::= */ yytestcase(yyruleno==366);
+ /* (367) ccons ::= NULL onconf */ yytestcase(yyruleno==367);
+ /* (368) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==368);
+ /* (369) ccons ::= AS generated */ yytestcase(yyruleno==369);
+ /* (370) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==370);
+ /* (371) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==371);
+ /* (372) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=372);
+ /* (373) tconscomma ::= */ yytestcase(yyruleno==373);
+ /* (374) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=374);
+ /* (375) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=375);
+ /* (376) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=376);
+ /* (377) oneselect ::= values */ yytestcase(yyruleno==377);
+ /* (378) sclp ::= selcollist COMMA */ yytestcase(yyruleno==378);
+ /* (379) as ::= ID|STRING */ yytestcase(yyruleno==379);
+ /* (380) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=380);
+ /* (381) returning ::= */ yytestcase(yyruleno==381);
+ /* (382) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=382);
+ /* (383) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==383);
+ /* (384) case_operand ::= expr */ yytestcase(yyruleno==384);
+ /* (385) exprlist ::= nexprlist */ yytestcase(yyruleno==385);
+ /* (386) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=386);
+ /* (387) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=387);
+ /* (388) nmnum ::= ON */ yytestcase(yyruleno==388);
+ /* (389) nmnum ::= DELETE */ yytestcase(yyruleno==389);
+ /* (390) nmnum ::= DEFAULT */ yytestcase(yyruleno==390);
+ /* (391) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==391);
+ /* (392) foreach_clause ::= */ yytestcase(yyruleno==392);
+ /* (393) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==393);
+ /* (394) trnm ::= nm */ yytestcase(yyruleno==394);
+ /* (395) tridxby ::= */ yytestcase(yyruleno==395);
+ /* (396) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==396);
+ /* (397) database_kw_opt ::= */ yytestcase(yyruleno==397);
+ /* (398) kwcolumn_opt ::= */ yytestcase(yyruleno==398);
+ /* (399) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==399);
+ /* (400) vtabarglist ::= vtabarg */ yytestcase(yyruleno==400);
+ /* (401) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==401);
+ /* (402) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==402);
+ /* (403) anylist ::= */ yytestcase(yyruleno==403);
+ /* (404) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==404);
+ /* (405) anylist ::= anylist ANY */ yytestcase(yyruleno==405);
+ /* (406) with ::= */ yytestcase(yyruleno==406);
+ /* (407) windowdefn_list ::= windowdefn (OPTIMIZED OUT) */ assert(yyruleno!=407);
+ /* (408) window ::= frame_opt (OPTIMIZED OUT) */ assert(yyruleno!=408);
break;
/********** End reduce actions ************************************************/
};
@@ -176430,19 +177848,12 @@ SQLITE_PRIVATE void sqlite3Parser(
(int)(yypParser->yytos - yypParser->yystack));
}
#endif
-#if YYSTACKDEPTH>0
if( yypParser->yytos>=yypParser->yystackEnd ){
- yyStackOverflow(yypParser);
- break;
- }
-#else
- if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
if( yyGrowStack(yypParser) ){
yyStackOverflow(yypParser);
break;
}
}
-#endif
}
yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor sqlite3ParserCTX_PARAM);
}else if( yyact <= YY_MAX_SHIFTREDUCE ){
@@ -177513,27 +178924,58 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){
*tokenType = TK_INTEGER;
#ifndef SQLITE_OMIT_HEX_INTEGER
if( z[0]=='0' && (z[1]=='x' || z[1]=='X') && sqlite3Isxdigit(z[2]) ){
- for(i=3; sqlite3Isxdigit(z[i]); i++){}
- return i;
- }
+ for(i=3; 1; i++){
+ if( sqlite3Isxdigit(z[i])==0 ){
+ if( z[i]==SQLITE_DIGIT_SEPARATOR ){
+ *tokenType = TK_QNUMBER;
+ }else{
+ break;
+ }
+ }
+ }
+ }else
#endif
- for(i=0; sqlite3Isdigit(z[i]); i++){}
+ {
+ for(i=0; 1; i++){
+ if( sqlite3Isdigit(z[i])==0 ){
+ if( z[i]==SQLITE_DIGIT_SEPARATOR ){
+ *tokenType = TK_QNUMBER;
+ }else{
+ break;
+ }
+ }
+ }
#ifndef SQLITE_OMIT_FLOATING_POINT
- if( z[i]=='.' ){
- i++;
- while( sqlite3Isdigit(z[i]) ){ i++; }
- *tokenType = TK_FLOAT;
- }
- if( (z[i]=='e' || z[i]=='E') &&
- ( sqlite3Isdigit(z[i+1])
- || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2]))
- )
- ){
- i += 2;
- while( sqlite3Isdigit(z[i]) ){ i++; }
- *tokenType = TK_FLOAT;
- }
+ if( z[i]=='.' ){
+ if( *tokenType==TK_INTEGER ) *tokenType = TK_FLOAT;
+ for(i++; 1; i++){
+ if( sqlite3Isdigit(z[i])==0 ){
+ if( z[i]==SQLITE_DIGIT_SEPARATOR ){
+ *tokenType = TK_QNUMBER;
+ }else{
+ break;
+ }
+ }
+ }
+ }
+ if( (z[i]=='e' || z[i]=='E') &&
+ ( sqlite3Isdigit(z[i+1])
+ || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2]))
+ )
+ ){
+ if( *tokenType==TK_INTEGER ) *tokenType = TK_FLOAT;
+ for(i+=2; 1; i++){
+ if( sqlite3Isdigit(z[i])==0 ){
+ if( z[i]==SQLITE_DIGIT_SEPARATOR ){
+ *tokenType = TK_QNUMBER;
+ }else{
+ break;
+ }
+ }
+ }
+ }
#endif
+ }
while( IdChar(z[i]) ){
*tokenType = TK_ILLEGAL;
i++;
@@ -177698,10 +179140,13 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql){
if( tokenType>=TK_WINDOW ){
assert( tokenType==TK_SPACE || tokenType==TK_OVER || tokenType==TK_FILTER
|| tokenType==TK_ILLEGAL || tokenType==TK_WINDOW
+ || tokenType==TK_QNUMBER
);
#else
if( tokenType>=TK_SPACE ){
- assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL );
+ assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL
+ || tokenType==TK_QNUMBER
+ );
#endif /* SQLITE_OMIT_WINDOWFUNC */
if( AtomicLoad(&db->u1.isInterrupted) ){
pParse->rc = SQLITE_INTERRUPT;
@@ -177734,7 +179179,7 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql){
assert( n==6 );
tokenType = analyzeFilterKeyword((const u8*)&zSql[6], lastTokenParsed);
#endif /* SQLITE_OMIT_WINDOWFUNC */
- }else{
+ }else if( tokenType!=TK_QNUMBER ){
Token x;
x.z = zSql;
x.n = n;
@@ -188729,22 +190174,24 @@ static int fts3IntegrityMethod(
char **pzErr /* Write error message here */
){
Fts3Table *p = (Fts3Table*)pVtab;
- int rc;
+ int rc = SQLITE_OK;
int bOk = 0;
UNUSED_PARAMETER(isQuick);
rc = sqlite3Fts3IntegrityCheck(p, &bOk);
- assert( rc!=SQLITE_CORRUPT_VTAB || bOk==0 );
- if( rc!=SQLITE_OK && rc!=SQLITE_CORRUPT_VTAB ){
+ assert( rc!=SQLITE_CORRUPT_VTAB );
+ if( rc==SQLITE_ERROR || (rc&0xFF)==SQLITE_CORRUPT ){
*pzErr = sqlite3_mprintf("unable to validate the inverted index for"
" FTS%d table %s.%s: %s",
p->bFts4 ? 4 : 3, zSchema, zTabname, sqlite3_errstr(rc));
- }else if( bOk==0 ){
+ if( *pzErr ) rc = SQLITE_OK;
+ }else if( rc==SQLITE_OK && bOk==0 ){
*pzErr = sqlite3_mprintf("malformed inverted index for FTS%d table %s.%s",
p->bFts4 ? 4 : 3, zSchema, zTabname);
+ if( *pzErr==0 ) rc = SQLITE_NOMEM;
}
sqlite3Fts3SegmentsClose(p);
- return SQLITE_OK;
+ return rc;
}
@@ -200406,7 +201853,12 @@ SQLITE_PRIVATE int sqlite3Fts3IntegrityCheck(Fts3Table *p, int *pbOk){
sqlite3_finalize(pStmt);
}
- *pbOk = (rc==SQLITE_OK && cksum1==cksum2);
+ if( rc==SQLITE_CORRUPT_VTAB ){
+ rc = SQLITE_OK;
+ *pbOk = 0;
+ }else{
+ *pbOk = (rc==SQLITE_OK && cksum1==cksum2);
+ }
return rc;
}
@@ -201312,7 +202764,7 @@ static void fts3SnippetDetails(
}
mCover |= mPhrase;
- for(j=0; j<pPhrase->nToken; j++){
+ for(j=0; j<pPhrase->nToken && j<pIter->nSnippet; j++){
mHighlight |= (mPos>>j);
}
@@ -203973,7 +205425,6 @@ static void jsonAppendRawNZ(JsonString *p, const char *zIn, u32 N){
}
}
-
/* Append formatted text (not to exceed N bytes) to the JsonString.
*/
static void jsonPrintf(int N, JsonString *p, const char *zFormat, ...){
@@ -204031,6 +205482,40 @@ static void jsonAppendSeparator(JsonString *p){
jsonAppendChar(p, ',');
}
+/* c is a control character. Append the canonical JSON representation
+** of that control character to p.
+**
+** This routine assumes that the output buffer has already been enlarged
+** sufficiently to hold the worst-case encoding plus a nul terminator.
+*/
+static void jsonAppendControlChar(JsonString *p, u8 c){
+ static const char aSpecial[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 'b', 't', 'n', 0, 'f', 'r', 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ assert( sizeof(aSpecial)==32 );
+ assert( aSpecial['\b']=='b' );
+ assert( aSpecial['\f']=='f' );
+ assert( aSpecial['\n']=='n' );
+ assert( aSpecial['\r']=='r' );
+ assert( aSpecial['\t']=='t' );
+ assert( c>=0 && c<sizeof(aSpecial) );
+ assert( p->nUsed+7 <= p->nAlloc );
+ if( aSpecial[c] ){
+ p->zBuf[p->nUsed] = '\\';
+ p->zBuf[p->nUsed+1] = aSpecial[c];
+ p->nUsed += 2;
+ }else{
+ p->zBuf[p->nUsed] = '\\';
+ p->zBuf[p->nUsed+1] = 'u';
+ p->zBuf[p->nUsed+2] = '0';
+ p->zBuf[p->nUsed+3] = '0';
+ p->zBuf[p->nUsed+4] = "0123456789abcdef"[c>>4];
+ p->zBuf[p->nUsed+5] = "0123456789abcdef"[c&0xf];
+ p->nUsed += 6;
+ }
+}
+
/* Append the N-byte string in zIn to the end of the JsonString string
** under construction. Enclose the string in double-quotes ("...") and
** escape any double-quotes or backslash characters contained within the
@@ -204090,35 +205575,14 @@ static void jsonAppendString(JsonString *p, const char *zIn, u32 N){
}
c = z[0];
if( c=='"' || c=='\\' ){
- json_simple_escape:
if( (p->nUsed+N+3 > p->nAlloc) && jsonStringGrow(p,N+3)!=0 ) return;
p->zBuf[p->nUsed++] = '\\';
p->zBuf[p->nUsed++] = c;
}else if( c=='\'' ){
p->zBuf[p->nUsed++] = c;
}else{
- static const char aSpecial[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 'b', 't', 'n', 0, 'f', 'r', 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
- assert( sizeof(aSpecial)==32 );
- assert( aSpecial['\b']=='b' );
- assert( aSpecial['\f']=='f' );
- assert( aSpecial['\n']=='n' );
- assert( aSpecial['\r']=='r' );
- assert( aSpecial['\t']=='t' );
- assert( c>=0 && c<sizeof(aSpecial) );
- if( aSpecial[c] ){
- c = aSpecial[c];
- goto json_simple_escape;
- }
if( (p->nUsed+N+7 > p->nAlloc) && jsonStringGrow(p,N+7)!=0 ) return;
- p->zBuf[p->nUsed++] = '\\';
- p->zBuf[p->nUsed++] = 'u';
- p->zBuf[p->nUsed++] = '0';
- p->zBuf[p->nUsed++] = '0';
- p->zBuf[p->nUsed++] = "0123456789abcdef"[c>>4];
- p->zBuf[p->nUsed++] = "0123456789abcdef"[c&0xf];
+ jsonAppendControlChar(p, c);
}
z++;
N--;
@@ -204819,7 +206283,10 @@ static u32 jsonbValidityCheck(
if( !jsonIsOk[z[j]] && z[j]!='\'' ){
if( z[j]=='"' ){
if( x==JSONB_TEXTJ ) return j+1;
- }else if( z[j]!='\\' || j+1>=k ){
+ }else if( z[j]<=0x1f ){
+ /* Control characters in JSON5 string literals are ok */
+ if( x==JSONB_TEXTJ ) return j+1;
+ }else if( NEVER(z[j]!='\\') || j+1>=k ){
return j+1;
}else if( strchr("\"\\/bfnrt",z[j+1])!=0 ){
j++;
@@ -205114,9 +206581,14 @@ json_parse_restart:
return -1;
}
}else if( c<=0x1f ){
- /* Control characters are not allowed in strings */
- pParse->iErr = j;
- return -1;
+ if( c==0 ){
+ pParse->iErr = j;
+ return -1;
+ }
+ /* Control characters are not allowed in canonical JSON string
+ ** literals, but are allowed in JSON5 string literals. */
+ opcode = JSONB_TEXT5;
+ pParse->hasNonstd = 1;
}else if( c=='"' ){
opcode = JSONB_TEXT5;
}
@@ -205332,6 +206804,7 @@ json_parse_restart:
return i+4;
}
/* fall-through into the default case that checks for NaN */
+ /* no break */ deliberate_fall_through
}
default: {
u32 k;
@@ -205600,7 +207073,7 @@ static u32 jsonTranslateBlobToText(
zIn = (const char*)&pParse->aBlob[i+n];
jsonAppendChar(pOut, '"');
while( sz2>0 ){
- for(k=0; k<sz2 && zIn[k]!='\\' && zIn[k]!='"'; k++){}
+ for(k=0; k<sz2 && (jsonIsOk[(u8)zIn[k]] || zIn[k]=='\''); k++){}
if( k>0 ){
jsonAppendRawNZ(pOut, zIn, k);
if( k>=sz2 ){
@@ -205615,6 +207088,13 @@ static u32 jsonTranslateBlobToText(
sz2--;
continue;
}
+ if( zIn[0]<=0x1f ){
+ if( pOut->nUsed+7>pOut->nAlloc && jsonStringGrow(pOut,7) ) break;
+ jsonAppendControlChar(pOut, zIn[0]);
+ zIn++;
+ sz2--;
+ continue;
+ }
assert( zIn[0]=='\\' );
assert( sz2>=1 );
if( sz2<2 ){
@@ -205717,6 +207197,112 @@ static u32 jsonTranslateBlobToText(
return i+n+sz;
}
+/* Context for recursion of json_pretty()
+*/
+typedef struct JsonPretty JsonPretty;
+struct JsonPretty {
+ JsonParse *pParse; /* The BLOB being rendered */
+ JsonString *pOut; /* Generate pretty output into this string */
+ const char *zIndent; /* Use this text for indentation */
+ u32 szIndent; /* Bytes in zIndent[] */
+ u32 nIndent; /* Current level of indentation */
+};
+
+/* Append indentation to the pretty JSON under construction */
+static void jsonPrettyIndent(JsonPretty *pPretty){
+ u32 jj;
+ for(jj=0; jj<pPretty->nIndent; jj++){
+ jsonAppendRaw(pPretty->pOut, pPretty->zIndent, pPretty->szIndent);
+ }
+}
+
+/*
+** Translate the binary JSONB representation of JSON beginning at
+** pParse->aBlob[i] into a JSON text string. Append the JSON
+** text onto the end of pOut. Return the index in pParse->aBlob[]
+** of the first byte past the end of the element that is translated.
+**
+** This is a variant of jsonTranslateBlobToText() that "pretty-prints"
+** the output. Extra whitespace is inserted to make the JSON easier
+** for humans to read.
+**
+** If an error is detected in the BLOB input, the pOut->eErr flag
+** might get set to JSTRING_MALFORMED. But not all BLOB input errors
+** are detected. So a malformed JSONB input might either result
+** in an error, or in incorrect JSON.
+**
+** The pOut->eErr JSTRING_OOM flag is set on a OOM.
+*/
+static u32 jsonTranslateBlobToPrettyText(
+ JsonPretty *pPretty, /* Pretty-printing context */
+ u32 i /* Start rendering at this index */
+){
+ u32 sz, n, j, iEnd;
+ const JsonParse *pParse = pPretty->pParse;
+ JsonString *pOut = pPretty->pOut;
+ n = jsonbPayloadSize(pParse, i, &sz);
+ if( n==0 ){
+ pOut->eErr |= JSTRING_MALFORMED;
+ return pParse->nBlob+1;
+ }
+ switch( pParse->aBlob[i] & 0x0f ){
+ case JSONB_ARRAY: {
+ j = i+n;
+ iEnd = j+sz;
+ jsonAppendChar(pOut, '[');
+ if( j<iEnd ){
+ jsonAppendChar(pOut, '\n');
+ pPretty->nIndent++;
+ while( pOut->eErr==0 ){
+ jsonPrettyIndent(pPretty);
+ j = jsonTranslateBlobToPrettyText(pPretty, j);
+ if( j>=iEnd ) break;
+ jsonAppendRawNZ(pOut, ",\n", 2);
+ }
+ jsonAppendChar(pOut, '\n');
+ pPretty->nIndent--;
+ jsonPrettyIndent(pPretty);
+ }
+ jsonAppendChar(pOut, ']');
+ i = iEnd;
+ break;
+ }
+ case JSONB_OBJECT: {
+ j = i+n;
+ iEnd = j+sz;
+ jsonAppendChar(pOut, '{');
+ if( j<iEnd ){
+ jsonAppendChar(pOut, '\n');
+ pPretty->nIndent++;
+ while( pOut->eErr==0 ){
+ jsonPrettyIndent(pPretty);
+ j = jsonTranslateBlobToText(pParse, j, pOut);
+ if( j>iEnd ){
+ pOut->eErr |= JSTRING_MALFORMED;
+ break;
+ }
+ jsonAppendRawNZ(pOut, ": ", 2);
+ j = jsonTranslateBlobToPrettyText(pPretty, j);
+ if( j>=iEnd ) break;
+ jsonAppendRawNZ(pOut, ",\n", 2);
+ }
+ jsonAppendChar(pOut, '\n');
+ pPretty->nIndent--;
+ jsonPrettyIndent(pPretty);
+ }
+ jsonAppendChar(pOut, '}');
+ i = iEnd;
+ break;
+ }
+ default: {
+ i = jsonTranslateBlobToText(pParse, i, pOut);
+ break;
+ }
+ }
+ return i;
+}
+
+
/* Return true if the input pJson
**
** For performance reasons, this routine does not do a detailed check of the
@@ -206967,11 +208553,12 @@ static void jsonParseFunc(
if( p==0 ) return;
if( argc==1 ){
jsonDebugPrintBlob(p, 0, p->nBlob, 0, &out);
- sqlite3_result_text64(ctx, out.zText, out.nChar, SQLITE_DYNAMIC, SQLITE_UTF8);
+ sqlite3_result_text64(ctx,out.zText,out.nChar,SQLITE_TRANSIENT,SQLITE_UTF8);
}else{
jsonShowParse(p);
}
jsonParseFree(p);
+ sqlite3_str_reset(&out);
}
#endif /* SQLITE_DEBUG */
@@ -207070,13 +208657,6 @@ static void jsonArrayLengthFunc(
jsonParseFree(p);
}
-/* True if the string is all digits */
-static int jsonAllDigits(const char *z, int n){
- int i;
- for(i=0; i<n && sqlite3Isdigit(z[i]); i++){}
- return i==n;
-}
-
/* True if the string is all alphanumerics and underscores */
static int jsonAllAlphanum(const char *z, int n){
int i;
@@ -207141,7 +208721,7 @@ static void jsonExtractFunc(
** [NUMBER] ==> $[NUMBER] // Not PG. Purely for convenience
*/
jsonStringInit(&jx, ctx);
- if( jsonAllDigits(zPath, nPath) ){
+ if( sqlite3_value_type(argv[i])==SQLITE_INTEGER ){
jsonAppendRawNZ(&jx, "[", 1);
jsonAppendRaw(&jx, zPath, nPath);
jsonAppendRawNZ(&jx, "]", 2);
@@ -207636,6 +209216,40 @@ json_type_done:
}
/*
+** json_pretty(JSON)
+** json_pretty(JSON, INDENT)
+**
+** Return text that is a pretty-printed rendering of the input JSON.
+** If the argument is not valid JSON, return NULL.
+**
+** The INDENT argument is text that is used for indentation. If omitted,
+** it defaults to four spaces (the same as PostgreSQL).
+*/
+static void jsonPrettyFunc(
+ sqlite3_context *ctx,
+ int argc,
+ sqlite3_value **argv
+){
+ JsonString s; /* The output string */
+ JsonPretty x; /* Pretty printing context */
+
+ memset(&x, 0, sizeof(x));
+ x.pParse = jsonParseFuncArg(ctx, argv[0], 0);
+ if( x.pParse==0 ) return;
+ x.pOut = &s;
+ jsonStringInit(&s, ctx);
+ if( argc==1 || (x.zIndent = (const char*)sqlite3_value_text(argv[1]))==0 ){
+ x.zIndent = " ";
+ x.szIndent = 4;
+ }else{
+ x.szIndent = (u32)strlen(x.zIndent);
+ }
+ jsonTranslateBlobToPrettyText(&x, 0);
+ jsonReturnString(&s, 0, 0);
+ jsonParseFree(x.pParse);
+}
+
+/*
** json_valid(JSON)
** json_valid(JSON, FLAGS)
**
@@ -208649,6 +210263,8 @@ SQLITE_PRIVATE void sqlite3RegisterJsonFunctions(void){
JFUNCTION(jsonb_object, -1,0,1, 1,1,0, jsonObjectFunc),
JFUNCTION(json_patch, 2,1,1, 0,0,0, jsonPatchFunc),
JFUNCTION(jsonb_patch, 2,1,0, 0,1,0, jsonPatchFunc),
+ JFUNCTION(json_pretty, 1,1,0, 0,0,0, jsonPrettyFunc),
+ JFUNCTION(json_pretty, 2,1,0, 0,0,0, jsonPrettyFunc),
JFUNCTION(json_quote, 1,0,1, 1,0,0, jsonQuoteFunc),
JFUNCTION(json_remove, -1,1,1, 0,0,0, jsonRemoveFunc),
JFUNCTION(jsonb_remove, -1,1,0, 0,1,0, jsonRemoveFunc),
@@ -210548,6 +212164,8 @@ static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){
return SQLITE_OK;
}
+SQLITE_PRIVATE int sqlite3IntFloatCompare(i64,double);
+
/*
** Rtree virtual table module xFilter method.
*/
@@ -210577,7 +212195,8 @@ static int rtreeFilter(
i64 iNode = 0;
int eType = sqlite3_value_numeric_type(argv[0]);
if( eType==SQLITE_INTEGER
- || (eType==SQLITE_FLOAT && sqlite3_value_double(argv[0])==iRowid)
+ || (eType==SQLITE_FLOAT
+ && 0==sqlite3IntFloatCompare(iRowid,sqlite3_value_double(argv[0])))
){
rc = findLeafNode(pRtree, iRowid, &pLeaf, &iNode);
}else{
@@ -211932,6 +213551,7 @@ constraint:
*/
static int rtreeBeginTransaction(sqlite3_vtab *pVtab){
Rtree *pRtree = (Rtree *)pVtab;
+ assert( pRtree->inWrTrans==0 );
pRtree->inWrTrans = 1;
return SQLITE_OK;
}
@@ -215486,7 +217106,7 @@ static void icuLoadCollation(
UCollator *pUCollator; /* ICU library collation object */
int rc; /* Return code from sqlite3_create_collation_x() */
- assert(nArg==2);
+ assert(nArg==2 || nArg==3);
(void)nArg; /* Unused parameter */
zLocale = (const char *)sqlite3_value_text(apArg[0]);
zName = (const char *)sqlite3_value_text(apArg[1]);
@@ -215501,7 +217121,39 @@ static void icuLoadCollation(
return;
}
assert(p);
-
+ if(nArg==3){
+ const char *zOption = (const char*)sqlite3_value_text(apArg[2]);
+ static const struct {
+ const char *zName;
+ UColAttributeValue val;
+ } aStrength[] = {
+ { "PRIMARY", UCOL_PRIMARY },
+ { "SECONDARY", UCOL_SECONDARY },
+ { "TERTIARY", UCOL_TERTIARY },
+ { "DEFAULT", UCOL_DEFAULT_STRENGTH },
+ { "QUARTERNARY", UCOL_QUATERNARY },
+ { "IDENTICAL", UCOL_IDENTICAL },
+ };
+ unsigned int i;
+ for(i=0; i<sizeof(aStrength)/sizeof(aStrength[0]); i++){
+ if( sqlite3_stricmp(zOption,aStrength[i].zName)==0 ){
+ ucol_setStrength(pUCollator, aStrength[i].val);
+ break;
+ }
+ }
+ if( i>=sizeof(aStrength)/sizeof(aStrength[0]) ){
+ sqlite3_str *pStr = sqlite3_str_new(sqlite3_context_db_handle(p));
+ sqlite3_str_appendf(pStr,
+ "unknown collation strength \"%s\" - should be one of:",
+ zOption);
+ for(i=0; i<sizeof(aStrength)/sizeof(aStrength[0]); i++){
+ sqlite3_str_appendf(pStr, " %s", aStrength[i].zName);
+ }
+ sqlite3_result_error(p, sqlite3_str_value(pStr), -1);
+ sqlite3_free(sqlite3_str_finish(pStr));
+ return;
+ }
+ }
rc = sqlite3_create_collation_v2(db, zName, SQLITE_UTF16, (void *)pUCollator,
icuCollationColl, icuCollationDel
);
@@ -215524,6 +217176,7 @@ SQLITE_PRIVATE int sqlite3IcuInit(sqlite3 *db){
void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
} scalars[] = {
{"icu_load_collation",2,SQLITE_UTF8|SQLITE_DIRECTONLY,1, icuLoadCollation},
+ {"icu_load_collation",3,SQLITE_UTF8|SQLITE_DIRECTONLY,1, icuLoadCollation},
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU)
{"regexp", 2, SQLITE_ANY|SQLITEICU_EXTRAFLAGS, 0, icuRegexpFunc},
{"lower", 1, SQLITE_UTF16|SQLITEICU_EXTRAFLAGS, 0, icuCaseFunc16},
@@ -216674,6 +218327,7 @@ typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
typedef sqlite3_int64 i64;
+typedef sqlite3_uint64 u64;
#endif
/*
@@ -217360,6 +219014,7 @@ static int rbuObjIterNext(sqlite3rbu *p, RbuObjIter *pIter){
if( rc!=SQLITE_ROW ){
rc = resetAndCollectError(pIter->pTblIter, &p->zErrmsg);
pIter->zTbl = 0;
+ pIter->zDataTbl = 0;
}else{
pIter->zTbl = (const char*)sqlite3_column_text(pIter->pTblIter, 0);
pIter->zDataTbl = (const char*)sqlite3_column_text(pIter->pTblIter,1);
@@ -219454,7 +221109,7 @@ static i64 rbuShmChecksum(sqlite3rbu *p){
u32 volatile *ptr;
p->rc = pDb->pMethods->xShmMap(pDb, 0, 32*1024, 0, (void volatile**)&ptr);
if( p->rc==SQLITE_OK ){
- iRet = ((i64)ptr[10] << 32) + ptr[11];
+ iRet = (i64)(((u64)ptr[10] << 32) + ptr[11]);
}
}
return iRet;
@@ -226925,14 +228580,14 @@ static int sessionChangesetNextOne(
p->rc = sessionInputBuffer(&p->in, 2);
if( p->rc!=SQLITE_OK ) return p->rc;
+ sessionDiscardData(&p->in);
+ p->in.iCurrent = p->in.iNext;
+
/* If the iterator is already at the end of the changeset, return DONE. */
if( p->in.iNext>=p->in.nData ){
return SQLITE_DONE;
}
- sessionDiscardData(&p->in);
- p->in.iCurrent = p->in.iNext;
-
op = p->in.aData[p->in.iNext++];
while( op=='T' || op=='P' ){
if( pbNew ) *pbNew = 1;
@@ -228667,6 +230322,7 @@ struct sqlite3_changegroup {
int rc; /* Error code */
int bPatch; /* True to accumulate patchsets */
SessionTable *pList; /* List of tables in current patch */
+ SessionBuffer rec;
sqlite3 *db; /* Configured by changegroup_schema() */
char *zDb; /* Configured by changegroup_schema() */
@@ -228965,108 +230621,128 @@ static int sessionChangesetExtendRecord(
}
/*
-** Add all changes in the changeset traversed by the iterator passed as
-** the first argument to the changegroup hash tables.
+** Locate or create a SessionTable object that may be used to add the
+** change currently pointed to by iterator pIter to changegroup pGrp.
+** If successful, set output variable (*ppTab) to point to the table
+** object and return SQLITE_OK. Otherwise, if some error occurs, return
+** an SQLite error code and leave (*ppTab) set to NULL.
*/
-static int sessionChangesetToHash(
- sqlite3_changeset_iter *pIter, /* Iterator to read from */
- sqlite3_changegroup *pGrp, /* Changegroup object to add changeset to */
- int bRebase /* True if hash table is for rebasing */
+static int sessionChangesetFindTable(
+ sqlite3_changegroup *pGrp,
+ const char *zTab,
+ sqlite3_changeset_iter *pIter,
+ SessionTable **ppTab
){
- u8 *aRec;
- int nRec;
int rc = SQLITE_OK;
SessionTable *pTab = 0;
- SessionBuffer rec = {0, 0, 0};
-
- while( SQLITE_ROW==sessionChangesetNext(pIter, &aRec, &nRec, 0) ){
- const char *zNew;
- int nCol;
- int op;
- int iHash;
- int bIndirect;
- SessionChange *pChange;
- SessionChange *pExist = 0;
- SessionChange **pp;
-
- /* Ensure that only changesets, or only patchsets, but not a mixture
- ** of both, are being combined. It is an error to try to combine a
- ** changeset and a patchset. */
- if( pGrp->pList==0 ){
- pGrp->bPatch = pIter->bPatchset;
- }else if( pIter->bPatchset!=pGrp->bPatch ){
- rc = SQLITE_ERROR;
- break;
- }
+ int nTab = (int)strlen(zTab);
+ u8 *abPK = 0;
+ int nCol = 0;
- sqlite3changeset_op(pIter, &zNew, &nCol, &op, &bIndirect);
- if( !pTab || sqlite3_stricmp(zNew, pTab->zName) ){
- /* Search the list for a matching table */
- int nNew = (int)strlen(zNew);
- u8 *abPK;
+ *ppTab = 0;
+ sqlite3changeset_pk(pIter, &abPK, &nCol);
- sqlite3changeset_pk(pIter, &abPK, 0);
- for(pTab = pGrp->pList; pTab; pTab=pTab->pNext){
- if( 0==sqlite3_strnicmp(pTab->zName, zNew, nNew+1) ) break;
- }
- if( !pTab ){
- SessionTable **ppTab;
+ /* Search the list for an existing table */
+ for(pTab = pGrp->pList; pTab; pTab=pTab->pNext){
+ if( 0==sqlite3_strnicmp(pTab->zName, zTab, nTab+1) ) break;
+ }
- pTab = sqlite3_malloc64(sizeof(SessionTable) + nCol + nNew+1);
- if( !pTab ){
- rc = SQLITE_NOMEM;
- break;
- }
- memset(pTab, 0, sizeof(SessionTable));
- pTab->nCol = nCol;
- pTab->abPK = (u8*)&pTab[1];
- memcpy(pTab->abPK, abPK, nCol);
- pTab->zName = (char*)&pTab->abPK[nCol];
- memcpy(pTab->zName, zNew, nNew+1);
-
- if( pGrp->db ){
- pTab->nCol = 0;
- rc = sessionInitTable(0, pTab, pGrp->db, pGrp->zDb);
- if( rc ){
- assert( pTab->azCol==0 );
- sqlite3_free(pTab);
- break;
- }
- }
+ /* If one was not found above, create a new table now */
+ if( !pTab ){
+ SessionTable **ppNew;
- /* The new object must be linked on to the end of the list, not
- ** simply added to the start of it. This is to ensure that the
- ** tables within the output of sqlite3changegroup_output() are in
- ** the right order. */
- for(ppTab=&pGrp->pList; *ppTab; ppTab=&(*ppTab)->pNext);
- *ppTab = pTab;
- }
+ pTab = sqlite3_malloc64(sizeof(SessionTable) + nCol + nTab+1);
+ if( !pTab ){
+ return SQLITE_NOMEM;
+ }
+ memset(pTab, 0, sizeof(SessionTable));
+ pTab->nCol = nCol;
+ pTab->abPK = (u8*)&pTab[1];
+ memcpy(pTab->abPK, abPK, nCol);
+ pTab->zName = (char*)&pTab->abPK[nCol];
+ memcpy(pTab->zName, zTab, nTab+1);
- if( !sessionChangesetCheckCompat(pTab, nCol, abPK) ){
- rc = SQLITE_SCHEMA;
- break;
+ if( pGrp->db ){
+ pTab->nCol = 0;
+ rc = sessionInitTable(0, pTab, pGrp->db, pGrp->zDb);
+ if( rc ){
+ assert( pTab->azCol==0 );
+ sqlite3_free(pTab);
+ return rc;
}
}
- if( nCol<pTab->nCol ){
- assert( pGrp->db );
- rc = sessionChangesetExtendRecord(pGrp, pTab, nCol, op, aRec, nRec, &rec);
- if( rc ) break;
- aRec = rec.aBuf;
- nRec = rec.nBuf;
- }
+ /* The new object must be linked on to the end of the list, not
+ ** simply added to the start of it. This is to ensure that the
+ ** tables within the output of sqlite3changegroup_output() are in
+ ** the right order. */
+ for(ppNew=&pGrp->pList; *ppNew; ppNew=&(*ppNew)->pNext);
+ *ppNew = pTab;
+ }
- if( sessionGrowHash(0, pIter->bPatchset, pTab) ){
- rc = SQLITE_NOMEM;
- break;
- }
+ /* Check that the table is compatible. */
+ if( !sessionChangesetCheckCompat(pTab, nCol, abPK) ){
+ rc = SQLITE_SCHEMA;
+ }
+
+ *ppTab = pTab;
+ return rc;
+}
+
+/*
+** Add the change currently indicated by iterator pIter to the hash table
+** belonging to changegroup pGrp.
+*/
+static int sessionOneChangeToHash(
+ sqlite3_changegroup *pGrp,
+ sqlite3_changeset_iter *pIter,
+ int bRebase
+){
+ int rc = SQLITE_OK;
+ int nCol = 0;
+ int op = 0;
+ int iHash = 0;
+ int bIndirect = 0;
+ SessionChange *pChange = 0;
+ SessionChange *pExist = 0;
+ SessionChange **pp = 0;
+ SessionTable *pTab = 0;
+ u8 *aRec = &pIter->in.aData[pIter->in.iCurrent + 2];
+ int nRec = (pIter->in.iNext - pIter->in.iCurrent) - 2;
+
+ /* Ensure that only changesets, or only patchsets, but not a mixture
+ ** of both, are being combined. It is an error to try to combine a
+ ** changeset and a patchset. */
+ if( pGrp->pList==0 ){
+ pGrp->bPatch = pIter->bPatchset;
+ }else if( pIter->bPatchset!=pGrp->bPatch ){
+ rc = SQLITE_ERROR;
+ }
+
+ if( rc==SQLITE_OK ){
+ const char *zTab = 0;
+ sqlite3changeset_op(pIter, &zTab, &nCol, &op, &bIndirect);
+ rc = sessionChangesetFindTable(pGrp, zTab, pIter, &pTab);
+ }
+
+ if( rc==SQLITE_OK && nCol<pTab->nCol ){
+ SessionBuffer *pBuf = &pGrp->rec;
+ rc = sessionChangesetExtendRecord(pGrp, pTab, nCol, op, aRec, nRec, pBuf);
+ aRec = pBuf->aBuf;
+ nRec = pBuf->nBuf;
+ assert( pGrp->db );
+ }
+
+ if( rc==SQLITE_OK && sessionGrowHash(0, pIter->bPatchset, pTab) ){
+ rc = SQLITE_NOMEM;
+ }
+
+ if( rc==SQLITE_OK ){
+ /* Search for existing entry. If found, remove it from the hash table.
+ ** Code below may link it back in. */
iHash = sessionChangeHash(
pTab, (pIter->bPatchset && op==SQLITE_DELETE), aRec, pTab->nChange
);
-
- /* Search for existing entry. If found, remove it from the hash table.
- ** Code below may link it back in.
- */
for(pp=&pTab->apChange[iHash]; *pp; pp=&(*pp)->pNext){
int bPkOnly1 = 0;
int bPkOnly2 = 0;
@@ -229081,19 +230757,41 @@ static int sessionChangesetToHash(
break;
}
}
+ }
+ if( rc==SQLITE_OK ){
rc = sessionChangeMerge(pTab, bRebase,
pIter->bPatchset, pExist, op, bIndirect, aRec, nRec, &pChange
);
- if( rc ) break;
- if( pChange ){
- pChange->pNext = pTab->apChange[iHash];
- pTab->apChange[iHash] = pChange;
- pTab->nEntry++;
- }
+ }
+ if( rc==SQLITE_OK && pChange ){
+ pChange->pNext = pTab->apChange[iHash];
+ pTab->apChange[iHash] = pChange;
+ pTab->nEntry++;
+ }
+
+ if( rc==SQLITE_OK ) rc = pIter->rc;
+ return rc;
+}
+
+/*
+** Add all changes in the changeset traversed by the iterator passed as
+** the first argument to the changegroup hash tables.
+*/
+static int sessionChangesetToHash(
+ sqlite3_changeset_iter *pIter, /* Iterator to read from */
+ sqlite3_changegroup *pGrp, /* Changegroup object to add changeset to */
+ int bRebase /* True if hash table is for rebasing */
+){
+ u8 *aRec;
+ int nRec;
+ int rc = SQLITE_OK;
+
+ while( SQLITE_ROW==(sessionChangesetNext(pIter, &aRec, &nRec, 0)) ){
+ rc = sessionOneChangeToHash(pGrp, pIter, bRebase);
+ if( rc!=SQLITE_OK ) break;
}
- sqlite3_free(rec.aBuf);
if( rc==SQLITE_OK ) rc = pIter->rc;
return rc;
}
@@ -229222,6 +230920,23 @@ SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup *pGrp, int nData, void
}
/*
+** Add a single change to a changeset-group.
+*/
+SQLITE_API int sqlite3changegroup_add_change(
+ sqlite3_changegroup *pGrp,
+ sqlite3_changeset_iter *pIter
+){
+ if( pIter->in.iCurrent==pIter->in.iNext
+ || pIter->rc!=SQLITE_OK
+ || pIter->bInvert
+ ){
+ /* Iterator does not point to any valid entry or is an INVERT iterator. */
+ return SQLITE_ERROR;
+ }
+ return sessionOneChangeToHash(pGrp, pIter, 0);
+}
+
+/*
** Obtain a buffer containing a changeset representing the concatenation
** of all changesets added to the group so far.
*/
@@ -229270,6 +230985,7 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup *pGrp){
if( pGrp ){
sqlite3_free(pGrp->zDb);
sessionDeleteTable(0, pGrp->pList);
+ sqlite3_free(pGrp->rec.aBuf);
sqlite3_free(pGrp);
}
}
@@ -229671,6 +231387,7 @@ SQLITE_API int sqlite3rebaser_rebase_strm(
SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p){
if( p ){
sessionDeleteTable(0, p->grp.pList);
+ sqlite3_free(p->grp.rec.aBuf);
sqlite3_free(p);
}
}
@@ -229768,8 +231485,8 @@ struct Fts5PhraseIter {
** EXTENSION API FUNCTIONS
**
** xUserData(pFts):
-** Return a copy of the context pointer the extension function was
-** registered with.
+** Return a copy of the pUserData pointer passed to the xCreateFunction()
+** API when the extension function was registered.
**
** xColumnTotalSize(pFts, iCol, pnToken):
** If parameter iCol is less than zero, set output variable *pnToken
@@ -231365,6 +233082,9 @@ static void sqlite3Fts5UnicodeAscii(u8*, u8*);
** sqlite3Fts5ParserARG_STORE Code to store %extra_argument into fts5yypParser
** sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser
** sqlite3Fts5ParserCTX_* As sqlite3Fts5ParserARG_ except for %extra_context
+** fts5YYREALLOC Name of the realloc() function to use
+** fts5YYFREE Name of the free() function to use
+** fts5YYDYNSTACK True if stack space should be extended on heap
** fts5YYERRORSYMBOL is the code number of the error symbol. If not
** defined, then do no error processing.
** fts5YYNSTATE the combined number of states.
@@ -231378,6 +233098,8 @@ static void sqlite3Fts5UnicodeAscii(u8*, u8*);
** fts5YY_NO_ACTION The fts5yy_action[] code for no-op
** fts5YY_MIN_REDUCE Minimum value for reduce actions
** fts5YY_MAX_REDUCE Maximum value for reduce actions
+** fts5YY_MIN_DSTRCTR Minimum symbol value that has a destructor
+** fts5YY_MAX_DSTRCTR Maximum symbol value that has a destructor
*/
#ifndef INTERFACE
# define INTERFACE 1
@@ -231404,6 +233126,9 @@ typedef union {
#define sqlite3Fts5ParserARG_PARAM ,pParse
#define sqlite3Fts5ParserARG_FETCH Fts5Parse *pParse=fts5yypParser->pParse;
#define sqlite3Fts5ParserARG_STORE fts5yypParser->pParse=pParse;
+#define fts5YYREALLOC realloc
+#define fts5YYFREE free
+#define fts5YYDYNSTACK 0
#define sqlite3Fts5ParserCTX_SDECL
#define sqlite3Fts5ParserCTX_PDECL
#define sqlite3Fts5ParserCTX_PARAM
@@ -231421,6 +233146,8 @@ typedef union {
#define fts5YY_NO_ACTION 82
#define fts5YY_MIN_REDUCE 83
#define fts5YY_MAX_REDUCE 110
+#define fts5YY_MIN_DSTRCTR 16
+#define fts5YY_MAX_DSTRCTR 24
/************* End control #defines *******************************************/
#define fts5YY_NLOOKAHEAD ((int)(sizeof(fts5yy_lookahead)/sizeof(fts5yy_lookahead[0])))
@@ -231436,6 +233163,22 @@ typedef union {
# define fts5yytestcase(X)
#endif
+/* Macro to determine if stack space has the ability to grow using
+** heap memory.
+*/
+#if fts5YYSTACKDEPTH<=0 || fts5YYDYNSTACK
+# define fts5YYGROWABLESTACK 1
+#else
+# define fts5YYGROWABLESTACK 0
+#endif
+
+/* Guarantee a minimum number of initial stack slots.
+*/
+#if fts5YYSTACKDEPTH<=0
+# undef fts5YYSTACKDEPTH
+# define fts5YYSTACKDEPTH 2 /* Need a minimum stack size */
+#endif
+
/* Next are the tables used to determine what action to take based on the
** current state and lookahead token. These tables are used to implement
@@ -231596,14 +233339,9 @@ struct fts5yyParser {
#endif
sqlite3Fts5ParserARG_SDECL /* A place to hold %extra_argument */
sqlite3Fts5ParserCTX_SDECL /* A place to hold %extra_context */
-#if fts5YYSTACKDEPTH<=0
- int fts5yystksz; /* Current side of the stack */
- fts5yyStackEntry *fts5yystack; /* The parser's stack */
- fts5yyStackEntry fts5yystk0; /* First stack entry */
-#else
- fts5yyStackEntry fts5yystack[fts5YYSTACKDEPTH]; /* The parser's stack */
- fts5yyStackEntry *fts5yystackEnd; /* Last entry in the stack */
-#endif
+ fts5yyStackEntry *fts5yystackEnd; /* Last entry in the stack */
+ fts5yyStackEntry *fts5yystack; /* The parser stack */
+ fts5yyStackEntry fts5yystk0[fts5YYSTACKDEPTH]; /* Initial stack space */
};
typedef struct fts5yyParser fts5yyParser;
@@ -231710,37 +233448,45 @@ static const char *const fts5yyRuleName[] = {
#endif /* NDEBUG */
-#if fts5YYSTACKDEPTH<=0
+#if fts5YYGROWABLESTACK
/*
** Try to increase the size of the parser stack. Return the number
** of errors. Return 0 on success.
*/
static int fts5yyGrowStack(fts5yyParser *p){
+ int oldSize = 1 + (int)(p->fts5yystackEnd - p->fts5yystack);
int newSize;
int idx;
fts5yyStackEntry *pNew;
- newSize = p->fts5yystksz*2 + 100;
- idx = p->fts5yytos ? (int)(p->fts5yytos - p->fts5yystack) : 0;
- if( p->fts5yystack==&p->fts5yystk0 ){
- pNew = malloc(newSize*sizeof(pNew[0]));
- if( pNew ) pNew[0] = p->fts5yystk0;
+ newSize = oldSize*2 + 100;
+ idx = (int)(p->fts5yytos - p->fts5yystack);
+ if( p->fts5yystack==p->fts5yystk0 ){
+ pNew = fts5YYREALLOC(0, newSize*sizeof(pNew[0]));
+ if( pNew==0 ) return 1;
+ memcpy(pNew, p->fts5yystack, oldSize*sizeof(pNew[0]));
}else{
- pNew = realloc(p->fts5yystack, newSize*sizeof(pNew[0]));
+ pNew = fts5YYREALLOC(p->fts5yystack, newSize*sizeof(pNew[0]));
+ if( pNew==0 ) return 1;
}
- if( pNew ){
- p->fts5yystack = pNew;
- p->fts5yytos = &p->fts5yystack[idx];
+ p->fts5yystack = pNew;
+ p->fts5yytos = &p->fts5yystack[idx];
#ifndef NDEBUG
- if( fts5yyTraceFILE ){
- fprintf(fts5yyTraceFILE,"%sStack grows from %d to %d entries.\n",
- fts5yyTracePrompt, p->fts5yystksz, newSize);
- }
-#endif
- p->fts5yystksz = newSize;
+ if( fts5yyTraceFILE ){
+ fprintf(fts5yyTraceFILE,"%sStack grows from %d to %d entries.\n",
+ fts5yyTracePrompt, oldSize, newSize);
}
- return pNew==0;
+#endif
+ p->fts5yystackEnd = &p->fts5yystack[newSize-1];
+ return 0;
}
+#endif /* fts5YYGROWABLESTACK */
+
+#if !fts5YYGROWABLESTACK
+/* For builds that do no have a growable stack, fts5yyGrowStack always
+** returns an error.
+*/
+# define fts5yyGrowStack(X) 1
#endif
/* Datatype of the argument to the memory allocated passed as the
@@ -231760,24 +233506,14 @@ static void sqlite3Fts5ParserInit(void *fts5yypRawParser sqlite3Fts5ParserCTX_PD
#ifdef fts5YYTRACKMAXSTACKDEPTH
fts5yypParser->fts5yyhwm = 0;
#endif
-#if fts5YYSTACKDEPTH<=0
- fts5yypParser->fts5yytos = NULL;
- fts5yypParser->fts5yystack = NULL;
- fts5yypParser->fts5yystksz = 0;
- if( fts5yyGrowStack(fts5yypParser) ){
- fts5yypParser->fts5yystack = &fts5yypParser->fts5yystk0;
- fts5yypParser->fts5yystksz = 1;
- }
-#endif
+ fts5yypParser->fts5yystack = fts5yypParser->fts5yystk0;
+ fts5yypParser->fts5yystackEnd = &fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1];
#ifndef fts5YYNOERRORRECOVERY
fts5yypParser->fts5yyerrcnt = -1;
#endif
fts5yypParser->fts5yytos = fts5yypParser->fts5yystack;
fts5yypParser->fts5yystack[0].stateno = 0;
fts5yypParser->fts5yystack[0].major = 0;
-#if fts5YYSTACKDEPTH>0
- fts5yypParser->fts5yystackEnd = &fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1];
-#endif
}
#ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK
@@ -231891,9 +233627,26 @@ static void fts5yy_pop_parser_stack(fts5yyParser *pParser){
*/
static void sqlite3Fts5ParserFinalize(void *p){
fts5yyParser *pParser = (fts5yyParser*)p;
- while( pParser->fts5yytos>pParser->fts5yystack ) fts5yy_pop_parser_stack(pParser);
-#if fts5YYSTACKDEPTH<=0
- if( pParser->fts5yystack!=&pParser->fts5yystk0 ) free(pParser->fts5yystack);
+
+ /* In-lined version of calling fts5yy_pop_parser_stack() for each
+ ** element left in the stack */
+ fts5yyStackEntry *fts5yytos = pParser->fts5yytos;
+ while( fts5yytos>pParser->fts5yystack ){
+#ifndef NDEBUG
+ if( fts5yyTraceFILE ){
+ fprintf(fts5yyTraceFILE,"%sPopping %s\n",
+ fts5yyTracePrompt,
+ fts5yyTokenName[fts5yytos->major]);
+ }
+#endif
+ if( fts5yytos->major>=fts5YY_MIN_DSTRCTR ){
+ fts5yy_destructor(pParser, fts5yytos->major, &fts5yytos->minor);
+ }
+ fts5yytos--;
+ }
+
+#if fts5YYGROWABLESTACK
+ if( pParser->fts5yystack!=pParser->fts5yystk0 ) fts5YYFREE(pParser->fts5yystack);
#endif
}
@@ -232120,25 +233873,19 @@ static void fts5yy_shift(
assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack) );
}
#endif
-#if fts5YYSTACKDEPTH>0
- if( fts5yypParser->fts5yytos>fts5yypParser->fts5yystackEnd ){
- fts5yypParser->fts5yytos--;
- fts5yyStackOverflow(fts5yypParser);
- return;
- }
-#else
- if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz] ){
+ fts5yytos = fts5yypParser->fts5yytos;
+ if( fts5yytos>fts5yypParser->fts5yystackEnd ){
if( fts5yyGrowStack(fts5yypParser) ){
fts5yypParser->fts5yytos--;
fts5yyStackOverflow(fts5yypParser);
return;
}
+ fts5yytos = fts5yypParser->fts5yytos;
+ assert( fts5yytos <= fts5yypParser->fts5yystackEnd );
}
-#endif
if( fts5yyNewState > fts5YY_MAX_SHIFT ){
fts5yyNewState += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE;
}
- fts5yytos = fts5yypParser->fts5yytos;
fts5yytos->stateno = fts5yyNewState;
fts5yytos->major = fts5yyMajor;
fts5yytos->minor.fts5yy0 = fts5yyMinor;
@@ -232575,19 +234322,12 @@ static void sqlite3Fts5Parser(
(int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack));
}
#endif
-#if fts5YYSTACKDEPTH>0
if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){
- fts5yyStackOverflow(fts5yypParser);
- break;
- }
-#else
- if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){
if( fts5yyGrowStack(fts5yypParser) ){
fts5yyStackOverflow(fts5yypParser);
break;
}
}
-#endif
}
fts5yyact = fts5yy_reduce(fts5yypParser,fts5yyruleno,fts5yymajor,fts5yyminor sqlite3Fts5ParserCTX_PARAM);
}else if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){
@@ -250799,7 +252539,7 @@ static void fts5SourceIdFunc(
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
- sqlite3_result_text(pCtx, "fts5: 2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355", -1, SQLITE_TRANSIENT);
+ sqlite3_result_text(pCtx, "fts5: 2024-05-23 13:25:27 96c92aba00c8375bc32fafcdf12429c58bd8aabfcadab6683e35bbb9cdebf19e", -1, SQLITE_TRANSIENT);
}
/*
@@ -250838,6 +252578,7 @@ static int fts5IntegrityMethod(
if( (rc&0xff)==SQLITE_CORRUPT ){
*pzErr = sqlite3_mprintf("malformed inverted index for FTS5 table %s.%s",
zSchema, zTabname);
+ rc = (*pzErr) ? SQLITE_OK : SQLITE_NOMEM;
}else if( rc!=SQLITE_OK ){
*pzErr = sqlite3_mprintf("unable to validate the inverted index for"
" FTS5 table %s.%s: %s",
@@ -250845,7 +252586,7 @@ static int fts5IntegrityMethod(
}
sqlite3Fts5IndexCloseReader(pTab->p.pIndex);
- return SQLITE_OK;
+ return rc;
}
static int fts5Init(sqlite3 *db){
diff --git a/src/3rdparty/sqlite/sqlite3.h b/src/3rdparty/sqlite/sqlite3.h
index 2618b37a7b..57df8dcf20 100644
--- a/src/3rdparty/sqlite/sqlite3.h
+++ b/src/3rdparty/sqlite/sqlite3.h
@@ -146,9 +146,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
-#define SQLITE_VERSION "3.45.3"
-#define SQLITE_VERSION_NUMBER 3045003
-#define SQLITE_SOURCE_ID "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355"
+#define SQLITE_VERSION "3.46.0"
+#define SQLITE_VERSION_NUMBER 3046000
+#define SQLITE_SOURCE_ID "2024-05-23 13:25:27 96c92aba00c8375bc32fafcdf12429c58bd8aabfcadab6683e35bbb9cdebf19e"
/*
** CAPI3REF: Run-Time Library Version Numbers
@@ -764,11 +764,11 @@ struct sqlite3_file {
** </ul>
** xLock() upgrades the database file lock. In other words, xLock() moves the
** database file lock in the direction NONE toward EXCLUSIVE. The argument to
-** xLock() is always on of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
+** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
** SQLITE_LOCK_NONE. If the database file lock is already at or above the
** requested lock, then the call to xLock() is a no-op.
** xUnlock() downgrades the database file lock to either SHARED or NONE.
-* If the lock is already at or below the requested lock state, then the call
+** If the lock is already at or below the requested lock state, then the call
** to xUnlock() is a no-op.
** The xCheckReservedLock() method checks whether any database connection,
** either in this process or in some other process, is holding a RESERVED,
@@ -3305,8 +3305,8 @@ SQLITE_API int sqlite3_set_authorizer(
#define SQLITE_RECURSIVE 33 /* NULL NULL */
/*
-** CAPI3REF: Tracing And Profiling Functions
-** METHOD: sqlite3
+** CAPI3REF: Deprecated Tracing And Profiling Functions
+** DEPRECATED
**
** These routines are deprecated. Use the [sqlite3_trace_v2()] interface
** instead of the routines described here.
@@ -6887,6 +6887,12 @@ SQLITE_API int sqlite3_autovacuum_pages(
** The exceptions defined in this paragraph might change in a future
** release of SQLite.
**
+** Whether the update hook is invoked before or after the
+** corresponding change is currently unspecified and may differ
+** depending on the type of change. Do not rely on the order of the
+** hook call with regards to the final result of the operation which
+** triggers the hook.
+**
** The update hook implementation must not do anything that will modify
** the database connection that invoked the update hook. Any actions
** to modify the database connection must be deferred until after the
@@ -8357,7 +8363,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
** The sqlite3_keyword_count() interface returns the number of distinct
** keywords understood by SQLite.
**
-** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and
+** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and
** makes *Z point to that keyword expressed as UTF8 and writes the number
** of bytes in the keyword into *L. The string that *Z points to is not
** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
@@ -9936,24 +9942,45 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
** <li value="2"><p>
** ^(If the sqlite3_vtab_distinct() interface returns 2, that means
** that the query planner does not need the rows returned in any particular
-** order, as long as rows with the same values in all "aOrderBy" columns
-** are adjacent.)^ ^(Furthermore, only a single row for each particular
-** combination of values in the columns identified by the "aOrderBy" field
-** needs to be returned.)^ ^It is always ok for two or more rows with the same
-** values in all "aOrderBy" columns to be returned, as long as all such rows
-** are adjacent. ^The virtual table may, if it chooses, omit extra rows
-** that have the same value for all columns identified by "aOrderBy".
-** ^However omitting the extra rows is optional.
+** order, as long as rows with the same values in all columns identified
+** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows
+** contain the same values for all columns identified by "colUsed", all but
+** one such row may optionally be omitted from the result.)^
+** The virtual table is not required to omit rows that are duplicates
+** over the "colUsed" columns, but if the virtual table can do that without
+** too much extra effort, it could potentially help the query to run faster.
** This mode is used for a DISTINCT query.
** <li value="3"><p>
-** ^(If the sqlite3_vtab_distinct() interface returns 3, that means
-** that the query planner needs only distinct rows but it does need the
-** rows to be sorted.)^ ^The virtual table implementation is free to omit
-** rows that are identical in all aOrderBy columns, if it wants to, but
-** it is not required to omit any rows. This mode is used for queries
+** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the
+** virtual table must return rows in the order defined by "aOrderBy" as
+** if the sqlite3_vtab_distinct() interface had returned 0. However if
+** two or more rows in the result have the same values for all columns
+** identified by "colUsed", then all but one such row may optionally be
+** omitted.)^ Like when the return value is 2, the virtual table
+** is not required to omit rows that are duplicates over the "colUsed"
+** columns, but if the virtual table can do that without
+** too much extra effort, it could potentially help the query to run faster.
+** This mode is used for queries
** that have both DISTINCT and ORDER BY clauses.
** </ol>
**
+** <p>The following table summarizes the conditions under which the
+** virtual table is allowed to set the "orderByConsumed" flag based on
+** the value returned by sqlite3_vtab_distinct(). This table is a
+** restatement of the previous four paragraphs:
+**
+** <table border=1 cellspacing=0 cellpadding=10 width="90%">
+** <tr>
+** <td valign="top">sqlite3_vtab_distinct() return value
+** <td valign="top">Rows are returned in aOrderBy order
+** <td valign="top">Rows with the same value in all aOrderBy columns are adjacent
+** <td valign="top">Duplicates over all colUsed columns may be omitted
+** <tr><td>0<td>yes<td>yes<td>no
+** <tr><td>1<td>no<td>yes<td>no
+** <tr><td>2<td>no<td>yes<td>yes
+** <tr><td>3<td>yes<td>yes<td>yes
+** </table>
+**
** ^For the purposes of comparing virtual table output values to see if the
** values are same value for sorting purposes, two NULL values are considered
** to be the same. In other words, the comparison operator is "IS"
@@ -11999,6 +12026,30 @@ SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const c
SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
/*
+** CAPI3REF: Add A Single Change To A Changegroup
+** METHOD: sqlite3_changegroup
+**
+** This function adds the single change currently indicated by the iterator
+** passed as the second argument to the changegroup object. The rules for
+** adding the change are just as described for [sqlite3changegroup_add()].
+**
+** If the change is successfully added to the changegroup, SQLITE_OK is
+** returned. Otherwise, an SQLite error code is returned.
+**
+** The iterator must point to a valid entry when this function is called.
+** If it does not, SQLITE_ERROR is returned and no change is added to the
+** changegroup. Additionally, the iterator must not have been opened with
+** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also
+** returned.
+*/
+SQLITE_API int sqlite3changegroup_add_change(
+ sqlite3_changegroup*,
+ sqlite3_changeset_iter*
+);
+
+
+
+/*
** CAPI3REF: Obtain A Composite Changeset From A Changegroup
** METHOD: sqlite3_changegroup
**
@@ -12802,8 +12853,8 @@ struct Fts5PhraseIter {
** EXTENSION API FUNCTIONS
**
** xUserData(pFts):
-** Return a copy of the context pointer the extension function was
-** registered with.
+** Return a copy of the pUserData pointer passed to the xCreateFunction()
+** API when the extension function was registered.
**
** xColumnTotalSize(pFts, iCol, pnToken):
** If parameter iCol is less than zero, set output variable *pnToken
diff --git a/src/android/CMakeLists.txt b/src/android/CMakeLists.txt
index 045076c8d3..007430598e 100644
--- a/src/android/CMakeLists.txt
+++ b/src/android/CMakeLists.txt
@@ -8,5 +8,6 @@ if (ANDROID)
add_subdirectory(jar)
add_subdirectory(java)
add_subdirectory(templates)
+ add_subdirectory(templates_aar)
endif()
diff --git a/src/android/jar/CMakeLists.txt b/src/android/jar/CMakeLists.txt
index c36bbdf75b..b786354a21 100644
--- a/src/android/jar/CMakeLists.txt
+++ b/src/android/jar/CMakeLists.txt
@@ -35,11 +35,17 @@ set(java_sources
src/org/qtproject/qt/android/QtWindow.java
src/org/qtproject/qt/android/QtActivityDelegateBase.java
src/org/qtproject/qt/android/QtEmbeddedDelegate.java
- src/org/qtproject/qt/android/QtEmbeddedDelegateFactory.java
+ src/org/qtproject/qt/android/QtEmbeddedViewInterfaceFactory.java
src/org/qtproject/qt/android/QtEmbeddedLoader.java
src/org/qtproject/qt/android/QtView.java
src/org/qtproject/qt/android/QtEmbeddedViewInterface.java
src/org/qtproject/qt/android/QtServiceEmbeddedDelegate.java
+ src/org/qtproject/qt/android/BackendRegister.java
+ src/org/qtproject/qt/android/QtWindowInterface.java
+ src/org/qtproject/qt/android/QtAccessibilityInterface.java
+ src/org/qtproject/qt/android/QtMenuInterface.java
+ src/org/qtproject/qt/android/QtLayoutInterface.java
+ src/org/qtproject/qt/android/QtInputInterface.java
)
qt_internal_add_jar(Qt${QtBase_VERSION_MAJOR}Android
diff --git a/src/android/jar/build.gradle b/src/android/jar/build.gradle
index 452d4ad780..6b5923f713 100644
--- a/src/android/jar/build.gradle
+++ b/src/android/jar/build.gradle
@@ -7,7 +7,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:8.0.2'
+ classpath 'com.android.tools.build:gradle:8.4.0'
}
}
@@ -27,7 +27,7 @@ android {
namespace "org.qtproject.qt.android"
defaultConfig {
- minSdkVersion 23
+ minSdkVersion 28
}
sourceSets {
diff --git a/src/android/jar/src/org/qtproject/qt/android/BackendRegister.java b/src/android/jar/src/org/qtproject/qt/android/BackendRegister.java
new file mode 100644
index 0000000000..b66a593ec6
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt/android/BackendRegister.java
@@ -0,0 +1,9 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+package org.qtproject.qt.android;
+
+class BackendRegister
+{
+ static native void registerBackend(Class interfaceType, Object interfaceObject);
+ static native void unregisterBackend(Class interfaceType);
+}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtAccessibilityDelegate.java b/src/android/jar/src/org/qtproject/qt/android/QtAccessibilityDelegate.java
index d23c87e792..8558e42c3b 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtAccessibilityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtAccessibilityDelegate.java
@@ -61,6 +61,8 @@ class QtAccessibilityDelegate extends View.AccessibilityDelegate
}
// TODO do we want to have one QtAccessibilityDelegate for the whole app (QtRootLayout) or
// e.g. one per window?
+ // FIXME make QtAccessibilityDelegate window based or verify current way works
+ // also for child windows: QTBUG-120685
public QtAccessibilityDelegate(QtLayout layout)
{
m_layout = layout;
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtAccessibilityInterface.java b/src/android/jar/src/org/qtproject/qt/android/QtAccessibilityInterface.java
new file mode 100644
index 0000000000..690b1ae248
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt/android/QtAccessibilityInterface.java
@@ -0,0 +1,14 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+package org.qtproject.qt.android;
+
+@UsedFromNativeCode
+interface QtAccessibilityInterface {
+ default void initializeAccessibility() { }
+ default void notifyLocationChange(int viewId) { }
+ default void notifyObjectHide(int viewId, int parentId) { }
+ default void notifyObjectFocus(int viewId) { }
+ default void notifyScrolledEvent(int viewId) { }
+ default void notifyValueChanged(int viewId, String value) { }
+ default void notifyObjectShow(int parentId) { }
+}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtActivityBase.java b/src/android/jar/src/org/qtproject/qt/android/QtActivityBase.java
index 3cb6ba220e..b5de60d49d 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtActivityBase.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtActivityBase.java
@@ -19,7 +19,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
-public class QtActivityBase extends Activity
+public class QtActivityBase extends Activity implements QtNative.AppStateDetailsListener
{
private String m_applicationParams = "";
private boolean m_isCustomThemeSet = false;
@@ -96,6 +96,8 @@ public class QtActivityBase extends Activity
m_delegate = new QtActivityDelegate(this);
+ QtNative.registerAppStateListener(this);
+
handleActivityRestart();
addReferrer(getIntent());
@@ -108,6 +110,14 @@ public class QtActivityBase extends Activity
}
@Override
+ public void onAppStateDetailsChanged(QtNative.ApplicationStateDetails details) {
+ if (details.isStarted)
+ m_delegate.registerBackends();
+ else
+ m_delegate.unregisterBackends();
+ }
+
+ @Override
protected void onStart()
{
super.onStart();
@@ -153,6 +163,7 @@ public class QtActivityBase extends Activity
{
super.onDestroy();
if (!m_retainNonConfigurationInstance) {
+ QtNative.unregisterAppStateListener(this);
QtNative.terminateQt();
QtNative.setActivity(null);
QtNative.getQtThread().exit();
@@ -295,6 +306,7 @@ public class QtActivityBase extends Activity
@Override
protected void onNewIntent(Intent intent)
{
+ addReferrer(intent);
QtNative.onNewIntent(intent);
}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java
index 1e1a36be3c..596074c631 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java
@@ -9,7 +9,6 @@ import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
-import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.Rect;
@@ -26,24 +25,24 @@ import android.view.Menu;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
-import android.view.Window;
-import android.view.WindowInsetsController;
import android.widget.ImageView;
import android.widget.PopupMenu;
import java.util.HashMap;
class QtActivityDelegate extends QtActivityDelegateBase
+ implements QtWindowInterface, QtAccessibilityInterface, QtMenuInterface, QtLayoutInterface
{
private static final String QtTAG = "QtActivityDelegate";
private QtRootLayout m_layout = null;
private ImageView m_splashScreen = null;
private boolean m_splashScreenSticky = false;
+ private boolean m_backendsRegistered = false;
private View m_dummyView = null;
- private HashMap<Integer, View> m_nativeViews = new HashMap<Integer, View>();
-
+ private final HashMap<Integer, View> m_nativeViews = new HashMap<>();
+ private QtAccessibilityDelegate m_accessibilityDelegate = null;
QtActivityDelegate(Activity activity)
{
@@ -53,17 +52,43 @@ class QtActivityDelegate extends QtActivityDelegateBase
setActivityBackgroundDrawable();
}
+ void registerBackends()
+ {
+ if (!m_backendsRegistered) {
+ m_backendsRegistered = true;
+ BackendRegister.registerBackend(QtWindowInterface.class,
+ (QtWindowInterface)QtActivityDelegate.this);
+ BackendRegister.registerBackend(QtAccessibilityInterface.class,
+ (QtAccessibilityInterface)QtActivityDelegate.this);
+ BackendRegister.registerBackend(QtMenuInterface.class,
+ (QtMenuInterface)QtActivityDelegate.this);
+ BackendRegister.registerBackend(QtLayoutInterface.class,
+ (QtLayoutInterface)QtActivityDelegate.this);
+ BackendRegister.registerBackend(QtInputInterface.class,
+ (QtInputInterface)m_inputDelegate);
+ }
+ }
+
+ void unregisterBackends()
+ {
+ if (m_backendsRegistered) {
+ m_backendsRegistered = false;
+ BackendRegister.unregisterBackend(QtWindowInterface.class);
+ BackendRegister.unregisterBackend(QtAccessibilityInterface.class);
+ BackendRegister.unregisterBackend(QtMenuInterface.class);
+ BackendRegister.unregisterBackend(QtLayoutInterface.class);
+ BackendRegister.unregisterBackend(QtInputInterface.class);
+ }
+ }
- @UsedFromNativeCode
@Override
- QtLayout getQtLayout()
+ public QtLayout getQtLayout()
{
return m_layout;
}
- @UsedFromNativeCode
@Override
- void setSystemUiVisibility(int systemUiVisibility)
+ public void setSystemUiVisibility(int systemUiVisibility)
{
QtNative.runAction(() -> {
m_displayManager.setSystemUiVisibility(systemUiVisibility);
@@ -212,7 +237,55 @@ class QtActivityDelegate extends QtActivityDelegateBase
});
}
- @UsedFromNativeCode
+ @Override
+ public void notifyLocationChange(int viewId)
+ {
+ if (m_accessibilityDelegate == null)
+ return;
+ m_accessibilityDelegate.notifyLocationChange(viewId);
+ }
+
+ @Override
+ public void notifyObjectHide(int viewId, int parentId)
+ {
+ if (m_accessibilityDelegate == null)
+ return;
+ m_accessibilityDelegate.notifyObjectHide(viewId, parentId);
+ }
+
+ @Override
+ public void notifyObjectShow(int parentId)
+ {
+ if (m_accessibilityDelegate == null)
+ return;
+ m_accessibilityDelegate.notifyObjectShow(parentId);
+ }
+
+ @Override
+ public void notifyObjectFocus(int viewId)
+ {
+ if (m_accessibilityDelegate == null)
+ return;
+ m_accessibilityDelegate.notifyObjectFocus(viewId);
+ }
+
+ @Override
+ public void notifyValueChanged(int viewId, String value)
+ {
+ if (m_accessibilityDelegate == null)
+ return;
+ m_accessibilityDelegate.notifyValueChanged(viewId, value);
+ }
+
+ @Override
+ public void notifyScrolledEvent(int viewId)
+ {
+ if (m_accessibilityDelegate == null)
+ return;
+ m_accessibilityDelegate.notifyScrolledEvent(viewId);
+ }
+
+ @Override
public void initializeAccessibility()
{
QtNative.runAction(() -> {
@@ -224,27 +297,25 @@ class QtActivityDelegate extends QtActivityDelegateBase
});
}
- @UsedFromNativeCode
+ // QtMenuInterface implementation begin
+ @Override
public void resetOptionsMenu()
{
QtNative.runAction(() -> m_activity.invalidateOptionsMenu());
}
- @UsedFromNativeCode
+ @Override
public void openOptionsMenu()
{
QtNative.runAction(() -> m_activity.openOptionsMenu());
}
- private boolean m_contextMenuVisible = false;
-
- public void onCreatePopupMenu(Menu menu)
+ @Override
+ public void closeContextMenu()
{
- QtNative.fillContextMenu(menu);
- m_contextMenuVisible = true;
+ QtNative.runAction(() -> m_activity.closeContextMenu());
}
- @UsedFromNativeCode
@Override
public void openContextMenu(final int x, final int y, final int w, final int h)
{
@@ -264,11 +335,14 @@ class QtActivityDelegate extends QtActivityDelegateBase
popup.show();
}, 100);
}
+ // QtMenuInterface implementation end
- @UsedFromNativeCode
- public void closeContextMenu()
+ private boolean m_contextMenuVisible = false;
+
+ public void onCreatePopupMenu(Menu menu)
{
- QtNative.runAction(() -> m_activity.closeContextMenu());
+ QtNative.fillContextMenu(menu);
+ m_contextMenuVisible = true;
}
@Override
@@ -310,7 +384,7 @@ class QtActivityDelegate extends QtActivityDelegateBase
@UsedFromNativeCode
@Override
- void removeTopLevelWindow(final int id)
+ public void removeTopLevelWindow(final int id)
{
QtNative.runAction(()-> {
if (m_topLevelWindows.containsKey(id)) {
@@ -328,7 +402,7 @@ class QtActivityDelegate extends QtActivityDelegateBase
@UsedFromNativeCode
@Override
- void bringChildToFront(final int id)
+ public void bringChildToFront(final int id)
{
QtNative.runAction(() -> {
QtWindow window = m_topLevelWindows.get(id);
@@ -339,7 +413,7 @@ class QtActivityDelegate extends QtActivityDelegateBase
@UsedFromNativeCode
@Override
- void bringChildToBack(int id)
+ public void bringChildToBack(int id)
{
QtNative.runAction(() -> {
QtWindow window = m_topLevelWindows.get(id);
@@ -348,16 +422,6 @@ class QtActivityDelegate extends QtActivityDelegateBase
});
}
- @Override
- QtAccessibilityDelegate createAccessibilityDelegate()
- {
- if (m_layout != null)
- return new QtAccessibilityDelegate(m_layout);
-
- Log.w(QtTAG, "Null layout, failed to initialize accessibility delegate.");
- return null;
- }
-
private void setActivityBackgroundDrawable()
{
TypedValue attr = new TypedValue();
@@ -408,7 +472,8 @@ class QtActivityDelegate extends QtActivityDelegateBase
QtNative.runAction(() -> {
if (m_nativeViews.containsKey(id)) {
View view = m_nativeViews.get(id);
- view.setLayoutParams(new QtLayout.LayoutParams(w, h, x, y));
+ if (view != null)
+ view.setLayoutParams(new QtLayout.LayoutParams(w, h, x, y));
} else {
Log.e(QtTAG, "View " + id + " not found!");
}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegateBase.java b/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegateBase.java
index 6fd539d8dd..4980a47d08 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegateBase.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegateBase.java
@@ -37,7 +37,6 @@ abstract class QtActivityDelegateBase
{
protected Activity m_activity;
protected HashMap<Integer, QtWindow> m_topLevelWindows;
- protected QtAccessibilityDelegate m_accessibilityDelegate = null;
protected QtDisplayManager m_displayManager = null;
protected QtInputDelegate m_inputDelegate = null;
@@ -46,20 +45,12 @@ abstract class QtActivityDelegateBase
// Subclass must implement these
abstract void startNativeApplicationImpl(String appParams, String mainLib);
- abstract QtAccessibilityDelegate createAccessibilityDelegate();
- abstract QtLayout getQtLayout();
// With these we are okay with default implementation doing nothing
void setUpLayout() {}
void setUpSplashScreen(int orientation) {}
void hideSplashScreen(final int duration) {}
- void openContextMenu(final int x, final int y, final int w, final int h) {}
void setActionBarVisibility(boolean visible) {}
- void addTopLevelWindow(final QtWindow window) {}
- void removeTopLevelWindow(final int id) {}
- void bringChildToFront(final int id) {}
- void bringChildToBack(int id) {}
- void setSystemUiVisibility(int systemUiVisibility) {}
QtActivityDelegateBase(Activity activity)
{
@@ -72,7 +63,6 @@ abstract class QtActivityDelegateBase
return m_displayManager;
}
- @UsedFromNativeCode
QtInputDelegate getInputDelegate() {
return m_inputDelegate;
}
@@ -158,62 +148,6 @@ abstract class QtActivityDelegateBase
hideSplashScreen(0);
}
- @UsedFromNativeCode
- public void notifyLocationChange(int viewId)
- {
- if (m_accessibilityDelegate == null)
- return;
- m_accessibilityDelegate.notifyLocationChange(viewId);
- }
-
- @UsedFromNativeCode
- public void notifyObjectHide(int viewId, int parentId)
- {
- if (m_accessibilityDelegate == null)
- return;
- m_accessibilityDelegate.notifyObjectHide(viewId, parentId);
- }
-
- @UsedFromNativeCode
- public void notifyObjectShow(int parentId)
- {
- if (m_accessibilityDelegate == null)
- return;
- m_accessibilityDelegate.notifyObjectShow(parentId);
- }
-
- @UsedFromNativeCode
- public void notifyObjectFocus(int viewId)
- {
- if (m_accessibilityDelegate == null)
- return;
- m_accessibilityDelegate.notifyObjectFocus(viewId);
- }
-
- @UsedFromNativeCode
- public void notifyValueChanged(int viewId, String value)
- {
- if (m_accessibilityDelegate == null)
- return;
- m_accessibilityDelegate.notifyValueChanged(viewId, value);
- }
-
- @UsedFromNativeCode
- public void notifyScrolledEvent(int viewId)
- {
- if (m_accessibilityDelegate == null)
- return;
- m_accessibilityDelegate.notifyScrolledEvent(viewId);
- }
-
- @UsedFromNativeCode
- public void initializeAccessibility()
- {
- QtNative.runAction(() -> {
- m_accessibilityDelegate = createAccessibilityDelegate();
- });
- }
-
void handleUiModeChange(int uiMode)
{
// QTBUG-108365
@@ -240,28 +174,4 @@ abstract class QtActivityDelegateBase
break;
}
}
-
- @UsedFromNativeCode
- public void resetOptionsMenu()
- {
- QtNative.runAction(() -> m_activity.invalidateOptionsMenu());
- }
-
- @UsedFromNativeCode
- public void openOptionsMenu()
- {
- QtNative.runAction(() -> m_activity.openOptionsMenu());
- }
-
- public void onCreatePopupMenu(Menu menu)
- {
- QtNative.fillContextMenu(menu);
- m_contextMenuVisible = true;
- }
-
- @UsedFromNativeCode
- public void closeContextMenu()
- {
- QtNative.runAction(() -> m_activity.closeContextMenu());
- }
}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java b/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java
index ff694777d5..5298ac02bd 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java
@@ -15,19 +15,24 @@ import android.os.Handler;
import android.os.Looper;
import android.util.DisplayMetrics;
import android.util.Log;
+import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.PopupMenu;
import java.util.ArrayList;
import java.util.HashMap;
class QtEmbeddedDelegate extends QtActivityDelegateBase
- implements QtNative.AppStateDetailsListener, QtEmbeddedViewInterface
+ implements QtNative.AppStateDetailsListener, QtEmbeddedViewInterface, QtWindowInterface,
+ QtMenuInterface, QtLayoutInterface
{
+ private static final String QtTAG = "QtEmbeddedDelegate";
// TODO simplistic implementation with one QtView, expand to support multiple views QTBUG-117649
private QtView m_view;
private QtNative.ApplicationStateDetails m_stateDetails;
private boolean m_windowLoaded = false;
+ private boolean m_backendsRegistered = false;
public QtEmbeddedDelegate(Activity context) {
super(context);
@@ -76,7 +81,7 @@ class QtEmbeddedDelegate extends QtActivityDelegateBase
if (m_activity == activity && m_stateDetails.isStarted) {
m_activity.getApplication().unregisterActivityLifecycleCallbacks(this);
QtNative.unregisterAppStateListener(QtEmbeddedDelegate.this);
- QtEmbeddedDelegateFactory.remove(m_activity);
+ QtEmbeddedViewInterfaceFactory.remove(m_activity);
QtNative.terminateQt();
QtNative.setActivity(null);
QtNative.getQtThread().exit();
@@ -89,6 +94,17 @@ class QtEmbeddedDelegate extends QtActivityDelegateBase
public void onAppStateDetailsChanged(QtNative.ApplicationStateDetails details) {
synchronized (this) {
m_stateDetails = details;
+ if (details.isStarted && !m_backendsRegistered) {
+ m_backendsRegistered = true;
+ BackendRegister.registerBackend(QtWindowInterface.class, (QtWindowInterface)this);
+ BackendRegister.registerBackend(QtMenuInterface.class, (QtMenuInterface)this);
+ BackendRegister.registerBackend(QtLayoutInterface.class, (QtLayoutInterface)this);
+ } else if (!details.isStarted && m_backendsRegistered) {
+ m_backendsRegistered = false;
+ BackendRegister.unregisterBackend(QtWindowInterface.class);
+ BackendRegister.unregisterBackend(QtMenuInterface.class);
+ BackendRegister.unregisterBackend(QtLayoutInterface.class);
+ }
}
}
@@ -115,16 +131,7 @@ class QtEmbeddedDelegate extends QtActivityDelegateBase
}
@Override
- QtAccessibilityDelegate createAccessibilityDelegate()
- {
- // FIXME make QtAccessibilityDelegate window based or verify current way works
- // also for child windows: QTBUG-120685
- return null;
- }
-
- @UsedFromNativeCode
- @Override
- QtLayout getQtLayout()
+ public QtLayout getQtLayout()
{
// TODO verify if returning m_view here works, this is used by the androidjniinput
// when e.g. showing a keyboard, so depends on getting the keyboard focus working
@@ -175,4 +182,36 @@ class QtEmbeddedDelegate extends QtActivityDelegateBase
m_windowLoaded = true;
}
}
+
+ // QtMenuInterface implementation begin
+ @Override
+ public void resetOptionsMenu() { QtNative.runAction(() -> m_activity.invalidateOptionsMenu()); }
+
+ @Override
+ public void openOptionsMenu() { QtNative.runAction(() -> m_activity.openOptionsMenu()); }
+
+ @Override
+ public void closeContextMenu() { QtNative.runAction(() -> m_activity.closeContextMenu()); }
+
+ @Override
+ public void openContextMenu(final int x, final int y, final int w, final int h)
+ {
+ QtLayout layout = getQtLayout();
+ layout.postDelayed(() -> {
+ final QtEditText focusedEditText = m_inputDelegate.getCurrentQtEditText();
+ if (focusedEditText == null) {
+ Log.w(QtTAG, "No focused view when trying to open context menu");
+ return;
+ }
+ layout.setLayoutParams(focusedEditText, new QtLayout.LayoutParams(w, h, x, y), false);
+ PopupMenu popup = new PopupMenu(m_activity, focusedEditText);
+ QtNative.fillContextMenu(popup.getMenu());
+ popup.setOnMenuItemClickListener(menuItem ->
+ m_activity.onContextItemSelected(menuItem));
+ popup.setOnDismissListener(popupMenu ->
+ m_activity.onContextMenuClosed(popupMenu.getMenu()));
+ popup.show();
+ }, 100);
+ }
+ // QtMenuInterface implementation end
}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegateFactory.java b/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegateFactory.java
deleted file mode 100644
index 8cf89e5bc3..0000000000
--- a/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegateFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (C) 2024 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-
-package org.qtproject.qt.android;
-
-import android.app.Activity;
-import android.app.Application;
-import android.os.Bundle;
-
-import java.util.HashMap;
-
-class QtEmbeddedDelegateFactory {
- private static final HashMap<Activity, QtEmbeddedDelegate> m_delegates = new HashMap<>();
- private static final Object m_delegateLock = new Object();
-
- @UsedFromNativeCode
- public static QtActivityDelegateBase getActivityDelegate(Activity activity) {
- synchronized (m_delegateLock) {
- return m_delegates.get(activity);
- }
- }
-
- public static QtEmbeddedDelegate create(Activity activity) {
- synchronized (m_delegateLock) {
- if (!m_delegates.containsKey(activity))
- m_delegates.put(activity, new QtEmbeddedDelegate(activity));
-
- return m_delegates.get(activity);
- }
- }
-
- public static void remove(Activity activity) {
- synchronized (m_delegateLock) {
- m_delegates.remove(activity);
- }
- }
-}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedLoader.java b/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedLoader.java
index 0c6c4b49f0..69ecced7ff 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedLoader.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedLoader.java
@@ -48,6 +48,6 @@ class QtEmbeddedLoader extends QtLoader {
protected void finish() {
// Called when loading fails - clear the delegate to make sure we don't hold reference
// to the embedding Context
- QtEmbeddedDelegateFactory.remove((Activity)m_context.getBaseContext());
+ QtEmbeddedViewInterfaceFactory.remove((Activity)m_context.getBaseContext());
}
}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedViewInterfaceFactory.java b/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedViewInterfaceFactory.java
new file mode 100644
index 0000000000..8a5764e93f
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedViewInterfaceFactory.java
@@ -0,0 +1,34 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+package org.qtproject.qt.android;
+
+import android.content.Context;
+import android.app.Activity;
+import android.app.Service;
+
+import java.util.HashMap;
+
+class QtEmbeddedViewInterfaceFactory {
+ private static final HashMap<Context, QtEmbeddedViewInterface> m_interfaces = new HashMap<>();
+ private static final Object m_interfaceLock = new Object();
+
+ public static QtEmbeddedViewInterface create(Context context) {
+ synchronized (m_interfaceLock) {
+ if (!m_interfaces.containsKey(context)) {
+ if (context instanceof Activity)
+ m_interfaces.put(context, new QtEmbeddedDelegate((Activity)context));
+ else if (context instanceof Service)
+ m_interfaces.put(context, new QtServiceEmbeddedDelegate((Service)context));
+ }
+
+ return m_interfaces.get(context);
+ }
+ }
+
+ public static void remove(Context context) {
+ synchronized (m_interfaceLock) {
+ m_interfaces.remove(context);
+ }
+ }
+}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtInputConnection.java b/src/android/jar/src/org/qtproject/qt/android/QtInputConnection.java
index 1bfe05e7ac..b95f817d33 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtInputConnection.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtInputConnection.java
@@ -77,6 +77,10 @@ class QtInputConnection extends BaseInputConnection
Log.w(QtTAG, "HideKeyboardRunnable: The activity reference is null");
return;
}
+ if (m_qtInputConnectionListener == null) {
+ Log.w(QtTAG, "HideKeyboardRunnable: QtInputConnectionListener is null");
+ return;
+ }
Rect r = new Rect();
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(r);
@@ -109,7 +113,7 @@ class QtInputConnection extends BaseInputConnection
{
if (closing)
m_view.postDelayed(new HideKeyboardRunnable(), 100);
- else
+ else if (m_qtInputConnectionListener != null)
m_qtInputConnectionListener.onSetClosing(false);
}
@@ -297,7 +301,8 @@ class QtInputConnection extends BaseInputConnection
restartImmInput();
break;
default:
- m_qtInputConnectionListener.onSendKeyEventDefaultCase();
+ if (m_qtInputConnectionListener != null)
+ m_qtInputConnectionListener.onSendKeyEventDefaultCase();
break;
}
}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtInputDelegate.java b/src/android/jar/src/org/qtproject/qt/android/QtInputDelegate.java
index cfa273e410..bf5578285a 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtInputDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtInputDelegate.java
@@ -21,7 +21,8 @@ import android.view.inputmethod.InputMethodManager;
import org.qtproject.qt.android.QtInputConnection.QtInputConnectionListener;
/** @noinspection FieldCanBeLocal*/
-class QtInputDelegate implements QtInputConnection.QtInputConnectionListener {
+class QtInputDelegate implements QtInputConnection.QtInputConnectionListener, QtInputInterface
+{
// keyboard methods
public static native void keyDown(int key, int unicode, int modifier, boolean autoRepeat);
@@ -90,6 +91,140 @@ class QtInputDelegate implements QtInputConnection.QtInputConnectionListener {
m_imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
}
+ // QtInputInterface implementation begin
+ @Override
+ public void updateSelection(final int selStart, final int selEnd,
+ final int candidatesStart, final int candidatesEnd)
+ {
+ QtNative.runAction(() -> {
+ if (m_imm == null)
+ return;
+
+ m_imm.updateSelection(m_currentEditText, selStart, selEnd, candidatesStart, candidatesEnd);
+ });
+ }
+
+ @Override
+ public void showSoftwareKeyboard(Activity activity, QtLayout layout,
+ final int x, final int y, final int width, final int height,
+ final int inputHints, final int enterKeyType)
+ {
+ QtNative.runAction(() -> {
+ if (m_imm == null || m_currentEditText == null)
+ return;
+
+ if (updateSoftInputMode(activity, height))
+ return;
+
+ m_currentEditText.setEditTextOptions(enterKeyType, inputHints);
+
+ m_currentEditText.postDelayed(() -> {
+ m_imm.showSoftInput(m_currentEditText, 0, new ResultReceiver(new Handler()) {
+ @Override
+ protected void onReceiveResult(int resultCode, Bundle resultData) {
+ switch (resultCode) {
+ case InputMethodManager.RESULT_SHOWN:
+ QtNativeInputConnection.updateCursorPosition();
+ //FALLTHROUGH
+ case InputMethodManager.RESULT_UNCHANGED_SHOWN:
+ setKeyboardVisibility(true, System.nanoTime());
+ if (m_softInputMode == 0) {
+ probeForKeyboardHeight(layout, activity,
+ x, y, width, height, inputHints, enterKeyType);
+ }
+ break;
+ case InputMethodManager.RESULT_HIDDEN:
+ case InputMethodManager.RESULT_UNCHANGED_HIDDEN:
+ setKeyboardVisibility(false, System.nanoTime());
+ break;
+ }
+ }
+ });
+ if (m_currentEditText.m_optionsChanged) {
+ m_imm.restartInput(m_currentEditText);
+ m_currentEditText.m_optionsChanged = false;
+ }
+ }, 15);
+ });
+ }
+
+ @Override
+ public int getSelectHandleWidth()
+ {
+ int width = 0;
+ if (m_leftSelectionHandle != null && m_rightSelectionHandle != null) {
+ width = Math.max(m_leftSelectionHandle.width(), m_rightSelectionHandle.width());
+ } else if (m_cursorHandle != null) {
+ width = m_cursorHandle.width();
+ }
+ return width;
+ }
+
+ /* called from the C++ code when the position of the cursor or selection handles needs to
+ be adjusted.
+ mode is one of QAndroidInputContext::CursorHandleShowMode
+ */
+ @Override
+ public void updateHandles(Activity activity, QtLayout layout, int mode,
+ int editX, int editY, int editButtons,
+ int x1, int y1, int x2, int y2, boolean rtl)
+ {
+ QtNative.runAction(() -> updateHandleImpl(activity, layout, mode, editX, editY, editButtons,
+ x1, y1, x2, y2, rtl));
+ }
+
+ @Override
+ public QtInputConnection.QtInputConnectionListener getInputConnectionListener()
+ {
+ return this;
+ }
+
+ @Override
+ public void resetSoftwareKeyboard()
+ {
+ if (m_imm == null || m_currentEditText == null)
+ return;
+ m_currentEditText.postDelayed(() -> {
+ m_imm.restartInput(m_currentEditText);
+ m_currentEditText.m_optionsChanged = false;
+ }, 5);
+ }
+
+ @Override
+ public void hideSoftwareKeyboard()
+ {
+ m_isKeyboardHidingAnimationOngoing = true;
+ QtNative.runAction(() -> {
+ if (m_imm == null || m_currentEditText == null)
+ return;
+
+ m_imm.hideSoftInputFromWindow(m_currentEditText.getWindowToken(), 0,
+ new ResultReceiver(new Handler()) {
+ @Override
+ protected void onReceiveResult(int resultCode, Bundle resultData) {
+ switch (resultCode) {
+ case InputMethodManager.RESULT_SHOWN:
+ case InputMethodManager.RESULT_UNCHANGED_SHOWN:
+ setKeyboardVisibility(true, System.nanoTime());
+ break;
+ case InputMethodManager.RESULT_HIDDEN:
+ case InputMethodManager.RESULT_UNCHANGED_HIDDEN:
+ setKeyboardVisibility(false, System.nanoTime());
+ break;
+ }
+ }
+ });
+ });
+ }
+
+ // Is the keyboard fully visible i.e. visible and no ongoing animation
+ @Override
+ public boolean isSoftwareKeyboardVisible()
+ {
+ return isKeyboardVisible() && !m_isKeyboardHidingAnimationOngoing;
+ }
+ // QtInputInterface implementation end
+
// QtInputConnectionListener methods
@Override
public void onSetClosing(boolean closing) {
@@ -113,13 +248,6 @@ class QtInputDelegate implements QtInputConnection.QtInputConnectionListener {
return m_keyboardIsVisible;
}
- // Is the keyboard fully visible i.e. visible and no ongoing animation
- @UsedFromNativeCode
- public boolean isSoftwareKeyboardVisible()
- {
- return isKeyboardVisible() && !m_isKeyboardHidingAnimationOngoing;
- }
-
void setSoftInputMode(int inputMode)
{
m_softInputMode = inputMode;
@@ -158,65 +286,11 @@ class QtInputDelegate implements QtInputConnection.QtInputConnectionListener {
}
- @UsedFromNativeCode
- public void resetSoftwareKeyboard()
- {
- if (m_imm == null || m_currentEditText == null)
- return;
- m_currentEditText.postDelayed(() -> {
- m_imm.restartInput(m_currentEditText);
- m_currentEditText.m_optionsChanged = false;
- }, 5);
- }
-
void setFocusedView(QtEditText currentEditText)
{
m_currentEditText = currentEditText;
}
- public void showSoftwareKeyboard(Activity activity, QtLayout layout,
- final int x, final int y, final int width, final int height,
- final int inputHints, final int enterKeyType)
- {
- QtNative.runAction(() -> {
- if (m_imm == null || m_currentEditText == null)
- return;
-
- if (updateSoftInputMode(activity, height))
- return;
-
- m_currentEditText.setEditTextOptions(enterKeyType, inputHints);
-
- m_currentEditText.postDelayed(() -> {
- m_imm.showSoftInput(m_currentEditText, 0, new ResultReceiver(new Handler()) {
- @Override
- protected void onReceiveResult(int resultCode, Bundle resultData) {
- switch (resultCode) {
- case InputMethodManager.RESULT_SHOWN:
- QtNativeInputConnection.updateCursorPosition();
- //FALLTHROUGH
- case InputMethodManager.RESULT_UNCHANGED_SHOWN:
- setKeyboardVisibility(true, System.nanoTime());
- if (m_softInputMode == 0) {
- probeForKeyboardHeight(layout, activity,
- x, y, width, height, inputHints, enterKeyType);
- }
- break;
- case InputMethodManager.RESULT_HIDDEN:
- case InputMethodManager.RESULT_UNCHANGED_HIDDEN:
- setKeyboardVisibility(false, System.nanoTime());
- break;
- }
- }
- });
- if (m_currentEditText.m_optionsChanged) {
- m_imm.restartInput(m_currentEditText);
- m_currentEditText.m_optionsChanged = false;
- }
- }, 15);
- });
- }
-
private boolean updateSoftInputMode(Activity activity, int height)
{
DisplayMetrics metrics = new DisplayMetrics();
@@ -284,69 +358,6 @@ class QtInputDelegate implements QtInputConnection.QtInputConnectionListener {
}, m_probeKeyboardHeightDelayMs);
}
- public void hideSoftwareKeyboard()
- {
- m_isKeyboardHidingAnimationOngoing = true;
- QtNative.runAction(() -> {
- if (m_imm == null || m_currentEditText == null)
- return;
-
- m_imm.hideSoftInputFromWindow(m_currentEditText.getWindowToken(), 0,
- new ResultReceiver(new Handler()) {
- @Override
- protected void onReceiveResult(int resultCode, Bundle resultData) {
- switch (resultCode) {
- case InputMethodManager.RESULT_SHOWN:
- case InputMethodManager.RESULT_UNCHANGED_SHOWN:
- setKeyboardVisibility(true, System.nanoTime());
- break;
- case InputMethodManager.RESULT_HIDDEN:
- case InputMethodManager.RESULT_UNCHANGED_HIDDEN:
- setKeyboardVisibility(false, System.nanoTime());
- break;
- }
- }
- });
- });
- }
-
- @UsedFromNativeCode
- public void updateSelection(final int selStart, final int selEnd,
- final int candidatesStart, final int candidatesEnd)
- {
- QtNative.runAction(() -> {
- if (m_imm == null)
- return;
-
- m_imm.updateSelection(m_currentEditText, selStart, selEnd, candidatesStart, candidatesEnd);
- });
- }
-
- @UsedFromNativeCode
- public int getSelectHandleWidth()
- {
- int width = 0;
- if (m_leftSelectionHandle != null && m_rightSelectionHandle != null) {
- width = Math.max(m_leftSelectionHandle.width(), m_rightSelectionHandle.width());
- } else if (m_cursorHandle != null) {
- width = m_cursorHandle.width();
- }
- return width;
- }
-
- /* called from the C++ code when the position of the cursor or selection handles needs to
- be adjusted.
- mode is one of QAndroidInputContext::CursorHandleShowMode
- */
- @UsedFromNativeCode
- public void updateHandles(Activity activity, QtLayout layout, int mode,
- int editX, int editY, int editButtons,
- int x1, int y1, int x2, int y2, boolean rtl)
- {
- QtNative.runAction(() -> updateHandleImpl(activity, layout, mode, editX, editY, editButtons,
- x1, y1, x2, y2, rtl));
- }
-
private void updateHandleImpl(Activity activity, QtLayout layout, int mode,
int editX, int editY, int editButtons,
int x1, int y1, int x2, int y2, boolean rtl)
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtInputInterface.java b/src/android/jar/src/org/qtproject/qt/android/QtInputInterface.java
new file mode 100644
index 0000000000..1dc4d5fd7f
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt/android/QtInputInterface.java
@@ -0,0 +1,21 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+package org.qtproject.qt.android;
+
+import android.app.Activity;
+
+@UsedFromNativeCode
+interface QtInputInterface {
+ void updateSelection(final int selStart, final int selEnd, final int candidatesStart,
+ final int candidatesEnd);
+ void showSoftwareKeyboard(Activity activity, QtLayout layout, final int x, final int y,
+ final int width, final int height, final int inputHints,
+ final int enterKeyType);
+ void resetSoftwareKeyboard();
+ void hideSoftwareKeyboard();
+ boolean isSoftwareKeyboardVisible();
+ int getSelectHandleWidth();
+ void updateHandles(Activity activity, QtLayout layout, int mode, int editX, int editY,
+ int editButtons, int x1, int y1, int x2, int y2, boolean rtl);
+ QtInputConnection.QtInputConnectionListener getInputConnectionListener();
+}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtLayoutInterface.java b/src/android/jar/src/org/qtproject/qt/android/QtLayoutInterface.java
new file mode 100644
index 0000000000..8444266893
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt/android/QtLayoutInterface.java
@@ -0,0 +1,8 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+package org.qtproject.qt.android;
+
+@UsedFromNativeCode
+interface QtLayoutInterface {
+ QtLayout getQtLayout();
+}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtMenuInterface.java b/src/android/jar/src/org/qtproject/qt/android/QtMenuInterface.java
new file mode 100644
index 0000000000..556b9a57b9
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt/android/QtMenuInterface.java
@@ -0,0 +1,11 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+package org.qtproject.qt.android;
+
+@UsedFromNativeCode
+interface QtMenuInterface {
+ void resetOptionsMenu();
+ void openOptionsMenu();
+ void closeContextMenu();
+ void openContextMenu(final int x, final int y, final int w, final int h);
+}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtNative.java b/src/android/jar/src/org/qtproject/qt/android/QtNative.java
index b2a2887ad5..17e1386efb 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtNative.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtNative.java
@@ -30,15 +30,16 @@ import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
-class QtNative
+// ### Qt7: make private and find new API for onNewIntent()
+public class QtNative
{
private static WeakReference<Activity> m_activity = null;
private static WeakReference<Service> m_service = null;
- public static final Object m_mainActivityMutex = new Object(); // mutex used to synchronize runnable operations
+ private static final Object m_mainActivityMutex = new Object(); // mutex used to synchronize runnable operations
private static final ApplicationStateDetails m_stateDetails = new ApplicationStateDetails();
- public static final String QtTAG = "Qt JAVA";
+ static final String QtTAG = "Qt JAVA";
// a list containing all actions which could not be performed (e.g. the main activity is destroyed, etc.)
private static final ArrayList<Runnable> m_lostActions = new ArrayList<>();
@@ -51,24 +52,24 @@ class QtNative
private static final Object m_appStateListenersLock = new Object();
@UsedFromNativeCode
- public static ClassLoader classLoader()
+ static ClassLoader classLoader()
{
return m_classLoader;
}
- public static void setClassLoader(ClassLoader classLoader)
+ static void setClassLoader(ClassLoader classLoader)
{
m_classLoader = classLoader;
}
- public static void setActivity(Activity qtMainActivity)
+ static void setActivity(Activity qtMainActivity)
{
synchronized (m_mainActivityMutex) {
m_activity = new WeakReference<>(qtMainActivity);
}
}
- public static void setService(Service qtMainService)
+ static void setService(Service qtMainService)
{
synchronized (m_mainActivityMutex) {
m_service = new WeakReference<>(qtMainService);
@@ -76,40 +77,40 @@ class QtNative
}
@UsedFromNativeCode
- public static Activity activity()
+ static Activity activity()
{
synchronized (m_mainActivityMutex) {
return m_activity != null ? m_activity.get() : null;
}
}
- public static boolean isActivityValid()
+ static boolean isActivityValid()
{
return m_activity != null && m_activity.get() != null;
}
@UsedFromNativeCode
- public static Service service()
+ static Service service()
{
synchronized (m_mainActivityMutex) {
return m_service != null ? m_service.get() : null;
}
}
- public static boolean isServiceValid()
+ static boolean isServiceValid()
{
return m_service != null && m_service.get() != null;
}
@UsedFromNativeCode
- public static Context getContext() {
+ static Context getContext() {
if (isActivityValid())
return m_activity.get();
return service();
}
@UsedFromNativeCode
- public static String[] getStringArray(String joinedString)
+ static String[] getStringArray(String joinedString)
{
return joinedString.split(",");
}
@@ -162,7 +163,7 @@ class QtNative
}
@UsedFromNativeCode
- public static boolean openURL(Context context, String url, String mime)
+ static boolean openURL(Context context, String url, String mime)
{
final Uri uri = getUriWithValidPermission(context, url, "r");
if (uri == null) {
@@ -201,39 +202,39 @@ class QtNative
}
// Keep in sync with src/corelib/global/qnamespace.h
- public static class ApplicationState {
+ static class ApplicationState {
static final int ApplicationSuspended = 0x0;
static final int ApplicationHidden = 0x1;
static final int ApplicationInactive = 0x2;
static final int ApplicationActive = 0x4;
}
- public static class ApplicationStateDetails {
+ static class ApplicationStateDetails {
int state = ApplicationState.ApplicationSuspended;
boolean nativePluginIntegrationReady = false;
boolean isStarted = false;
}
- public static ApplicationStateDetails getStateDetails()
+ static ApplicationStateDetails getStateDetails()
{
return m_stateDetails;
}
- public static void setStarted(boolean started)
+ static void setStarted(boolean started)
{
m_stateDetails.isStarted = started;
notifyAppStateDetailsChanged(m_stateDetails);
}
@UsedFromNativeCode
- public static void notifyNativePluginIntegrationReady(boolean ready)
+ static void notifyNativePluginIntegrationReady(boolean ready)
{
m_stateDetails.nativePluginIntegrationReady = ready;
notifyNativePluginIntegrationReadyChanged(ready);
notifyAppStateDetailsChanged(m_stateDetails);
}
- public static void setApplicationState(int state)
+ static void setApplicationState(int state)
{
synchronized (m_mainActivityMutex) {
m_stateDetails.state = state;
@@ -276,12 +277,12 @@ class QtNative
// Post a runnable to Main (UI) Thread if the app is active,
// otherwise, queue it to be posted when the the app is active again
- public static void runAction(Runnable action)
+ static void runAction(Runnable action)
{
runAction(action, true);
}
- public static void runAction(Runnable action, boolean queueWhenInactive)
+ static void runAction(Runnable action, boolean queueWhenInactive)
{
synchronized (m_mainActivityMutex) {
final Looper mainLooper = Looper.getMainLooper();
@@ -328,7 +329,7 @@ class QtNative
runAction(() -> view.setVisibility(visible ? View.VISIBLE : View.GONE));
}
- public static void startApplication(String params, String mainLib)
+ static void startApplication(String params, String mainLib)
{
synchronized (m_mainActivityMutex) {
m_qtThread.run(() -> {
@@ -343,7 +344,7 @@ class QtNative
}
}
- public static void quitApp()
+ static void quitApp()
{
runAction(() -> {
quitQtAndroidPlugin();
@@ -357,7 +358,7 @@ class QtNative
}
@UsedFromNativeCode
- public static int checkSelfPermission(String permission)
+ static int checkSelfPermission(String permission)
{
synchronized (m_mainActivityMutex) {
Context context = getContext();
@@ -419,47 +420,43 @@ class QtNative
}
// application methods
- public static native boolean startQtAndroidPlugin(String params);
- public static native void startQtApplication();
- public static native void waitForServiceSetup();
- public static native void quitQtCoreApplication();
- public static native void quitQtAndroidPlugin();
- public static native void terminateQt();
- public static native boolean updateNativeActivity();
+ static native boolean startQtAndroidPlugin(String params);
+ static native void startQtApplication();
+ static native void waitForServiceSetup();
+ static native void quitQtCoreApplication();
+ static native void quitQtAndroidPlugin();
+ static native void terminateQt();
+ static native boolean updateNativeActivity();
// application methods
- // surface methods
- public static native void setSurface(int id, Object surface);
- // surface methods
-
// window methods
- public static native void updateWindow();
+ static native void updateWindow();
// window methods
// application methods
- public static native void updateApplicationState(int state);
+ static native void updateApplicationState(int state);
// menu methods
- public static native boolean onPrepareOptionsMenu(Menu menu);
- public static native boolean onOptionsItemSelected(int itemId, boolean checked);
- public static native void onOptionsMenuClosed(Menu menu);
-
- public static native void onCreateContextMenu(ContextMenu menu);
- public static native void fillContextMenu(Menu menu);
- public static native boolean onContextItemSelected(int itemId, boolean checked);
- public static native void onContextMenuClosed(Menu menu);
+ static native boolean onPrepareOptionsMenu(Menu menu);
+ static native boolean onOptionsItemSelected(int itemId, boolean checked);
+ static native void onOptionsMenuClosed(Menu menu);
+
+ static native void onCreateContextMenu(ContextMenu menu);
+ static native void fillContextMenu(Menu menu);
+ static native boolean onContextItemSelected(int itemId, boolean checked);
+ static native void onContextMenuClosed(Menu menu);
// menu methods
// activity methods
- public static native void onActivityResult(int requestCode, int resultCode, Intent data);
+ static native void onActivityResult(int requestCode, int resultCode, Intent data);
public static native void onNewIntent(Intent data);
- public static native void runPendingCppRunnables();
+ static native void runPendingCppRunnables();
- public static native void sendRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults);
+ static native void sendRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults);
// activity methods
// service methods
- public static native IBinder onBind(Intent intent);
+ static native IBinder onBind(Intent intent);
// service methods
}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtRootLayout.java b/src/android/jar/src/org/qtproject/qt/android/QtRootLayout.java
index 3dae587a71..71f34bee24 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtRootLayout.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtRootLayout.java
@@ -16,11 +16,8 @@ import android.view.Surface;
A layout which corresponds to one Activity, i.e. is the root layout where the top level window
and handles orientation changes.
*/
-public class QtRootLayout extends QtLayout
+class QtRootLayout extends QtLayout
{
- private int m_activityDisplayRotation = -1;
- private int m_ownDisplayRotation = -1;
- private int m_nativeOrientation = -1;
private int m_previousRotation = -1;
public QtRootLayout(Context context)
@@ -28,21 +25,6 @@ public class QtRootLayout extends QtLayout
super(context);
}
- public void setActivityDisplayRotation(int rotation)
- {
- m_activityDisplayRotation = rotation;
- }
-
- public void setNativeOrientation(int orientation)
- {
- m_nativeOrientation = orientation;
- }
-
- public int displayRotation()
- {
- return m_ownDisplayRotation;
- }
-
@Override
protected void onSizeChanged (int w, int h, int oldw, int oldh)
{
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtServiceEmbeddedDelegate.java b/src/android/jar/src/org/qtproject/qt/android/QtServiceEmbeddedDelegate.java
index 29f1d1790f..d8af626ca0 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtServiceEmbeddedDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtServiceEmbeddedDelegate.java
@@ -28,13 +28,8 @@ class QtServiceEmbeddedDelegate implements QtEmbeddedViewInterface, QtNative.App
m_service = service;
QtNative.registerAppStateListener(this);
QtNative.setService(service);
- }
-
- @UsedFromNativeCode
- QtInputDelegate getInputDelegate()
- {
- // TODO Implement text input (QTBUG-122552)
- return null;
+ // QTBUG-122920 TODO Implement accessibility for service UIs
+ // QTBUG-122552 TODO Implement text input
}
@Override
@@ -107,6 +102,7 @@ class QtServiceEmbeddedDelegate implements QtEmbeddedViewInterface, QtNative.App
{
QtNative.setApplicationState(ApplicationSuspended);
QtNative.unregisterAppStateListener(QtServiceEmbeddedDelegate.this);
+ QtEmbeddedViewInterfaceFactory.remove(m_service);
QtNative.terminateQt();
QtNative.setService(null);
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt/android/QtSurface.java
index 3165de4811..e20974eeac 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtSurface.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtSurface.java
@@ -14,7 +14,7 @@ import android.view.SurfaceView;
@SuppressLint("ViewConstructor")
class QtSurface extends SurfaceView implements SurfaceHolder.Callback
{
- private QtSurfaceInterface m_surfaceCallback;
+ private final QtSurfaceInterface m_surfaceCallback;
public QtSurface(Context context, QtSurfaceInterface surfaceCallback, boolean onTop, int imageDepth)
{
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtSurfaceInterface.java b/src/android/jar/src/org/qtproject/qt/android/QtSurfaceInterface.java
index 8df442f730..5850f2e3a1 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtSurfaceInterface.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtSurfaceInterface.java
@@ -6,8 +6,7 @@ package org.qtproject.qt.android;
import android.view.Surface;
-
-public interface QtSurfaceInterface
+interface QtSurfaceInterface
{
void onSurfaceChanged(Surface surface);
}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtTextureView.java b/src/android/jar/src/org/qtproject/qt/android/QtTextureView.java
index 828838a9f0..95370f3e4b 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtTextureView.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtTextureView.java
@@ -5,15 +5,14 @@
package org.qtproject.qt.android;
import android.content.Context;
-import android.graphics.PixelFormat;
import android.graphics.SurfaceTexture;
import android.util.Log;
import android.view.Surface;
import android.view.TextureView;
-public class QtTextureView extends TextureView implements TextureView.SurfaceTextureListener
+class QtTextureView extends TextureView implements TextureView.SurfaceTextureListener
{
- private QtSurfaceInterface m_surfaceCallback;
+ private final QtSurfaceInterface m_surfaceCallback;
private boolean m_staysOnTop;
private Surface m_surface;
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtView.java b/src/android/jar/src/org/qtproject/qt/android/QtView.java
index ddf70b3b5b..b4fa0382ed 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtView.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtView.java
@@ -44,24 +44,15 @@ abstract class QtView extends ViewGroup {
private static native void resizeWindow(long windowReference,
int x, int y, int width, int height);
- /**
- * Create QtView for embedding a QWindow. Instantiating a QtView will load the Qt libraries
- * if they have not already been loaded, including the app library specified by appName, and
- * starting the said Qt app.
- * @param context the hosting Context
- * @param appLibName the name of the Qt app library to load and start. This corresponds to the
- target name set in Qt app's CMakeLists.txt
- **/
- public QtView(Context context, String appLibName) throws InvalidParameterException {
+ /**
+ * Create a QtView for embedding a QWindow without loading the Qt libraries or starting
+ * the Qt app.
+ * @param context the hosting Context
+ **/
+ public QtView(Context context) {
super(context);
- if (appLibName == null || appLibName.isEmpty()) {
- throw new InvalidParameterException("QtView: argument 'appLibName' may not be empty "+
- "or null");
- }
- QtEmbeddedLoader loader = new QtEmbeddedLoader(context);
- m_viewInterface = QtEmbeddedDelegateFactory.create((Activity)context);
- loader.setMainLibraryName(appLibName);
+ m_viewInterface = QtEmbeddedViewInterfaceFactory.create(context);
addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
@@ -78,10 +69,22 @@ abstract class QtView extends ViewGroup {
}
}
});
- loader.loadQtLibraries();
- // Start Native Qt application
- m_viewInterface.startQtApplication(loader.getApplicationParameters(),
- loader.getMainLibraryPath());
+ }
+ /**
+ * Create a QtView for embedding a QWindow, and load the Qt libraries if they have not already
+ * been loaded, including the app library specified by appName, and starting the said Qt app.
+ * @param context the hosting Context
+ * @param appLibName the name of the Qt app library to load and start. This corresponds to the
+ target name set in Qt app's CMakeLists.txt
+ **/
+ public QtView(Context context, String appLibName) throws InvalidParameterException {
+ this(context);
+ if (appLibName == null || appLibName.isEmpty()) {
+ throw new InvalidParameterException("QtView: argument 'appLibName' may not be empty "+
+ "or null");
+ }
+
+ loadQtLibraries(appLibName);
}
@Override
@@ -139,6 +142,15 @@ abstract class QtView extends ViewGroup {
m_windowListener = listener;
}
+ void loadQtLibraries(String appLibName) {
+ QtEmbeddedLoader loader = new QtEmbeddedLoader(getContext());
+ loader.setMainLibraryName(appLibName);
+ loader.loadQtLibraries();
+ // Start Native Qt application
+ m_viewInterface.startQtApplication(loader.getApplicationParameters(),
+ loader.getMainLibraryPath());
+ }
+
void setWindowReference(long windowReference) {
m_windowReference = windowReference;
}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtWindow.java b/src/android/jar/src/org/qtproject/qt/android/QtWindow.java
index d72e69d32a..2a9daa5d02 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtWindow.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtWindow.java
@@ -6,7 +6,6 @@ package org.qtproject.qt.android;
import android.content.Context;
import android.view.GestureDetector;
import android.view.MotionEvent;
-import android.util.Log;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
@@ -14,11 +13,9 @@ import android.view.ViewGroup;
import java.util.HashMap;
class QtWindow extends QtLayout implements QtSurfaceInterface {
- private final static String TAG = "QtWindow";
-
private View m_surfaceContainer;
private View m_nativeView;
- private HashMap<Integer, QtWindow> m_childWindows = new HashMap<Integer, QtWindow>();
+ private final HashMap<Integer, QtWindow> m_childWindows = new HashMap<>();
private QtWindow m_parentWindow;
private GestureDetector m_gestureDetector;
private final QtEditText m_editText;
@@ -26,11 +23,12 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
private static native void setSurface(int windowId, Surface surface);
static native void windowFocusChanged(boolean hasFocus, int id);
- public QtWindow(Context context, QtWindow parentWindow, QtInputDelegate delegate)
+ public QtWindow(Context context, QtWindow parentWindow,
+ QtInputConnection.QtInputConnectionListener listener)
{
super(context);
setId(View.generateViewId());
- m_editText = new QtEditText(context, delegate);
+ m_editText = new QtEditText(context, listener);
setParent(parentWindow);
setFocusableInTouchMode(true);
addView(m_editText, new QtLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
@@ -39,6 +37,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
QtNative.runAction(() -> {
m_gestureDetector =
new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
+ @Override
public void onLongPress(MotionEvent event) {
QtInputDelegate.longPress(getId(), (int) event.getX(), (int) event.getY());
}
@@ -47,6 +46,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
});
}
+ @UsedFromNativeCode
void setVisible(boolean visible) {
QtNative.runAction(() -> {
if (visible)
@@ -85,12 +85,14 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
return QtInputDelegate.sendGenericMotionEvent(event, getId());
}
+ @UsedFromNativeCode
public void removeWindow()
{
if (m_parentWindow != null)
m_parentWindow.removeChildWindow(getId());
}
+ @UsedFromNativeCode
public void createSurface(final boolean onTop,
final int x, final int y, final int w, final int h,
final int imageDepth, final boolean isOpaque,
@@ -116,6 +118,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
});
}
+ @UsedFromNativeCode
public void destroySurface()
{
QtNative.runAction(()-> {
@@ -126,6 +129,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
}, false);
}
+ @UsedFromNativeCode
public void setGeometry(final int x, final int y, final int w, final int h)
{
QtNative.runAction(()-> {
@@ -150,6 +154,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
});
}
+ @UsedFromNativeCode
public void setNativeView(final View view,
final int x, final int y, final int w, final int h)
{
@@ -165,6 +170,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
});
}
+ @UsedFromNativeCode
public void bringChildToFront(int id)
{
QtNative.runAction(()-> {
@@ -176,6 +182,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
});
}
+ @UsedFromNativeCode
public void bringChildToBack(int id) {
QtNative.runAction(()-> {
View view = m_childWindows.get(id);
@@ -185,6 +192,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
});
}
+ @UsedFromNativeCode
public void removeNativeView()
{
QtNative.runAction(()-> {
@@ -207,9 +215,4 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
if (m_parentWindow != null)
m_parentWindow.addChildWindow(this);
}
-
- QtWindow parent()
- {
- return m_parentWindow;
- }
}
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtWindowInterface.java b/src/android/jar/src/org/qtproject/qt/android/QtWindowInterface.java
new file mode 100644
index 0000000000..1fb312786f
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt/android/QtWindowInterface.java
@@ -0,0 +1,11 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+package org.qtproject.qt.android;
+@UsedFromNativeCode
+interface QtWindowInterface {
+ default void addTopLevelWindow(final QtWindow window) { }
+ default void removeTopLevelWindow(final int id) { }
+ default void bringChildToFront(final int id) { }
+ default void bringChildToBack(int id) { }
+ default void setSystemUiVisibility(int systemUiVisibility) { }
+}
diff --git a/src/android/templates/build.gradle b/src/android/templates/build.gradle
index f94ffbde54..4a93923277 100644
--- a/src/android/templates/build.gradle
+++ b/src/android/templates/build.gradle
@@ -5,7 +5,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.4.1'
+ classpath 'com.android.tools.build:gradle:8.4.0'
}
}
@@ -14,11 +14,11 @@ repositories {
mavenCentral()
}
-apply plugin: 'com.android.application'
+apply plugin: qtGradlePluginType
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
- implementation 'androidx.core:core:1.10.1'
+ implementation 'androidx.core:core:1.13.1'
}
android {
@@ -29,12 +29,14 @@ android {
* - qtAndroidDir - holds the path to qt android files
* needed to build any Qt application
* on Android.
+ * - qtGradlePluginType - whether to build an app or a library
*
* are defined in gradle.properties file. This file is
* updated by QtCreator and androiddeployqt tools.
* Changing them manually might break the compilation!
*******************************************************/
+ namespace androidPackageName
compileSdkVersion androidCompileSdkVersion
buildToolsVersion androidBuildToolsVersion
ndkVersion androidNdkVersion
diff --git a/src/android/templates/doc/src/android-manifest-file-configuration.qdoc b/src/android/templates/doc/src/android-manifest-file-configuration.qdoc
index db0d3c7277..d32d16aa47 100644
--- a/src/android/templates/doc/src/android-manifest-file-configuration.qdoc
+++ b/src/android/templates/doc/src/android-manifest-file-configuration.qdoc
@@ -50,8 +50,10 @@ Qt sets the following manifest configuration by default:
\li {1, 5} \l {Android: App Manifest <manifest>}{<manifest>}
\li package
\li Sets the package name. The default value is \c {org.qtproject.example.app_name}.
+ \warning This field is deprecated and moved to \c build.gradle. It will be removed
+ in an upcoming release.
\row
- \li \c {android:installLocation}
+ \li android:installLocation
\li Sets the app's installation location, whether internal or external storage.
The default value is \c auto.
\row
@@ -63,7 +65,7 @@ Qt sets the following manifest configuration by default:
\li Sets the public version name. Populated from \c ANDROID_VERSION_NAME (qmake)
and \c QT_ANDROID_VERSION_NAME (CMake). The default value is \c {1.0}.
\row
- \li \c {<supports-screens>}
+ \li <supports-screens>
\li Sets the screen sizes that the app supports,
default values are \c anyDensity, \c largeScreens,
\c normalScreens, and \c smallScreens.
diff --git a/src/android/templates_aar/AndroidManifest.xml b/src/android/templates_aar/AndroidManifest.xml
new file mode 100644
index 0000000000..9c9e91e650
--- /dev/null
+++ b/src/android/templates_aar/AndroidManifest.xml
@@ -0,0 +1,9 @@
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="org.qtproject.example"
+ android:versionCode="-- %%INSERT_VERSION_CODE%% --"
+ android:versionName="-- %%INSERT_VERSION_NAME%% --">
+ <!-- %%INSERT_PERMISSIONS -->
+ <!-- %%INSERT_FEATURES -->
+</manifest>
diff --git a/src/android/templates_aar/CMakeLists.txt b/src/android/templates_aar/CMakeLists.txt
new file mode 100644
index 0000000000..07c421fbab
--- /dev/null
+++ b/src/android/templates_aar/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Android aar specific template files
+
+set(templates_aar_files
+ "${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml")
+
+add_custom_target(Qt${QtBase_VERSION_MAJOR}AndroidAarTemplates
+ SOURCES
+ ${templates_aar_files}
+)
+
+qt_path_join(destination ${QT_INSTALL_DIR} ${INSTALL_DATADIR} "src/android/templates_aar")
+
+qt_copy_or_install(FILES ${templates_aar_files}
+ DESTINATION "${destination}")
+
+if(NOT QT_WILL_INSTALL)
+ qt_internal_copy_at_build_time(TARGET Qt${QtBase_VERSION_MAJOR}AndroidAarTemplates
+ FILES ${templates_aar_files}
+ DESTINATION ${destination}
+ )
+endif()
diff --git a/src/assets/CMakeLists.txt b/src/assets/CMakeLists.txt
index 9357953132..2ab060b022 100644
--- a/src/assets/CMakeLists.txt
+++ b/src/assets/CMakeLists.txt
@@ -1 +1,3 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(icons)
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index e1fb0d7e39..1055cf4ab5 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -456,7 +456,7 @@ endif()
set(core_version_tagging_files
global/qversiontagging.cpp)
qt_internal_extend_target(Core
- CONDITION TEST_ld_version_script OR APPLE OR WIN32
+ CONDITION QT_FEATURE_version_tagging
SOURCES ${core_version_tagging_files}
)
@@ -897,7 +897,7 @@ qt_internal_extend_target(Core CONDITION QT_FEATURE_timezone AND UNIX AND NOT AN
qt_internal_extend_target(Core
CONDITION
- QT_FEATURE_icu AND QT_FEATURE_timezone AND NOT ANDROID AND NOT APPLE
+ QT_FEATURE_icu AND QT_FEATURE_timezone AND NOT UNIX
SOURCES
time/qtimezoneprivate_icu.cpp
)
@@ -1484,3 +1484,39 @@ qt_internal_extend_target(Core
# QReadWriteLock::destroyRecursive(QReadWriteLockPrivate*)
"_ZN*14QReadWriteLock16destroyRecursiveEP*21QReadWriteLockPrivate*"
)
+
+function(qt_internal_library_deprecation_level)
+ # QT_DISABLE_DEPRECATED_UP_TO controls which version we use as a cut-off
+ # compiling in to the library. E.g. if it is set to QT_VERSION then no
+ # code which was deprecated before QT_VERSION will be compiled in.
+ if(NOT DEFINED QT_DISABLE_DEPRECATED_UP_TO)
+ if(WIN32)
+ # On Windows, due to the way DLLs work, we need to export all functions,
+ # including the inlines
+ set(QT_DISABLE_DEPRECATED_UP_TO "0x040800")
+ else()
+ # On other platforms, Qt's own compilation does need to compile the Qt 5.0 API
+ set(QT_DISABLE_DEPRECATED_UP_TO "0x050000")
+ endif()
+ elseif(NOT QT_DISABLE_DEPRECATED_UP_TO MATCHES "^0x[0-9][0-9][0-9][0-9][0-9][0-9]$")
+ message(FATAL_ERROR "Ivalid format of the QT_DISABLE_DEPRECATED_UP_TO macro:"
+ " ${QT_DISABLE_DEPRECATED_UP_TO}. The expected format is the hexadecimal number,"
+ " e.g. 0x060102")
+ endif()
+ # QT_WARN_DEPRECATED_UP_TO controls the upper-bound of deprecation
+ # warnings that are emitted. E.g. if it is set to 0x060500 then all use of
+ # things deprecated in or before 6.5.0 will be warned against.
+ set(QT_WARN_DEPRECATED_UP_TO 0x070000)
+
+ set(output_header "${CMAKE_CURRENT_BINARY_DIR}/global/qtdeprecationdefinitions.h")
+ configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/global/qtdeprecationdefinitions.h.in"
+ "${output_header}"
+ @ONLY
+ NEWLINE_STYLE UNIX
+ )
+
+ target_sources(Core PRIVATE "${output_header}")
+ set_source_files_properties("${output_header}" PROPERTIES GENERATED TRUE)
+endfunction()
+qt_internal_library_deprecation_level()
diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake
index 6218df1947..a78a5a1af6 100644
--- a/src/corelib/Qt6AndroidMacros.cmake
+++ b/src/corelib/Qt6AndroidMacros.cmake
@@ -217,6 +217,10 @@ function(qt6_android_generate_deployment_settings target)
${target} "_qt_android_native_package_source_dir")
# version code
+ _qt_internal_add_android_deployment_property(file_contents "android-package-name"
+ ${target} "QT_ANDROID_PACKAGE_NAME")
+
+ # version code
_qt_internal_add_android_deployment_property(file_contents "android-version-code"
${target} "QT_ANDROID_VERSION_CODE")
@@ -296,6 +300,13 @@ function(qt6_android_generate_deployment_settings target)
string(APPEND file_contents
" \"zstdCompression\": ${is_zstd_enabled},\n")
+ if(QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS)
+ set(is_generate_java_qml_components "true")
+ else()
+ set(is_generate_java_qml_components "false")
+ endif()
+ string(APPEND file_contents
+ " \"generate-java-qml-components\": ${is_generate_java_qml_components},\n")
# Last item in json file
# base location of stdlibc++, will be suffixed by androiddeploy qt
@@ -381,6 +392,9 @@ function(qt6_android_add_apk_target target)
if(TARGET aab)
add_dependencies(aab ${target}_make_aab)
endif()
+ if(TARGET aar)
+ add_dependencies(aar ${target}_make_aar)
+ endif()
if(TARGET apk)
add_dependencies(apk ${target}_make_apk)
_qt_internal_create_global_apk_all_target_if_needed()
@@ -418,8 +432,10 @@ function(qt6_android_add_apk_target target)
endif()
set(apk_file_name "${target}.apk")
+ set(aar_file_name "${target}.aar")
set(dep_file_name "${target}.d")
set(apk_final_file_path "${apk_final_dir}/${apk_file_name}")
+ set(aar_final_file_path "${apk_final_dir}/${aar_file_name}")
set(dep_file_path "${apk_final_dir}/${dep_file_name}")
set(target_file_copy_relative_path
"libs/${CMAKE_ANDROID_ARCH_ABI}/$<TARGET_FILE_NAME:${target}>")
@@ -523,10 +539,33 @@ function(qt6_android_add_apk_target target)
VERBATIM
${uses_terminal}
)
+
+ # Add custom command that creates the aar and triggers rebuild if files listed in
+ # ${dep_file_path} are changed.
+ add_custom_command(OUTPUT "${aar_final_file_path}"
+ COMMAND ${CMAKE_COMMAND}
+ -E copy "$<TARGET_FILE:${target}>"
+ "${apk_final_dir}/${target_file_copy_relative_path}"
+ COMMAND "${deployment_tool}"
+ --input "${deployment_file}"
+ --output "${apk_final_dir}"
+ --apk "${aar_final_file_path}"
+ --depfile "${dep_file_path}"
+ --builddir "${relative_to_dir}"
+ --build-aar
+ ${extra_args}
+ COMMENT "Creating AAR for ${target}"
+ DEPENDS "${target}" "${deployment_file}" ${extra_deps}
+ DEPFILE "${dep_file_path}"
+ VERBATIM
+ ${uses_terminal}
+ )
cmake_policy(POP)
# Create a ${target}_make_apk target to trigger the apk build.
add_custom_target(${target}_make_apk DEPENDS "${apk_final_file_path}")
+ # Create a ${target}_make_aar target to trigger the aar build.
+ add_custom_target(${target}_make_aar DEPENDS "${aar_final_file_path}")
else()
add_custom_target(${target}_make_apk
DEPENDS ${target}_prepare_apk_dir
@@ -540,6 +579,19 @@ function(qt6_android_add_apk_target target)
VERBATIM
${uses_terminal}
)
+
+ add_custom_target(${target}_make_aar
+ DEPENDS ${target}_prepare_apk_dir
+ COMMAND ${deployment_tool}
+ --input ${deployment_file}
+ --output ${apk_final_dir}
+ --apk ${aar_final_file_path}
+ --build-aar
+ ${extra_args}
+ COMMENT "Creating AAR for ${target}"
+ VERBATIM
+ ${uses_terminal}
+ )
endif()
# Add target triggering AAB creation. Since the _make_aab target is not added to the ALL
@@ -638,6 +690,11 @@ function(_qt_internal_create_global_android_targets)
# It will trigger building all the apk build targets that are added as part of the project.
# Allow opting out.
_qt_internal_create_global_android_targets_impl(aab)
+
+ # Create a top-level "aar" target for convenience, so that users can call 'ninja aar'.
+ # It will trigger building all the aar build targets that are added as part of the project.
+ # Allow opting out.
+ _qt_internal_create_global_android_targets_impl(aar)
endfunction()
# The function collects all known non-imported shared libraries that are created in the build tree.
diff --git a/src/corelib/Qt6CoreConfigExtras.cmake.in b/src/corelib/Qt6CoreConfigExtras.cmake.in
index 7fd929e59b..b7ac0925af 100644
--- a/src/corelib/Qt6CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt6CoreConfigExtras.cmake.in
@@ -1,3 +1,5 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
if(NOT DEFINED QT_DEFAULT_MAJOR_VERSION)
set(QT_DEFAULT_MAJOR_VERSION 6)
endif()
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index 9e71b4265a..1a449b4aa3 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -3155,13 +3155,17 @@ endfunction()
# Write deployment information for the targets of the project.
function(_qt_internal_write_target_deploy_info out_file)
set(targets "")
+ set(dynamic_target_types EXECUTABLE SHARED_LIBRARY MODULE_LIBRARY)
_qt_internal_collect_buildsystem_targets(targets
- "${CMAKE_SOURCE_DIR}" INCLUDE EXECUTABLE SHARED_LIBRARY MODULE_LIBRARY)
+ "${CMAKE_SOURCE_DIR}" INCLUDE ${dynamic_target_types} STATIC_LIBRARY)
set(content "")
foreach(target IN LISTS targets)
set(var_prefix "__QT_DEPLOY_TARGET_${target}")
string(APPEND content "set(${var_prefix}_FILE $<TARGET_FILE:${target}>)\n")
- if(WIN32 AND CMAKE_VERSION GREATER_EQUAL "3.21")
+ get_target_property(target_type ${target} TYPE)
+ string(APPEND content "set(${var_prefix}_TYPE ${target_type})\n")
+ if(WIN32 AND CMAKE_VERSION GREATER_EQUAL "3.21"
+ AND target_type IN_LIST dynamic_target_types)
string(APPEND content
"set(${var_prefix}_RUNTIME_DLLS $<TARGET_RUNTIME_DLLS:${target}>)\n")
endif()
diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp
index 23679bf4cc..40ef9875b0 100644
--- a/src/corelib/compat/removed_api.cpp
+++ b/src/corelib/compat/removed_api.cpp
@@ -928,10 +928,41 @@ QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode)
#endif // QT_CORE_REMOVED_SINCE(6, 7)
#if QT_CORE_REMOVED_SINCE(6, 8)
+#include "qabstractitemmodel.h"
+
+bool QPersistentModelIndex::operator<(const QPersistentModelIndex &other) const noexcept
+{
+ return is_lt(compareThreeWay(*this, other));
+}
+
+bool QPersistentModelIndex::operator==(const QPersistentModelIndex &other) const noexcept
+{
+ return comparesEqual(*this, other);
+}
+
+bool QPersistentModelIndex::operator==(const QModelIndex &other) const noexcept
+{
+ return comparesEqual(*this, other);
+}
+
+bool QPersistentModelIndex::operator!=(const QModelIndex &other) const noexcept
+{
+ return !comparesEqual(*this, other);
+}
+
#include "qbitarray.h" // inlined API
#include "qbytearray.h" // inlined API
+QT_BEGIN_NAMESPACE
+namespace QtPrivate {
+Q_CORE_EXPORT qsizetype lastIndexOf(QByteArrayView haystack, qsizetype from, char needle) noexcept
+{
+ return lastIndexOf(haystack, from, uchar(needle));
+}
+}
+QT_END_NAMESPACE
+
#include "qcborarray.h" // inlined API
#include "qcbormap.h" // inlined API
@@ -952,6 +983,15 @@ bool QDir::operator==(const QDir &dir) const
return comparesEqual(*this, dir);
}
+#if QT_CONFIG(easingcurve)
+#include "qeasingcurve.h"
+
+bool QEasingCurve::operator==(const QEasingCurve &other) const
+{
+ return comparesEqual(*this, other);
+}
+#endif // QT_CONFIG(easingcurve)
+
#include "qfileinfo.h" // inlined API
bool QFileInfo::operator==(const QFileInfo &fileinfo) const
@@ -959,7 +999,9 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) const
return comparesEqual(*this, fileinfo);
}
+#if QT_CONFIG(itemmodel)
#include "qitemselectionmodel.h" // inlined API
+#endif // itemmodel
#include "qjsonarray.h"
@@ -1005,12 +1047,16 @@ bool QJsonValue::operator!=(const QJsonValue &other) const
return !comparesEqual(*this, other);
}
+#include "qline.h" // inlined API
+
+#if QT_CONFIG(mimetype)
#include "qmimetype.h"
bool QMimeType::operator==(const QMimeType &other) const
{
return comparesEqual(*this, other);
}
+#endif // QT_CONFIG(mimetype)
#include "qobject.h"
#include "qnumeric.h"
@@ -1069,10 +1115,33 @@ qsizetype QRegularExpressionMatch::capturedEnd(QStringView name) const
{
return capturedEnd(QAnyStringView(name));
}
+
+bool QRegularExpression::operator==(const QRegularExpression &other) const
+{
+ return comparesEqual(*this, other);
+}
#endif // QT_CONFIG(regularexpression)
+#if QT_CONFIG(future)
+#include "qresultstore.h"
+
+bool QtPrivate::ResultIteratorBase::operator==(const QtPrivate::ResultIteratorBase &other) const
+{
+ return comparesEqual(*this, other);
+}
+
+bool QtPrivate::ResultIteratorBase::operator!=(const QtPrivate::ResultIteratorBase &other) const
+{
+ return !comparesEqual(*this, other);
+}
+#endif // QT_CONFIG(future)
+
#include "qstring.h" // inlined API
+#if QT_CONFIG(thread)
+# include "qthreadpool.h" // inlined API
+#endif
+
#include "qurl.h"
bool QUrl::operator<(const QUrl &url) const
@@ -1097,7 +1166,31 @@ bool QUrlQuery::operator==(const QUrlQuery &other) const
return comparesEqual(*this, other);
}
+#include "quuid.h"
+
+bool QUuid::operator<(const QUuid &other) const noexcept
+{
+ return is_lt(compareThreeWay(*this, other));
+}
+
+bool QUuid::operator>(const QUuid &other) const noexcept
+{
+ return is_gt(compareThreeWay(*this, other));
+}
+
+QUuid QUuid::createUuidV3(const QUuid &ns, const QByteArray &baseData) noexcept
+{
+ return createUuidV3(ns, qToByteArrayViewIgnoringNull(baseData));
+}
+
+QUuid QUuid::createUuidV5(const QUuid &ns, const QByteArray &baseData) noexcept
+{
+ return createUuidV5(ns, qToByteArrayViewIgnoringNull(baseData));
+}
+
+#if QT_CONFIG(xmlstream)
#include "qxmlstream.h" // inlined API
+#endif // QT_CONFIG(xmlstream)
// #include "qotherheader.h"
// // implement removed functions from qotherheader.h
diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake
index 80e6d93193..b34086c8ad 100644
--- a/src/corelib/configure.cmake
+++ b/src/corelib/configure.cmake
@@ -324,6 +324,37 @@ linkat(AT_FDCWD, \"foo\", AT_FDCWD, \"bar\", AT_SYMLINK_FOLLOW);
}
")
+# memmem
+qt_config_compile_test(memmem
+ LABEL "memmem()"
+ CODE
+#define _APPLE_SAUCE 1 /* Apple doesn't require anything */
+"#define _BSD_SOURCE 1 /* For FreeBSD */
+#define _GNU_SOURCE 1 /* For glibc, Bionic */
+#include <string.h>
+
+int main(void)
+{
+ const void *r = memmem(\"abc\", 3, \"bc\", 2);
+ (void)r;
+ return 0;
+}")
+
+# memrchr
+qt_config_compile_test(memrchr
+ LABEL "memrchr()"
+ CODE
+"#define _BSD_SOURCE 1 /* For FreeBSD */
+#define _GNU_SOURCE 1 /* For glibc, Bionic */
+#include <string.h>
+
+int main(void)
+{
+ const void *r = memrchr(\"abc\", 'a', 3);
+ (void)r;
+ return 0;
+}")
+
# ppoll
qt_config_compile_test(ppoll
LABEL "ppoll()"
@@ -430,6 +461,34 @@ const auto backtrace = std::stacktrace::current();
CXX_STANDARD 23
)
+# <future>
+qt_config_compile_test(cxx_std_async_noncopyable
+ LABEL "std::async() NonCopyable"
+ CODE
+"// Calling std::async with lambda which takes non-copyable argument causes compilation error on
+// some platforms (VxWorks 24.03 and older with C++17-compatibility for example)
+#include <future>
+
+class NonCopyable {
+public:
+ NonCopyable(const NonCopyable&) = delete;
+ NonCopyable(NonCopyable&&) = default;
+
+ NonCopyable(int value)
+ :value (value)
+ {}
+
+ int value;
+};
+
+int main(int argc, char** argv) {
+ return std::async(
+ std::launch::deferred,
+ [](NonCopyable value) { return value.value; },
+ NonCopyable(argc - 1)).get();
+}
+")
+
#### Features
qt_feature("clock-gettime" PRIVATE
@@ -458,7 +517,7 @@ qt_feature("system-doubleconversion" PRIVATE
)
qt_feature("cxx11_future" PUBLIC
LABEL "C++11 <future>"
- CONDITION NOT VXWORKS
+ CONDITION TEST_cxx_std_async_noncopyable
)
qt_feature("cxx17_filesystem" PUBLIC
LABEL "C++17 <filesystem>"
@@ -526,6 +585,14 @@ qt_feature("std-atomic64" PUBLIC
LABEL "64 bit atomic operations"
CONDITION WrapAtomic_FOUND
)
+qt_feature("memmem" PRIVATE
+ LABEL "C library function memmem()"
+ CONDITION TEST_memmem
+)
+qt_feature("memrchr" PRIVATE
+ LABEL "C library function memrchr()"
+ CONDITION TEST_memrchr
+)
qt_feature("mimetype" PUBLIC
SECTION "Utilities"
LABEL "Mimetype handling"
@@ -832,7 +899,8 @@ qt_feature("timezone_locale" PRIVATE
SECTION "Utilities"
LABEL "QTimeZone"
PURPOSE "Provides support for localized time-zone display names."
- DISABLE ON # Implementation is currently incomplete, so leave turned off
+ CONDITION
+ QT_FEATURE_timezone AND ( ( UNIX AND NOT APPLE AND NOT ANDROID ) OR QT_FEATURE_icu )
)
qt_feature("datetimeparser" PRIVATE
SECTION "Utilities"
diff --git a/src/corelib/doc/snippets/signalsandslots/signalsandslots.h b/src/corelib/doc/snippets/signalsandslots/signalsandslots.h
index 2f5a53231c..a590e8fd5e 100644
--- a/src/corelib/doc/snippets/signalsandslots/signalsandslots.h
+++ b/src/corelib/doc/snippets/signalsandslots/signalsandslots.h
@@ -33,6 +33,8 @@ class Counter : public QObject
{
Q_OBJECT
+// Note. The Q_OBJECT macro starts a private section.
+// To declare public members, use the 'public:' access modifier.
public:
Counter() { m_value = 0; }
diff --git a/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc b/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc
index b710ba7275..8422a688f0 100644
--- a/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc
+++ b/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc
@@ -318,6 +318,29 @@ The mentioned variables are used internally by \l{androiddeployqt}.
*/
/*!
+\page cmake-variable-qt-android-generate-java-qml-components.html
+\ingroup cmake-variables-qtcore
+\ingroup cmake-android-build-properties
+
+\title QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS
+\target cmake-variable-QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS
+
+\summary {Enables the generation of QtQmlComponent-based classes.}
+\cmakevariablesince 6.8
+\preliminarycmakevariable
+\cmakevariableandroidonly
+
+This variable enables Java code generation for QML components of the target application. The
+generated code will be included in the resulting package. The Java package name of generated
+classes will be the same as the Android app package. If the leaf part of the package name is
+not the same as the target executable, an extra static class with the same name as the
+capitalized target executable will surround all QML modules enclosing Java classes. Each QML
+module class, again in a capitalized form, will contain QtQmlComponent extension classes that
+represent QML components of that module.
+*/
+
+\sa{androiddeployqt}
+/*!
\page cmake-variable-qt-use-target-android-build-dir.html
\ingroup cmake-variables-qtcore
diff --git a/src/corelib/doc/src/cmake/cmake-properties.qdoc b/src/corelib/doc/src/cmake/cmake-properties.qdoc
index 8fe2b0e88f..4b602d5d07 100644
--- a/src/corelib/doc/src/cmake/cmake-properties.qdoc
+++ b/src/corelib/doc/src/cmake/cmake-properties.qdoc
@@ -245,6 +245,56 @@ CMake will attempt to use the latest installed version.
*/
/*!
+\page cmake-target-property-qt-android-package-name.html
+\ingroup cmake-properties-qtcore
+\ingroup cmake-target-properties-qtcore
+\ingroup cmake-android-build-properties
+
+\title QT_ANDROID_PACKAGE_NAME
+\target cmake-target-property-QT_ANDROID_PACKAGE_NAME
+
+\summary {The app's package name.}
+
+\cmakepropertysince 6.8
+\preliminarycmakeproperty
+\cmakepropertyandroidonly
+
+Specifies the app's package name. This is usually a unique dot separated
+name for the app, that will be used to identify the app on devices or in
+the Play Store. For example, "org.qtproject.example.gallery".
+
+The package name set by this property is passed to the \c build.gradle file
+as a \c namespace property, instead of \c AndroidManifest.xml, since the
+latter is deprecated since Android Gradle Plugin 7.4.
+
+The package name considers some words or characters as illegal and the build
+will clean such names if any is encountered. An underscore (\c _) either replaces
+illegal characters or is appended to illegal words.
+
+\list
+ \li Allowed characters: alphanumeric, an underscore or a dot [a-zA-Z0-9_.].
+ \li Illegal words: abstract, continue, for, new, switch, assert, default,
+ if, package, synchronized, boolean, do, goto, private, this, break,
+ double, implements, protected, throw, byte, else, import, public,
+ throws, case, enum, instanceof, return, transient, catch, extends,
+ int, short, try, char, final, interface, static, void, class, finally,
+ long, strictfp, volatile, const, float, native, super, while.
+\endlist
+
+The default package name for Qt for Android apps is \c org.qtproject.example.<target_name>.
+
+\note Setting the package name manually in \c build.gradle (via
+\c namespace property) takes precedence over \c AndroidManifest.xml
+(via \c package attribute), and the latter also takes precedence over
+this property.
+
+For more information, see Android's
+\l{Android: Configure the app module}{configure the app module}.
+
+\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}
+*/
+
+/*!
\page cmake-target-property-qt-android-version-code.html
\ingroup cmake-properties-qtcore
\ingroup cmake-target-properties-qtcore
diff --git a/src/corelib/doc/src/cmake/qt_android_generate_deployment_settings.qdoc b/src/corelib/doc/src/cmake/qt_android_generate_deployment_settings.qdoc
index 5a7bbdc33f..daa3680070 100644
--- a/src/corelib/doc/src/cmake/qt_android_generate_deployment_settings.qdoc
+++ b/src/corelib/doc/src/cmake/qt_android_generate_deployment_settings.qdoc
@@ -63,6 +63,7 @@ how to accomplish this.
\li \l{cmake-target-property-QT_ANDROID_MIN_SDK_VERSION}{QT_ANDROID_MIN_SDK_VERSION}
\li \l{cmake-target-property-QT_ANDROID_PACKAGE_SOURCE_DIR}{QT_ANDROID_PACKAGE_SOURCE_DIR}
\li \l{cmake-target-property-QT_ANDROID_TARGET_SDK_VERSION}{QT_ANDROID_TARGET_SDK_VERSION}
+\li \l{cmake-target-property-QT_ANDROID_PACKAGE_NAME}{QT_ANDROID_PACKAGE_NAME}
\li \l{cmake-target-property-QT_ANDROID_VERSION_NAME}{QT_ANDROID_VERSION_NAME}
\li \l{cmake-target-property-QT_ANDROID_VERSION_CODE}{QT_ANDROID_VERSION_CODE}
\li \l{cmake-target-property-QT_QML_IMPORT_PATH}{QT_QML_IMPORT_PATH}
diff --git a/src/corelib/doc/src/foreach-keyword.qdoc b/src/corelib/doc/src/foreach-keyword.qdoc
index b3a4482528..6aa21d5880 100644
--- a/src/corelib/doc/src/foreach-keyword.qdoc
+++ b/src/corelib/doc/src/foreach-keyword.qdoc
@@ -81,7 +81,10 @@
/*!
\macro QT_NO_FOREACH
\since 6.0
+ \relates <QtGlobal>
Defining this macro removes the availability of Qt's \c foreach
loop.
+
+ \sa QT_NO_KEYWORDS
*/
diff --git a/src/corelib/doc/src/jni.qdoc b/src/corelib/doc/src/jni.qdoc
new file mode 100644
index 0000000000..e49a03369c
--- /dev/null
+++ b/src/corelib/doc/src/jni.qdoc
@@ -0,0 +1,215 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \namespace QtJniTypes
+ \inmodule QtCore
+ \ingroup frameworks-technologies
+ \keyword JNI
+ \since 6.8
+
+ \brief The QtJniTypes namespace declares C++ types that correspond to Java types.
+
+ The \l{Java Native Interface Specification}{Java Native Interface}
+ framework enables native C or C++ code to call Java APIs, and to register
+ native C or C++ functions that Java code should be able to call with the
+ JVM. In Qt, the QJniObject and QJniEnvironment types provide convenient
+ wrappers for using JNI.
+
+ Since the Java language, similar to C++, supports overloading, functions
+ need to be specified including their entire signature string. This is
+ complex, repetitive, and error prone, especially when functions take
+ several parameters. QJniObject provides variadic template APIs that can
+ deduce the signature string for a function call at compile time, based on
+ the C++ types passed into the template. For this to work, the mapping of
+ those C++ types to their corresponding JNI string needs to be known at
+ compile time.
+
+ Qt implements this mapping for the standard \l {QJniObject::JNI Types}{JNI types}.
+ By using the Q_DECLARE_JNI_CLASS macro, the mapping can be extended for
+ arbitrary Java types.
+
+ \sa Q_DECLARE_JNI_CLASS, Q_DECLARE_JNI_NATIVE_METHOD, Q_JNI_NATIVE_METHOD
+*/
+
+/*!
+ \macro Q_DECLARE_JNI_TYPE(Type, JavaSignature)
+ \internal
+ \relates QtJniTypes
+ \since 6.8
+
+ Declares a C++ type \a Type in the QtJniTypes namespace that wraps the Java
+ type \a JavaSignature. The signature needs to start with \c{[L} to indicate
+ an array of a class, or with \c{L} for classes, and end with a semicolon
+ \c{;}.
+
+ \code
+ Q_DECLARE_JNI_TYPE(StringArray, "[Ljava/lang/String;")
+ \endcode
+
+ \sa Q_DECLARE_JNI_CLASS
+*/
+
+/*!
+ \macro Q_DECLARE_JNI_CLASS(Type, JavaSignature)
+ \relates QtJniTypes
+ \since 6.8
+
+ Declares a C++ type \a Type in the QtJniTypes namespace that wraps the Java
+ class \a JavaSignature. The Java class name in \a JavaSignature needs to be
+ fully qualified, using \c{/} as the separator.
+
+ \code
+ Q_DECLARE_JNI_CLASS(File, "java/io/File")
+ Q_DECLARE_JNI_CLASS(FileWriter, "java/io/FileWriter")
+ \endcode
+
+ The C++ classes \c{QtJniTypes::File} and \c{QtJniTypes::FileWriter} are
+ then QJniObject-like types that can be used to instantiate the
+ corresponding Java class, to call methods, and to pass such instances
+ through QJniObject variadic template methods with automatic, compile-time
+ signature deduction.
+
+ \code
+ using namespace QtJniTypes;
+
+ File file("path/to/file"); // instantiates the java.io.File type in Java
+ if (file.callMethod<bool>("createNewFile")) {
+ FileWriter writer(file); // instantiates a java.io.FileWriter that operates on file
+ writer.callMethod("write", 42);
+ }
+ \endcode
+*/
+
+/*!
+ \macro Q_DECLARE_JNI_NATIVE_METHOD(Method)
+ \relates QtJniTypes
+ \since 6.8
+
+ Declares the free C or C++ function \a Method as a native method. The
+ method can later be registered with the JNI framework using
+ QJniEnvironment::registerNativeMethod() with the help of the
+ Q_JNI_NATIVE_METHOD macro.
+
+ \code
+ // C++ side
+
+ Q_DECLARE_JNI_CLASS(MyJavaType, "my/java/Type")
+
+ static void nativeFunction(JNIEnv *env, jobject thiz, jlong id)
+ {
+ // ...
+ }
+ Q_DECLARE_JNI_NATIVE_METHOD(nativeFunction)
+
+ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
+ {
+ QJniEnvironment env;
+ env.registerNativeMethods<QtJniTypes::MyJavaType>({
+ Q_JNI_NATIVE_METHOD(nativeFunction)
+ });
+ }
+
+ // Java side
+ public class MyJavaType
+ {
+ native public nativeFunction(long id);
+ }
+ \endcode
+
+ \sa Q_JNI_NATIVE_METHOD, Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE
+*/
+
+/*!
+ \macro Q_DECLARE_JNI_NATIVE_METHOD(Method, JavaName)
+ \relates QtJniTypes
+ \overload
+ \since 6.8
+
+ Declares the free C or C++ function \a Method as a native method that's
+ available in Java as \a JavaName. The method can later be registered with
+ the JNI framework using QJniEnvironment::registerNativeMethod() with the
+ help of the Q_JNI_NATIVE_METHOD macro.
+
+ \sa Q_JNI_NATIVE_METHOD, Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE
+*/
+
+/*!
+ \macro Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(Method)
+ \relates QtJniTypes
+ \since 6.8
+
+ Declares the C++ static class member function \a Method as a native method.
+ The method can later be registered with the JNI framework using
+ QJniEnvironment::registerNativeMethod() with the help of the
+ Q_JNI_NATIVE_SCOPED_METHOD macro.
+
+ \code
+ class NativeHandler
+ {
+ // ...
+ private:
+ static void handleChange((JNIEnv*, jobject, jlong id);
+ Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(handleChange)
+ };
+
+ \dots
+ QJniEnvironment env;
+ env.registerNativeMethods<QtJniTypes::MyJavaType>({
+ Q_JNI_NATIVE_SCOPED_METHOD(handleChange, NativeHandler)
+ });
+ \endcode
+
+ \sa Q_DECLARE_JNI_NATIVE_METHOD, Q_JNI_NATIVE_SCOPED_METHOD
+*/
+
+/*!
+ \macro Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(Method, JavaName)
+ \relates QtJniTypes
+ \overload
+ \since 6.8
+
+ Declares the C++ static class member function \a Method as a native method
+ that's available in Java as \a JavaName. The method can later be registered
+ with the JNI framework using QJniEnvironment::registerNativeMethod() with
+ the help of the Q_JNI_NATIVE_METHOD macro.
+
+ \sa Q_DECLARE_JNI_NATIVE_METHOD, Q_JNI_NATIVE_SCOPED_METHOD
+*/
+
+/*!
+ \macro Q_JNI_NATIVE_METHOD(Method)
+ \relates QtJniTypes
+ \since 6.8
+
+ Makes the previously \l{Q_DECLARE_JNI_NATIVE_METHOD}{declared} native
+ method \a Method available for registration with the JNI framework. Use
+ this macro when registering the method with JNI using
+ QJniEnvironment::registerNativeMethod().
+
+ \code
+ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
+ {
+ QJniEnvironment env;
+ env.registerNativeMethods<QtJniTypes::MyJavaType>({
+ Q_JNI_NATIVE_METHOD(nativeFunction)
+ });
+ }
+ \endcode
+
+ \sa Q_DECLARE_JNI_NATIVE_METHOD
+*/
+
+/*!
+ \macro Q_JNI_NATIVE_SCOPED_METHOD(Method, Scope)
+ \relates QtJniTypes
+ \since 6.8
+
+ Makes the previously
+ \l{Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE}{declared} native method
+ \a Method in scope \a Scope available for registration with the JNI framework.
+ Use this macro when registering the method with JNI using
+ QJniEnvironment::registerNativeMethod().
+
+ \sa Q_JNI_NATIVE_METHOD, Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE
+*/
diff --git a/src/corelib/doc/src/objectmodel/metaobjects.qdoc b/src/corelib/doc/src/objectmodel/metaobjects.qdoc
index 3d7685447f..44f574816e 100644
--- a/src/corelib/doc/src/objectmodel/metaobjects.qdoc
+++ b/src/corelib/doc/src/objectmodel/metaobjects.qdoc
@@ -19,8 +19,7 @@
\list 1
\li The \l QObject class provides a base class for objects that can
take advantage of the meta-object system.
- \li The Q_OBJECT macro inside the private section of the class
- declaration is used to enable meta-object features, such as
+ \li The Q_OBJECT macro is used to enable meta-object features, such as
dynamic properties, signals, and slots.
\li The \l{moc}{Meta-Object Compiler} (\c moc) supplies each
QObject subclass with the necessary code to implement
diff --git a/src/corelib/doc/src/objectmodel/properties.qdoc b/src/corelib/doc/src/objectmodel/properties.qdoc
index 99a3e60d88..0e66c8445c 100644
--- a/src/corelib/doc/src/objectmodel/properties.qdoc
+++ b/src/corelib/doc/src/objectmodel/properties.qdoc
@@ -186,12 +186,11 @@
\section1 A Simple Example
- Suppose we have a class MyClass, which is derived from QObject and
- which uses the Q_OBJECT macro in its private section. We want to
- declare a property in MyClass to keep track of a priority
- value. The name of the property will be \e priority, and its type
- will be an enumeration type named \e Priority, which is defined in
- MyClass.
+ Suppose we have a class \c MyClass, which is derived from QObject and which
+ uses the Q_OBJECT macro. We want to declare a property in \c MyClass to keep
+ track of a priority value. The name of the property will be \c priority, and
+ its type will be an enumeration type named \c Priority, which is defined in
+ \c MyClass.
We declare the property with the Q_PROPERTY() macro in the private
section of the class. The required \c READ function is named \c
@@ -200,7 +199,7 @@
System} using the Q_ENUM() macro. Registering an enumeration type
makes the enumerator names available for use in calls to
QObject::setProperty(). We must also provide our own declarations
- for the \c READ and \c WRITE functions. The declaration of MyClass
+ for the \c READ and \c WRITE functions. The declaration of \c MyClass
then might look like this:
\snippet code/doc_src_properties.cpp 5
@@ -213,24 +212,24 @@
potentially forcing re-evaluation in other places if nothing has
changed.
- Given a pointer to an instance of MyClass or a pointer to a
- QObject that is an instance of MyClass, we have two ways to set
+ Given a pointer to an instance of \c MyClass or a pointer to a
+ QObject that is an instance of \c MyClass, we have two ways to set
its priority property:
\snippet code/doc_src_properties.cpp 6
In the example, the enumeration type that is the property type is
- declared in MyClass and registered with the \l{Meta-Object System}
+ declared in \c MyClass and registered with the \l{Meta-Object System}
using the Q_ENUM() macro. This makes the enumeration values
- available as strings for use as in the call to \l{QObject::}{setProperty()}. Had
- the enumeration type been declared in another class, its fully
+ available as strings for use as in the call to \l{QObject::}{setProperty()}.
+ Had the enumeration type been declared in another class, its fully
qualified name (i.e., OtherClass::Priority) would be required, and
that other class would also have to inherit QObject and register
the enumeration type there using the Q_ENUM() macro.
A similar macro, Q_FLAG(), is also available. Like Q_ENUM(), it
registers an enumeration type, but it marks the type as being a
- set of \e flags, i.e. values that can be OR'd together. An I/O
+ set of \e flags, i.e., values that can be OR'd together. An I/O
class might have enumeration values \c Read and \c Write and then
QObject::setProperty() could accept \c{Read | Write}. Q_FLAG()
should be used to register this enumeration type.
diff --git a/src/corelib/global/qassert.cpp b/src/corelib/global/qassert.cpp
index 6a29cbfa21..7c0064ac2f 100644
--- a/src/corelib/global/qassert.cpp
+++ b/src/corelib/global/qassert.cpp
@@ -195,36 +195,6 @@ void qBadAlloc()
*/
/*!
- \macro QT_TERMINATE_ON_EXCEPTION(expr)
- \relates <QtGlobal>
- \internal
-
- In general, use of the Q_DECL_NOEXCEPT macro is preferred over
- Q_DECL_NOTHROW, because it exhibits well-defined behavior and
- supports the more powerful Q_DECL_NOEXCEPT_EXPR variant. However,
- use of Q_DECL_NOTHROW has the advantage that Windows builds
- benefit on a wide range or compiler versions that do not yet
- support the C++11 noexcept feature.
-
- It may therefore be beneficial to use Q_DECL_NOTHROW and emulate
- the C++11 behavior manually with an embedded try/catch.
-
- Qt provides the QT_TERMINATE_ON_EXCEPTION(expr) macro for this
- purpose. It either expands to \c expr (if Qt is compiled without
- exception support or the compiler supports C++11 noexcept
- semantics) or to
- \snippet code/src_corelib_global_qglobal.cpp qterminate
- otherwise.
-
- Since this macro expands to just \c expr if the compiler supports
- C++11 noexcept, expecting the compiler to take over responsibility
- of calling std::terminate() in that case, it should not be used
- outside Q_DECL_NOTHROW functions.
-
- \sa Q_DECL_NOEXCEPT, Q_DECL_NOTHROW, qTerminate()
-*/
-
-/*!
\macro void Q_UNREACHABLE()
\relates <QtAssert>
\since 5.0
diff --git a/src/corelib/global/qcompare.cpp b/src/corelib/global/qcompare.cpp
index ac220b8434..81abf01984 100644
--- a/src/corelib/global/qcompare.cpp
+++ b/src/corelib/global/qcompare.cpp
@@ -149,6 +149,7 @@ CHECK(strong, equivalent);
/*!
\class Qt::strong_ordering
\inmodule QtCore
+ \inheaderfile QtCompare
\brief Qt::strong_ordering represents a comparison where equivalent values are
indistinguishable.
\sa Qt::weak_ordering, Qt::partial_ordering, {Comparison types overview}
@@ -334,6 +335,7 @@ CHECK(strong, equivalent);
/*!
\class Qt::weak_ordering
\inmodule QtCore
+ \inheaderfile QtCompare
\brief Qt::weak_ordering represents a comparison where equivalent values are
still distinguishable.
\sa Qt::strong_ordering, Qt::partial_ordering, {Comparison types overview}
@@ -484,6 +486,7 @@ CHECK(strong, equivalent);
/*!
\class Qt::partial_ordering
\inmodule QtCore
+ \inheaderfile QtCompare
\brief Qt::partial_ordering represents the result of a comparison that allows
for unordered results.
\sa Qt::strong_ordering, Qt::weak_ordering, {Comparison types overview}
@@ -1354,4 +1357,57 @@ CHECK(strong, equivalent);
\sa Qt::partial_ordering, Qt::weak_ordering, Qt::strong_ordering
*/
+/*!
+ \class Qt::totally_ordered_wrapper
+ \inmodule QtCore
+ \inheaderfile QtCompare
+ \brief Qt::totally_ordered_wrapper is a wrapper type that provides strict
+ total order for the wrapped types.
+ \since 6.8
+
+ One of its primary usecases is to prevent \e {Undefined Behavior} (UB) when
+ comparing pointers.
+
+ Consider the following simple class:
+
+ \code
+ template <typename T>
+ struct PointerWrapperBad {
+ int val;
+ T *ptr;
+ };
+ \endcode
+
+ Lexicographical comparison of the two instances of the \c PointerWrapperBad
+ type would result in UB, because it will call \c {operator<()} or
+ \c {operator<=>()} on the \c {ptr} members.
+
+ To fix it, use the new wrapper type:
+
+ \code
+ template <typename T>
+ struct PointerWrapperGood {
+ int val;
+ Qt::totally_ordered_wrapper<T *> ptr;
+
+ friend bool
+ operator==(PointerWrapperGood lhs, PointerWrapperGood rhs) noexcept = default;
+ friend auto
+ operator<=>(PointerWrapperGood lhs, PointerWrapperGood rhs) noexecpt = default;
+ };
+ \endcode
+
+ The \c {operator<()} and (if available) \c {operator<=>()} operators for
+ the \c {Qt::totally_ordered_wrapper} type use the
+ \l {https://en.cppreference.com/w/cpp/utility/functional/less}{std::less}
+ and \l {https://en.cppreference.com/w/cpp/utility/compare/compare_three_way}
+ {std::compare_three_way} function objects respectively, providing
+ \l {https://en.cppreference.com/w/cpp/language/operator_comparison#Pointer_total_order}
+ {strict total order over pointers} when doing the comparison.
+
+ As a result, the relational operators for \c {PointerWrapperGood::ptr}
+ member will be well-defined, and we can even \c {=default} the relational
+ operators for the \c {PointerWrapperGood} class, like it's shown above.
+*/
+
QT_END_NAMESPACE
diff --git a/src/corelib/global/qcomparehelpers.h b/src/corelib/global/qcomparehelpers.h
index 97c972bfa7..9754505e70 100644
--- a/src/corelib/global/qcomparehelpers.h
+++ b/src/corelib/global/qcomparehelpers.h
@@ -23,7 +23,7 @@
#endif
#include <QtCore/q20type_traits.h>
-#include <functional> // std::less
+#include <functional> // std::less, std::hash
QT_BEGIN_NAMESPACE
@@ -559,9 +559,121 @@ constexpr Qt::strong_ordering compareThreeWay(Enum lhs, Enum rhs) noexcept
{
return compareThreeWay(qToUnderlying(lhs), qToUnderlying(rhs));
}
-
} // namespace Qt
+namespace QtOrderingPrivate {
+
+template <typename Head, typename...Tail, std::size_t...Is>
+constexpr std::tuple<Tail...> qt_tuple_pop_front_impl(const std::tuple<Head, Tail...> &t,
+ std::index_sequence<Is...>) noexcept
+{
+ return std::tuple<Tail...>(std::get<Is + 1>(t)...);
+}
+
+template <typename Head, typename...Tail>
+constexpr std::tuple<Tail...> qt_tuple_pop_front(const std::tuple<Head, Tail...> &t) noexcept
+{
+ return qt_tuple_pop_front_impl(t, std::index_sequence_for<Tail...>{});
+}
+
+template <typename LhsHead, typename...LhsTail, typename RhsHead, typename...RhsTail>
+constexpr auto compareThreeWayMulti(const std::tuple<LhsHead, LhsTail...> &lhs, // ie. not empty
+ const std::tuple<RhsHead, RhsTail...> &rhs) noexcept
+{
+ static_assert(sizeof...(LhsTail) == sizeof...(RhsTail),
+ // expanded together below, but provide a nicer error message:
+ "The tuple arguments have to have the same size.");
+
+ using Qt::compareThreeWay;
+ using R = std::common_type_t<
+ decltype(compareThreeWay(std::declval<LhsHead>(), std::declval<RhsHead>())),
+ decltype(compareThreeWay(std::declval<LhsTail>(), std::declval<RhsTail>()))...
+ >;
+
+ const auto &l = std::get<0>(lhs);
+ const auto &r = std::get<0>(rhs);
+ static_assert(noexcept(compareThreeWay(l, r)),
+ "This function requires all relational operators to be noexcept.");
+ const auto res = compareThreeWay(l, r);
+ if constexpr (sizeof...(LhsTail) > 0) {
+ if (is_eq(res))
+ return R{compareThreeWayMulti(qt_tuple_pop_front(lhs), qt_tuple_pop_front(rhs))};
+ }
+ return R{res};
+}
+
+} //QtOrderingPrivate
+
+namespace Qt {
+// A wrapper class that adapts the wrappee to use the strongly-ordered
+// <functional> function objects for implementing the relational operators.
+// Mostly useful to avoid UB on pointers (which it currently mandates P to be),
+// because all the comparison helpers (incl. std::compare_three_way on
+// std::tuple<T*>!) will use the language-level operators.
+//
+template <typename P>
+class totally_ordered_wrapper
+{
+ static_assert(std::is_pointer_v<P>);
+ using T = std::remove_pointer_t<P>;
+
+ P ptr;
+public:
+ totally_ordered_wrapper() noexcept = default;
+ explicit constexpr totally_ordered_wrapper(P p) noexcept : ptr(p) {}
+
+ constexpr P get() const noexcept { return ptr; }
+ constexpr P operator->() const noexcept { return get(); }
+ constexpr T& operator*() const noexcept { return *get(); }
+
+ explicit constexpr operator bool() const noexcept { return get(); }
+
+private:
+ friend constexpr auto compareThreeWay(const totally_ordered_wrapper &lhs, const totally_ordered_wrapper &rhs) noexcept
+ { return Qt::compareThreeWay(lhs.ptr, rhs.ptr); }
+#define MAKE_RELOP(Ret, op, Op) \
+ friend constexpr Ret operator op (const totally_ordered_wrapper &lhs, const totally_ordered_wrapper &rhs) noexcept \
+ { return std:: Op {}(lhs.ptr, rhs.ptr); } \
+ friend constexpr Ret operator op (const totally_ordered_wrapper &lhs, const P &rhs) noexcept \
+ { return std:: Op {}(lhs.ptr, rhs ); } \
+ friend constexpr Ret operator op (const P &lhs, const totally_ordered_wrapper &rhs) noexcept \
+ { return std:: Op {}(lhs, rhs.ptr); } \
+ friend constexpr Ret operator op (const totally_ordered_wrapper &lhs, std::nullptr_t) noexcept \
+ { return std:: Op {}(lhs.ptr, nullptr); } \
+ friend constexpr Ret operator op (std::nullptr_t, const totally_ordered_wrapper &rhs) noexcept \
+ { return std:: Op {}(nullptr, rhs.ptr); } \
+ /* end */
+ MAKE_RELOP(bool, ==, equal_to<P>)
+ MAKE_RELOP(bool, !=, not_equal_to<P>)
+ MAKE_RELOP(bool, < , less<P>)
+ MAKE_RELOP(bool, <=, less_equal<P>)
+ MAKE_RELOP(bool, > , greater<P>)
+ MAKE_RELOP(bool, >=, greater_equal<P>)
+#ifdef __cpp_lib_three_way_comparison
+ MAKE_RELOP(auto, <=>, compare_three_way)
+#endif
+#undef MAKE_RELOP
+ friend void qt_ptr_swap(totally_ordered_wrapper &lhs, totally_ordered_wrapper &rhs) noexcept
+ { qt_ptr_swap(lhs.ptr, rhs.ptr); }
+ friend void swap(totally_ordered_wrapper &lhs, totally_ordered_wrapper &rhs) noexcept
+ { qt_ptr_swap(lhs, rhs); }
+ friend size_t qHash(totally_ordered_wrapper key, size_t seed = 0) noexcept
+ { return qHash(key.ptr, seed); }
+};
+
+} //Qt
+
QT_END_NAMESPACE
+namespace std {
+ template <typename P>
+ struct hash<QT_PREPEND_NAMESPACE(Qt::totally_ordered_wrapper)<P>>
+ {
+ using argument_type = QT_PREPEND_NAMESPACE(Qt::totally_ordered_wrapper)<P>;
+ using result_type = size_t;
+ constexpr result_type operator()(argument_type w) const noexcept
+ { return std::hash<P>{}(w.get()); }
+ };
+}
+
#endif // QCOMPAREHELPERS_H
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h
index 4d80f23786..c2fe4661f6 100644
--- a/src/corelib/global/qconfig-bootstrapped.h
+++ b/src/corelib/global/qconfig-bootstrapped.h
@@ -72,6 +72,8 @@
# define QT_FEATURE_linkat -1
#endif
#define QT_FEATURE_lttng -1
+#define QT_FEATURE_memmem -1
+#define QT_FEATURE_memrchr -1
#define QT_NO_QOBJECT
#define QT_FEATURE_process -1
#define QT_FEATURE_regularexpression 1
diff --git a/src/corelib/global/qexceptionhandling.h b/src/corelib/global/qexceptionhandling.h
index 76c6185c3e..7ffd0798f6 100644
--- a/src/corelib/global/qexceptionhandling.h
+++ b/src/corelib/global/qexceptionhandling.h
@@ -28,17 +28,11 @@ Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() noexcept;
# define QT_CATCH(A) else
# define QT_THROW(A) qt_noop()
# define QT_RETHROW qt_noop()
-# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
#else
# define QT_TRY try
# define QT_CATCH(A) catch (A)
# define QT_THROW(A) throw A
# define QT_RETHROW throw
-# ifdef Q_COMPILER_NOEXCEPT
-# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
-# else
-# define QT_TERMINATE_ON_EXCEPTION(expr) do { try { expr; } catch (...) { qTerminate(); } } while (false)
-# endif
#endif
QT_END_NAMESPACE
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 222c008f8a..99e4e49c9c 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -170,6 +170,19 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
}
/*!
+ \macro QT_NO_KEYWORDS
+ \relates <QtGlobal>
+
+ Define this macro to disable the Qt-specific keywords that are usually enabled,
+ such as \c signals and \c slots. Use \c Q_SIGNALS and \c Q_SLOTS instead.
+
+ Libraries should define this macro to make sure that they don't use the generic
+ keywords without the \c Q_ prefix in their public headers.
+
+ \sa QT_NO_FOREACH
+*/
+
+/*!
\macro QT_NAMESPACE
\internal
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 1009057bad..2d70e82370 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -67,8 +67,9 @@
#include <QtCore/qtresource.h>
#include <QtCore/qttranslation.h>
#include <QtCore/qttypetraits.h>
+#if QT_CONFIG(version_tagging)
#include <QtCore/qversiontagging.h>
-
+#endif
#endif /* __cplusplus */
#endif /* QGLOBAL_H */
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 1b03733d2a..6ffaef8f7c 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -516,79 +516,123 @@ QLibraryInfoPrivate::LocationInfo QLibraryInfoPrivate::locationInfo(QLibraryInfo
/*!
\since 6.0
Returns the path specified by \a p.
+
+ If there is more than one path listed in qt.conf, it will
+ only return the first one.
+ \sa paths
*/
QString QLibraryInfo::path(LibraryPath p)
{
return QLibraryInfoPrivate::path(p);
}
+/*!
+ \since 6.8
+ Returns all paths specificied by \a p.
-/*
- Returns the path specified by \a p.
-
- The usage mode can be set to UsedFromQtBinDir to enable special handling for executables that
- live in <install-prefix>/bin.
+ \sa path
*/
-QString QLibraryInfoPrivate::path(QLibraryInfo::LibraryPath p, UsageMode usageMode)
+QStringList QLibraryInfo::paths(LibraryPath p)
+{
+ return QLibraryInfoPrivate::paths(p);
+}
+
+
+static QString normalizePath(QString ret)
+{
+ qsizetype startIndex = 0;
+ /* We support placeholders of the form $(<ENV_VAR>) in qt.conf.
+ The loop below tries to find all such placeholders, and replaces
+ them with the actual value of the ENV_VAR environment variable
+ */
+ while (true) {
+ startIndex = ret.indexOf(u'$', startIndex);
+ if (startIndex < 0)
+ break;
+ if (ret.size() < startIndex + 3)
+ break;
+ if (ret.at(startIndex + 1) != u'(') {
+ startIndex++;
+ continue;
+ }
+ qsizetype endIndex = ret.indexOf(u')', startIndex + 2);
+ if (endIndex < 0)
+ break;
+ auto envVarName = QStringView{ret}.sliced(startIndex + 2, endIndex - startIndex - 2);
+ QString value = qEnvironmentVariable(envVarName.toLocal8Bit().constData());
+ ret.replace(startIndex, endIndex - startIndex + 1, value);
+ startIndex += value.size();
+ }
+ return QDir::fromNativeSeparators(ret);
+};
+
+static bool keepQtBuildDefaults()
+{
+#if QT_CONFIG(settings)
+ QSettings *config = QLibraryInfoPrivate::configuration();
+ Q_ASSERT(config != nullptr);
+ return config->value("Config/MergeQtConf", false).toBool();
+#else
+ return false;
+#endif
+}
+
+#if QT_CONFIG(settings)
+static QVariant libraryPathToValue(QLibraryInfo::LibraryPath loc)
+{
+ QVariant value;
+ auto li = QLibraryInfoPrivate::locationInfo(loc);
+ if (li.key.isNull())
+ return value;
+ QSettings *config = QLibraryInfoPrivate::configuration();
+ Q_ASSERT(config != nullptr);
+ // if keepQtBuildDefaults returns true,
+ // we only consider explicit values listed in qt.conf
+ QVariant defaultValue = keepQtBuildDefaults()
+ ? QVariant()
+ : QVariant(li.defaultValue);
+ config->beginGroup("Paths"_L1);
+ auto cleanup = qScopeGuard([&]() { config->endGroup(); });
+ if (li.fallbackKey.isNull()) {
+ value = config->value(li.key, defaultValue);
+ } else {
+ value = config->value(li.key);
+ if (!value.isValid())
+ value = config->value(li.fallbackKey, defaultValue);
+ }
+ return value;
+}
+#endif // settings
+
+QStringList QLibraryInfoPrivate::paths(QLibraryInfo::LibraryPath p,
+ UsageMode usageMode)
{
const QLibraryInfo::LibraryPath loc = p;
- QString ret;
+ QList<QString> ret;
bool fromConf = false;
#if QT_CONFIG(settings)
if (havePaths()) {
fromConf = true;
- auto li = QLibraryInfoPrivate::locationInfo(loc);
- if (!li.key.isNull()) {
- QSettings *config = QLibraryInfoPrivate::configuration();
- Q_ASSERT(config != nullptr);
- config->beginGroup("Paths"_L1);
-
- if (li.fallbackKey.isNull()) {
- ret = config->value(li.key, li.defaultValue).toString();
- } else {
- QVariant v = config->value(li.key);
- if (!v.isValid())
- v = config->value(li.fallbackKey, li.defaultValue);
- ret = v.toString();
- }
-
- qsizetype startIndex = 0;
- /* We support placeholders of the form $(<ENV_VAR>) in qt.conf.
- The loop below tries to find all such placeholders, and replaces
- them with the actual value of the ENV_VAR environment variable
- */
- while (true) {
- startIndex = ret.indexOf(u'$', startIndex);
- if (startIndex < 0)
- break;
- if (ret.size() < startIndex + 3)
- break;
- if (ret.at(startIndex + 1) != u'(') {
- startIndex++;
- continue;
- }
- qsizetype endIndex = ret.indexOf(u')', startIndex + 2);
- if (endIndex < 0)
- break;
- auto envVarName = QStringView{ret}.mid(startIndex + 2, endIndex - startIndex - 2);
- QString value = QString::fromLocal8Bit(qgetenv(envVarName.toLocal8Bit().constData()));
- ret.replace(startIndex, endIndex - startIndex + 1, value);
- startIndex += value.size();
- }
-
- config->endGroup();
+ QVariant value = libraryPathToValue(loc);
+ if (value.isValid()) {
- ret = QDir::fromNativeSeparators(ret);
+ if (auto *asList = get_if<QList<QString>>(&value))
+ ret = std::move(*asList);
+ else
+ ret = QList<QString>({ std::move(value).toString()});
+ for (qsizetype i = 0, end = ret.size(); i < end; ++i)
+ ret[i] = normalizePath(ret[i]);
}
}
#endif // settings
- if (!fromConf) {
+ if (!fromConf || keepQtBuildDefaults()) {
+ QString noConfResult;
if (loc == QLibraryInfo::PrefixPath) {
- ret = getPrefix(usageMode);
+ noConfResult = getPrefix(usageMode);
} else if (int(loc) <= qt_configure_strs.count()) {
- ret = QString::fromLocal8Bit(qt_configure_strs.viewAt(loc - 1));
+ noConfResult = QString::fromLocal8Bit(qt_configure_strs.viewAt(loc - 1));
#ifndef Q_OS_WIN // On Windows we use the registry
} else if (loc == QLibraryInfo::SettingsPath) {
// Use of volatile is a hack to discourage compilers from calling
@@ -596,24 +640,39 @@ QString QLibraryInfoPrivate::path(QLibraryInfo::LibraryPath p, UsageMode usageMo
// compile-time, as Qt installers binary-patch the path, replacing
// the dummy path seen at compile-time, typically changing length.
const char *volatile path = QT_CONFIGURE_SETTINGS_PATH;
- ret = QString::fromLocal8Bit(path);
+ noConfResult = QString::fromLocal8Bit(path);
#endif
}
+ if (!noConfResult.isEmpty())
+ ret.push_back(std::move(noConfResult));
}
+ if (ret.isEmpty())
+ return ret;
- if (!ret.isEmpty() && QDir::isRelativePath(ret)) {
- QString baseDir;
- if (loc == QLibraryInfo::PrefixPath) {
- baseDir = prefixFromAppDirHelper();
- } else {
- // we make any other path absolute to the prefix directory
- baseDir = path(QLibraryInfo::PrefixPath, usageMode);
- }
- ret = QDir::cleanPath(baseDir + u'/' + ret);
+ QString baseDir;
+ if (loc == QLibraryInfo::PrefixPath) {
+ baseDir = prefixFromAppDirHelper();
+ } else {
+ // we make any other path absolute to the prefix directory
+ baseDir = QLibraryInfoPrivate::path(QLibraryInfo::PrefixPath, usageMode);
}
+ for (qsizetype i = 0, end = ret.size(); i < end; ++i)
+ if (QDir::isRelativePath(ret[i]))
+ ret[i] = QDir::cleanPath(baseDir + u'/' + std::move(ret[i]));
return ret;
}
+/*
+ Returns the path specified by \a p.
+
+ The usage mode can be set to UsedFromQtBinDir to enable special handling for executables that
+ live in <install-prefix>/bin.
+ */
+QString QLibraryInfoPrivate::path(QLibraryInfo::LibraryPath p, UsageMode usageMode)
+{
+ return paths(p, usageMode).value(0, QString());
+}
+
/*!
Returns additional arguments to the platform plugin matching
\a platformName which can be specified as a string list using
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index d4e8f8b050..6cac6c83b0 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -42,6 +42,7 @@ public:
SettingsPath = 100
};
static QString path(LibraryPath p);
+ static QStringList paths(LibraryPath p);
#if QT_DEPRECATED_SINCE(6, 0)
using LibraryLocation = LibraryPath;
QT_DEPRECATED_VERSION_X_6_0("Use path()")
diff --git a/src/corelib/global/qlibraryinfo_p.h b/src/corelib/global/qlibraryinfo_p.h
index 4b471b932e..b9ca6b4d18 100644
--- a/src/corelib/global/qlibraryinfo_p.h
+++ b/src/corelib/global/qlibraryinfo_p.h
@@ -50,6 +50,7 @@ public:
};
static QString path(QLibraryInfo::LibraryPath p, UsageMode usageMode = RegularUsage);
+ static QList<QString> paths(QLibraryInfo::LibraryPath p, UsageMode usageMode = RegularUsage);
};
QT_END_NAMESPACE
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index dec16e4a77..efeec37094 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -834,7 +834,7 @@ void QMessageLogger::fatal(const QLoggingCategory &cat, const char *msg, ...) co
va_list ap;
va_start(ap, msg); // use variable arg list
- QT_TERMINATE_ON_EXCEPTION(qt_message(QtFatalMsg, ctxt, msg, ap));
+ qt_message(QtFatalMsg, ctxt, msg, ap);
va_end(ap);
#ifndef Q_CC_MSVC_ONLY
@@ -858,7 +858,7 @@ void QMessageLogger::fatal(QMessageLogger::CategoryFunction catFunc,
va_list ap;
va_start(ap, msg); // use variable arg list
- QT_TERMINATE_ON_EXCEPTION(qt_message(QtFatalMsg, ctxt, msg, ap));
+ qt_message(QtFatalMsg, ctxt, msg, ap);
va_end(ap);
#ifndef Q_CC_MSVC_ONLY
@@ -877,7 +877,7 @@ void QMessageLogger::fatal(const char *msg, ...) const noexcept
QInternalMessageLogContext ctxt(context);
va_list ap;
va_start(ap, msg); // use variable arg list
- QT_TERMINATE_ON_EXCEPTION(qt_message(QtFatalMsg, ctxt, msg, ap));
+ qt_message(QtFatalMsg, ctxt, msg, ap);
va_end(ap);
#ifndef Q_CC_MSVC_ONLY
@@ -2621,7 +2621,7 @@ QMessageLogContext &QMessageLogContext::copyContextFrom(const QMessageLogContext
This enum describes the messages that can be sent to a message
handler (QtMessageHandler). You can use the enum to identify and
associate the various message types with the appropriate
- actions.
+ actions. Its values are, in order of increasing severity:
\value QtDebugMsg
A message generated by the qDebug() function.
@@ -2635,8 +2635,6 @@ QMessageLogContext &QMessageLogContext::copyContextFrom(const QMessageLogContext
A message generated by the qFatal() function.
\omitvalue QtSystemMsg
- \c QtInfoMsg was added in Qt 5.5.
-
\sa QtMessageHandler, qInstallMessageHandler()
*/
diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h
index aa0ab93a2d..b4ec1a1235 100644
--- a/src/corelib/global/qlogging.h
+++ b/src/corelib/global/qlogging.h
@@ -28,10 +28,11 @@ class QNoDebug;
enum QtMsgType {
QtDebugMsg,
+ QT7_ONLY(QtInfoMsg,)
QtWarningMsg,
QtCriticalMsg,
QtFatalMsg,
- QtInfoMsg,
+ QT6_ONLY(QtInfoMsg,)
#if QT_DEPRECATED_SINCE(6, 7)
QtSystemMsg Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtCriticalMsg instead.") = QtCriticalMsg
#endif
diff --git a/src/corelib/global/qminmax.h b/src/corelib/global/qminmax.h
index e6fb62bf9d..fca13e047e 100644
--- a/src/corelib/global/qminmax.h
+++ b/src/corelib/global/qminmax.h
@@ -11,31 +11,10 @@
#include <QtCore/qassert.h>
#include <QtCore/qtconfigmacros.h>
-
-#include <type_traits>
+#include <QtCore/qttypetraits.h>
QT_BEGIN_NAMESPACE
-namespace QTypeTraits {
-
-namespace detail {
-template<typename T, typename U,
- typename = std::enable_if_t<std::is_arithmetic_v<T> && std::is_arithmetic_v<U> &&
- std::is_floating_point_v<T> == std::is_floating_point_v<U> &&
- std::is_signed_v<T> == std::is_signed_v<U> &&
- !std::is_same_v<T, bool> && !std::is_same_v<U, bool> &&
- !std::is_same_v<T, char> && !std::is_same_v<U, char>>>
-struct Promoted
-{
- using type = decltype(T() + U());
-};
-}
-
-template <typename T, typename U>
-using Promoted = typename detail::Promoted<T, U>::type;
-
-}
-
template <typename T>
constexpr inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; }
template <typename T>
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 2398c0a1a4..1569577b12 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -1356,6 +1356,11 @@ namespace Qt {
PreventContextMenu
};
+ enum class ContextMenuTrigger {
+ Press,
+ Release,
+ };
+
enum InputMethodQuery {
ImEnabled = 0x1,
ImCursorRectangle = 0x2,
@@ -1731,6 +1736,7 @@ namespace Qt {
Q_ENUM_NS(ScrollBarPolicy)
Q_ENUM_NS(FocusPolicy)
Q_ENUM_NS(ContextMenuPolicy)
+ Q_ENUM_NS(ContextMenuTrigger)
Q_ENUM_NS(ArrowType)
Q_ENUM_NS(ToolButtonStyle)
Q_ENUM_NS(PenStyle)
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index ddfade675a..b2ec64f435 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -2087,6 +2087,18 @@
*/
/*!
+ \enum Qt::ContextMenuTrigger
+ \since 6.8
+
+ This enum type defines the mouse event used to trigger a context menu event.
+
+ \value Press context menu on mouse press event, default on UNIX systems.
+ \value Release context menu on mouse release event, default on Windows.
+
+ \sa QStyleHints::contextMenuTrigger
+*/
+
+/*!
\enum Qt::FocusPolicy
This enum type defines the various policies a widget can have with
diff --git a/src/corelib/global/qtconfigmacros.h b/src/corelib/global/qtconfigmacros.h
index 03d52d885a..b643122d5c 100644
--- a/src/corelib/global/qtconfigmacros.h
+++ b/src/corelib/global/qtconfigmacros.h
@@ -9,6 +9,7 @@
#endif
#include <QtCore/qtconfiginclude.h>
+#include <QtCore/qtdeprecationdefinitions.h>
#include <QtCore/qtversionchecks.h>
#include <assert.h>
diff --git a/src/corelib/global/qtdeprecationdefinitions.h.in b/src/corelib/global/qtdeprecationdefinitions.h.in
new file mode 100644
index 0000000000..0570f63a5a
--- /dev/null
+++ b/src/corelib/global/qtdeprecationdefinitions.h.in
@@ -0,0 +1,28 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QTDEPRECATIONDEFINITIONS_H
+#define QTDEPRECATIONDEFINITIONS_H
+
+#ifndef QT_DISABLE_DEPRECATED_UP_TO
+# ifdef QT_DISABLE_DEPRECATED_BEFORE // If the deprecated macro is defined, use its value
+# define QT_DISABLE_DEPRECATED_UP_TO QT_DISABLE_DEPRECATED_BEFORE
+# else
+# define QT_DISABLE_DEPRECATED_UP_TO @QT_DISABLE_DEPRECATED_UP_TO@
+# endif
+#endif
+
+#if QT_DISABLE_DEPRECATED_UP_TO < @QT_DISABLE_DEPRECATED_UP_TO@
+# warning QT_DISABLE_DEPRECATED_UP_TO is set to the version that is lower than the version that \
+ Qt was built with. This may lead to linking issues.
+#endif
+
+#ifndef QT_WARN_DEPRECATED_UP_TO
+# ifdef QT_DEPRECATED_WARNINGS_SINCE // If the deprecated macro is defined, use its value
+# define QT_WARN_DEPRECATED_UP_TO QT_DEPRECATED_WARNINGS_SINCE
+# else
+# define QT_WARN_DEPRECATED_UP_TO @QT_WARN_DEPRECATED_UP_TO@
+# endif
+#endif
+
+#endif // QTDEPRECATIONDEFINITIONS_H
diff --git a/src/corelib/global/qtdeprecationmarkers.h b/src/corelib/global/qtdeprecationmarkers.h
index 6df5ebce6d..68f4fda186 100644
--- a/src/corelib/global/qtdeprecationmarkers.h
+++ b/src/corelib/global/qtdeprecationmarkers.h
@@ -5,6 +5,7 @@
#define QTDEPRECATIONMARKERS_H
#include <QtCore/qtconfigmacros.h>
+#include <QtCore/qtdeprecationdefinitions.h>
#include <QtCore/qtversionchecks.h>
#include <QtCore/qcompilerdetection.h> // for Q_DECL_DEPRECATED
@@ -44,28 +45,6 @@ QT_BEGIN_NAMESPACE
# define Q_DECL_ENUMERATOR_DEPRECATED_X(ignored)
#endif
-// If the deprecated macro is defined, use its value
-#if !defined(QT_DISABLE_DEPRECATED_UP_TO) && defined(QT_DISABLE_DEPRECATED_BEFORE)
-# define QT_DISABLE_DEPRECATED_UP_TO QT_DISABLE_DEPRECATED_BEFORE
-#endif
-
-// If the deprecated macro is defined, use its value
-#if !defined(QT_WARN_DEPRECATED_UP_TO) && defined(QT_DEPRECATED_WARNINGS_SINCE)
-# define QT_WARN_DEPRECATED_UP_TO QT_DEPRECATED_WARNINGS_SINCE
-#endif
-
-#ifndef QT_WARN_DEPRECATED_UP_TO
-# ifdef QT_DISABLE_DEPRECATED_UP_TO
-# define QT_WARN_DEPRECATED_UP_TO QT_DISABLE_DEPRECATED_UP_TO
-# else
-# define QT_WARN_DEPRECATED_UP_TO QT_VERSION
-# endif
-#endif
-
-#ifndef QT_DISABLE_DEPRECATED_UP_TO
-#define QT_DISABLE_DEPRECATED_UP_TO QT_VERSION_CHECK(5, 0, 0)
-#endif
-
/*
QT_DEPRECATED_SINCE(major, minor) evaluates as true if the Qt version is greater than
the deprecation point specified.
diff --git a/src/corelib/global/qttypetraits.h b/src/corelib/global/qttypetraits.h
index 1efb24bf70..35dfad155b 100644
--- a/src/corelib/global/qttypetraits.h
+++ b/src/corelib/global/qttypetraits.h
@@ -60,6 +60,26 @@ template <typename T> struct type_dependent_false : std::false_type {};
template <auto T> struct value_dependent_false : std::false_type {};
}
+namespace QTypeTraits {
+
+namespace detail {
+template<typename T, typename U,
+ typename = std::enable_if_t<std::is_arithmetic_v<T> && std::is_arithmetic_v<U> &&
+ std::is_floating_point_v<T> == std::is_floating_point_v<U> &&
+ std::is_signed_v<T> == std::is_signed_v<U> &&
+ !std::is_same_v<T, bool> && !std::is_same_v<U, bool> &&
+ !std::is_same_v<T, char> && !std::is_same_v<U, char>>>
+struct Promoted
+{
+ using type = decltype(T() + U());
+};
+}
+
+template <typename T, typename U>
+using Promoted = typename detail::Promoted<T, U>::type;
+
+} // namespace QTypeTraits
+
QT_END_NAMESPACE
#endif // QTTYPETRAITS_H
diff --git a/src/corelib/global/qversiontagging.h b/src/corelib/global/qversiontagging.h
index 965d53e88f..fa2dd23728 100644
--- a/src/corelib/global/qversiontagging.h
+++ b/src/corelib/global/qversiontagging.h
@@ -13,6 +13,8 @@
#include <QtCore/qtversionchecks.h>
#include <QtCore/qtypes.h>
+QT_REQUIRE_CONFIG(version_tagging);
+
QT_BEGIN_NAMESPACE
/*
diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp
index 763620692c..4e513bc7cf 100644
--- a/src/corelib/io/qbuffer.cpp
+++ b/src/corelib/io/qbuffer.cpp
@@ -282,8 +282,7 @@ void QBuffer::setData(const char *data, qsizetype size)
qWarning("QBuffer::setData: Buffer is open");
return;
}
- d->buf->replace(qsizetype(0), d->buf->size(), // ### QByteArray lacks assign(ptr, n)
- data, size);
+ d->buf->assign(data, data + size);
}
/*!
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 9291201d88..05947f3380 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -313,9 +313,10 @@ inline void QDirPrivate::sortFileList(QDir::SortFlags sort, const QFileInfoList
names->append(fi.fileName());
}
} else {
- QScopedArrayPointer<QDirSortItem> si(new QDirSortItem[n]);
+ QVarLengthArray<QDirSortItem, 64> si;
+ si.reserve(n);
for (qsizetype i = 0; i < n; ++i)
- si[i] = QDirSortItem{l.at(i), sort};
+ si.emplace_back(l.at(i), sort);
#ifndef QT_BOOTSTRAPPED
if (sort.testAnyFlag(QDir::LocaleAware)) {
diff --git a/src/corelib/io/qdirlisting.cpp b/src/corelib/io/qdirlisting.cpp
index 008003e856..7366aadf06 100644
--- a/src/corelib/io/qdirlisting.cpp
+++ b/src/corelib/io/qdirlisting.cpp
@@ -25,12 +25,11 @@
\snippet code/src_corelib_io_qdirlisting.cpp 1
Iterators constructed by QDirListing (QDirListing::const_iterator) are
- forward-only (you cannot iterate directories in reverse order) and don't
- allow random access. They can be used in ranged-for loops (or with STL
- alogrithms that don't require random access iterators). Dereferencing
- a valid iterator returns a QDirListing::DirEntry object. The (c)end()
- iterator marks the end of the iteration. Dereferencing the end iterator
- is undefiend behavior.
+ forward-only, single-pass iterators, that don't allow random access. They
+ can be used in ranged-for loops (or with STL alogrithms that don't
+ require random access iterators). Dereferencing a valid iterator returns
+ a QDirListing::DirEntry object. The (c)end() iterator marks the end of
+ the iteration. Dereferencing the end iterator is undefined behavior.
QDirListing::DirEntry offers a subset of QFileInfo's API (for example,
fileName(), filePath(), exists()). Internally, DirEntry only constructs
@@ -80,7 +79,6 @@
#include <QtCore/private/qduplicatetracker_p.h>
#include <memory>
-#include <stack>
#include <vector>
QT_BEGIN_NAMESPACE
@@ -92,6 +90,7 @@ class QDirListingPrivate
public:
void init(bool resolveEngine);
void advance();
+ void beginIterating();
bool entryMatches(QDirEntryInfo &info);
void pushDirectory(QDirEntryInfo &info);
@@ -113,10 +112,10 @@ public:
#endif
using FEngineIteratorPtr = std::unique_ptr<QAbstractFileEngineIterator>;
- std::stack<FEngineIteratorPtr, std::vector<FEngineIteratorPtr>> fileEngineIterators;
+ std::vector<FEngineIteratorPtr> fileEngineIterators;
#ifndef QT_NO_FILESYSTEMITERATOR
using FsIteratorPtr = std::unique_ptr<QFileSystemIterator>;
- std::stack<FsIteratorPtr, std::vector<FsIteratorPtr>> nativeIterators;
+ std::vector<FsIteratorPtr> nativeIterators;
#endif
// Loop protection
@@ -143,7 +142,21 @@ void QDirListingPrivate::init(bool resolveEngine = true)
engine = QFileSystemEngine::createLegacyEngine(initialEntryInfo.entry,
initialEntryInfo.metaData);
}
+}
+
+/*!
+ \internal
+ Resets the iteration state (if any), so that calling begin()/cbegin()
+ always starts iterating anew.
+*/
+void QDirListingPrivate::beginIterating()
+{
+#ifndef QT_NO_FILESYSTEMITERATOR
+ nativeIterators.clear();
+#endif
+ fileEngineIterators.clear();
+ visitedLinks.clear();
pushDirectory(initialEntryInfo);
}
@@ -167,7 +180,7 @@ void QDirListingPrivate::pushDirectory(QDirEntryInfo &entryInfo)
if (engine) {
engine->setFileName(path);
if (auto it = engine->beginEntryList(path, filters, nameFilters)) {
- fileEngineIterators.emplace(std::move(it));
+ fileEngineIterators.emplace_back(std::move(it));
} else {
// No iterator; no entry list.
}
@@ -178,7 +191,7 @@ void QDirListingPrivate::pushDirectory(QDirEntryInfo &entryInfo)
fentry = &entryInfo.fileInfoOpt->d_ptr->fileEntry;
else
fentry = &entryInfo.entry;
- nativeIterators.emplace(std::make_unique<QFileSystemIterator>(*fentry, filters));
+ nativeIterators.emplace_back(std::make_unique<QFileSystemIterator>(*fentry, filters));
#else
qWarning("Qt was built with -no-feature-filesystemiterator: no files/plugins will be found!");
#endif
@@ -196,19 +209,18 @@ bool QDirListingPrivate::entryMatches(QDirEntryInfo &entryInfo)
Advances the internal iterator, either a QAbstractFileEngineIterator (e.g.
QResourceFileEngineIterator) or a QFileSystemIterator (which uses low-level
- system methods, e.g. readdir() on Unix).
-
- An iterator stack is used for holding the iterators.
+ system methods, e.g. readdir() on Unix). The iterators are stored in a
+ vector.
A typical example of doing recursive iteration:
- while iterating directory A we find a sub-dir B
- - an iterator for B is added to the iterator stack
- - B's iterator is processed (the top() of the stack) first; then loop
+ - an iterator for B is added to the vector
+ - B's iterator is processed (vector.back()) first; then the loop
goes back to processing A's iterator
*/
void QDirListingPrivate::advance()
{
- // Use get() in both code paths below because the iterator returned by top()
+ // Use get() in both code paths below because the iterator returned by back()
// may be invalidated due to reallocation when appending new iterators in
// pushDirectory().
@@ -216,7 +228,7 @@ void QDirListingPrivate::advance()
while (!fileEngineIterators.empty()) {
// Find the next valid iterator that matches the filters.
QAbstractFileEngineIterator *it;
- while (it = fileEngineIterators.top().get(), it->advance()) {
+ while (it = fileEngineIterators.back().get(), it->advance()) {
QDirEntryInfo entryInfo;
entryInfo.fileInfoOpt = it->currentFileInfo();
if (entryMatches(entryInfo)) {
@@ -225,7 +237,7 @@ void QDirListingPrivate::advance()
}
}
- fileEngineIterators.pop();
+ fileEngineIterators.pop_back();
}
} else {
#ifndef QT_NO_FILESYSTEMITERATOR
@@ -233,7 +245,8 @@ void QDirListingPrivate::advance()
while (!nativeIterators.empty()) {
// Find the next valid iterator that matches the filters.
QFileSystemIterator *it;
- while (it = nativeIterators.top().get(), it->advance(entryInfo.entry, entryInfo.metaData)) {
+ while (it = nativeIterators.back().get(),
+ it->advance(entryInfo.entry, entryInfo.metaData)) {
if (entryMatches(entryInfo)) {
currentEntryInfo = std::move(entryInfo);
return;
@@ -241,7 +254,7 @@ void QDirListingPrivate::advance()
entryInfo = {};
}
- nativeIterators.pop();
+ nativeIterators.pop_back();
}
#endif
}
@@ -485,12 +498,25 @@ QString QDirListing::iteratorPath() const
\fn QDirListing::const_iterator QDirListing::end() const
\fn QDirListing::const_iterator QDirListing::cend() const
- begin()/cbegin() returns a QDirListing::const_iterator that enables
- iterating over directory entries using a ranged-for loop; dereferencing
- this iterator returns a \c{const QFileInfo &}.
-
- end()/cend() return a sentinel const_iterator that signals the end of
- the iteration. Dereferencing this iterator is undefined behavior.
+ (c)begin() returns a QDirListing::const_iterator that can be used to
+ iterate over directory entries.
+
+ \list
+ \li This is a forward-only, single-pass iterator (you cannot iterate
+ directory entries in reverse order)
+ \li Doesn't allow random access
+ \li Can be used in ranged-for loops; or with STL algorithms that don't
+ require random access iterators
+ \li Dereferencing a valid iterator returns a \c{const DirEntry &}
+ \li (c)end() returns a sentinel-like const_iterator that signals the
+ end of the iteration. Dereferencing the end() iterator is undefined
+ behavior
+ \li Each time (c)begin() is called on the same QDirListing object,
+ the internal state is reset and the iteration starts anew
+ \endlist
+
+ (Some of the above restrictions are dictated by the underlying system
+ library functions' implementation).
For example:
\snippet code/src_corelib_io_qdirlisting.cpp 0
@@ -498,14 +524,11 @@ QString QDirListing::iteratorPath() const
Here's how to find and read all files filtered by name, recursively:
\snippet code/src_corelib_io_qdirlisting.cpp 1
- \note As this is a unidirectional (forward-only) iterator, calling
- begin()/cbegin() more than once on the same QDirListing object could
- result in unexpected behavior (for example, some entries being skipped).
-
\sa fileInfo(), fileName(), filePath()
*/
QDirListing::const_iterator QDirListing::begin() const
{
+ d->beginIterating();
const_iterator it{d.get()};
return ++it;
}
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index 52188dde51..ea594470ea 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -510,7 +510,7 @@ QFile::moveToTrash()
\since 5.15
\overload
- Moves the file specified by fileName() to the trash. Returns \c true if successful,
+ Moves the file specified by \a fileName to the trash. Returns \c true if successful,
and sets \a pathInTrash (if provided) to the path at which the file can be found within
the trash; otherwise returns \c false.
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index bda2962f8d..fb48f22bc6 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -641,30 +641,17 @@ QFileSystemEntry QFileSystemEngine::getRawLinkPath(const QFileSystemEntry &link,
QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry, QFileSystemMetaData &data)
{
Q_CHECK_FILE_NAME(entry, entry);
+ char *resolved_name = nullptr;
-#if !defined(Q_OS_DARWIN) && !defined(Q_OS_QNX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_HAIKU) && _POSIX_VERSION < 200809L
- // realpath(X,0) is not supported
- Q_UNUSED(data);
- return QFileSystemEntry(slowCanonicalized(absoluteName(entry).filePath()));
-#else
-# if defined(Q_OS_DARWIN) || defined(Q_OS_ANDROID) || _POSIX_VERSION < 200801L
- // used to store the result of realpath in case where realpath cannot allocate itself
+#ifdef PATH_MAX
+ // use the stack to avoid the overhead of memory allocation
char stack_result[PATH_MAX + 1];
#else
- // enables unconditionally passing stack_result below
+ // system with unlimited file paths -> must use heap
std::nullptr_t stack_result = nullptr;
-# endif
- auto resolved_path_deleter = [&](char *ptr) {
- // frees resolved_name if it was allocated by realpath
-# if defined(Q_OS_DARWIN) || defined(Q_OS_ANDROID) || _POSIX_VERSION < 200801L
- // ptr is either null, or points to stack_result
- Q_ASSERT(!ptr || ptr == stack_result);
- return;
-#else
- free(ptr);
-# endif
- };
- std::unique_ptr<char, decltype (resolved_path_deleter)> resolved_name {nullptr, resolved_path_deleter};
+ auto freer = qScopeGuard([&] { free(resolved_name); });
+#endif
+
# if defined(Q_OS_DARWIN) || defined(Q_OS_ANDROID)
// On some Android and macOS versions, realpath() will return a path even if
// it does not exist. To work around this, we check existence in advance.
@@ -674,14 +661,14 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
if (!data.exists())
errno = ENOENT;
else
- resolved_name.reset(realpath(entry.nativeFilePath().constData(), stack_result));
+ resolved_name = realpath(entry.nativeFilePath().constData(), stack_result);
# else
- resolved_name.reset(realpath(entry.nativeFilePath().constData(), stack_result));
+ resolved_name = realpath(entry.nativeFilePath().constData(), stack_result);
# endif
if (resolved_name) {
data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute;
data.entryFlags |= QFileSystemMetaData::ExistsAttribute;
- QString canonicalPath = QDir::cleanPath(QFile::decodeName(resolved_name.get()));
+ QString canonicalPath = QDir::cleanPath(QFile::decodeName(resolved_name));
return QFileSystemEntry(canonicalPath);
} else if (errno == ENOENT || errno == ENOTDIR) { // file doesn't exist
data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute;
@@ -689,7 +676,6 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
return QFileSystemEntry();
}
return entry;
-#endif
}
//static
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index df57d12efc..581e1e75ef 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -36,6 +36,13 @@
#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY)
# define QT_USE_MMAP
# include <sys/mman.h>
+# ifdef Q_OS_LINUX
+// since 5.7, so define in case we're being compiled with older kernel headers
+# define MREMAP_DONTUNMAP 4
+# elif defined(Q_OS_DARWIN)
+# include <mach/mach.h>
+# include <mach/vm_map.h>
+# endif
#endif
#ifdef Q_OS_WIN
# include <qt_windows.h>
@@ -286,6 +293,8 @@ public:
bool load(const QString &file);
void clear();
+ static bool mayRemapData(const QResource &resource);
+
QLocale locale;
QString fileName, absoluteFilePath;
QList<QResourceRoot *> related;
@@ -1127,13 +1136,14 @@ public:
: QDynamicBufferResourceRoot(_root), unmapPointer(nullptr), unmapLength(0)
{ }
~QDynamicFileResourceRoot() {
- if (unmapPointer)
+ if (wasMemoryMapped())
unmap_sys(unmapPointer, unmapLength);
else
delete[] mappingBuffer();
}
QString mappingFile() const { return fileName; }
ResourceRootType type() const override { return Resource_File; }
+ bool wasMemoryMapped() const { return unmapPointer; }
bool registerSelf(const QString &f);
};
@@ -1377,11 +1387,21 @@ private:
bool unmap(uchar *ptr);
void uncompress() const;
void mapUncompressed();
- qint64 offset;
+ bool mapUncompressed_sys();
+ void unmapUncompressed_sys();
+ qint64 offset = 0;
QResource resource;
mutable QByteArray uncompressed;
+ bool mustUnmap = false;
+
+ // minimum size for which we'll try to re-open ourselves in mapUncompressed()
+ static constexpr qsizetype RemapCompressedThreshold = 16384;
protected:
- QResourceFileEnginePrivate() : offset(0) { }
+ ~QResourceFileEnginePrivate()
+ {
+ if (mustUnmap)
+ unmapUncompressed_sys();
+ }
};
bool QResourceFileEngine::caseSensitive() const
@@ -1639,10 +1659,126 @@ void QResourceFileEnginePrivate::mapUncompressed()
Q_ASSERT(resource.compressionAlgorithm() == QResource::NoCompression);
if (!uncompressed.isNull())
return; // nothing to do
+
+ if (resource.uncompressedSize() >= RemapCompressedThreshold) {
+ if (mapUncompressed_sys())
+ return;
+ }
+
uncompressed = resource.uncompressedData();
uncompressed.detach();
}
+#if defined(MREMAP_MAYMOVE) && defined(MREMAP_DONTUNMAP)
+inline bool QResourcePrivate::mayRemapData(const QResource &resource)
+{
+ auto d = resource.d_func();
+
+ // assumptions from load():
+ // - d->related is not empty
+ // - the first item in d->related is the one with our data
+ // by current construction, it's also the only item
+ const QResourceRoot *root = d->related.at(0);
+
+ switch (root->type()) {
+ case QResourceRoot::Resource_Builtin:
+ return true; // always acceptable, memory is read-only
+ case QResourceRoot::Resource_Buffer:
+ return false; // never acceptable, memory is heap
+ case QResourceRoot::Resource_File:
+ break;
+ }
+
+ auto df = static_cast<const QDynamicFileResourceRoot *>(root);
+ return df->wasMemoryMapped();
+}
+#endif
+
+// Returns the page boundaries of where \a location is located in memory.
+static auto mappingBoundaries(const void *location, qsizetype size)
+{
+#ifdef Q_OS_WIN
+ auto getpagesize = [] {
+ SYSTEM_INFO sysinfo;
+ ::GetSystemInfo(&sysinfo);
+ return sysinfo.dwAllocationGranularity;
+ };
+#endif
+ struct R {
+ void *begin;
+ qsizetype size;
+ qptrdiff offset;
+ } r;
+
+ const quintptr pageMask = getpagesize() - 1;
+ quintptr data = quintptr(location);
+ quintptr begin = data & ~pageMask;
+ quintptr end = (data + size + pageMask) & ~pageMask;
+ r.begin = reinterpret_cast<void *>(begin);
+ r.size = end - begin;
+ r.offset = data & pageMask;
+ return r;
+}
+
+bool QResourceFileEnginePrivate::mapUncompressed_sys()
+{
+ auto r = mappingBoundaries(resource.data(), resource.uncompressedSize());
+ void *ptr = nullptr;
+
+#if defined(MREMAP_MAYMOVE) && defined(MREMAP_DONTUNMAP)
+ // Use MREMAP_MAYMOVE to tell the kernel to give us a new address and use
+ // MREMAP_DONTUNMAP (supported since kernel 5.7) to request that it create
+ // a new mapping of the same pages, instead of moving. We can only do that
+ // for pages that are read-only, otherwise the kernel replaces the source
+ // with pages full of nulls.
+ if (!QResourcePrivate::mayRemapData(resource))
+ return false;
+
+ ptr = mremap(r.begin, r.size, r.size, MREMAP_MAYMOVE | MREMAP_DONTUNMAP);
+ if (ptr == MAP_FAILED)
+ return false;
+
+ // Allow writing, which the documentation says we allow. This is safe
+ // because MREMAP_DONTUNMAP only works for private mappings.
+ if (mprotect(ptr, r.size, PROT_READ | PROT_WRITE) != 0) {
+ munmap(ptr, r.size);
+ return false;
+ }
+#elif defined(Q_OS_DARWIN)
+ mach_port_t self = mach_task_self();
+ vm_address_t addr = 0;
+ vm_address_t mask = 0;
+ bool anywhere = true;
+ bool copy = true;
+ vm_prot_t cur_prot = VM_PROT_READ | VM_PROT_WRITE;
+ vm_prot_t max_prot = VM_PROT_ALL;
+ kern_return_t res = vm_remap(self, &addr, r.size, mask, anywhere,
+ self, vm_address_t(r.begin), copy, &cur_prot,
+ &max_prot, VM_INHERIT_DEFAULT);
+ if (res != KERN_SUCCESS)
+ return false;
+
+ ptr = reinterpret_cast<void *>(addr);
+ if ((max_prot & VM_PROT_WRITE) == 0 || mprotect(ptr, r.size, PROT_READ | PROT_WRITE) != 0) {
+ munmap(ptr, r.size);
+ return false;
+ }
+#endif
+
+ if (!ptr)
+ return false;
+ const char *newdata = static_cast<char *>(ptr) + r.offset;
+ uncompressed = QByteArray::fromRawData(newdata, resource.uncompressedSize());
+ mustUnmap = true;
+ return true;
+}
+
+void QResourceFileEnginePrivate::unmapUncompressed_sys()
+{
+ auto r = mappingBoundaries(uncompressed.constBegin(), uncompressed.size());
+ QDynamicFileResourceRoot::unmap_sys(r.begin, r.size);
+}
+
#endif // !defined(QT_BOOTSTRAPPED)
QT_END_NAMESPACE
diff --git a/src/corelib/io/qstorageinfo_linux.cpp b/src/corelib/io/qstorageinfo_linux.cpp
index a9d46e7395..b4360f9164 100644
--- a/src/corelib/io/qstorageinfo_linux.cpp
+++ b/src/corelib/io/qstorageinfo_linux.cpp
@@ -13,6 +13,7 @@
#include <q20memory.h>
#include <sys/ioctl.h>
+#include <sys/stat.h>
#include <sys/statfs.h>
// so we don't have to #include <linux/fs.h>, which is known to cause conflicts
@@ -28,10 +29,29 @@
# define ST_RDONLY 0x0001 /* mount read-only */
#endif
+#if defined(Q_OS_ANDROID)
+// statx() is disabled on Android because quite a few systems
+// come with sandboxes that kill applications that make system calls outside a
+// whitelist and several Android vendors can't be bothered to update the list.
+# undef STATX_BASIC_STATS
+#endif
+
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
+namespace {
+struct AutoFileDescriptor
+{
+ int fd = -1;
+ AutoFileDescriptor(const QString &path, int mode = QT_OPEN_RDONLY)
+ : fd(qt_safe_open(QFile::encodeName(path), mode))
+ {}
+ ~AutoFileDescriptor() { if (fd >= 0) qt_safe_close(fd); }
+ operator int() const noexcept { return fd; }
+};
+}
+
// udev encodes the labels with ID_LABEL_FS_ENC which is done with
// blkid_encode_string(). Within this function some 1-byte utf-8
// characters not considered safe (e.g. '\' or ' ') are encoded as hex
@@ -79,6 +99,20 @@ static inline dev_t deviceIdForPath(const QString &device)
return st.st_dev;
}
+static inline quint64 mountIdForPath(int fd)
+{
+ if (fd < 0)
+ return 0;
+#if defined(STATX_BASIC_STATS) && defined(STATX_MNT_ID)
+ // STATX_MNT_ID was added in kernel v5.8
+ struct statx st;
+ int r = statx(fd, "", AT_EMPTY_PATH | AT_NO_AUTOMOUNT, STATX_MNT_ID, &st);
+ if (r == 0 && (st.stx_mask & STATX_MNT_ID))
+ return st.stx_mnt_id;
+#endif
+ return 0;
+}
+
static inline quint64 retrieveDeviceId(const QByteArray &device, quint64 deviceId = 0)
{
// major = 0 implies an anonymous block device, so we need to stat() the
@@ -129,10 +163,9 @@ static inline auto retrieveLabels()
return result;
}
-static std::optional<QString> retrieveLabelViaIoctl(const QString &path)
+static std::optional<QString> retrieveLabelViaIoctl(int fd)
{
// FS_IOC_GETFSLABEL was introduced in v4.18; previously it was btrfs-specific.
- int fd = qt_safe_open(QFile::encodeName(path).constData(), QT_OPEN_RDONLY);
if (fd < 0)
return std::nullopt;
@@ -140,15 +173,14 @@ static std::optional<QString> retrieveLabelViaIoctl(const QString &path)
// says) and the return code on success (0) does not indicate the length.
char label[FSLABEL_MAX] = {};
int r = ioctl(fd, FS_IOC_GETFSLABEL, &label);
- close(fd);
if (r < 0)
return std::nullopt;
return QString::fromUtf8(label);
}
-static inline QString retrieveLabel(const QStorageInfoPrivate &d, quint64 deviceId)
+static inline QString retrieveLabel(const QStorageInfoPrivate &d, int fd, quint64 deviceId)
{
- if (auto label = retrieveLabelViaIoctl(d.rootPath))
+ if (auto label = retrieveLabelViaIoctl(fd))
return *label;
deviceId = retrieveDeviceId(d.device, deviceId);
@@ -207,39 +239,51 @@ void QStorageInfoPrivate::doStat()
return;
}
- // We iterate over the /proc/self/mountinfo list backwards because then any
- // matching isParentOf must be the actual mount point because it's the most
- // recent mount on that path. Linux does allow mounting over non-empty
- // directories, such as in:
- // # mount | tail -2
- // tmpfs on /tmp/foo/bar type tmpfs (rw,relatime,inode64)
- // tmpfs on /tmp/foo type tmpfs (rw,relatime,inode64)
- //
- // We try to match the device ID in case there's a mount --move.
- // We can't *rely* on it because some filesystems like btrfs will assign
- // device IDs to subvolumes that aren't listed in /proc/self/mountinfo.
-
- const QString oldRootPath = std::exchange(rootPath, QString());
- const dev_t rootPathDevId = deviceIdForPath(oldRootPath);
MountInfo *best = nullptr;
- for (auto it = infos.rbegin(); it != infos.rend(); ++it) {
- if (!isParentOf(it->mountPoint, oldRootPath))
- continue;
- if (rootPathDevId == it->stDev) {
- // device ID matches; this is definitely the best option
- best = q20::to_address(it);
- break;
- }
- if (!best) {
- // if we can't find a device ID match, this parent path is probably
- // the correct one
+ AutoFileDescriptor fd(rootPath);
+ if (quint64 mntid = mountIdForPath(fd)) {
+ // We have the mount ID for this path, so find the matching line.
+ auto it = std::find_if(infos.begin(), infos.end(),
+ [mntid](const MountInfo &info) { return info.mntid == mntid; });
+ if (it != infos.end())
best = q20::to_address(it);
+ } else {
+ // We have failed to get the mount ID for this path, usually because
+ // the path cannot be open()ed by this user (e.g., /root), so we fall
+ // back to a string search.
+ // We iterate over the /proc/self/mountinfo list backwards because then any
+ // matching isParentOf must be the actual mount point because it's the most
+ // recent mount on that path. Linux does allow mounting over non-empty
+ // directories, such as in:
+ // # mount | tail -2
+ // tmpfs on /tmp/foo/bar type tmpfs (rw,relatime,inode64)
+ // tmpfs on /tmp/foo type tmpfs (rw,relatime,inode64)
+ //
+ // We try to match the device ID in case there's a mount --move.
+ // We can't *rely* on it because some filesystems like btrfs will assign
+ // device IDs to subvolumes that aren't listed in /proc/self/mountinfo.
+
+ const QString oldRootPath = std::exchange(rootPath, QString());
+ const dev_t rootPathDevId = deviceIdForPath(oldRootPath);
+ for (auto it = infos.rbegin(); it != infos.rend(); ++it) {
+ if (!isParentOf(it->mountPoint, oldRootPath))
+ continue;
+ if (rootPathDevId == it->stDev) {
+ // device ID matches; this is definitely the best option
+ best = q20::to_address(it);
+ break;
+ }
+ if (!best) {
+ // if we can't find a device ID match, this parent path is probably
+ // the correct one
+ best = q20::to_address(it);
+ }
}
}
if (best) {
auto stDev = best->stDev;
setFromMountInfo(std::move(*best));
- name = retrieveLabel(*this, stDev);
+ name = retrieveLabel(*this, fd, stDev);
}
}
@@ -250,11 +294,11 @@ QList<QStorageInfo> QStorageInfoPrivate::mountedVolumes()
return QList{root()};
std::optional<decltype(retrieveLabels())> labelMap;
- auto labelForDevice = [&labelMap](const QStorageInfoPrivate &d, quint64 devid) {
+ auto labelForDevice = [&labelMap](const QStorageInfoPrivate &d, int fd, quint64 devid) {
if (d.fileSystemType == "tmpfs")
return QString();
- if (auto label = retrieveLabelViaIoctl(d.rootPath))
+ if (auto label = retrieveLabelViaIoctl(fd))
return *label;
devid = retrieveDeviceId(d.device, devid);
@@ -271,15 +315,31 @@ QList<QStorageInfo> QStorageInfoPrivate::mountedVolumes()
};
QList<QStorageInfo> volumes;
- for (MountInfo &info : infos) {
+ volumes.reserve(infos.size());
+ for (auto it = infos.begin(); it != infos.end(); ++it) {
+ MountInfo &info = *it;
+ AutoFileDescriptor fd(info.mountPoint);
+
+ // find out if the path as we see it matches this line from mountinfo
+ quint64 mntid = mountIdForPath(fd);
+ if (mntid == 0) {
+ // statx failed, so scan the later lines to see if any is a parent
+ // to this
+ auto isParent = [&info](const MountInfo &maybeParent) {
+ return isParentOf(maybeParent.mountPoint, info.mountPoint);
+ };
+ if (std::find_if(it + 1, infos.end(), isParent) != infos.end())
+ continue;
+ } else if (mntid != info.mntid) {
+ continue;
+ }
+
const auto infoStDev = info.stDev;
QStorageInfoPrivate d(std::move(info));
d.retrieveVolumeInfo();
if (d.bytesTotal <= 0 && d.rootPath != u'/')
continue;
- if (infoStDev != deviceIdForPath(d.rootPath))
- continue; // probably something mounted over this mountpoint
- d.name = labelForDevice(d, infoStDev);
+ d.name = labelForDevice(d, fd, infoStDev);
volumes.emplace_back(QStorageInfo(*new QStorageInfoPrivate(std::move(d))));
}
return volumes;
diff --git a/src/corelib/io/qstorageinfo_linux_p.h b/src/corelib/io/qstorageinfo_linux_p.h
index 6f5e107ec6..ae6c1a3859 100644
--- a/src/corelib/io/qstorageinfo_linux_p.h
+++ b/src/corelib/io/qstorageinfo_linux_p.h
@@ -93,7 +93,7 @@ static QByteArray parseMangledPath(QByteArrayView path)
}
// Indexes into the "fields" std::array in parseMountInfo()
-// static constexpr short MountId = 0;
+static constexpr short MountId = 0;
// static constexpr short ParentId = 1;
static constexpr short DevNo = 2;
static constexpr short FsRoot = 3;
@@ -199,6 +199,13 @@ doParseMountInfo(const QByteArray &mountinfo, FilterMountInfo filter = FilterMou
tokenizeLine(fields, line);
MountInfo info;
+ if (auto r = qstrntoll(fields[MountId].data(), fields[MountId].size(), 10); r.ok()) {
+ info.mntid = r.result;
+ } else {
+ checkField({});
+ continue;
+ }
+
QByteArray mountP = parseMangledPath(fields[MountPoint]);
if (!checkField(mountP))
continue;
diff --git a/src/corelib/io/qstorageinfo_p.h b/src/corelib/io/qstorageinfo_p.h
index 3af4b81ca4..3b049cdfd4 100644
--- a/src/corelib/io/qstorageinfo_p.h
+++ b/src/corelib/io/qstorageinfo_p.h
@@ -69,6 +69,7 @@ public:
QByteArray device;
QByteArray fsRoot;
dev_t stDev = 0;
+ quint64 mntid = 0;
};
void setFromMountInfo(MountInfo &&info)
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 4360b5b076..1e285bb36b 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -1014,8 +1014,9 @@ inline bool QUrlPrivate::setScheme(const QString &value, qsizetype len, bool doS
inline void QUrlPrivate::setAuthority(const QString &auth, qsizetype from, qsizetype end, QUrl::ParsingMode mode)
{
sectionIsPresent &= ~Authority;
- sectionIsPresent |= Host;
port = -1;
+ if (from == end && !auth.isNull())
+ sectionIsPresent |= Host; // empty but not null authority implies host
// we never actually _loop_
while (from != end) {
@@ -1155,8 +1156,11 @@ inline void QUrlPrivate::setQuery(const QString &value, qsizetype from, qsizetyp
inline void QUrlPrivate::appendHost(QString &appendTo, QUrl::FormattingOptions options) const
{
- if (host.isEmpty())
+ if (host.isEmpty()) {
+ if ((sectionIsPresent & Host) && appendTo.isNull())
+ appendTo.detach();
return;
+ }
if (host.at(0).unicode() == '[') {
// IPv6 addresses might contain a zone-id which needs to be recoded
if (options != 0)
@@ -1274,7 +1278,9 @@ QUrlPrivate::setHost(const QString &value, qsizetype from, qsizetype iend, QUrl:
const qsizetype len = end - begin;
host.clear();
- sectionIsPresent |= Host;
+ sectionIsPresent &= ~Host;
+ if (!value.isNull() || (sectionIsPresent & Authority))
+ sectionIsPresent |= Host;
if (len == 0)
return true;
@@ -2029,11 +2035,6 @@ void QUrl::setAuthority(const QString &authority, ParsingMode mode)
}
d->setAuthority(authority, 0, authority.size(), mode);
- if (authority.isNull()) {
- // QUrlPrivate::setAuthority cleared almost everything
- // but it leaves the Host bit set
- d->sectionIsPresent &= ~QUrlPrivate::Authority;
- }
}
/*!
@@ -2297,8 +2298,7 @@ void QUrl::setHost(const QString &host, ParsingMode mode)
}
if (d->setHost(data, 0, data.size(), mode)) {
- if (host.isNull())
- d->sectionIsPresent &= ~QUrlPrivate::Host;
+ return;
} else if (!data.startsWith(u'[')) {
// setHost failed, it might be IPv6 or IPvFuture in need of bracketing
Q_ASSERT(d->error);
@@ -2311,6 +2311,7 @@ void QUrl::setHost(const QString &host, ParsingMode mode)
// source data contains ':', so it's an IPv6 error
d->error->code = QUrlPrivate::InvalidIPv6AddressError;
}
+ d->sectionIsPresent &= ~QUrlPrivate::Host;
} else {
// succeeded
d->clearError();
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index cd29f2fcc2..216db3b42a 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -288,6 +288,9 @@ void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data)
\brief The QPersistentModelIndex class is used to locate data in a data model.
\ingroup model-view
+ \compares strong
+ \compareswith strong QModelIndex
+ \endcompareswith
A QPersistentModelIndex is a model index that can be stored by an
application, and later used to access information in a model.
@@ -375,45 +378,53 @@ QPersistentModelIndex::~QPersistentModelIndex()
}
/*!
- Returns \c{true} if this persistent model index is equal to the \a other
- persistent model index; otherwise returns \c{false}.
+ \fn bool QPersistentModelIndex::operator==(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs)
+ Returns \c{true} if \a lhs persistent model index is equal to the \a rhs
+ persistent model index; otherwise returns \c{false}.
- The internal data pointer, row, column, and model values in the persistent
- model index are used when comparing with another persistent model index.
+ The internal data pointer, row, column, and model values in the persistent
+ model index are used when comparing with another persistent model index.
*/
-bool QPersistentModelIndex::operator==(const QPersistentModelIndex &other) const noexcept
+/*!
+ \fn bool QPersistentModelIndex::operator!=(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs)
+ \since 4.2
+
+ Returns \c{true} if \a lhs persistent model index is not equal to the \a rhs
+ persistent model index; otherwise returns \c{false}.
+*/
+bool comparesEqual(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs) noexcept
{
- if (d && other.d)
- return d->index == other.d->index;
- return d == other.d;
+ if (lhs.d && rhs.d)
+ return lhs.d->index == rhs.d->index;
+ return lhs.d == rhs.d;
}
/*!
+ \fn bool QPersistentModelIndex::operator<(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs)
\since 4.1
- Returns \c{true} if this persistent model index is smaller than the \a other
+ Returns \c{true} if \a lhs persistent model index is smaller than the \a rhs
persistent model index; otherwise returns \c{false}.
The internal data pointer, row, column, and model values in the persistent
model index are used when comparing with another persistent model index.
*/
-
-bool QPersistentModelIndex::operator<(const QPersistentModelIndex &other) const noexcept
+Qt::strong_ordering compareThreeWay(const QPersistentModelIndex &lhs,
+ const QPersistentModelIndex &rhs) noexcept
{
- if (d && other.d)
- return d->index < other.d->index;
+ if (lhs.d && rhs.d)
+ return compareThreeWay(lhs.d->index, rhs.d->index);
- return std::less<>{}(d, other.d);
+ using Qt::totally_ordered_wrapper;
+ return compareThreeWay(totally_ordered_wrapper{lhs.d}, totally_ordered_wrapper{rhs.d});
}
-/*!
- \fn bool QPersistentModelIndex::operator!=(const QPersistentModelIndex &other) const
- \since 4.2
-
- Returns \c{true} if this persistent model index is not equal to the \a
- other persistent model index; otherwise returns \c{false}.
-*/
+Qt::strong_ordering compareThreeWay(const QPersistentModelIndex &lhs,
+ const QModelIndex &rhs) noexcept
+{
+ return compareThreeWay(lhs.d ? lhs.d->index : QModelIndex{}, rhs);
+}
/*!
Sets the persistent model index to refer to the same item in a model
@@ -470,32 +481,26 @@ QPersistentModelIndex::operator QModelIndex() const
}
/*!
- Returns \c{true} if this persistent model index refers to the same location as
- the \a other model index; otherwise returns \c{false}.
+ \fn bool QPersistentModelIndex::operator==(const QPersistentModelIndex &lhs, const QModelIndex &rhs)
+ Returns \c{true} if \a lhs persistent model index refers to the same location as
+ the \a rhs model index; otherwise returns \c{false}.
The internal data pointer, row, column, and model values in the persistent
model index are used when comparing with another model index.
-*/
-
-bool QPersistentModelIndex::operator==(const QModelIndex &other) const noexcept
-{
- if (d)
- return d->index == other;
- return !other.isValid();
-}
+ */
/*!
- \fn bool QPersistentModelIndex::operator!=(const QModelIndex &other) const
+ \fn bool QPersistentModelIndex::operator!=(const QPersistentModelIndex &lhs, const QModelIndex &rhs)
- Returns \c{true} if this persistent model index does not refer to the same
- location as the \a other model index; otherwise returns \c{false}.
+ Returns \c{true} if \a lhs persistent model index does not refer to the same
+ location as the \a rhs model index; otherwise returns \c{false}.
*/
-bool QPersistentModelIndex::operator!=(const QModelIndex &other) const noexcept
+bool comparesEqual(const QPersistentModelIndex &lhs, const QModelIndex &rhs) noexcept
{
- if (d)
- return d->index != other;
- return other.isValid();
+ if (lhs.d)
+ return lhs.d->index == rhs;
+ return !rhs.isValid();
}
/*!
@@ -1158,6 +1163,7 @@ void QAbstractItemModel::resetInternalData()
\ingroup model-view
+ \compares strong
This class is used as an index into item models derived from
QAbstractItemModel. The index is used by item views, delegates, and
@@ -1328,24 +1334,22 @@ void QAbstractItemModel::resetInternalData()
*/
/*!
- \fn bool QModelIndex::operator==(const QModelIndex &other) const
+ \fn bool QModelIndex::operator==(const QModelIndex &lhs, const QModelIndex &rhs)
- Returns \c{true} if this model index refers to the same location as the
- \a other model index; otherwise returns \c{false}.
+ Returns \c{true} if \a lhs model index refers to the same location as the
+ \a rhs model index; otherwise returns \c{false}.
The internal data pointer, row, column, and model values are used when
comparing with another model index.
*/
-
/*!
- \fn bool QModelIndex::operator!=(const QModelIndex &other) const
+ \fn bool QModelIndex::operator!=(const QModelIndex &lhs, const QModelIndex &rhs)
- Returns \c{true} if this model index does not refer to the same location as
- the \a other model index; otherwise returns \c{false}.
+ Returns \c{true} if \a lhs model index does not refer to the same location as
+ the \a rhs model index; otherwise returns \c{false}.
*/
-
/*!
\fn QModelIndex QModelIndex::parent() const
@@ -4124,10 +4128,10 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
*/
/*!
- \fn bool QModelIndex::operator<(const QModelIndex &other) const
+ \fn bool QModelIndex::operator<(const QModelIndex &lhs, const QModelIndex &rhs)
\since 4.1
- Returns \c{true} if this model index is smaller than the \a other
+ Returns \c{true} if \a lhs model index is smaller than the \a rhs
model index; otherwise returns \c{false}.
The less than calculation is not directly useful to developers - the way that indexes
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h
index 8f22f14989..418fc6b864 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.h
+++ b/src/corelib/itemmodels/qabstractitemmodel.h
@@ -5,11 +5,14 @@
#ifndef QABSTRACTITEMMODEL_H
#define QABSTRACTITEMMODEL_H
+#include <QtCore/qcompare.h>
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
#include <QtCore/qobject.h>
#include <QtCore/qvariant.h>
+#include <tuple>
+
QT_REQUIRE_CONFIG(itemmodel);
QT_BEGIN_NAMESPACE
@@ -138,19 +141,16 @@ public:
inline QVariant data(int role = Qt::DisplayRole) const;
inline void multiData(QModelRoleDataSpan roleDataSpan) const;
inline Qt::ItemFlags flags() const;
- constexpr inline const QAbstractItemModel *model() const noexcept { return m; }
+ constexpr inline const QAbstractItemModel *model() const noexcept { return m.get(); }
constexpr inline bool isValid() const noexcept { return (r >= 0) && (c >= 0) && (m != nullptr); }
- constexpr inline bool operator==(const QModelIndex &other) const noexcept
- { return (other.r == r) && (other.i == i) && (other.c == c) && (other.m == m); }
- constexpr inline bool operator!=(const QModelIndex &other) const noexcept
- { return !(*this == other); }
- constexpr inline bool operator<(const QModelIndex &other) const noexcept
- {
- return r < other.r
- || (r == other.r && (c < other.c
- || (c == other.c && (i < other.i
- || (i == other.i && std::less<const QAbstractItemModel *>()(m, other.m))))));
- }
+
+private:
+ constexpr auto asTuple() const noexcept { return std::tie(r, c, i, m); }
+ friend constexpr bool comparesEqual(const QModelIndex &lhs, const QModelIndex &rhs) noexcept
+ { return lhs.asTuple() == rhs.asTuple(); }
+ friend constexpr Qt::strong_ordering compareThreeWay(const QModelIndex &lhs, const QModelIndex &rhs) noexcept
+ { return QtOrderingPrivate::compareThreeWayMulti(lhs.asTuple(), rhs.asTuple()); }
+ Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(QModelIndex)
private:
inline QModelIndex(int arow, int acolumn, const void *ptr, const QAbstractItemModel *amodel) noexcept
: r(arow), c(acolumn), i(reinterpret_cast<quintptr>(ptr)), m(amodel) {}
@@ -158,7 +158,7 @@ private:
: r(arow), c(acolumn), i(id), m(amodel) {}
int r, c;
quintptr i;
- const QAbstractItemModel *m;
+ Qt::totally_ordered_wrapper<const QAbstractItemModel *> m;
};
Q_DECLARE_TYPEINFO(QModelIndex, Q_RELOCATABLE_TYPE);
@@ -178,17 +178,21 @@ public:
QPersistentModelIndex(const QModelIndex &index);
QPersistentModelIndex(const QPersistentModelIndex &other);
~QPersistentModelIndex();
+#if QT_CORE_REMOVED_SINCE(6, 8)
bool operator<(const QPersistentModelIndex &other) const noexcept;
bool operator==(const QPersistentModelIndex &other) const noexcept;
inline bool operator!=(const QPersistentModelIndex &other) const noexcept
{ return !operator==(other); }
+#endif
QPersistentModelIndex &operator=(const QPersistentModelIndex &other);
inline QPersistentModelIndex(QPersistentModelIndex &&other) noexcept
: d(std::exchange(other.d, nullptr)) {}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPersistentModelIndex)
void swap(QPersistentModelIndex &other) noexcept { qt_ptr_swap(d, other.d); }
+#if QT_CORE_REMOVED_SINCE(6, 8)
bool operator==(const QModelIndex &other) const noexcept;
bool operator!=(const QModelIndex &other) const noexcept;
+#endif
QPersistentModelIndex &operator=(const QModelIndex &other);
operator QModelIndex() const;
int row() const;
@@ -208,6 +212,18 @@ private:
friend size_t qHash(const QPersistentModelIndex &, size_t seed) noexcept;
friend bool qHashEquals(const QPersistentModelIndex &a, const QPersistentModelIndex &b) noexcept
{ return a.d == b.d; }
+ friend Q_CORE_EXPORT bool
+ comparesEqual(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs) noexcept;
+ friend Q_CORE_EXPORT bool
+ comparesEqual(const QPersistentModelIndex &lhs, const QModelIndex &rhs) noexcept;
+ friend Q_CORE_EXPORT Qt::strong_ordering // ### Qt 7: partial_ordering?
+ compareThreeWay(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs) noexcept;
+ friend Q_CORE_EXPORT Qt::strong_ordering // ### Qt 7: partial_ordering?
+ compareThreeWay(const QPersistentModelIndex &lhs, const QModelIndex &rhs) noexcept;
+#if !QT_CORE_REMOVED_SINCE(6, 8)
+ Q_DECLARE_STRONGLY_ORDERED(QPersistentModelIndex)
+ Q_DECLARE_STRONGLY_ORDERED(QPersistentModelIndex, QModelIndex)
+#endif
#ifndef QT_NO_DEBUG_STREAM
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &);
#endif
diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h
index c4b8dadc97..aaf32e68ef 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.h
+++ b/src/corelib/itemmodels/qitemselectionmodel.h
@@ -77,7 +77,7 @@ private:
friend bool comparesEqual(const QItemSelectionRange &lhs,
const QItemSelectionRange &rhs) noexcept
{
- return (lhs.tl == rhs.tl && lhs.br == rhs.br);
+ return comparesEqual(lhs.tl, rhs.tl) && comparesEqual(lhs.br, rhs.br);
}
Q_DECLARE_EQUALITY_COMPARABLE(QItemSelectionRange)
QPersistentModelIndex tl, br;
diff --git a/src/corelib/kernel/qapplicationstatic.h b/src/corelib/kernel/qapplicationstatic.h
index bf5e79b8bf..345a880748 100644
--- a/src/corelib/kernel/qapplicationstatic.h
+++ b/src/corelib/kernel/qapplicationstatic.h
@@ -11,6 +11,10 @@
#include <new>
+#if 0
+#pragma qt_class(QApplicationStatic)
+#endif
+
QT_BEGIN_NAMESPACE
namespace QtGlobalStatic {
diff --git a/src/corelib/kernel/qcore_foundation.mm b/src/corelib/kernel/qcore_foundation.mm
index a31040944f..6d2451e078 100644
--- a/src/corelib/kernel/qcore_foundation.mm
+++ b/src/corelib/kernel/qcore_foundation.mm
@@ -300,8 +300,8 @@ QUuid QUuid::fromCFUUID(CFUUIDRef uuid)
*/
CFUUIDRef QUuid::toCFUUID() const
{
- const QByteArray bytes = toRfc4122();
- return CFUUIDCreateFromUUIDBytes(0, *reinterpret_cast<const CFUUIDBytes *>(bytes.constData()));
+ const auto bytes = toBytes();
+ return CFUUIDCreateFromUUIDBytes(0, *reinterpret_cast<const CFUUIDBytes *>(&bytes));
}
/*!
@@ -333,8 +333,11 @@ QUuid QUuid::fromNSUUID(const NSUUID *uuid)
*/
NSUUID *QUuid::toNSUUID() const
{
- const QByteArray bytes = toRfc4122();
- return [[[NSUUID alloc] initWithUUIDBytes:*reinterpret_cast<const uuid_t *>(bytes.constData())] autorelease];
+ const auto bytes = toBytes();
+ static_assert(sizeof bytes == sizeof(uuid_t));
+ uuid_t u;
+ memcpy(&u, &bytes, sizeof(uuid_t));
+ return [[[NSUUID alloc] initWithUUIDBytes:u] autorelease];
}
// ----------------------------------------------------------------------------
diff --git a/src/corelib/kernel/qcore_mac.mm b/src/corelib/kernel/qcore_mac.mm
index 54c4373aed..00b0d078d7 100644
--- a/src/corelib/kernel/qcore_mac.mm
+++ b/src/corelib/kernel/qcore_mac.mm
@@ -541,7 +541,7 @@ QMacRootLevelAutoReleasePool::QMacRootLevelAutoReleasePool()
if (qEnvironmentVariableIsSet(ROOT_LEVEL_POOL_DISABLE_SWITCH))
return;
- pool.reset(new QMacAutoReleasePool);
+ pool.emplace();
[[[ROOT_LEVEL_POOL_MARKER alloc] init] autorelease];
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index e63c320805..5ecf8072f4 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -19,6 +19,8 @@
#include <QtCore/qoperatingsystemversion.h>
+#include <optional>
+
#ifdef Q_OS_MACOS
#include <mach/port.h>
struct mach_header;
@@ -48,7 +50,6 @@ kern_return_t IOObjectRelease(io_object_t object);
#endif
#include "qstring.h"
-#include "qscopedpointer.h"
#include "qpair.h"
#if defined( __OBJC__) && defined(QT_NAMESPACE)
@@ -129,7 +130,7 @@ public:
Q_NODISCARD_CTOR QMacRootLevelAutoReleasePool();
~QMacRootLevelAutoReleasePool();
private:
- QScopedPointer<QMacAutoReleasePool> pool;
+ std::optional<QMacAutoReleasePool> pool = std::nullopt;
};
#endif
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index bd00f69c1c..a494369c5d 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -3251,7 +3251,7 @@ void QCoreApplication::installNativeEventFilter(QAbstractNativeEventFilter *filt
*/
void QCoreApplication::removeNativeEventFilter(QAbstractNativeEventFilter *filterObject)
{
- QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance();
+ QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance(QCoreApplicationPrivate::theMainThread.loadAcquire());
if (!filterObject || !eventDispatcher)
return;
eventDispatcher->removeNativeEventFilter(filterObject);
diff --git a/src/corelib/kernel/qelapsedtimer.cpp b/src/corelib/kernel/qelapsedtimer.cpp
index 511b81a04e..c4308a0b8f 100644
--- a/src/corelib/kernel/qelapsedtimer.cpp
+++ b/src/corelib/kernel/qelapsedtimer.cpp
@@ -14,6 +14,8 @@ QT_BEGIN_NAMESPACE
\reentrant
\ingroup tools
+ \compares strong
+
The QElapsedTimer class is usually used to quickly calculate how much
time has elapsed between two events. Its API is similar to that of QTime,
so code that was using that can be ported quickly to the new class.
@@ -155,8 +157,7 @@ QT_BEGIN_NAMESPACE
Returns \c true if \a lhs and \a rhs contain different times, false otherwise.
*/
/*!
- \fn bool operator<(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept
- \relates QElapsedTimer
+ \fn bool QElapsedTimer::operator<(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept
Returns \c true if \a lhs was started before \a rhs, false otherwise.
diff --git a/src/corelib/kernel/qelapsedtimer.h b/src/corelib/kernel/qelapsedtimer.h
index 7d8b889f61..e71573456d 100644
--- a/src/corelib/kernel/qelapsedtimer.h
+++ b/src/corelib/kernel/qelapsedtimer.h
@@ -4,6 +4,7 @@
#ifndef QELAPSEDTIMER_H
#define QELAPSEDTIMER_H
+#include <QtCore/qcompare.h>
#include <QtCore/qglobal.h>
#include <chrono>
@@ -45,15 +46,41 @@ public:
Duration durationTo(const QElapsedTimer &other) const noexcept;
qint64 msecsTo(const QElapsedTimer &other) const noexcept;
qint64 secsTo(const QElapsedTimer &other) const noexcept;
-
- friend bool operator==(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept
- { return lhs.t1 == rhs.t1 && lhs.t2 == rhs.t2; }
- friend bool operator!=(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept
- { return !(lhs == rhs); }
-
friend bool Q_CORE_EXPORT operator<(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept;
private:
+ friend bool comparesEqual(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept
+ {
+ return lhs.t1 == rhs.t1 && lhs.t2 == rhs.t2;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(QElapsedTimer)
+
+ friend Qt::strong_ordering compareThreeWay(const QElapsedTimer &lhs,
+ const QElapsedTimer &rhs) noexcept
+ {
+ return Qt::compareThreeWay(lhs.t1, rhs.t1);
+ }
+
+#if defined(__cpp_lib_three_way_comparison)
+ friend std::strong_ordering
+ operator<=>(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept
+ {
+ return compareThreeWay(lhs, rhs);
+ }
+#else
+ friend bool operator>(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept
+ {
+ return is_gt(compareThreeWay(lhs, rhs));
+ }
+ friend bool operator<=(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept
+ {
+ return is_lteq(compareThreeWay(lhs, rhs));
+ }
+ friend bool operator>=(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept
+ {
+ return is_gteq(compareThreeWay(lhs, rhs));
+ }
+#endif // defined(__cpp_lib_three_way_comparison)
qint64 t1 = Q_INT64_C(0x8000000000000000);
qint64 t2 = Q_INT64_C(0x8000000000000000);
};
diff --git a/src/corelib/kernel/qjniarray.h b/src/corelib/kernel/qjniarray.h
index 976b4e92e3..2ea82e39db 100644
--- a/src/corelib/kernel/qjniarray.h
+++ b/src/corelib/kernel/qjniarray.h
@@ -18,7 +18,7 @@ QT_BEGIN_NAMESPACE
template <typename T> class QJniArray;
template <typename T>
-struct QJniArrayIterator
+struct QT_TECH_PREVIEW_API QJniArrayIterator
{
QJniArrayIterator() = default;
@@ -86,7 +86,7 @@ private:
{}
};
-class QJniArrayBase
+class QT_TECH_PREVIEW_API QJniArrayBase
{
// for SFINAE'ing out the fromContainer named constructor
template <typename Container, typename = void> struct CanConvertHelper : std::false_type {};
@@ -193,7 +193,7 @@ private:
};
template <typename T>
-class QJniArray : public QJniArrayBase
+class QT_TECH_PREVIEW_API QJniArray : public QJniArrayBase
{
friend struct QJniArrayIterator<T>;
public:
diff --git a/src/corelib/kernel/qjniobject.cpp b/src/corelib/kernel/qjniobject.cpp
index 8244a4390f..d5b0cd5663 100644
--- a/src/corelib/kernel/qjniobject.cpp
+++ b/src/corelib/kernel/qjniobject.cpp
@@ -34,19 +34,10 @@ using namespace Qt::StringLiterals;
\sa QJniEnvironment
- \section1 General Notes
-
- \list
- \li Class names need to be fully-qualified, for example: \c "java/lang/String".
- \li Method signatures are written as \c "(ArgumentsTypes)ReturnType", see \l {JNI Types}.
- \li All object types are returned as a QJniObject.
- \endlist
-
\section1 Method Signatures
QJniObject provides convenience functions that will use the correct signature based on the
- provided template types. For functions that only return and take \l {JNI types}, the
- signature can be generate at compile time:
+ provided or deduced template arguments.
\code
jint x = QJniObject::callMethod<jint>("getSize");
@@ -54,13 +45,11 @@ using namespace Qt::StringLiterals;
jint ret = jString1.callMethod<jint>("compareToIgnoreCase", jString2.object<jstring>());
\endcode
- These functions are variadic templates, and the compiler will deduce the template arguments
- from the actual argument types. In many situations, only the return type needs to be provided
- explicitly.
-
- For functions that take other argument types, you need to supply the signature yourself. It is
- important that the signature matches the function you want to call. The example below
- demonstrates how to call different static functions:
+ These functions are variadic templates, and the compiler will deduce the
+ signature from the actual argument types. Only the return type needs to be
+ provided explicitly. QJniObject can deduce the signature string for
+ functions that take \l {JNI types}, and for types that have been declared
+ with the QtJniTypes type mapping.
\code
// Java class
@@ -73,6 +62,31 @@ using namespace Qt::StringLiterals;
}
\endcode
+ \code
+ // C++ code
+ Q_DECLARE_JNI_CLASS(TestClass, "org/qtproject/qt/TestClass")
+
+ // ...
+ using namespace QtJniTypes;
+ TestClass testClass = TestClass::callStaticMethod<TestClass>("create");
+ \endcode
+
+ This allows working with arbitrary Java and Android types in C++ code, without having to
+ create JNI signature strings explicitly.
+
+ \section2 Explicit JNI Signatures
+
+ It is possible to supply the signature yourself. In that case, it is important
+ that the signature matches the function you want to call.
+
+ \list
+ \li Class names need to be fully-qualified, for example: \c "java/lang/String".
+ \li Method signatures are written as \c "(ArgumentsTypes)ReturnType", see \l {JNI Types}.
+ \li All object types are returned as a QJniObject.
+ \endlist
+
+ The example below demonstrates how to call different static functions:
+
The signature structure is \c "(ArgumentsTypes)ReturnType". Array types in the signature
must have the \c {[} prefix, and the fully-qualified \c Object type names must have the
\c L prefix and the \c ; suffix. The signature for the \c create function is
@@ -105,9 +119,9 @@ using namespace Qt::StringLiterals;
// C++ code
QJniObject string1 = QJniObject::fromString("String1");
QJniObject string2 = QJniObject::fromString("String2");
- QJniObject stringArray = QJniObject::callStaticObjectMethod<jstringArray>(
+ QJniObject stringArray = QJniObject::callStaticObjectMethod<jobjectArray>(
"org/qtproject/qt/TestClass",
- "stringArray"
+ "stringArray",
string1.object<jstring>(),
string2.object<jstring>());
\endcode
diff --git a/src/corelib/kernel/qjniobject.h b/src/corelib/kernel/qjniobject.h
index 589f6489f7..707d1ae28a 100644
--- a/src/corelib/kernel/qjniobject.h
+++ b/src/corelib/kernel/qjniobject.h
@@ -670,7 +670,7 @@ inline bool operator!=(const QJniObject &obj1, const QJniObject &obj2)
}
namespace QtJniTypes {
-struct JObjectBase
+struct QT_TECH_PREVIEW_API JObjectBase
{
operator QJniObject() const { return m_object; }
@@ -695,7 +695,7 @@ protected:
};
template<typename Type>
-class JObject : public JObjectBase
+class QT_TECH_PREVIEW_API JObject : public JObjectBase
{
public:
using Class = Type;
diff --git a/src/corelib/kernel/qjnitypes.h b/src/corelib/kernel/qjnitypes.h
index 1eaae6312b..033445be6a 100644
--- a/src/corelib/kernel/qjnitypes.h
+++ b/src/corelib/kernel/qjnitypes.h
@@ -11,6 +11,7 @@
QT_BEGIN_NAMESPACE
+// QT_TECH_PREVIEW_API
#define Q_DECLARE_JNI_TYPE_HELPER(Type) \
namespace QtJniTypes { \
struct Type : JObject<Type> \
@@ -19,19 +20,19 @@ struct Type : JObject<Type> \
}; \
} \
-
+// QT_TECH_PREVIEW_API
#define Q_DECLARE_JNI_TYPE(Type, Signature) \
Q_DECLARE_JNI_TYPE_HELPER(Type) \
template<> \
struct QtJniTypes::Traits<QtJniTypes::Type> { \
static constexpr auto signature() \
{ \
- static_assert((Signature[0] == 'L' \
- || Signature[0] == '[') \
- && Signature[sizeof(Signature) - 2] == ';', \
+ constexpr QtJniTypes::CTString sig(Signature); \
+ static_assert((sig.startsWith('L') || sig.startsWith("[L")) \
+ && sig.endsWith(';'), \
"Type signature needs to start with 'L' or" \
- " '[' and end with ';'"); \
- return QtJniTypes::CTString(Signature); \
+ " '[L', and end with ';'"); \
+ return sig; \
} \
}; \
@@ -176,7 +177,6 @@ va_##Method(JNIEnv *env, jclass thiz, ...)
}, argTuple); \
} \
-
#define Q_DECLARE_JNI_NATIVE_METHOD(...) \
QT_OVERLOADED_MACRO(QT_DECLARE_JNI_NATIVE_METHOD, __VA_ARGS__) \
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 148983f126..05662b385a 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -3656,8 +3656,8 @@ QMetaProperty::QMetaProperty(const QMetaObject *mobj, int index)
data(getMetaPropertyData(mobj, index))
{
Q_ASSERT(index >= 0 && index < priv(mobj->d.data)->propertyCount);
-
- if (!(data.flags() & EnumOrFlag))
+ // The code below here just resolves menum if the property is an enum type:
+ if (!(data.flags() & EnumOrFlag) || !metaType().flags().testFlag(QMetaType::IsEnumeration))
return;
QByteArrayView enum_name = typeNameFromTypeInfo(mobj, data.type());
menum = mobj->enumerator(QMetaObjectPrivate::indexOfEnumerator(mobj, enum_name));
diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h
index d2c36fceb4..d5dc9a356a 100644
--- a/src/corelib/kernel/qmetaobject_p.h
+++ b/src/corelib/kernel/qmetaobject_p.h
@@ -111,22 +111,18 @@ public:
const_cast<QArgumentType *>(this)->_name = QMetaType(_type).name();
return _name;
}
- bool operator==(const QArgumentType &other) const
- {
- if (_type && other._type)
- return _type == other._type;
- else
- return name() == other.name();
- }
- bool operator!=(const QArgumentType &other) const
+
+private:
+ friend bool comparesEqual(const QArgumentType &lhs,
+ const QArgumentType &rhs) noexcept
{
- if (_type && other._type)
- return _type != other._type;
+ if (lhs._type && rhs._type)
+ return lhs._type == rhs._type;
else
- return name() != other.name();
+ return lhs.name() == rhs.name();
}
+ Q_DECLARE_EQUALITY_COMPARABLE(QArgumentType)
-private:
int _type;
QByteArray _name;
};
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 387c0f49ab..1c2665e53c 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -474,6 +474,7 @@ const char *QtMetaTypePrivate::typedefNameForType(const QtPrivate::QMetaTypeInte
\ingroup objectmodel
\threadsafe
+ \compares equality
The class is used as a helper to marshall types in QVariant and
in queued signals and slots connections. It associates a type
@@ -925,20 +926,20 @@ void QMetaType::unregisterMetaType(QMetaType type)
Returns the QMetaType corresponding to the type in the template parameter.
*/
-/*! \fn bool QMetaType::operator==(QMetaType a, QMetaType b)
+/*! \fn bool QMetaType::operator==(const QMetaType &lhs, const QMetaType &rhs)
\since 5.15
\overload
- Returns \c true if the QMetaType \a a represents the same type
- as the QMetaType \a b, otherwise returns \c false.
+ Returns \c true if the QMetaType \a lhs represents the same type
+ as the QMetaType \a rhs, otherwise returns \c false.
*/
-/*! \fn bool QMetaType::operator!=(QMetaType a, QMetaType b)
+/*! \fn bool QMetaType::operator!=(const QMetaType &lhs, const QMetaType &rhs)
\since 5.15
\overload
- Returns \c true if the QMetaType \a a represents a different type
- than the QMetaType \a b, otherwise returns \c false.
+ Returns \c true if the QMetaType \a lhs represents a different type
+ than the QMetaType \a rhs, otherwise returns \c false.
*/
/*! \internal */
@@ -2659,6 +2660,36 @@ bool QMetaType::hasRegisteredConverterFunction(QMetaType fromType, QMetaType toT
}
/*!
+ \internal
+ Non-template helper ("SCARY") for IsMetaTypePair::registerConverter().
+*/
+bool QtPrivate::hasRegisteredConverterFunctionToPairVariantInterface(QMetaType m)
+{
+ const QMetaType to = QMetaType::fromType<QtMetaTypePrivate::QPairVariantInterfaceImpl>();
+ return QMetaType::hasRegisteredConverterFunction(m, to);
+}
+
+/*!
+ \internal
+ Non-template helper ("SCARY") for SequentialValueTypeIsMetaType::registerConverter().
+*/
+bool QtPrivate::hasRegisteredConverterFunctionToIterableMetaSequence(QMetaType m)
+{
+ const QMetaType to = QMetaType::fromType<QIterable<QMetaSequence>>();
+ return QMetaType::hasRegisteredConverterFunction(m, to);
+}
+
+/*!
+ \internal
+ Non-template helper ("SCARY") for AssociativeKeyTypeIsMetaType::registerConverter().
+*/
+bool QtPrivate::hasRegisteredConverterFunctionToIterableMetaAssociation(QMetaType m)
+{
+ const QMetaType to = QMetaType::fromType<QIterable<QMetaAssociation>>();
+ return QMetaType::hasRegisteredConverterFunction(m, to);
+}
+
+/*!
\fn template<typename From, typename To> bool QMetaType::hasRegisteredMutableViewFunction()
Returns \c true, if the meta type system has a registered mutable view on type From of type To.
\since 6.0
@@ -2676,6 +2707,26 @@ bool QMetaType::hasRegisteredMutableViewFunction(QMetaType fromType, QMetaType t
}
/*!
+ \internal
+ Non-template helper ("SCARY") for SequentialValueTypeIsMetaType::registerMutableView().
+*/
+bool QtPrivate::hasRegisteredMutableViewFunctionToIterableMetaSequence(QMetaType m)
+{
+ const QMetaType to = QMetaType::fromType<QIterable<QMetaSequence>>();
+ return QMetaType::hasRegisteredMutableViewFunction(m, to);
+}
+
+/*!
+ \internal
+ Non-template helper ("SCARY") for AssociativeKeyTypeIsMetaType::registerMutableView().
+*/
+bool QtPrivate::hasRegisteredMutableViewFunctionToIterableMetaAssociation(QMetaType m)
+{
+ const QMetaType to = QMetaType::fromType<QIterable<QMetaAssociation>>();
+ return QMetaType::hasRegisteredMutableViewFunction(m, to);
+}
+
+/*!
\fn const char *QMetaType::typeName(int typeId)
\deprecated
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index e3ef1474da..12a67aef58 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -518,20 +518,20 @@ public:
template<typename T>
constexpr static QMetaType fromType();
static QMetaType fromName(QByteArrayView name);
-
- friend bool operator==(QMetaType a, QMetaType b)
+private:
+ friend bool comparesEqual(const QMetaType &lhs,
+ const QMetaType &rhs) noexcept
{
- if (a.d_ptr == b.d_ptr)
+ if (lhs.d_ptr == rhs.d_ptr)
return true;
- if (!a.d_ptr || !b.d_ptr)
+ if (!lhs.d_ptr || !rhs.d_ptr)
return false; // one type is undefined, the other is defined
// avoid id call if we already have the id
- const int aId = a.id();
- const int bId = b.id();
+ const int aId = lhs.id();
+ const int bId = rhs.id();
return aId == bId;
}
- friend bool operator!=(QMetaType a, QMetaType b) { return !(a == b); }
-
+ Q_DECLARE_EQUALITY_COMPARABLE(QMetaType)
#ifndef QT_NO_DEBUG_STREAM
private:
friend Q_CORE_EXPORT QDebug operator<<(QDebug d, QMetaType m);
@@ -1750,11 +1750,19 @@ QT_FOR_EACH_STATIC_TYPE(Q_DECLARE_BUILTIN_METATYPE)
QT_BEGIN_NAMESPACE
+namespace QtPrivate {
+// out-of-line helpers to reduce template code bloat ("SCARY") and improve compile times:
+Q_CORE_EXPORT bool hasRegisteredConverterFunctionToPairVariantInterface(QMetaType m);
+Q_CORE_EXPORT bool hasRegisteredConverterFunctionToIterableMetaSequence(QMetaType m);
+Q_CORE_EXPORT bool hasRegisteredMutableViewFunctionToIterableMetaSequence(QMetaType m);
+Q_CORE_EXPORT bool hasRegisteredConverterFunctionToIterableMetaAssociation(QMetaType m);
+Q_CORE_EXPORT bool hasRegisteredMutableViewFunctionToIterableMetaAssociation(QMetaType m);
+}
+
template <typename T>
inline bool QtPrivate::IsMetaTypePair<T, true>::registerConverter()
{
- const QMetaType to = QMetaType::fromType<QtMetaTypePrivate::QPairVariantInterfaceImpl>();
- if (!QMetaType::hasRegisteredConverterFunction(QMetaType::fromType<T>(), to)) {
+ if (!QtPrivate::hasRegisteredConverterFunctionToPairVariantInterface(QMetaType::fromType<T>())) {
QtMetaTypePrivate::QPairVariantInterfaceConvertFunctor<T> o;
return QMetaType::registerConverter<T, QtMetaTypePrivate::QPairVariantInterfaceImpl>(o);
}
@@ -1786,8 +1794,7 @@ struct SequentialValueTypeIsMetaType<T, true>
{
static bool registerConverter()
{
- const QMetaType to = QMetaType::fromType<QIterable<QMetaSequence>>();
- if (!QMetaType::hasRegisteredConverterFunction(QMetaType::fromType<T>(), to)) {
+ if (!QtPrivate::hasRegisteredConverterFunctionToIterableMetaSequence(QMetaType::fromType<T>())) {
QSequentialIterableConvertFunctor<T> o;
return QMetaType::registerConverter<T, QIterable<QMetaSequence>>(o);
}
@@ -1796,8 +1803,7 @@ struct SequentialValueTypeIsMetaType<T, true>
static bool registerMutableView()
{
- const QMetaType to = QMetaType::fromType<QIterable<QMetaSequence>>();
- if (!QMetaType::hasRegisteredMutableViewFunction(QMetaType::fromType<T>(), to)) {
+ if (!QtPrivate::hasRegisteredMutableViewFunctionToIterableMetaSequence(QMetaType::fromType<T>())) {
QSequentialIterableMutableViewFunctor<T> o;
return QMetaType::registerMutableView<T, QIterable<QMetaSequence>>(o);
}
@@ -1830,8 +1836,7 @@ struct AssociativeKeyTypeIsMetaType<T, true> : AssociativeMappedTypeIsMetaType<T
{
static bool registerConverter()
{
- const QMetaType to = QMetaType::fromType<QIterable<QMetaAssociation>>();
- if (!QMetaType::hasRegisteredConverterFunction(QMetaType::fromType<T>(), to)) {
+ if (!QtPrivate::hasRegisteredConverterFunctionToIterableMetaAssociation(QMetaType::fromType<T>())) {
QAssociativeIterableConvertFunctor<T> o;
return QMetaType::registerConverter<T, QIterable<QMetaAssociation>>(o);
}
@@ -1840,8 +1845,7 @@ struct AssociativeKeyTypeIsMetaType<T, true> : AssociativeMappedTypeIsMetaType<T
static bool registerMutableView()
{
- const QMetaType to = QMetaType::fromType<QIterable<QMetaAssociation>>();
- if (!QMetaType::hasRegisteredMutableViewFunction(QMetaType::fromType<T>(), to)) {
+ if (!QtPrivate::hasRegisteredMutableViewFunctionToIterableMetaAssociation(QMetaType::fromType<T>())) {
QAssociativeIterableMutableViewFunctor<T> o;
return QMetaType::registerMutableView<T, QIterable<QMetaAssociation>>(o);
}
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index e1129c5d25..31b779dc9b 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -4698,16 +4698,25 @@ QDebug operator<<(QDebug dbg, const QObject *o)
\sa {Qt's Property System}
*/
-
/*!
\macro Q_OBJECT
\relates QObject
- The Q_OBJECT macro must appear in the private section of a class
- definition that declares its own signals and slots or that uses
- other services provided by Qt's meta-object system.
+ The Q_OBJECT macro is used to enable meta-object features, such as dynamic
+ properties, signals, and slots.
- For example:
+ You can add the Q_OBJECT macro to any section of a class definition that
+ declares its own signals and slots or that uses other services provided by
+ Qt's meta-object system.
+
+//! [qobject-macros-private-access-specifier]
+ \note This macro expansion ends with a \c private: access specifier. If you
+ declare members immediately after this macro, those members will also be
+ private. To add public (or protected) members right after the macro, use a
+ \c {public:} (or \c {protected:}) access specifier.
+//! [qobject-macros-private-access-specifier]
+
+ Example:
\snippet signalsandslots/signalsandslots.h 1
\codeline
@@ -4715,15 +4724,8 @@ QDebug operator<<(QDebug dbg, const QObject *o)
\snippet signalsandslots/signalsandslots.h 3
\note This macro requires the class to be a subclass of QObject. Use
- Q_GADGET or Q_GADGET_EXPORT instead of Q_OBJECT to enable the meta object system's support
- for enums in a class that is not a QObject subclass.
-
-//! [qobject-macros-private-access-specifier]
- \note This macro expansion ends with a \c private: access specifier, which makes member
- declarations immediately after the macro private, too. If you want add public (or protected)
- members immediately after the macro, you need to use a \c public: (or \c protected:)
- access specifier.
-//! [qobject-macros-private-access-specifier]
+ Q_GADGET or Q_GADGET_EXPORT instead of Q_OBJECT to enable the meta object
+ system's support for enums in a class that is not a QObject subclass.
\sa {Meta-Object System}, {Signals and Slots}, {Qt's Property System}
*/
@@ -4734,8 +4736,9 @@ QDebug operator<<(QDebug dbg, const QObject *o)
The Q_GADGET macro is a lighter version of the Q_OBJECT macro for classes
that do not inherit from QObject but still want to use some of the
- reflection capabilities offered by QMetaObject. Just like the Q_OBJECT
- macro, it must appear in the private section of a class definition.
+ reflection capabilities offered by QMetaObject.
+
+ \include qobject.cpp qobject-macros-private-access-specifier
Q_GADGETs can have Q_ENUM, Q_PROPERTY and Q_INVOKABLE, but they cannot have
signals or slots.
@@ -4744,8 +4747,6 @@ QDebug operator<<(QDebug dbg, const QObject *o)
\c{staticMetaObject} is of type QMetaObject and provides access to the
enums declared with Q_ENUM.
- \include qobject.cpp qobject-macros-private-access-specifier
-
\sa Q_GADGET_EXPORT
*/
@@ -4761,6 +4762,8 @@ QDebug operator<<(QDebug dbg, const QObject *o)
enclosing class as a whole should not be (e.g. because it consists of mostly
inline functions).
+ \include qobject.cpp qobject-macros-private-access-specifier
+
For example:
\code
@@ -4771,8 +4774,6 @@ QDebug operator<<(QDebug dbg, const QObject *o)
~~~
\endcode
- \include qobject.cpp qobject-macros-private-access-specifier
-
\sa Q_GADGET, {Creating Shared Libraries}
*/
diff --git a/src/corelib/kernel/qpointer.h b/src/corelib/kernel/qpointer.h
index 39e4ba3e0f..8875eef5c3 100644
--- a/src/corelib/kernel/qpointer.h
+++ b/src/corelib/kernel/qpointer.h
@@ -4,6 +4,7 @@
#ifndef QPOINTER_H
#define QPOINTER_H
+#include <QtCore/qcompare.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qtypeinfo.h>
@@ -90,27 +91,21 @@ public:
friend void swap(QPointer &lhs, QPointer &rhs) noexcept
{ lhs.swap(rhs); }
-#define DECLARE_COMPARE_SET(T1, A1, T2, A2) \
- friend bool operator==(T1, T2) noexcept \
- { return A1 == A2; } \
- friend bool operator!=(T1, T2) noexcept \
- { return A1 != A2; }
-
-#define DECLARE_TEMPLATE_COMPARE_SET(T1, A1, T2, A2) \
- template <typename X> \
- friend bool operator==(T1, T2) noexcept \
- { return A1 == A2; } \
- template <typename X> \
- friend bool operator!=(T1, T2) noexcept \
- { return A1 != A2; }
-
- DECLARE_TEMPLATE_COMPARE_SET(const QPointer &p1, p1.data(), const QPointer<X> &p2, p2.data())
- DECLARE_TEMPLATE_COMPARE_SET(const QPointer &p1, p1.data(), X *ptr, ptr)
- DECLARE_TEMPLATE_COMPARE_SET(X *ptr, ptr, const QPointer &p2, p2.data())
- DECLARE_COMPARE_SET(const QPointer &p1, p1.data(), std::nullptr_t, nullptr)
- DECLARE_COMPARE_SET(std::nullptr_t, nullptr, const QPointer &p2, p2.data())
-#undef DECLARE_COMPARE_SET
-#undef DECLARE_TEMPLATE_COMPARE_SET
+private:
+ template <typename X>
+ friend bool comparesEqual(const QPointer &lhs, const QPointer<X> &rhs) noexcept
+ { return lhs.data() == rhs.data(); }
+ QT_DECLARE_EQUALITY_OPERATORS_HELPER(QPointer, QPointer<X>, /* non-constexpr */,
+ template <typename X>)
+
+ template <typename X>
+ friend bool comparesEqual(const QPointer &lhs, X *rhs) noexcept
+ { return lhs.data() == rhs; }
+ Q_DECLARE_EQUALITY_COMPARABLE(QPointer, X*, template <typename X>)
+
+ friend bool comparesEqual(const QPointer &lhs, std::nullptr_t) noexcept
+ { return lhs.data() == nullptr; }
+ Q_DECLARE_EQUALITY_COMPARABLE(QPointer, std::nullptr_t)
};
template <class T> Q_DECLARE_TYPEINFO_BODY(QPointer<T>, Q_RELOCATABLE_TYPE);
diff --git a/src/corelib/kernel/qpointer.qdoc b/src/corelib/kernel/qpointer.qdoc
index 9e4c9b2658..63a2a72e6f 100644
--- a/src/corelib/kernel/qpointer.qdoc
+++ b/src/corelib/kernel/qpointer.qdoc
@@ -8,6 +8,12 @@
\ingroup objectmodel
+ \compares equality
+ \compareswith equality QPointer<X> X* std::nullptr_t
+ Where X and T are compatible types, which means that they are either the same (except
+ for their cv-qualifiers), or one is a base type of the other.
+ \endcompareswith
+
A guarded pointer, QPointer<T>, behaves like a normal C++
pointer \c{T *}, except that it is automatically cleared when the
referenced object is destroyed (unlike normal C++ pointers, which
@@ -202,38 +208,38 @@
*/
/*!
- \fn template <typename T> template<typename X> bool QPointer<T>::operator==(X *o, const QPointer<T> &p)
+ \fn template <typename T> template<typename X> bool QPointer<T>::operator==(X* const &lhs, const QPointer<T> &rhs)
- Equality operator. Returns \c true if \a o and the guarded
- pointer \a p are pointing to the same object, otherwise
+ Equality operator. Returns \c true if \a lhs and the guarded
+ pointer \a rhs are pointing to the same object, otherwise
returns \c false.
*/
/*!
- \fn template <typename T> template<typename X> bool QPointer<T>::operator==(const QPointer<T> &p, X *o)
+ \fn template <typename T> template<typename X> bool QPointer<T>::operator==(const QPointer<T> &lhs, X* const &rhs)
- Equality operator. Returns \c true if \a o and the guarded
- pointer \a p are pointing to the same object, otherwise
+ Equality operator. Returns \c true if \a rhs and the guarded
+ pointer \a lhs are pointing to the same object, otherwise
returns \c false.
*/
/*!
- \fn template <typename T> template<typename X> bool QPointer<T>::operator==(const QPointer<T> &p1, const QPointer<X> &p2)
+ \fn template <typename T> template<typename X> bool QPointer<T>::operator==(const QPointer<T> &lhs, const QPointer<X> &rhs)
- Equality operator. Returns \c true if the guarded pointers \a p1 and \a p2
+ Equality operator. Returns \c true if the guarded pointers \a lhs and \a rhs
are pointing to the same object, otherwise
returns \c false.
*/
/*!
- \fn template <typename T> bool QPointer<T>::operator==(std::nullptr_t, const QPointer<T> &rhs)
+ \fn template <typename T> bool QPointer<T>::operator==(std::nullptr_t const &lhs, const QPointer<T> &rhs)
Equality operator. Returns \c true if the pointer guarded by \a rhs
is \nullptr, otherwise
returns \c false.
*/
/*!
- \fn template <typename T> bool QPointer<T>::operator==(const QPointer<T> &lhs, std::nullptr_t)
+ \fn template <typename T> bool QPointer<T>::operator==(const QPointer<T> &lhs, std::nullptr_t const &rhs)
Equality operator. Returns \c true if the pointer guarded by \a lhs
is \nullptr, otherwise
@@ -241,35 +247,35 @@
*/
/*!
- \fn template <typename T> template<typename X> bool QPointer<T>::operator!=(const QPointer<T> &p, X *o)
+ \fn template <typename T> template<typename X> bool QPointer<T>::operator!=(const QPointer<T> &lhs, X* const &rhs)
- Inequality operator. Returns \c true if \a o and the guarded
- pointer \a p are not pointing to the same object, otherwise
+ Inequality operator. Returns \c true if \a rhs and the guarded
+ pointer \a lhs are not pointing to the same object, otherwise
returns \c false.
*/
/*!
- \fn template <typename T> template<typename X> bool QPointer<T>::operator!=(X *o, const QPointer<T> &p)
+ \fn template <typename T> template<typename X> bool QPointer<T>::operator!=(X* const &lhs, const QPointer<T> &rhs)
- Inequality operator. Returns \c true if \a o and the guarded
- pointer \a p are not pointing to the same object, otherwise
+ Inequality operator. Returns \c true if \a lhs and the guarded
+ pointer \a rhs are not pointing to the same object, otherwise
returns \c false.
*/
/*!
- \fn template <typename T> template<typename X> bool QPointer<T>::operator!=(const QPointer<T> &p1, const QPointer<X> &p2)
+ \fn template <typename T> template<typename X> bool QPointer<T>::operator!=(const QPointer<T> &lhs, const QPointer<X> &rhs)
- Inequality operator. Returns \c true if the guarded pointers \a p1 and
- \a p2 are not pointing to the same object, otherwise
+ Inequality operator. Returns \c true if the guarded pointers \a lhs and
+ \a rhs are not pointing to the same object, otherwise
returns \c false.
*/
/*!
- \fn template <typename T> bool QPointer<T>::operator!=(std::nullptr_t, const QPointer<T> &rhs)
+ \fn template <typename T> bool QPointer<T>::operator!=(std::nullptr_t const &lhs, const QPointer<T> &rhs)
Inequality operator. Returns \c true if the pointer guarded by \a rhs is
a valid (ie not \nullptr) pointer, otherwise
returns \c false.
*/
/*!
- \fn template <typename T> bool QPointer<T>::operator!=(const QPointer<T> &lhs, std::nullptr_t)
+ \fn template <typename T> bool QPointer<T>::operator!=(const QPointer<T> &lhs, std::nullptr_t const &rhs)
Inequality operator. Returns \c true if the pointer guarded by \a lhs is
a valid (ie not \nullptr) pointer, otherwise
diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h
index 8ae6664a2b..376482a6af 100644
--- a/src/corelib/kernel/qproperty_p.h
+++ b/src/corelib/kernel/qproperty_p.h
@@ -19,12 +19,13 @@
#include <qproperty.h>
#include <qmetaobject.h>
-#include <qscopedpointer.h>
#include <qscopedvaluerollback.h>
#include <qvariant.h>
#include <vector>
#include <QtCore/QVarLengthArray>
+#include <memory>
+
QT_BEGIN_NAMESPACE
namespace QtPrivate {
@@ -292,7 +293,7 @@ private:
ObserverArray inlineDependencyObservers; // for things we are observing
QPropertyObserverPointer firstObserver; // list of observers observing us
- QScopedPointer<std::vector<QPropertyObserver>> heapObservers; // for things we are observing
+ std::unique_ptr<std::vector<QPropertyObserver>> heapObservers; // for things we are observing
protected:
QUntypedPropertyData *propertyDataPtr = nullptr;
diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h
index 86dc08a6bc..a8456721d0 100644
--- a/src/corelib/kernel/qpropertyprivate.h
+++ b/src/corelib/kernel/qpropertyprivate.h
@@ -95,28 +95,20 @@ public:
void swap(QPropertyBindingPrivatePtr &other) noexcept
{ qt_ptr_swap(d, other.d); }
- friend bool operator==(const QPropertyBindingPrivatePtr &p1, const QPropertyBindingPrivatePtr &p2) noexcept
- { return p1.d == p2.d; }
- friend bool operator!=(const QPropertyBindingPrivatePtr &p1, const QPropertyBindingPrivatePtr &p2) noexcept
- { return p1.d != p2.d; }
- friend bool operator==(const QPropertyBindingPrivatePtr &p1, const T *ptr) noexcept
- { return p1.d == ptr; }
- friend bool operator!=(const QPropertyBindingPrivatePtr &p1, const T *ptr) noexcept
- { return p1.d != ptr; }
- friend bool operator==(const T *ptr, const QPropertyBindingPrivatePtr &p2) noexcept
- { return ptr == p2.d; }
- friend bool operator!=(const T *ptr, const QPropertyBindingPrivatePtr &p2) noexcept
- { return ptr != p2.d; }
- friend bool operator==(const QPropertyBindingPrivatePtr &p1, std::nullptr_t) noexcept
- { return !p1; }
- friend bool operator!=(const QPropertyBindingPrivatePtr &p1, std::nullptr_t) noexcept
- { return p1; }
- friend bool operator==(std::nullptr_t, const QPropertyBindingPrivatePtr &p2) noexcept
- { return !p2; }
- friend bool operator!=(std::nullptr_t, const QPropertyBindingPrivatePtr &p2) noexcept
- { return p2; }
-
private:
+ friend bool comparesEqual(const QPropertyBindingPrivatePtr &lhs,
+ const QPropertyBindingPrivatePtr &rhs) noexcept
+ { return lhs.d == rhs.d; }
+ Q_DECLARE_EQUALITY_COMPARABLE(QPropertyBindingPrivatePtr)
+ friend bool comparesEqual(const QPropertyBindingPrivatePtr &lhs,
+ const T *rhs) noexcept
+ { return lhs.d == rhs; }
+ Q_DECLARE_EQUALITY_COMPARABLE(QPropertyBindingPrivatePtr, T*)
+ friend bool comparesEqual(const QPropertyBindingPrivatePtr &lhs,
+ std::nullptr_t) noexcept
+ { return !lhs; }
+ Q_DECLARE_EQUALITY_COMPARABLE(QPropertyBindingPrivatePtr, std::nullptr_t)
+
QtPrivate::RefCounted *d;
};
diff --git a/src/corelib/kernel/qsocketnotifier.h b/src/corelib/kernel/qsocketnotifier.h
index 8288a6b2b5..ac9e577ebc 100644
--- a/src/corelib/kernel/qsocketnotifier.h
+++ b/src/corelib/kernel/qsocketnotifier.h
@@ -83,20 +83,20 @@ public:
Q_DECL_CONSTEXPR_NOT_WIN bool isValid() const noexcept { return *this != QSocketDescriptor(); }
- friend Q_DECL_CONSTEXPR_NOT_WIN bool operator==(QSocketDescriptor lhs,
- QSocketDescriptor rhs) noexcept
+private:
+ friend Q_DECL_CONSTEXPR_NOT_WIN bool comparesEqual(const QSocketDescriptor &lhs,
+ const QSocketDescriptor &rhs) noexcept
{
return lhs.sockfd == rhs.sockfd;
}
- friend Q_DECL_CONSTEXPR_NOT_WIN bool operator!=(QSocketDescriptor lhs,
- QSocketDescriptor rhs) noexcept
- {
- return lhs.sockfd != rhs.sockfd;
- }
+#if defined(Q_OS_WIN) || defined(Q_QDOC)
+ Q_DECLARE_EQUALITY_COMPARABLE(QSocketDescriptor)
+#else
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QSocketDescriptor)
+#endif
#undef Q_DECL_CONSTEXPR_NOT_WIN
-private:
DescriptorType sockfd;
};
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index d567bcbb7c..306e5b3a38 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -497,6 +497,7 @@ public:
// If possible we reuse the current QVariant private.
if (isDetached() && d.type() == metaType) {
*reinterpret_cast<VT *>(const_cast<void *>(constData())) = std::forward<T>(avalue);
+ d.is_null = false;
} else {
*this = QVariant::fromValue<VT>(std::forward<T>(avalue));
}
diff --git a/src/corelib/mimetypes/mime/packages/freedesktop.org.xml b/src/corelib/mimetypes/mime/packages/freedesktop.org.xml
index b7aa6a1995..e77349a12e 100644
--- a/src/corelib/mimetypes/mime/packages/freedesktop.org.xml
+++ b/src/corelib/mimetypes/mime/packages/freedesktop.org.xml
@@ -10699,39 +10699,39 @@ command to generate the output files.
<glob pattern="*.udeb"/>
</mime-type>
<mime-type type="application/x-designer">
- <comment>Qt Designer interface document</comment>
- <comment xml:lang="zh_TW">Qt Designer 介面文件</comment>
- <comment xml:lang="zh_CN">Qt Designer 界面文档</comment>
- <comment xml:lang="uk">документ інтерфейсу Qt Designer</comment>
- <comment xml:lang="tr">Qt Designer arayüz belgesi</comment>
- <comment xml:lang="sv">Qt Designer-gränssnittsdokument</comment>
- <comment xml:lang="sq">dokument ndërfaqesh Qt Designer</comment>
- <comment xml:lang="sl">Dokument vmesnika Qt Designer</comment>
- <comment xml:lang="si">Qt Designer අතුරුමුහුණත් ලේඛනය</comment>
- <comment xml:lang="ru">Документ интерфейса Qt Designer</comment>
- <comment xml:lang="pt_BR">Documento de interface do Qt Designer</comment>
- <comment xml:lang="pt">documento de interface Qt Designer</comment>
- <comment xml:lang="pl">Dokument interfejsu Qt Designer</comment>
- <comment xml:lang="nl">Qt Designer-interfacedocument</comment>
+ <comment>Qt Widgets Designer interface document</comment>
+ <comment xml:lang="zh_TW">Qt Widgets Designer 介面文件</comment>
+ <comment xml:lang="zh_CN">Qt Widgets Designer 界面文档</comment>
+ <comment xml:lang="uk">документ інтерфейсу Qt Widgets Designer</comment>
+ <comment xml:lang="tr">Qt Widgets Designer arayüz belgesi</comment>
+ <comment xml:lang="sv">Qt Widgets Designer-gränssnittsdokument</comment>
+ <comment xml:lang="sq">dokument ndërfaqesh Qt Widgets Designer</comment>
+ <comment xml:lang="sl">Dokument vmesnika Qt Widgets Designer</comment>
+ <comment xml:lang="si">Qt Widgets Designer අතුරුමුහුණත් ලේඛනය</comment>
+ <comment xml:lang="ru">Документ интерфейса Qt Widgets Designer</comment>
+ <comment xml:lang="pt_BR">Documento de interface do Qt Widgets Designer</comment>
+ <comment xml:lang="pt">documento de interface Qt Widgets Designer</comment>
+ <comment xml:lang="pl">Dokument interfejsu Qt Widgets Designer</comment>
+ <comment xml:lang="nl">Qt Widgets Designer-interfacedocument</comment>
<comment xml:lang="ko">Qt 디자이너 인터페이스 문서</comment>
- <comment xml:lang="kk">Qt Designer интерфейс құжаты</comment>
- <comment xml:lang="ja">Qt Designer インターフェイスドキュメント</comment>
- <comment xml:lang="it">Documento interfaccia Qt Designer</comment>
- <comment xml:lang="is">Qt Designer viðmótsskjal</comment>
- <comment xml:lang="id">Dokumen antarmuka Qt Designer</comment>
- <comment xml:lang="hu">Qt Designer felületleíró dokumentum</comment>
- <comment xml:lang="hr">Qt Designer dokument sučelja</comment>
- <comment xml:lang="he">מסמך מנשק של Qt Designer</comment>
- <comment xml:lang="fr">document d'interface Qt Designer</comment>
- <comment xml:lang="fi">Qt Designer -käyttöliittymän asiakirja</comment>
- <comment xml:lang="eu">Qt Designer interfaze dokumentua</comment>
- <comment xml:lang="es">documento de interfaz de Qt Designer</comment>
- <comment xml:lang="en_GB">Qt Designer interface document</comment>
+ <comment xml:lang="kk">Qt Widgets Designer интерфейс құжаты</comment>
+ <comment xml:lang="ja">Qt Widgets Designer インターフェイスドキュメント</comment>
+ <comment xml:lang="it">Documento interfaccia Qt Widgets Designer</comment>
+ <comment xml:lang="is">Qt Widgets Designer viðmótsskjal</comment>
+ <comment xml:lang="id">Dokumen antarmuka Qt Widgets Designer</comment>
+ <comment xml:lang="hu">Qt Widgets Designer felületleíró dokumentum</comment>
+ <comment xml:lang="hr">Qt Widgets Designer dokument sučelja</comment>
+ <comment xml:lang="he">מסמך מנשק של Qt Widgets Designer</comment>
+ <comment xml:lang="fr">document d'interface Qt Widgets Designer</comment>
+ <comment xml:lang="fi">Qt Widgets Designer -käyttöliittymän asiakirja</comment>
+ <comment xml:lang="eu">Qt Widgets Designer interfaze dokumentua</comment>
+ <comment xml:lang="es">documento de interfaz de Qt Widgets Designer</comment>
+ <comment xml:lang="en_GB">Qt Widgets Designer interface document</comment>
<comment xml:lang="de">Qt-Designer-Oberflächendokument</comment>
- <comment xml:lang="da">Qt Designer-brugerflade-dokument</comment>
- <comment xml:lang="ca">document d'interfície Qt Designer</comment>
- <comment xml:lang="bg">Документ — интерфейс, Qt Designer</comment>
- <comment xml:lang="be">дакумент інтэрфейсу Qt Designer</comment>
+ <comment xml:lang="da">Qt Widgets Designer-brugerflade-dokument</comment>
+ <comment xml:lang="ca">document d'interfície Qt Widgets Designer</comment>
+ <comment xml:lang="bg">Документ — интерфейс, Qt Widgets Designer</comment>
+ <comment xml:lang="be">дакумент інтэрфейсу Qt Widgets Designer</comment>
<comment xml:lang="ar">مستند واجهة مصمم كيوت</comment>
<generic-icon name="x-office-document"/>
<sub-class-of type="application/xml"/>
diff --git a/src/corelib/platform/android/qandroidnativeinterface.cpp b/src/corelib/platform/android/qandroidnativeinterface.cpp
index fc3a09c78b..351893eb81 100644
--- a/src/corelib/platform/android/qandroidnativeinterface.cpp
+++ b/src/corelib/platform/android/qandroidnativeinterface.cpp
@@ -49,7 +49,7 @@ QT_DEFINE_NATIVE_INTERFACE(QAndroidApplication);
\fn QJniObject QNativeInterface::QAndroidApplication::context()
Returns the Android context as a \c QJniObject. The context is an \c Activity
- if the main activity object is valid. Otherwise, the context is a \c Service.
+ if the most recently started activity object is valid. Otherwise, the context is a \c Service.
\since 6.2
*/
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index 9c7216c3c5..b3fad47ee6 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -116,12 +116,12 @@ static QUuid _q_uuidFromHex(const char *src)
return QUuid();
}
-static QUuid createFromName(const QUuid &ns, const QByteArray &baseData, QCryptographicHash::Algorithm algorithm, int version)
+static QUuid createFromName(QUuid ns, QByteArrayView baseData, QCryptographicHash::Algorithm algorithm, int version) noexcept
{
- QCryptographicHash hash(algorithm);
- hash.addData(ns.toRfc4122());
- hash.addData(baseData);
- QByteArrayView hashResult = hash.resultView();
+ std::byte buffer[20];
+ Q_ASSERT(sizeof buffer >= size_t(QCryptographicHash::hashLength(algorithm)));
+ QByteArrayView hashResult
+ = QCryptographicHash::hashInto(buffer, {QByteArrayView{ns.toBytes()}, baseData}, algorithm);
Q_ASSERT(hashResult.size() >= 16);
hashResult.truncate(16); // Sha1 will be too long
@@ -142,6 +142,11 @@ static QUuid createFromName(const QUuid &ns, const QByteArray &baseData, QCrypto
\reentrant
+ \compares strong
+ \compareswith strong GUID
+ \note Comparison with GUID is Windows-only.
+ \endcompareswith
+
Using \e{U}niversally \e{U}nique \e{ID}entifiers (UUID) is a
standard way to uniquely identify entities in a distributed
computing environment. A UUID is a 16-byte (128-bit) number
@@ -527,11 +532,14 @@ QUuid QUuid::fromString(QAnyStringView text) noexcept
/*!
\since 5.0
- \fn QUuid QUuid::createUuidV3(const QUuid &ns, const QByteArray &baseData);
+ \fn QUuid QUuid::createUuidV3(QUuid ns, QByteArrayView baseData);
This function returns a new UUID with variant QUuid::DCE and version QUuid::Md5.
\a ns is the namespace and \a baseData is the basic data as described by RFC 4122.
+ \note In Qt versions prior to 6.8, this function took QByteArray, not
+ QByteArrayView.
+
\sa variant(), version(), createUuidV5()
*/
@@ -547,11 +555,14 @@ QUuid QUuid::fromString(QAnyStringView text) noexcept
/*!
\since 5.0
- \fn QUuid QUuid::createUuidV5(const QUuid &ns, const QByteArray &baseData);
+ \fn QUuid QUuid::createUuidV5(QUuid ns, QByteArrayView baseData);
This function returns a new UUID with variant QUuid::DCE and version QUuid::Sha1.
\a ns is the namespace and \a baseData is the basic data as described by RFC 4122.
+ \note In Qt versions prior to 6.8, this function took QByteArray, not
+ QByteArrayView.
+
\sa variant(), version(), createUuidV3()
*/
@@ -565,13 +576,13 @@ QUuid QUuid::fromString(QAnyStringView text) noexcept
\sa variant(), version(), createUuidV3()
*/
#ifndef QT_BOOTSTRAPPED
-QUuid QUuid::createUuidV3(const QUuid &ns, const QByteArray &baseData)
+QUuid QUuid::createUuidV3(QUuid ns, QByteArrayView baseData) noexcept
{
return createFromName(ns, baseData, QCryptographicHash::Md5, 3);
}
#endif
-QUuid QUuid::createUuidV5(const QUuid &ns, const QByteArray &baseData)
+QUuid QUuid::createUuidV5(QUuid ns, QByteArrayView baseData) noexcept
{
return createFromName(ns, baseData, QCryptographicHash::Sha1, 5);
}
@@ -600,16 +611,16 @@ QUuid QUuid::fromRfc4122(QByteArrayView bytes) noexcept
}
/*!
- \fn bool QUuid::operator==(const QUuid &other) const
+ \fn bool QUuid::operator==(const QUuid &lhs, const QUuid &rhs)
- Returns \c true if this QUuid and the \a other QUuid are identical;
+ Returns \c true if \a lhs QUuid and the \a rhs QUuid are identical;
otherwise returns \c false.
*/
/*!
- \fn bool QUuid::operator!=(const QUuid &other) const
+ \fn bool QUuid::operator!=(const QUuid &lhs, const QUuid &rhs)
- Returns \c true if this QUuid and the \a other QUuid are different;
+ Returns \c true if \a lhs QUuid and the \a rhs QUuid are different;
otherwise returns \c false.
*/
@@ -898,51 +909,31 @@ QUuid::Version QUuid::version() const noexcept
}
/*!
- \fn bool QUuid::operator<(const QUuid &other) const
+ \fn bool QUuid::operator<(const QUuid &lhs, const QUuid &rhs)
- Returns \c true if this QUuid has the same \l{Variant field}
- {variant field} as the \a other QUuid and is lexicographically
- \e{before} the \a other QUuid. If the \a other QUuid has a
+ Returns \c true if \a lhs QUuid has the same \l{Variant field}
+ {variant field} as the \a rhs QUuid and is lexicographically
+ \e{before} the \a rhs QUuid. If the \a rhs QUuid has a
different variant field, the return value is determined by
comparing the two \l{QUuid::Variant} {variants}.
\sa variant()
*/
-bool QUuid::operator<(const QUuid &other) const noexcept
-{
- if (variant() != other.variant())
- return variant() < other.variant();
-
-#define ISLESS(f1, f2) if (f1!=f2) return (f1<f2);
- ISLESS(data1, other.data1);
- ISLESS(data2, other.data2);
- ISLESS(data3, other.data3);
- for (int n = 0; n < 8; n++) {
- ISLESS(data4[n], other.data4[n]);
- }
-#undef ISLESS
- return false;
-}
/*!
- \fn bool QUuid::operator>(const QUuid &other) const
+ \fn bool QUuid::operator>(const QUuid &lhs, const QUuid &rhs)
- Returns \c true if this QUuid has the same \l{Variant field}
- {variant field} as the \a other QUuid and is lexicographically
- \e{after} the \a other QUuid. If the \a other QUuid has a
+ Returns \c true if \a lhs QUuid has the same \l{Variant field}
+ {variant field} as the \a rhs QUuid and is lexicographically
+ \e{after} the \a rhs QUuid. If the \a rhs QUuid has a
different variant field, the return value is determined by
comparing the two \l{QUuid::Variant} {variants}.
\sa variant()
*/
-bool QUuid::operator>(const QUuid &other) const noexcept
-{
- return other < *this;
-}
/*!
- \fn bool operator<=(const QUuid &lhs, const QUuid &rhs)
- \relates QUuid
+ \fn bool QUuid::operator<=(const QUuid &lhs, const QUuid &rhs)
\since 5.5
Returns \c true if \a lhs has the same \l{Variant field}
@@ -955,8 +946,7 @@ bool QUuid::operator>(const QUuid &other) const noexcept
*/
/*!
- \fn bool operator>=(const QUuid &lhs, const QUuid &rhs)
- \relates QUuid
+ \fn bool QUuid::operator>=(const QUuid &lhs, const QUuid &rhs)
\since 5.5
Returns \c true if \a lhs has the same \l{Variant field}
@@ -1009,17 +999,17 @@ QUuid QUuid::createUuid()
#endif // !Q_OS_WIN && !QT_BOOTSTRAPPED
/*!
- \fn bool QUuid::operator==(const GUID &guid) const
+ \fn bool QUuid::operator==(const QUuid &lhs, const GUID &rhs)
- Returns \c true if this UUID is equal to the Windows GUID \a guid;
+ Returns \c true if \a lhs UUID is equal to the Windows GUID \a rhs;
otherwise returns \c false.
*/
/*!
- \fn bool QUuid::operator!=(const GUID &guid) const
+ \fn bool QUuid::operator!=(const QUuid &lhs, const GUID &rhs)
- Returns \c true if this UUID is not equal to the Windows GUID \a
- guid; otherwise returns \c false.
+ Returns \c true if \a lhs UUID is not equal to the Windows GUID \a rhs;
+ otherwise returns \c false.
*/
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h
index 7125e8e2cc..591d9b27c4 100644
--- a/src/corelib/plugin/quuid.h
+++ b/src/corelib/plugin/quuid.h
@@ -4,6 +4,7 @@
#ifndef QUUID_H
#define QUUID_H
+#include <QtCore/qcompare.h>
#include <QtCore/qendian.h>
#include <QtCore/qstring.h>
@@ -122,27 +123,60 @@ QT_WARNING_POP
constexpr quint128 toUInt128(QSysInfo::Endian order = QSysInfo::BigEndian) const noexcept;
#endif
- constexpr bool operator==(const QUuid &orig) const noexcept
+private:
+ friend constexpr bool comparesEqual(const QUuid &lhs, const QUuid &rhs) noexcept
{
- if (data1 != orig.data1 || data2 != orig.data2 ||
- data3 != orig.data3)
+ if (lhs.data1 != rhs.data1 || lhs.data2 != rhs.data2 || lhs.data3 != rhs.data3)
return false;
- for (uint i = 0; i < 8; i++)
- if (data4[i] != orig.data4[i])
+ for (uint i = 0; i < 8; i++) {
+ if (lhs.data4[i] != rhs.data4[i])
return false;
+ }
return true;
}
+ friend Qt::strong_ordering compareThreeWay(const QUuid &lhs, const QUuid &rhs) noexcept
+ {
+ if (lhs.variant() != rhs.variant())
+ return Qt::compareThreeWay(lhs.variant(), rhs.variant());
+ if (lhs.data1 != rhs.data1)
+ return Qt::compareThreeWay(lhs.data1, rhs.data1);
+ if (lhs.data2 != rhs.data2)
+ return Qt::compareThreeWay(lhs.data2, rhs.data2);
+ if (lhs.data3 != rhs.data3)
+ return Qt::compareThreeWay(lhs.data3, rhs.data3);
+
+ int c = std::memcmp(lhs.data4, rhs.data4, sizeof(lhs.data4));
+ return Qt::compareThreeWay(c, 0);
+ }
+
+public:
+/* To prevent a meta-type creation ambiguity on Windows, we put comparison
+ macros under NOT QT_CORE_REMOVED_SINCE(6, 8) part. */
+#if QT_CORE_REMOVED_SINCE(6, 8)
+ constexpr bool operator==(const QUuid &orig) const noexcept
+ {
+ return comparesEqual(*this, orig);
+ }
constexpr bool operator!=(const QUuid &orig) const noexcept
{
- return !(*this == orig);
+ return !operator==(orig);
}
bool operator<(const QUuid &other) const noexcept;
bool operator>(const QUuid &other) const noexcept;
-
+#else
+private:
+#if defined(__cpp_lib_three_way_comparison) && !defined(Q_QDOC)
+ QT_DECLARE_3WAY_HELPER_STRONG(QUuid, QUuid, /* non-constexpr */, /* no attributes */)
+#else
+ QT_DECLARE_ORDERING_HELPER_STRONG(QUuid, QUuid, /* non-constexpr */, /* no attributes */)
+#endif // defined(__cpp_lib_three_way_comparison) && !defined(Q_QDOC)
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QUuid)
+#endif // QT_CORE_REMOVED_SINCE(6, 8)
+public:
#if defined(Q_OS_WIN) || defined(Q_QDOC)
// On Windows we have a type GUID that is used by the platform API, so we
// provide convenience operators to cast from and to this type.
@@ -162,32 +196,51 @@ QT_WARNING_POP
GUID guid = { data1, data2, data3, { data4[0], data4[1], data4[2], data4[3], data4[4], data4[5], data4[6], data4[7] } };
return guid;
}
-
+private:
+ friend constexpr bool comparesEqual(const QUuid &lhs, const GUID &rhs) noexcept
+ {
+ return comparesEqual(lhs, QUuid(rhs));
+ }
+public:
+/* To prevent a meta-type creation ambiguity on Windows, we put comparison
+ macros under NOT QT_CORE_REMOVED_SINCE(6, 8) part. */
+#if QT_CORE_REMOVED_SINCE(6, 8)
constexpr bool operator==(const GUID &guid) const noexcept
{
- return *this == QUuid(guid);
+ return comparesEqual(*this, QUuid(guid));
}
constexpr bool operator!=(const GUID &guid) const noexcept
{
- return !(*this == guid);
+ return !operator==(guid);
}
+#else
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QUuid, GUID)
+#endif // !QT_CORE_REMOVED_SINCE(6, 8)
#endif
+public:
static QUuid createUuid();
-#ifndef QT_BOOTSTRAPPED
- static QUuid createUuidV3(const QUuid &ns, const QByteArray &baseData);
+#if QT_CORE_REMOVED_SINCE(6, 8)
+ static QUuid createUuidV3(const QUuid &ns, const QByteArray &baseData) noexcept;
+ static QUuid createUuidV5(const QUuid &ns, const QByteArray &baseData) noexcept;
#endif
- static QUuid createUuidV5(const QUuid &ns, const QByteArray &baseData);
+ static QUuid createUuidV5(QUuid ns, QByteArrayView baseData) noexcept;
#ifndef QT_BOOTSTRAPPED
+ static QUuid createUuidV3(QUuid ns, QByteArrayView baseData) noexcept;
+#if !QT_CORE_REMOVED_SINCE(6, 8)
+ Q_WEAK_OVERLOAD
+#endif
static inline QUuid createUuidV3(const QUuid &ns, const QString &baseData)
{
- return QUuid::createUuidV3(ns, baseData.toUtf8());
+ return QUuid::createUuidV3(ns, qToByteArrayViewIgnoringNull(baseData.toUtf8()));
}
#endif
-
+#if !QT_CORE_REMOVED_SINCE(6, 8)
+ Q_WEAK_OVERLOAD
+#endif
static inline QUuid createUuidV5(const QUuid &ns, const QString &baseData)
{
- return QUuid::createUuidV5(ns, baseData.toUtf8());
+ return QUuid::createUuidV5(ns, qToByteArrayViewIgnoringNull(baseData.toUtf8()));
}
QUuid::Variant variant() const noexcept;
@@ -291,11 +344,6 @@ constexpr quint128 QUuid::toUInt128(QSysInfo::Endian order) const noexcept
}
#endif
-inline bool operator<=(const QUuid &lhs, const QUuid &rhs) noexcept
-{ return !(rhs < lhs); }
-inline bool operator>=(const QUuid &lhs, const QUuid &rhs) noexcept
-{ return !(lhs < rhs); }
-
#if defined(Q_QDOC)
// provide fake declarations of qXXXEndian() functions, so that qDoc could
// distinguish them from the general template
diff --git a/src/corelib/serialization/qdatastream.cpp b/src/corelib/serialization/qdatastream.cpp
index 6dcc0890e3..329be4a294 100644
--- a/src/corelib/serialization/qdatastream.cpp
+++ b/src/corelib/serialization/qdatastream.cpp
@@ -1090,6 +1090,7 @@ QDataStream &QDataStream::readBytes(char *&s, qint64 &l)
qsizetype allocated = 0;
std::unique_ptr<char[]> curBuf = nullptr;
+ constexpr qsizetype StepIncreaseThreshold = std::numeric_limits<qsizetype>::max() / 2;
do {
qsizetype blockSize = qMin(step, len - allocated);
const qsizetype n = allocated + blockSize + 1;
@@ -1098,7 +1099,8 @@ QDataStream &QDataStream::readBytes(char *&s, qint64 &l)
if (readBlock(curBuf.get() + allocated, blockSize) != blockSize)
return *this;
allocated += blockSize;
- step *= 2;
+ if (step <= StepIncreaseThreshold)
+ step *= 2;
} while (allocated < len);
s = curBuf.release();
diff --git a/src/corelib/text/qanystringview.h b/src/corelib/text/qanystringview.h
index 01efd83743..843fa7e5c9 100644
--- a/src/corelib/text/qanystringview.h
+++ b/src/corelib/text/qanystringview.h
@@ -62,10 +62,13 @@ private:
};
template <typename Char>
- using if_compatible_char = std::enable_if_t<std::disjunction_v<
+ using is_compatible_char = std::disjunction<
QtPrivate::IsCompatibleCharType<Char>,
QtPrivate::IsCompatibleChar8Type<Char>
- >, bool>;
+ >;
+
+ template <typename Char>
+ using if_compatible_char = std::enable_if_t<is_compatible_char<Char>::value, bool>;
template <typename Pointer>
using if_compatible_pointer = std::enable_if_t<std::disjunction_v<
@@ -87,6 +90,7 @@ private:
std::is_same<q20::remove_cvref_t<T>, QAnyStringView::Tag>,
std::is_same<q20::remove_cvref_t<T>, QAnyStringView>, // don't make a copy/move ctor
std::is_pointer<std::decay_t<T>>, // const char*, etc
+ is_compatible_char<T>, // don't create a QString/QByteArray, we have a ctor
std::is_same<q20::remove_cvref_t<T>, QByteArray>,
std::is_same<q20::remove_cvref_t<T>, QString>
>>,
@@ -144,6 +148,11 @@ private:
static QChar toQChar(QChar ch) noexcept { return ch; }
static QChar toQChar(QLatin1Char ch) noexcept { return ch; }
+ struct QCharContainer { // private, so users can't pass their own
+ explicit QCharContainer() = default;
+ QChar ch;
+ };
+
explicit constexpr QAnyStringView(const void *d, qsizetype n, std::size_t sizeAndType) noexcept
: m_data{d}, m_size{std::size_t(n) | (sizeAndType & TypeMask)} {}
public:
@@ -193,16 +202,16 @@ public:
constexpr QAnyStringView(Container &&c, QtPrivate::wrapped_t<Container, QByteArray> &&capacity = {})
//noexcept(std::is_nothrow_constructible_v<QByteArray, Container>)
: QAnyStringView(capacity = std::forward<Container>(c)) {}
-
template <typename Char, if_compatible_char<Char> = true>
constexpr QAnyStringView(const Char &c) noexcept
: QAnyStringView{&c, 1} {}
- constexpr QAnyStringView(const QChar &c) noexcept
- : QAnyStringView{&c, 1} {}
+ template <typename Char, if_convertible_to<QChar, Char> = true>
+ constexpr QAnyStringView(Char ch, QCharContainer &&capacity = QCharContainer()) noexcept
+ : QAnyStringView{&(capacity.ch = ch), 1} {}
template <typename Char, typename Container = decltype(QChar::fromUcs4(U'x')),
std::enable_if_t<std::is_same_v<Char, char32_t>, bool> = true>
- constexpr QAnyStringView(Char c, Container &&capacity = {})
+ constexpr QAnyStringView(Char c, Container &&capacity = {}) noexcept
: QAnyStringView(capacity = QChar::fromUcs4(c)) {}
constexpr QAnyStringView(QStringView v) noexcept
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp
index e6387e4bed..d9f0ee405a 100644
--- a/src/corelib/text/qbytearray.cpp
+++ b/src/corelib/text/qbytearray.cpp
@@ -56,15 +56,35 @@ static constexpr inline uchar asciiLower(uchar c)
return c >= 'A' && c <= 'Z' ? c | 0x20 : c;
}
-qsizetype qFindByteArray(
- const char *haystack0, qsizetype haystackLen, qsizetype from,
- const char *needle0, qsizetype needleLen);
-
/*****************************************************************************
Safe and portable C string functions; extensions to standard string.h
*****************************************************************************/
/*! \relates QByteArray
+ \internal
+
+ Wrapper around memrchr() for systems that don't have it. It's provided in
+ every system because, as a GNU extension, memrchr() may not be declared in
+ string.h depending on how strict the compiler was asked to be.
+
+ Used in QByteArrayView::lastIndexOf() overload for a single char.
+*/
+const void *qmemrchr(const void *s, int needle, size_t size) noexcept
+{
+#if QT_CONFIG(memrchr)
+ return memrchr(s, needle, size);
+#endif
+ auto b = static_cast<const char *>(s);
+ const char *n = b + size;
+ while (n-- != b) {
+ if (*n == needle)
+ return n;
+ }
+ return nullptr;
+}
+
+
+/*! \relates QByteArray
Returns a duplicate string.
@@ -2680,31 +2700,6 @@ QByteArray QByteArray::repeated(qsizetype times) const
return result;
}
-#define REHASH(a) \
- if (ol_minus_1 < sizeof(std::size_t) * CHAR_BIT) \
- hashHaystack -= std::size_t(a) << ol_minus_1; \
- hashHaystack <<= 1
-
-qsizetype QtPrivate::findByteArray(QByteArrayView haystack, qsizetype from, QByteArrayView needle) noexcept
-{
- const auto ol = needle.size();
- const auto l = haystack.size();
- if (ol == 0) {
- if (from < 0)
- return qMax(from + l, 0);
- else
- return from > l ? -1 : from;
- }
-
- if (ol == 1)
- return findByteArray(haystack, from, needle.front());
-
- if (from > l || ol + from > l)
- return -1;
-
- return qFindByteArray(haystack.data(), haystack.size(), from, needle.data(), ol);
-}
-
/*! \fn qsizetype QByteArray::indexOf(QByteArrayView bv, qsizetype from) const
\since 6.0
@@ -2745,10 +2740,10 @@ static qsizetype lastIndexOfHelper(const char *haystack, qsizetype l, const char
const char *end = haystack;
haystack += from;
- const auto ol_minus_1 = std::size_t(ol - 1);
+ const qregisteruint ol_minus_1 = ol - 1;
const char *n = needle + ol_minus_1;
const char *h = haystack + ol_minus_1;
- std::size_t hashNeedle = 0, hashHaystack = 0;
+ qregisteruint hashNeedle = 0, hashHaystack = 0;
qsizetype idx;
for (idx = 0; idx < ol; ++idx) {
hashNeedle = ((hashNeedle<<1) + *(n-idx));
@@ -2760,34 +2755,11 @@ static qsizetype lastIndexOfHelper(const char *haystack, qsizetype l, const char
if (hashHaystack == hashNeedle && memcmp(needle, haystack, ol) == 0)
return haystack - end;
--haystack;
- REHASH(*(haystack + ol));
+ if (ol_minus_1 < sizeof(ol_minus_1) * CHAR_BIT)
+ hashHaystack -= qregisteruint(*(haystack + ol)) << ol_minus_1;
+ hashHaystack <<= 1;
}
return -1;
-
-}
-
-static inline qsizetype lastIndexOfCharHelper(QByteArrayView haystack, qsizetype from, char needle) noexcept
-{
- if (haystack.size() == 0)
- return -1;
- if (from < 0)
- from += haystack.size();
- else if (from > haystack.size())
- from = haystack.size() - 1;
- if (from >= 0) {
- const char *b = haystack.data();
- const char *n = b + from + 1;
- while (n-- != b) {
- if (*n == needle)
- return n - b;
- }
- }
- return -1;
-}
-
-qsizetype QtPrivate::lastIndexOf(QByteArrayView haystack, qsizetype from, char needle) noexcept
-{
- return lastIndexOfCharHelper(haystack, from, needle);
}
qsizetype QtPrivate::lastIndexOf(QByteArrayView haystack, qsizetype from, QByteArrayView needle) noexcept
@@ -2799,7 +2771,7 @@ qsizetype QtPrivate::lastIndexOf(QByteArrayView haystack, qsizetype from, QByteA
}
const auto ol = needle.size();
if (ol == 1)
- return lastIndexOfCharHelper(haystack, from, needle.front());
+ return QtPrivate::lastIndexOf(haystack, from, needle.front());
return lastIndexOfHelper(haystack.data(), haystack.size(), needle.data(), ol, from);
}
@@ -4218,24 +4190,6 @@ QByteArray QByteArray::toBase64(Base64Options options) const
\sa toUShort()
*/
-static char *qulltoa2(char *p, qulonglong n, int base)
-{
-#if defined(QT_CHECK_RANGE)
- if (base < 2 || base > 36) {
- qWarning("QByteArray::setNum: Invalid base %d", base);
- base = 10;
- }
-#endif
- constexpr char b = 'a' - 10;
- do {
- const int c = n % base;
- n /= base;
- *--p = c + (c < 10 ? '0' : b);
- } while (n);
-
- return p;
-}
-
/*!
\overload
@@ -4255,9 +4209,7 @@ QByteArray &QByteArray::setNum(qlonglong n, int base)
p = qulltoa2(buff + buffsize, qulonglong(n), base);
}
- clear();
- append(p, buffsize - (p - buff));
- return *this;
+ return assign(QByteArrayView{p, buff + buffsize});
}
/*!
@@ -4272,9 +4224,7 @@ QByteArray &QByteArray::setNum(qulonglong n, int base)
char buff[buffsize];
char *p = qulltoa2(buff + buffsize, n, base);
- clear();
- append(p, buffsize - (p - buff));
- return *this;
+ return assign(QByteArrayView{p, buff + buffsize});
}
/*!
@@ -5206,5 +5156,3 @@ size_t qHash(const QByteArray::FromBase64Result &key, size_t seed) noexcept
*/
QT_END_NAMESPACE
-
-#undef REHASH
diff --git a/src/corelib/text/qbytearrayalgorithms.h b/src/corelib/text/qbytearrayalgorithms.h
index 7060161bb4..649ec2e39b 100644
--- a/src/corelib/text/qbytearrayalgorithms.h
+++ b/src/corelib/text/qbytearrayalgorithms.h
@@ -31,8 +31,8 @@ qsizetype findByteArray(QByteArrayView haystack, qsizetype from, char needle) no
[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
qsizetype findByteArray(QByteArrayView haystack, qsizetype from, QByteArrayView needle) noexcept;
-[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
-qsizetype lastIndexOf(QByteArrayView haystack, qsizetype from, char needle) noexcept;
+[[nodiscard]] inline Q_DECL_PURE_FUNCTION
+qsizetype lastIndexOf(QByteArrayView haystack, qsizetype from, uchar needle) noexcept;
[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
qsizetype lastIndexOf(QByteArrayView haystack, qsizetype from, QByteArrayView needle) noexcept;
@@ -99,6 +99,8 @@ static inline T toIntegral(ByteArrayView data, bool *ok, int base)
Safe and portable C string functions; extensions to standard string.h
*****************************************************************************/
+[[nodiscard]] Q_DECL_PURE_FUNCTION Q_CORE_EXPORT
+const void *qmemrchr(const void *s, int needle, size_t n) noexcept;
Q_CORE_EXPORT char *qstrdup(const char *);
inline size_t qstrlen(const char *str)
diff --git a/src/corelib/text/qbytearraymatcher.cpp b/src/corelib/text/qbytearraymatcher.cpp
index ae38fb584b..9f27e10f3d 100644
--- a/src/corelib/text/qbytearraymatcher.cpp
+++ b/src/corelib/text/qbytearraymatcher.cpp
@@ -3,6 +3,11 @@
#include "qbytearraymatcher.h"
+#include <qtconfiginclude.h>
+#ifndef QT_BOOTSTRAPPED
+# include <private/qtcore-config_p.h>
+#endif
+
#include <limits.h>
QT_BEGIN_NAMESPACE
@@ -212,26 +217,10 @@ qsizetype QByteArrayMatcher::indexIn(QByteArrayView data, qsizetype from) const
\sa setPattern()
*/
-
-static qsizetype findChar(const char *str, qsizetype len, char ch, qsizetype from)
-{
- const uchar *s = (const uchar *)str;
- uchar c = (uchar)ch;
- if (from < 0)
- from = qMax(from + len, qsizetype(0));
- if (from < len) {
- const uchar *n = s + from - 1;
- const uchar *e = s + len;
- while (++n != e)
- if (*n == c)
- return n - s;
- }
- return -1;
-}
-
/*!
\internal
*/
+Q_NEVER_INLINE
static qsizetype qFindByteArrayBoyerMoore(
const char *haystack, qsizetype haystackLen, qsizetype haystackOffset,
const char *needle, qsizetype needleLen)
@@ -244,20 +233,21 @@ static qsizetype qFindByteArrayBoyerMoore(
(const uchar *)needle, needleLen, skiptable);
}
-#define REHASH(a) \
- if (sl_minus_1 < sizeof(std::size_t) * CHAR_BIT) \
- hashHaystack -= std::size_t(a) << sl_minus_1; \
- hashHaystack <<= 1
-
/*!
\internal
*/
-qsizetype qFindByteArray(
- const char *haystack0, qsizetype haystackLen, qsizetype from,
- const char *needle, qsizetype needleLen)
+static qsizetype qFindByteArray(const char *haystack0, qsizetype l, qsizetype from,
+ const char *needle, qsizetype sl);
+qsizetype QtPrivate::findByteArray(QByteArrayView haystack, qsizetype from, QByteArrayView needle) noexcept
{
- const auto l = haystackLen;
- const auto sl = needleLen;
+ const auto haystack0 = haystack.data();
+ const auto l = haystack.size();
+ const auto sl = needle.size();
+#if !QT_CONFIG(memmem)
+ if (sl == 1)
+ return findByteArray(haystack, from, needle.front());
+#endif
+
if (from < 0)
from += l;
if (std::size_t(sl + from) > std::size_t(l))
@@ -267,8 +257,10 @@ qsizetype qFindByteArray(
if (!l)
return -1;
- if (sl == 1)
- return findChar(haystack0, haystackLen, needle[0], from);
+#if QT_CONFIG(memmem)
+ auto where = memmem(haystack0 + from, l - from, needle.data(), sl);
+ return where ? static_cast<const char *>(where) - haystack0 : -1;
+#endif
/*
We use the Boyer-Moore algorithm in cases where the overhead
@@ -276,18 +268,22 @@ qsizetype qFindByteArray(
hash function.
*/
if (l > 500 && sl > 5)
- return qFindByteArrayBoyerMoore(haystack0, haystackLen, from,
- needle, needleLen);
+ return qFindByteArrayBoyerMoore(haystack0, l, from, needle.data(), sl);
+ return qFindByteArray(haystack0, l, from, needle.data(), sl);
+}
+qsizetype qFindByteArray(const char *haystack0, qsizetype l, qsizetype from,
+ const char *needle, qsizetype sl)
+{
/*
We use some hashing for efficiency's sake. Instead of
comparing strings, we compare the hash value of str with that
- of a part of this QString. Only if that matches, we call memcmp().
+ of a part of this QByteArray. Only if that matches, we call memcmp().
*/
const char *haystack = haystack0 + from;
const char *end = haystack0 + (l - sl);
- const auto sl_minus_1 = std::size_t(sl - 1);
- std::size_t hashNeedle = 0, hashHaystack = 0;
+ const qregisteruint sl_minus_1 = sl - 1;
+ qregisteruint hashNeedle = 0, hashHaystack = 0;
qsizetype idx;
for (idx = 0; idx < sl; ++idx) {
hashNeedle = ((hashNeedle<<1) + needle[idx]);
@@ -301,7 +297,9 @@ qsizetype qFindByteArray(
&& memcmp(needle, haystack, sl) == 0)
return haystack - haystack0;
- REHASH(*haystack);
+ if (sl_minus_1 < sizeof(sl_minus_1) * CHAR_BIT)
+ hashHaystack -= qregisteruint(*haystack) << sl_minus_1;
+ hashHaystack <<= 1;
++haystack;
}
return -1;
@@ -409,7 +407,4 @@ qsizetype QStaticByteArrayMatcherBase::indexOfIn(const char *needle, size_t nlen
\snippet code/src_corelib_text_qbytearraymatcher.cpp 1
*/
-
QT_END_NAMESPACE
-
-#undef REHASH
diff --git a/src/corelib/text/qbytearrayview.h b/src/corelib/text/qbytearrayview.h
index 45ebc812cd..9f7d854a9a 100644
--- a/src/corelib/text/qbytearrayview.h
+++ b/src/corelib/text/qbytearrayview.h
@@ -401,6 +401,18 @@ qsizetype QtPrivate::findByteArray(QByteArrayView haystack, qsizetype from, char
return -1;
}
+qsizetype QtPrivate::lastIndexOf(QByteArrayView haystack, qsizetype from, uchar needle) noexcept
+{
+ if (from < 0)
+ from = qMax(from + haystack.size(), qsizetype(0));
+ else
+ from = qMin(from, haystack.size() - 1);
+
+ const char *const b = haystack.data();
+ const void *n = b ? qmemrchr(b, needle, from + 1) : nullptr;
+ return n ? static_cast<const char *>(n) - b : -1;
+}
+
QT_END_NAMESPACE
#endif // QBYTEARRAYVIEW_H
diff --git a/src/corelib/text/qchar.cpp b/src/corelib/text/qchar.cpp
index 63296a92de..7b114e9723 100644
--- a/src/corelib/text/qchar.cpp
+++ b/src/corelib/text/qchar.cpp
@@ -123,9 +123,7 @@ QT_BEGIN_NAMESPACE
Starting with Qt 6.0, most QChar constructors are \c explicit. This
is done to avoid dangerous mistakes when accidentally mixing
- integral types and strings. You can opt-out (and make these
- constructors implicit) by defining the macro \c
- QT_IMPLICIT_QCHAR_CONSTRUCTION.
+ integral types and strings.
For more information see
\l{https://www.unicode.org/ucd/}{"About the Unicode Character Database"}.
@@ -2110,51 +2108,4 @@ static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationFo
return true;
}
-/*!
- \macro QT_IMPLICIT_QCHAR_CONSTRUCTION
- \since 6.0
- \relates QChar
-
- Defining this macro makes certain QChar constructors implicit
- rather than explicit. This is done to enforce safe conversions:
-
- \badcode
-
- QString str = getString();
- if (str == 123) {
- // Oops, meant str == "123". By default does not compile,
- // *unless* this macro is defined, in which case, it's interpreted
- // as `if (str == QChar(123))`, that is, `if (str == '{')`.
- // Likely, not what we meant.
- }
-
- \endcode
-
- This macro is provided to keep existing code working; it is
- recommended to instead use explicit conversions and/or QLatin1Char.
- For instance:
-
- \code
-
- QChar c1 = 'x'; // OK, unless QT_NO_CAST_FROM_ASCII is defined
- QChar c2 = u'x'; // always OK, recommended
- QChar c3 = QLatin1Char('x'); // always OK, recommended
-
- // from int to 1 UTF-16 code unit: must guarantee that the input is <= 0xFFFF
- QChar c4 = 120; // compile error, unless QT_IMPLICIT_QCHAR_CONSTRUCTION is defined
- QChar c5(120); // OK (direct initialization)
- auto c6 = QChar(120); // ditto
-
- // from int/char32_t to 1/2 UTF-16 code units:
- // 𝄞 'MUSICAL SYMBOL G CLEF' (U+1D11E)
- auto c7 = QChar(0x1D11E); // compiles, but undefined behavior at runtime
- auto c8 = QChar::fromUcs4(0x1D11E); // always OK
- auto c9 = QChar::fromUcs4(U'\U0001D11E'); // always OK
- // => use c8/c9 as QStringView objects
-
- \endcode
-
- \sa QLatin1Char, QChar::fromUcs4, QT_NO_CAST_FROM_ASCII
-*/
-
QT_END_NAMESPACE
diff --git a/src/corelib/text/qchar.h b/src/corelib/text/qchar.h
index c0c53664c2..b3fd794726 100644
--- a/src/corelib/text/qchar.h
+++ b/src/corelib/text/qchar.h
@@ -63,17 +63,15 @@ public:
};
#ifdef QT_IMPLICIT_QCHAR_CONSTRUCTION
-#define QCHAR_MAYBE_IMPLICIT Q_IMPLICIT
-#else
-#define QCHAR_MAYBE_IMPLICIT explicit
+#error This macro has been removed in Qt 6.8.
#endif
constexpr Q_IMPLICIT QChar() noexcept : ucs(0) {}
constexpr Q_IMPLICIT QChar(ushort rc) noexcept : ucs(rc) {}
- constexpr QCHAR_MAYBE_IMPLICIT QChar(uchar c, uchar r) noexcept : ucs(char16_t((r << 8) | c)) {}
+ constexpr explicit QChar(uchar c, uchar r) noexcept : ucs(char16_t((r << 8) | c)) {}
constexpr Q_IMPLICIT QChar(short rc) noexcept : ucs(char16_t(rc)) {}
- constexpr QCHAR_MAYBE_IMPLICIT QChar(uint rc) noexcept : ucs((Q_ASSERT(rc <= 0xffff), char16_t(rc))) {}
- constexpr QCHAR_MAYBE_IMPLICIT QChar(int rc) noexcept : QChar(uint(rc)) {}
+ constexpr explicit QChar(uint rc) noexcept : ucs((Q_ASSERT(rc <= 0xffff), char16_t(rc))) {}
+ constexpr explicit QChar(int rc) noexcept : QChar(uint(rc)) {}
constexpr Q_IMPLICIT QChar(SpecialCharacter s) noexcept : ucs(char16_t(s)) {}
constexpr Q_IMPLICIT QChar(QLatin1Char ch) noexcept : ucs(ch.unicode()) {}
constexpr Q_IMPLICIT QChar(char16_t ch) noexcept : ucs(ch) {}
@@ -85,12 +83,10 @@ public:
// Always implicit -- allow for 'x' => QChar conversions
QT_ASCII_CAST_WARN constexpr Q_IMPLICIT QChar(char c) noexcept : ucs(uchar(c)) { }
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
- QT_ASCII_CAST_WARN constexpr QCHAR_MAYBE_IMPLICIT QChar(uchar c) noexcept : ucs(c) { }
+ QT_ASCII_CAST_WARN constexpr explicit QChar(uchar c) noexcept : ucs(c) { }
#endif
#endif
-#undef QCHAR_MAYBE_IMPLICIT
-
static constexpr QChar fromUcs2(char16_t c) noexcept { return QChar{c}; }
static constexpr inline auto fromUcs4(char32_t c) noexcept;
diff --git a/src/corelib/text/qlatin1stringmatcher.cpp b/src/corelib/text/qlatin1stringmatcher.cpp
index 68bf97db5c..9036048fff 100644
--- a/src/corelib/text/qlatin1stringmatcher.cpp
+++ b/src/corelib/text/qlatin1stringmatcher.cpp
@@ -160,6 +160,31 @@ Qt::CaseSensitivity QLatin1StringMatcher::caseSensitivity() const noexcept
*/
qsizetype QLatin1StringMatcher::indexIn(QLatin1StringView haystack, qsizetype from) const noexcept
{
+ return indexIn_helper(haystack, from);
+}
+
+/*!
+ \since 6.8
+ \overload
+
+ Searches for the pattern in the given \a haystack starting from index
+ position \a from.
+
+ \sa caseSensitivity(), pattern()
+*/
+qsizetype QLatin1StringMatcher::indexIn(QStringView haystack, qsizetype from) const noexcept
+{
+ return indexIn_helper(haystack, from);
+}
+
+/*!
+ \internal
+*/
+template <typename String>
+qsizetype QLatin1StringMatcher::indexIn_helper(String haystack, qsizetype from) const noexcept
+{
+ static_assert(QtPrivate::isLatin1OrUtf16View<String>);
+
if (m_pattern.isEmpty() && from == haystack.size())
return from;
if (from < 0) // Historical behavior (see QString::indexOf and co.)
@@ -167,8 +192,15 @@ qsizetype QLatin1StringMatcher::indexIn(QLatin1StringView haystack, qsizetype fr
if (from >= haystack.size())
return -1;
- auto begin = haystack.begin() + from;
- auto end = haystack.end();
+ const auto start = [haystack] {
+ if constexpr (std::is_same_v<String, QStringView>)
+ return haystack.utf16();
+ else
+ return haystack.begin();
+ }();
+
+ auto begin = start + from;
+ auto end = start + haystack.size();
auto found = begin;
if (m_cs == Qt::CaseSensitive) {
found = m_caseSensitiveSearcher(begin, end, m_pattern.begin(), m_pattern.end()).begin;
@@ -178,7 +210,7 @@ qsizetype QLatin1StringMatcher::indexIn(QLatin1StringView haystack, qsizetype fr
const qsizetype bufferSize = std::min(m_pattern.size(), qsizetype(sizeof m_foldBuffer));
const QLatin1StringView restNeedle = m_pattern.sliced(bufferSize);
const bool needleLongerThanBuffer = restNeedle.size() > 0;
- QLatin1StringView restHaystack = haystack;
+ String restHaystack = haystack;
do {
found = m_caseInsensitiveSearcher(found, end, m_foldBuffer, &m_foldBuffer[bufferSize])
.begin;
@@ -189,13 +221,13 @@ qsizetype QLatin1StringMatcher::indexIn(QLatin1StringView haystack, qsizetype fr
}
restHaystack = haystack.sliced(
qMin(haystack.size(),
- bufferSize + qsizetype(std::distance(haystack.begin(), found))));
+ bufferSize + qsizetype(std::distance(start, found))));
if (restHaystack.startsWith(restNeedle, Qt::CaseInsensitive))
break;
++found;
} while (true);
}
- return std::distance(haystack.begin(), found);
+ return std::distance(start, found);
}
QT_END_NAMESPACE
diff --git a/src/corelib/text/qlatin1stringmatcher.h b/src/corelib/text/qlatin1stringmatcher.h
index 3b8c24fc92..dd3414fc6d 100644
--- a/src/corelib/text/qlatin1stringmatcher.h
+++ b/src/corelib/text/qlatin1stringmatcher.h
@@ -14,6 +14,10 @@
QT_BEGIN_NAMESPACE
namespace QtPrivate {
+template <typename T>
+constexpr inline bool isLatin1OrUtf16View =
+ std::disjunction_v<std::is_same<T, QLatin1StringView>, std::is_same<T, QStringView>>;
+
template<class RandomIt1,
class Hash = std::hash<typename std::iterator_traits<RandomIt1>::value_type>,
class BinaryPredicate = std::equal_to<>>
@@ -147,6 +151,7 @@ public:
Q_CORE_EXPORT Qt::CaseSensitivity caseSensitivity() const noexcept;
Q_CORE_EXPORT qsizetype indexIn(QLatin1StringView haystack, qsizetype from = 0) const noexcept;
+ Q_CORE_EXPORT qsizetype indexIn(QStringView haystack, qsizetype from = 0) const noexcept;
private:
void setSearcher() noexcept;
@@ -164,6 +169,10 @@ private:
CaseSensitiveSearcher m_caseSensitiveSearcher;
CaseInsensitiveSearcher m_caseInsensitiveSearcher;
};
+
+ template <typename String>
+ qsizetype indexIn_helper(String haystack, qsizetype from) const noexcept;
+
char m_foldBuffer[256];
};
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp
index ab95b300eb..86ab072b73 100644
--- a/src/corelib/text/qlocale.cpp
+++ b/src/corelib/text/qlocale.cpp
@@ -4760,6 +4760,11 @@ QStringList QLocale::uiLanguages(TagSeparator separator) const
const bool isSystem = d->m_data == &systemLocaleData;
if (isSystem) {
uiLanguages = systemLocale()->query(QSystemLocale::UILanguages).toStringList();
+ if (separator != TagSeparator::Dash) {
+ // Map from default separator, Dash, used by backends:
+ const QChar join = QLatin1Char(sep);
+ uiLanguages = uiLanguages.replaceInStrings(u"-", QStringView(&join, 1));
+ }
// ... but we need to include likely-adjusted forms of each of those, too.
// For now, collect up locale Ids representing the entries, for later processing:
for (const auto &entry : std::as_const(uiLanguages))
diff --git a/src/corelib/text/qlocale_tools.cpp b/src/corelib/text/qlocale_tools.cpp
index b6639bcb71..b68090365b 100644
--- a/src/corelib/text/qlocale_tools.cpp
+++ b/src/corelib/text/qlocale_tools.cpp
@@ -552,6 +552,18 @@ QString qulltoa(qulonglong number, int base, const QStringView zero)
return QString(reinterpret_cast<QChar *>(p), end - p);
}
+char *qulltoa2(char *p, qulonglong n, int base)
+{
+#if defined(QT_CHECK_RANGE)
+ if (base < 2 || base > 36) {
+ qWarning("QByteArray::setNum: Invalid base %d", base);
+ base = 10;
+ }
+#endif
+ qulltoString_helper(n, base, p);
+ return p;
+}
+
/*!
\internal
@@ -795,4 +807,78 @@ QByteArray qdtoAscii(double d, QLocaleData::DoubleForm form, int precision, bool
return dtoString<QByteArray>(d, form, precision, uppercase);
}
+#if defined(QT_SUPPORTS_INT128) || (defined(Q_CC_MSVC) && (_MSC_VER >= 1930))
+static inline quint64 toUInt64(qinternaluint128 v)
+{
+#ifdef QT_SUPPORTS_INT128
+ return quint64(v);
+#elif defined(Q_CC_MSVC)
+ return quint64(v._Word[0]);
+#endif
+}
+QString quint128toBasicLatin(qinternaluint128 number, int base)
+{
+ // We divide our 128-bit number into parts that we can do text
+ // concatenation with. This list is the maximum power of the
+ // base that is less than 2^64.
+ static constexpr auto dividers = []() constexpr {
+ std::array<quint64, 35> bases {};
+ for (int base = 2; base <= 36; ++base) {
+ quint64 v = base;
+ while (v * base > v)
+ v *= base;
+ bases[base - 2] = v;
+ }
+ return bases;
+ }();
+ static constexpr auto digitCounts = []() constexpr {
+ std::array<quint8, 35> digits{};
+ for (int base = 2; base <= 36; ++base) {
+ quint64 v = base;
+ int i = 0;
+ for (i = 0; v * base > v; ++i)
+ v *= base;
+ digits[base - 2] = i;
+ }
+ return digits;
+ }();
+
+ QString result;
+
+ constexpr unsigned flags = QLocaleData::NoFlags;
+ const QLocaleData *dd = QLocaleData::c();
+
+ // special base cases:
+ constexpr int Width = -1;
+ if (base == 2 || base == 4 || base == 16) {
+ // 2^64 is a power of 2, 4 and 16
+ result = dd->unsLongLongToString(quint64(number), 64, base, Width, flags);
+ result.prepend(dd->unsLongLongToString(quint64(number >> 64), -1, base, Width, flags));
+ } else {
+ int digitCount = digitCounts[base - 2];
+ quint64 divider = dividers[base - 2];
+ quint64 lower = toUInt64(number % divider);
+ number /= divider;
+ while (number) {
+ result.prepend(dd->unsLongLongToString(lower, digitCount, base, Width, flags));
+ lower = toUInt64(number % divider);
+ number /= divider;
+ }
+ result.prepend(dd->unsLongLongToString(lower, -1, base, Width, flags));
+ }
+ return result;
+}
+
+QString qint128toBasicLatin(qinternalint128 number, int base)
+{
+ const bool negative = number < 0;
+ if (negative)
+ number *= -1;
+ QString result = quint128toBasicLatin(qinternaluint128(number), base);
+ if (negative)
+ result.prepend(u'-');
+ return result;
+}
+#endif // defined(QT_SUPPORTS_INT128) || (defined(Q_CC_MSVC) && (_MSC_VER >= 1930))
+
QT_END_NAMESPACE
diff --git a/src/corelib/text/qlocale_tools_p.h b/src/corelib/text/qlocale_tools_p.h
index 9b02403ea4..9ae9dc8de7 100644
--- a/src/corelib/text/qlocale_tools_p.h
+++ b/src/corelib/text/qlocale_tools_p.h
@@ -18,8 +18,20 @@
#include "qlocale_p.h"
#include "qstring.h"
+#if !defined(QT_SUPPORTS_INT128) && defined(Q_CC_MSVC) && (_MSC_VER >= 1930)
+#include <__msvc_int128.hpp>
+#endif
+
QT_BEGIN_NAMESPACE
+#if defined(QT_SUPPORTS_INT128)
+using qinternalint128 = qint128;
+using qinternaluint128 = quint128;
+#elif defined(Q_CC_MSVC) && (_MSC_VER >= 1930)
+using qinternalint128 = std::_Signed128;
+using qinternaluint128 = std::_Unsigned128;
+#endif
+
enum StrayCharacterMode {
TrailingJunkProhibited,
TrailingJunkAllowed,
@@ -36,12 +48,20 @@ void qt_doubleToAscii(double d, QLocaleData::DoubleForm form, int precision,
[[nodiscard]] QString qulltoBasicLatin(qulonglong l, int base, bool negative);
[[nodiscard]] QString qulltoa(qulonglong l, int base, const QStringView zero);
+[[nodiscard]] char *qulltoa2(char *p, qulonglong n, int base);
[[nodiscard]] Q_CORE_EXPORT QString qdtoa(qreal d, int *decpt, int *sign);
[[nodiscard]] QString qdtoBasicLatin(double d, QLocaleData::DoubleForm form,
int precision, bool uppercase);
[[nodiscard]] QByteArray qdtoAscii(double d, QLocaleData::DoubleForm form,
int precision, bool uppercase);
+#if defined(QT_SUPPORTS_INT128) || (defined(Q_CC_MSVC) && (_MSC_VER >= 1930))
+[[nodiscard]] Q_CORE_EXPORT QString quint128toBasicLatin(qinternaluint128 number,
+ int base = 10);
+[[nodiscard]] Q_CORE_EXPORT QString qint128toBasicLatin(qinternalint128 number,
+ int base = 10);
+#endif
+
[[nodiscard]] constexpr inline bool isZero(double d)
{
return d == 0; // Amusingly, compilers do not grumble.
diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp
index 67c422568b..78261e14cb 100644
--- a/src/corelib/text/qregularexpression.cpp
+++ b/src/corelib/text/qregularexpression.cpp
@@ -42,6 +42,7 @@ using namespace Qt::StringLiterals;
\keyword regular expression
+ \compares equality
Regular expressions, or \e{regexps}, are a very powerful tool to handle
strings and texts. This is useful in many contexts, e.g.,
@@ -1734,18 +1735,20 @@ void QRegularExpression::optimize() const
}
/*!
- Returns \c true if the regular expression is equal to \a re, or false
+ \fn bool QRegularExpression::operator==(const QRegularExpression &lhs, const QRegularExpression &rhs) noexcept
+
+ Returns \c true if the \a lhs regular expression is equal to the \a rhs, or false
otherwise. Two QRegularExpression objects are equal if they have
the same pattern string and the same pattern options.
\sa operator!=()
*/
-bool QRegularExpression::operator==(const QRegularExpression &re) const
+bool comparesEqual(const QRegularExpression &lhs,
+ const QRegularExpression &rhs) noexcept
{
- return (d == re.d) ||
- (d->pattern == re.d->pattern && d->patternOptions == re.d->patternOptions);
+ return (lhs.d == rhs.d) ||
+ (lhs.d->pattern == rhs.d->pattern && lhs.d->patternOptions == rhs.d->patternOptions);
}
-
/*!
\fn QRegularExpression & QRegularExpression::operator=(QRegularExpression && re)
@@ -1758,9 +1761,9 @@ bool QRegularExpression::operator==(const QRegularExpression &re) const
*/
/*!
- \fn bool QRegularExpression::operator!=(const QRegularExpression &re) const
+ \fn bool QRegularExpression::operator!=(const QRegularExpression &lhs, const QRegularExpression &rhs) noexcept
- Returns \c true if the regular expression is different from \a re, or
+ Returns \c true if the \a lhs regular expression is different from the \a rhs, or
false otherwise.
\sa operator==()
diff --git a/src/corelib/text/qregularexpression.h b/src/corelib/text/qregularexpression.h
index 2b51b94b15..ab147b87d4 100644
--- a/src/corelib/text/qregularexpression.h
+++ b/src/corelib/text/qregularexpression.h
@@ -157,11 +157,15 @@ public:
static QRegularExpression fromWildcard(QStringView pattern, Qt::CaseSensitivity cs = Qt::CaseInsensitive,
WildcardConversionOptions options = DefaultWildcardConversion);
-
+#if QT_CORE_REMOVED_SINCE(6, 8)
bool operator==(const QRegularExpression &re) const;
inline bool operator!=(const QRegularExpression &re) const { return !operator==(re); }
-
+#endif
private:
+ friend Q_CORE_EXPORT bool comparesEqual(const QRegularExpression &lhs,
+ const QRegularExpression &rhs) noexcept;
+ Q_DECLARE_EQUALITY_COMPARABLE(QRegularExpression)
+
friend struct QRegularExpressionPrivate;
friend class QRegularExpressionMatch;
friend struct QRegularExpressionMatchPrivate;
@@ -365,30 +369,24 @@ private:
// [input.iterators] imposes operator== on us. Unfortunately, it's not
// trivial to implement, so just do the bare minimum to satifisfy
// Cpp17EqualityComparable.
- friend bool operator==(const QRegularExpressionMatchIteratorRangeBasedForIterator &lhs,
- const QRegularExpressionMatchIteratorRangeBasedForIterator &rhs) noexcept
+ friend bool comparesEqual(const QRegularExpressionMatchIteratorRangeBasedForIterator &lhs,
+ const QRegularExpressionMatchIteratorRangeBasedForIterator &rhs)
+ noexcept
{
return (&lhs == &rhs);
}
-
- friend bool operator!=(const QRegularExpressionMatchIteratorRangeBasedForIterator &lhs,
- const QRegularExpressionMatchIteratorRangeBasedForIterator &rhs) noexcept
- {
- return !(lhs == rhs);
- }
+ Q_DECLARE_EQUALITY_COMPARABLE(QRegularExpressionMatchIteratorRangeBasedForIterator)
// This is what we really use in a range-based for.
- friend bool operator==(const QRegularExpressionMatchIteratorRangeBasedForIterator &lhs,
- QRegularExpressionMatchIteratorRangeBasedForIteratorSentinel) noexcept
+ friend bool comparesEqual(const QRegularExpressionMatchIteratorRangeBasedForIterator &lhs,
+ const QRegularExpressionMatchIteratorRangeBasedForIteratorSentinel &rhs)
+ noexcept
{
+ Q_UNUSED(rhs);
return lhs.m_atEnd;
}
-
- friend bool operator!=(const QRegularExpressionMatchIteratorRangeBasedForIterator &lhs,
- QRegularExpressionMatchIteratorRangeBasedForIteratorSentinel) noexcept
- {
- return !lhs.m_atEnd;
- }
+ Q_DECLARE_EQUALITY_COMPARABLE(QRegularExpressionMatchIteratorRangeBasedForIterator,
+ QRegularExpressionMatchIteratorRangeBasedForIteratorSentinel)
QRegularExpressionMatchIterator m_matchIterator;
QRegularExpressionMatch m_currentMatch;
diff --git a/src/corelib/text/qstaticlatin1stringmatcher.h b/src/corelib/text/qstaticlatin1stringmatcher.h
index d80ebd8547..bd6d9db08b 100644
--- a/src/corelib/text/qstaticlatin1stringmatcher.h
+++ b/src/corelib/text/qstaticlatin1stringmatcher.h
@@ -109,13 +109,30 @@ public:
}
constexpr qsizetype indexIn(QLatin1StringView haystack, qsizetype from = 0) const noexcept
+ { return indexIn_helper(haystack, from); }
+
+ constexpr qsizetype indexIn(QStringView haystack, qsizetype from = 0) const noexcept
+ { return indexIn_helper(haystack, from); }
+
+private:
+ template <typename String>
+ constexpr qsizetype indexIn_helper(String haystack, qsizetype from = 0) const noexcept
{
+ static_assert(QtPrivate::isLatin1OrUtf16View<String>);
+
if (from >= haystack.size())
return -1;
- const char *begin = haystack.begin() + from;
- const char *end = haystack.end();
+
+ const auto start = [haystack]() constexpr {
+ if constexpr (std::is_same_v<String, QStringView>)
+ return haystack.utf16();
+ else
+ return haystack.begin();
+ }();
+ const auto begin = start + from;
+ const auto end = start + haystack.size();
const auto r = m_searcher(begin, end, m_pattern.begin(), m_pattern.end());
- return r.begin == end ? -1 : std::distance(haystack.begin(), r.begin);
+ return r.begin == end ? -1 : std::distance(start, r.begin);
}
};
diff --git a/src/corelib/text/qstaticlatin1stringmatcher.qdoc b/src/corelib/text/qstaticlatin1stringmatcher.qdoc
index 6577f985b2..86edf69bc2 100644
--- a/src/corelib/text/qstaticlatin1stringmatcher.qdoc
+++ b/src/corelib/text/qstaticlatin1stringmatcher.qdoc
@@ -44,6 +44,7 @@
/*!
\fn template<Qt::CaseSensitivity CS, size_t N> constexpr qsizetype QStaticLatin1StringMatcher<CS, N>::indexIn(QLatin1StringView haystack, qsizetype from) const
+ \fn template<Qt::CaseSensitivity CS, size_t N> constexpr qsizetype QStaticLatin1StringMatcher<CS, N>::indexIn(QStringView haystack, qsizetype from) const
Searches the QLatin1StringView \a haystack, from byte position \a from
(default 0, i.e. from the first byte), for QLatin1StringView pattern()
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index f0bf0c50a3..8adbfe3cbb 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -63,8 +63,8 @@
#endif
#define REHASH(a) \
- if (sl_minus_1 < sizeof(std::size_t) * CHAR_BIT) \
- hashHaystack -= std::size_t(a) << sl_minus_1; \
+ if (sl_minus_1 < sizeof(sl_minus_1) * CHAR_BIT) \
+ hashHaystack -= decltype(hashHaystack)(a) << sl_minus_1; \
hashHaystack <<= 1
QT_BEGIN_NAMESPACE
@@ -183,10 +183,10 @@ static qsizetype qLastIndexOf(Haystack haystack0, qsizetype from,
const auto needle = needle0.data();
const auto *end = haystack;
haystack += from;
- const std::size_t sl_minus_1 = sl ? sl - 1 : 0;
+ const qregisteruint sl_minus_1 = sl ? sl - 1 : 0;
const auto *n = needle + sl_minus_1;
const auto *h = haystack + sl_minus_1;
- std::size_t hashNeedle = 0, hashHaystack = 0;
+ qregisteruint hashNeedle = 0, hashHaystack = 0;
if (cs == Qt::CaseSensitive) {
for (qsizetype idx = 0; idx < sl; ++idx) {
@@ -1543,6 +1543,8 @@ int QtPrivate::compareStrings(QLatin1StringView lhs, QLatin1StringView rhs, Qt::
{
if (lhs.isEmpty())
return qt_lencmp(qsizetype(0), rhs.size());
+ if (rhs.isEmpty())
+ return qt_lencmp(lhs.size(), qsizetype(0));
if (cs == Qt::CaseInsensitive)
return latin1nicmp(lhs.data(), lhs.size(), rhs.data(), rhs.size());
const auto l = std::min(lhs.size(), rhs.size());
@@ -9140,18 +9142,13 @@ namespace {
struct Part
{
Part() = default; // for QVarLengthArray; do not use
- constexpr Part(QStringView s, int num = -1)
- : tag{QtPrivate::ArgBase::U16}, number{num}, data{s.utf16()}, size{s.size()} {}
- constexpr Part(QLatin1StringView s, int num = -1)
- : tag{QtPrivate::ArgBase::L1}, number{num}, data{s.data()}, size{s.size()} {}
+ constexpr Part(QAnyStringView s, int num = -1)
+ : string{s}, number{num} {}
- void reset(QStringView s) noexcept { *this = {s, number}; }
- void reset(QLatin1StringView s) noexcept { *this = {s, number}; }
+ void reset(QAnyStringView s) noexcept { *this = {s, number}; }
- QtPrivate::ArgBase::Tag tag;
+ QAnyStringView string;
int number;
- const void *data;
- qsizetype size;
};
} // unnamed namespace
@@ -9234,16 +9231,13 @@ static qsizetype resolveStringRefsAndReturnTotalSize(ParseResult &parts, const A
}
}
}
- totalSize += part.size;
+ totalSize += part.string.size();
}
return totalSize;
}
} // unnamed namespace
-Q_ALWAYS_INLINE QString to_string(QLatin1StringView s) noexcept { return s; }
-Q_ALWAYS_INLINE QString to_string(QStringView s) noexcept { return s.toString(); }
-
template <typename StringView>
static QString argToQStringImpl(StringView pattern, size_t numArgs, const QtPrivate::ArgBase **args)
{
@@ -9257,7 +9251,7 @@ static QString argToQStringImpl(StringView pattern, size_t numArgs, const QtPriv
argIndexToPlaceholderMap.resize(qsizetype(numArgs));
else if (Q_UNLIKELY(static_cast<size_t>(argIndexToPlaceholderMap.size()) < numArgs)) // 3b
qWarning("QString::arg: %d argument(s) missing in %ls",
- int(numArgs - argIndexToPlaceholderMap.size()), qUtf16Printable(to_string(pattern)));
+ int(numArgs - argIndexToPlaceholderMap.size()), qUtf16Printable(pattern.toString()));
// 5
const qsizetype totalSize = resolveStringRefsAndReturnTotalSize(parts, argIndexToPlaceholderMap, args);
@@ -9266,24 +9260,33 @@ static QString argToQStringImpl(StringView pattern, size_t numArgs, const QtPriv
QString result(totalSize, Qt::Uninitialized);
auto out = const_cast<QChar*>(result.constData());
- for (const Part &part : parts) {
- switch (part.tag) {
- case QtPrivate::ArgBase::L1:
- if (part.size) {
+ struct Concatenate {
+ QChar *out;
+ QChar *operator()(QLatin1String part) noexcept
+ {
+ if (part.size()) {
qt_from_latin1(reinterpret_cast<char16_t*>(out),
- reinterpret_cast<const char*>(part.data), part.size);
+ part.data(), part.size());
}
- break;
- case QtPrivate::ArgBase::U8:
- Q_UNREACHABLE(); // waiting for QUtf8String
- break;
- case QtPrivate::ArgBase::U16:
- if (part.size)
- memcpy(out, part.data, part.size * sizeof(QChar));
- break;
+ return out + part.size();
}
- out += part.size;
- }
+ QChar *operator()(QUtf8StringView part) noexcept
+ {
+ return QUtf8::convertToUnicode(out, part);
+ }
+ QChar *operator()(QStringView part) noexcept
+ {
+ if (part.size())
+ memcpy(out, part.data(), part.size() * sizeof(QChar));
+ return out + part.size();
+ }
+ };
+
+ for (const Part &part : parts)
+ out = part.string.visit(Concatenate{out});
+
+ // UTF-8 decoding may have caused an overestimate of totalSize - correct it:
+ result.truncate(out - result.cbegin());
return result;
}
@@ -9905,8 +9908,8 @@ qsizetype QtPrivate::findString(QStringView haystack0, qsizetype from, QStringVi
const char16_t *needle = needle0.utf16();
const char16_t *haystack = haystack0.utf16() + from;
const char16_t *end = haystack0.utf16() + (l - sl);
- const std::size_t sl_minus_1 = sl - 1;
- std::size_t hashNeedle = 0, hashHaystack = 0;
+ const qregisteruint sl_minus_1 = sl - 1;
+ qregisteruint hashNeedle = 0, hashHaystack = 0;
qsizetype idx;
if (cs == Qt::CaseSensitive) {
diff --git a/src/corelib/text/qstringconverter_p.h b/src/corelib/text/qstringconverter_p.h
index e68ffb2bb0..5c530cf1bd 100644
--- a/src/corelib/text/qstringconverter_p.h
+++ b/src/corelib/text/qstringconverter_p.h
@@ -52,6 +52,7 @@ struct QLatin1
static char *convertFromUnicode(char *out, QStringView in, QStringConverter::State *state) noexcept;
// Defined in qstring.cpp
+ Q_CORE_EXPORT
static char *convertFromUnicode(char *out, QStringView in) noexcept;
};
diff --git a/src/corelib/thread/qfuture.h b/src/corelib/thread/qfuture.h
index 5939a93780..3945df066a 100644
--- a/src/corelib/thread/qfuture.h
+++ b/src/corelib/thread/qfuture.h
@@ -183,8 +183,6 @@ QT_WARNING_POP
{ future = o.future; index = o.index; return *this; }
inline const T &operator*() const { return future->d.resultReference(index); }
inline const T *operator->() const { return future->d.resultPointer(index); }
- inline bool operator!=(const const_iterator &other) const { return index != other.index; }
- inline bool operator==(const const_iterator &o) const { return !operator!=(o); }
inline const_iterator &operator++()
{ index = advanceIndex(index, 1); return *this; }
inline const_iterator &operator--()
@@ -213,6 +211,12 @@ QT_WARNING_POP
{ return const_iterator(k.future, k.advanceIndex(k.index, j)); }
private:
+ friend bool comparesEqual(const const_iterator &lhs, const const_iterator &rhs) noexcept
+ {
+ return lhs.index == rhs.index;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(const_iterator)
+
/*! \internal
Advances the iterator index \a idx \a n steps, waits for the
diff --git a/src/corelib/thread/qfuture.qdoc b/src/corelib/thread/qfuture.qdoc
index 9eda766968..b278d39882 100644
--- a/src/corelib/thread/qfuture.qdoc
+++ b/src/corelib/thread/qfuture.qdoc
@@ -613,17 +613,17 @@
Returns a pointer to the current result.
*/
-/*! \fn template <typename T> bool QFuture<T>::const_iterator::operator!=(const const_iterator &other) const
+/*! \fn template <typename T> bool QFuture<T>::const_iterator::operator!=(const const_iterator &lhs, const const_iterator &rhs)
- Returns \c true if \a other points to a different result than this iterator;
+ Returns \c true if \a lhs points to a different result than \a rhs iterator;
otherwise returns \c false.
\sa operator==()
*/
-/*! \fn template <typename T> bool QFuture<T>::const_iterator::operator==(const const_iterator &other) const
+/*! \fn template <typename T> bool QFuture<T>::const_iterator::operator==(const const_iterator &lhs, const const_iterator &rhs)
- Returns \c true if \a other points to the same result as this iterator;
+ Returns \c true if \a lhs points to the same result as \a rhs iterator;
otherwise returns \c false.
\sa operator!=()
diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h
index 180a59a94e..ea7d40ad90 100644
--- a/src/corelib/thread/qfutureinterface.h
+++ b/src/corelib/thread/qfutureinterface.h
@@ -465,6 +465,9 @@ std::vector<T> QFutureInterface<T>::takeResults()
}
#endif
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wweak-vtables") // QTBUG-125115
+
template <>
class QFutureInterface<void> : public QFutureInterfaceBase
{
@@ -495,6 +498,8 @@ public:
}
};
+QT_WARNING_POP // Clang -Wweak-vtables
+
template<typename T>
inline void swap(QFutureInterface<T> &a, QFutureInterface<T> &b) noexcept
{
diff --git a/src/corelib/thread/qresultstore.cpp b/src/corelib/thread/qresultstore.cpp
index 14ed7c6b87..8b7601f5b0 100644
--- a/src/corelib/thread/qresultstore.cpp
+++ b/src/corelib/thread/qresultstore.cpp
@@ -88,16 +88,6 @@ void ResultIteratorBase::batchedAdvance()
m_vectorIndex = 0;
}
-bool ResultIteratorBase::operator==(const ResultIteratorBase &other) const
-{
- return (mapIterator == other.mapIterator && m_vectorIndex == other.m_vectorIndex);
-}
-
-bool ResultIteratorBase::operator!=(const ResultIteratorBase &other) const
-{
- return !operator==(other);
-}
-
bool ResultIteratorBase::isVector() const
{
return mapIterator.value().isVector();
diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h
index 30ce1fe904..f21068206f 100644
--- a/src/corelib/thread/qresultstore.h
+++ b/src/corelib/thread/qresultstore.h
@@ -46,12 +46,21 @@ public:
ResultIteratorBase operator++();
int batchSize() const;
void batchedAdvance();
+#if QT_CORE_REMOVED_SINCE(6, 8)
bool operator==(const ResultIteratorBase &other) const;
bool operator!=(const ResultIteratorBase &other) const;
+#endif
bool isVector() const;
bool canIncrementVectorIndex() const;
bool isValid() const;
+private:
+ friend bool comparesEqual(const ResultIteratorBase &lhs,
+ const ResultIteratorBase &rhs) noexcept
+ {
+ return (lhs.mapIterator == rhs.mapIterator && lhs.m_vectorIndex == rhs.m_vectorIndex);
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(ResultIteratorBase)
protected:
QMap<int, ResultItem>::const_iterator mapIterator;
int m_vectorIndex;
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 8d8f353aaa..ea76a2ccad 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -531,10 +531,18 @@ bool QThread::isRunning() const
}
/*!
- Sets the maximum stack size for the thread to \a stackSize. If \a
- stackSize is greater than zero, the maximum stack size is set to
- \a stackSize bytes, otherwise the maximum stack size is
- automatically determined by the operating system.
+ Sets the stack size for the thread to \a stackSize. If \a stackSize is
+ zero, the operating system or runtime will choose a default value.
+ Otherwise, the thread's stack size will be the value provided (which may be
+ rounded up or down).
+
+ On most operating systems, the amount of memory allocated to serve the
+ stack will initially be smaller than \a stackSize and will grow as the
+ thread uses the stack. This parameter sets the maximum size it will be
+ allowed to grow to (that is, it sets the size of the virtual memory space
+ the stack is allowed to occupy).
+
+ This function can only be called before the thread is started.
\warning Most operating systems place minimum and maximum limits
on thread stack sizes. The thread will fail to start if the stack
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 617a5ebf28..44487a2cc2 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -282,8 +282,16 @@ void *QThreadPrivate::start(void *arg)
#ifdef PTHREAD_CANCEL_DISABLE
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, nullptr);
#endif
- pthread_cleanup_push(QThreadPrivate::finish, arg);
-
+#if !defined(Q_OS_QNX) && !defined(Q_OS_VXWORKS)
+ // On QNX, calling finish() from a thread_local destructor causes the C
+ // library to hang.
+ // On VxWorks, its pthread implementation fails on call to `pthead_setspecific` which is made
+ // by first QObject constructor during `finish()`. This causes call to QThread::current, since
+ // QObject doesn't have parent, and since the pthread is already removed, it tries to set
+ // QThreadData for current pthread key, which crashes.
+ static thread_local
+#endif
+ auto cleanup = qScopeGuard([=] { finish(arg); });
terminate_on_exception([&] {
QThread *thr = reinterpret_cast<QThread *>(arg);
QThreadData *data = QThreadData::get2(thr);
@@ -328,11 +336,7 @@ void *QThreadPrivate::start(void *arg)
thr->run();
});
- // This pop runs finish() below. It's outside the try/catch (and has its
- // own try/catch) to prevent finish() to be run in case an exception is
- // thrown.
- pthread_cleanup_pop(1);
-
+ // The qScopeGuard above call runs finish() below.
return nullptr;
}
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp
index ae584656fe..c7531111da 100644
--- a/src/corelib/thread/qthreadpool.cpp
+++ b/src/corelib/thread/qthreadpool.cpp
@@ -258,7 +258,7 @@ void QThreadPoolPrivate::startThread(QRunnable *runnable)
/*!
\internal
- Helper function only to be called from waitForDone(int)
+ Helper function only to be called from waitForDone()
Deletes all current threads.
*/
@@ -285,22 +285,17 @@ void QThreadPoolPrivate::reset()
/*!
\internal
- Helper function only to be called from waitForDone(int)
+ Helper function only to be called from the public waitForDone()
*/
bool QThreadPoolPrivate::waitForDone(const QDeadlineTimer &timer)
{
+ QMutexLocker locker(&mutex);
while (!(queue.isEmpty() && activeThreads == 0) && !timer.hasExpired())
noActiveThreads.wait(&mutex, timer);
- return queue.isEmpty() && activeThreads == 0;
-}
-
-bool QThreadPoolPrivate::waitForDone(int msecs)
-{
- QMutexLocker locker(&mutex);
- QDeadlineTimer timer(msecs);
- if (!waitForDone(timer))
+ if (!queue.isEmpty() || activeThreads)
return false;
+
reset();
// New jobs might have started during reset, but return anyway
// as the active thread and task count did reach 0 once, and
@@ -598,18 +593,17 @@ bool QThreadPool::tryStart(QRunnable *runnable)
int QThreadPool::expiryTimeout() const
{
+ using namespace std::chrono;
Q_D(const QThreadPool);
QMutexLocker locker(&d->mutex);
- return d->expiryTimeout;
+ return duration_cast<milliseconds>(d->expiryTimeout).count();
}
void QThreadPool::setExpiryTimeout(int expiryTimeout)
{
Q_D(QThreadPool);
QMutexLocker locker(&d->mutex);
- if (d->expiryTimeout == expiryTimeout)
- return;
- d->expiryTimeout = expiryTimeout;
+ d->expiryTimeout = std::chrono::milliseconds(expiryTimeout);
}
/*! \property QThreadPool::maxThreadCount
@@ -808,15 +802,24 @@ void QThreadPool::startOnReservedThread(QRunnable *runnable)
*/
/*!
+ \fn bool QThreadPool::waitForDone(int msecs)
Waits up to \a msecs milliseconds for all threads to exit and removes all
threads from the thread pool. Returns \c true if all threads were removed;
- otherwise it returns \c false. If \a msecs is -1 (the default), the timeout
- is ignored (waits for the last thread to exit).
+ otherwise it returns \c false. If \a msecs is -1, this function waits for
+ the last thread to exit.
+*/
+
+/*!
+ \since 6.8
+
+ Waits until \a deadline expires for all threads to exit and removes all
+ threads from the thread pool. Returns \c true if all threads were removed;
+ otherwise it returns \c false.
*/
-bool QThreadPool::waitForDone(int msecs)
+bool QThreadPool::waitForDone(QDeadlineTimer deadline)
{
Q_D(QThreadPool);
- return d->waitForDone(msecs);
+ return d->waitForDone(deadline);
}
/*!
diff --git a/src/corelib/thread/qthreadpool.h b/src/corelib/thread/qthreadpool.h
index a097ace14b..0640f41587 100644
--- a/src/corelib/thread/qthreadpool.h
+++ b/src/corelib/thread/qthreadpool.h
@@ -9,7 +9,9 @@
#include <QtCore/qthread.h>
#include <QtCore/qrunnable.h>
+#if QT_CORE_REMOVED_SINCE(6, 6)
#include <functional>
+#endif
QT_REQUIRE_CONFIG(thread);
@@ -70,7 +72,9 @@ public:
void reserveThread();
void releaseThread();
- bool waitForDone(int msecs = -1);
+ QT_CORE_INLINE_SINCE(6, 8)
+ bool waitForDone(int msecs);
+ bool waitForDone(QDeadlineTimer deadline = QDeadlineTimer::Forever);
void clear();
@@ -101,6 +105,13 @@ void QThreadPool::startOnReservedThread(Callable &&functionToRun)
startOnReservedThread(QRunnable::create(std::forward<Callable>(functionToRun)));
}
+#if QT_CORE_INLINE_IMPL_SINCE(6, 8)
+bool QThreadPool::waitForDone(int msecs)
+{
+ return waitForDone(QDeadlineTimer(msecs));
+}
+#endif
+
QT_END_NAMESPACE
#endif
diff --git a/src/corelib/thread/qthreadpool_p.h b/src/corelib/thread/qthreadpool_p.h
index 67c703fabd..7910592f70 100644
--- a/src/corelib/thread/qthreadpool_p.h
+++ b/src/corelib/thread/qthreadpool_p.h
@@ -128,7 +128,6 @@ public:
{ return qMax(requestedMaxThreadCount, 1); } // documentation says we start at least one
void startThread(QRunnable *runnable = nullptr);
void reset();
- bool waitForDone(int msecs);
bool waitForDone(const QDeadlineTimer &timer);
void clear();
void stealAndRunRunnable(QRunnable *runnable);
@@ -144,7 +143,7 @@ public:
QWaitCondition noActiveThreads;
QString objectName;
- int expiryTimeout = 30000;
+ std::chrono::duration<int, std::milli> expiryTimeout = std::chrono::seconds(30);
int requestedMaxThreadCount = QThread::idealThreadCount(); // don't use this directly
int reservedThreads = 0;
int activeThreads = 0;
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp
index 687f174c07..c3e9b49b25 100644
--- a/src/corelib/time/qdatetime.cpp
+++ b/src/corelib/time/qdatetime.cpp
@@ -5350,10 +5350,19 @@ QDateTime QDateTime::currentDateTimeUtc()
\since 6.4
Constructs a datetime representing the same point in time as \a time,
- using Qt::UTC as its specification.
+ using Qt::UTC as its time representation.
- The clock of \a time must be compatible with \c{std::chrono::system_clock},
- and the duration type must be convertible to \c{std::chrono::milliseconds}.
+ The clock of \a time must be compatible with
+ \c{std::chrono::system_clock}; in particular, a conversion
+ supported by \c{std::chrono::clock_cast} must exist. After the
+ conversion, the duration type of the result must be convertible to
+ \c{std::chrono::milliseconds}.
+
+ If this is not the case, the caller must perform the necessary
+ clock conversion towards \c{std::chrono::system_clock} and the
+ necessary conversion of the duration type
+ (cast/round/floor/ceil/...) so that the input to this function
+ satisfies the constraints above.
\note This function requires C++20.
@@ -5361,6 +5370,22 @@ QDateTime QDateTime::currentDateTimeUtc()
*/
/*!
+ \since 6.4
+ \overload
+
+ Constructs a datetime representing the same point in time as \a time,
+ using Qt::UTC as its time representation.
+*/
+QDateTime QDateTime::fromStdTimePoint(
+ std::chrono::time_point<
+ std::chrono::system_clock,
+ std::chrono::milliseconds
+ > time)
+{
+ return fromMSecsSinceEpoch(time.time_since_epoch().count(), QTimeZone::UTC);
+}
+
+/*!
\fn QDateTime QDateTime::fromStdTimePoint(const std::chrono::local_time<std::chrono::milliseconds> &time)
\since 6.4
diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h
index e1c0d29e2a..70a79a4f87 100644
--- a/src/corelib/time/qdatetime.h
+++ b/src/corelib/time/qdatetime.h
@@ -35,28 +35,28 @@ public:
#if __cpp_lib_chrono >= 201907L || defined(Q_QDOC)
QT_POST_CXX17_API_IN_EXPORTED_CLASS
Q_IMPLICIT constexpr QDate(std::chrono::year_month_day date) noexcept
- : jd(date.ok() ? stdSysDaysToJulianDay(date) : nullJd())
+ : jd(date.ok() ? stdSysDaysToJulianDay(date QT6_CALL_NEW_OVERLOAD_TAIL) : nullJd())
{}
QT_POST_CXX17_API_IN_EXPORTED_CLASS
Q_IMPLICIT constexpr QDate(std::chrono::year_month_day_last date) noexcept
- : jd(date.ok() ? stdSysDaysToJulianDay(date) : nullJd())
+ : jd(date.ok() ? stdSysDaysToJulianDay(date QT6_CALL_NEW_OVERLOAD_TAIL) : nullJd())
{}
QT_POST_CXX17_API_IN_EXPORTED_CLASS
Q_IMPLICIT constexpr QDate(std::chrono::year_month_weekday date) noexcept
- : jd(date.ok() ? stdSysDaysToJulianDay(date) : nullJd())
+ : jd(date.ok() ? stdSysDaysToJulianDay(date QT6_CALL_NEW_OVERLOAD_TAIL) : nullJd())
{}
QT_POST_CXX17_API_IN_EXPORTED_CLASS
Q_IMPLICIT constexpr QDate(std::chrono::year_month_weekday_last date) noexcept
- : jd(date.ok() ? stdSysDaysToJulianDay(date) : nullJd())
+ : jd(date.ok() ? stdSysDaysToJulianDay(date QT6_CALL_NEW_OVERLOAD_TAIL) : nullJd())
{}
QT_POST_CXX17_API_IN_EXPORTED_CLASS
static constexpr QDate fromStdSysDays(const std::chrono::sys_days &days) noexcept
{
- return QDate(stdSysDaysToJulianDay(days));
+ return QDate(stdSysDaysToJulianDay(days QT6_CALL_NEW_OVERLOAD_TAIL));
}
QT_POST_CXX17_API_IN_EXPORTED_CLASS
@@ -177,7 +177,9 @@ private:
static constexpr inline qint64 unixEpochJd() { return Q_INT64_C(2440588); }
#if __cpp_lib_chrono >= 201907L
- static constexpr qint64 stdSysDaysToJulianDay(const std::chrono::sys_days &days) noexcept
+ QT_POST_CXX17_API_IN_EXPORTED_CLASS
+ static constexpr qint64
+ stdSysDaysToJulianDay(const std::chrono::sys_days &days QT6_DECL_NEW_OVERLOAD_TAIL) noexcept
{
const auto epochDays = days.time_since_epoch().count();
// minJd() and maxJd() fit into 40 bits.
@@ -189,6 +191,13 @@ private:
}
return unixEpochJd() + epochDays;
}
+
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ static constexpr qint64 stdSysDaysToJulianDay(const std::chrono::sys_days &days) noexcept
+ {
+ return stdSysDaysToJulianDay(days QT6_CALL_NEW_OVERLOAD_TAIL);
+ }
+#endif // QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
#endif // __cpp_lib_chrono >= 201907L
qint64 jd;
@@ -499,8 +508,26 @@ public:
NSDate *toNSDate() const Q_DECL_NS_RETURNS_AUTORELEASED;
#endif
+ static QDateTime fromStdTimePoint(
+ std::chrono::time_point<
+ std::chrono::system_clock,
+ std::chrono::milliseconds
+ > time
+ );
+
#if __cpp_lib_chrono >= 201907L || defined(Q_QDOC)
#if __cpp_concepts >= 201907L || defined(Q_QDOC)
+private:
+ // The duration type of the result of a clock_cast<system_clock>.
+ // This duration may differ from the duration of the input.
+ template <typename Clock, typename Duration>
+ using system_clock_cast_duration = decltype(
+ std::chrono::clock_cast<std::chrono::system_clock>(
+ std::declval<const std::chrono::time_point<Clock, Duration> &>()
+ ).time_since_epoch()
+ );
+
+public:
// Generic clock, as long as it's compatible with us (= system_clock)
template <typename Clock, typename Duration>
static QDateTime fromStdTimePoint(const std::chrono::time_point<Clock, Duration> &time)
@@ -508,14 +535,18 @@ public:
requires(const std::chrono::time_point<Clock, Duration> &t) {
// the clock can be converted to system_clock
std::chrono::clock_cast<std::chrono::system_clock>(t);
- // the duration can be converted to milliseconds
- requires std::is_convertible_v<Duration, std::chrono::milliseconds>;
+ // after the conversion to system_clock, the duration type
+ // we get is convertible to milliseconds
+ requires std::is_convertible_v<
+ system_clock_cast_duration<Clock, Duration>,
+ std::chrono::milliseconds
+ >;
}
{
const auto sysTime = std::chrono::clock_cast<std::chrono::system_clock>(time);
// clock_cast can change the duration, so convert it again to milliseconds
const auto timeInMSec = std::chrono::time_point_cast<std::chrono::milliseconds>(sysTime);
- return fromMSecsSinceEpoch(timeInMSec.time_since_epoch().count(), Qt::UTC);
+ return fromStdTimePoint(timeInMSec);
}
#endif // __cpp_concepts
@@ -529,7 +560,7 @@ public:
QT_POST_CXX17_API_IN_EXPORTED_CLASS
static QDateTime fromStdLocalTime(const std::chrono::local_time<std::chrono::milliseconds> &time)
{
- QDateTime result(QDate(1970, 1, 1), QTime(0, 0, 0));
+ QDateTime result(QDate(1970, 1, 1), QTime(0, 0, 0), TransitionResolution::LegacyBehavior);
return result.addMSecs(time.time_since_epoch().count());
}
diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp
index 78520a51aa..cce32e7ad2 100644
--- a/src/corelib/time/qdatetimeparser.cpp
+++ b/src/corelib/time/qdatetimeparser.cpp
@@ -334,7 +334,7 @@ int QDateTimeParser::sectionPos(int sectionIndex) const
return sectionPos(sectionNode(sectionIndex));
}
-int QDateTimeParser::sectionPos(const SectionNode &sn) const
+int QDateTimeParser::sectionPos(SectionNode sn) const
{
switch (sn.type) {
case FirstSection: return 0;
@@ -2314,11 +2314,9 @@ QString QDateTimeParser::getAmPmText(AmPm ap, Case cs) const
/*
\internal
-
- I give arg2 preference because arg1 is always a QDateTime.
*/
-bool operator==(const QDateTimeParser::SectionNode &s1, const QDateTimeParser::SectionNode &s2)
+bool operator==(QDateTimeParser::SectionNode s1, QDateTimeParser::SectionNode s2)
{
return (s1.type == s2.type) && (s1.pos == s2.pos) && (s1.count == s2.count);
}
diff --git a/src/corelib/time/qdatetimeparser_p.h b/src/corelib/time/qdatetimeparser_p.h
index faf383f3d7..30e9e4d524 100644
--- a/src/corelib/time/qdatetimeparser_p.h
+++ b/src/corelib/time/qdatetimeparser_p.h
@@ -212,7 +212,7 @@ protected: // for the benefit of QDateTimeEditPrivate
int sectionSize(int index) const;
int sectionMaxSize(int index) const;
int sectionPos(int index) const;
- int sectionPos(const SectionNode &sn) const;
+ int sectionPos(SectionNode sn) const;
const SectionNode &sectionNode(int index) const;
Section sectionType(int index) const;
@@ -265,7 +265,7 @@ protected: // for the benefit of QDateTimeEditPrivate
};
Q_DECLARE_TYPEINFO(QDateTimeParser::SectionNode, Q_PRIMITIVE_TYPE);
-Q_CORE_EXPORT bool operator==(const QDateTimeParser::SectionNode &s1, const QDateTimeParser::SectionNode &s2);
+Q_CORE_EXPORT bool operator==(QDateTimeParser::SectionNode s1, QDateTimeParser::SectionNode s2);
Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeParser::Sections)
Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeParser::FieldInfo)
diff --git a/src/corelib/time/qtimezone.cpp b/src/corelib/time/qtimezone.cpp
index 3a68277a6c..8ce967cf9f 100644
--- a/src/corelib/time/qtimezone.cpp
+++ b/src/corelib/time/qtimezone.cpp
@@ -455,10 +455,17 @@ QTimeZone::QTimeZone(const QByteArray &ianaId)
d = new QUtcTimeZonePrivate(ianaId);
// If not recognized, try creating it with the system backend.
if (!d->isValid()) {
- if (ianaId.isEmpty())
+ if (ianaId.isEmpty()) {
d = newBackendTimeZone();
- else // Constructor MUST produce invalid for unsupported ID.
+ } else { // Constructor MUST produce invalid for unsupported ID.
d = newBackendTimeZone(ianaId);
+ if (!d->isValid()) {
+ // We may have a legacy alias for a supported IANA ID:
+ const QByteArray name = QTimeZonePrivate::aliasToIana(ianaId);
+ if (!name.isEmpty() && name != ianaId)
+ d = newBackendTimeZone(name);
+ }
+ }
}
// Can also handle UTC with arbitrary (valid) offset, but only do so as
// fall-back, since either of the above may handle it more informatively.
@@ -823,6 +830,34 @@ QByteArray QTimeZone::id() const
}
/*!
+ \since 6.8
+ Returns \c true if \a alias is an alternative name for this timezone.
+
+ The IANA (formerly Olson) database has renamed some zones during its
+ history. There are also some zones that only differed prior to 1970 but are
+ now treated as synonymous. Some backends may have data reaching to before
+ 1970 and produce distinct zones in the latter case. Others may produce zones
+ indistinguishable except by id(). This method determines whether an ID
+ refers (at least since 1970) to the same zone that this timezone object
+ describes.
+
+ This method is only available when feature \c timezone is enabled.
+*/
+bool QTimeZone::aliasMatches(QByteArrayView alias) const
+{
+ if (alias == id())
+ return true;
+ QByteArray mine = QTimeZonePrivate::aliasToIana(id());
+ // Empty if id() aliases to itself, which we've already checked:
+ if (!mine.isEmpty() && alias == mine)
+ return true;
+ QByteArray its = QTimeZonePrivate::aliasToIana(alias);
+ // Empty if alias aliases to itself, which we've already compared to id()
+ // and, where relevant, mine.
+ return !its.isEmpty() && its == (mine.isEmpty() ? id() : mine);
+}
+
+/*!
\since 6.2
Returns the territory for the time zone.
diff --git a/src/corelib/time/qtimezone.h b/src/corelib/time/qtimezone.h
index 46c7d6312b..6c490c4e25 100644
--- a/src/corelib/time/qtimezone.h
+++ b/src/corelib/time/qtimezone.h
@@ -166,6 +166,7 @@ public:
};
typedef QList<OffsetData> OffsetDataList;
+ bool aliasMatches(QByteArrayView alias) const;
QByteArray id() const;
QLocale::Territory territory() const;
# if QT_DEPRECATED_SINCE(6, 6)
diff --git a/src/corelib/time/qtimezonelocale.cpp b/src/corelib/time/qtimezonelocale.cpp
index 5757e55d28..cf3a84b317 100644
--- a/src/corelib/time/qtimezonelocale.cpp
+++ b/src/corelib/time/qtimezonelocale.cpp
@@ -4,7 +4,9 @@
#include <private/qtimezonelocale_p.h>
#include <private/qtimezoneprivate_p.h>
-#if !QT_CONFIG(icu) // Use data generated from CLDR:
+#if !QT_CONFIG(icu)
+# include <private/qdatetime_p.h>
+// Use data generated from CLDR:
# include <private/qtimezonelocale_data_p.h>
# include <private/qtimezoneprivate_data_p.h>
#endif
@@ -12,9 +14,90 @@
QT_BEGIN_NAMESPACE
#if QT_CONFIG(icu) // Get data from ICU:
+namespace {
+
+// Convert TimeType and NameType into ICU UCalendarDisplayNameType
+constexpr UCalendarDisplayNameType ucalDisplayNameType(QTimeZone::TimeType timeType,
+ QTimeZone::NameType nameType)
+{
+ // TODO ICU C UCalendarDisplayNameType does not support full set of C++ TimeZone::EDisplayType
+ // For now, treat Generic as Standard
+ switch (nameType) {
+ case QTimeZone::OffsetName:
+ Q_UNREACHABLE(); // Callers of ucalTimeZoneDisplayName() should take care of OffsetName.
+ case QTimeZone::ShortName:
+ return timeType == QTimeZone::DaylightTime ? UCAL_SHORT_DST : UCAL_SHORT_STANDARD;
+ case QTimeZone::DefaultName:
+ case QTimeZone::LongName:
+ return timeType == QTimeZone::DaylightTime ? UCAL_DST : UCAL_STANDARD;
+ }
+ Q_UNREACHABLE_RETURN(UCAL_STANDARD);
+}
+
+} // nameless namespace
+
namespace QtTimeZoneLocale {
+// Qt wrapper around ucal_getTimeZoneDisplayName()
+// Used directly by ICU backend; indirectly by TZ (see below).
+QString ucalTimeZoneDisplayName(UCalendar *ucal,
+ QTimeZone::TimeType timeType,
+ QTimeZone::NameType nameType,
+ const QByteArray &localeCode)
+{
+ constexpr int32_t BigNameLength = 50;
+ int32_t size = BigNameLength;
+ QString result(size, Qt::Uninitialized);
+ auto dst = [&result]() { return reinterpret_cast<UChar *>(result.data()); };
+ UErrorCode status = U_ZERO_ERROR;
+ const UCalendarDisplayNameType utype = ucalDisplayNameType(timeType, nameType);
+
+ // size = ucal_getTimeZoneDisplayName(cal, type, locale, result, resultLength, status)
+ size = ucal_getTimeZoneDisplayName(ucal, utype, localeCode.constData(),
+ dst(), size, &status);
+
+ // If overflow, then resize and retry
+ if (size > BigNameLength || status == U_BUFFER_OVERFLOW_ERROR) {
+ result.resize(size);
+ status = U_ZERO_ERROR;
+ size = ucal_getTimeZoneDisplayName(ucal, utype, localeCode.constData(),
+ dst(), size, &status);
+ }
+
+ if (!U_SUCCESS(status))
+ return QString();
+
+ // Resize and return:
+ result.resize(size);
+ return result;
+}
+
} // QtTimeZoneLocale
+
+// Used by TZ backends when ICU is available:
+QString QTimeZonePrivate::localeName(qint64 atMSecsSinceEpoch, int offsetFromUtc,
+ QTimeZone::TimeType timeType,
+ QTimeZone::NameType nameType,
+ const QLocale &locale) const
+{
+ Q_UNUSED(atMSecsSinceEpoch);
+ // TODO: use CLDR data for the offset name.
+ // No ICU API for offset formats, so fall back to our ISO one, even if
+ // locale isn't C:
+ if (nameType == QTimeZone::OffsetName)
+ return isoOffsetFormat(offsetFromUtc);
+
+ const QString id = QString::fromUtf8(m_id);
+ const QByteArray loc = locale.name().toUtf8();
+ UErrorCode status = U_ZERO_ERROR;
+ UCalendar *ucal = ucal_open(reinterpret_cast<const UChar *>(id.data()), id.size(),
+ loc.constData(), UCAL_DEFAULT, &status);
+ if (ucal && U_SUCCESS(status)) {
+ auto tidier = qScopeGuard([ucal]() { ucal_close(ucal); });
+ return QtTimeZoneLocale::ucalTimeZoneDisplayName(ucal, timeType, nameType, loc);
+ }
+ return QString();
+}
#else // No ICU, use QTZ[LP}_data_p.h data for feature timezone_locale.
namespace {
using namespace QtTimeZoneLocale; // QTZL_data_p.h
@@ -24,6 +107,20 @@ using namespace QtTimeZoneCldr; // QTZP_data_p.h
// Accessors for the QTZP_data_p.h
} // nameless namespace
+
+QString QTimeZonePrivate::localeName(qint64 atMSecsSinceEpoch, int offsetFromUtc,
+ QTimeZone::TimeType timeType,
+ QTimeZone::NameType nameType,
+ const QLocale &locale) const
+{
+ Q_ASSERT(nameType != QTimeZone::OffsetName || locale.language() != QLocale::C);
+ // Get data from QTZ[LP]_data_p.h
+
+ Q_UNUSED(atMSecsSinceEpoch);
+ Q_UNUSED(offsetFromUtc);
+ Q_UNUSED(timeType);
+ return QString();
+}
#endif // ICU
QT_END_NAMESPACE
diff --git a/src/corelib/time/qtimezonelocale_p.h b/src/corelib/time/qtimezonelocale_p.h
index adc8e83b35..6e6c6b51fd 100644
--- a/src/corelib/time/qtimezonelocale_p.h
+++ b/src/corelib/time/qtimezonelocale_p.h
@@ -14,18 +14,31 @@
//
// We mean it.
//
+#include <private/qglobal_p.h>
+#include <QtCore/qstring.h>
#include <QtCore/qtimezone.h>
+#if QT_CONFIG(icu)
+#include <unicode/ucal.h>
+#endif
+
QT_REQUIRE_CONFIG(timezone);
QT_REQUIRE_CONFIG(timezone_locale);
+QT_BEGIN_NAMESPACE
+
namespace QtTimeZoneLocale {
#if QT_CONFIG(icu)
+QString ucalTimeZoneDisplayName(UCalendar *ucal, QTimeZone::TimeType timeType,
+ QTimeZone::NameType nameType,
+ const QString &localeCode);
#else
// Define data types for QTZL_data_p.h
#endif
}
+QT_END_NAMESPACE
+
#endif // QTIMEZONELOCALE_P_H
diff --git a/src/corelib/time/qtimezoneprivate.cpp b/src/corelib/time/qtimezoneprivate.cpp
index 2ad0d874b6..1b70f6385f 100644
--- a/src/corelib/time/qtimezoneprivate.cpp
+++ b/src/corelib/time/qtimezoneprivate.cpp
@@ -5,6 +5,9 @@
#include "qtimezone.h"
#include "qtimezoneprivate_p.h"
+#if QT_CONFIG(timezone_locale)
+# include "qtimezonelocale_p.h"
+#endif
#include "qtimezoneprivate_data_p.h"
#include <qdatastream.h>
@@ -51,6 +54,11 @@ constexpr bool atLowerWindowsKey(const WindowsData &entry, qint16 winIdKey) noex
return entry.windowsIdKey < winIdKey;
}
+static bool earlierAliasId(const AliasData &entry, QByteArrayView aliasId) noexcept
+{
+ return entry.aliasId().compare(aliasId, Qt::CaseInsensitive) < 0;
+}
+
static bool earlierWindowsId(const WindowsData &entry, QByteArrayView winId) noexcept
{
return entry.windowsId().compare(winId, Qt::CaseInsensitive) < 0;
@@ -172,22 +180,37 @@ QString QTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch,
QTimeZone::NameType nameType,
const QLocale &locale) const
{
- if (nameType == QTimeZone::OffsetName)
- return isoOffsetFormat(offsetFromUtc(atMSecsSinceEpoch));
-
- if (isDaylightTime(atMSecsSinceEpoch))
- return displayName(QTimeZone::DaylightTime, nameType, locale);
- else
- return displayName(QTimeZone::StandardTime, nameType, locale);
+ const Data tran = data(atMSecsSinceEpoch);
+ if (tran.atMSecsSinceEpoch != invalidMSecs()) {
+ if (nameType == QTimeZone::OffsetName && locale.language() == QLocale::C)
+ return isoOffsetFormat(tran.offsetFromUtc);
+ if (nameType == QTimeZone::ShortName && isDataLocale(locale))
+ return tran.abbreviation;
+
+ QTimeZone::TimeType timeType
+ = tran.daylightTimeOffset != 0 ? QTimeZone::DaylightTime : QTimeZone::StandardTime;
+#if QT_CONFIG(timezone_locale)
+ return localeName(atMSecsSinceEpoch, tran.offsetFromUtc, timeType, nameType, locale);
+#else
+ return displayName(timeType, nameType, locale);
+#endif
+ }
+ return QString();
}
QString QTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
QTimeZone::NameType nameType,
const QLocale &locale) const
{
- Q_UNUSED(timeType);
- Q_UNUSED(nameType);
- Q_UNUSED(locale);
+ const Data tran = data(timeType);
+ if (tran.atMSecsSinceEpoch != invalidMSecs()) {
+ if (nameType == QTimeZone::OffsetName && isDataLocale(locale))
+ return isoOffsetFormat(tran.offsetFromUtc);
+
+#if QT_CONFIG(timezone_locale)
+ return localeName(tran.atMSecsSinceEpoch, tran.offsetFromUtc, timeType, nameType, locale);
+#endif
+ }
return QString();
}
@@ -227,6 +250,56 @@ bool QTimeZonePrivate::isDaylightTime(qint64 atMSecsSinceEpoch) const
return false;
}
+QTimeZonePrivate::Data QTimeZonePrivate::data(QTimeZone::TimeType timeType) const
+{
+ // True if tran is valid and has the DST-ness to match timeType:
+ const auto validMatch = [timeType](const QTimeZonePrivate::Data &tran) {
+ return tran.atMSecsSinceEpoch != invalidMSecs()
+ && ((timeType == QTimeZone::DaylightTime) != (tran.daylightTimeOffset == 0));
+ };
+
+ // Get current tran, use if suitable:
+ const qint64 currentMSecs = QDateTime::currentMSecsSinceEpoch();
+ QTimeZonePrivate::Data tran = data(currentMSecs);
+ if (validMatch(tran))
+ return tran;
+
+ if (hasTransitions()) {
+ // Otherwise, next tran probably flips DST-ness:
+ tran = nextTransition(currentMSecs);
+ if (validMatch(tran))
+ return tran;
+
+ // Failing that, prev (or present, if current MSecs is exactly a
+ // transition moment) tran defines what data() got us and the one before
+ // that probably flips DST-ness; failing that, keep marching backwards
+ // in search of a DST interval:
+ tran = previousTransition(currentMSecs + 1);
+ while (tran.atMSecsSinceEpoch != invalidMSecs()) {
+ tran = previousTransition(tran.atMSecsSinceEpoch);
+ if (validMatch(tran))
+ return tran;
+ }
+ }
+ return {};
+}
+
+/*!
+ \internal
+
+ Returns true if the abbreviation given in data()'s returns is appropriate
+ for use in the given \a locale.
+
+ Base implementation assumes data() corresponds to the system locale; derived
+ classes should override if their data() is something else (such as
+ C/English).
+*/
+bool QTimeZonePrivate::isDataLocale(const QLocale &locale) const
+{
+ // Guess data is for the system locale unless backend overrides that.
+ return locale == QLocale::system();
+}
+
QTimeZonePrivate::Data QTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const
{
Q_UNUSED(forMSecsSinceEpoch);
@@ -701,6 +774,18 @@ QString QTimeZonePrivate::isoOffsetFormat(int offsetFromUtc, QTimeZone::NameType
return result;
}
+QByteArray QTimeZonePrivate::aliasToIana(QByteArrayView alias)
+{
+ const auto data = std::lower_bound(std::begin(aliasMappingTable), std::end(aliasMappingTable),
+ alias, earlierAliasId);
+ if (data != std::end(aliasMappingTable) && data->aliasId() == alias)
+ return data->ianaId().toByteArray();
+ // Note: empty return means not an alias, which is true of an ID that others
+ // are aliases to, as the table omits self-alias entries. Let caller sort
+ // that out, rather than allocating to return alias.toByteArray().
+ return {};
+}
+
QByteArray QTimeZonePrivate::ianaIdToWindowsId(const QByteArray &id)
{
const auto idUtf8 = QUtf8StringView(id);
@@ -906,6 +991,19 @@ QTimeZonePrivate::Data QUtcTimeZonePrivate::data(qint64 forMSecsSinceEpoch) cons
return d;
}
+// Override to shortcut past base's complications:
+QTimeZonePrivate::Data QUtcTimeZonePrivate::data(QTimeZone::TimeType timeType) const
+{
+ Q_UNUSED(timeType);
+ return data(QDateTime::currentMSecsSinceEpoch());
+}
+
+bool QUtcTimeZonePrivate::isDataLocale(const QLocale &locale) const
+{
+ // Officially only supports C locale names; these are surely also viable for English.
+ return locale.language() == QLocale::C || locale.language() == QLocale::English;
+}
+
void QUtcTimeZonePrivate::init(const QByteArray &zoneId)
{
m_id = zoneId;
@@ -933,6 +1031,15 @@ QString QUtcTimeZonePrivate::comment() const
return m_comment;
}
+// Override to bypass complications in base-class:
+QString QUtcTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch,
+ QTimeZone::NameType nameType,
+ const QLocale &locale) const
+{
+ Q_UNUSED(atMSecsSinceEpoch);
+ return displayName(QTimeZone::StandardTime, nameType, locale);
+}
+
QString QUtcTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
QTimeZone::NameType nameType,
const QLocale &locale) const
diff --git a/src/corelib/time/qtimezoneprivate_data_p.h b/src/corelib/time/qtimezoneprivate_data_p.h
index 5174f06a0d..26bc5e02df 100644
--- a/src/corelib/time/qtimezoneprivate_data_p.h
+++ b/src/corelib/time/qtimezoneprivate_data_p.h
@@ -25,7 +25,7 @@ QT_BEGIN_NAMESPACE
namespace QtTimeZoneCldr {
/*
- Recognized UTC-offset zones and CLDR-derived data on Windows IDs.
+ Recognized UTC-offset zones and CLDR-derived data on timezone IDs.
The UTC-offset zone table is provided for generic UTC±HH:mm format time
zones. The UTC backend can support arbitrary offsets in seconds, but only
@@ -44,6 +44,17 @@ namespace QtTimeZoneCldr {
of its last update and how to update it.
*/
+struct AliasData
+{
+ // Table is sorted on aliasId(), then on ianaId().
+ // Indices in alias table, not IANA (group) table
+ quint16 aliasIdIndex;
+ quint16 ianaIdIndex;
+ // Values for the actual IDs:
+ constexpr QByteArrayView aliasId() const;
+ constexpr QByteArrayView ianaId() const;
+};
+
struct ZoneData
{
// Keys (table is sorted in Windows ID, then on territory enum value):
@@ -77,8 +88,8 @@ struct UtcData
// GENERATED PART STARTS HERE
/*
- This part of the file was generated on 2024-01-29 from the
- Common Locale Data Repository v43 file supplemental/windowsZones.xml
+ This part of the file was generated on 2024-02-07 from the
+ Common Locale Data Repository v43
http://www.unicode.org/cldr/
@@ -86,6 +97,144 @@ struct UtcData
edited) CLDR data; see qtbase/util/locale_database/.
*/
+// Alias ID Index, IANA ID Index
+static constexpr AliasData aliasMappingTable[] = {
+ { 0, 14 }, // Africa/Asmara -> Africa/Asmera
+ { 28, 44 }, // Africa/Timbuktu -> Africa/Bamako
+ { 58, 89 }, // America/Argentina/Buenos_Aires -> America/Buenos_Aires
+ { 110, 138 }, // America/Argentina/Catamarca -> America/Catamarca
+ { 156, 138 }, // America/Argentina/ComodRivadavia -> America/Catamarca
+ { 189, 215 }, // America/Argentina/Cordoba -> America/Cordoba
+ { 231, 255 }, // America/Argentina/Jujuy -> America/Jujuy
+ { 269, 295 }, // America/Argentina/Mendoza -> America/Mendoza
+ { 311, 328 }, // America/Atikokan -> America/Coral_Harbour
+ { 350, 363 }, // America/Atka -> America/Adak
+ { 376, 393 }, // America/Ensenada -> America/Tijuana
+ { 409, 428 }, // America/Fort_Wayne -> America/Indianapolis
+ { 449, 428 }, // America/Indiana/Indianapolis -> America/Indianapolis
+ { 478, 506 }, // America/Kentucky/Louisville -> America/Louisville
+ { 525, 541 }, // America/Knox_IN -> America/Indiana/Knox
+ { 562, 579 }, // America/Montreal -> America/Toronto
+ { 595, 608 }, // America/Nuuk -> America/Godthab
+ { 624, 643 }, // America/Porto_Acre -> America/Rio_Branco
+ { 662, 215 }, // America/Rosario -> America/Cordoba
+ { 678, 695 }, // America/Shiprock -> America/Denver
+ { 710, 725 }, // America/Virgin -> America/St_Thomas
+ { 743, 765 }, // Antarctica/South_Pole -> Pacific/Auckland
+ { 782, 797 }, // Asia/Ashkhabad -> Asia/Ashgabat
+ { 811, 826 }, // Asia/Chongqing -> Asia/Shanghai
+ { 840, 826 }, // Asia/Chungking -> Asia/Shanghai
+ { 855, 866 }, // Asia/Dacca -> Asia/Dhaka
+ { 877, 826 }, // Asia/Harbin -> Asia/Shanghai
+ { 889, 906 }, // Asia/Ho_Chi_Minh -> Asia/Saigon
+ { 918, 932 }, // Asia/Istanbul -> Europe/Istanbul
+ { 948, 961 }, // Asia/Kashgar -> Asia/Urumqi
+ { 973, 988 }, // Asia/Kathmandu -> Asia/Katmandu
+ { 1002, 1015 }, // Asia/Kolkata -> Asia/Calcutta
+ { 1029, 1040 }, // Asia/Macao -> Asia/Macau
+ { 1051, 1065 }, // Asia/Tel_Aviv -> Asia/Jerusalem
+ { 1080, 1092 }, // Asia/Thimbu -> Asia/Thimphu
+ { 1105, 1124 }, // Asia/Ujung_Pandang -> Asia/Makassar
+ { 1138, 1154 }, // Asia/Ulan_Bator -> Asia/Ulaanbaatar
+ { 1171, 1183 }, // Asia/Yangon -> Asia/Rangoon
+ { 1196, 1211 }, // Atlantic/Faroe -> Atlantic/Faeroe
+ { 1227, 1246 }, // Atlantic/Jan_Mayen -> Arctic/Longyearbyen
+ { 1266, 1280 }, // Australia/ACT -> Australia/Sydney
+ { 1297, 1280 }, // Australia/Canberra -> Australia/Sydney
+ { 1316, 1330 }, // Australia/LHI -> Australia/Lord_Howe
+ { 1350, 1280 }, // Australia/NSW -> Australia/Sydney
+ { 1364, 1380 }, // Australia/North -> Australia/Darwin
+ { 1397, 1418 }, // Australia/Queensland -> Australia/Brisbane
+ { 1437, 1453 }, // Australia/South -> Australia/Adelaide
+ { 1472, 1491 }, // Australia/Tasmania -> Australia/Hobart
+ { 1508, 1527 }, // Australia/Victoria -> Australia/Melbourne
+ { 1547, 1562 }, // Australia/West -> Australia/Perth
+ { 1578, 1599 }, // Australia/Yancowinna -> Australia/Broken_Hill
+ { 1621, 643 }, // Brazil/Acre -> America/Rio_Branco
+ { 1633, 1650 }, // Brazil/DeNoronha -> America/Noronha
+ { 1666, 1678 }, // Brazil/East -> America/Sao_Paulo
+ { 1696, 1708 }, // Brazil/West -> America/Manaus
+ { 1723, 1739 }, // Canada/Atlantic -> America/Halifax
+ { 1755, 1770 }, // Canada/Central -> America/Winnipeg
+ { 1787, 1812 }, // Canada/East-Saskatchewan -> America/Regina
+ { 1827, 579 }, // Canada/Eastern -> America/Toronto
+ { 1842, 1858 }, // Canada/Mountain -> America/Edmonton
+ { 1875, 1895 }, // Canada/Newfoundland -> America/St_Johns
+ { 1912, 1927 }, // Canada/Pacific -> America/Vancouver
+ { 1945, 1812 }, // Canada/Saskatchewan -> America/Regina
+ { 1965, 1978 }, // Canada/Yukon -> America/Whitehorse
+ { 1997, 2015 }, // Chile/Continental -> America/Santiago
+ { 2032, 2051 }, // Chile/EasterIsland -> Pacific/Easter
+ { 2066, 2071 }, // Cuba -> America/Havana
+ { 2086, 2090 }, // EST -> Etc/GMT+5
+ { 2100, 2106 }, // Egypt -> Africa/Cairo
+ { 2119, 2124 }, // Eire -> Europe/Dublin
+ { 2138, 2148 }, // Etc/GMT+0 -> Etc/GMT
+ { 2156, 2148 }, // Etc/GMT-0 -> Etc/GMT
+ { 2166, 2148 }, // Etc/GMT0 -> Etc/GMT
+ { 2175, 2148 }, // Etc/Greenwich -> Etc/GMT
+ { 2189, 2197 }, // Etc/UCT -> Etc/UTC
+ { 2205, 2197 }, // Etc/Universal -> Etc/UTC
+ { 2219, 2197 }, // Etc/Zulu -> Etc/UTC
+ { 2228, 2243 }, // Europe/Belfast -> Europe/London
+ { 2257, 2269 }, // Europe/Kyiv -> Europe/Kiev
+ { 2281, 2296 }, // Europe/Nicosia -> Asia/Nicosia
+ { 2309, 2325 }, // Europe/Tiraspol -> Europe/Chisinau
+ { 2341, 2243 }, // GB -> Europe/London
+ { 2344, 2243 }, // GB-Eire -> Europe/London
+ { 2352, 2148 }, // GMT -> Etc/GMT
+ { 2356, 2148 }, // GMT+0 -> Etc/GMT
+ { 2362, 2148 }, // GMT-0 -> Etc/GMT
+ { 2368, 2148 }, // GMT0 -> Etc/GMT
+ { 2373, 2148 }, // Greenwich -> Etc/GMT
+ { 2383, 2387 }, // HST -> Etc/GMT+10
+ { 2398, 2407 }, // Hongkong -> Asia/Hong_Kong
+ { 2422, 2430 }, // Iceland -> Atlantic/Reykjavik
+ { 2449, 2454 }, // Iran -> Asia/Tehran
+ { 2466, 1065 }, // Israel -> Asia/Jerusalem
+ { 2473, 2481 }, // Jamaica -> America/Jamaica
+ { 2497, 2503 }, // Japan -> Asia/Tokyo
+ { 2514, 2524 }, // Kwajalein -> Pacific/Kwajalein
+ { 2542, 2548 }, // Libya -> Africa/Tripoli
+ { 2563, 2567 }, // MST -> Etc/GMT+7
+ { 2577, 393 }, // Mexico/BajaNorte -> America/Tijuana
+ { 2594, 2609 }, // Mexico/BajaSur -> America/Mazatlan
+ { 2626, 2641 }, // Mexico/General -> America/Mexico_City
+ { 2661, 765 }, // NZ -> Pacific/Auckland
+ { 2664, 2672 }, // NZ-CHAT -> Pacific/Chatham
+ { 2688, 695 }, // Navajo -> America/Denver
+ { 2695, 826 }, // PRC -> Asia/Shanghai
+ { 2699, 2713 }, // Pacific/Chuuk -> Pacific/Truk
+ { 2726, 2741 }, // Pacific/Kanton -> Pacific/Enderbury
+ { 2759, 2775 }, // Pacific/Pohnpei -> Pacific/Ponape
+ { 2790, 2804 }, // Pacific/Samoa -> Pacific/Pago_Pago
+ { 2822, 2713 }, // Pacific/Yap -> Pacific/Truk
+ { 2834, 2841 }, // Poland -> Europe/Warsaw
+ { 2855, 2864 }, // Portugal -> Europe/Lisbon
+ { 2878, 2882 }, // ROC -> Asia/Taipei
+ { 2894, 2898 }, // ROK -> Asia/Seoul
+ { 2909, 2919 }, // Singapore -> Asia/Singapore
+ { 2934, 932 }, // Turkey -> Europe/Istanbul
+ { 2941, 2197 }, // UCT -> Etc/UTC
+ { 2945, 2955 }, // US/Alaska -> America/Anchorage
+ { 2973, 363 }, // US/Aleutian -> America/Adak
+ { 2985, 2996 }, // US/Arizona -> America/Phoenix
+ { 3012, 3023 }, // US/Central -> America/Chicago
+ { 3039, 428 }, // US/East-Indiana -> America/Indianapolis
+ { 3055, 3066 }, // US/Eastern -> America/New_York
+ { 3083, 3093 }, // US/Hawaii -> Pacific/Honolulu
+ { 3110, 541 }, // US/Indiana-Starke -> America/Indiana/Knox
+ { 3128, 3140 }, // US/Michigan -> America/Detroit
+ { 3156, 695 }, // US/Mountain -> America/Denver
+ { 3168, 3179 }, // US/Pacific -> America/Los_Angeles
+ { 3199, 3179 }, // US/Pacific-New -> America/Los_Angeles
+ { 3214, 2804 }, // US/Samoa -> Pacific/Pago_Pago
+ { 3223, 2197 }, // UTC -> Etc/UTC
+ { 3227, 2197 }, // Universal -> Etc/UTC
+ { 3237, 3242 }, // W-SU -> Europe/Moscow
+ { 3256, 2197 }, // Zulu -> Etc/UTC
+};
+
// Windows ID Key, Territory Enum, IANA ID Index
static constexpr ZoneData zoneDataTable[] = {
{ 1, 1, 0 }, // Afghanistan Standard Time / Afghanistan
@@ -184,462 +333,462 @@ static constexpr ZoneData zoneDataTable[] = {
{ 41, 0, 2235 }, // Eastern Standard Time / AnyTerritory
{ 41, 18, 2243 }, // Eastern Standard Time / Bahamas
{ 41, 41, 2258 }, // Eastern Standard Time / Canada
- { 41, 248, 2363 }, // Eastern Standard Time / United States
- { 42, 152, 2520 }, // Eastern Standard Time (Mexico) / Mexico
- { 43, 71, 2535 }, // Egypt Standard Time / Egypt
- { 44, 193, 2548 }, // Ekaterinburg Standard Time / Russia
- { 45, 82, 2567 }, // Fiji Standard Time / Fiji
- { 46, 2, 2580 }, // FLE Standard Time / Aland Islands
- { 46, 36, 2597 }, // FLE Standard Time / Bulgaria
- { 46, 75, 2610 }, // FLE Standard Time / Estonia
- { 46, 83, 2625 }, // FLE Standard Time / Finland
- { 46, 131, 2641 }, // FLE Standard Time / Latvia
- { 46, 137, 2653 }, // FLE Standard Time / Lithuania
- { 46, 244, 2668 }, // FLE Standard Time / Ukraine
- { 47, 90, 2714 }, // Georgian Standard Time / Georgia
- { 48, 81, 2727 }, // GMT Standard Time / Faroe Islands
- { 48, 100, 2743 }, // GMT Standard Time / Guernsey
- { 48, 114, 2759 }, // GMT Standard Time / Ireland
- { 48, 115, 2773 }, // GMT Standard Time / Isle of Man
- { 48, 121, 2792 }, // GMT Standard Time / Jersey
- { 48, 188, 2806 }, // GMT Standard Time / Portugal
- { 48, 220, 2837 }, // GMT Standard Time / Spain
- { 48, 246, 2853 }, // GMT Standard Time / United Kingdom
- { 49, 95, 2867 }, // Greenland Standard Time / Greenland
- { 50, 37, 2883 }, // Greenwich Standard Time / Burkina Faso
- { 50, 89, 2902 }, // Greenwich Standard Time / Gambia
- { 50, 92, 2916 }, // Greenwich Standard Time / Ghana
- { 50, 95, 2929 }, // Greenwich Standard Time / Greenland
- { 50, 101, 2950 }, // Greenwich Standard Time / Guinea-Bissau
- { 50, 102, 2964 }, // Greenwich Standard Time / Guinea
- { 50, 109, 2979 }, // Greenwich Standard Time / Iceland
- { 50, 118, 2998 }, // Greenwich Standard Time / Ivory Coast
- { 50, 134, 3013 }, // Greenwich Standard Time / Liberia
- { 50, 145, 3029 }, // Greenwich Standard Time / Mali
- { 50, 149, 3043 }, // Greenwich Standard Time / Mauritania
- { 50, 196, 3061 }, // Greenwich Standard Time / Saint Helena
- { 50, 206, 3080 }, // Greenwich Standard Time / Senegal
- { 50, 209, 3093 }, // Greenwich Standard Time / Sierra Leone
- { 50, 233, 3109 }, // Greenwich Standard Time / Togo
- { 51, 63, 3121 }, // GTB Standard Time / Cyprus
- { 51, 94, 3149 }, // GTB Standard Time / Greece
- { 51, 192, 3163 }, // GTB Standard Time / Romania
- { 52, 104, 3180 }, // Haiti Standard Time / Haiti
- { 53, 0, 3203 }, // Hawaiian Standard Time / AnyTerritory
- { 53, 58, 3214 }, // Hawaiian Standard Time / Cook Islands
- { 53, 86, 3232 }, // Hawaiian Standard Time / French Polynesia
- { 53, 247, 3247 }, // Hawaiian Standard Time / United States Outlying Islands
- { 53, 248, 3264 }, // Hawaiian Standard Time / United States
- { 54, 110, 3281 }, // India Standard Time / India
- { 55, 112, 3295 }, // Iran Standard Time / Iran
- { 56, 116, 3307 }, // Israel Standard Time / Israel
- { 57, 122, 3322 }, // Jordan Standard Time / Jordan
- { 58, 193, 3333 }, // Kaliningrad Standard Time / Russia
- { 59, 218, 3352 }, // Korea Standard Time / South Korea
- { 60, 135, 3363 }, // Libya Standard Time / Libya
- { 61, 0, 3378 }, // Line Islands Standard Time / AnyTerritory
- { 61, 125, 3389 }, // Line Islands Standard Time / Kiribati
- { 62, 15, 3408 }, // Lord Howe Standard Time / Australia
- { 63, 193, 3428 }, // Magadan Standard Time / Russia
- { 64, 49, 3441 }, // Magallanes Standard Time / Chile
- { 65, 86, 3462 }, // Marquesas Standard Time / French Polynesia
- { 66, 150, 3480 }, // Mauritius Standard Time / Mauritius
- { 66, 191, 3497 }, // Mauritius Standard Time / Reunion
- { 66, 208, 3512 }, // Mauritius Standard Time / Seychelles
- { 67, 132, 3524 }, // Middle East Standard Time / Lebanon
- { 68, 250, 3536 }, // Montevideo Standard Time / Uruguay
- { 69, 159, 3555 }, // Morocco Standard Time / Morocco
- { 69, 257, 3573 }, // Morocco Standard Time / Western Sahara
- { 70, 0, 3589 }, // Mountain Standard Time / AnyTerritory
- { 70, 41, 3597 }, // Mountain Standard Time / Canada
- { 70, 152, 3671 }, // Mountain Standard Time / Mexico
- { 70, 248, 3693 }, // Mountain Standard Time / United States
- { 71, 152, 3722 }, // Mountain Standard Time (Mexico) / Mexico
- { 72, 53, 3739 }, // Myanmar Standard Time / Cocos Islands
- { 72, 161, 3752 }, // Myanmar Standard Time / Myanmar
- { 73, 193, 3765 }, // N. Central Asia Standard Time / Russia
- { 74, 162, 3782 }, // Namibia Standard Time / Namibia
- { 75, 164, 3798 }, // Nepal Standard Time / Nepal
- { 76, 9, 3812 }, // New Zealand Standard Time / Antarctica
- { 76, 167, 3831 }, // New Zealand Standard Time / New Zealand
- { 77, 41, 3848 }, // Newfoundland Standard Time / Canada
- { 78, 172, 3865 }, // Norfolk Standard Time / Norfolk Island
- { 79, 193, 3881 }, // North Asia East Standard Time / Russia
- { 80, 193, 3894 }, // North Asia Standard Time / Russia
- { 81, 174, 3929 }, // North Korea Standard Time / North Korea
- { 82, 193, 3944 }, // Omsk Standard Time / Russia
- { 83, 49, 3954 }, // Pacific SA Standard Time / Chile
- { 84, 0, 3971 }, // Pacific Standard Time / AnyTerritory
- { 84, 41, 3979 }, // Pacific Standard Time / Canada
- { 84, 248, 3997 }, // Pacific Standard Time / United States
- { 85, 152, 4017 }, // Pacific Standard Time (Mexico) / Mexico
- { 86, 178, 4054 }, // Pakistan Standard Time / Pakistan
- { 87, 183, 4067 }, // Paraguay Standard Time / Paraguay
- { 88, 123, 4084 }, // Qyzylorda Standard Time / Kazakhstan
- { 89, 23, 4099 }, // Romance Standard Time / Belgium
- { 89, 65, 4115 }, // Romance Standard Time / Denmark
- { 89, 84, 4133 }, // Romance Standard Time / France
- { 89, 220, 4146 }, // Romance Standard Time / Spain
- { 90, 193, 4173 }, // Russia Time Zone 10 / Russia
- { 91, 193, 4192 }, // Russia Time Zone 11 / Russia
- { 92, 193, 4219 }, // Russia Time Zone 3 / Russia
- { 93, 193, 4233 }, // Russian Standard Time / Russia
- { 93, 244, 4260 }, // Russian Standard Time / Ukraine
- { 94, 0, 4278 }, // SA Eastern Standard Time / AnyTerritory
- { 94, 9, 4288 }, // SA Eastern Standard Time / Antarctica
- { 94, 32, 4325 }, // SA Eastern Standard Time / Brazil
- { 94, 80, 4404 }, // SA Eastern Standard Time / Falkland Islands
- { 94, 85, 4421 }, // SA Eastern Standard Time / French Guiana
- { 94, 223, 4437 }, // SA Eastern Standard Time / Suriname
- { 95, 0, 4456 }, // SA Pacific Standard Time / AnyTerritory
- { 95, 32, 4466 }, // SA Pacific Standard Time / Brazil
- { 95, 41, 4502 }, // SA Pacific Standard Time / Canada
- { 95, 45, 4524 }, // SA Pacific Standard Time / Cayman Islands
- { 95, 54, 4539 }, // SA Pacific Standard Time / Colombia
- { 95, 70, 4554 }, // SA Pacific Standard Time / Ecuador
- { 95, 119, 4572 }, // SA Pacific Standard Time / Jamaica
- { 95, 181, 4588 }, // SA Pacific Standard Time / Panama
- { 95, 184, 4603 }, // SA Pacific Standard Time / Peru
- { 96, 0, 4616 }, // SA Western Standard Time / AnyTerritory
- { 96, 8, 4626 }, // SA Western Standard Time / Anguilla
- { 96, 10, 4643 }, // SA Western Standard Time / Antigua and Barbuda
- { 96, 13, 4659 }, // SA Western Standard Time / Aruba
- { 96, 21, 4673 }, // SA Western Standard Time / Barbados
- { 96, 28, 4690 }, // SA Western Standard Time / Bolivia
- { 96, 32, 4705 }, // SA Western Standard Time / Brazil
- { 96, 34, 4758 }, // SA Western Standard Time / British Virgin Islands
- { 96, 41, 4774 }, // SA Western Standard Time / Canada
- { 96, 44, 4795 }, // SA Western Standard Time / Caribbean Netherlands
- { 96, 62, 4814 }, // SA Western Standard Time / Curacao
- { 96, 68, 4830 }, // SA Western Standard Time / Dominica
- { 96, 69, 4847 }, // SA Western Standard Time / Dominican Republic
- { 96, 96, 4869 }, // SA Western Standard Time / Grenada
- { 96, 97, 4885 }, // SA Western Standard Time / Guadeloupe
- { 96, 103, 4904 }, // SA Western Standard Time / Guyana
- { 96, 148, 4919 }, // SA Western Standard Time / Martinique
- { 96, 158, 4938 }, // SA Western Standard Time / Montserrat
- { 96, 189, 4957 }, // SA Western Standard Time / Puerto Rico
- { 96, 195, 4977 }, // SA Western Standard Time / Saint Barthelemy
- { 96, 197, 4999 }, // SA Western Standard Time / Saint Kitts and Nevis
- { 96, 198, 5016 }, // SA Western Standard Time / Saint Lucia
- { 96, 199, 5033 }, // SA Western Standard Time / Saint Martin
- { 96, 201, 5049 }, // SA Western Standard Time / Saint Vincent and Grenadines
- { 96, 211, 5068 }, // SA Western Standard Time / Sint Maarten
- { 96, 236, 5090 }, // SA Western Standard Time / Trinidad and Tobago
- { 96, 249, 5112 }, // SA Western Standard Time / United States Virgin Islands
- { 97, 200, 5130 }, // Saint Pierre Standard Time / Saint Pierre and Miquelon
- { 98, 193, 5147 }, // Sakhalin Standard Time / Russia
- { 99, 202, 5161 }, // Samoa Standard Time / Samoa
- { 100, 204, 5174 }, // Sao Tome Standard Time / Sao Tome and Principe
- { 101, 193, 5190 }, // Saratov Standard Time / Russia
- { 102, 0, 5205 }, // SE Asia Standard Time / AnyTerritory
- { 102, 9, 5215 }, // SE Asia Standard Time / Antarctica
- { 102, 39, 5232 }, // SE Asia Standard Time / Cambodia
- { 102, 51, 5248 }, // SE Asia Standard Time / Christmas Island
- { 102, 111, 5265 }, // SE Asia Standard Time / Indonesia
- { 102, 129, 5293 }, // SE Asia Standard Time / Laos
- { 102, 231, 5308 }, // SE Asia Standard Time / Thailand
- { 102, 255, 5321 }, // SE Asia Standard Time / Vietnam
- { 103, 0, 5333 }, // Singapore Standard Time / AnyTerritory
- { 103, 35, 5343 }, // Singapore Standard Time / Brunei
- { 103, 111, 5355 }, // Singapore Standard Time / Indonesia
- { 103, 143, 5369 }, // Singapore Standard Time / Malaysia
- { 103, 185, 5400 }, // Singapore Standard Time / Philippines
- { 103, 210, 5412 }, // Singapore Standard Time / Singapore
- { 104, 0, 5427 }, // South Africa Standard Time / AnyTerritory
- { 104, 30, 5437 }, // South Africa Standard Time / Botswana
- { 104, 38, 5453 }, // South Africa Standard Time / Burundi
- { 104, 57, 5470 }, // South Africa Standard Time / Congo - Kinshasa
- { 104, 76, 5488 }, // South Africa Standard Time / Eswatini
- { 104, 133, 5503 }, // South Africa Standard Time / Lesotho
- { 104, 142, 5517 }, // South Africa Standard Time / Malawi
- { 104, 160, 5533 }, // South Africa Standard Time / Mozambique
- { 104, 194, 5547 }, // South Africa Standard Time / Rwanda
- { 104, 216, 5561 }, // South Africa Standard Time / South Africa
- { 104, 260, 5581 }, // South Africa Standard Time / Zambia
- { 104, 261, 5595 }, // South Africa Standard Time / Zimbabwe
- { 105, 219, 5609 }, // South Sudan Standard Time / South Sudan
- { 106, 221, 5621 }, // Sri Lanka Standard Time / Sri Lanka
- { 107, 222, 5634 }, // Sudan Standard Time / Sudan
- { 108, 227, 5650 }, // Syria Standard Time / Syria
- { 109, 228, 5664 }, // Taipei Standard Time / Taiwan
- { 110, 15, 5676 }, // Tasmania Standard Time / Australia
- { 111, 32, 5731 }, // Tocantins Standard Time / Brazil
- { 112, 0, 5749 }, // Tokyo Standard Time / AnyTerritory
- { 112, 111, 5759 }, // Tokyo Standard Time / Indonesia
- { 112, 120, 5773 }, // Tokyo Standard Time / Japan
- { 112, 179, 5784 }, // Tokyo Standard Time / Palau
- { 112, 232, 5798 }, // Tokyo Standard Time / Timor-Leste
- { 113, 193, 5808 }, // Tomsk Standard Time / Russia
- { 114, 235, 5819 }, // Tonga Standard Time / Tonga
- { 115, 193, 5837 }, // Transbaikal Standard Time / Russia
- { 116, 239, 5848 }, // Turkey Standard Time / Turkey
- { 117, 241, 5864 }, // Turks And Caicos Standard Time / Turks and Caicos Islands
- { 118, 156, 5883 }, // Ulaanbaatar Standard Time / Mongolia
- { 119, 248, 5916 }, // US Eastern Standard Time / United States
- { 120, 0, 5983 }, // US Mountain Standard Time / AnyTerritory
- { 120, 41, 5993 }, // US Mountain Standard Time / Canada
- { 120, 152, 6050 }, // US Mountain Standard Time / Mexico
- { 120, 248, 6069 }, // US Mountain Standard Time / United States
- { 121, 0, 6085 }, // UTC / AnyTerritory
- { 122, 0, 6101 }, // UTC+12 / AnyTerritory
- { 122, 125, 6112 }, // UTC+12 / Kiribati
- { 122, 147, 6127 }, // UTC+12 / Marshall Islands
- { 122, 163, 6160 }, // UTC+12 / Nauru
- { 122, 242, 6174 }, // UTC+12 / Tuvalu
- { 122, 247, 6191 }, // UTC+12 / United States Outlying Islands
- { 122, 256, 6204 }, // UTC+12 / Wallis and Futuna
- { 123, 0, 6219 }, // UTC+13 / AnyTerritory
- { 123, 125, 6230 }, // UTC+13 / Kiribati
- { 123, 234, 6248 }, // UTC+13 / Tokelau
- { 124, 0, 6264 }, // UTC-02 / AnyTerritory
- { 124, 32, 6274 }, // UTC-02 / Brazil
- { 124, 217, 6290 }, // UTC-02 / South Georgia and South Sandwich Islands
- { 125, 0, 6313 }, // UTC-08 / AnyTerritory
- { 125, 186, 6323 }, // UTC-08 / Pitcairn
- { 126, 0, 6340 }, // UTC-09 / AnyTerritory
- { 126, 86, 6350 }, // UTC-09 / French Polynesia
- { 127, 0, 6366 }, // UTC-11 / AnyTerritory
- { 127, 5, 6377 }, // UTC-11 / American Samoa
- { 127, 171, 6395 }, // UTC-11 / Niue
- { 127, 247, 6408 }, // UTC-11 / United States Outlying Islands
- { 128, 254, 6423 }, // Venezuela Standard Time / Venezuela
- { 129, 193, 6439 }, // Vladivostok Standard Time / Russia
- { 130, 193, 6470 }, // Volgograd Standard Time / Russia
- { 131, 15, 6487 }, // W. Australia Standard Time / Australia
- { 132, 0, 6503 }, // W. Central Africa Standard Time / AnyTerritory
- { 132, 4, 6513 }, // W. Central Africa Standard Time / Algeria
- { 132, 7, 6528 }, // W. Central Africa Standard Time / Angola
- { 132, 25, 6542 }, // W. Central Africa Standard Time / Benin
- { 132, 40, 6560 }, // W. Central Africa Standard Time / Cameroon
- { 132, 46, 6574 }, // W. Central Africa Standard Time / Central African Republic
- { 132, 48, 6588 }, // W. Central Africa Standard Time / Chad
- { 132, 56, 6604 }, // W. Central Africa Standard Time / Congo - Brazzaville
- { 132, 57, 6623 }, // W. Central Africa Standard Time / Congo - Kinshasa
- { 132, 73, 6639 }, // W. Central Africa Standard Time / Equatorial Guinea
- { 132, 88, 6653 }, // W. Central Africa Standard Time / Gabon
- { 132, 169, 6671 }, // W. Central Africa Standard Time / Nigeria
- { 132, 170, 6684 }, // W. Central Africa Standard Time / Niger
- { 132, 238, 6698 }, // W. Central Africa Standard Time / Tunisia
- { 133, 6, 6711 }, // W. Europe Standard Time / Andorra
- { 133, 16, 6726 }, // W. Europe Standard Time / Austria
- { 133, 91, 6740 }, // W. Europe Standard Time / Germany
- { 133, 93, 6770 }, // W. Europe Standard Time / Gibraltar
- { 133, 117, 6787 }, // W. Europe Standard Time / Italy
- { 133, 136, 6799 }, // W. Europe Standard Time / Liechtenstein
- { 133, 138, 6812 }, // W. Europe Standard Time / Luxembourg
- { 133, 146, 6830 }, // W. Europe Standard Time / Malta
- { 133, 155, 6843 }, // W. Europe Standard Time / Monaco
- { 133, 165, 6857 }, // W. Europe Standard Time / Netherlands
- { 133, 175, 6874 }, // W. Europe Standard Time / Norway
- { 133, 203, 6886 }, // W. Europe Standard Time / San Marino
- { 133, 224, 6904 }, // W. Europe Standard Time / Svalbard and Jan Mayen
- { 133, 225, 6924 }, // W. Europe Standard Time / Sweden
- { 133, 226, 6941 }, // W. Europe Standard Time / Switzerland
- { 133, 253, 6955 }, // W. Europe Standard Time / Vatican City
- { 134, 156, 6970 }, // W. Mongolia Standard Time / Mongolia
- { 135, 0, 6980 }, // West Asia Standard Time / AnyTerritory
- { 135, 9, 6990 }, // West Asia Standard Time / Antarctica
- { 135, 87, 7008 }, // West Asia Standard Time / French Southern Territories
- { 135, 123, 7025 }, // West Asia Standard Time / Kazakhstan
- { 135, 144, 7070 }, // West Asia Standard Time / Maldives
- { 135, 229, 7086 }, // West Asia Standard Time / Tajikistan
- { 135, 240, 7100 }, // West Asia Standard Time / Turkmenistan
- { 135, 251, 7114 }, // West Asia Standard Time / Uzbekistan
- { 136, 180, 7143 }, // West Bank Standard Time / Palestinian Territories
- { 137, 0, 7165 }, // West Pacific Standard Time / AnyTerritory
- { 137, 9, 7176 }, // West Pacific Standard Time / Antarctica
- { 137, 98, 7202 }, // West Pacific Standard Time / Guam
- { 137, 153, 7215 }, // West Pacific Standard Time / Micronesia
- { 137, 173, 7228 }, // West Pacific Standard Time / Northern Mariana Islands
- { 137, 182, 7243 }, // West Pacific Standard Time / Papua New Guinea
- { 138, 193, 7264 }, // Yakutsk Standard Time / Russia
- { 139, 41, 7291 }, // Yukon Standard Time / Canada
+ { 41, 248, 2346 }, // Eastern Standard Time / United States
+ { 42, 152, 2503 }, // Eastern Standard Time (Mexico) / Mexico
+ { 43, 71, 2518 }, // Egypt Standard Time / Egypt
+ { 44, 193, 2531 }, // Ekaterinburg Standard Time / Russia
+ { 45, 82, 2550 }, // Fiji Standard Time / Fiji
+ { 46, 2, 2563 }, // FLE Standard Time / Aland Islands
+ { 46, 36, 2580 }, // FLE Standard Time / Bulgaria
+ { 46, 75, 2593 }, // FLE Standard Time / Estonia
+ { 46, 83, 2608 }, // FLE Standard Time / Finland
+ { 46, 131, 2624 }, // FLE Standard Time / Latvia
+ { 46, 137, 2636 }, // FLE Standard Time / Lithuania
+ { 46, 244, 2651 }, // FLE Standard Time / Ukraine
+ { 47, 90, 2697 }, // Georgian Standard Time / Georgia
+ { 48, 81, 2710 }, // GMT Standard Time / Faroe Islands
+ { 48, 100, 2726 }, // GMT Standard Time / Guernsey
+ { 48, 114, 2742 }, // GMT Standard Time / Ireland
+ { 48, 115, 2756 }, // GMT Standard Time / Isle of Man
+ { 48, 121, 2775 }, // GMT Standard Time / Jersey
+ { 48, 188, 2789 }, // GMT Standard Time / Portugal
+ { 48, 220, 2820 }, // GMT Standard Time / Spain
+ { 48, 246, 2836 }, // GMT Standard Time / United Kingdom
+ { 49, 95, 2850 }, // Greenland Standard Time / Greenland
+ { 50, 37, 2866 }, // Greenwich Standard Time / Burkina Faso
+ { 50, 89, 2885 }, // Greenwich Standard Time / Gambia
+ { 50, 92, 2899 }, // Greenwich Standard Time / Ghana
+ { 50, 95, 2912 }, // Greenwich Standard Time / Greenland
+ { 50, 101, 2933 }, // Greenwich Standard Time / Guinea-Bissau
+ { 50, 102, 2947 }, // Greenwich Standard Time / Guinea
+ { 50, 109, 2962 }, // Greenwich Standard Time / Iceland
+ { 50, 118, 2981 }, // Greenwich Standard Time / Ivory Coast
+ { 50, 134, 2996 }, // Greenwich Standard Time / Liberia
+ { 50, 145, 3012 }, // Greenwich Standard Time / Mali
+ { 50, 149, 3026 }, // Greenwich Standard Time / Mauritania
+ { 50, 196, 3044 }, // Greenwich Standard Time / Saint Helena
+ { 50, 206, 3063 }, // Greenwich Standard Time / Senegal
+ { 50, 209, 3076 }, // Greenwich Standard Time / Sierra Leone
+ { 50, 233, 3092 }, // Greenwich Standard Time / Togo
+ { 51, 63, 3104 }, // GTB Standard Time / Cyprus
+ { 51, 94, 3132 }, // GTB Standard Time / Greece
+ { 51, 192, 3146 }, // GTB Standard Time / Romania
+ { 52, 104, 3163 }, // Haiti Standard Time / Haiti
+ { 53, 0, 3186 }, // Hawaiian Standard Time / AnyTerritory
+ { 53, 58, 3197 }, // Hawaiian Standard Time / Cook Islands
+ { 53, 86, 3215 }, // Hawaiian Standard Time / French Polynesia
+ { 53, 247, 3230 }, // Hawaiian Standard Time / United States Outlying Islands
+ { 53, 248, 3247 }, // Hawaiian Standard Time / United States
+ { 54, 110, 3264 }, // India Standard Time / India
+ { 55, 112, 3278 }, // Iran Standard Time / Iran
+ { 56, 116, 3290 }, // Israel Standard Time / Israel
+ { 57, 122, 3305 }, // Jordan Standard Time / Jordan
+ { 58, 193, 3316 }, // Kaliningrad Standard Time / Russia
+ { 59, 218, 3335 }, // Korea Standard Time / South Korea
+ { 60, 135, 3346 }, // Libya Standard Time / Libya
+ { 61, 0, 3361 }, // Line Islands Standard Time / AnyTerritory
+ { 61, 125, 3372 }, // Line Islands Standard Time / Kiribati
+ { 62, 15, 3391 }, // Lord Howe Standard Time / Australia
+ { 63, 193, 3411 }, // Magadan Standard Time / Russia
+ { 64, 49, 3424 }, // Magallanes Standard Time / Chile
+ { 65, 86, 3445 }, // Marquesas Standard Time / French Polynesia
+ { 66, 150, 3463 }, // Mauritius Standard Time / Mauritius
+ { 66, 191, 3480 }, // Mauritius Standard Time / Reunion
+ { 66, 208, 3495 }, // Mauritius Standard Time / Seychelles
+ { 67, 132, 3507 }, // Middle East Standard Time / Lebanon
+ { 68, 250, 3519 }, // Montevideo Standard Time / Uruguay
+ { 69, 159, 3538 }, // Morocco Standard Time / Morocco
+ { 69, 257, 3556 }, // Morocco Standard Time / Western Sahara
+ { 70, 0, 3572 }, // Mountain Standard Time / AnyTerritory
+ { 70, 41, 3580 }, // Mountain Standard Time / Canada
+ { 70, 152, 3654 }, // Mountain Standard Time / Mexico
+ { 70, 248, 3676 }, // Mountain Standard Time / United States
+ { 71, 152, 3705 }, // Mountain Standard Time (Mexico) / Mexico
+ { 72, 53, 3722 }, // Myanmar Standard Time / Cocos Islands
+ { 72, 161, 3735 }, // Myanmar Standard Time / Myanmar
+ { 73, 193, 3748 }, // N. Central Asia Standard Time / Russia
+ { 74, 162, 3765 }, // Namibia Standard Time / Namibia
+ { 75, 164, 3781 }, // Nepal Standard Time / Nepal
+ { 76, 9, 3795 }, // New Zealand Standard Time / Antarctica
+ { 76, 167, 3814 }, // New Zealand Standard Time / New Zealand
+ { 77, 41, 3831 }, // Newfoundland Standard Time / Canada
+ { 78, 172, 3848 }, // Norfolk Standard Time / Norfolk Island
+ { 79, 193, 3864 }, // North Asia East Standard Time / Russia
+ { 80, 193, 3877 }, // North Asia Standard Time / Russia
+ { 81, 174, 3912 }, // North Korea Standard Time / North Korea
+ { 82, 193, 3927 }, // Omsk Standard Time / Russia
+ { 83, 49, 3937 }, // Pacific SA Standard Time / Chile
+ { 84, 0, 3954 }, // Pacific Standard Time / AnyTerritory
+ { 84, 41, 3962 }, // Pacific Standard Time / Canada
+ { 84, 248, 3980 }, // Pacific Standard Time / United States
+ { 85, 152, 4000 }, // Pacific Standard Time (Mexico) / Mexico
+ { 86, 178, 4037 }, // Pakistan Standard Time / Pakistan
+ { 87, 183, 4050 }, // Paraguay Standard Time / Paraguay
+ { 88, 123, 4067 }, // Qyzylorda Standard Time / Kazakhstan
+ { 89, 23, 4082 }, // Romance Standard Time / Belgium
+ { 89, 65, 4098 }, // Romance Standard Time / Denmark
+ { 89, 84, 4116 }, // Romance Standard Time / France
+ { 89, 220, 4129 }, // Romance Standard Time / Spain
+ { 90, 193, 4156 }, // Russia Time Zone 10 / Russia
+ { 91, 193, 4175 }, // Russia Time Zone 11 / Russia
+ { 92, 193, 4202 }, // Russia Time Zone 3 / Russia
+ { 93, 193, 4216 }, // Russian Standard Time / Russia
+ { 93, 244, 4243 }, // Russian Standard Time / Ukraine
+ { 94, 0, 4261 }, // SA Eastern Standard Time / AnyTerritory
+ { 94, 9, 4271 }, // SA Eastern Standard Time / Antarctica
+ { 94, 32, 4308 }, // SA Eastern Standard Time / Brazil
+ { 94, 80, 4387 }, // SA Eastern Standard Time / Falkland Islands
+ { 94, 85, 4404 }, // SA Eastern Standard Time / French Guiana
+ { 94, 223, 4420 }, // SA Eastern Standard Time / Suriname
+ { 95, 0, 4439 }, // SA Pacific Standard Time / AnyTerritory
+ { 95, 32, 4449 }, // SA Pacific Standard Time / Brazil
+ { 95, 41, 4485 }, // SA Pacific Standard Time / Canada
+ { 95, 45, 4507 }, // SA Pacific Standard Time / Cayman Islands
+ { 95, 54, 4522 }, // SA Pacific Standard Time / Colombia
+ { 95, 70, 4537 }, // SA Pacific Standard Time / Ecuador
+ { 95, 119, 4555 }, // SA Pacific Standard Time / Jamaica
+ { 95, 181, 4571 }, // SA Pacific Standard Time / Panama
+ { 95, 184, 4586 }, // SA Pacific Standard Time / Peru
+ { 96, 0, 4599 }, // SA Western Standard Time / AnyTerritory
+ { 96, 8, 4609 }, // SA Western Standard Time / Anguilla
+ { 96, 10, 4626 }, // SA Western Standard Time / Antigua and Barbuda
+ { 96, 13, 4642 }, // SA Western Standard Time / Aruba
+ { 96, 21, 4656 }, // SA Western Standard Time / Barbados
+ { 96, 28, 4673 }, // SA Western Standard Time / Bolivia
+ { 96, 32, 4688 }, // SA Western Standard Time / Brazil
+ { 96, 34, 4741 }, // SA Western Standard Time / British Virgin Islands
+ { 96, 41, 4757 }, // SA Western Standard Time / Canada
+ { 96, 44, 4778 }, // SA Western Standard Time / Caribbean Netherlands
+ { 96, 62, 4797 }, // SA Western Standard Time / Curacao
+ { 96, 68, 4813 }, // SA Western Standard Time / Dominica
+ { 96, 69, 4830 }, // SA Western Standard Time / Dominican Republic
+ { 96, 96, 4852 }, // SA Western Standard Time / Grenada
+ { 96, 97, 4868 }, // SA Western Standard Time / Guadeloupe
+ { 96, 103, 4887 }, // SA Western Standard Time / Guyana
+ { 96, 148, 4902 }, // SA Western Standard Time / Martinique
+ { 96, 158, 4921 }, // SA Western Standard Time / Montserrat
+ { 96, 189, 4940 }, // SA Western Standard Time / Puerto Rico
+ { 96, 195, 4960 }, // SA Western Standard Time / Saint Barthelemy
+ { 96, 197, 4982 }, // SA Western Standard Time / Saint Kitts and Nevis
+ { 96, 198, 4999 }, // SA Western Standard Time / Saint Lucia
+ { 96, 199, 5016 }, // SA Western Standard Time / Saint Martin
+ { 96, 201, 5032 }, // SA Western Standard Time / Saint Vincent and Grenadines
+ { 96, 211, 5051 }, // SA Western Standard Time / Sint Maarten
+ { 96, 236, 5073 }, // SA Western Standard Time / Trinidad and Tobago
+ { 96, 249, 5095 }, // SA Western Standard Time / United States Virgin Islands
+ { 97, 200, 5113 }, // Saint Pierre Standard Time / Saint Pierre and Miquelon
+ { 98, 193, 5130 }, // Sakhalin Standard Time / Russia
+ { 99, 202, 5144 }, // Samoa Standard Time / Samoa
+ { 100, 204, 5157 }, // Sao Tome Standard Time / Sao Tome and Principe
+ { 101, 193, 5173 }, // Saratov Standard Time / Russia
+ { 102, 0, 5188 }, // SE Asia Standard Time / AnyTerritory
+ { 102, 9, 5198 }, // SE Asia Standard Time / Antarctica
+ { 102, 39, 5215 }, // SE Asia Standard Time / Cambodia
+ { 102, 51, 5231 }, // SE Asia Standard Time / Christmas Island
+ { 102, 111, 5248 }, // SE Asia Standard Time / Indonesia
+ { 102, 129, 5276 }, // SE Asia Standard Time / Laos
+ { 102, 231, 5291 }, // SE Asia Standard Time / Thailand
+ { 102, 255, 5304 }, // SE Asia Standard Time / Vietnam
+ { 103, 0, 5316 }, // Singapore Standard Time / AnyTerritory
+ { 103, 35, 5326 }, // Singapore Standard Time / Brunei
+ { 103, 111, 5338 }, // Singapore Standard Time / Indonesia
+ { 103, 143, 5352 }, // Singapore Standard Time / Malaysia
+ { 103, 185, 5383 }, // Singapore Standard Time / Philippines
+ { 103, 210, 5395 }, // Singapore Standard Time / Singapore
+ { 104, 0, 5410 }, // South Africa Standard Time / AnyTerritory
+ { 104, 30, 5420 }, // South Africa Standard Time / Botswana
+ { 104, 38, 5436 }, // South Africa Standard Time / Burundi
+ { 104, 57, 5453 }, // South Africa Standard Time / Congo - Kinshasa
+ { 104, 76, 5471 }, // South Africa Standard Time / Eswatini
+ { 104, 133, 5486 }, // South Africa Standard Time / Lesotho
+ { 104, 142, 5500 }, // South Africa Standard Time / Malawi
+ { 104, 160, 5516 }, // South Africa Standard Time / Mozambique
+ { 104, 194, 5530 }, // South Africa Standard Time / Rwanda
+ { 104, 216, 5544 }, // South Africa Standard Time / South Africa
+ { 104, 260, 5564 }, // South Africa Standard Time / Zambia
+ { 104, 261, 5578 }, // South Africa Standard Time / Zimbabwe
+ { 105, 219, 5592 }, // South Sudan Standard Time / South Sudan
+ { 106, 221, 5604 }, // Sri Lanka Standard Time / Sri Lanka
+ { 107, 222, 5617 }, // Sudan Standard Time / Sudan
+ { 108, 227, 5633 }, // Syria Standard Time / Syria
+ { 109, 228, 5647 }, // Taipei Standard Time / Taiwan
+ { 110, 15, 5659 }, // Tasmania Standard Time / Australia
+ { 111, 32, 5714 }, // Tocantins Standard Time / Brazil
+ { 112, 0, 5732 }, // Tokyo Standard Time / AnyTerritory
+ { 112, 111, 5742 }, // Tokyo Standard Time / Indonesia
+ { 112, 120, 5756 }, // Tokyo Standard Time / Japan
+ { 112, 179, 5767 }, // Tokyo Standard Time / Palau
+ { 112, 232, 5781 }, // Tokyo Standard Time / Timor-Leste
+ { 113, 193, 5791 }, // Tomsk Standard Time / Russia
+ { 114, 235, 5802 }, // Tonga Standard Time / Tonga
+ { 115, 193, 5820 }, // Transbaikal Standard Time / Russia
+ { 116, 239, 5831 }, // Turkey Standard Time / Turkey
+ { 117, 241, 5847 }, // Turks And Caicos Standard Time / Turks and Caicos Islands
+ { 118, 156, 5866 }, // Ulaanbaatar Standard Time / Mongolia
+ { 119, 248, 5899 }, // US Eastern Standard Time / United States
+ { 120, 0, 5966 }, // US Mountain Standard Time / AnyTerritory
+ { 120, 41, 5976 }, // US Mountain Standard Time / Canada
+ { 120, 152, 6033 }, // US Mountain Standard Time / Mexico
+ { 120, 248, 6052 }, // US Mountain Standard Time / United States
+ { 121, 0, 6068 }, // UTC / AnyTerritory
+ { 122, 0, 6084 }, // UTC+12 / AnyTerritory
+ { 122, 125, 6095 }, // UTC+12 / Kiribati
+ { 122, 147, 6110 }, // UTC+12 / Marshall Islands
+ { 122, 163, 6143 }, // UTC+12 / Nauru
+ { 122, 242, 6157 }, // UTC+12 / Tuvalu
+ { 122, 247, 6174 }, // UTC+12 / United States Outlying Islands
+ { 122, 256, 6187 }, // UTC+12 / Wallis and Futuna
+ { 123, 0, 6202 }, // UTC+13 / AnyTerritory
+ { 123, 125, 6213 }, // UTC+13 / Kiribati
+ { 123, 234, 6231 }, // UTC+13 / Tokelau
+ { 124, 0, 6247 }, // UTC-02 / AnyTerritory
+ { 124, 32, 6257 }, // UTC-02 / Brazil
+ { 124, 217, 6273 }, // UTC-02 / South Georgia and South Sandwich Islands
+ { 125, 0, 6296 }, // UTC-08 / AnyTerritory
+ { 125, 186, 6306 }, // UTC-08 / Pitcairn
+ { 126, 0, 6323 }, // UTC-09 / AnyTerritory
+ { 126, 86, 6333 }, // UTC-09 / French Polynesia
+ { 127, 0, 6349 }, // UTC-11 / AnyTerritory
+ { 127, 5, 6360 }, // UTC-11 / American Samoa
+ { 127, 171, 6378 }, // UTC-11 / Niue
+ { 127, 247, 6391 }, // UTC-11 / United States Outlying Islands
+ { 128, 254, 6406 }, // Venezuela Standard Time / Venezuela
+ { 129, 193, 6422 }, // Vladivostok Standard Time / Russia
+ { 130, 193, 6453 }, // Volgograd Standard Time / Russia
+ { 131, 15, 6470 }, // W. Australia Standard Time / Australia
+ { 132, 0, 6486 }, // W. Central Africa Standard Time / AnyTerritory
+ { 132, 4, 6496 }, // W. Central Africa Standard Time / Algeria
+ { 132, 7, 6511 }, // W. Central Africa Standard Time / Angola
+ { 132, 25, 6525 }, // W. Central Africa Standard Time / Benin
+ { 132, 40, 6543 }, // W. Central Africa Standard Time / Cameroon
+ { 132, 46, 6557 }, // W. Central Africa Standard Time / Central African Republic
+ { 132, 48, 6571 }, // W. Central Africa Standard Time / Chad
+ { 132, 56, 6587 }, // W. Central Africa Standard Time / Congo - Brazzaville
+ { 132, 57, 6606 }, // W. Central Africa Standard Time / Congo - Kinshasa
+ { 132, 73, 6622 }, // W. Central Africa Standard Time / Equatorial Guinea
+ { 132, 88, 6636 }, // W. Central Africa Standard Time / Gabon
+ { 132, 169, 6654 }, // W. Central Africa Standard Time / Nigeria
+ { 132, 170, 6667 }, // W. Central Africa Standard Time / Niger
+ { 132, 238, 6681 }, // W. Central Africa Standard Time / Tunisia
+ { 133, 6, 6694 }, // W. Europe Standard Time / Andorra
+ { 133, 16, 6709 }, // W. Europe Standard Time / Austria
+ { 133, 91, 6723 }, // W. Europe Standard Time / Germany
+ { 133, 93, 6753 }, // W. Europe Standard Time / Gibraltar
+ { 133, 117, 6770 }, // W. Europe Standard Time / Italy
+ { 133, 136, 6782 }, // W. Europe Standard Time / Liechtenstein
+ { 133, 138, 6795 }, // W. Europe Standard Time / Luxembourg
+ { 133, 146, 6813 }, // W. Europe Standard Time / Malta
+ { 133, 155, 6826 }, // W. Europe Standard Time / Monaco
+ { 133, 165, 6840 }, // W. Europe Standard Time / Netherlands
+ { 133, 175, 6857 }, // W. Europe Standard Time / Norway
+ { 133, 203, 6869 }, // W. Europe Standard Time / San Marino
+ { 133, 224, 6887 }, // W. Europe Standard Time / Svalbard and Jan Mayen
+ { 133, 225, 6907 }, // W. Europe Standard Time / Sweden
+ { 133, 226, 6924 }, // W. Europe Standard Time / Switzerland
+ { 133, 253, 6938 }, // W. Europe Standard Time / Vatican City
+ { 134, 156, 6953 }, // W. Mongolia Standard Time / Mongolia
+ { 135, 0, 6963 }, // West Asia Standard Time / AnyTerritory
+ { 135, 9, 6973 }, // West Asia Standard Time / Antarctica
+ { 135, 87, 6991 }, // West Asia Standard Time / French Southern Territories
+ { 135, 123, 7008 }, // West Asia Standard Time / Kazakhstan
+ { 135, 144, 7053 }, // West Asia Standard Time / Maldives
+ { 135, 229, 7069 }, // West Asia Standard Time / Tajikistan
+ { 135, 240, 7083 }, // West Asia Standard Time / Turkmenistan
+ { 135, 251, 7097 }, // West Asia Standard Time / Uzbekistan
+ { 136, 180, 7126 }, // West Bank Standard Time / Palestinian Territories
+ { 137, 0, 7148 }, // West Pacific Standard Time / AnyTerritory
+ { 137, 9, 7159 }, // West Pacific Standard Time / Antarctica
+ { 137, 98, 7185 }, // West Pacific Standard Time / Guam
+ { 137, 153, 7198 }, // West Pacific Standard Time / Micronesia
+ { 137, 173, 7211 }, // West Pacific Standard Time / Northern Mariana Islands
+ { 137, 182, 7226 }, // West Pacific Standard Time / Papua New Guinea
+ { 138, 193, 7247 }, // Yakutsk Standard Time / Russia
+ { 139, 41, 7274 }, // Yukon Standard Time / Canada
};
// Windows ID Key, Windows ID Index, IANA ID Index, UTC Offset
static constexpr WindowsData windowsDataTable[] = {
{ 1, 0, 0, 16200 }, // Afghanistan Standard Time
- { 2, 26, 7325,-32400 }, // Alaskan Standard Time
+ { 2, 26, 7308,-32400 }, // Alaskan Standard Time
{ 3, 48, 106,-36000 }, // Aleutian Standard Time
{ 4, 71, 119, 25200 }, // Altai Standard Time
{ 5, 91, 168, 10800 }, // Arab Standard Time
{ 6, 110, 212, 14400 }, // Arabian Standard Time
{ 7, 132, 223, 10800 }, // Arabic Standard Time
- { 8, 153, 7343,-10800 }, // Argentina Standard Time
- { 9, 177, 7364, 14400 }, // Astrakhan Standard Time
- { 10, 201, 7381,-14400 }, // Atlantic Standard Time
+ { 8, 153, 7326,-10800 }, // Argentina Standard Time
+ { 9, 177, 7347, 14400 }, // Astrakhan Standard Time
+ { 10, 201, 7364,-14400 }, // Atlantic Standard Time
{ 11, 224, 642, 34200 }, // AUS Central Standard Time
{ 12, 250, 659, 31500 }, // Aus Central W. Standard Time
- { 13, 279, 7397, 36000 }, // AUS Eastern Standard Time
+ { 13, 279, 7380, 36000 }, // AUS Eastern Standard Time
{ 14, 305, 712, 14400 }, // Azerbaijan Standard Time
{ 15, 330, 743, -3600 }, // Azores Standard Time
{ 16, 351, 759,-10800 }, // Bahia Standard Time
{ 17, 371, 773, 21600 }, // Bangladesh Standard Time
{ 18, 396, 797, 10800 }, // Belarus Standard Time
{ 19, 418, 810, 39600 }, // Bougainville Standard Time
- { 20, 445, 7414,-21600 }, // Canada Central Standard Time
+ { 20, 445, 7397,-21600 }, // Canada Central Standard Time
{ 21, 474, 878, -3600 }, // Cape Verde Standard Time
{ 22, 499, 898, 14400 }, // Caucasus Standard Time
- { 23, 522, 7429, 34200 }, // Cen. Australia Standard Time
+ { 23, 522, 7412, 34200 }, // Cen. Australia Standard Time
{ 24, 551, 1034,-21600 }, // Central America Standard Time
- { 25, 581, 7448, 21600 }, // Central Asia Standard Time
- { 26, 608, 7460,-14400 }, // Central Brazilian Standard Time
+ { 25, 581, 7431, 21600 }, // Central Asia Standard Time
+ { 26, 608, 7443,-14400 }, // Central Brazilian Standard Time
{ 27, 640, 1245, 3600 }, // Central Europe Standard Time
{ 28, 669, 1373, 3600 }, // Central European Standard Time
{ 29, 700, 1460, 39600 }, // Central Pacific Standard Time
- { 30, 730, 7475,-21600 }, // Central Standard Time
- { 31, 752, 7491,-21600 }, // Central Standard Time (Mexico)
+ { 30, 730, 7458,-21600 }, // Central Standard Time
+ { 31, 752, 7474,-21600 }, // Central Standard Time (Mexico)
{ 32, 783, 1873, 45900 }, // Chatham Islands Standard Time
{ 33, 813, 1889, 28800 }, // China Standard Time
{ 34, 833, 1929,-18000 }, // Cuba Standard Time
{ 35, 852, 1944,-43200 }, // Dateline Standard Time
{ 36, 875, 2045, 10800 }, // E. Africa Standard Time
- { 37, 899, 7511, 36000 }, // E. Australia Standard Time
+ { 37, 899, 7494, 36000 }, // E. Australia Standard Time
{ 38, 926, 2186, 7200 }, // E. Europe Standard Time
{ 39, 950, 2202,-10800 }, // E. South America Standard Time
{ 40, 981, 2220,-21600 }, // Easter Island Standard Time
- { 41, 1009, 7530,-18000 }, // Eastern Standard Time
- { 42, 1031, 2520,-18000 }, // Eastern Standard Time (Mexico)
- { 43, 1062, 2535, 7200 }, // Egypt Standard Time
- { 44, 1082, 2548, 18000 }, // Ekaterinburg Standard Time
- { 45, 1109, 2567, 43200 }, // Fiji Standard Time
- { 46, 1128, 7547, 7200 }, // FLE Standard Time
- { 47, 1146, 2714, 14400 }, // Georgian Standard Time
- { 48, 1169, 2853, 0 }, // GMT Standard Time
- { 49, 1187, 2867,-10800 }, // Greenland Standard Time
- { 50, 1211, 2979, 0 }, // Greenwich Standard Time
- { 51, 1235, 3163, 7200 }, // GTB Standard Time
- { 52, 1253, 3180,-18000 }, // Haiti Standard Time
- { 53, 1273, 3264,-36000 }, // Hawaiian Standard Time
- { 54, 1296, 3281, 19800 }, // India Standard Time
- { 55, 1316, 3295, 12600 }, // Iran Standard Time
- { 56, 1335, 3307, 7200 }, // Israel Standard Time
- { 57, 1356, 3322, 7200 }, // Jordan Standard Time
- { 58, 1377, 3333, 7200 }, // Kaliningrad Standard Time
- { 59, 1403, 3352, 32400 }, // Korea Standard Time
- { 60, 1423, 3363, 7200 }, // Libya Standard Time
- { 61, 1443, 3389, 50400 }, // Line Islands Standard Time
- { 62, 1470, 3408, 37800 }, // Lord Howe Standard Time
- { 63, 1494, 3428, 36000 }, // Magadan Standard Time
- { 64, 1516, 3441,-10800 }, // Magallanes Standard Time
- { 65, 1541, 3462,-34200 }, // Marquesas Standard Time
- { 66, 1565, 3480, 14400 }, // Mauritius Standard Time
- { 67, 1589, 3524, 7200 }, // Middle East Standard Time
- { 68, 1615, 3536,-10800 }, // Montevideo Standard Time
- { 69, 1640, 3555, 0 }, // Morocco Standard Time
- { 70, 1662, 7559,-25200 }, // Mountain Standard Time
- { 71, 1685, 3722,-25200 }, // Mountain Standard Time (Mexico)
- { 72, 1717, 3752, 23400 }, // Myanmar Standard Time
- { 73, 1739, 3765, 21600 }, // N. Central Asia Standard Time
- { 74, 1769, 3782, 3600 }, // Namibia Standard Time
- { 75, 1791, 3798, 20700 }, // Nepal Standard Time
- { 76, 1811, 3831, 43200 }, // New Zealand Standard Time
- { 77, 1837, 3848,-12600 }, // Newfoundland Standard Time
- { 78, 1864, 3865, 39600 }, // Norfolk Standard Time
- { 79, 1886, 3881, 28800 }, // North Asia East Standard Time
- { 80, 1916, 7574, 25200 }, // North Asia Standard Time
- { 81, 1941, 3929, 30600 }, // North Korea Standard Time
- { 82, 1967, 3944, 21600 }, // Omsk Standard Time
- { 83, 1986, 3954,-10800 }, // Pacific SA Standard Time
- { 84, 2011, 3997,-28800 }, // Pacific Standard Time
- { 85, 2033, 7591,-28800 }, // Pacific Standard Time (Mexico)
- { 86, 2064, 4054, 18000 }, // Pakistan Standard Time
- { 87, 2087, 4067,-14400 }, // Paraguay Standard Time
- { 88, 2110, 4084, 18000 }, // Qyzylorda Standard Time
- { 89, 2134, 4133, 3600 }, // Romance Standard Time
- { 90, 2156, 4173, 39600 }, // Russia Time Zone 10
- { 91, 2176, 7607, 43200 }, // Russia Time Zone 11
- { 92, 2196, 4219, 14400 }, // Russia Time Zone 3
- { 93, 2215, 7622, 10800 }, // Russian Standard Time
- { 94, 2237, 4421,-10800 }, // SA Eastern Standard Time
- { 95, 2262, 4539,-18000 }, // SA Pacific Standard Time
- { 96, 2287, 4690,-14400 }, // SA Western Standard Time
- { 97, 2312, 5130,-10800 }, // Saint Pierre Standard Time
- { 98, 2339, 5147, 39600 }, // Sakhalin Standard Time
- { 99, 2362, 5161, 46800 }, // Samoa Standard Time
- { 100, 2382, 5174, 0 }, // Sao Tome Standard Time
- { 101, 2405, 5190, 14400 }, // Saratov Standard Time
- { 102, 2427, 5308, 25200 }, // SE Asia Standard Time
- { 103, 2449, 5412, 28800 }, // Singapore Standard Time
- { 104, 2473, 5561, 7200 }, // South Africa Standard Time
- { 105, 2500, 5609, 7200 }, // South Sudan Standard Time
- { 106, 2526, 5621, 19800 }, // Sri Lanka Standard Time
- { 107, 2550, 5634, 7200 }, // Sudan Standard Time
- { 108, 2570, 5650, 7200 }, // Syria Standard Time
- { 109, 2590, 5664, 28800 }, // Taipei Standard Time
- { 110, 2611, 7636, 36000 }, // Tasmania Standard Time
- { 111, 2634, 5731,-10800 }, // Tocantins Standard Time
- { 112, 2658, 5773, 32400 }, // Tokyo Standard Time
- { 113, 2678, 5808, 25200 }, // Tomsk Standard Time
- { 114, 2698, 5819, 46800 }, // Tonga Standard Time
- { 115, 2718, 5837, 32400 }, // Transbaikal Standard Time
- { 116, 2744, 5848, 7200 }, // Turkey Standard Time
- { 117, 2765, 5864,-14400 }, // Turks And Caicos Standard Time
- { 118, 2796, 7653, 28800 }, // Ulaanbaatar Standard Time
- { 119, 2822, 7670,-18000 }, // US Eastern Standard Time
- { 120, 2847, 6069,-25200 }, // US Mountain Standard Time
- { 121, 2873, 7691, 0 }, // UTC
- { 122, 2877, 6101, 43200 }, // UTC+12
- { 123, 2884, 6219, 46800 }, // UTC+13
- { 124, 2891, 6264, -7200 }, // UTC-02
- { 125, 2898, 6313,-28800 }, // UTC-08
- { 126, 2905, 6340,-32400 }, // UTC-09
- { 127, 2912, 6366,-39600 }, // UTC-11
- { 128, 2919, 6423,-16200 }, // Venezuela Standard Time
- { 129, 2943, 7699, 36000 }, // Vladivostok Standard Time
- { 130, 2969, 6470, 14400 }, // Volgograd Standard Time
- { 131, 2993, 6487, 28800 }, // W. Australia Standard Time
- { 132, 3020, 6671, 3600 }, // W. Central Africa Standard Time
- { 133, 3052, 7716, 3600 }, // W. Europe Standard Time
- { 134, 3076, 6970, 25200 }, // W. Mongolia Standard Time
- { 135, 3102, 7730, 18000 }, // West Asia Standard Time
- { 136, 3126, 7744, 7200 }, // West Bank Standard Time
- { 137, 3150, 7243, 36000 }, // West Pacific Standard Time
- { 138, 3177, 7756, 32400 }, // Yakutsk Standard Time
- { 139, 3199, 7769,-25200 }, // Yukon Standard Time
+ { 41, 1009, 7513,-18000 }, // Eastern Standard Time
+ { 42, 1031, 2503,-18000 }, // Eastern Standard Time (Mexico)
+ { 43, 1062, 2518, 7200 }, // Egypt Standard Time
+ { 44, 1082, 2531, 18000 }, // Ekaterinburg Standard Time
+ { 45, 1109, 2550, 43200 }, // Fiji Standard Time
+ { 46, 1128, 7530, 7200 }, // FLE Standard Time
+ { 47, 1146, 2697, 14400 }, // Georgian Standard Time
+ { 48, 1169, 2836, 0 }, // GMT Standard Time
+ { 49, 1187, 2850,-10800 }, // Greenland Standard Time
+ { 50, 1211, 2962, 0 }, // Greenwich Standard Time
+ { 51, 1235, 3146, 7200 }, // GTB Standard Time
+ { 52, 1253, 3163,-18000 }, // Haiti Standard Time
+ { 53, 1273, 3247,-36000 }, // Hawaiian Standard Time
+ { 54, 1296, 3264, 19800 }, // India Standard Time
+ { 55, 1316, 3278, 12600 }, // Iran Standard Time
+ { 56, 1335, 3290, 7200 }, // Israel Standard Time
+ { 57, 1356, 3305, 7200 }, // Jordan Standard Time
+ { 58, 1377, 3316, 7200 }, // Kaliningrad Standard Time
+ { 59, 1403, 3335, 32400 }, // Korea Standard Time
+ { 60, 1423, 3346, 7200 }, // Libya Standard Time
+ { 61, 1443, 3372, 50400 }, // Line Islands Standard Time
+ { 62, 1470, 3391, 37800 }, // Lord Howe Standard Time
+ { 63, 1494, 3411, 36000 }, // Magadan Standard Time
+ { 64, 1516, 3424,-10800 }, // Magallanes Standard Time
+ { 65, 1541, 3445,-34200 }, // Marquesas Standard Time
+ { 66, 1565, 3463, 14400 }, // Mauritius Standard Time
+ { 67, 1589, 3507, 7200 }, // Middle East Standard Time
+ { 68, 1615, 3519,-10800 }, // Montevideo Standard Time
+ { 69, 1640, 3538, 0 }, // Morocco Standard Time
+ { 70, 1662, 7542,-25200 }, // Mountain Standard Time
+ { 71, 1685, 3705,-25200 }, // Mountain Standard Time (Mexico)
+ { 72, 1717, 3735, 23400 }, // Myanmar Standard Time
+ { 73, 1739, 3748, 21600 }, // N. Central Asia Standard Time
+ { 74, 1769, 3765, 3600 }, // Namibia Standard Time
+ { 75, 1791, 3781, 20700 }, // Nepal Standard Time
+ { 76, 1811, 3814, 43200 }, // New Zealand Standard Time
+ { 77, 1837, 3831,-12600 }, // Newfoundland Standard Time
+ { 78, 1864, 3848, 39600 }, // Norfolk Standard Time
+ { 79, 1886, 3864, 28800 }, // North Asia East Standard Time
+ { 80, 1916, 7557, 25200 }, // North Asia Standard Time
+ { 81, 1941, 3912, 30600 }, // North Korea Standard Time
+ { 82, 1967, 3927, 21600 }, // Omsk Standard Time
+ { 83, 1986, 3937,-10800 }, // Pacific SA Standard Time
+ { 84, 2011, 3980,-28800 }, // Pacific Standard Time
+ { 85, 2033, 7574,-28800 }, // Pacific Standard Time (Mexico)
+ { 86, 2064, 4037, 18000 }, // Pakistan Standard Time
+ { 87, 2087, 4050,-14400 }, // Paraguay Standard Time
+ { 88, 2110, 4067, 18000 }, // Qyzylorda Standard Time
+ { 89, 2134, 4116, 3600 }, // Romance Standard Time
+ { 90, 2156, 4156, 39600 }, // Russia Time Zone 10
+ { 91, 2176, 7590, 43200 }, // Russia Time Zone 11
+ { 92, 2196, 4202, 14400 }, // Russia Time Zone 3
+ { 93, 2215, 7605, 10800 }, // Russian Standard Time
+ { 94, 2237, 4404,-10800 }, // SA Eastern Standard Time
+ { 95, 2262, 4522,-18000 }, // SA Pacific Standard Time
+ { 96, 2287, 4673,-14400 }, // SA Western Standard Time
+ { 97, 2312, 5113,-10800 }, // Saint Pierre Standard Time
+ { 98, 2339, 5130, 39600 }, // Sakhalin Standard Time
+ { 99, 2362, 5144, 46800 }, // Samoa Standard Time
+ { 100, 2382, 5157, 0 }, // Sao Tome Standard Time
+ { 101, 2405, 5173, 14400 }, // Saratov Standard Time
+ { 102, 2427, 5291, 25200 }, // SE Asia Standard Time
+ { 103, 2449, 5395, 28800 }, // Singapore Standard Time
+ { 104, 2473, 5544, 7200 }, // South Africa Standard Time
+ { 105, 2500, 5592, 7200 }, // South Sudan Standard Time
+ { 106, 2526, 5604, 19800 }, // Sri Lanka Standard Time
+ { 107, 2550, 5617, 7200 }, // Sudan Standard Time
+ { 108, 2570, 5633, 7200 }, // Syria Standard Time
+ { 109, 2590, 5647, 28800 }, // Taipei Standard Time
+ { 110, 2611, 7619, 36000 }, // Tasmania Standard Time
+ { 111, 2634, 5714,-10800 }, // Tocantins Standard Time
+ { 112, 2658, 5756, 32400 }, // Tokyo Standard Time
+ { 113, 2678, 5791, 25200 }, // Tomsk Standard Time
+ { 114, 2698, 5802, 46800 }, // Tonga Standard Time
+ { 115, 2718, 5820, 32400 }, // Transbaikal Standard Time
+ { 116, 2744, 5831, 7200 }, // Turkey Standard Time
+ { 117, 2765, 5847,-14400 }, // Turks And Caicos Standard Time
+ { 118, 2796, 7636, 28800 }, // Ulaanbaatar Standard Time
+ { 119, 2822, 7653,-18000 }, // US Eastern Standard Time
+ { 120, 2847, 6052,-25200 }, // US Mountain Standard Time
+ { 121, 2873, 7674, 0 }, // UTC
+ { 122, 2877, 6084, 43200 }, // UTC+12
+ { 123, 2884, 6202, 46800 }, // UTC+13
+ { 124, 2891, 6247, -7200 }, // UTC-02
+ { 125, 2898, 6296,-28800 }, // UTC-08
+ { 126, 2905, 6323,-32400 }, // UTC-09
+ { 127, 2912, 6349,-39600 }, // UTC-11
+ { 128, 2919, 6406,-16200 }, // Venezuela Standard Time
+ { 129, 2943, 7682, 36000 }, // Vladivostok Standard Time
+ { 130, 2969, 6453, 14400 }, // Volgograd Standard Time
+ { 131, 2993, 6470, 28800 }, // W. Australia Standard Time
+ { 132, 3020, 6654, 3600 }, // W. Central Africa Standard Time
+ { 133, 3052, 7699, 3600 }, // W. Europe Standard Time
+ { 134, 3076, 6953, 25200 }, // W. Mongolia Standard Time
+ { 135, 3102, 7713, 18000 }, // West Asia Standard Time
+ { 136, 3126, 7727, 7200 }, // West Bank Standard Time
+ { 137, 3150, 7226, 36000 }, // West Pacific Standard Time
+ { 138, 3177, 7739, 32400 }, // Yakutsk Standard Time
+ { 139, 3199, 7752,-25200 }, // Yukon Standard Time
};
// IANA ID Index, UTC Offset
static constexpr UtcData utcDataTable[] = {
- { 7788,-50400 }, // UTC-14:00
- { 7798,-46800 }, // UTC-13:00
- { 7808,-43200 }, // UTC-12:00
- { 7818,-39600 }, // UTC-11:00
- { 7828,-36000 }, // UTC-10:00
- { 7838,-32400 }, // UTC-09:00
- { 7848,-28800 }, // UTC-08:00
- { 7858,-25200 }, // UTC-07:00
- { 7868,-21600 }, // UTC-06:00
- { 7878,-18000 }, // UTC-05:00
- { 7888,-16200 }, // UTC-04:30
- { 7898,-14400 }, // UTC-04:00
- { 7908,-12600 }, // UTC-03:30
- { 7918,-10800 }, // UTC-03:00
- { 7928, -7200 }, // UTC-02:00
- { 7938, -3600 }, // UTC-01:00
- { 7948, 0 }, // UTC
- { 7972, 3600 }, // UTC+01:00
- { 7982, 7200 }, // UTC+02:00
- { 7992, 10800 }, // UTC+03:00
- { 8002, 12600 }, // UTC+03:30
- { 8012, 14400 }, // UTC+04:00
- { 8022, 16200 }, // UTC+04:30
- { 8032, 18000 }, // UTC+05:00
- { 8042, 19800 }, // UTC+05:30
- { 8052, 20700 }, // UTC+05:45
- { 8062, 21600 }, // UTC+06:00
- { 8072, 23400 }, // UTC+06:30
- { 8082, 25200 }, // UTC+07:00
- { 8092, 28800 }, // UTC+08:00
- { 8102, 30600 }, // UTC+08:30
- { 8112, 32400 }, // UTC+09:00
- { 8122, 34200 }, // UTC+09:30
- { 8132, 36000 }, // UTC+10:00
- { 8142, 39600 }, // UTC+11:00
- { 8152, 43200 }, // UTC+12:00
- { 8162, 46800 }, // UTC+13:00
- { 8172, 50400 }, // UTC+14:00
+ { 7771,-50400 }, // UTC-14:00
+ { 7781,-46800 }, // UTC-13:00
+ { 7791,-43200 }, // UTC-12:00
+ { 7801,-39600 }, // UTC-11:00
+ { 7811,-36000 }, // UTC-10:00
+ { 7821,-32400 }, // UTC-09:00
+ { 7831,-28800 }, // UTC-08:00
+ { 7841,-25200 }, // UTC-07:00
+ { 7851,-21600 }, // UTC-06:00
+ { 7861,-18000 }, // UTC-05:00
+ { 7871,-16200 }, // UTC-04:30
+ { 7881,-14400 }, // UTC-04:00
+ { 7891,-12600 }, // UTC-03:30
+ { 7901,-10800 }, // UTC-03:00
+ { 7911, -7200 }, // UTC-02:00
+ { 7921, -3600 }, // UTC-01:00
+ { 7931, 0 }, // UTC
+ { 7955, 3600 }, // UTC+01:00
+ { 7965, 7200 }, // UTC+02:00
+ { 7975, 10800 }, // UTC+03:00
+ { 7985, 12600 }, // UTC+03:30
+ { 7995, 14400 }, // UTC+04:00
+ { 8005, 16200 }, // UTC+04:30
+ { 8015, 18000 }, // UTC+05:00
+ { 8025, 19800 }, // UTC+05:30
+ { 8035, 20700 }, // UTC+05:45
+ { 8045, 21600 }, // UTC+06:00
+ { 8055, 23400 }, // UTC+06:30
+ { 8065, 25200 }, // UTC+07:00
+ { 8075, 28800 }, // UTC+08:00
+ { 8085, 30600 }, // UTC+08:30
+ { 8095, 32400 }, // UTC+09:00
+ { 8105, 34200 }, // UTC+09:30
+ { 8115, 36000 }, // UTC+10:00
+ { 8125, 39600 }, // UTC+11:00
+ { 8135, 43200 }, // UTC+12:00
+ { 8145, 46800 }, // UTC+13:00
+ { 8155, 50400 }, // UTC+14:00
};
static constexpr char windowsIdData[] = {
@@ -991,378 +1140,586 @@ static constexpr char ianaIdData[] = {
0x44, 0x54, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4e, 0x61, 0x73, 0x73, 0x61,
0x75, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54, 0x6f, 0x72, 0x6f, 0x6e, 0x74,
0x6f, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x49, 0x71, 0x61, 0x6c, 0x75, 0x69,
-0x74, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x6f, 0x6e, 0x74, 0x72, 0x65,
-0x61, 0x6c, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4e, 0x69, 0x70, 0x69, 0x67,
-0x6f, 0x6e, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x61, 0x6e, 0x67, 0x6e,
-0x69, 0x72, 0x74, 0x75, 0x6e, 0x67, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54,
-0x68, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x42, 0x61, 0x79, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
-0x63, 0x61, 0x2f, 0x4e, 0x65, 0x77, 0x5f, 0x59, 0x6f, 0x72, 0x6b, 0x20, 0x41, 0x6d, 0x65, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x44, 0x65, 0x74, 0x72, 0x6f, 0x69, 0x74, 0x20, 0x41, 0x6d, 0x65, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61, 0x2f, 0x50, 0x65, 0x74, 0x65,
-0x72, 0x73, 0x62, 0x75, 0x72, 0x67, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x49,
-0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61, 0x2f, 0x56, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x6e, 0x65, 0x73,
-0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61,
-0x2f, 0x57, 0x69, 0x6e, 0x61, 0x6d, 0x61, 0x63, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
-0x2f, 0x4b, 0x65, 0x6e, 0x74, 0x75, 0x63, 0x6b, 0x79, 0x2f, 0x4d, 0x6f, 0x6e, 0x74, 0x69, 0x63,
-0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4c, 0x6f, 0x75,
-0x69, 0x73, 0x76, 0x69, 0x6c, 0x6c, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
-0x43, 0x61, 0x6e, 0x63, 0x75, 0x6e, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x61,
-0x69, 0x72, 0x6f, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x59, 0x65, 0x6b, 0x61, 0x74, 0x65, 0x72,
-0x69, 0x6e, 0x62, 0x75, 0x72, 0x67, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x46,
-0x69, 0x6a, 0x69, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4d, 0x61, 0x72, 0x69, 0x65,
-0x68, 0x61, 0x6d, 0x6e, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x53, 0x6f, 0x66, 0x69,
-0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x54, 0x61, 0x6c, 0x6c, 0x69, 0x6e, 0x6e,
-0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x48, 0x65, 0x6c, 0x73, 0x69, 0x6e, 0x6b, 0x69,
-0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x52, 0x69, 0x67, 0x61, 0x0, 0x45, 0x75, 0x72,
-0x6f, 0x70, 0x65, 0x2f, 0x56, 0x69, 0x6c, 0x6e, 0x69, 0x75, 0x73, 0x0, 0x45, 0x75, 0x72, 0x6f,
-0x70, 0x65, 0x2f, 0x4b, 0x69, 0x65, 0x76, 0x20, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x55,
-0x7a, 0x68, 0x67, 0x6f, 0x72, 0x6f, 0x64, 0x20, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x5a,
-0x61, 0x70, 0x6f, 0x72, 0x6f, 0x7a, 0x68, 0x79, 0x65, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x54,
-0x62, 0x69, 0x6c, 0x69, 0x73, 0x69, 0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f,
-0x46, 0x61, 0x65, 0x72, 0x6f, 0x65, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x47, 0x75,
-0x65, 0x72, 0x6e, 0x73, 0x65, 0x79, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x44, 0x75,
-0x62, 0x6c, 0x69, 0x6e, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x49, 0x73, 0x6c, 0x65,
-0x5f, 0x6f, 0x66, 0x5f, 0x4d, 0x61, 0x6e, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4a,
-0x65, 0x72, 0x73, 0x65, 0x79, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4c, 0x69, 0x73,
-0x62, 0x6f, 0x6e, 0x20, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x4d, 0x61, 0x64,
-0x65, 0x69, 0x72, 0x61, 0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x43, 0x61,
-0x6e, 0x61, 0x72, 0x79, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4c, 0x6f, 0x6e, 0x64,
-0x6f, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x47, 0x6f, 0x64, 0x74, 0x68,
-0x61, 0x62, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4f, 0x75, 0x61, 0x67, 0x61, 0x64,
-0x6f, 0x75, 0x67, 0x6f, 0x75, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x61, 0x6e,
-0x6a, 0x75, 0x6c, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x63, 0x63, 0x72, 0x61,
-0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x61, 0x6e, 0x6d, 0x61, 0x72, 0x6b,
-0x73, 0x68, 0x61, 0x76, 0x6e, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x69, 0x73,
-0x73, 0x61, 0x75, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x6f, 0x6e, 0x61, 0x6b,
-0x72, 0x79, 0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x52, 0x65, 0x79, 0x6b,
-0x6a, 0x61, 0x76, 0x69, 0x6b, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x62, 0x69,
-0x64, 0x6a, 0x61, 0x6e, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x6f, 0x6e, 0x72,
-0x6f, 0x76, 0x69, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x61, 0x6d, 0x61,
-0x6b, 0x6f, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4e, 0x6f, 0x75, 0x61, 0x6b, 0x63,
-0x68, 0x6f, 0x74, 0x74, 0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x53, 0x74,
-0x5f, 0x48, 0x65, 0x6c, 0x65, 0x6e, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x44,
-0x61, 0x6b, 0x61, 0x72, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x46, 0x72, 0x65, 0x65,
-0x74, 0x6f, 0x77, 0x6e, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4c, 0x6f, 0x6d, 0x65,
-0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4e, 0x69, 0x63, 0x6f, 0x73, 0x69, 0x61, 0x20, 0x41, 0x73,
-0x69, 0x61, 0x2f, 0x46, 0x61, 0x6d, 0x61, 0x67, 0x75, 0x73, 0x74, 0x61, 0x0, 0x45, 0x75, 0x72,
-0x6f, 0x70, 0x65, 0x2f, 0x41, 0x74, 0x68, 0x65, 0x6e, 0x73, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70,
-0x65, 0x2f, 0x42, 0x75, 0x63, 0x68, 0x61, 0x72, 0x65, 0x73, 0x74, 0x0, 0x41, 0x6d, 0x65, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x50, 0x6f, 0x72, 0x74, 0x2d, 0x61, 0x75, 0x2d, 0x50, 0x72, 0x69, 0x6e,
-0x63, 0x65, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x31, 0x30, 0x0, 0x50, 0x61,
-0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x52, 0x61, 0x72, 0x6f, 0x74, 0x6f, 0x6e, 0x67, 0x61, 0x0,
-0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x54, 0x61, 0x68, 0x69, 0x74, 0x69, 0x0, 0x50,
-0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x4a, 0x6f, 0x68, 0x6e, 0x73, 0x74, 0x6f, 0x6e, 0x0,
-0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x48, 0x6f, 0x6e, 0x6f, 0x6c, 0x75, 0x6c, 0x75,
-0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x74, 0x74, 0x61, 0x0, 0x41,
-0x73, 0x69, 0x61, 0x2f, 0x54, 0x65, 0x68, 0x72, 0x61, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f,
-0x4a, 0x65, 0x72, 0x75, 0x73, 0x61, 0x6c, 0x65, 0x6d, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x41,
-0x6d, 0x6d, 0x61, 0x6e, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4b, 0x61, 0x6c, 0x69,
-0x6e, 0x69, 0x6e, 0x67, 0x72, 0x61, 0x64, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x53, 0x65, 0x6f,
-0x75, 0x6c, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54, 0x72, 0x69, 0x70, 0x6f, 0x6c,
-0x69, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x31, 0x34, 0x0, 0x50, 0x61, 0x63,
-0x69, 0x66, 0x69, 0x63, 0x2f, 0x4b, 0x69, 0x72, 0x69, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x0,
-0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x4c, 0x6f, 0x72, 0x64, 0x5f, 0x48,
-0x6f, 0x77, 0x65, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4d, 0x61, 0x67, 0x61, 0x64, 0x61, 0x6e,
-0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x75, 0x6e, 0x74, 0x61, 0x5f, 0x41,
-0x72, 0x65, 0x6e, 0x61, 0x73, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x4d, 0x61,
-0x72, 0x71, 0x75, 0x65, 0x73, 0x61, 0x73, 0x0, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x2f, 0x4d,
-0x61, 0x75, 0x72, 0x69, 0x74, 0x69, 0x75, 0x73, 0x0, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x2f,
-0x52, 0x65, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x0, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x2f, 0x4d,
-0x61, 0x68, 0x65, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x42, 0x65, 0x69, 0x72, 0x75, 0x74, 0x0,
-0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x6f, 0x6e, 0x74, 0x65, 0x76, 0x69, 0x64,
-0x65, 0x6f, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x61, 0x73, 0x61, 0x62, 0x6c,
-0x61, 0x6e, 0x63, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x45, 0x6c, 0x5f, 0x41,
-0x61, 0x69, 0x75, 0x6e, 0x0, 0x4d, 0x53, 0x54, 0x37, 0x4d, 0x44, 0x54, 0x0, 0x41, 0x6d, 0x65,
-0x72, 0x69, 0x63, 0x61, 0x2f, 0x45, 0x64, 0x6d, 0x6f, 0x6e, 0x74, 0x6f, 0x6e, 0x20, 0x41, 0x6d,
-0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x61, 0x6d, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x5f,
-0x42, 0x61, 0x79, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x49, 0x6e, 0x75, 0x76,
-0x69, 0x6b, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x59, 0x65, 0x6c, 0x6c, 0x6f,
-0x77, 0x6b, 0x6e, 0x69, 0x66, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43,
-0x69, 0x75, 0x64, 0x61, 0x64, 0x5f, 0x4a, 0x75, 0x61, 0x72, 0x65, 0x7a, 0x0, 0x41, 0x6d, 0x65,
-0x72, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x65, 0x6e, 0x76, 0x65, 0x72, 0x20, 0x41, 0x6d, 0x65, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x42, 0x6f, 0x69, 0x73, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
-0x61, 0x2f, 0x4d, 0x61, 0x7a, 0x61, 0x74, 0x6c, 0x61, 0x6e, 0x0, 0x49, 0x6e, 0x64, 0x69, 0x61,
-0x6e, 0x2f, 0x43, 0x6f, 0x63, 0x6f, 0x73, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x52, 0x61, 0x6e,
-0x67, 0x6f, 0x6f, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4e, 0x6f, 0x76, 0x6f, 0x73, 0x69,
-0x62, 0x69, 0x72, 0x73, 0x6b, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x57, 0x69, 0x6e,
-0x64, 0x68, 0x6f, 0x65, 0x6b, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x61, 0x74, 0x6d, 0x61,
-0x6e, 0x64, 0x75, 0x0, 0x41, 0x6e, 0x74, 0x61, 0x72, 0x63, 0x74, 0x69, 0x63, 0x61, 0x2f, 0x4d,
-0x63, 0x4d, 0x75, 0x72, 0x64, 0x6f, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x41,
-0x75, 0x63, 0x6b, 0x6c, 0x61, 0x6e, 0x64, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
-0x53, 0x74, 0x5f, 0x4a, 0x6f, 0x68, 0x6e, 0x73, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63,
-0x2f, 0x4e, 0x6f, 0x72, 0x66, 0x6f, 0x6c, 0x6b, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x49, 0x72,
-0x6b, 0x75, 0x74, 0x73, 0x6b, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x72, 0x61, 0x73, 0x6e,
-0x6f, 0x79, 0x61, 0x72, 0x73, 0x6b, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4e, 0x6f, 0x76, 0x6f,
-0x6b, 0x75, 0x7a, 0x6e, 0x65, 0x74, 0x73, 0x6b, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x50, 0x79,
-0x6f, 0x6e, 0x67, 0x79, 0x61, 0x6e, 0x67, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4f, 0x6d, 0x73,
-0x6b, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x61, 0x6e, 0x74, 0x69, 0x61,
-0x67, 0x6f, 0x0, 0x50, 0x53, 0x54, 0x38, 0x50, 0x44, 0x54, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
-0x63, 0x61, 0x2f, 0x56, 0x61, 0x6e, 0x63, 0x6f, 0x75, 0x76, 0x65, 0x72, 0x0, 0x41, 0x6d, 0x65,
-0x72, 0x69, 0x63, 0x61, 0x2f, 0x4c, 0x6f, 0x73, 0x5f, 0x41, 0x6e, 0x67, 0x65, 0x6c, 0x65, 0x73,
-0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54, 0x69, 0x6a, 0x75, 0x61, 0x6e, 0x61,
-0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x61, 0x6e, 0x74, 0x61, 0x5f, 0x49,
-0x73, 0x61, 0x62, 0x65, 0x6c, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x61, 0x72, 0x61, 0x63,
-0x68, 0x69, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x73, 0x75, 0x6e, 0x63,
-0x69, 0x6f, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x51, 0x79, 0x7a, 0x79, 0x6c, 0x6f, 0x72,
-0x64, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x42, 0x72, 0x75, 0x73, 0x73, 0x65,
-0x6c, 0x73, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x43, 0x6f, 0x70, 0x65, 0x6e, 0x68,
-0x61, 0x67, 0x65, 0x6e, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x50, 0x61, 0x72, 0x69,
-0x73, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4d, 0x61, 0x64, 0x72, 0x69, 0x64, 0x20,
-0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x65, 0x75, 0x74, 0x61, 0x0, 0x41, 0x73, 0x69,
-0x61, 0x2f, 0x53, 0x72, 0x65, 0x64, 0x6e, 0x65, 0x6b, 0x6f, 0x6c, 0x79, 0x6d, 0x73, 0x6b, 0x0,
-0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x61, 0x6d, 0x63, 0x68, 0x61, 0x74, 0x6b, 0x61, 0x20, 0x41,
-0x73, 0x69, 0x61, 0x2f, 0x41, 0x6e, 0x61, 0x64, 0x79, 0x72, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70,
-0x65, 0x2f, 0x53, 0x61, 0x6d, 0x61, 0x72, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f,
-0x4d, 0x6f, 0x73, 0x63, 0x6f, 0x77, 0x20, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4b, 0x69,
-0x72, 0x6f, 0x76, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x53, 0x69, 0x6d, 0x66, 0x65,
-0x72, 0x6f, 0x70, 0x6f, 0x6c, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x33, 0x0,
-0x41, 0x6e, 0x74, 0x61, 0x72, 0x63, 0x74, 0x69, 0x63, 0x61, 0x2f, 0x52, 0x6f, 0x74, 0x68, 0x65,
-0x72, 0x61, 0x20, 0x41, 0x6e, 0x74, 0x61, 0x72, 0x63, 0x74, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x61,
-0x6c, 0x6d, 0x65, 0x72, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x46, 0x6f, 0x72,
-0x74, 0x61, 0x6c, 0x65, 0x7a, 0x61, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42,
-0x65, 0x6c, 0x65, 0x6d, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x63,
-0x65, 0x69, 0x6f, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x52, 0x65, 0x63, 0x69,
-0x66, 0x65, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x61, 0x6e, 0x74, 0x61,
-0x72, 0x65, 0x6d, 0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x53, 0x74, 0x61,
-0x6e, 0x6c, 0x65, 0x79, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x61, 0x79,
-0x65, 0x6e, 0x6e, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x61, 0x72,
-0x61, 0x6d, 0x61, 0x72, 0x69, 0x62, 0x6f, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b,
-0x35, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x52, 0x69, 0x6f, 0x5f, 0x42, 0x72,
-0x61, 0x6e, 0x63, 0x6f, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x45, 0x69, 0x72,
-0x75, 0x6e, 0x65, 0x70, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x6f,
-0x72, 0x61, 0x6c, 0x5f, 0x48, 0x61, 0x72, 0x62, 0x6f, 0x75, 0x72, 0x0, 0x41, 0x6d, 0x65, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x43, 0x61, 0x79, 0x6d, 0x61, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
-0x63, 0x61, 0x2f, 0x42, 0x6f, 0x67, 0x6f, 0x74, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
-0x61, 0x2f, 0x47, 0x75, 0x61, 0x79, 0x61, 0x71, 0x75, 0x69, 0x6c, 0x0, 0x41, 0x6d, 0x65, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x4a, 0x61, 0x6d, 0x61, 0x69, 0x63, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x50, 0x61, 0x6e, 0x61, 0x6d, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
-0x63, 0x61, 0x2f, 0x4c, 0x69, 0x6d, 0x61, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b,
-0x34, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x6e, 0x67, 0x75, 0x69, 0x6c,
-0x6c, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x6e, 0x74, 0x69, 0x67,
-0x75, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x72, 0x75, 0x62, 0x61,
-0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x61, 0x72, 0x62, 0x61, 0x64, 0x6f,
-0x73, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4c, 0x61, 0x5f, 0x50, 0x61, 0x7a,
-0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x6e, 0x61, 0x75, 0x73, 0x20,
-0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x6f, 0x61, 0x5f, 0x56, 0x69, 0x73, 0x74,
-0x61, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x6f, 0x72, 0x74, 0x6f, 0x5f,
-0x56, 0x65, 0x6c, 0x68, 0x6f, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54, 0x6f,
-0x72, 0x74, 0x6f, 0x6c, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x6c,
-0x61, 0x6e, 0x63, 0x2d, 0x53, 0x61, 0x62, 0x6c, 0x6f, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
-0x63, 0x61, 0x2f, 0x4b, 0x72, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x69, 0x6a, 0x6b, 0x0, 0x41, 0x6d,
-0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x75, 0x72, 0x61, 0x63, 0x61, 0x6f, 0x0, 0x41, 0x6d,
-0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x6f, 0x6d, 0x69, 0x6e, 0x69, 0x63, 0x61, 0x0, 0x41,
-0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x61, 0x6e, 0x74, 0x6f, 0x5f, 0x44, 0x6f, 0x6d,
-0x69, 0x6e, 0x67, 0x6f, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x47, 0x72, 0x65,
-0x6e, 0x61, 0x64, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x47, 0x75, 0x61,
-0x64, 0x65, 0x6c, 0x6f, 0x75, 0x70, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
-0x47, 0x75, 0x79, 0x61, 0x6e, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d,
-0x61, 0x72, 0x74, 0x69, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
-0x61, 0x2f, 0x4d, 0x6f, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x72, 0x61, 0x74, 0x0, 0x41, 0x6d, 0x65,
-0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x75, 0x65, 0x72, 0x74, 0x6f, 0x5f, 0x52, 0x69, 0x63, 0x6f,
-0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x74, 0x5f, 0x42, 0x61, 0x72, 0x74,
-0x68, 0x65, 0x6c, 0x65, 0x6d, 0x79, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53,
-0x74, 0x5f, 0x4b, 0x69, 0x74, 0x74, 0x73, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
-0x53, 0x74, 0x5f, 0x4c, 0x75, 0x63, 0x69, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
-0x2f, 0x4d, 0x61, 0x72, 0x69, 0x67, 0x6f, 0x74, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
-0x2f, 0x53, 0x74, 0x5f, 0x56, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x0, 0x41, 0x6d, 0x65, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x4c, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x50, 0x72, 0x69, 0x6e, 0x63, 0x65,
-0x73, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x6f, 0x72, 0x74, 0x5f, 0x6f,
-0x66, 0x5f, 0x53, 0x70, 0x61, 0x69, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
-0x53, 0x74, 0x5f, 0x54, 0x68, 0x6f, 0x6d, 0x61, 0x73, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
-0x61, 0x2f, 0x4d, 0x69, 0x71, 0x75, 0x65, 0x6c, 0x6f, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f,
-0x53, 0x61, 0x6b, 0x68, 0x61, 0x6c, 0x69, 0x6e, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63,
-0x2f, 0x41, 0x70, 0x69, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x61, 0x6f,
-0x5f, 0x54, 0x6f, 0x6d, 0x65, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x53, 0x61, 0x72,
-0x61, 0x74, 0x6f, 0x76, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x37, 0x0, 0x41,
-0x6e, 0x74, 0x61, 0x72, 0x63, 0x74, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x61, 0x76, 0x69, 0x73, 0x0,
-0x41, 0x73, 0x69, 0x61, 0x2f, 0x50, 0x68, 0x6e, 0x6f, 0x6d, 0x5f, 0x50, 0x65, 0x6e, 0x68, 0x0,
-0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x2f, 0x43, 0x68, 0x72, 0x69, 0x73, 0x74, 0x6d, 0x61, 0x73,
-0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4a, 0x61, 0x6b, 0x61, 0x72, 0x74, 0x61, 0x20, 0x41, 0x73,
-0x69, 0x61, 0x2f, 0x50, 0x6f, 0x6e, 0x74, 0x69, 0x61, 0x6e, 0x61, 0x6b, 0x0, 0x41, 0x73, 0x69,
-0x61, 0x2f, 0x56, 0x69, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6e, 0x65, 0x0, 0x41, 0x73, 0x69, 0x61,
-0x2f, 0x42, 0x61, 0x6e, 0x67, 0x6b, 0x6f, 0x6b, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x53, 0x61,
-0x69, 0x67, 0x6f, 0x6e, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x38, 0x0, 0x41,
-0x73, 0x69, 0x61, 0x2f, 0x42, 0x72, 0x75, 0x6e, 0x65, 0x69, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f,
-0x4d, 0x61, 0x6b, 0x61, 0x73, 0x73, 0x61, 0x72, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x75,
-0x61, 0x6c, 0x61, 0x5f, 0x4c, 0x75, 0x6d, 0x70, 0x75, 0x72, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f,
-0x4b, 0x75, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4d, 0x61, 0x6e,
-0x69, 0x6c, 0x61, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x53, 0x69, 0x6e, 0x67, 0x61, 0x70, 0x6f,
-0x72, 0x65, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x32, 0x0, 0x41, 0x66, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x47, 0x61, 0x62, 0x6f, 0x72, 0x6f, 0x6e, 0x65, 0x0, 0x41, 0x66, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x42, 0x75, 0x6a, 0x75, 0x6d, 0x62, 0x75, 0x72, 0x61, 0x0, 0x41, 0x66,
-0x72, 0x69, 0x63, 0x61, 0x2f, 0x4c, 0x75, 0x62, 0x75, 0x6d, 0x62, 0x61, 0x73, 0x68, 0x69, 0x0,
-0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x62, 0x61, 0x62, 0x61, 0x6e, 0x65, 0x0, 0x41,
-0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x73, 0x65, 0x72, 0x75, 0x0, 0x41, 0x66, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x42, 0x6c, 0x61, 0x6e, 0x74, 0x79, 0x72, 0x65, 0x0, 0x41, 0x66, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x70, 0x75, 0x74, 0x6f, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63,
-0x61, 0x2f, 0x4b, 0x69, 0x67, 0x61, 0x6c, 0x69, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f,
-0x4a, 0x6f, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x73, 0x62, 0x75, 0x72, 0x67, 0x0, 0x41, 0x66, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x4c, 0x75, 0x73, 0x61, 0x6b, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63,
-0x61, 0x2f, 0x48, 0x61, 0x72, 0x61, 0x72, 0x65, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f,
-0x4a, 0x75, 0x62, 0x61, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x43, 0x6f, 0x6c, 0x6f, 0x6d, 0x62,
-0x6f, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4b, 0x68, 0x61, 0x72, 0x74, 0x6f, 0x75,
-0x6d, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x44, 0x61, 0x6d, 0x61, 0x73, 0x63, 0x75, 0x73, 0x0,
-0x41, 0x73, 0x69, 0x61, 0x2f, 0x54, 0x61, 0x69, 0x70, 0x65, 0x69, 0x0, 0x41, 0x75, 0x73, 0x74,
-0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x48, 0x6f, 0x62, 0x61, 0x72, 0x74, 0x20, 0x41, 0x75, 0x73,
-0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x43, 0x75, 0x72, 0x72, 0x69, 0x65, 0x20, 0x41, 0x6e,
-0x74, 0x61, 0x72, 0x63, 0x74, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x63, 0x71, 0x75, 0x61, 0x72,
-0x69, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x72, 0x61, 0x67, 0x75,
-0x61, 0x69, 0x6e, 0x61, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x39, 0x0, 0x41,
-0x73, 0x69, 0x61, 0x2f, 0x4a, 0x61, 0x79, 0x61, 0x70, 0x75, 0x72, 0x61, 0x0, 0x41, 0x73, 0x69,
-0x61, 0x2f, 0x54, 0x6f, 0x6b, 0x79, 0x6f, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f,
-0x50, 0x61, 0x6c, 0x61, 0x75, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x44, 0x69, 0x6c, 0x69, 0x0,
-0x41, 0x73, 0x69, 0x61, 0x2f, 0x54, 0x6f, 0x6d, 0x73, 0x6b, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66,
-0x69, 0x63, 0x2f, 0x54, 0x6f, 0x6e, 0x67, 0x61, 0x74, 0x61, 0x70, 0x75, 0x0, 0x41, 0x73, 0x69,
-0x61, 0x2f, 0x43, 0x68, 0x69, 0x74, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x49,
-0x73, 0x74, 0x61, 0x6e, 0x62, 0x75, 0x6c, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
-0x47, 0x72, 0x61, 0x6e, 0x64, 0x5f, 0x54, 0x75, 0x72, 0x6b, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f,
-0x55, 0x6c, 0x61, 0x61, 0x6e, 0x62, 0x61, 0x61, 0x74, 0x61, 0x72, 0x20, 0x41, 0x73, 0x69, 0x61,
-0x2f, 0x43, 0x68, 0x6f, 0x69, 0x62, 0x61, 0x6c, 0x73, 0x61, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72,
+0x74, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4e, 0x69, 0x70, 0x69, 0x67, 0x6f,
+0x6e, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x61, 0x6e, 0x67, 0x6e, 0x69,
+0x72, 0x74, 0x75, 0x6e, 0x67, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54, 0x68,
+0x75, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x42, 0x61, 0x79, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x4e, 0x65, 0x77, 0x5f, 0x59, 0x6f, 0x72, 0x6b, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x44, 0x65, 0x74, 0x72, 0x6f, 0x69, 0x74, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61, 0x2f, 0x50, 0x65, 0x74, 0x65, 0x72,
+0x73, 0x62, 0x75, 0x72, 0x67, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x49, 0x6e,
+0x64, 0x69, 0x61, 0x6e, 0x61, 0x2f, 0x56, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x6e, 0x65, 0x73, 0x20,
+0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61, 0x2f,
+0x57, 0x69, 0x6e, 0x61, 0x6d, 0x61, 0x63, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
+0x4b, 0x65, 0x6e, 0x74, 0x75, 0x63, 0x6b, 0x79, 0x2f, 0x4d, 0x6f, 0x6e, 0x74, 0x69, 0x63, 0x65,
+0x6c, 0x6c, 0x6f, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4c, 0x6f, 0x75, 0x69,
+0x73, 0x76, 0x69, 0x6c, 0x6c, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43,
+0x61, 0x6e, 0x63, 0x75, 0x6e, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x61, 0x69,
+0x72, 0x6f, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x59, 0x65, 0x6b, 0x61, 0x74, 0x65, 0x72, 0x69,
+0x6e, 0x62, 0x75, 0x72, 0x67, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x46, 0x69,
+0x6a, 0x69, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4d, 0x61, 0x72, 0x69, 0x65, 0x68,
+0x61, 0x6d, 0x6e, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x53, 0x6f, 0x66, 0x69, 0x61,
+0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x54, 0x61, 0x6c, 0x6c, 0x69, 0x6e, 0x6e, 0x0,
+0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x48, 0x65, 0x6c, 0x73, 0x69, 0x6e, 0x6b, 0x69, 0x0,
+0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x52, 0x69, 0x67, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f,
+0x70, 0x65, 0x2f, 0x56, 0x69, 0x6c, 0x6e, 0x69, 0x75, 0x73, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70,
+0x65, 0x2f, 0x4b, 0x69, 0x65, 0x76, 0x20, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x55, 0x7a,
+0x68, 0x67, 0x6f, 0x72, 0x6f, 0x64, 0x20, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x5a, 0x61,
+0x70, 0x6f, 0x72, 0x6f, 0x7a, 0x68, 0x79, 0x65, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x54, 0x62,
+0x69, 0x6c, 0x69, 0x73, 0x69, 0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x46,
+0x61, 0x65, 0x72, 0x6f, 0x65, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x47, 0x75, 0x65,
+0x72, 0x6e, 0x73, 0x65, 0x79, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x44, 0x75, 0x62,
+0x6c, 0x69, 0x6e, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x49, 0x73, 0x6c, 0x65, 0x5f,
+0x6f, 0x66, 0x5f, 0x4d, 0x61, 0x6e, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4a, 0x65,
+0x72, 0x73, 0x65, 0x79, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4c, 0x69, 0x73, 0x62,
+0x6f, 0x6e, 0x20, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x4d, 0x61, 0x64, 0x65,
+0x69, 0x72, 0x61, 0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x43, 0x61, 0x6e,
+0x61, 0x72, 0x79, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4c, 0x6f, 0x6e, 0x64, 0x6f,
+0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x47, 0x6f, 0x64, 0x74, 0x68, 0x61,
+0x62, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4f, 0x75, 0x61, 0x67, 0x61, 0x64, 0x6f,
+0x75, 0x67, 0x6f, 0x75, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x61, 0x6e, 0x6a,
+0x75, 0x6c, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x63, 0x63, 0x72, 0x61, 0x0,
+0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x61, 0x6e, 0x6d, 0x61, 0x72, 0x6b, 0x73,
+0x68, 0x61, 0x76, 0x6e, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x69, 0x73, 0x73,
+0x61, 0x75, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x6f, 0x6e, 0x61, 0x6b, 0x72,
+0x79, 0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x52, 0x65, 0x79, 0x6b, 0x6a,
+0x61, 0x76, 0x69, 0x6b, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x62, 0x69, 0x64,
+0x6a, 0x61, 0x6e, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x6f, 0x6e, 0x72, 0x6f,
+0x76, 0x69, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x61, 0x6d, 0x61, 0x6b,
+0x6f, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4e, 0x6f, 0x75, 0x61, 0x6b, 0x63, 0x68,
+0x6f, 0x74, 0x74, 0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x53, 0x74, 0x5f,
+0x48, 0x65, 0x6c, 0x65, 0x6e, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x61,
+0x6b, 0x61, 0x72, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x46, 0x72, 0x65, 0x65, 0x74,
+0x6f, 0x77, 0x6e, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4c, 0x6f, 0x6d, 0x65, 0x0,
+0x41, 0x73, 0x69, 0x61, 0x2f, 0x4e, 0x69, 0x63, 0x6f, 0x73, 0x69, 0x61, 0x20, 0x41, 0x73, 0x69,
+0x61, 0x2f, 0x46, 0x61, 0x6d, 0x61, 0x67, 0x75, 0x73, 0x74, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f,
+0x70, 0x65, 0x2f, 0x41, 0x74, 0x68, 0x65, 0x6e, 0x73, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65,
+0x2f, 0x42, 0x75, 0x63, 0x68, 0x61, 0x72, 0x65, 0x73, 0x74, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x50, 0x6f, 0x72, 0x74, 0x2d, 0x61, 0x75, 0x2d, 0x50, 0x72, 0x69, 0x6e, 0x63,
+0x65, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x31, 0x30, 0x0, 0x50, 0x61, 0x63,
+0x69, 0x66, 0x69, 0x63, 0x2f, 0x52, 0x61, 0x72, 0x6f, 0x74, 0x6f, 0x6e, 0x67, 0x61, 0x0, 0x50,
+0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x54, 0x61, 0x68, 0x69, 0x74, 0x69, 0x0, 0x50, 0x61,
+0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x4a, 0x6f, 0x68, 0x6e, 0x73, 0x74, 0x6f, 0x6e, 0x0, 0x50,
+0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x48, 0x6f, 0x6e, 0x6f, 0x6c, 0x75, 0x6c, 0x75, 0x0,
+0x41, 0x73, 0x69, 0x61, 0x2f, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x74, 0x74, 0x61, 0x0, 0x41, 0x73,
+0x69, 0x61, 0x2f, 0x54, 0x65, 0x68, 0x72, 0x61, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4a,
+0x65, 0x72, 0x75, 0x73, 0x61, 0x6c, 0x65, 0x6d, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x41, 0x6d,
+0x6d, 0x61, 0x6e, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4b, 0x61, 0x6c, 0x69, 0x6e,
+0x69, 0x6e, 0x67, 0x72, 0x61, 0x64, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x53, 0x65, 0x6f, 0x75,
+0x6c, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54, 0x72, 0x69, 0x70, 0x6f, 0x6c, 0x69,
+0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x31, 0x34, 0x0, 0x50, 0x61, 0x63, 0x69,
+0x66, 0x69, 0x63, 0x2f, 0x4b, 0x69, 0x72, 0x69, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x0, 0x41,
+0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x4c, 0x6f, 0x72, 0x64, 0x5f, 0x48, 0x6f,
+0x77, 0x65, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4d, 0x61, 0x67, 0x61, 0x64, 0x61, 0x6e, 0x0,
+0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x75, 0x6e, 0x74, 0x61, 0x5f, 0x41, 0x72,
+0x65, 0x6e, 0x61, 0x73, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x4d, 0x61, 0x72,
+0x71, 0x75, 0x65, 0x73, 0x61, 0x73, 0x0, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x2f, 0x4d, 0x61,
+0x75, 0x72, 0x69, 0x74, 0x69, 0x75, 0x73, 0x0, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x2f, 0x52,
+0x65, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x0, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x2f, 0x4d, 0x61,
+0x68, 0x65, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x42, 0x65, 0x69, 0x72, 0x75, 0x74, 0x0, 0x41,
+0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x6f, 0x6e, 0x74, 0x65, 0x76, 0x69, 0x64, 0x65,
+0x6f, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x61, 0x73, 0x61, 0x62, 0x6c, 0x61,
+0x6e, 0x63, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x45, 0x6c, 0x5f, 0x41, 0x61,
+0x69, 0x75, 0x6e, 0x0, 0x4d, 0x53, 0x54, 0x37, 0x4d, 0x44, 0x54, 0x0, 0x41, 0x6d, 0x65, 0x72,
+0x69, 0x63, 0x61, 0x2f, 0x45, 0x64, 0x6d, 0x6f, 0x6e, 0x74, 0x6f, 0x6e, 0x20, 0x41, 0x6d, 0x65,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x61, 0x6d, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x5f, 0x42,
+0x61, 0x79, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x49, 0x6e, 0x75, 0x76, 0x69,
+0x6b, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x59, 0x65, 0x6c, 0x6c, 0x6f, 0x77,
+0x6b, 0x6e, 0x69, 0x66, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x69,
+0x75, 0x64, 0x61, 0x64, 0x5f, 0x4a, 0x75, 0x61, 0x72, 0x65, 0x7a, 0x0, 0x41, 0x6d, 0x65, 0x72,
+0x69, 0x63, 0x61, 0x2f, 0x44, 0x65, 0x6e, 0x76, 0x65, 0x72, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x42, 0x6f, 0x69, 0x73, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
+0x2f, 0x4d, 0x61, 0x7a, 0x61, 0x74, 0x6c, 0x61, 0x6e, 0x0, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e,
+0x2f, 0x43, 0x6f, 0x63, 0x6f, 0x73, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x52, 0x61, 0x6e, 0x67,
+0x6f, 0x6f, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4e, 0x6f, 0x76, 0x6f, 0x73, 0x69, 0x62,
+0x69, 0x72, 0x73, 0x6b, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x57, 0x69, 0x6e, 0x64,
+0x68, 0x6f, 0x65, 0x6b, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x61, 0x74, 0x6d, 0x61, 0x6e,
+0x64, 0x75, 0x0, 0x41, 0x6e, 0x74, 0x61, 0x72, 0x63, 0x74, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x63,
+0x4d, 0x75, 0x72, 0x64, 0x6f, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x41, 0x75,
+0x63, 0x6b, 0x6c, 0x61, 0x6e, 0x64, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53,
+0x74, 0x5f, 0x4a, 0x6f, 0x68, 0x6e, 0x73, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f,
+0x4e, 0x6f, 0x72, 0x66, 0x6f, 0x6c, 0x6b, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x49, 0x72, 0x6b,
+0x75, 0x74, 0x73, 0x6b, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x72, 0x61, 0x73, 0x6e, 0x6f,
+0x79, 0x61, 0x72, 0x73, 0x6b, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4e, 0x6f, 0x76, 0x6f, 0x6b,
+0x75, 0x7a, 0x6e, 0x65, 0x74, 0x73, 0x6b, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x50, 0x79, 0x6f,
+0x6e, 0x67, 0x79, 0x61, 0x6e, 0x67, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4f, 0x6d, 0x73, 0x6b,
+0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x61, 0x6e, 0x74, 0x69, 0x61, 0x67,
+0x6f, 0x0, 0x50, 0x53, 0x54, 0x38, 0x50, 0x44, 0x54, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x56, 0x61, 0x6e, 0x63, 0x6f, 0x75, 0x76, 0x65, 0x72, 0x0, 0x41, 0x6d, 0x65, 0x72,
+0x69, 0x63, 0x61, 0x2f, 0x4c, 0x6f, 0x73, 0x5f, 0x41, 0x6e, 0x67, 0x65, 0x6c, 0x65, 0x73, 0x0,
+0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54, 0x69, 0x6a, 0x75, 0x61, 0x6e, 0x61, 0x20,
+0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x61, 0x6e, 0x74, 0x61, 0x5f, 0x49, 0x73,
+0x61, 0x62, 0x65, 0x6c, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x61, 0x72, 0x61, 0x63, 0x68,
+0x69, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x73, 0x75, 0x6e, 0x63, 0x69,
+0x6f, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x51, 0x79, 0x7a, 0x79, 0x6c, 0x6f, 0x72, 0x64,
+0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x42, 0x72, 0x75, 0x73, 0x73, 0x65, 0x6c,
+0x73, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x43, 0x6f, 0x70, 0x65, 0x6e, 0x68, 0x61,
+0x67, 0x65, 0x6e, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x50, 0x61, 0x72, 0x69, 0x73,
+0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4d, 0x61, 0x64, 0x72, 0x69, 0x64, 0x20, 0x41,
+0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x65, 0x75, 0x74, 0x61, 0x0, 0x41, 0x73, 0x69, 0x61,
+0x2f, 0x53, 0x72, 0x65, 0x64, 0x6e, 0x65, 0x6b, 0x6f, 0x6c, 0x79, 0x6d, 0x73, 0x6b, 0x0, 0x41,
+0x73, 0x69, 0x61, 0x2f, 0x4b, 0x61, 0x6d, 0x63, 0x68, 0x61, 0x74, 0x6b, 0x61, 0x20, 0x41, 0x73,
+0x69, 0x61, 0x2f, 0x41, 0x6e, 0x61, 0x64, 0x79, 0x72, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65,
+0x2f, 0x53, 0x61, 0x6d, 0x61, 0x72, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4d,
+0x6f, 0x73, 0x63, 0x6f, 0x77, 0x20, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4b, 0x69, 0x72,
+0x6f, 0x76, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x53, 0x69, 0x6d, 0x66, 0x65, 0x72,
+0x6f, 0x70, 0x6f, 0x6c, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x33, 0x0, 0x41,
+0x6e, 0x74, 0x61, 0x72, 0x63, 0x74, 0x69, 0x63, 0x61, 0x2f, 0x52, 0x6f, 0x74, 0x68, 0x65, 0x72,
+0x61, 0x20, 0x41, 0x6e, 0x74, 0x61, 0x72, 0x63, 0x74, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x61, 0x6c,
+0x6d, 0x65, 0x72, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x46, 0x6f, 0x72, 0x74,
+0x61, 0x6c, 0x65, 0x7a, 0x61, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x65,
+0x6c, 0x65, 0x6d, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x63, 0x65,
+0x69, 0x6f, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x52, 0x65, 0x63, 0x69, 0x66,
+0x65, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x61, 0x6e, 0x74, 0x61, 0x72,
+0x65, 0x6d, 0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x53, 0x74, 0x61, 0x6e,
+0x6c, 0x65, 0x79, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x61, 0x79, 0x65,
+0x6e, 0x6e, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x61, 0x72, 0x61,
+0x6d, 0x61, 0x72, 0x69, 0x62, 0x6f, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x35,
+0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x52, 0x69, 0x6f, 0x5f, 0x42, 0x72, 0x61,
+0x6e, 0x63, 0x6f, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x45, 0x69, 0x72, 0x75,
+0x6e, 0x65, 0x70, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x6f, 0x72,
+0x61, 0x6c, 0x5f, 0x48, 0x61, 0x72, 0x62, 0x6f, 0x75, 0x72, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x43, 0x61, 0x79, 0x6d, 0x61, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x42, 0x6f, 0x67, 0x6f, 0x74, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
+0x2f, 0x47, 0x75, 0x61, 0x79, 0x61, 0x71, 0x75, 0x69, 0x6c, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x4a, 0x61, 0x6d, 0x61, 0x69, 0x63, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x50, 0x61, 0x6e, 0x61, 0x6d, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x4c, 0x69, 0x6d, 0x61, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x34,
+0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x6e, 0x67, 0x75, 0x69, 0x6c, 0x6c,
+0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x6e, 0x74, 0x69, 0x67, 0x75,
+0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x72, 0x75, 0x62, 0x61, 0x0,
+0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x61, 0x72, 0x62, 0x61, 0x64, 0x6f, 0x73,
+0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4c, 0x61, 0x5f, 0x50, 0x61, 0x7a, 0x0,
+0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x6e, 0x61, 0x75, 0x73, 0x20, 0x41,
+0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x6f, 0x61, 0x5f, 0x56, 0x69, 0x73, 0x74, 0x61,
+0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x6f, 0x72, 0x74, 0x6f, 0x5f, 0x56,
+0x65, 0x6c, 0x68, 0x6f, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54, 0x6f, 0x72,
+0x74, 0x6f, 0x6c, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x6c, 0x61,
+0x6e, 0x63, 0x2d, 0x53, 0x61, 0x62, 0x6c, 0x6f, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x4b, 0x72, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x69, 0x6a, 0x6b, 0x0, 0x41, 0x6d, 0x65,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x75, 0x72, 0x61, 0x63, 0x61, 0x6f, 0x0, 0x41, 0x6d, 0x65,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x6f, 0x6d, 0x69, 0x6e, 0x69, 0x63, 0x61, 0x0, 0x41, 0x6d,
+0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x61, 0x6e, 0x74, 0x6f, 0x5f, 0x44, 0x6f, 0x6d, 0x69,
+0x6e, 0x67, 0x6f, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x47, 0x72, 0x65, 0x6e,
+0x61, 0x64, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x47, 0x75, 0x61, 0x64,
+0x65, 0x6c, 0x6f, 0x75, 0x70, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x47,
+0x75, 0x79, 0x61, 0x6e, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61,
+0x72, 0x74, 0x69, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
+0x2f, 0x4d, 0x6f, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x72, 0x61, 0x74, 0x0, 0x41, 0x6d, 0x65, 0x72,
+0x69, 0x63, 0x61, 0x2f, 0x50, 0x75, 0x65, 0x72, 0x74, 0x6f, 0x5f, 0x52, 0x69, 0x63, 0x6f, 0x0,
+0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x74, 0x5f, 0x42, 0x61, 0x72, 0x74, 0x68,
+0x65, 0x6c, 0x65, 0x6d, 0x79, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x74,
+0x5f, 0x4b, 0x69, 0x74, 0x74, 0x73, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53,
+0x74, 0x5f, 0x4c, 0x75, 0x63, 0x69, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
+0x4d, 0x61, 0x72, 0x69, 0x67, 0x6f, 0x74, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
+0x53, 0x74, 0x5f, 0x56, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x4c, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x50, 0x72, 0x69, 0x6e, 0x63, 0x65, 0x73,
+0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x6f, 0x72, 0x74, 0x5f, 0x6f, 0x66,
+0x5f, 0x53, 0x70, 0x61, 0x69, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53,
+0x74, 0x5f, 0x54, 0x68, 0x6f, 0x6d, 0x61, 0x73, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
+0x2f, 0x4d, 0x69, 0x71, 0x75, 0x65, 0x6c, 0x6f, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x53,
+0x61, 0x6b, 0x68, 0x61, 0x6c, 0x69, 0x6e, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f,
+0x41, 0x70, 0x69, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x61, 0x6f, 0x5f,
+0x54, 0x6f, 0x6d, 0x65, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x53, 0x61, 0x72, 0x61,
+0x74, 0x6f, 0x76, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x37, 0x0, 0x41, 0x6e,
+0x74, 0x61, 0x72, 0x63, 0x74, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x61, 0x76, 0x69, 0x73, 0x0, 0x41,
+0x73, 0x69, 0x61, 0x2f, 0x50, 0x68, 0x6e, 0x6f, 0x6d, 0x5f, 0x50, 0x65, 0x6e, 0x68, 0x0, 0x49,
+0x6e, 0x64, 0x69, 0x61, 0x6e, 0x2f, 0x43, 0x68, 0x72, 0x69, 0x73, 0x74, 0x6d, 0x61, 0x73, 0x0,
+0x41, 0x73, 0x69, 0x61, 0x2f, 0x4a, 0x61, 0x6b, 0x61, 0x72, 0x74, 0x61, 0x20, 0x41, 0x73, 0x69,
+0x61, 0x2f, 0x50, 0x6f, 0x6e, 0x74, 0x69, 0x61, 0x6e, 0x61, 0x6b, 0x0, 0x41, 0x73, 0x69, 0x61,
+0x2f, 0x56, 0x69, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6e, 0x65, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f,
+0x42, 0x61, 0x6e, 0x67, 0x6b, 0x6f, 0x6b, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x53, 0x61, 0x69,
+0x67, 0x6f, 0x6e, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x38, 0x0, 0x41, 0x73,
+0x69, 0x61, 0x2f, 0x42, 0x72, 0x75, 0x6e, 0x65, 0x69, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4d,
+0x61, 0x6b, 0x61, 0x73, 0x73, 0x61, 0x72, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x75, 0x61,
+0x6c, 0x61, 0x5f, 0x4c, 0x75, 0x6d, 0x70, 0x75, 0x72, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b,
+0x75, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4d, 0x61, 0x6e, 0x69,
+0x6c, 0x61, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x53, 0x69, 0x6e, 0x67, 0x61, 0x70, 0x6f, 0x72,
+0x65, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x32, 0x0, 0x41, 0x66, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x47, 0x61, 0x62, 0x6f, 0x72, 0x6f, 0x6e, 0x65, 0x0, 0x41, 0x66, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x42, 0x75, 0x6a, 0x75, 0x6d, 0x62, 0x75, 0x72, 0x61, 0x0, 0x41, 0x66, 0x72,
+0x69, 0x63, 0x61, 0x2f, 0x4c, 0x75, 0x62, 0x75, 0x6d, 0x62, 0x61, 0x73, 0x68, 0x69, 0x0, 0x41,
+0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x62, 0x61, 0x62, 0x61, 0x6e, 0x65, 0x0, 0x41, 0x66,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x73, 0x65, 0x72, 0x75, 0x0, 0x41, 0x66, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x42, 0x6c, 0x61, 0x6e, 0x74, 0x79, 0x72, 0x65, 0x0, 0x41, 0x66, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x4d, 0x61, 0x70, 0x75, 0x74, 0x6f, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61,
+0x2f, 0x4b, 0x69, 0x67, 0x61, 0x6c, 0x69, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4a,
+0x6f, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x73, 0x62, 0x75, 0x72, 0x67, 0x0, 0x41, 0x66, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x4c, 0x75, 0x73, 0x61, 0x6b, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61,
+0x2f, 0x48, 0x61, 0x72, 0x61, 0x72, 0x65, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4a,
+0x75, 0x62, 0x61, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x43, 0x6f, 0x6c, 0x6f, 0x6d, 0x62, 0x6f,
+0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4b, 0x68, 0x61, 0x72, 0x74, 0x6f, 0x75, 0x6d,
+0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x44, 0x61, 0x6d, 0x61, 0x73, 0x63, 0x75, 0x73, 0x0, 0x41,
+0x73, 0x69, 0x61, 0x2f, 0x54, 0x61, 0x69, 0x70, 0x65, 0x69, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72,
+0x61, 0x6c, 0x69, 0x61, 0x2f, 0x48, 0x6f, 0x62, 0x61, 0x72, 0x74, 0x20, 0x41, 0x75, 0x73, 0x74,
+0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x43, 0x75, 0x72, 0x72, 0x69, 0x65, 0x20, 0x41, 0x6e, 0x74,
+0x61, 0x72, 0x63, 0x74, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x63, 0x71, 0x75, 0x61, 0x72, 0x69,
+0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x72, 0x61, 0x67, 0x75, 0x61,
+0x69, 0x6e, 0x61, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x39, 0x0, 0x41, 0x73,
+0x69, 0x61, 0x2f, 0x4a, 0x61, 0x79, 0x61, 0x70, 0x75, 0x72, 0x61, 0x0, 0x41, 0x73, 0x69, 0x61,
+0x2f, 0x54, 0x6f, 0x6b, 0x79, 0x6f, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x50,
+0x61, 0x6c, 0x61, 0x75, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x44, 0x69, 0x6c, 0x69, 0x0, 0x41,
+0x73, 0x69, 0x61, 0x2f, 0x54, 0x6f, 0x6d, 0x73, 0x6b, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69,
+0x63, 0x2f, 0x54, 0x6f, 0x6e, 0x67, 0x61, 0x74, 0x61, 0x70, 0x75, 0x0, 0x41, 0x73, 0x69, 0x61,
+0x2f, 0x43, 0x68, 0x69, 0x74, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x49, 0x73,
+0x74, 0x61, 0x6e, 0x62, 0x75, 0x6c, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x47,
+0x72, 0x61, 0x6e, 0x64, 0x5f, 0x54, 0x75, 0x72, 0x6b, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x55,
+0x6c, 0x61, 0x61, 0x6e, 0x62, 0x61, 0x61, 0x74, 0x61, 0x72, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f,
+0x43, 0x68, 0x6f, 0x69, 0x62, 0x61, 0x6c, 0x73, 0x61, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61, 0x70, 0x6f, 0x6c, 0x69, 0x73, 0x20,
+0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61, 0x2f,
+0x4d, 0x61, 0x72, 0x65, 0x6e, 0x67, 0x6f, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
+0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61, 0x2f, 0x56, 0x65, 0x76, 0x61, 0x79, 0x0, 0x45, 0x74,
+0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x37, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
+0x43, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x6e, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
+0x44, 0x61, 0x77, 0x73, 0x6f, 0x6e, 0x5f, 0x43, 0x72, 0x65, 0x65, 0x6b, 0x20, 0x41, 0x6d, 0x65,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x46, 0x6f, 0x72, 0x74, 0x5f, 0x4e, 0x65, 0x6c, 0x73, 0x6f, 0x6e,
+0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x48, 0x65, 0x72, 0x6d, 0x6f, 0x73, 0x69,
+0x6c, 0x6c, 0x6f, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x68, 0x6f, 0x65,
+0x6e, 0x69, 0x78, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x55, 0x54, 0x43, 0x20, 0x45, 0x74, 0x63, 0x2f,
+0x47, 0x4d, 0x54, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x31, 0x32, 0x0, 0x50,
+0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x54, 0x61, 0x72, 0x61, 0x77, 0x61, 0x0, 0x50, 0x61,
+0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x4d, 0x61, 0x6a, 0x75, 0x72, 0x6f, 0x20, 0x50, 0x61, 0x63,
+0x69, 0x66, 0x69, 0x63, 0x2f, 0x4b, 0x77, 0x61, 0x6a, 0x61, 0x6c, 0x65, 0x69, 0x6e, 0x0, 0x50,
+0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x4e, 0x61, 0x75, 0x72, 0x75, 0x0, 0x50, 0x61, 0x63,
+0x69, 0x66, 0x69, 0x63, 0x2f, 0x46, 0x75, 0x6e, 0x61, 0x66, 0x75, 0x74, 0x69, 0x0, 0x50, 0x61,
+0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x57, 0x61, 0x6b, 0x65, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66,
+0x69, 0x63, 0x2f, 0x57, 0x61, 0x6c, 0x6c, 0x69, 0x73, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d,
+0x54, 0x2d, 0x31, 0x33, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x45, 0x6e, 0x64,
+0x65, 0x72, 0x62, 0x75, 0x72, 0x79, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x46,
+0x61, 0x6b, 0x61, 0x6f, 0x66, 0x6f, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x32,
+0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4e, 0x6f, 0x72, 0x6f, 0x6e, 0x68, 0x61,
+0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x5f,
+0x47, 0x65, 0x6f, 0x72, 0x67, 0x69, 0x61, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b,
+0x38, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x50, 0x69, 0x74, 0x63, 0x61, 0x69,
+0x72, 0x6e, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x39, 0x0, 0x50, 0x61, 0x63,
+0x69, 0x66, 0x69, 0x63, 0x2f, 0x47, 0x61, 0x6d, 0x62, 0x69, 0x65, 0x72, 0x0, 0x45, 0x74, 0x63,
+0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x31, 0x31, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f,
+0x50, 0x61, 0x67, 0x6f, 0x5f, 0x50, 0x61, 0x67, 0x6f, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69,
+0x63, 0x2f, 0x4e, 0x69, 0x75, 0x65, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x4d,
+0x69, 0x64, 0x77, 0x61, 0x79, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x61,
+0x72, 0x61, 0x63, 0x61, 0x73, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x56, 0x6c, 0x61, 0x64, 0x69,
+0x76, 0x6f, 0x73, 0x74, 0x6f, 0x6b, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x55, 0x73, 0x74, 0x2d,
+0x4e, 0x65, 0x72, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x56, 0x6f, 0x6c, 0x67,
+0x6f, 0x67, 0x72, 0x61, 0x64, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f,
+0x50, 0x65, 0x72, 0x74, 0x68, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x31, 0x0,
+0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x6c, 0x67, 0x69, 0x65, 0x72, 0x73, 0x0, 0x41,
+0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4c, 0x75, 0x61, 0x6e, 0x64, 0x61, 0x0, 0x41, 0x66, 0x72,
+0x69, 0x63, 0x61, 0x2f, 0x50, 0x6f, 0x72, 0x74, 0x6f, 0x2d, 0x4e, 0x6f, 0x76, 0x6f, 0x0, 0x41,
+0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x6f, 0x75, 0x61, 0x6c, 0x61, 0x0, 0x41, 0x66, 0x72,
+0x69, 0x63, 0x61, 0x2f, 0x42, 0x61, 0x6e, 0x67, 0x75, 0x69, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x4e, 0x64, 0x6a, 0x61, 0x6d, 0x65, 0x6e, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x42, 0x72, 0x61, 0x7a, 0x7a, 0x61, 0x76, 0x69, 0x6c, 0x6c, 0x65, 0x0, 0x41, 0x66,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x4b, 0x69, 0x6e, 0x73, 0x68, 0x61, 0x73, 0x61, 0x0, 0x41, 0x66,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x6c, 0x61, 0x62, 0x6f, 0x0, 0x41, 0x66, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x4c, 0x69, 0x62, 0x72, 0x65, 0x76, 0x69, 0x6c, 0x6c, 0x65, 0x0, 0x41, 0x66,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x4c, 0x61, 0x67, 0x6f, 0x73, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x4e, 0x69, 0x61, 0x6d, 0x65, 0x79, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f,
+0x54, 0x75, 0x6e, 0x69, 0x73, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x41, 0x6e, 0x64,
+0x6f, 0x72, 0x72, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x56, 0x69, 0x65, 0x6e,
+0x6e, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x42, 0x65, 0x72, 0x6c, 0x69, 0x6e,
+0x20, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x42, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x65, 0x6e,
+0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x47, 0x69, 0x62, 0x72, 0x61, 0x6c, 0x74, 0x61,
+0x72, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x52, 0x6f, 0x6d, 0x65, 0x0, 0x45, 0x75,
+0x72, 0x6f, 0x70, 0x65, 0x2f, 0x56, 0x61, 0x64, 0x75, 0x7a, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70,
+0x65, 0x2f, 0x4c, 0x75, 0x78, 0x65, 0x6d, 0x62, 0x6f, 0x75, 0x72, 0x67, 0x0, 0x45, 0x75, 0x72,
+0x6f, 0x70, 0x65, 0x2f, 0x4d, 0x61, 0x6c, 0x74, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65,
+0x2f, 0x4d, 0x6f, 0x6e, 0x61, 0x63, 0x6f, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x41,
+0x6d, 0x73, 0x74, 0x65, 0x72, 0x64, 0x61, 0x6d, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f,
+0x4f, 0x73, 0x6c, 0x6f, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x53, 0x61, 0x6e, 0x5f,
+0x4d, 0x61, 0x72, 0x69, 0x6e, 0x6f, 0x0, 0x41, 0x72, 0x63, 0x74, 0x69, 0x63, 0x2f, 0x4c, 0x6f,
+0x6e, 0x67, 0x79, 0x65, 0x61, 0x72, 0x62, 0x79, 0x65, 0x6e, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70,
+0x65, 0x2f, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x68, 0x6f, 0x6c, 0x6d, 0x0, 0x45, 0x75, 0x72, 0x6f,
+0x70, 0x65, 0x2f, 0x5a, 0x75, 0x72, 0x69, 0x63, 0x68, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65,
+0x2f, 0x56, 0x61, 0x74, 0x69, 0x63, 0x61, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x48, 0x6f,
+0x76, 0x64, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x35, 0x0, 0x41, 0x6e, 0x74,
+0x61, 0x72, 0x63, 0x74, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x77, 0x73, 0x6f, 0x6e, 0x0, 0x49,
+0x6e, 0x64, 0x69, 0x61, 0x6e, 0x2f, 0x4b, 0x65, 0x72, 0x67, 0x75, 0x65, 0x6c, 0x65, 0x6e, 0x0,
+0x41, 0x73, 0x69, 0x61, 0x2f, 0x4f, 0x72, 0x61, 0x6c, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x41,
+0x71, 0x74, 0x61, 0x75, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x41, 0x71, 0x74, 0x6f, 0x62, 0x65,
+0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x41, 0x74, 0x79, 0x72, 0x61, 0x75, 0x0, 0x49, 0x6e, 0x64,
+0x69, 0x61, 0x6e, 0x2f, 0x4d, 0x61, 0x6c, 0x64, 0x69, 0x76, 0x65, 0x73, 0x0, 0x41, 0x73, 0x69,
+0x61, 0x2f, 0x44, 0x75, 0x73, 0x68, 0x61, 0x6e, 0x62, 0x65, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f,
+0x41, 0x73, 0x68, 0x67, 0x61, 0x62, 0x61, 0x74, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x54, 0x61,
+0x73, 0x68, 0x6b, 0x65, 0x6e, 0x74, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x53, 0x61, 0x6d, 0x61,
+0x72, 0x6b, 0x61, 0x6e, 0x64, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x48, 0x65, 0x62, 0x72, 0x6f,
+0x6e, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x47, 0x61, 0x7a, 0x61, 0x0, 0x45, 0x74, 0x63, 0x2f,
+0x47, 0x4d, 0x54, 0x2d, 0x31, 0x30, 0x0, 0x41, 0x6e, 0x74, 0x61, 0x72, 0x63, 0x74, 0x69, 0x63,
+0x61, 0x2f, 0x44, 0x75, 0x6d, 0x6f, 0x6e, 0x74, 0x44, 0x55, 0x72, 0x76, 0x69, 0x6c, 0x6c, 0x65,
+0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x47, 0x75, 0x61, 0x6d, 0x0, 0x50, 0x61,
+0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x54, 0x72, 0x75, 0x6b, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66,
+0x69, 0x63, 0x2f, 0x53, 0x61, 0x69, 0x70, 0x61, 0x6e, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69,
+0x63, 0x2f, 0x50, 0x6f, 0x72, 0x74, 0x5f, 0x4d, 0x6f, 0x72, 0x65, 0x73, 0x62, 0x79, 0x0, 0x41,
+0x73, 0x69, 0x61, 0x2f, 0x59, 0x61, 0x6b, 0x75, 0x74, 0x73, 0x6b, 0x20, 0x41, 0x73, 0x69, 0x61,
+0x2f, 0x4b, 0x68, 0x61, 0x6e, 0x64, 0x79, 0x67, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x57, 0x68, 0x69, 0x74, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x41, 0x6d, 0x65,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x61, 0x77, 0x73, 0x6f, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72,
+0x69, 0x63, 0x61, 0x2f, 0x41, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x0, 0x41, 0x6d,
+0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x75, 0x65, 0x6e, 0x6f, 0x73, 0x5f, 0x41, 0x69, 0x72,
+0x65, 0x73, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x41, 0x73, 0x74, 0x72, 0x61, 0x6b,
+0x68, 0x61, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x48, 0x61, 0x6c, 0x69,
+0x66, 0x61, 0x78, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x53, 0x79,
+0x64, 0x6e, 0x65, 0x79, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x52, 0x65, 0x67,
+0x69, 0x6e, 0x61, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x41, 0x64,
+0x65, 0x6c, 0x61, 0x69, 0x64, 0x65, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x41, 0x6c, 0x6d, 0x61,
+0x74, 0x79, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x75, 0x69, 0x61, 0x62,
+0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x68, 0x69, 0x63, 0x61, 0x67,
+0x6f, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x65, 0x78, 0x69, 0x63, 0x6f,
+0x5f, 0x43, 0x69, 0x74, 0x79, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f,
+0x42, 0x72, 0x69, 0x73, 0x62, 0x61, 0x6e, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
+0x2f, 0x4e, 0x65, 0x77, 0x5f, 0x59, 0x6f, 0x72, 0x6b, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65,
+0x2f, 0x4b, 0x69, 0x65, 0x76, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x65,
+0x6e, 0x76, 0x65, 0x72, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x72, 0x61, 0x73, 0x6e, 0x6f,
+0x79, 0x61, 0x72, 0x73, 0x6b, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54, 0x69,
+0x6a, 0x75, 0x61, 0x6e, 0x61, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x61, 0x6d, 0x63, 0x68,
+0x61, 0x74, 0x6b, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4d, 0x6f, 0x73, 0x63,
+0x6f, 0x77, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x48, 0x6f, 0x62,
+0x61, 0x72, 0x74, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x55, 0x6c, 0x61, 0x61, 0x6e, 0x62, 0x61,
+0x61, 0x74, 0x61, 0x72, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x49, 0x6e, 0x64,
+0x69, 0x61, 0x6e, 0x61, 0x70, 0x6f, 0x6c, 0x69, 0x73, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x55, 0x54,
+0x43, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x56, 0x6c, 0x61, 0x64, 0x69, 0x76, 0x6f, 0x73, 0x74,
+0x6f, 0x6b, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x42, 0x65, 0x72, 0x6c, 0x69, 0x6e,
+0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x54, 0x61, 0x73, 0x68, 0x6b, 0x65, 0x6e, 0x74, 0x0, 0x41,
+0x73, 0x69, 0x61, 0x2f, 0x48, 0x65, 0x62, 0x72, 0x6f, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f,
+0x59, 0x61, 0x6b, 0x75, 0x74, 0x73, 0x6b, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
+0x57, 0x68, 0x69, 0x74, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x31,
+0x34, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x31, 0x33, 0x3a, 0x30, 0x30, 0x0, 0x55,
+0x54, 0x43, 0x2d, 0x31, 0x32, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x31, 0x31, 0x3a,
+0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x31, 0x30, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43,
+0x2d, 0x30, 0x39, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x38, 0x3a, 0x30, 0x30,
+0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30,
+0x36, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x35, 0x3a, 0x30, 0x30, 0x0, 0x55,
+0x54, 0x43, 0x2d, 0x30, 0x34, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x34, 0x3a,
+0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x33, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43,
+0x2d, 0x30, 0x33, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x32, 0x3a, 0x30, 0x30,
+0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x31, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x20, 0x55,
+0x54, 0x43, 0x2b, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x20, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x30, 0x3a,
+0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x31, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43,
+0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x33, 0x3a, 0x30, 0x30,
+0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x33, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30,
+0x34, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x34, 0x3a, 0x33, 0x30, 0x0, 0x55,
+0x54, 0x43, 0x2b, 0x30, 0x35, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x35, 0x3a,
+0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x35, 0x3a, 0x34, 0x35, 0x0, 0x55, 0x54, 0x43,
+0x2b, 0x30, 0x36, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x36, 0x3a, 0x33, 0x30,
+0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30,
+0x38, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x38, 0x3a, 0x33, 0x30, 0x0, 0x55,
+0x54, 0x43, 0x2b, 0x30, 0x39, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x39, 0x3a,
+0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x30, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43,
+0x2b, 0x31, 0x31, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x32, 0x3a, 0x30, 0x30,
+0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x33, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31,
+0x34, 0x3a, 0x30, 0x30, 0x0
+};
+
+static constexpr char aliasIdData[] = {
+0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x73, 0x6d, 0x61, 0x72, 0x61, 0x0, 0x41, 0x66,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x73, 0x6d, 0x65, 0x72, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x54, 0x69, 0x6d, 0x62, 0x75, 0x6b, 0x74, 0x75, 0x0, 0x41, 0x66, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x42, 0x61, 0x6d, 0x61, 0x6b, 0x6f, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x41, 0x72, 0x67, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x61, 0x2f, 0x42, 0x75, 0x65, 0x6e,
+0x6f, 0x73, 0x5f, 0x41, 0x69, 0x72, 0x65, 0x73, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
+0x2f, 0x42, 0x75, 0x65, 0x6e, 0x6f, 0x73, 0x5f, 0x41, 0x69, 0x72, 0x65, 0x73, 0x0, 0x41, 0x6d,
+0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x72, 0x67, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x61, 0x2f,
+0x43, 0x61, 0x74, 0x61, 0x6d, 0x61, 0x72, 0x63, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x43, 0x61, 0x74, 0x61, 0x6d, 0x61, 0x72, 0x63, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72,
+0x69, 0x63, 0x61, 0x2f, 0x41, 0x72, 0x67, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x61, 0x2f, 0x43, 0x6f,
+0x6d, 0x6f, 0x64, 0x52, 0x69, 0x76, 0x61, 0x64, 0x61, 0x76, 0x69, 0x61, 0x0, 0x41, 0x6d, 0x65,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x72, 0x67, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x61, 0x2f, 0x43,
+0x6f, 0x72, 0x64, 0x6f, 0x62, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43,
+0x6f, 0x72, 0x64, 0x6f, 0x62, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41,
+0x72, 0x67, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x61, 0x2f, 0x4a, 0x75, 0x6a, 0x75, 0x79, 0x0, 0x41,
+0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4a, 0x75, 0x6a, 0x75, 0x79, 0x0, 0x41, 0x6d, 0x65,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x72, 0x67, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x61, 0x2f, 0x4d,
+0x65, 0x6e, 0x64, 0x6f, 0x7a, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d,
+0x65, 0x6e, 0x64, 0x6f, 0x7a, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41,
+0x74, 0x69, 0x6b, 0x6f, 0x6b, 0x61, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
+0x43, 0x6f, 0x72, 0x61, 0x6c, 0x5f, 0x48, 0x61, 0x72, 0x62, 0x6f, 0x75, 0x72, 0x0, 0x41, 0x6d,
+0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x74, 0x6b, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x41, 0x64, 0x61, 0x6b, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f,
+0x45, 0x6e, 0x73, 0x65, 0x6e, 0x61, 0x64, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
+0x2f, 0x54, 0x69, 0x6a, 0x75, 0x61, 0x6e, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
+0x2f, 0x46, 0x6f, 0x72, 0x74, 0x5f, 0x57, 0x61, 0x79, 0x6e, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72,
0x69, 0x63, 0x61, 0x2f, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61, 0x70, 0x6f, 0x6c, 0x69, 0x73,
-0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61,
-0x2f, 0x4d, 0x61, 0x72, 0x65, 0x6e, 0x67, 0x6f, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
-0x2f, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61, 0x2f, 0x56, 0x65, 0x76, 0x61, 0x79, 0x0, 0x45,
-0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x37, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
-0x2f, 0x43, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x6e, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
-0x2f, 0x44, 0x61, 0x77, 0x73, 0x6f, 0x6e, 0x5f, 0x43, 0x72, 0x65, 0x65, 0x6b, 0x20, 0x41, 0x6d,
-0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x46, 0x6f, 0x72, 0x74, 0x5f, 0x4e, 0x65, 0x6c, 0x73, 0x6f,
-0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x48, 0x65, 0x72, 0x6d, 0x6f, 0x73,
-0x69, 0x6c, 0x6c, 0x6f, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x68, 0x6f,
-0x65, 0x6e, 0x69, 0x78, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x55, 0x54, 0x43, 0x20, 0x45, 0x74, 0x63,
-0x2f, 0x47, 0x4d, 0x54, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x31, 0x32, 0x0,
-0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x54, 0x61, 0x72, 0x61, 0x77, 0x61, 0x0, 0x50,
-0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x4d, 0x61, 0x6a, 0x75, 0x72, 0x6f, 0x20, 0x50, 0x61,
-0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x4b, 0x77, 0x61, 0x6a, 0x61, 0x6c, 0x65, 0x69, 0x6e, 0x0,
-0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x4e, 0x61, 0x75, 0x72, 0x75, 0x0, 0x50, 0x61,
-0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x46, 0x75, 0x6e, 0x61, 0x66, 0x75, 0x74, 0x69, 0x0, 0x50,
-0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x57, 0x61, 0x6b, 0x65, 0x0, 0x50, 0x61, 0x63, 0x69,
-0x66, 0x69, 0x63, 0x2f, 0x57, 0x61, 0x6c, 0x6c, 0x69, 0x73, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47,
-0x4d, 0x54, 0x2d, 0x31, 0x33, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x45, 0x6e,
-0x64, 0x65, 0x72, 0x62, 0x75, 0x72, 0x79, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f,
-0x46, 0x61, 0x6b, 0x61, 0x6f, 0x66, 0x6f, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b,
-0x32, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4e, 0x6f, 0x72, 0x6f, 0x6e, 0x68,
-0x61, 0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x53, 0x6f, 0x75, 0x74, 0x68,
-0x5f, 0x47, 0x65, 0x6f, 0x72, 0x67, 0x69, 0x61, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54,
-0x2b, 0x38, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x50, 0x69, 0x74, 0x63, 0x61,
-0x69, 0x72, 0x6e, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x39, 0x0, 0x50, 0x61,
-0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x47, 0x61, 0x6d, 0x62, 0x69, 0x65, 0x72, 0x0, 0x45, 0x74,
-0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x31, 0x31, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63,
-0x2f, 0x50, 0x61, 0x67, 0x6f, 0x5f, 0x50, 0x61, 0x67, 0x6f, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66,
-0x69, 0x63, 0x2f, 0x4e, 0x69, 0x75, 0x65, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f,
-0x4d, 0x69, 0x64, 0x77, 0x61, 0x79, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43,
-0x61, 0x72, 0x61, 0x63, 0x61, 0x73, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x56, 0x6c, 0x61, 0x64,
-0x69, 0x76, 0x6f, 0x73, 0x74, 0x6f, 0x6b, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x55, 0x73, 0x74,
-0x2d, 0x4e, 0x65, 0x72, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x56, 0x6f, 0x6c,
-0x67, 0x6f, 0x67, 0x72, 0x61, 0x64, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61,
-0x2f, 0x50, 0x65, 0x72, 0x74, 0x68, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x31,
-0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x6c, 0x67, 0x69, 0x65, 0x72, 0x73, 0x0,
-0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4c, 0x75, 0x61, 0x6e, 0x64, 0x61, 0x0, 0x41, 0x66,
-0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x6f, 0x72, 0x74, 0x6f, 0x2d, 0x4e, 0x6f, 0x76, 0x6f, 0x0,
-0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x6f, 0x75, 0x61, 0x6c, 0x61, 0x0, 0x41, 0x66,
-0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x61, 0x6e, 0x67, 0x75, 0x69, 0x0, 0x41, 0x66, 0x72, 0x69,
-0x63, 0x61, 0x2f, 0x4e, 0x64, 0x6a, 0x61, 0x6d, 0x65, 0x6e, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69,
-0x63, 0x61, 0x2f, 0x42, 0x72, 0x61, 0x7a, 0x7a, 0x61, 0x76, 0x69, 0x6c, 0x6c, 0x65, 0x0, 0x41,
-0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4b, 0x69, 0x6e, 0x73, 0x68, 0x61, 0x73, 0x61, 0x0, 0x41,
-0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x6c, 0x61, 0x62, 0x6f, 0x0, 0x41, 0x66, 0x72,
-0x69, 0x63, 0x61, 0x2f, 0x4c, 0x69, 0x62, 0x72, 0x65, 0x76, 0x69, 0x6c, 0x6c, 0x65, 0x0, 0x41,
-0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4c, 0x61, 0x67, 0x6f, 0x73, 0x0, 0x41, 0x66, 0x72, 0x69,
-0x63, 0x61, 0x2f, 0x4e, 0x69, 0x61, 0x6d, 0x65, 0x79, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61,
-0x2f, 0x54, 0x75, 0x6e, 0x69, 0x73, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x41, 0x6e,
-0x64, 0x6f, 0x72, 0x72, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x56, 0x69, 0x65,
-0x6e, 0x6e, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x42, 0x65, 0x72, 0x6c, 0x69,
-0x6e, 0x20, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x42, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x65,
-0x6e, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x47, 0x69, 0x62, 0x72, 0x61, 0x6c, 0x74,
-0x61, 0x72, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x52, 0x6f, 0x6d, 0x65, 0x0, 0x45,
-0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x56, 0x61, 0x64, 0x75, 0x7a, 0x0, 0x45, 0x75, 0x72, 0x6f,
-0x70, 0x65, 0x2f, 0x4c, 0x75, 0x78, 0x65, 0x6d, 0x62, 0x6f, 0x75, 0x72, 0x67, 0x0, 0x45, 0x75,
-0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4d, 0x61, 0x6c, 0x74, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70,
-0x65, 0x2f, 0x4d, 0x6f, 0x6e, 0x61, 0x63, 0x6f, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f,
-0x41, 0x6d, 0x73, 0x74, 0x65, 0x72, 0x64, 0x61, 0x6d, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65,
-0x2f, 0x4f, 0x73, 0x6c, 0x6f, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x53, 0x61, 0x6e,
-0x5f, 0x4d, 0x61, 0x72, 0x69, 0x6e, 0x6f, 0x0, 0x41, 0x72, 0x63, 0x74, 0x69, 0x63, 0x2f, 0x4c,
-0x6f, 0x6e, 0x67, 0x79, 0x65, 0x61, 0x72, 0x62, 0x79, 0x65, 0x6e, 0x0, 0x45, 0x75, 0x72, 0x6f,
-0x70, 0x65, 0x2f, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x68, 0x6f, 0x6c, 0x6d, 0x0, 0x45, 0x75, 0x72,
-0x6f, 0x70, 0x65, 0x2f, 0x5a, 0x75, 0x72, 0x69, 0x63, 0x68, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70,
-0x65, 0x2f, 0x56, 0x61, 0x74, 0x69, 0x63, 0x61, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x48,
-0x6f, 0x76, 0x64, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x35, 0x0, 0x41, 0x6e,
-0x74, 0x61, 0x72, 0x63, 0x74, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x77, 0x73, 0x6f, 0x6e, 0x0,
-0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x2f, 0x4b, 0x65, 0x72, 0x67, 0x75, 0x65, 0x6c, 0x65, 0x6e,
-0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4f, 0x72, 0x61, 0x6c, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f,
-0x41, 0x71, 0x74, 0x61, 0x75, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x41, 0x71, 0x74, 0x6f, 0x62,
-0x65, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x41, 0x74, 0x79, 0x72, 0x61, 0x75, 0x0, 0x49, 0x6e,
-0x64, 0x69, 0x61, 0x6e, 0x2f, 0x4d, 0x61, 0x6c, 0x64, 0x69, 0x76, 0x65, 0x73, 0x0, 0x41, 0x73,
-0x69, 0x61, 0x2f, 0x44, 0x75, 0x73, 0x68, 0x61, 0x6e, 0x62, 0x65, 0x0, 0x41, 0x73, 0x69, 0x61,
-0x2f, 0x41, 0x73, 0x68, 0x67, 0x61, 0x62, 0x61, 0x74, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x54,
-0x61, 0x73, 0x68, 0x6b, 0x65, 0x6e, 0x74, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x53, 0x61, 0x6d,
-0x61, 0x72, 0x6b, 0x61, 0x6e, 0x64, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x48, 0x65, 0x62, 0x72,
-0x6f, 0x6e, 0x20, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x47, 0x61, 0x7a, 0x61, 0x0, 0x45, 0x74, 0x63,
-0x2f, 0x47, 0x4d, 0x54, 0x2d, 0x31, 0x30, 0x0, 0x41, 0x6e, 0x74, 0x61, 0x72, 0x63, 0x74, 0x69,
-0x63, 0x61, 0x2f, 0x44, 0x75, 0x6d, 0x6f, 0x6e, 0x74, 0x44, 0x55, 0x72, 0x76, 0x69, 0x6c, 0x6c,
-0x65, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x47, 0x75, 0x61, 0x6d, 0x0, 0x50,
-0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x54, 0x72, 0x75, 0x6b, 0x0, 0x50, 0x61, 0x63, 0x69,
-0x66, 0x69, 0x63, 0x2f, 0x53, 0x61, 0x69, 0x70, 0x61, 0x6e, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66,
-0x69, 0x63, 0x2f, 0x50, 0x6f, 0x72, 0x74, 0x5f, 0x4d, 0x6f, 0x72, 0x65, 0x73, 0x62, 0x79, 0x0,
-0x41, 0x73, 0x69, 0x61, 0x2f, 0x59, 0x61, 0x6b, 0x75, 0x74, 0x73, 0x6b, 0x20, 0x41, 0x73, 0x69,
-0x61, 0x2f, 0x4b, 0x68, 0x61, 0x6e, 0x64, 0x79, 0x67, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
-0x63, 0x61, 0x2f, 0x57, 0x68, 0x69, 0x74, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x41, 0x6d,
-0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x61, 0x77, 0x73, 0x6f, 0x6e, 0x0, 0x41, 0x6d, 0x65,
-0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x0, 0x41,
-0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x42, 0x75, 0x65, 0x6e, 0x6f, 0x73, 0x5f, 0x41, 0x69,
-0x72, 0x65, 0x73, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x41, 0x73, 0x74, 0x72, 0x61,
-0x6b, 0x68, 0x61, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x48, 0x61, 0x6c,
-0x69, 0x66, 0x61, 0x78, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x53,
-0x79, 0x64, 0x6e, 0x65, 0x79, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x52, 0x65,
-0x67, 0x69, 0x6e, 0x61, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x41,
-0x64, 0x65, 0x6c, 0x61, 0x69, 0x64, 0x65, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x41, 0x6c, 0x6d,
-0x61, 0x74, 0x79, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x75, 0x69, 0x61,
-0x62, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x68, 0x69, 0x63, 0x61,
-0x67, 0x6f, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x65, 0x78, 0x69, 0x63,
-0x6f, 0x5f, 0x43, 0x69, 0x74, 0x79, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61,
-0x2f, 0x42, 0x72, 0x69, 0x73, 0x62, 0x61, 0x6e, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
-0x61, 0x2f, 0x4e, 0x65, 0x77, 0x5f, 0x59, 0x6f, 0x72, 0x6b, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70,
-0x65, 0x2f, 0x4b, 0x69, 0x65, 0x76, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x44,
-0x65, 0x6e, 0x76, 0x65, 0x72, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x72, 0x61, 0x73, 0x6e,
-0x6f, 0x79, 0x61, 0x72, 0x73, 0x6b, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54,
-0x69, 0x6a, 0x75, 0x61, 0x6e, 0x61, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x61, 0x6d, 0x63,
-0x68, 0x61, 0x74, 0x6b, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4d, 0x6f, 0x73,
-0x63, 0x6f, 0x77, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x48, 0x6f,
-0x62, 0x61, 0x72, 0x74, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x55, 0x6c, 0x61, 0x61, 0x6e, 0x62,
-0x61, 0x61, 0x74, 0x61, 0x72, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x49, 0x6e,
-0x64, 0x69, 0x61, 0x6e, 0x61, 0x70, 0x6f, 0x6c, 0x69, 0x73, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x55,
-0x54, 0x43, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x56, 0x6c, 0x61, 0x64, 0x69, 0x76, 0x6f, 0x73,
-0x74, 0x6f, 0x6b, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x42, 0x65, 0x72, 0x6c, 0x69,
-0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x54, 0x61, 0x73, 0x68, 0x6b, 0x65, 0x6e, 0x74, 0x0,
-0x41, 0x73, 0x69, 0x61, 0x2f, 0x48, 0x65, 0x62, 0x72, 0x6f, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61,
-0x2f, 0x59, 0x61, 0x6b, 0x75, 0x74, 0x73, 0x6b, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61,
-0x2f, 0x57, 0x68, 0x69, 0x74, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x0, 0x55, 0x54, 0x43, 0x2d,
-0x31, 0x34, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x31, 0x33, 0x3a, 0x30, 0x30, 0x0,
-0x55, 0x54, 0x43, 0x2d, 0x31, 0x32, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x31, 0x31,
-0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x31, 0x30, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54,
-0x43, 0x2d, 0x30, 0x39, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x38, 0x3a, 0x30,
-0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d,
-0x30, 0x36, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x35, 0x3a, 0x30, 0x30, 0x0,
-0x55, 0x54, 0x43, 0x2d, 0x30, 0x34, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x34,
-0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x33, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54,
-0x43, 0x2d, 0x30, 0x33, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x32, 0x3a, 0x30,
-0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x31, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x20,
-0x55, 0x54, 0x43, 0x2b, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x20, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x30,
-0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x31, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54,
-0x43, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x33, 0x3a, 0x30,
-0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x33, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b,
-0x30, 0x34, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x34, 0x3a, 0x33, 0x30, 0x0,
-0x55, 0x54, 0x43, 0x2b, 0x30, 0x35, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x35,
-0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x35, 0x3a, 0x34, 0x35, 0x0, 0x55, 0x54,
-0x43, 0x2b, 0x30, 0x36, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x36, 0x3a, 0x33,
-0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b,
-0x30, 0x38, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x38, 0x3a, 0x33, 0x30, 0x0,
-0x55, 0x54, 0x43, 0x2b, 0x30, 0x39, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x39,
-0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x30, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54,
-0x43, 0x2b, 0x31, 0x31, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x32, 0x3a, 0x30,
-0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x33, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b,
-0x31, 0x34, 0x3a, 0x30, 0x30, 0x0
+0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61,
+0x2f, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61, 0x70, 0x6f, 0x6c, 0x69, 0x73, 0x0, 0x41, 0x6d,
+0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4b, 0x65, 0x6e, 0x74, 0x75, 0x63, 0x6b, 0x79, 0x2f, 0x4c,
+0x6f, 0x75, 0x69, 0x73, 0x76, 0x69, 0x6c, 0x6c, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x4c, 0x6f, 0x75, 0x69, 0x73, 0x76, 0x69, 0x6c, 0x6c, 0x65, 0x0, 0x41, 0x6d, 0x65,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x4b, 0x6e, 0x6f, 0x78, 0x5f, 0x49, 0x4e, 0x0, 0x41, 0x6d, 0x65,
+0x72, 0x69, 0x63, 0x61, 0x2f, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61, 0x2f, 0x4b, 0x6e, 0x6f,
+0x78, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x6f, 0x6e, 0x74, 0x72, 0x65,
+0x61, 0x6c, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54, 0x6f, 0x72, 0x6f, 0x6e,
+0x74, 0x6f, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4e, 0x75, 0x75, 0x6b, 0x0,
+0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x47, 0x6f, 0x64, 0x74, 0x68, 0x61, 0x62, 0x0,
+0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x6f, 0x72, 0x74, 0x6f, 0x5f, 0x41, 0x63,
+0x72, 0x65, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x52, 0x69, 0x6f, 0x5f, 0x42,
+0x72, 0x61, 0x6e, 0x63, 0x6f, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x52, 0x6f,
+0x73, 0x61, 0x72, 0x69, 0x6f, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x68,
+0x69, 0x70, 0x72, 0x6f, 0x63, 0x6b, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x44,
+0x65, 0x6e, 0x76, 0x65, 0x72, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x56, 0x69,
+0x72, 0x67, 0x69, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x74, 0x5f,
+0x54, 0x68, 0x6f, 0x6d, 0x61, 0x73, 0x0, 0x41, 0x6e, 0x74, 0x61, 0x72, 0x63, 0x74, 0x69, 0x63,
+0x61, 0x2f, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x5f, 0x50, 0x6f, 0x6c, 0x65, 0x0, 0x50, 0x61, 0x63,
+0x69, 0x66, 0x69, 0x63, 0x2f, 0x41, 0x75, 0x63, 0x6b, 0x6c, 0x61, 0x6e, 0x64, 0x0, 0x41, 0x73,
+0x69, 0x61, 0x2f, 0x41, 0x73, 0x68, 0x6b, 0x68, 0x61, 0x62, 0x61, 0x64, 0x0, 0x41, 0x73, 0x69,
+0x61, 0x2f, 0x41, 0x73, 0x68, 0x67, 0x61, 0x62, 0x61, 0x74, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f,
+0x43, 0x68, 0x6f, 0x6e, 0x67, 0x71, 0x69, 0x6e, 0x67, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x53,
+0x68, 0x61, 0x6e, 0x67, 0x68, 0x61, 0x69, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x43, 0x68, 0x75,
+0x6e, 0x67, 0x6b, 0x69, 0x6e, 0x67, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x44, 0x61, 0x63, 0x63,
+0x61, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x44, 0x68, 0x61, 0x6b, 0x61, 0x0, 0x41, 0x73, 0x69,
+0x61, 0x2f, 0x48, 0x61, 0x72, 0x62, 0x69, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x48, 0x6f,
+0x5f, 0x43, 0x68, 0x69, 0x5f, 0x4d, 0x69, 0x6e, 0x68, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x53,
+0x61, 0x69, 0x67, 0x6f, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x49, 0x73, 0x74, 0x61, 0x6e,
+0x62, 0x75, 0x6c, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x49, 0x73, 0x74, 0x61, 0x6e,
+0x62, 0x75, 0x6c, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x61, 0x73, 0x68, 0x67, 0x61, 0x72,
+0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x55, 0x72, 0x75, 0x6d, 0x71, 0x69, 0x0, 0x41, 0x73, 0x69,
+0x61, 0x2f, 0x4b, 0x61, 0x74, 0x68, 0x6d, 0x61, 0x6e, 0x64, 0x75, 0x0, 0x41, 0x73, 0x69, 0x61,
+0x2f, 0x4b, 0x61, 0x74, 0x6d, 0x61, 0x6e, 0x64, 0x75, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b,
+0x6f, 0x6c, 0x6b, 0x61, 0x74, 0x61, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x43, 0x61, 0x6c, 0x63,
+0x75, 0x74, 0x74, 0x61, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4d, 0x61, 0x63, 0x61, 0x6f, 0x0,
+0x41, 0x73, 0x69, 0x61, 0x2f, 0x4d, 0x61, 0x63, 0x61, 0x75, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f,
+0x54, 0x65, 0x6c, 0x5f, 0x41, 0x76, 0x69, 0x76, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4a, 0x65,
+0x72, 0x75, 0x73, 0x61, 0x6c, 0x65, 0x6d, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x54, 0x68, 0x69,
+0x6d, 0x62, 0x75, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x54, 0x68, 0x69, 0x6d, 0x70, 0x68, 0x75,
+0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x55, 0x6a, 0x75, 0x6e, 0x67, 0x5f, 0x50, 0x61, 0x6e, 0x64,
+0x61, 0x6e, 0x67, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4d, 0x61, 0x6b, 0x61, 0x73, 0x73, 0x61,
+0x72, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x55, 0x6c, 0x61, 0x6e, 0x5f, 0x42, 0x61, 0x74, 0x6f,
+0x72, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x55, 0x6c, 0x61, 0x61, 0x6e, 0x62, 0x61, 0x61, 0x74,
+0x61, 0x72, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x59, 0x61, 0x6e, 0x67, 0x6f, 0x6e, 0x0, 0x41,
+0x73, 0x69, 0x61, 0x2f, 0x52, 0x61, 0x6e, 0x67, 0x6f, 0x6f, 0x6e, 0x0, 0x41, 0x74, 0x6c, 0x61,
+0x6e, 0x74, 0x69, 0x63, 0x2f, 0x46, 0x61, 0x72, 0x6f, 0x65, 0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e,
+0x74, 0x69, 0x63, 0x2f, 0x46, 0x61, 0x65, 0x72, 0x6f, 0x65, 0x0, 0x41, 0x74, 0x6c, 0x61, 0x6e,
+0x74, 0x69, 0x63, 0x2f, 0x4a, 0x61, 0x6e, 0x5f, 0x4d, 0x61, 0x79, 0x65, 0x6e, 0x0, 0x41, 0x72,
+0x63, 0x74, 0x69, 0x63, 0x2f, 0x4c, 0x6f, 0x6e, 0x67, 0x79, 0x65, 0x61, 0x72, 0x62, 0x79, 0x65,
+0x6e, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x41, 0x43, 0x54, 0x0,
+0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x53, 0x79, 0x64, 0x6e, 0x65, 0x79,
+0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x43, 0x61, 0x6e, 0x62, 0x65,
+0x72, 0x72, 0x61, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x4c, 0x48,
+0x49, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x4c, 0x6f, 0x72, 0x64,
+0x5f, 0x48, 0x6f, 0x77, 0x65, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f,
+0x4e, 0x53, 0x57, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x4e, 0x6f,
+0x72, 0x74, 0x68, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x44, 0x61,
+0x72, 0x77, 0x69, 0x6e, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x51,
+0x75, 0x65, 0x65, 0x6e, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61,
+0x6c, 0x69, 0x61, 0x2f, 0x42, 0x72, 0x69, 0x73, 0x62, 0x61, 0x6e, 0x65, 0x0, 0x41, 0x75, 0x73,
+0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x0, 0x41, 0x75, 0x73,
+0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x41, 0x64, 0x65, 0x6c, 0x61, 0x69, 0x64, 0x65, 0x0,
+0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x54, 0x61, 0x73, 0x6d, 0x61, 0x6e,
+0x69, 0x61, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x48, 0x6f, 0x62,
+0x61, 0x72, 0x74, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x56, 0x69,
+0x63, 0x74, 0x6f, 0x72, 0x69, 0x61, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61,
+0x2f, 0x4d, 0x65, 0x6c, 0x62, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72,
+0x61, 0x6c, 0x69, 0x61, 0x2f, 0x57, 0x65, 0x73, 0x74, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61,
+0x6c, 0x69, 0x61, 0x2f, 0x50, 0x65, 0x72, 0x74, 0x68, 0x0, 0x41, 0x75, 0x73, 0x74, 0x72, 0x61,
+0x6c, 0x69, 0x61, 0x2f, 0x59, 0x61, 0x6e, 0x63, 0x6f, 0x77, 0x69, 0x6e, 0x6e, 0x61, 0x0, 0x41,
+0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x61, 0x2f, 0x42, 0x72, 0x6f, 0x6b, 0x65, 0x6e, 0x5f,
+0x48, 0x69, 0x6c, 0x6c, 0x0, 0x42, 0x72, 0x61, 0x7a, 0x69, 0x6c, 0x2f, 0x41, 0x63, 0x72, 0x65,
+0x0, 0x42, 0x72, 0x61, 0x7a, 0x69, 0x6c, 0x2f, 0x44, 0x65, 0x4e, 0x6f, 0x72, 0x6f, 0x6e, 0x68,
+0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4e, 0x6f, 0x72, 0x6f, 0x6e, 0x68,
+0x61, 0x0, 0x42, 0x72, 0x61, 0x7a, 0x69, 0x6c, 0x2f, 0x45, 0x61, 0x73, 0x74, 0x0, 0x41, 0x6d,
+0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x61, 0x6f, 0x5f, 0x50, 0x61, 0x75, 0x6c, 0x6f, 0x0,
+0x42, 0x72, 0x61, 0x7a, 0x69, 0x6c, 0x2f, 0x57, 0x65, 0x73, 0x74, 0x0, 0x41, 0x6d, 0x65, 0x72,
+0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x6e, 0x61, 0x75, 0x73, 0x0, 0x43, 0x61, 0x6e, 0x61, 0x64,
+0x61, 0x2f, 0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x48, 0x61, 0x6c, 0x69, 0x66, 0x61, 0x78, 0x0, 0x43, 0x61, 0x6e, 0x61, 0x64,
+0x61, 0x2f, 0x43, 0x65, 0x6e, 0x74, 0x72, 0x61, 0x6c, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x57, 0x69, 0x6e, 0x6e, 0x69, 0x70, 0x65, 0x67, 0x0, 0x43, 0x61, 0x6e, 0x61, 0x64,
+0x61, 0x2f, 0x45, 0x61, 0x73, 0x74, 0x2d, 0x53, 0x61, 0x73, 0x6b, 0x61, 0x74, 0x63, 0x68, 0x65,
+0x77, 0x61, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x52, 0x65, 0x67, 0x69,
+0x6e, 0x61, 0x0, 0x43, 0x61, 0x6e, 0x61, 0x64, 0x61, 0x2f, 0x45, 0x61, 0x73, 0x74, 0x65, 0x72,
+0x6e, 0x0, 0x43, 0x61, 0x6e, 0x61, 0x64, 0x61, 0x2f, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x61, 0x69,
+0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x45, 0x64, 0x6d, 0x6f, 0x6e, 0x74,
+0x6f, 0x6e, 0x0, 0x43, 0x61, 0x6e, 0x61, 0x64, 0x61, 0x2f, 0x4e, 0x65, 0x77, 0x66, 0x6f, 0x75,
+0x6e, 0x64, 0x6c, 0x61, 0x6e, 0x64, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53,
+0x74, 0x5f, 0x4a, 0x6f, 0x68, 0x6e, 0x73, 0x0, 0x43, 0x61, 0x6e, 0x61, 0x64, 0x61, 0x2f, 0x50,
+0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x56,
+0x61, 0x6e, 0x63, 0x6f, 0x75, 0x76, 0x65, 0x72, 0x0, 0x43, 0x61, 0x6e, 0x61, 0x64, 0x61, 0x2f,
+0x53, 0x61, 0x73, 0x6b, 0x61, 0x74, 0x63, 0x68, 0x65, 0x77, 0x61, 0x6e, 0x0, 0x43, 0x61, 0x6e,
+0x61, 0x64, 0x61, 0x2f, 0x59, 0x75, 0x6b, 0x6f, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x57, 0x68, 0x69, 0x74, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x0, 0x43, 0x68, 0x69,
+0x6c, 0x65, 0x2f, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x0, 0x41,
+0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x53, 0x61, 0x6e, 0x74, 0x69, 0x61, 0x67, 0x6f, 0x0,
+0x43, 0x68, 0x69, 0x6c, 0x65, 0x2f, 0x45, 0x61, 0x73, 0x74, 0x65, 0x72, 0x49, 0x73, 0x6c, 0x61,
+0x6e, 0x64, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x45, 0x61, 0x73, 0x74, 0x65,
+0x72, 0x0, 0x43, 0x75, 0x62, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x48,
+0x61, 0x76, 0x61, 0x6e, 0x61, 0x0, 0x45, 0x53, 0x54, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d,
+0x54, 0x2b, 0x35, 0x0, 0x45, 0x67, 0x79, 0x70, 0x74, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61,
+0x2f, 0x43, 0x61, 0x69, 0x72, 0x6f, 0x0, 0x45, 0x69, 0x72, 0x65, 0x0, 0x45, 0x75, 0x72, 0x6f,
+0x70, 0x65, 0x2f, 0x44, 0x75, 0x62, 0x6c, 0x69, 0x6e, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d,
+0x54, 0x2b, 0x30, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x0, 0x45, 0x74, 0x63, 0x2f,
+0x47, 0x4d, 0x54, 0x2d, 0x30, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x30, 0x0, 0x45,
+0x74, 0x63, 0x2f, 0x47, 0x72, 0x65, 0x65, 0x6e, 0x77, 0x69, 0x63, 0x68, 0x0, 0x45, 0x74, 0x63,
+0x2f, 0x55, 0x43, 0x54, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x55, 0x54, 0x43, 0x0, 0x45, 0x74, 0x63,
+0x2f, 0x55, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x61, 0x6c, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x5a,
+0x75, 0x6c, 0x75, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x42, 0x65, 0x6c, 0x66, 0x61,
+0x73, 0x74, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4c, 0x6f, 0x6e, 0x64, 0x6f, 0x6e,
+0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4b, 0x79, 0x69, 0x76, 0x0, 0x45, 0x75, 0x72,
+0x6f, 0x70, 0x65, 0x2f, 0x4b, 0x69, 0x65, 0x76, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f,
+0x4e, 0x69, 0x63, 0x6f, 0x73, 0x69, 0x61, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4e, 0x69, 0x63,
+0x6f, 0x73, 0x69, 0x61, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x54, 0x69, 0x72, 0x61,
+0x73, 0x70, 0x6f, 0x6c, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x43, 0x68, 0x69, 0x73,
+0x69, 0x6e, 0x61, 0x75, 0x0, 0x47, 0x42, 0x0, 0x47, 0x42, 0x2d, 0x45, 0x69, 0x72, 0x65, 0x0,
+0x47, 0x4d, 0x54, 0x0, 0x47, 0x4d, 0x54, 0x2b, 0x30, 0x0, 0x47, 0x4d, 0x54, 0x2d, 0x30, 0x0,
+0x47, 0x4d, 0x54, 0x30, 0x0, 0x47, 0x72, 0x65, 0x65, 0x6e, 0x77, 0x69, 0x63, 0x68, 0x0, 0x48,
+0x53, 0x54, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x31, 0x30, 0x0, 0x48, 0x6f,
+0x6e, 0x67, 0x6b, 0x6f, 0x6e, 0x67, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x48, 0x6f, 0x6e, 0x67,
+0x5f, 0x4b, 0x6f, 0x6e, 0x67, 0x0, 0x49, 0x63, 0x65, 0x6c, 0x61, 0x6e, 0x64, 0x0, 0x41, 0x74,
+0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x2f, 0x52, 0x65, 0x79, 0x6b, 0x6a, 0x61, 0x76, 0x69, 0x6b,
+0x0, 0x49, 0x72, 0x61, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x54, 0x65, 0x68, 0x72, 0x61,
+0x6e, 0x0, 0x49, 0x73, 0x72, 0x61, 0x65, 0x6c, 0x0, 0x4a, 0x61, 0x6d, 0x61, 0x69, 0x63, 0x61,
+0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4a, 0x61, 0x6d, 0x61, 0x69, 0x63, 0x61,
+0x0, 0x4a, 0x61, 0x70, 0x61, 0x6e, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x54, 0x6f, 0x6b, 0x79,
+0x6f, 0x0, 0x4b, 0x77, 0x61, 0x6a, 0x61, 0x6c, 0x65, 0x69, 0x6e, 0x0, 0x50, 0x61, 0x63, 0x69,
+0x66, 0x69, 0x63, 0x2f, 0x4b, 0x77, 0x61, 0x6a, 0x61, 0x6c, 0x65, 0x69, 0x6e, 0x0, 0x4c, 0x69,
+0x62, 0x79, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54, 0x72, 0x69, 0x70, 0x6f,
+0x6c, 0x69, 0x0, 0x4d, 0x53, 0x54, 0x0, 0x45, 0x74, 0x63, 0x2f, 0x47, 0x4d, 0x54, 0x2b, 0x37,
+0x0, 0x4d, 0x65, 0x78, 0x69, 0x63, 0x6f, 0x2f, 0x42, 0x61, 0x6a, 0x61, 0x4e, 0x6f, 0x72, 0x74,
+0x65, 0x0, 0x4d, 0x65, 0x78, 0x69, 0x63, 0x6f, 0x2f, 0x42, 0x61, 0x6a, 0x61, 0x53, 0x75, 0x72,
+0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x61, 0x7a, 0x61, 0x74, 0x6c, 0x61,
+0x6e, 0x0, 0x4d, 0x65, 0x78, 0x69, 0x63, 0x6f, 0x2f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
+0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4d, 0x65, 0x78, 0x69, 0x63, 0x6f, 0x5f,
+0x43, 0x69, 0x74, 0x79, 0x0, 0x4e, 0x5a, 0x0, 0x4e, 0x5a, 0x2d, 0x43, 0x48, 0x41, 0x54, 0x0,
+0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x43, 0x68, 0x61, 0x74, 0x68, 0x61, 0x6d, 0x0,
+0x4e, 0x61, 0x76, 0x61, 0x6a, 0x6f, 0x0, 0x50, 0x52, 0x43, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66,
+0x69, 0x63, 0x2f, 0x43, 0x68, 0x75, 0x75, 0x6b, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63,
+0x2f, 0x54, 0x72, 0x75, 0x6b, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x4b, 0x61,
+0x6e, 0x74, 0x6f, 0x6e, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x45, 0x6e, 0x64,
+0x65, 0x72, 0x62, 0x75, 0x72, 0x79, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x50,
+0x6f, 0x68, 0x6e, 0x70, 0x65, 0x69, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x50,
+0x6f, 0x6e, 0x61, 0x70, 0x65, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x53, 0x61,
+0x6d, 0x6f, 0x61, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x50, 0x61, 0x67, 0x6f,
+0x5f, 0x50, 0x61, 0x67, 0x6f, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x59, 0x61,
+0x70, 0x0, 0x50, 0x6f, 0x6c, 0x61, 0x6e, 0x64, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f,
+0x57, 0x61, 0x72, 0x73, 0x61, 0x77, 0x0, 0x50, 0x6f, 0x72, 0x74, 0x75, 0x67, 0x61, 0x6c, 0x0,
+0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, 0x4c, 0x69, 0x73, 0x62, 0x6f, 0x6e, 0x0, 0x52, 0x4f,
+0x43, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x54, 0x61, 0x69, 0x70, 0x65, 0x69, 0x0, 0x52, 0x4f,
+0x4b, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x53, 0x65, 0x6f, 0x75, 0x6c, 0x0, 0x53, 0x69, 0x6e,
+0x67, 0x61, 0x70, 0x6f, 0x72, 0x65, 0x0, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x53, 0x69, 0x6e, 0x67,
+0x61, 0x70, 0x6f, 0x72, 0x65, 0x0, 0x54, 0x75, 0x72, 0x6b, 0x65, 0x79, 0x0, 0x55, 0x43, 0x54,
+0x0, 0x55, 0x53, 0x2f, 0x41, 0x6c, 0x61, 0x73, 0x6b, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x41, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x0, 0x55, 0x53, 0x2f,
+0x41, 0x6c, 0x65, 0x75, 0x74, 0x69, 0x61, 0x6e, 0x0, 0x55, 0x53, 0x2f, 0x41, 0x72, 0x69, 0x7a,
+0x6f, 0x6e, 0x61, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x50, 0x68, 0x6f, 0x65,
+0x6e, 0x69, 0x78, 0x0, 0x55, 0x53, 0x2f, 0x43, 0x65, 0x6e, 0x74, 0x72, 0x61, 0x6c, 0x0, 0x41,
+0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x43, 0x68, 0x69, 0x63, 0x61, 0x67, 0x6f, 0x0, 0x55,
+0x53, 0x2f, 0x45, 0x61, 0x73, 0x74, 0x2d, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61, 0x0, 0x55,
+0x53, 0x2f, 0x45, 0x61, 0x73, 0x74, 0x65, 0x72, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63,
+0x61, 0x2f, 0x4e, 0x65, 0x77, 0x5f, 0x59, 0x6f, 0x72, 0x6b, 0x0, 0x55, 0x53, 0x2f, 0x48, 0x61,
+0x77, 0x61, 0x69, 0x69, 0x0, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2f, 0x48, 0x6f, 0x6e,
+0x6f, 0x6c, 0x75, 0x6c, 0x75, 0x0, 0x55, 0x53, 0x2f, 0x49, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x61,
+0x2d, 0x53, 0x74, 0x61, 0x72, 0x6b, 0x65, 0x0, 0x55, 0x53, 0x2f, 0x4d, 0x69, 0x63, 0x68, 0x69,
+0x67, 0x61, 0x6e, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x44, 0x65, 0x74, 0x72,
+0x6f, 0x69, 0x74, 0x0, 0x55, 0x53, 0x2f, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x0,
+0x55, 0x53, 0x2f, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69,
+0x63, 0x61, 0x2f, 0x4c, 0x6f, 0x73, 0x5f, 0x41, 0x6e, 0x67, 0x65, 0x6c, 0x65, 0x73, 0x0, 0x55,
+0x53, 0x2f, 0x50, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x2d, 0x4e, 0x65, 0x77, 0x0, 0x55, 0x53,
+0x2f, 0x53, 0x61, 0x6d, 0x6f, 0x61, 0x0, 0x55, 0x54, 0x43, 0x0, 0x55, 0x6e, 0x69, 0x76, 0x65,
+0x72, 0x73, 0x61, 0x6c, 0x0, 0x57, 0x2d, 0x53, 0x55, 0x0, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65,
+0x2f, 0x4d, 0x6f, 0x73, 0x63, 0x6f, 0x77, 0x0, 0x5a, 0x75, 0x6c, 0x75, 0x0
};
// GENERATED PART ENDS HERE
+constexpr QByteArrayView AliasData::aliasId() const { return aliasIdData + aliasIdIndex; }
+constexpr QByteArrayView AliasData::ianaId() const { return aliasIdData + ianaIdIndex; }
constexpr QByteArrayView WindowsData::windowsId() const { return windowsIdData + windowsIdIndex; }
// Each of the following returns a space-joined sequence of IANA IDs:
constexpr QByteArrayView WindowsData::ianaId() const { return ianaIdData + ianaIdIndex; }
diff --git a/src/corelib/time/qtimezoneprivate_icu.cpp b/src/corelib/time/qtimezoneprivate_icu.cpp
index 1a3baa70d0..a9fe68b83c 100644
--- a/src/corelib/time/qtimezoneprivate_icu.cpp
+++ b/src/corelib/time/qtimezoneprivate_icu.cpp
@@ -4,6 +4,7 @@
#include "qtimezone.h"
#include "qtimezoneprivate_p.h"
+#include "qtimezonelocale_p.h"
#include <unicode/ucal.h>
@@ -22,27 +23,6 @@ QT_BEGIN_NAMESPACE
// ICU utilities
-// Convert TimeType and NameType into ICU UCalendarDisplayNameType
-static UCalendarDisplayNameType ucalDisplayNameType(QTimeZone::TimeType timeType, QTimeZone::NameType nameType)
-{
- // TODO ICU C UCalendarDisplayNameType does not support full set of C++ TimeZone::EDisplayType
- switch (nameType) {
- case QTimeZone::ShortName :
- case QTimeZone::OffsetName :
- if (timeType == QTimeZone::DaylightTime)
- return UCAL_SHORT_DST;
- // Includes GenericTime
- return UCAL_SHORT_STANDARD;
- case QTimeZone::DefaultName :
- case QTimeZone::LongName :
- if (timeType == QTimeZone::DaylightTime)
- return UCAL_DST;
- // Includes GenericTime
- return UCAL_STANDARD;
- }
- return UCAL_STANDARD;
-}
-
// Qt wrapper around ucal_getDefaultTimeZone()
static QByteArray ucalDefaultTimeZoneId()
{
@@ -69,44 +49,6 @@ static QByteArray ucalDefaultTimeZoneId()
return QByteArray();
}
-// Qt wrapper around ucal_getTimeZoneDisplayName()
-static QString ucalTimeZoneDisplayName(UCalendar *ucal, QTimeZone::TimeType timeType,
- QTimeZone::NameType nameType,
- const QString &localeCode)
-{
- int32_t size = 50;
- QString result(size, Qt::Uninitialized);
- UErrorCode status = U_ZERO_ERROR;
-
- // size = ucal_getTimeZoneDisplayName(cal, type, locale, result, resultLength, status)
- size = ucal_getTimeZoneDisplayName(ucal,
- ucalDisplayNameType(timeType, nameType),
- localeCode.toUtf8(),
- reinterpret_cast<UChar *>(result.data()),
- size,
- &status);
-
- // If overflow, then resize and retry
- if (status == U_BUFFER_OVERFLOW_ERROR) {
- result.resize(size);
- status = U_ZERO_ERROR;
- size = ucal_getTimeZoneDisplayName(ucal,
- ucalDisplayNameType(timeType, nameType),
- localeCode.toUtf8(),
- reinterpret_cast<UChar *>(result.data()),
- size,
- &status);
- }
-
- // If successful on first or second go, resize and return
- if (U_SUCCESS(status)) {
- result.resize(size);
- return result;
- }
-
- return QString();
-}
-
// Qt wrapper around ucal_get() for offsets
static bool ucalOffsetsAtTime(UCalendar *m_ucal, qint64 atMSecsSinceEpoch,
int *utcOffset, int *dstOffset)
@@ -203,13 +145,11 @@ static QTimeZonePrivate::Data ucalTimeZoneTransition(UCalendar *m_ucal,
tran.offsetFromUtc = utc + dst;
tran.standardTimeOffset = utc;
tran.daylightTimeOffset = dst;
- // TODO No ICU API, use short name instead
- if (dst == 0)
- tran.abbreviation = ucalTimeZoneDisplayName(m_ucal, QTimeZone::StandardTime,
- QTimeZone::ShortName, QLocale().name());
- else
- tran.abbreviation = ucalTimeZoneDisplayName(m_ucal, QTimeZone::DaylightTime,
- QTimeZone::ShortName, QLocale().name());
+ // TODO No ICU API, use short name as abbreviation.
+ QTimeZone::TimeType timeType = dst == 0 ? QTimeZone::StandardTime : QTimeZone::DaylightTime;
+ using namespace QtTimeZoneLocale;
+ tran.abbreviation = ucalTimeZoneDisplayName(m_ucal, timeType,
+ QTimeZone::ShortName, QLocale().name());
return tran;
}
#endif // U_ICU_VERSION_SHORT
@@ -317,6 +257,7 @@ QString QIcuTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
}
// Technically this may be suspect, if locale isn't QLocale(), since that's
// what we used when constructing m_ucal; does ICU cope with inconsistency ?
+ using namespace QtTimeZoneLocale;
return ucalTimeZoneDisplayName(m_ucal, timeType, nameType, locale.name());
}
diff --git a/src/corelib/time/qtimezoneprivate_p.h b/src/corelib/time/qtimezoneprivate_p.h
index 506acaa1f7..7034a7285c 100644
--- a/src/corelib/time/qtimezoneprivate_p.h
+++ b/src/corelib/time/qtimezoneprivate_p.h
@@ -99,6 +99,8 @@ public:
virtual bool isDaylightTime(qint64 atMSecsSinceEpoch) const;
virtual Data data(qint64 forMSecsSinceEpoch) const;
+ virtual Data data(QTimeZone::TimeType timeType) const;
+ virtual bool isDataLocale(const QLocale &locale) const;
QDateTimePrivate::ZoneState stateAtZoneTime(qint64 forLocalMSecs,
QDateTimePrivate::TransitionOptions resolve) const;
@@ -131,6 +133,7 @@ public:
static QString isoOffsetFormat(int offsetFromUtc,
QTimeZone::NameType mode = QTimeZone::OffsetName);
+ static QByteArray aliasToIana(QByteArrayView alias);
static QByteArray ianaIdToWindowsId(const QByteArray &ianaId);
static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId);
static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId,
@@ -150,6 +153,15 @@ public:
return QByteArrayLiteral("UTC");
}
+#if QT_CONFIG(timezone_locale)
+private:
+ // Defined in qtimezonelocale.cpp
+ QString localeName(qint64 atMSecsSinceEpoch, int offsetFromUtc,
+ QTimeZone::TimeType timeType,
+ QTimeZone::NameType nameType,
+ const QLocale &locale) const;
+#endif // L10n helpers.
+
protected:
QByteArray m_id;
};
@@ -179,11 +191,15 @@ public:
QUtcTimeZonePrivate *clone() const override;
Data data(qint64 forMSecsSinceEpoch) const override;
+ Data data(QTimeZone::TimeType timeType) const override;
+ bool isDataLocale(const QLocale &locale) const override;
QLocale::Territory territory() const override;
QString comment() const override;
- using QTimeZonePrivate::displayName;
+ QString displayName(qint64 atMSecsSinceEpoch,
+ QTimeZone::NameType nameType,
+ const QLocale &locale) const override;
QString displayName(QTimeZone::TimeType timeType,
QTimeZone::NameType nameType,
const QLocale &locale) const override;
@@ -217,7 +233,7 @@ private:
// TODO: shuffle (almost reverse) order of and rework #if-ery here to use #elif
// and match the #if-ery in each of QTZ's newBackendTimeZone() cascades for
// backend selection.
-#if QT_CONFIG(icu)
+#if QT_CONFIG(icu) && !defined(Q_OS_UNIX)
class Q_AUTOTEST_EXPORT QIcuTimeZonePrivate final : public QTimeZonePrivate
{
public:
@@ -241,6 +257,7 @@ public:
bool hasDaylightTime() const override;
bool isDaylightTime(qint64 atMSecsSinceEpoch) const override;
+ using QTimeZonePrivate::data;
Data data(qint64 forMSecsSinceEpoch) const override;
bool hasTransitions() const override;
@@ -259,7 +276,7 @@ private:
UCalendar *m_ucal;
};
-#endif // ICU
+#endif // ICU not on Unix.
#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID)
struct QTzTransitionTime
@@ -321,6 +338,8 @@ public:
bool isDaylightTime(qint64 atMSecsSinceEpoch) const override;
Data data(qint64 forMSecsSinceEpoch) const override;
+ Data data(QTimeZone::TimeType timeType) const override;
+ bool isDataLocale(const QLocale &locale) const override;
bool hasTransitions() const override;
Data nextTransition(qint64 afterMSecsSinceEpoch) const override;
@@ -338,14 +357,6 @@ private:
Data dataForTzTransition(QTzTransitionTime tran) const;
Data dataFromRule(QTzTransitionRule rule, qint64 msecsSinceEpoch) const;
-#if QT_CONFIG(icu)
-# ifdef __cpp_lib_is_final
- static_assert(std::is_final<QIcuTimeZonePrivate>::value,
- "if QIcuTimeZonePrivate isn't final, we may need to specialize "
- "QExplicitlySharedDataPointer::clone() to call QTimeZonePrivate::clone()");
-# endif
- mutable QExplicitlySharedDataPointer<const QIcuTimeZonePrivate> m_icu;
-#endif
QTzTimeZoneCacheEntry cached_data;
const QList<QTzTransitionTime> &tranCache() const { return cached_data.m_tranTimes; }
};
@@ -378,6 +389,7 @@ public:
bool hasDaylightTime() const override;
bool isDaylightTime(qint64 atMSecsSinceEpoch) const override;
+ using QTimeZonePrivate::data;
Data data(qint64 forMSecsSinceEpoch) const override;
bool hasTransitions() const override;
@@ -432,6 +444,7 @@ public:
bool hasDaylightTime() const override;
bool isDaylightTime(qint64 atMSecsSinceEpoch) const override;
+ using QTimeZonePrivate::data;
Data data(qint64 forMSecsSinceEpoch) const override;
bool hasTransitions() const override;
@@ -481,6 +494,7 @@ public:
bool hasDaylightTime() const override;
bool isDaylightTime(qint64 atMSecsSinceEpoch) const override;
+ using QTimeZonePrivate::data;
Data data(qint64 forMSecsSinceEpoch) const override;
QByteArray systemTimeZoneId() const override;
diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp
index f6156fe93e..8d14e75193 100644
--- a/src/corelib/time/qtimezoneprivate_tz.cpp
+++ b/src/corelib/time/qtimezoneprivate_tz.cpp
@@ -33,10 +33,6 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-#if QT_CONFIG(icu)
-Q_CONSTINIT static QBasicMutex s_icu_mutex;
-#endif
-
/*
Private
@@ -771,9 +767,6 @@ QTzTimeZonePrivate::~QTzTimeZonePrivate()
QTzTimeZonePrivate *QTzTimeZonePrivate::clone() const
{
-#if QT_CONFIG(icu)
- const auto lock = qt_scoped_lock(s_icu_mutex);
-#endif
return new QTzTimeZonePrivate(*this);
}
@@ -1007,15 +1000,7 @@ QTzTimeZonePrivate::QTzTimeZonePrivate(const QByteArray &ianaId)
if (m_id.isEmpty()) {
// This can only happen for the system zone, when we've read the
// contents of /etc/localtime because it wasn't a symlink.
-#if QT_CONFIG(icu)
- // Use ICU's system zone, if only to avoid using the abbreviation as ID
- // (ICU might mis-recognize it) in displayName().
- m_icu = new QIcuTimeZonePrivate();
- // Use its ID, as an alternate source of data:
- m_id = m_icu->id();
- if (!m_id.isEmpty())
- return;
-#endif
+ // TODO: use CLDR generic abbreviation for the zone.
m_id = abbreviation(QDateTime::currentMSecsSinceEpoch()).toUtf8();
}
}
@@ -1034,70 +1019,19 @@ QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
QTimeZone::NameType nameType,
const QLocale &locale) const
{
- // TZ DB lacks localized names (it only has IANA IDs), so delegate to ICU
- // for those, when available.
-#if QT_CONFIG(icu)
- {
- auto lock = qt_scoped_lock(s_icu_mutex);
- // TODO Some valid TZ names are not valid ICU names, use translation table?
- if (!m_icu)
- m_icu = new QIcuTimeZonePrivate(m_id);
- if (m_icu->isValid())
- return m_icu->displayName(timeType, nameType, locale);
- }
-#else
- Q_UNUSED(timeType);
- Q_UNUSED(nameType);
- Q_UNUSED(locale);
-#endif
- // If ICU is unavailable, fall back to abbreviations.
- // Abbreviations don't have GenericTime
- if (timeType == QTimeZone::GenericTime)
- timeType = QTimeZone::StandardTime;
-
- // Get current tran, if valid and is what we want, then use it
- const qint64 currentMSecs = QDateTime::currentMSecsSinceEpoch();
- QTimeZonePrivate::Data tran = data(currentMSecs);
- if (tran.atMSecsSinceEpoch != invalidMSecs()
- && ((timeType == QTimeZone::DaylightTime && tran.daylightTimeOffset != 0)
- || (timeType == QTimeZone::StandardTime && tran.daylightTimeOffset == 0))) {
- return tran.abbreviation;
- }
-
- // Otherwise get next tran and if valid and is what we want, then use it
- tran = nextTransition(currentMSecs);
- if (tran.atMSecsSinceEpoch != invalidMSecs()
- && ((timeType == QTimeZone::DaylightTime && tran.daylightTimeOffset != 0)
- || (timeType == QTimeZone::StandardTime && tran.daylightTimeOffset == 0))) {
- return tran.abbreviation;
- }
-
- // Otherwise get prev tran and if valid and is what we want, then use it
- tran = previousTransition(currentMSecs);
- if (tran.atMSecsSinceEpoch != invalidMSecs())
- tran = previousTransition(tran.atMSecsSinceEpoch);
- if (tran.atMSecsSinceEpoch != invalidMSecs()
- && ((timeType == QTimeZone::DaylightTime && tran.daylightTimeOffset != 0)
- || (timeType == QTimeZone::StandardTime && tran.daylightTimeOffset == 0))) {
- return tran.abbreviation;
- }
-
- // Otherwise is strange sequence, so work backwards through trans looking for first match, if any
- auto it = std::partition_point(tranCache().cbegin(), tranCache().cend(),
- [currentMSecs](const QTzTransitionTime &at) {
- return at.atMSecsSinceEpoch <= currentMSecs;
- });
-
- while (it != tranCache().cbegin()) {
- --it;
- tran = dataForTzTransition(*it);
- int offset = tran.daylightTimeOffset;
- if ((timeType == QTimeZone::DaylightTime) != (offset == 0))
- return tran.abbreviation;
+ // TZ only provides C-locale abbreviations and offset:
+ if (nameType != QTimeZone::LongName && isDataLocale(locale)) {
+ QTimeZonePrivate::Data tran = data(timeType);
+ if (tran.atMSecsSinceEpoch != invalidMSecs()) {
+ if (nameType == QTimeZone::ShortName)
+ return tran.abbreviation;
+ // Save base class repeating the data(timeType) query:
+ if (locale.language() == QLocale::C)
+ return isoOffsetFormat(tran.offsetFromUtc);
+ }
}
-
- // Otherwise if no match use current data
- return data(currentMSecs).abbreviation;
+ // Otherwise, fall back to base class (and qtimezonelocale.cpp):
+ return QTimeZonePrivate::displayName(timeType, nameType, locale);
}
QString QTzTimeZonePrivate::abbreviation(qint64 atMSecsSinceEpoch) const
@@ -1184,6 +1118,64 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const
return dataFromRule(cached_data.m_tranRules.at(last->ruleIndex), forMSecsSinceEpoch);
}
+// Overridden because the final iteration over transitions only needs to look
+// forward and backwards one transition within the POSIX rule (when there is
+// one, as is common) to settle the whole period it covers, so we can then skip
+// all other transitions of the POSIX rule and iterate tranCache() backwards
+// from its most recent transition.
+QTimeZonePrivate::Data QTzTimeZonePrivate::data(QTimeZone::TimeType timeType) const
+{
+ // True if tran is valid and has the DST-ness to match timeType:
+ const auto validMatch = [timeType](const QTimeZonePrivate::Data &tran) {
+ return tran.atMSecsSinceEpoch != invalidMSecs()
+ && ((timeType == QTimeZone::DaylightTime) != (tran.daylightTimeOffset == 0));
+ };
+
+ // Get current tran, use if suitable:
+ const qint64 currentMSecs = QDateTime::currentMSecsSinceEpoch();
+ QTimeZonePrivate::Data tran = data(currentMSecs);
+ if (validMatch(tran))
+ return tran;
+
+ // Otherwise, next tran probably flips DST-ness:
+ tran = nextTransition(currentMSecs);
+ if (validMatch(tran))
+ return tran;
+
+ // Failing that, prev (or present, if current MSecs is eactly a transition
+ // moment) tran defines what data() got us and the one before that probably
+ // flips DST-ness:
+ tran = previousTransition(currentMSecs + 1);
+ if (tran.atMSecsSinceEpoch != invalidMSecs())
+ tran = previousTransition(tran.atMSecsSinceEpoch);
+ if (validMatch(tran))
+ return tran;
+
+ // Otherwise, we can look backwards through transitions for a match; if we
+ // have a POSIX rule, it clearly doesn't do DST (or we'd have hit it by
+ // now), so we only need to look in the tranCache() up to now.
+ const auto untilNow = [currentMSecs](const QTzTransitionTime &at) {
+ return at.atMSecsSinceEpoch <= currentMSecs;
+ };
+ auto it = std::partition_point(tranCache().cbegin(), tranCache().cend(), untilNow);
+ // That's the end or first future transition; we don't want to look at it,
+ // but at all those before it.
+ while (it != tranCache().cbegin()) {
+ --it;
+ tran = dataForTzTransition(*it);
+ if ((timeType == QTimeZone::DaylightTime) != (tran.daylightTimeOffset == 0))
+ return tran;
+ }
+
+ return {};
+}
+
+bool QTzTimeZonePrivate::isDataLocale(const QLocale &locale) const
+{
+ // TZ data uses English / C locale names:
+ return locale.language() == QLocale::C || locale.language() == QLocale::English;
+}
+
bool QTzTimeZonePrivate::hasTransitions() const
{
return true;
diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp
index 2e82a394ee..d0ed17eba2 100644
--- a/src/corelib/tools/qcryptographichash.cpp
+++ b/src/corelib/tools/qcryptographichash.cpp
@@ -1153,13 +1153,49 @@ void QCryptographicHashPrivate::State::finalizeUnchecked(QCryptographicHash::Alg
\note In Qt versions prior to 6.3, this function took QByteArray,
not QByteArrayView.
+
+ \sa hashInto()
*/
QByteArray QCryptographicHash::hash(QByteArrayView data, Algorithm method)
{
+ QByteArray ba(hashLengthInternal(method), Qt::Uninitialized);
+ [[maybe_unused]] const auto r = hashInto(ba, data, method);
+ Q_ASSERT(r.size() == ba.size());
+ return ba;
+}
+
+/*!
+ \since 6.8
+ \fn QCryptographicHash::hashInto(QSpan<char> buffer, QSpan<const QByteArrayView> data, Algorithm method);
+ \fn QCryptographicHash::hashInto(QSpan<uchar> buffer, QSpan<const QByteArrayView> data, Algorithm method);
+ \fn QCryptographicHash::hashInto(QSpan<std::byte> buffer, QSpan<const QByteArrayView> data, Algorithm method);
+ \fn QCryptographicHash::hashInto(QSpan<char> buffer, QByteArrayView data, Algorithm method);
+ \fn QCryptographicHash::hashInto(QSpan<uchar> buffer, QByteArrayView data, Algorithm method);
+ \fn QCryptographicHash::hashInto(QSpan<std::byte> buffer, QByteArrayView data, Algorithm method);
+
+ Returns the hash of \a data using \a method, using \a buffer to store the result.
+
+ If \a data is a span, adds all the byte array views to the hash, in the order given.
+
+ The return value will be a sub-span of \a buffer, unless \a buffer is of
+ insufficient size, in which case a null QByteArrayView is returned.
+
+ \sa hash()
+*/
+QByteArrayView QCryptographicHash::hashInto(QSpan<std::byte> buffer,
+ QSpan<const QByteArrayView> data,
+ Algorithm method) noexcept
+{
QCryptographicHashPrivate hash(method);
- hash.addData(data);
+ for (QByteArrayView part : data)
+ hash.addData(part);
hash.finalizeUnchecked(); // no mutex needed: no-one but us has access to 'hash'
- return hash.resultView().toByteArray();
+ auto result = hash.resultView();
+ if (buffer.size() < result.size())
+ return {}; // buffer too small
+ // ### optimize: have the method directly write into `buffer`
+ memcpy(buffer.data(), result.data(), result.size());
+ return buffer.first(result.size());
}
/*!
@@ -1338,7 +1374,7 @@ static HashBlock xored(const HashBlock &block, quint8 val) noexcept
class QMessageAuthenticationCodePrivate
{
public:
- QMessageAuthenticationCodePrivate(QCryptographicHash::Algorithm m)
+ explicit QMessageAuthenticationCodePrivate(QCryptographicHash::Algorithm m) noexcept
: messageHash(m)
{
}
@@ -1635,15 +1671,52 @@ void QMessageAuthenticationCodePrivate::finalizeUnchecked() noexcept
the key \a key and the method \a method.
\include qcryptographichash.cpp {qba-to-qbav-6.6}
+
+ \sa hashInto()
*/
QByteArray QMessageAuthenticationCode::hash(QByteArrayView message, QByteArrayView key,
QCryptographicHash::Algorithm method)
{
+ QByteArray ba(hashLengthInternal(method), Qt::Uninitialized);
+ [[maybe_unused]] const auto r = hashInto(ba, message, key, method);
+ Q_ASSERT(r.size() == ba.size());
+ return ba;
+}
+
+/*!
+ \since 6.8
+ \fn QMessageAuthenticationCode::hashInto(QSpan<char> buffer, QSpan<const QByteArrayView> messageParts, QByteArrayView key, QCryptographicHash::Algorithm method);
+ \fn QMessageAuthenticationCode::hashInto(QSpan<uchar> buffer, QSpan<const QByteArrayView> messageParts, QByteArrayView key, QCryptographicHash::Algorithm method);
+ \fn QMessageAuthenticationCode::hashInto(QSpan<std::byte> buffer, QSpan<const QByteArrayView> messageParts, QByteArrayView key, QCryptographicHash::Algorithm method);
+ \fn QMessageAuthenticationCode::hashInto(QSpan<char> buffer, QByteArrayView message, QByteArrayView key, QCryptographicHash::Algorithm method);
+ \fn QMessageAuthenticationCode::hashInto(QSpan<uchar> buffer, QByteArrayView message, QByteArrayView key, QCryptographicHash::Algorithm method);
+ \fn QMessageAuthenticationCode::hashInto(QSpan<std::byte> buffer, QByteArrayView message, QByteArrayView key, QCryptographicHash::Algorithm method);
+
+ Returns the authentication code for the message (\a message or, for the
+ QSpan overloads, the concatenation of \a messageParts) using the key \a key
+ and the method \a method.
+
+ The return value will be a sub-span of \a buffer, unless \a buffer is of
+ insufficient size, in which case a null QByteArrayView is returned.
+
+ \sa hash()
+*/
+QByteArrayView QMessageAuthenticationCode::hashInto(QSpan<std::byte> buffer,
+ QSpan<const QByteArrayView> messageParts,
+ QByteArrayView key,
+ QCryptographicHash::Algorithm method) noexcept
+{
QMessageAuthenticationCodePrivate mac(method);
mac.setKey(key);
- mac.messageHash.addData(message);
+ for (QByteArrayView part : messageParts)
+ mac.messageHash.addData(part);
mac.finalizeUnchecked();
- return mac.messageHash.resultView().toByteArray();
+ auto result = mac.messageHash.resultView();
+ if (buffer.size() < result.size())
+ return {}; // buffer too small
+ // ### optimize: have the method directly write into `buffer`
+ memcpy(buffer.data(), result.data(), result.size());
+ return buffer.first(result.size());
}
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qcryptographichash.h b/src/corelib/tools/qcryptographichash.h
index 294453adce..8c4f70457f 100644
--- a/src/corelib/tools/qcryptographichash.h
+++ b/src/corelib/tools/qcryptographichash.h
@@ -8,6 +8,7 @@
#include <QtCore/qbytearray.h>
#include <QtCore/qobjectdefs.h>
+#include <QtCore/qspan.h>
QT_BEGIN_NAMESPACE
@@ -91,6 +92,19 @@ public:
static QByteArray hash(const QByteArray &data, Algorithm method);
#endif
static QByteArray hash(QByteArrayView data, Algorithm method);
+
+ static QByteArrayView hashInto(QSpan<char> buffer, QByteArrayView data, Algorithm method) noexcept
+ { return hashInto(as_writable_bytes(buffer), {&data, 1}, method); }
+ static QByteArrayView hashInto(QSpan<uchar> buffer, QByteArrayView data, Algorithm method) noexcept
+ { return hashInto(as_writable_bytes(buffer), {&data, 1}, method); }
+ static QByteArrayView hashInto(QSpan<std::byte> buffer, QByteArrayView data, Algorithm method) noexcept
+ { return hashInto(buffer, {&data, 1}, method); }
+ static QByteArrayView hashInto(QSpan<char> buffer, QSpan<const QByteArrayView> data, Algorithm method) noexcept
+ { return hashInto(as_writable_bytes(buffer), data, method); }
+ static QByteArrayView hashInto(QSpan<uchar> buffer, QSpan<const QByteArrayView> data, Algorithm method) noexcept
+ { return hashInto(as_writable_bytes(buffer), data, method); }
+ static QByteArrayView hashInto(QSpan<std::byte> buffer, QSpan<const QByteArrayView> data, Algorithm method) noexcept;
+
static int hashLength(Algorithm method);
static bool supportsAlgorithm(Algorithm method);
private:
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index d8b3367de3..52602a0256 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -1153,32 +1153,37 @@ QEasingCurve::~QEasingCurve()
*/
/*!
- Compare this easing curve with \a other and returns \c true if they are
- equal. It will also compare the properties of a curve.
+ \fn bool QEasingCurve::operator==(const QEasingCurve &lhs, const QEasingCurve &rhs)
+
+ Compares easing curve \a lhs with \a rhs and returns \c true if they are
+ equal; otherwise returns \c false.
+ It will also compare the properties of the curves.
*/
-bool QEasingCurve::operator==(const QEasingCurve &other) const
+bool comparesEqual(const QEasingCurve &lhs, const QEasingCurve &rhs) noexcept
{
- bool res = d_ptr->func == other.d_ptr->func
- && d_ptr->type == other.d_ptr->type;
+ bool res = lhs.d_ptr->func == rhs.d_ptr->func
+ && lhs.d_ptr->type == rhs.d_ptr->type;
if (res) {
- if (d_ptr->config && other.d_ptr->config) {
+ if (lhs.d_ptr->config && rhs.d_ptr->config) {
// catch the config content
- res = d_ptr->config->operator==(*(other.d_ptr->config));
+ res = lhs.d_ptr->config->operator==(*(rhs.d_ptr->config));
- } else if (d_ptr->config || other.d_ptr->config) {
+ } else if (lhs.d_ptr->config || rhs.d_ptr->config) {
// one one has a config object, which could contain default values
- res = qFuzzyCompare(amplitude(), other.amplitude())
- && qFuzzyCompare(period(), other.period())
- && qFuzzyCompare(overshoot(), other.overshoot());
+ res = qFuzzyCompare(lhs.amplitude(), rhs.amplitude())
+ && qFuzzyCompare(lhs.period(), rhs.period())
+ && qFuzzyCompare(lhs.overshoot(), rhs.overshoot());
}
}
return res;
}
/*!
- \fn bool QEasingCurve::operator!=(const QEasingCurve &other) const
- Compare this easing curve with \a other and returns \c true if they are not equal.
- It will also compare the properties of a curve.
+ \fn bool QEasingCurve::operator!=(const QEasingCurve &lhs, const QEasingCurve &rhs)
+
+ Compares easing curve \a lhs with \a rhs and returns \c true if they are
+ not equal; otherwise returns \c false.
+ It will also compare the properties of the curves.
\sa operator==()
*/
diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h
index 5b112d7d7d..61e9aa247d 100644
--- a/src/corelib/tools/qeasingcurve.h
+++ b/src/corelib/tools/qeasingcurve.h
@@ -8,6 +8,7 @@
QT_REQUIRE_CONFIG(easingcurve);
+#include <QtCore/qcompare.h>
#include <QtCore/qlist.h>
#include <QtCore/qobjectdefs.h>
@@ -47,9 +48,11 @@ public:
void swap(QEasingCurve &other) noexcept { qt_ptr_swap(d_ptr, other.d_ptr); }
+#if QT_CORE_REMOVED_SINCE(6, 8)
bool operator==(const QEasingCurve &other) const;
inline bool operator!=(const QEasingCurve &other) const
{ return !(this->operator==(other)); }
+#endif
qreal amplitude() const;
void setAmplitude(qreal amplitude);
@@ -81,6 +84,11 @@ private:
friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve &);
friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &);
#endif
+ friend Q_CORE_EXPORT bool
+ comparesEqual(const QEasingCurve &lhs, const QEasingCurve &rhs) noexcept;
+#if !QT_CORE_REMOVED_SINCE(6, 8)
+ Q_DECLARE_EQUALITY_COMPARABLE(QEasingCurve)
+#endif
};
Q_DECLARE_SHARED(QEasingCurve)
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index 9216b8875b..e313b06aa9 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -14,6 +14,9 @@ QT_BEGIN_NAMESPACE
\class QLine
\inmodule QtCore
\ingroup painting
+ \compares equality
+ \compareswith equality QLineF
+ \endcompareswith
\brief The QLine class provides a two-dimensional vector using
integer precision.
@@ -133,18 +136,18 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn bool QLine::operator!=(const QLine &line) const
+ \fn bool QLine::operator!=(const QLine &lhs, const QLine &rhs)
- Returns \c true if the given \a line is not the same as \e this line.
+ Returns \c true if the line \a lhs is not the same as line \a rhs.
A line is different from another line if any of their start or
end points differ, or the internal order of the points is different.
*/
/*!
- \fn bool QLine::operator==(const QLine &line) const
+ \fn bool QLine::operator==(const QLine &lhs, const QLine &rhs)
- Returns \c true if the given \a line is the same as \e this line.
+ Returns \c true if the line \a lhs is the same as line \a rhs.
A line is identical to another line if the start and end points
are identical, and the internal order of the points is the same.
@@ -288,6 +291,9 @@ QDataStream &operator>>(QDataStream &stream, QLine &line)
\class QLineF
\inmodule QtCore
\ingroup painting
+ \compares equality
+ \compareswith equality QLine
+ \endcompareswith
\brief The QLineF class provides a two-dimensional vector using
floating point precision.
@@ -508,18 +514,18 @@ QDataStream &operator>>(QDataStream &stream, QLine &line)
*/
/*!
- \fn bool QLineF::operator!=(const QLineF &line) const
+ \fn bool QLineF::operator!=(const QLineF &lhs, const QLineF &rhs)
- Returns \c true if the given \a line is not the same as \e this line.
+ Returns \c true if the line \a lhs is not the same as line \a rhs.
A line is different from another line if their start or end points
differ, or the internal order of the points is different.
*/
/*!
- \fn bool QLineF::operator==(const QLineF &line) const
+ \fn bool QLineF::operator==(const QLineF &lhs, const QLineF &rhs)
- Returns \c true if the given \a line is the same as this line.
+ Returns \c true if the line \a lhs is the same as line \a rhs.
A line is identical to another line if the start and end points
are identical, and the internal order of the points is the same.
@@ -781,6 +787,25 @@ qreal QLineF::angleTo(const QLineF &l) const
return delta_normalized;
}
+/*!
+ \fn bool QLineF::qFuzzyCompare(const QLineF &lhs, const QLineF &rhs)
+ \since 6.8
+
+ Returns \c true if line \a lhs is approximately equal to line \a rhs;
+ otherwise returns \c false.
+
+ The lines are considered approximately equal if their start and end
+ points are approximately equal.
+*/
+
+/*!
+ \fn bool QLineF::qFuzzyIsNull(const QLineF &line)
+ \since 6.8
+
+ Returns \c true if the start point of line \a line is approximately
+ equal to its end point; otherwise returns \c false.
+*/
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QLineF &p)
{
diff --git a/src/corelib/tools/qline.h b/src/corelib/tools/qline.h
index e23ffbe9d5..03dac30e16 100644
--- a/src/corelib/tools/qline.h
+++ b/src/corelib/tools/qline.h
@@ -48,12 +48,20 @@ public:
inline void setPoints(const QPoint &p1, const QPoint &p2);
inline void setLine(int x1, int y1, int x2, int y2);
+#if QT_CORE_REMOVED_SINCE(6, 8)
constexpr inline bool operator==(const QLine &d) const noexcept;
- constexpr inline bool operator!=(const QLine &d) const noexcept { return !(*this == d); }
+ constexpr inline bool operator!=(const QLine &d) const noexcept { return !operator==(d); }
+#endif
[[nodiscard]] constexpr inline QLineF toLineF() const noexcept;
private:
+ friend constexpr bool comparesEqual(const QLine &lhs, const QLine &rhs) noexcept
+ { return lhs.pt1 == rhs.pt1 && lhs.pt2 == rhs.pt2; }
+#if !QT_CORE_REMOVED_SINCE(6, 8)
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QLine)
+#endif
+
QPoint pt1, pt2;
};
Q_DECLARE_TYPEINFO(QLine, Q_PRIMITIVE_TYPE);
@@ -161,10 +169,12 @@ inline void QLine::setLine(int aX1, int aY1, int aX2, int aY2)
pt2 = QPoint(aX2, aY2);
}
+#if QT_CORE_REMOVED_SINCE(6, 8)
constexpr inline bool QLine::operator==(const QLine &d) const noexcept
{
- return pt1 == d.pt1 && pt2 == d.pt2;
+ return comparesEqual(*this, d);
}
+#endif
#ifndef QT_NO_DEBUG_STREAM
Q_CORE_EXPORT QDebug operator<<(QDebug d, const QLine &p);
@@ -233,12 +243,30 @@ public:
inline void setPoints(const QPointF &p1, const QPointF &p2);
inline void setLine(qreal x1, qreal y1, qreal x2, qreal y2);
+#if QT_CORE_REMOVED_SINCE(6, 8)
constexpr inline bool operator==(const QLineF &d) const;
- constexpr inline bool operator!=(const QLineF &d) const { return !(*this == d); }
+ constexpr inline bool operator!=(const QLineF &d) const { return !operator==(d); }
+#endif
constexpr QLine toLine() const;
private:
+ friend constexpr bool comparesEqual(const QLineF &lhs, const QLineF &rhs) noexcept
+ { return lhs.pt1 == rhs.pt1 && lhs.pt2 == rhs.pt2; }
+#if !QT_CORE_REMOVED_SINCE(6, 8)
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QLineF)
+#endif
+
+ friend constexpr bool comparesEqual(const QLineF &lhs, const QLine &rhs) noexcept
+ { return comparesEqual(lhs, rhs.toLineF()); }
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QLineF, QLine)
+
+ friend constexpr bool qFuzzyCompare(const QLineF &lhs, const QLineF &rhs) noexcept
+ { return qFuzzyCompare(lhs.pt1, rhs.pt1) && qFuzzyCompare(lhs.pt2, rhs.pt2); }
+
+ friend constexpr bool qFuzzyIsNull(const QLineF &line) noexcept
+ { return qFuzzyCompare(line.pt1, line.pt2); }
+
QPointF pt1, pt2;
};
Q_DECLARE_TYPEINFO(QLineF, Q_PRIMITIVE_TYPE);
@@ -283,7 +311,7 @@ constexpr inline qreal QLineF::y2() const
constexpr inline bool QLineF::isNull() const
{
- return qFuzzyCompare(pt1.x(), pt2.x()) && qFuzzyCompare(pt1.y(), pt2.y());
+ return qFuzzyCompare(pt1, pt2);
}
constexpr inline QPointF QLineF::p1() const
@@ -383,12 +411,12 @@ inline void QLineF::setLine(qreal aX1, qreal aY1, qreal aX2, qreal aY2)
pt2 = QPointF(aX2, aY2);
}
-
+#if QT_CORE_REMOVED_SINCE(6, 8)
constexpr inline bool QLineF::operator==(const QLineF &d) const
{
- return pt1 == d.pt1 && pt2 == d.pt2;
+ return comparesEqual(*this, d);
}
-
+#endif
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp
index 1d2cb7d6e5..c4cd0da30d 100644
--- a/src/corelib/tools/qmargins.cpp
+++ b/src/corelib/tools/qmargins.cpp
@@ -14,6 +14,10 @@ QT_BEGIN_NAMESPACE
\ingroup painting
\since 4.6
+ \compares equality
+ \compareswith equality QMarginsF
+ \endcompareswith
+
\brief The QMargins class defines the four margins of a rectangle.
QMargin defines a set of four margins; left, top, right, and bottom,
@@ -107,15 +111,15 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn bool QMargins::operator==(const QMargins &m1, const QMargins &m2)
+ \fn bool QMargins::operator==(const QMargins &lhs, const QMargins &rhs)
- Returns \c true if \a m1 and \a m2 are equal; otherwise returns \c false.
+ Returns \c true if \a lhs and \a rhs are equal; otherwise returns \c false.
*/
/*!
- \fn bool QMargins::operator!=(const QMargins &m1, const QMargins &m2)
+ \fn bool QMargins::operator!=(const QMargins &lhs, const QMargins &rhs)
- Returns \c true if \a m1 and \a m2 are different; otherwise returns \c false.
+ Returns \c true if \a lhs and \a rhs are different; otherwise returns \c false.
*/
/*!
@@ -438,6 +442,10 @@ QDebug operator<<(QDebug dbg, const QMargins &m)
\ingroup painting
\since 5.3
+ \compares equality
+ \compareswith equality QMargins
+ \endcompareswith
+
\brief The QMarginsF class defines the four margins of a rectangle.
QMarginsF defines a set of four margins; left, top, right, and bottom,
@@ -746,6 +754,22 @@ QDebug operator<<(QDebug dbg, const QMargins &m)
\sa QMarginsF(), QMargins::toMarginsF()
*/
+/*!
+ \fn bool QMarginsF::qFuzzyCompare(const QMarginsF &lhs, const QMarginsF &rhs)
+ \since 6.8
+
+ Returns \c true if \a lhs is approximately equal to \a rhs;
+ otherwise returns \c false.
+*/
+
+/*!
+ \fn bool QMarginsF::qFuzzyIsNull(const QMarginsF &margins)
+ \since 6.8
+
+ Returns \c true if all components of margsins \a margins are
+ approximately equal to zero; otherwise returns \c false.
+*/
+
/*****************************************************************************
QMarginsF stream functions
*****************************************************************************/
diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h
index f8d7150dfd..3b29860d66 100644
--- a/src/corelib/tools/qmargins.h
+++ b/src/corelib/tools/qmargins.h
@@ -4,6 +4,7 @@
#ifndef QMARGINS_H
#define QMARGINS_H
+#include <QtCore/qcompare.h>
#include <QtCore/qnamespace.h>
#include <QtCore/q20type_traits.h>
@@ -54,19 +55,14 @@ private:
int m_right;
int m_bottom;
- friend constexpr inline bool operator==(const QMargins &m1, const QMargins &m2) noexcept
+ friend constexpr bool comparesEqual(const QMargins &lhs, const QMargins &rhs) noexcept
{
- return
- m1.m_left == m2.m_left &&
- m1.m_top == m2.m_top &&
- m1.m_right == m2.m_right &&
- m1.m_bottom == m2.m_bottom;
- }
-
- friend constexpr inline bool operator!=(const QMargins &m1, const QMargins &m2) noexcept
- {
- return !(m1 == m2);
+ return lhs.m_left == rhs.m_left
+ && lhs.m_top == rhs.m_top
+ && lhs.m_right == rhs.m_right
+ && lhs.m_bottom == rhs.m_bottom;
}
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QMargins)
template <std::size_t I,
typename M,
@@ -304,18 +300,35 @@ private:
qreal m_right;
qreal m_bottom;
- friend constexpr inline bool operator==(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
+ QT_WARNING_PUSH
+ QT_WARNING_DISABLE_FLOAT_COMPARE
+ friend constexpr bool qFuzzyCompare(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
{
- return qFuzzyCompare(lhs.left(), rhs.left())
- && qFuzzyCompare(lhs.top(), rhs.top())
- && qFuzzyCompare(lhs.right(), rhs.right())
- && qFuzzyCompare(lhs.bottom(), rhs.bottom());
+ return ((!lhs.m_left || !rhs.m_left) ? qFuzzyIsNull(lhs.m_left - rhs.m_left)
+ : qFuzzyCompare(lhs.m_left, rhs.m_left))
+ && ((!lhs.m_top || !rhs.m_top) ? qFuzzyIsNull(lhs.m_top - rhs.m_top)
+ : qFuzzyCompare(lhs.m_top, rhs.m_top))
+ && ((!lhs.m_right || !rhs.m_right) ? qFuzzyIsNull(lhs.m_right - rhs.m_right)
+ : qFuzzyCompare(lhs.m_right, rhs.m_right))
+ && ((!lhs.m_bottom || !rhs.m_bottom) ? qFuzzyIsNull(lhs.m_bottom - rhs.m_bottom)
+ : qFuzzyCompare(lhs.m_bottom, rhs.m_bottom));
+ }
+ QT_WARNING_POP
+ friend constexpr bool qFuzzyIsNull(const QMarginsF &m) noexcept
+ {
+ return qFuzzyIsNull(m.m_left) && qFuzzyIsNull(m.m_top)
+ && qFuzzyIsNull(m.m_right) && qFuzzyIsNull(m.m_bottom);
}
- friend constexpr inline bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
+ friend constexpr bool comparesEqual(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
{
- return !(lhs == rhs);
+ return qFuzzyCompare(lhs, rhs);
}
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QMarginsF)
+
+ friend constexpr bool comparesEqual(const QMarginsF &lhs, const QMargins &rhs) noexcept
+ { return comparesEqual(lhs, rhs.toMarginsF()); }
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QMarginsF, QMargins)
template <std::size_t I,
typename M,
diff --git a/src/corelib/tools/qmessageauthenticationcode.h b/src/corelib/tools/qmessageauthenticationcode.h
index 4e88138763..7c5edfa7bf 100644
--- a/src/corelib/tools/qmessageauthenticationcode.h
+++ b/src/corelib/tools/qmessageauthenticationcode.h
@@ -55,6 +55,30 @@ public:
static QByteArray hash(QByteArrayView message, QByteArrayView key,
QCryptographicHash::Algorithm method);
+ static QByteArrayView
+ hashInto(QSpan<char> buffer, QByteArrayView message, QByteArrayView key,
+ QCryptographicHash::Algorithm method) noexcept
+ { return hashInto(as_writable_bytes(buffer), {&message, 1}, key, method); }
+ static QByteArrayView
+ hashInto(QSpan<uchar> buffer, QByteArrayView message, QByteArrayView key,
+ QCryptographicHash::Algorithm method) noexcept
+ { return hashInto(as_writable_bytes(buffer), {&message, 1}, key, method); }
+ static QByteArrayView
+ hashInto(QSpan<std::byte> buffer, QByteArrayView message,
+ QByteArrayView key, QCryptographicHash::Algorithm method) noexcept
+ { return hashInto(buffer, {&message, 1}, key, method); }
+ static QByteArrayView
+ hashInto(QSpan<char> buffer, QSpan<const QByteArrayView> messageParts,
+ QByteArrayView key, QCryptographicHash::Algorithm method) noexcept
+ { return hashInto(as_writable_bytes(buffer), messageParts, key, method); }
+ static QByteArrayView
+ hashInto(QSpan<uchar> buffer, QSpan<const QByteArrayView> messageParts,
+ QByteArrayView key, QCryptographicHash::Algorithm method) noexcept
+ { return hashInto(as_writable_bytes(buffer), messageParts, key, method); }
+ static QByteArrayView
+ hashInto(QSpan<std::byte> buffer, QSpan<const QByteArrayView> message,
+ QByteArrayView key, QCryptographicHash::Algorithm method) noexcept;
+
private:
Q_DISABLE_COPY(QMessageAuthenticationCode)
QMessageAuthenticationCodePrivate *d;
diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp
index d1f3b12a68..775a354469 100644
--- a/src/corelib/tools/qpoint.cpp
+++ b/src/corelib/tools/qpoint.cpp
@@ -15,6 +15,10 @@ QT_BEGIN_NAMESPACE
\ingroup painting
\reentrant
+ \compares equality
+ \compareswith equality QPointF
+ \endcompareswith
+
\brief The QPoint class defines a point in the plane using integer
precision.
@@ -208,16 +212,17 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn bool QPoint::operator==(const QPoint &p1, const QPoint &p2)
+ \fn bool QPoint::operator==(const QPoint &lhs, const QPoint &rhs)
- Returns \c true if \a p1 and \a p2 are equal; otherwise returns
- false.
+ Returns \c true if \a lhs and \a rhs are equal; otherwise returns
+ \c false.
*/
/*!
- \fn bool QPoint::operator!=(const QPoint &p1, const QPoint &p2)
+ \fn bool QPoint::operator!=(const QPoint &lhs, const QPoint &rhs)
- Returns \c true if \a p1 and \a p2 are not equal; otherwise returns \c false.
+ Returns \c true if \a lhs and \a rhs are not equal; otherwise returns
+ \c false.
*/
/*!
@@ -463,6 +468,10 @@ size_t qHash(QPoint key, size_t seed) noexcept
\ingroup painting
\reentrant
+ \compares equality
+ \compareswith equality QPoint
+ \endcompareswith
+
\brief The QPointF class defines a point in the plane using
floating point precision.
@@ -730,9 +739,9 @@ size_t qHash(QPoint key, size_t seed) noexcept
*/
/*!
- \fn bool QPointF::operator==(const QPointF &p1, const QPointF &p2)
+ \fn bool QPointF::operator==(const QPointF &lhs, const QPointF &rhs)
- Returns \c true if \a p1 is approximately equal to \a p2; otherwise
+ Returns \c true if \a lhs is approximately equal to \a rhs; otherwise
returns \c false.
\warning This function does not check for strict equality; instead,
@@ -742,9 +751,9 @@ size_t qHash(QPoint key, size_t seed) noexcept
*/
/*!
- \fn bool QPointF::operator!=(const QPointF &p1, const QPointF &p2);
+ \fn bool QPointF::operator!=(const QPointF &lhs, const QPointF &rhs)
- Returns \c true if \a p1 is sufficiently different from \a p2;
+ Returns \c true if \a lhs is sufficiently different from \a rhs;
otherwise returns \c false.
\warning This function does not check for strict inequality; instead,
@@ -753,6 +762,26 @@ size_t qHash(QPoint key, size_t seed) noexcept
\sa qFuzzyCompare
*/
+/*!
+ \fn bool QPointF::qFuzzyCompare(const QPointF &p1, const QPointF &p2)
+ \since 6.8
+
+ Returns \c true if \a p1 is approximately equal to \a p2; otherwise
+ returns \c false.
+
+ \sa qFuzzyIsNull
+*/
+
+/*!
+ \fn bool QPointF::qFuzzyIsNull(const QPointF &point)
+ \since 6.8
+
+ Returns \c true if \a point is approximately equal to a point
+ \c {(0.0, 0.0)}.
+
+ \sa qFuzzyCompare
+*/
+
#ifndef QT_NO_DATASTREAM
/*!
\fn QDataStream &operator<<(QDataStream &stream, const QPointF &point)
diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h
index 7df4d49005..50b4c864be 100644
--- a/src/corelib/tools/qpoint.h
+++ b/src/corelib/tools/qpoint.h
@@ -4,7 +4,9 @@
#ifndef QPOINT_H
#define QPOINT_H
+#include <QtCore/qcompare.h>
#include <QtCore/qnamespace.h>
+#include <QtCore/qnumeric.h>
#include <QtCore/q20type_traits.h>
#include <QtCore/q23utility.h>
@@ -51,10 +53,10 @@ public:
constexpr static inline int dotProduct(const QPoint &p1, const QPoint &p2)
{ return p1.xp * p2.xp + p1.yp * p2.yp; }
- friend constexpr inline bool operator==(const QPoint &p1, const QPoint &p2) noexcept
+private:
+ friend constexpr bool comparesEqual(const QPoint &p1, const QPoint &p2) noexcept
{ return p1.xp == p2.xp && p1.yp == p2.yp; }
- friend constexpr inline bool operator!=(const QPoint &p1, const QPoint &p2) noexcept
- { return p1.xp != p2.xp || p1.yp != p2.yp; }
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QPoint)
friend constexpr inline QPoint operator+(const QPoint &p1, const QPoint &p2) noexcept
{ return QPoint(p1.xp + p2.xp, p1.yp + p2.yp); }
friend constexpr inline QPoint operator-(const QPoint &p1, const QPoint &p2) noexcept
@@ -78,6 +80,7 @@ public:
friend constexpr inline QPoint operator/(const QPoint &p, qreal c)
{ return QPoint(qRound(p.xp / c), qRound(p.yp / c)); }
+public:
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
[[nodiscard]] Q_CORE_EXPORT CGPoint toCGPoint() const noexcept;
#endif
@@ -241,19 +244,25 @@ public:
return p1.xp * p2.xp + p1.yp * p2.yp;
}
+private:
QT_WARNING_PUSH
QT_WARNING_DISABLE_FLOAT_COMPARE
- friend constexpr inline bool operator==(const QPointF &p1, const QPointF &p2)
+ friend constexpr bool qFuzzyCompare(const QPointF &p1, const QPointF &p2) noexcept
{
return ((!p1.xp || !p2.xp) ? qFuzzyIsNull(p1.xp - p2.xp) : qFuzzyCompare(p1.xp, p2.xp))
&& ((!p1.yp || !p2.yp) ? qFuzzyIsNull(p1.yp - p2.yp) : qFuzzyCompare(p1.yp, p2.yp));
}
- friend constexpr inline bool operator!=(const QPointF &p1, const QPointF &p2)
+ QT_WARNING_POP
+ friend constexpr bool qFuzzyIsNull(const QPointF &point) noexcept
{
- return !(p1 == p2);
+ return qFuzzyIsNull(point.xp) && qFuzzyIsNull(point.yp);
}
- QT_WARNING_POP
-
+ friend constexpr bool comparesEqual(const QPointF &p1, const QPointF &p2) noexcept
+ { return qFuzzyCompare(p1, p2); }
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QPointF)
+ friend constexpr bool comparesEqual(const QPointF &p1, const QPoint &p2) noexcept
+ { return comparesEqual(p1, p2.toPointF()); }
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QPointF, QPoint)
friend constexpr inline QPointF operator+(const QPointF &p1, const QPointF &p2)
{ return QPointF(p1.xp + p2.xp, p1.yp + p2.yp); }
friend constexpr inline QPointF operator-(const QPointF &p1, const QPointF &p2)
@@ -272,6 +281,7 @@ public:
return QPointF(p.xp / divisor, p.yp / divisor);
}
+public:
constexpr QPoint toPoint() const;
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp
index 6d345ce543..ce28a6d887 100644
--- a/src/corelib/tools/qrect.cpp
+++ b/src/corelib/tools/qrect.cpp
@@ -15,6 +15,10 @@ QT_BEGIN_NAMESPACE
\ingroup painting
\reentrant
+ \compares equality
+ \compareswith equality QRectF
+ \endcompareswith
+
\brief The QRect class defines a rectangle in the plane using
integer precision.
@@ -1105,18 +1109,18 @@ bool QRect::intersects(const QRect &r) const noexcept
}
/*!
- \fn bool QRect::operator==(const QRect &r1, const QRect &r2)
+ \fn bool QRect::operator==(const QRect &lhs, const QRect &rhs)
- Returns \c true if the rectangles \a r1 and \a r2 are equal,
+ Returns \c true if the rectangles \a lhs and \a rhs are equal,
otherwise returns \c false.
*/
/*!
- \fn bool QRect::operator!=(const QRect &r1, const QRect &r2)
+ \fn bool QRect::operator!=(const QRect &lhs, const QRect &rhs)
- Returns \c true if the rectangles \a r1 and \a r2 are different, otherwise
- returns \c false.
+ Returns \c true if the rectangles \a lhs and \a rhs are different,
+ otherwise returns \c false.
*/
/*!
@@ -1279,6 +1283,10 @@ QDebug operator<<(QDebug dbg, const QRect &r)
\ingroup painting
\reentrant
+ \compares equality
+ \compareswith equality QRect
+ \endcompareswith
+
\brief The QRectF class defines a finite rectangle in the plane using
floating point precision.
@@ -2346,10 +2354,10 @@ QRect QRectF::toAlignedRect() const noexcept
*/
/*!
- \fn bool QRectF::operator==(const QRectF &r1, const QRectF &r2)
+ \fn bool QRectF::operator==(const QRectF &lhs, const QRectF &rhs)
- Returns \c true if the rectangles \a r1 and \a r2 are \b approximately equal,
- otherwise returns \c false.
+ Returns \c true if the rectangles \a lhs and \a rhs are \b approximately
+ equal, otherwise returns \c false.
\warning This function does not check for strict equality; instead,
it uses a fuzzy comparison to compare the rectangles' coordinates.
@@ -2359,9 +2367,9 @@ QRect QRectF::toAlignedRect() const noexcept
/*!
- \fn bool QRectF::operator!=(const QRectF &r1, const QRectF &r2)
+ \fn bool QRectF::operator!=(const QRectF &lhs, const QRectF &rhs)
- Returns \c true if the rectangles \a r1 and \a r2 are sufficiently
+ Returns \c true if the rectangles \a lhs and \a rhs are sufficiently
different, otherwise returns \c false.
\warning This function does not check for strict inequality; instead,
@@ -2429,6 +2437,22 @@ QRect QRectF::toAlignedRect() const noexcept
\sa marginsRemoved(), operator+=(), marginsAdded()
*/
+/*!
+ \fn bool QRectF::qFuzzyCompare(const QRectF &lhs, const QRectF &rhs)
+ \since 6.8
+
+ Returns \c true if the rectangle \a lhs is approximately equal to the
+ rectangle \a rhs; otherwise returns \c false.
+*/
+
+/*!
+ \fn bool QRectF::qFuzzyIsNull(const QRectF &rect)
+ \since 6.8
+
+ Returns \c true if both width and height of the rectangle \a rect are
+ approximately equal to zero; otherwise returns \c false.
+*/
+
/*****************************************************************************
QRectF stream functions
*****************************************************************************/
diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h
index e69a217f48..fb938b0056 100644
--- a/src/corelib/tools/qrect.h
+++ b/src/corelib/tools/qrect.h
@@ -119,12 +119,13 @@ public:
[[nodiscard]] static constexpr inline QRect span(const QPoint &p1, const QPoint &p2) noexcept;
- friend constexpr inline bool operator==(const QRect &r1, const QRect &r2) noexcept
+private:
+ friend constexpr bool comparesEqual(const QRect &r1, const QRect &r2) noexcept
{ return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2; }
- friend constexpr inline bool operator!=(const QRect &r1, const QRect &r2) noexcept
- { return r1.x1!=r2.x1 || r1.x2!=r2.x2 || r1.y1!=r2.y1 || r1.y2!=r2.y2; }
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QRect)
friend constexpr inline size_t qHash(const QRect &, size_t) noexcept;
+public:
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
[[nodiscard]] CGRect toCGRect() const noexcept;
#endif
@@ -572,17 +573,30 @@ public:
constexpr inline QRectF &operator+=(const QMarginsF &margins) noexcept;
constexpr inline QRectF &operator-=(const QMarginsF &margins) noexcept;
- friend constexpr inline bool operator==(const QRectF &r1, const QRectF &r2) noexcept
+private:
+ friend constexpr bool comparesEqual(const QRectF &r1, const QRectF &r2) noexcept
{
return r1.topLeft() == r2.topLeft()
&& r1.size() == r2.size();
}
- friend constexpr inline bool operator!=(const QRectF &r1, const QRectF &r2) noexcept
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QRectF)
+
+ friend constexpr bool comparesEqual(const QRectF &r1, const QRect &r2) noexcept
+ { return r1.topLeft() == r2.topLeft() && r1.size() == r2.size(); }
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QRectF, QRect)
+
+ friend constexpr bool qFuzzyCompare(const QRectF &lhs, const QRectF &rhs) noexcept
{
- return r1.topLeft() != r2.topLeft()
- || r1.size() != r2.size();
+ return qFuzzyCompare(lhs.topLeft(), rhs.topLeft())
+ && qFuzzyCompare(lhs.bottomRight(), rhs.bottomRight());
}
+ friend constexpr bool qFuzzyIsNull(const QRectF &rect) noexcept
+ {
+ return qFuzzyIsNull(rect.w) && qFuzzyIsNull(rect.h);
+ }
+
+public:
[[nodiscard]] constexpr inline QRect toRect() const noexcept;
[[nodiscard]] QRect toAlignedRect() const noexcept;
diff --git a/src/corelib/tools/qsize.cpp b/src/corelib/tools/qsize.cpp
index d5e8e4c71b..27ff1d164d 100644
--- a/src/corelib/tools/qsize.cpp
+++ b/src/corelib/tools/qsize.cpp
@@ -266,15 +266,15 @@ QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const noexcept
*/
/*!
- \fn bool QSize::operator==(const QSize &s1, const QSize &s2)
+ \fn bool QSize::operator==(const QSize &lhs, const QSize &rhs)
- Returns \c true if \a s1 and \a s2 are equal; otherwise returns \c false.
+ Returns \c true if \a lhs and \a rhs are equal; otherwise returns \c false.
*/
/*!
- \fn bool QSize::operator!=(const QSize &s1, const QSize &s2)
+ \fn bool QSize::operator!=(const QSize &lhs, const QSize &rhs)
- Returns \c true if \a s1 and \a s2 are different; otherwise returns \c false.
+ Returns \c true if \a lhs and \a rhs are different; otherwise returns \c false.
*/
/*!
@@ -714,9 +714,9 @@ QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const noexcept
*/
/*!
- \fn bool QSizeF::operator==(const QSizeF &s1, const QSizeF &s2)
+ \fn bool QSizeF::operator==(const QSizeF &lhs, const QSizeF &rhs)
- Returns \c true if \a s1 and \a s2 are approximately equal; otherwise
+ Returns \c true if \a lhs and \a rhs are approximately equal; otherwise
returns false.
\warning This function does not check for strict equality; instead,
@@ -726,9 +726,9 @@ QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const noexcept
*/
/*!
- \fn bool QSizeF::operator!=(const QSizeF &s1, const QSizeF &s2)
+ \fn bool QSizeF::operator!=(const QSizeF &lhs, const QSizeF &rhs)
- Returns \c true if \a s1 and \a s2 are sufficiently different; otherwise
+ Returns \c true if \a lhs and \a rhs are sufficiently different; otherwise
returns \c false.
\warning This function does not check for strict inequality; instead,
@@ -808,7 +808,24 @@ QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const noexcept
\sa expandedTo(), scale()
*/
+/*!
+ \fn bool QSizeF::qFuzzyCompare(const QSizeF &lhs, const QSizeF &rhs)
+ \since 6.8
+
+ Returns \c true if the size \a lhs is approximately equal to the
+ size \a rhs; otherwise returns \c false.
+
+ The sizes are considered approximately equal if their width and
+ height are approximately equal.
+*/
+/*!
+ \fn bool QSizeF::qFuzzyIsNull(const QSizeF &size)
+ \since 6.8
+
+ Returns \c true if both width and height of the size \a size
+ are approximately equal to zero.
+*/
/*****************************************************************************
QSizeF stream functions
diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h
index a5eaf34afe..67f7146201 100644
--- a/src/corelib/tools/qsize.h
+++ b/src/corelib/tools/qsize.h
@@ -59,10 +59,10 @@ public:
constexpr inline QSize &operator*=(qreal c) noexcept;
inline QSize &operator/=(qreal c);
- friend inline constexpr bool operator==(const QSize &s1, const QSize &s2) noexcept
+private:
+ friend constexpr bool comparesEqual(const QSize &s1, const QSize &s2) noexcept
{ return s1.wd == s2.wd && s1.ht == s2.ht; }
- friend inline constexpr bool operator!=(const QSize &s1, const QSize &s2) noexcept
- { return s1.wd != s2.wd || s1.ht != s2.ht; }
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QSize)
friend inline constexpr QSize operator+(const QSize &s1, const QSize &s2) noexcept
{ return QSize(s1.wd + s2.wd, s1.ht + s2.ht); }
friend inline constexpr QSize operator-(const QSize &s1, const QSize &s2) noexcept
@@ -75,6 +75,7 @@ public:
{ Q_ASSERT(!qFuzzyIsNull(c)); return QSize(qRound(s.wd / c), qRound(s.ht / c)); }
friend inline constexpr size_t qHash(const QSize &, size_t) noexcept;
+public:
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
[[nodiscard]] CGSize toCGSize() const noexcept;
#endif
@@ -242,16 +243,25 @@ public:
constexpr inline QSizeF &operator*=(qreal c) noexcept;
inline QSizeF &operator/=(qreal c);
+private:
QT_WARNING_PUSH
QT_WARNING_DISABLE_FLOAT_COMPARE
- friend constexpr inline bool operator==(const QSizeF &s1, const QSizeF &s2)
+ friend constexpr bool qFuzzyCompare(const QSizeF &s1, const QSizeF &s2) noexcept
{
+ // Cannot use qFuzzyCompare(), because it will give incorrect results
+ // if one of the arguments is 0.0.
return ((!s1.wd || !s2.wd) ? qFuzzyIsNull(s1.wd - s2.wd) : qFuzzyCompare(s1.wd, s2.wd))
&& ((!s1.ht || !s2.ht) ? qFuzzyIsNull(s1.ht - s2.ht) : qFuzzyCompare(s1.ht, s2.ht));
}
QT_WARNING_POP
- friend constexpr inline bool operator!=(const QSizeF &s1, const QSizeF &s2)
- { return !(s1 == s2); }
+ friend constexpr bool qFuzzyIsNull(const QSizeF &size) noexcept
+ { return qFuzzyIsNull(size.wd) && qFuzzyIsNull(size.ht); }
+ friend constexpr bool comparesEqual(const QSizeF &lhs, const QSizeF &rhs) noexcept
+ { return qFuzzyCompare(lhs, rhs); }
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QSizeF)
+ friend constexpr bool comparesEqual(const QSizeF &lhs, const QSize &rhs) noexcept
+ { return comparesEqual(lhs, rhs.toSizeF()); }
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QSizeF, QSize)
friend constexpr inline QSizeF operator+(const QSizeF &s1, const QSizeF &s2) noexcept
{ return QSizeF(s1.wd + s2.wd, s1.ht + s2.ht); }
friend constexpr inline QSizeF operator-(const QSizeF &s1, const QSizeF &s2) noexcept
@@ -263,6 +273,7 @@ public:
friend inline QSizeF operator/(const QSizeF &s, qreal c)
{ Q_ASSERT(!qFuzzyIsNull(c)); return QSizeF(s.wd / c, s.ht / c); }
+public:
constexpr inline QSize toSize() const noexcept;
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
diff --git a/src/corelib/tools/qspan.h b/src/corelib/tools/qspan.h
index d6ae2570ae..2671ba374f 100644
--- a/src/corelib/tools/qspan.h
+++ b/src/corelib/tools/qspan.h
@@ -433,6 +433,29 @@ public:
[[nodiscard]] constexpr QSpan<T> sliced(size_type pos) const { return subspan(pos); }
[[nodiscard]] constexpr QSpan<T> sliced(size_type pos, size_type n) const { return subspan(pos, n); }
+private:
+ // [span.objectrep]
+ [[nodiscard]] friend
+ QSpan<const std::byte, E == q20::dynamic_extent ? q20::dynamic_extent : E * sizeof(T)>
+ as_bytes(QSpan s) noexcept
+ {
+ using R = QSpan<const std::byte, E == q20::dynamic_extent ? q20::dynamic_extent : E * sizeof(T)>;
+ return R{reinterpret_cast<const std::byte *>(s.data()), s.size_bytes()};
+ }
+
+ template <typename U>
+ using if_mutable = std::enable_if_t<!std::is_const_v<U>, bool>;
+
+#ifndef Q_QDOC
+ template <typename T2 = T, if_mutable<T2> = true>
+#endif
+ [[nodiscard]] friend
+ QSpan<std::byte, E == q20::dynamic_extent ? q20::dynamic_extent : E * sizeof(T)>
+ as_writable_bytes(QSpan s) noexcept
+ {
+ using R = QSpan<std::byte, E == q20::dynamic_extent ? q20::dynamic_extent : E * sizeof(T)>;
+ return R{reinterpret_cast<std::byte *>(s.data()), s.size_bytes()};
+ }
}; // class QSpan
// [span.deduct]
diff --git a/src/corelib/tools/qspan.qdoc b/src/corelib/tools/qspan.qdoc
index 472f122877..9b55b09bf7 100644
--- a/src/corelib/tools/qspan.qdoc
+++ b/src/corelib/tools/qspan.qdoc
@@ -556,7 +556,6 @@
\sa subspan(QSpan<T,E>::size_type), subspan(), first(), last()
*/
-#if 0 // needs fix for QTBUG-118080 integrated into qt5.git
/*!
\fn template <typename T, size_t E> template <std::size_t Offset, std::size_t Count> auto QSpan<T, E>::subspan() const
\keyword subspan-t2
@@ -573,7 +572,6 @@
\sa subspan(QSpan<T,E>::size_type, QSpan<T,E>::size_type), subspan(), first(), last()
*/
-#endif
//
// runtime subspans:
@@ -649,3 +647,37 @@
\sa subspan(), first(QSpan<T,E>::size_type), last(QSpan<T,E>::size_type)
*/
+/*!
+ \fn template <typename T, size_t E> auto QSpan<T, E>::as_bytes(QSpan s)
+ \since 6.8
+
+ Returns \a s as a \c{QSpan<const std::byte, E'>} whose size() is equal to
+ \c{s.size_bytes()}.
+
+ If \c{E} is \c{std::dynamic_extent} then so is \c{E'}.
+ Otherwise, \c{E' = E * sizeof(T)}.
+
+ \note \c{q20::dynamic_extent} is a C++17 backport of C++20's
+ \l{https://en.cppreference.com/w/cpp/container/span/dynamic_extent}{\c{std::dynamic_extent}}.
+
+ \sa as_writable_bytes(), size_bytes()
+*/
+
+/*!
+ \fn template <typename T, size_t E> auto QSpan<T, E>::as_writable_bytes(QSpan s)
+ \since 6.8
+
+ Returns \a s as a \c{QSpan<std::byte, E'>} whose size() is equal to
+ \c{s.size_bytes()}.
+
+ If \c{E} is \c{std::dynamic_extent} then so is \c{E'}.
+ Otherwise, \c{E' = E * sizeof(T)}.
+
+ \note This function participates in overload resolution only if
+ \c{!std::is_const_v<T>}.
+
+ \note \c{q20::dynamic_extent} is a C++17 backport of C++20's
+ \l{https://en.cppreference.com/w/cpp/container/span/dynamic_extent}{\c{std::dynamic_extent}}.
+
+ \sa as_bytes(), size_bytes()
+*/
diff --git a/src/corelib/tools/qversionnumber.cpp b/src/corelib/tools/qversionnumber.cpp
index 4b8ace71cc..af95875b44 100644
--- a/src/corelib/tools/qversionnumber.cpp
+++ b/src/corelib/tools/qversionnumber.cpp
@@ -30,6 +30,7 @@ QT_IMPL_METATYPE_EXTERN(QVersionNumber)
\brief The QVersionNumber class contains a version number with an arbitrary
number of segments.
+ \compares strong
\snippet qversionnumber/main.cpp 0
*/
diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h
index 95217a6eff..e7ae107226 100644
--- a/src/corelib/tools/qversionnumber.h
+++ b/src/corelib/tools/qversionnumber.h
@@ -6,6 +6,7 @@
#ifndef QVERSIONNUMBER_H
#define QVERSIONNUMBER_H
+#include <QtCore/qcompare.h>
#include <QtCore/qcontainertools_impl.h>
#include <QtCore/qlist.h>
#include <QtCore/qmetatype.h>
@@ -355,25 +356,20 @@ public:
[[nodiscard]] Q_CORE_EXPORT static QVersionNumber fromString(QStringView string, int *suffixIndex);
#endif
- [[nodiscard]] friend bool operator> (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
- { return compare(lhs, rhs) > 0; }
-
- [[nodiscard]] friend bool operator>=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
- { return compare(lhs, rhs) >= 0; }
-
- [[nodiscard]] friend bool operator< (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
- { return compare(lhs, rhs) < 0; }
-
- [[nodiscard]] friend bool operator<=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
- { return compare(lhs, rhs) <= 0; }
-
- [[nodiscard]] friend bool operator==(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
- { return compare(lhs, rhs) == 0; }
-
- [[nodiscard]] friend bool operator!=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
- { return compare(lhs, rhs) != 0; }
-
private:
+ [[nodiscard]] friend bool comparesEqual(const QVersionNumber &lhs,
+ const QVersionNumber &rhs) noexcept
+ {
+ return compare(lhs, rhs) == 0;
+ }
+ [[nodiscard]] friend Qt::strong_ordering compareThreeWay(const QVersionNumber &lhs,
+ const QVersionNumber &rhs) noexcept
+ {
+ int c = compare(lhs, rhs);
+ return Qt::compareThreeWay(c, 0);
+ }
+ Q_DECLARE_STRONGLY_ORDERED(QVersionNumber)
+
#ifndef QT_NO_DATASTREAM
friend Q_CORE_EXPORT QDataStream& operator>>(QDataStream &in, QVersionNumber &version);
#endif
diff --git a/src/dbus/qdbusextratypes.cpp b/src/dbus/qdbusextratypes.cpp
index 61f2075443..3354e76577 100644
--- a/src/dbus/qdbusextratypes.cpp
+++ b/src/dbus/qdbusextratypes.cpp
@@ -34,6 +34,8 @@ void QDBusSignature::doCheck()
if (!QDBusUtil::isValidSignature(m_signature)) {
qWarning("QDBusSignature: invalid signature \"%s\"", qPrintable(m_signature));
m_signature.clear();
+ } else if (m_signature.isEmpty()) {
+ m_signature.detach(); // we need it to not be null
}
}
diff --git a/src/dbus/qdbusextratypes.h b/src/dbus/qdbusextratypes.h
index 1bc0f3086d..1c0826b992 100644
--- a/src/dbus/qdbusextratypes.h
+++ b/src/dbus/qdbusextratypes.h
@@ -77,7 +77,10 @@ class Q_DBUS_EXPORT QDBusSignature
{
QString m_signature;
public:
- QDBusSignature() noexcept : m_signature() {}
+ QDBusSignature() noexcept
+ {
+ m_signature.detach(); // mark non-null (empty signatures are valid)
+ }
// compiler-generated copy/move constructor/assignment operators are ok!
// compiler-generated destructor is ok!
diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp
index b2ed2586fb..d1f1a41ab0 100644
--- a/src/dbus/qdbusmarshaller.cpp
+++ b/src/dbus/qdbusmarshaller.cpp
@@ -120,7 +120,7 @@ inline void QDBusMarshaller::append(const QDBusObjectPath &arg)
inline void QDBusMarshaller::append(const QDBusSignature &arg)
{
QByteArray data = arg.signature().toUtf8();
- if (!ba && data.isEmpty()) {
+ if (!ba && data.isNull()) {
error("Invalid signature passed in arguments"_L1);
} else {
const char *cdata = data.constData();
diff --git a/src/dbus/qdbusutil.cpp b/src/dbus/qdbusutil.cpp
index 827418c487..78338aa054 100644
--- a/src/dbus/qdbusutil.cpp
+++ b/src/dbus/qdbusutil.cpp
@@ -512,14 +512,14 @@ namespace QDBusUtil
bool isValidSignature(const QString &signature)
{
QByteArray ba = signature.toLatin1();
- const char *data = ba.constData();
- while (true) {
+ const char *data = ba.constBegin();
+ const char *end = ba.constEnd();
+ while (data != end) {
data = validateSingleType(data);
if (!data)
return false;
- if (*data == '\0')
- return true;
}
+ return true;
}
/*!
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index cef71318d8..94cc686724 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -7,7 +7,9 @@ qt_find_package(WrapPNG PROVIDED_TARGETS WrapPNG::WrapPNG)
qt_find_package(WrapFreetype PROVIDED_TARGETS WrapFreetype::WrapFreetype)
if (QT_FEATURE_gui)
- if(WIN32)
+ if(QT_QPA_PLATFORMS)
+ list(GET QT_QPA_PLATFORMS 0 _default_platform)
+ elseif(WIN32)
set(_default_platform "windows")
elseif(ANDROID)
set(_default_platform "android")
@@ -30,6 +32,11 @@ if (QT_FEATURE_gui)
endif()
set(QT_QPA_DEFAULT_PLATFORM "${_default_platform}" CACHE STRING "QPA default platform")
+ if(NOT "${QT_QPA_DEFAULT_PLATFORM}" IN_LIST QT_QPA_PLATFORMS)
+ list(APPEND QT_QPA_PLATFORMS "${QT_QPA_DEFAULT_PLATFORM}")
+ set(QT_QPA_PLATFORMS "${QT_QPA_PLATFORMS}" CACHE STRING
+ "QPA platforms deployed by default" FORCE)
+ endif()
endif()
# Silence warnings in 3rdparty code
@@ -164,6 +171,7 @@ qt_internal_add_module(Gui
painting/qcolormatrix_p.h
painting/qcolorspace.cpp painting/qcolorspace.h painting/qcolorspace_p.h
painting/qcolortransferfunction_p.h
+ painting/qcolortransfergeneric_p.h
painting/qcolortransfertable_p.h
painting/qcolortransform.cpp painting/qcolortransform.h painting/qcolortransform_p.h
painting/qcolortrc_p.h
@@ -376,6 +384,11 @@ qt_internal_extend_target(Gui CONDITION MACOS
${FWAppKit}
)
+qt_internal_extend_target(Gui CONDITION UIKIT
+ SOURCES
+ platform/ios/qiosnativeinterface.cpp
+)
+
qt_internal_extend_target(Gui CONDITION WASM
SOURCES
platform/wasm/qwasmnativeinterface.cpp
@@ -402,6 +415,19 @@ qt_internal_extend_target(Gui CONDITION APPLE
${FWImageIO}
)
+qt_internal_extend_target(Gui CONDITION APPLE AND QT_FEATURE_metal
+ SOURCES
+ platform/darwin/qmetallayer.mm platform/darwin/qmetallayer_p.h
+ LIBRARIES
+ ${FWQuartzCore}
+)
+
+qt_internal_extend_target(Gui CONDITION QNX
+ SOURCES
+ painting/qrasterbackingstore.cpp painting/qrasterbackingstore_p.h
+ painting/qrhibackingstore.cpp painting/qrhibackingstore_p.h
+)
+
qt_internal_extend_target(Gui CONDITION QT_FEATURE_animation
SOURCES
animation/qguivariantanimation.cpp
diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp
index b3269a2a95..5e7a452a33 100644
--- a/src/gui/accessible/linux/atspiadaptor.cpp
+++ b/src/gui/accessible/linux/atspiadaptor.cpp
@@ -35,6 +35,13 @@
#define ATSPI_COORD_TYPE_PARENT 2
#endif
+// ATSPI_*_VERSION defines were added in libatspi 2.50,
+// as was the AtspiLive enum; define values here for older versions
+#if !defined(ATSPI_MAJOR_VERSION) || !defined(ATSPI_MINOR_VERSION) || ATSPI_MAJOR_VERSION < 2 || ATSPI_MINOR_VERSION < 50
+#define ATSPI_LIVE_POLITE 1
+#define ATSPI_LIVE_ASSERTIVE 2
+#endif
+
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
@@ -42,11 +49,12 @@ using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(lcAccessibilityAtspi, "qt.accessibility.atspi")
Q_LOGGING_CATEGORY(lcAccessibilityAtspiCreation, "qt.accessibility.atspi.creation")
-AtSpiAdaptor::AtSpiAdaptor(DBusConnection *connection, QObject *parent)
+AtSpiAdaptor::AtSpiAdaptor(QAtSpiDBusConnection *connection, QObject *parent)
: QDBusVirtualObject(parent), m_dbus(connection)
, sendFocus(0)
, sendObject(0)
, sendObject_active_descendant_changed(0)
+ , sendObject_announcement(0)
, sendObject_attributes_changed(0)
, sendObject_bounds_changed(0)
, sendObject_children_changed(0)
@@ -127,6 +135,7 @@ QString AtSpiAdaptor::introspect(const QString &path) const
" <interface name=\"org.a11y.atspi.Accessible\">\n"
" <property access=\"read\" type=\"s\" name=\"Name\"/>\n"
" <property access=\"read\" type=\"s\" name=\"Description\"/>\n"
+ " <property access=\"read\" type=\"s\" name=\"HelpText\"/>\n"
" <property access=\"read\" type=\"(so)\" name=\"Parent\">\n"
" <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
" </property>\n"
@@ -678,6 +687,8 @@ void AtSpiAdaptor::setBitFlag(const QString &flag)
if (false) {
} else if (right.startsWith("ActiveDescendantChanged"_L1)) {
sendObject_active_descendant_changed = 1;
+ } else if (right.startsWith("Announcement"_L1)) {
+ sendObject_announcement = 1;
} else if (right.startsWith("AttributesChanged"_L1)) {
sendObject_attributes_changed = 1;
} else if (right.startsWith("BoundsChanged"_L1)) {
@@ -929,6 +940,26 @@ void AtSpiAdaptor::notifyStateChange(QAccessibleInterface *interface, const QStr
sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "StateChanged"_L1, stateArgs);
}
+void AtSpiAdaptor::sendAnnouncement(QAccessibleAnnouncementEvent *event)
+{
+ QAccessibleInterface *iface = event->accessibleInterface();
+ if (!iface) {
+ qCWarning(lcAccessibilityAtspi, "Announcement event has no accessible set.");
+ return;
+ }
+ if (!iface->isValid()) {
+ qCWarning(lcAccessibilityAtspi) << "Announcement event with invalid accessible: " << iface;
+ return;
+ }
+
+ const QString path = pathForInterface(iface);
+ const QString message = event->message();
+ const QAccessible::AnnouncementPriority prio = event->priority();
+ const int politeness = (prio == QAccessible::AnnouncementPriority::Assertive) ? ATSPI_LIVE_ASSERTIVE : ATSPI_LIVE_POLITE;
+
+ const QVariantList args = packDBusSignalArguments(QString(), politeness, 0, QVariant::fromValue(QDBusVariant(message)));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "Announcement"_L1, args);
+}
/*!
This function gets called when Qt notifies about accessibility updates.
@@ -1003,6 +1034,14 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
sendFocusChanged(event->accessibleInterface());
break;
}
+
+ case QAccessible::Announcement: {
+ if (sendObject || sendObject_announcement) {
+ QAccessibleAnnouncementEvent *announcementEvent = static_cast<QAccessibleAnnouncementEvent*>(event);
+ sendAnnouncement(announcementEvent);
+ }
+ break;
+ }
case QAccessible::TextInserted:
case QAccessible::TextRemoved:
case QAccessible::TextUpdated: {
@@ -1586,6 +1625,8 @@ bool AtSpiAdaptor::accessibleInterface(QAccessibleInterface *interface, const QS
sendReply(connection, message, accessibleInterfaces(interface));
} else if (function == "GetDescription"_L1) {
sendReply(connection, message, QVariant::fromValue(QDBusVariant(interface->text(QAccessible::Description))));
+ } else if (function == "GetHelpText"_L1) {
+ sendReply(connection, message, QVariant::fromValue(QDBusVariant(interface->text(QAccessible::Help))));
} else if (function == "GetState"_L1) {
quint64 spiState = spiStatesFromQState(interface->state());
if (interface->tableInterface()) {
@@ -1606,7 +1647,7 @@ bool AtSpiAdaptor::accessibleInterface(QAccessibleInterface *interface, const QS
sendReply(connection, message,
QVariant::fromValue(spiStateSetFromSpiStates(spiState)));
} else if (function == "GetAttributes"_L1) {
- sendReply(connection, message, QVariant::fromValue(QSpiAttributeSet()));
+ sendReply(connection, message, QVariant::fromValue(getAttributes(interface)));
} else if (function == "GetRelationSet"_L1) {
sendReply(connection, message, QVariant::fromValue(relationSet(interface, connection)));
} else if (function == "GetApplication"_L1) {
@@ -2264,6 +2305,38 @@ namespace
}
}
+QSpiAttributeSet AtSpiAdaptor::getAttributes(QAccessibleInterface *interface) const
+{
+ QSpiAttributeSet set;
+ QAccessibleAttributesInterface *attributesIface = interface->attributesInterface();
+ if (!attributesIface)
+ return set;
+
+ const QList<QAccessible::Attribute> attrKeys = attributesIface->attributeKeys();
+ for (QAccessible::Attribute key : attrKeys) {
+ const QVariant value = attributesIface->attributeValue(key);
+ // see "Core Accessibility API Mappings" spec: https://www.w3.org/TR/core-aam-1.2/
+ switch (key) {
+ case QAccessible::Attribute::Custom:
+ {
+ // forward custom attributes to AT-SPI as-is
+ Q_ASSERT((value.canConvert<QHash<QString, QString>>()));
+ const QHash<QString, QString> attrMap = value.value<QHash<QString, QString>>();
+ for (auto [name, val] : attrMap.asKeyValueRange())
+ set.insert(name, val);
+ break;
+ }
+ case QAccessible::Attribute::Level:
+ Q_ASSERT(value.canConvert<int>());
+ set.insert(QStringLiteral("level"), QString::number(value.toInt()));
+ break;
+ default:
+ break;
+ }
+ }
+ return set;
+}
+
// FIXME all attribute methods below should share code
QVariantList AtSpiAdaptor::getAttributes(QAccessibleInterface *interface, int offset, bool includeDefaults) const
{
diff --git a/src/gui/accessible/linux/atspiadaptor_p.h b/src/gui/accessible/linux/atspiadaptor_p.h
index 3a890f3d7d..fe7f6c477c 100644
--- a/src/gui/accessible/linux/atspiadaptor_p.h
+++ b/src/gui/accessible/linux/atspiadaptor_p.h
@@ -16,7 +16,7 @@
// We mean it.
//
-#include <atspi/atspi-constants.h>
+#include <atspi/atspi.h>
#include <QtGui/private/qtguiglobal_p.h>
#include <QtDBus/qdbusvirtualobject.h>
@@ -38,7 +38,7 @@ class AtSpiAdaptor :public QDBusVirtualObject
Q_OBJECT
public:
- explicit AtSpiAdaptor(DBusConnection *connection, QObject *parent = nullptr);
+ explicit AtSpiAdaptor(QAtSpiDBusConnection *connection, QObject *parent = nullptr);
~AtSpiAdaptor();
void registerApplication();
@@ -85,8 +85,11 @@ private:
void notifyStateChange(QAccessibleInterface *interface, const QString& state, int value);
+ void sendAnnouncement(QAccessibleAnnouncementEvent *event);
+
// accessible helper functions
AtspiRole getRole(QAccessibleInterface *interface) const;
+ QSpiAttributeSet getAttributes(QAccessibleInterface *) const;
QSpiRelationArray relationSet(QAccessibleInterface *interface, const QDBusConnection &connection) const;
QStringList accessibleInterfaces(QAccessibleInterface *interface) const;
@@ -111,7 +114,7 @@ private:
// private vars
QSpiObjectReference accessibilityRegistry;
- DBusConnection *m_dbus;
+ QAtSpiDBusConnection *m_dbus;
QSpiApplicationAdaptor *m_applicationAdaptor;
/// Assigned from the accessibility registry.
@@ -130,6 +133,7 @@ private:
// all of object
uint sendObject : 1;
uint sendObject_active_descendant_changed : 1;
+ uint sendObject_announcement : 1;
uint sendObject_attributes_changed : 1;
uint sendObject_bounds_changed : 1;
uint sendObject_children_changed : 1;
diff --git a/src/gui/accessible/linux/dbusconnection.cpp b/src/gui/accessible/linux/dbusconnection.cpp
index 10bd10927e..620575cc98 100644
--- a/src/gui/accessible/linux/dbusconnection.cpp
+++ b/src/gui/accessible/linux/dbusconnection.cpp
@@ -26,13 +26,13 @@ using namespace Qt::StringLiterals;
#define A11Y_PATH "/org/a11y/bus"_L1
/*!
- \class DBusConnection
+ \class QAtSpiDBusConnection
\internal
\brief Connects to the accessibility dbus.
This is usually a different bus from the session bus.
*/
-DBusConnection::DBusConnection(QObject *parent)
+QAtSpiDBusConnection::QAtSpiDBusConnection(QObject *parent)
: QObject(parent), m_a11yConnection(QString()), m_enabled(false)
{
// If the bus is explicitly set via env var it overrides everything else.
@@ -66,7 +66,7 @@ DBusConnection::DBusConnection(QObject *parent)
}
}
-QString DBusConnection::getAddressFromXCB()
+QString QAtSpiDBusConnection::getAddressFromXCB()
{
QGuiApplication *app = qobject_cast<QGuiApplication *>(QCoreApplication::instance());
if (!app)
@@ -85,7 +85,7 @@ QString DBusConnection::getAddressFromXCB()
// We have the a11y registry on the session bus.
// Subscribe to updates about a11y enabled state.
// Find out the bus address
-void DBusConnection::serviceRegistered()
+void QAtSpiDBusConnection::serviceRegistered()
{
// listen to enabled changes
QDBusConnection c = QDBusConnection::sessionBus();
@@ -113,12 +113,12 @@ void DBusConnection::serviceRegistered()
// connect(a11yStatus, ); QtDbus doesn't support notifications for property changes yet
}
-void DBusConnection::serviceUnregistered()
+void QAtSpiDBusConnection::serviceUnregistered()
{
emit enabledChanged(false);
}
-void DBusConnection::connectA11yBus(const QString &address)
+void QAtSpiDBusConnection::connectA11yBus(const QString &address)
{
if (address.isEmpty()) {
qWarning("Could not find Accessibility DBus address.");
@@ -130,7 +130,7 @@ void DBusConnection::connectA11yBus(const QString &address)
emit enabledChanged(true);
}
-void DBusConnection::dbusError(const QDBusError &error)
+void QAtSpiDBusConnection::dbusError(const QDBusError &error)
{
qWarning() << "Accessibility encountered a DBus error:" << error;
}
@@ -139,7 +139,7 @@ void DBusConnection::dbusError(const QDBusError &error)
Returns the DBus connection that got established.
Or an invalid connection if not yet connected.
*/
-QDBusConnection DBusConnection::connection() const
+QDBusConnection QAtSpiDBusConnection::connection() const
{
return m_a11yConnection;
}
diff --git a/src/gui/accessible/linux/dbusconnection_p.h b/src/gui/accessible/linux/dbusconnection_p.h
index 8b231c5ad0..98bd02741f 100644
--- a/src/gui/accessible/linux/dbusconnection_p.h
+++ b/src/gui/accessible/linux/dbusconnection_p.h
@@ -27,12 +27,12 @@ QT_BEGIN_NAMESPACE
class QDBusServiceWatcher;
-class DBusConnection : public QObject
+class QAtSpiDBusConnection : public QObject
{
Q_OBJECT
public:
- DBusConnection(QObject *parent = nullptr);
+ QAtSpiDBusConnection(QObject *parent = nullptr);
QDBusConnection connection() const;
bool isEnabled() const { return m_enabled; }
diff --git a/src/gui/accessible/linux/qspiaccessiblebridge.cpp b/src/gui/accessible/linux/qspiaccessiblebridge.cpp
index de2e7d5fc0..0d18589ac5 100644
--- a/src/gui/accessible/linux/qspiaccessiblebridge.cpp
+++ b/src/gui/accessible/linux/qspiaccessiblebridge.cpp
@@ -31,7 +31,7 @@ using namespace Qt::StringLiterals;
QSpiAccessibleBridge::QSpiAccessibleBridge()
: cache(nullptr), dec(nullptr), dbusAdaptor(nullptr)
{
- dbusConnection = new DBusConnection();
+ dbusConnection = new QAtSpiDBusConnection();
connect(dbusConnection, SIGNAL(enabledChanged(bool)), this, SLOT(enabledChanged(bool)));
// Now that we have connected the signal, make sure we didn't miss a change,
// e.g. when running as root or when AT_SPI_BUS_ADDRESS is set by hand.
diff --git a/src/gui/accessible/linux/qspiaccessiblebridge_p.h b/src/gui/accessible/linux/qspiaccessiblebridge_p.h
index 5ad48c5cc4..69c4feb7bf 100644
--- a/src/gui/accessible/linux/qspiaccessiblebridge_p.h
+++ b/src/gui/accessible/linux/qspiaccessiblebridge_p.h
@@ -27,7 +27,7 @@ QT_REQUIRE_CONFIG(accessibility);
QT_BEGIN_NAMESPACE
-class DBusConnection;
+class QAtSpiDBusConnection;
class QSpiDBusCache;
class AtSpiAdaptor;
struct RoleNames;
@@ -60,7 +60,7 @@ private:
QSpiDBusCache *cache;
DeviceEventControllerAdaptor *dec;
AtSpiAdaptor *dbusAdaptor;
- DBusConnection* dbusConnection;
+ QAtSpiDBusConnection* dbusConnection;
SpiRoleMapping m_spiRoleMapping;
};
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 46bca16dad..eec779efb1 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -173,6 +173,7 @@ Q_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
\value ActionChanged An action has been changed.
\value ActiveDescendantChanged
\value Alert A system alert (e.g., a message from a QMessageBox)
+ \value [since 6.8] Announcement The announcement of a message is requested.
\value AttributeChanged
\value ContextHelpEnd Context help (QWhatsThis) for an object is finished.
\value ContextHelpStart Context help (QWhatsThis) for an object is initiated.
@@ -449,6 +450,30 @@ Q_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
\sa QAccessibleAttributesInterface
*/
+/*! \enum QAccessible::AnnouncementPriority
+ This enum describes the priority for announcements used by the
+ \l QAccessibleAnnouncementEvent.
+ \since 6.8
+
+ With \a QAccessible::AnouncementPriority::Polite, assistive technologies
+ should announce the message at the next graceful opportunity such as at the
+ end of speaking the current sentence or when the user pauses typing.
+
+ When specifying \a QAccessible::AnouncementPriority::Assertive, assistive
+ technologies should notify the user immediately.
+
+ Because an interruption might disorient users or cause them to not complete
+ their current task, \a QAccessible::AnouncementPriority::Assertive should
+ not be used unless the interruption is imperative.
+
+ \value Polite The announcement has normal priority.
+ \value Assertive The announcement has high priority and should notify
+ the user immediately, even if that means interrupting the user's
+ current task.
+
+ \sa QAccessibleAnnouncementEvent
+*/
+
/*!
\enum QAccessible::InterfaceType
@@ -1778,9 +1803,58 @@ QAccessibleTextSelectionEvent::~QAccessibleTextSelectionEvent()
{
}
+/*!
+ \since 6.8
+ \class QAccessibleAnnouncementEvent
+ \ingroup accessibility
+ \inmodule QtGui
+
+ \brief The QAccessibleAnnouncementEvent is used to request the announcement
+ of a given message by assistive technologies.
+
+ This class is used with \l QAccessible::updateAccessibility().
+*/
+
+/*! \fn QAccessibleAnnouncementEvent::QAccessibleAnnouncementEvent(QObject *object, const QString &message)
+
+ Constructs a new QAccessibleAnnouncementEvent event for \a object
+ to request the announcement of \a message with priority \l QAccessible::AnnouncementPriority::Polite.
+
+ \l QAccessibleAnnouncementEvent::setPriority can be used to adjust the priority.
+*/
+
+/*! \fn QAccessibleAnnouncementEvent::QAccessibleAnnouncementEvent(QAccessibleInterface *iface, const QString &message)
+
+ Constructs a new QAccessibleAnnouncementEvent event for \a iface
+ to request the announcement of \a message with priority \l QAccessible::AnnouncementPriority::Polite.
+
+ \l QAccessibleAnnouncementEvent::setPriority can be used to adjust the priority.
+*/
+
+/*! \fn QString QAccessibleAnnouncementEvent::message() const
+
+ Returns the message.
+*/
+
+/*! \fn QAccessible::AnnouncementPriority QAccessibleAnnouncementEvent::priority() const
+
+ Returns the priority.
+*/
+
+/*! \fn void QAccessibleAnnouncementEvent::setPriority(QAccessible::AnnouncementPriority priority)
+
+ Sets the priority with which the announcement will be requested to \a priority.
+*/
/*!
+ \internal
+*/
+QAccessibleAnnouncementEvent::~QAccessibleAnnouncementEvent()
+{
+}
+
+/*!
Returns the QAccessibleInterface associated with the event.
*/
QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
@@ -3118,7 +3192,7 @@ bool QAccessibleSelectionInterface::isSelected(QAccessibleInterface *childItem)
Attributes are key-value pairs. Values are stored in \l QVariant.
- The \a QAccessible::Attributes enumeration describes the available keys and
+ The \l QAccessible::Attribute enumeration describes the available keys and
documents which type to use for the value of each key.
While the text-specific attributes handled by \l QAccessibleTextInterface::attributes
@@ -3151,8 +3225,11 @@ QAccessibleAttributesInterface::~QAccessibleAttributesInterface()
Returns the value of the attribute \a key of this object.
- If the specificed attribute is not set for this object, an invalid
- \l QVariant is returned.
+ If the attribute is set for this object, a value of the type documented for the
+ given key in the documentation of the \l QAccessible::Attribute enumeration is
+ returned in the \l QVariant.
+
+ Otherwise, an invalid \l QVariant is returned.
*/
/*! \internal */
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 0a92e76c73..3d8daa4b3c 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -316,6 +316,7 @@ public:
Q_ASSERT(m_type != QAccessible::TextRemoved);
Q_ASSERT(m_type != QAccessible::TextUpdated);
Q_ASSERT(m_type != QAccessible::TableModelChanged);
+ Q_ASSERT(m_type != QAccessible::Announcement);
}
inline QAccessibleEvent(QAccessibleInterface *iface, QAccessible::Event typ)
@@ -330,6 +331,7 @@ public:
Q_ASSERT(m_type != QAccessible::TextRemoved);
Q_ASSERT(m_type != QAccessible::TextUpdated);
Q_ASSERT(m_type != QAccessible::TableModelChanged);
+ Q_ASSERT(m_type != QAccessible::Announcement);
m_uniqueId = QAccessible::uniqueId(iface);
m_object = iface->object();
}
@@ -605,6 +607,36 @@ protected:
int m_lastColumn;
};
+class Q_GUI_EXPORT QAccessibleAnnouncementEvent : public QAccessibleEvent
+{
+public:
+ inline QAccessibleAnnouncementEvent(QObject *object, const QString &message)
+ : QAccessibleEvent(object, QAccessible::InvalidEvent)
+ , m_message(message)
+ , m_priority(QAccessible::AnnouncementPriority::Polite)
+ {
+ m_type = QAccessible::Announcement;
+ }
+
+ inline QAccessibleAnnouncementEvent(QAccessibleInterface *iface, const QString &message)
+ : QAccessibleEvent(iface, QAccessible::InvalidEvent)
+ , m_message(message)
+ , m_priority(QAccessible::AnnouncementPriority::Polite)
+ {
+ m_type = QAccessible::Announcement;
+ }
+
+ ~QAccessibleAnnouncementEvent();
+
+ QString message() const { return m_message; }
+ QAccessible::AnnouncementPriority priority() const { return m_priority; }
+ void setPriority(QAccessible::AnnouncementPriority priority) { m_priority = priority; };
+
+protected:
+ QString m_message;
+ QAccessible::AnnouncementPriority m_priority;
+};
+
#ifndef Q_QDOC
#define QAccessibleInterface_iid "org.qt-project.Qt.QAccessibleInterface"
Q_DECLARE_INTERFACE(QAccessibleInterface, QAccessibleInterface_iid)
diff --git a/src/gui/accessible/qaccessible_base.h b/src/gui/accessible/qaccessible_base.h
index 2d2b1de316..1ca3dadc36 100644
--- a/src/gui/accessible/qaccessible_base.h
+++ b/src/gui/accessible/qaccessible_base.h
@@ -101,6 +101,7 @@ public:
HelpChanged = 0x80A0,
DefaultActionChanged = 0x80B0,
AcceleratorChanged = 0x80C0,
+ Announcement = 0x80D0,
InvalidEvent
};
@@ -367,6 +368,12 @@ public:
Level,
};
+ enum class AnnouncementPriority {
+ Polite,
+ Assertive
+ };
+ Q_ENUM(AnnouncementPriority)
+
typedef QAccessibleInterface*(*InterfaceFactory)(const QString &key, QObject*);
typedef void(*UpdateHandler)(QAccessibleEvent *event);
typedef void(*RootObjectHandler)(QObject*);
diff --git a/src/gui/accessible/qaccessiblebridge.cpp b/src/gui/accessible/qaccessiblebridge.cpp
index a8b54b0c68..0651c516ea 100644
--- a/src/gui/accessible/qaccessiblebridge.cpp
+++ b/src/gui/accessible/qaccessiblebridge.cpp
@@ -33,6 +33,8 @@ QT_BEGIN_NAMESPACE
Destroys the accessibility bridge object.
*/
+QAccessibleBridge::~QAccessibleBridge()
+ = default;
/*!
\fn void QAccessibleBridge::setRootObject(QAccessibleInterface *object)
diff --git a/src/gui/accessible/qaccessiblebridge.h b/src/gui/accessible/qaccessiblebridge.h
index 4d817c8e58..753f59597a 100644
--- a/src/gui/accessible/qaccessiblebridge.h
+++ b/src/gui/accessible/qaccessiblebridge.h
@@ -16,10 +16,10 @@ QT_BEGIN_NAMESPACE
class QAccessibleInterface;
class QAccessibleEvent;
-class QAccessibleBridge
+class Q_GUI_EXPORT QAccessibleBridge
{
public:
- virtual ~QAccessibleBridge() {}
+ virtual ~QAccessibleBridge();
virtual void setRootObject(QAccessibleInterface *) = 0;
virtual void notifyAccessibilityUpdate(QAccessibleEvent *event) = 0;
};
diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake
index e1d8efb292..da08863ac6 100644
--- a/src/gui/configure.cmake
+++ b/src/gui/configure.cmake
@@ -893,7 +893,7 @@ qt_feature("jpeg" PRIVATE
CONDITION QT_FEATURE_imageformatplugin
DISABLE INPUT_libjpeg STREQUAL 'no'
)
-qt_feature_definition("jpeg" "QT_NO_IMAGEFORMAT_JPEG" NEGATE)
+qt_feature_definition("jpeg" "QT_NO_IMAGEFORMAT_JPEG" NEGATE VALUE "1")
qt_feature("system-jpeg" PRIVATE
LABEL " Using system libjpeg"
CONDITION QT_FEATURE_jpeg AND JPEG_FOUND
diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp
index 2208cca1be..315c847c91 100644
--- a/src/gui/image/qbitmap.cpp
+++ b/src/gui/image/qbitmap.cpp
@@ -129,7 +129,6 @@ QBitmap::QBitmap(const QString& fileName, const char *format)
/*!
\fn void QBitmap::swap(QBitmap &other)
- \since 4.8
Swaps bitmap \a other with this bitmap. This operation is very
fast and never fails.
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 086ac37a07..07e646efa5 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -32,6 +32,33 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
+// Convenience class providing a bool read() function.
+namespace {
+class ImageReader
+{
+public:
+ ImageReader(const QString &fileName) : m_reader(fileName), m_atEnd(false) { }
+
+ QByteArray format() const { return m_reader.format(); }
+
+ bool read(QImage *image)
+ {
+ if (m_atEnd)
+ return false;
+ *image = m_reader.read();
+ if (!image->size().isValid()) {
+ m_atEnd = true;
+ return false;
+ }
+ m_atEnd = !m_reader.jumpToNextImage();
+ return true;
+ }
+
+private:
+ QImageReader m_reader;
+ bool m_atEnd;
+};
+} // namespace
/*!
\enum QIcon::Mode
@@ -150,7 +177,7 @@ void QPixmapIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode
painter->drawPixmap(rect, px);
}
-static inline int area(const QSize &s) { return s.width() * s.height(); }
+static inline qint64 area(const QSize &s) { return qint64(s.width()) * s.height(); }
// Returns the smallest of the two that is still larger than or equal to size.
// Pixmaps at the correct scale are preferred, pixmaps at lower scale are
@@ -160,15 +187,16 @@ static inline int area(const QSize &s) { return s.width() * s.height(); }
// the 2x pixmaps then.)
static QPixmapIconEngineEntry *bestSizeScaleMatch(const QSize &size, qreal scale, QPixmapIconEngineEntry *pa, QPixmapIconEngineEntry *pb)
{
-
+ const auto scaleA = pa->pixmap.devicePixelRatio();
+ const auto scaleB = pb->pixmap.devicePixelRatio();
// scale: we can only differentiate on scale if the scale differs
- if (pa->scale != pb->scale) {
+ if (scaleA != scaleB) {
// Score the pixmaps: 0 is an exact scale match, positive
// scores have more detail than requested, negative scores
// have less detail than requested.
- qreal ascore = pa->scale - scale;
- qreal bscore = pb->scale - scale;
+ qreal ascore = scaleA - scale;
+ qreal bscore = scaleB - scale;
// always prefer positive scores to prevent upscaling
if ((ascore < 0) != (bscore < 0))
@@ -177,18 +205,18 @@ static QPixmapIconEngineEntry *bestSizeScaleMatch(const QSize &size, qreal scale
return (qAbs(ascore) < qAbs(bscore)) ? pa : pb;
}
- int s = area(size);
+ qint64 s = area(size);
if (pa->size == QSize() && pa->pixmap.isNull()) {
pa->pixmap = QPixmap(pa->fileName);
pa->size = pa->pixmap.size();
}
- int a = area(pa->size);
+ qint64 a = area(pa->size);
if (pb->size == QSize() && pb->pixmap.isNull()) {
pb->pixmap = QPixmap(pb->fileName);
pb->size = pb->pixmap.size();
}
- int b = area(pb->size);
- int res = a;
+ qint64 b = area(pb->size);
+ qint64 res = a;
if (qMin(a,b) >= s)
res = qMin(a,b);
else
@@ -201,13 +229,14 @@ static QPixmapIconEngineEntry *bestSizeScaleMatch(const QSize &size, qreal scale
QPixmapIconEngineEntry *QPixmapIconEngine::tryMatch(const QSize &size, qreal scale, QIcon::Mode mode, QIcon::State state)
{
QPixmapIconEngineEntry *pe = nullptr;
- for (int i = 0; i < pixmaps.size(); ++i)
- if (pixmaps.at(i).mode == mode && pixmaps.at(i).state == state) {
+ for (auto &entry : pixmaps) {
+ if (entry.mode == mode && entry.state == state) {
if (pe)
- pe = bestSizeScaleMatch(size, scale, &pixmaps[i], pe);
+ pe = bestSizeScaleMatch(size, scale, &entry, pe);
else
- pe = &pixmaps[i];
+ pe = &entry;
}
+ }
return pe;
}
@@ -271,41 +300,32 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
QPixmap QPixmapIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)
{
-
QPixmap pm;
QPixmapIconEngineEntry *pe = bestMatch(size, scale, mode, state, false);
if (pe)
pm = pe->pixmap;
+ else
+ return pm;
if (pm.isNull()) {
- int idx = pixmaps.size();
- while (--idx >= 0) {
- if (pe == &pixmaps.at(idx)) {
- pixmaps.remove(idx);
- break;
- }
- }
+ removePixmapEntry(pe);
if (pixmaps.isEmpty())
return pm;
- else
- return pixmap(size, mode, state);
+ return scaledPixmap(size, mode, state, scale);
}
- QSize actualSize = pm.size();
- if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
- actualSize.scale(size, Qt::KeepAspectRatio);
-
+ const auto actualSize = adjustSize(size, pm.size());
QString key = "qt_"_L1
% HexString<quint64>(pm.cacheKey())
- % HexString<uint>(pe ? pe->mode : QIcon::Normal)
+ % HexString<quint8>(pe->mode)
% HexString<quint64>(QGuiApplication::palette().cacheKey())
% HexString<uint>(actualSize.width())
% HexString<uint>(actualSize.height());
if (mode == QIcon::Active) {
- if (QPixmapCache::find(key % HexString<uint>(mode), &pm))
+ if (QPixmapCache::find(key % HexString<quint8>(mode), &pm))
return pm; // horray
- if (QPixmapCache::find(key % HexString<uint>(QIcon::Normal), &pm)) {
+ if (QPixmapCache::find(key % HexString<quint8>(QIcon::Normal), &pm)) {
QPixmap active = pm;
if (QGuiApplication *guiApp = qobject_cast<QGuiApplication *>(qApp))
active = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(guiApp))->applyQIconStyleHelper(QIcon::Active, pm);
@@ -314,7 +334,7 @@ QPixmap QPixmapIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIc
}
}
- if (!QPixmapCache::find(key % HexString<uint>(mode), &pm)) {
+ if (!QPixmapCache::find(key % HexString<quint8>(mode), &pm)) {
if (pm.size() != actualSize)
pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
if (pe->mode != mode && mode != QIcon::Normal) {
@@ -324,7 +344,7 @@ QPixmap QPixmapIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIc
if (!generated.isNull())
pm = generated;
}
- QPixmapCache::insert(key % HexString<uint>(mode), pm);
+ QPixmapCache::insert(key % HexString<quint8>(mode), pm);
}
return pm;
}
@@ -341,12 +361,7 @@ QSize QPixmapIconEngine::actualSize(const QSize &size, QIcon::Mode mode, QIcon::
if (QPixmapIconEngineEntry *pe = bestMatch(size, scale, mode, state, true))
actualSize = pe->size;
- if (actualSize.isNull())
- return actualSize;
-
- if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
- actualSize.scale(size, Qt::KeepAspectRatio);
- return actualSize;
+ return adjustSize(size, actualSize);
}
QList<QSize> QPixmapIconEngine::availableSizes(QIcon::Mode mode, QIcon::State state)
@@ -369,7 +384,7 @@ void QPixmapIconEngine::addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon
{
if (!pixmap.isNull()) {
QPixmapIconEngineEntry *pe = tryMatch(pixmap.size(), pixmap.devicePixelRatio(), mode, state);
- if (pe && pe->size == pixmap.size() && pe->scale == pixmap.devicePixelRatio()) {
+ if (pe && pe->size == pixmap.size() && pe->pixmap.devicePixelRatio() == pixmap.devicePixelRatio()) {
pe->pixmap = pixmap;
pe->fileName.clear();
} else {
@@ -387,41 +402,13 @@ static inline int origIcoDepth(const QImage &image)
static inline int findBySize(const QList<QImage> &images, const QSize &size)
{
- for (int i = 0; i < images.size(); ++i) {
+ for (qsizetype i = 0; i < images.size(); ++i) {
if (images.at(i).size() == size)
return i;
}
return -1;
}
-// Convenience class providing a bool read() function.
-namespace {
-class ImageReader
-{
-public:
- ImageReader(const QString &fileName) : m_reader(fileName), m_atEnd(false) {}
-
- QByteArray format() const { return m_reader.format(); }
-
- bool read(QImage *image)
- {
- if (m_atEnd)
- return false;
- *image = m_reader.read();
- if (!image->size().isValid()) {
- m_atEnd = true;
- return false;
- }
- m_atEnd = !m_reader.jumpToNextImage();
- return true;
- }
-
-private:
- QImageReader m_reader;
- bool m_atEnd;
-};
-} // namespace
-
void QPixmapIconEngine::addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state)
{
if (fileName.isEmpty())
@@ -787,7 +774,6 @@ QIcon &QIcon::operator=(const QIcon &other)
/*!
\fn void QIcon::swap(QIcon &other)
- \since 4.8
Swaps icon \a other with this icon. This operation is very
fast and never fails.
@@ -805,7 +791,6 @@ QIcon::operator QVariant() const
Returns a number that identifies the contents of this QIcon
object. Distinct QIcon objects can have the same key if
they refer to the same contents.
- \since 4.3
The cacheKey() will change when the icon is altered via
addPixmap() or addFile().
@@ -862,7 +847,9 @@ QPixmap QIcon::pixmap(const QSize &size, Mode mode, State state) const
\since 6.0
Returns a pixmap with the requested \a size, \a devicePixelRatio, \a mode, and \a
- state, generating one if necessary.
+ state, generating one with the given \a mode and \a state if necessary. The pixmap
+ might be smaller than requested, but never larger, unless the device-pixel ratio
+ of the returned pixmap is larger than 1.
\sa actualSize(), paint()
*/
@@ -1113,6 +1100,7 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State
if (fileName.isEmpty())
return;
detach();
+ bool alreadyAdded = false;
if (!d) {
QFileInfo info(fileName);
@@ -1122,10 +1110,12 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State
suffix = QMimeDatabase().mimeTypeForFile(info).preferredSuffix(); // determination from contents
#endif // mimetype
QIconEngine *engine = iconEngineFromSuffix(fileName, suffix);
+ if (engine)
+ alreadyAdded = !engine->isNull();
d = new QIconPrivate(engine ? engine : new QPixmapIconEngine);
}
-
- d->engine->addFile(fileName, size, mode, state);
+ if (!alreadyAdded)
+ d->engine->addFile(fileName, size, mode, state);
// Check if a "@Nx" file exists and add it.
QString atNxFileName = qt_findAtNxFile(fileName, qApp->devicePixelRatio());
@@ -1134,8 +1124,6 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State
}
/*!
- \since 4.5
-
Returns a list of available icon sizes for the specified \a mode and
\a state.
*/
@@ -1147,8 +1135,6 @@ QList<QSize> QIcon::availableSizes(Mode mode, State state) const
}
/*!
- \since 4.7
-
Returns the name used to create the icon, if available.
Depending on the way the icon was created, it may have an associated
@@ -1164,8 +1150,6 @@ QString QIcon::name() const
}
/*!
- \since 4.6
-
Sets the search paths for icon themes to \a paths.
The content of \a paths should follow the theme format
@@ -1179,8 +1163,6 @@ void QIcon::setThemeSearchPaths(const QStringList &paths)
}
/*!
- \since 4.6
-
Returns the search paths for icon themes.
The default search paths will be defined by the platform.
@@ -1235,8 +1217,6 @@ void QIcon::setFallbackSearchPaths(const QStringList &paths)
}
/*!
- \since 4.6
-
Sets the current icon theme to \a name.
The theme will be will be looked up in themeSearchPaths().
@@ -1255,8 +1235,6 @@ void QIcon::setThemeName(const QString &name)
}
/*!
- \since 4.6
-
Returns the name of the current icon theme.
If not set, the current icon theme will be defined by the
@@ -1317,8 +1295,6 @@ void QIcon::setFallbackThemeName(const QString &name)
}
/*!
- \since 4.6
-
Returns the QIcon corresponding to \a name in the
\l{themeName()}{current icon theme}.
@@ -1388,8 +1364,6 @@ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback)
}
/*!
- \since 4.6
-
Returns \c true if there is an icon available for \a name in the
current icon theme or any of the fallbacks, as described by
fromTheme(), otherwise returns \c false.
@@ -1836,7 +1810,6 @@ bool QIcon::isMask() const
/*!
\fn QDataStream &operator<<(QDataStream &stream, const QIcon &icon)
\relates QIcon
- \since 4.2
Writes the given \a icon to the given \a stream as a PNG
image. If the icon contains more than one image, all images will
@@ -1877,7 +1850,6 @@ QDataStream &operator<<(QDataStream &s, const QIcon &icon)
/*!
\fn QDataStream &operator>>(QDataStream &stream, QIcon &icon)
\relates QIcon
- \since 4.2
Reads an image, or a set of images, from the given \a stream into
the given \a icon.
diff --git a/src/gui/image/qicon_p.h b/src/gui/image/qicon_p.h
index c5bf120620..8050d76435 100644
--- a/src/gui/image/qicon_p.h
+++ b/src/gui/image/qicon_p.h
@@ -34,7 +34,7 @@ public:
delete engine;
}
- qreal pixmapDevicePixelRatio(qreal displayDevicePixelRatio, const QSize &requestedSize, const QSize &actualSize);
+ static qreal pixmapDevicePixelRatio(qreal displayDevicePixelRatio, const QSize &requestedSize, const QSize &actualSize);
QIconEngine *engine;
@@ -49,24 +49,22 @@ public:
struct QPixmapIconEngineEntry
{
- QPixmapIconEngineEntry():scale(1), mode(QIcon::Normal), state(QIcon::Off){}
- QPixmapIconEngineEntry(const QPixmap &pm, QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off)
- :pixmap(pm), size(pm.size()), scale(pm.devicePixelRatio()), mode(m), state(s){}
- QPixmapIconEngineEntry(const QString &file, const QSize &sz = QSize(), QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off)
- :fileName(file), size(sz), scale(1), mode(m), state(s){}
- QPixmapIconEngineEntry(const QString &file, const QImage &image, QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off);
+ QPixmapIconEngineEntry() = default;
+ QPixmapIconEngineEntry(const QPixmap &pm, QIcon::Mode m, QIcon::State s)
+ : pixmap(pm), size(pm.size()), mode(m), state(s) {}
+ QPixmapIconEngineEntry(const QString &file, const QSize &sz, QIcon::Mode m, QIcon::State s)
+ : fileName(file), size(sz), mode(m), state(s) {}
+ QPixmapIconEngineEntry(const QString &file, const QImage &image, QIcon::Mode m, QIcon::State s);
QPixmap pixmap;
QString fileName;
QSize size;
- qreal scale;
- QIcon::Mode mode;
- QIcon::State state;
- bool isNull() const {return (fileName.isEmpty() && pixmap.isNull()); }
+ QIcon::Mode mode = QIcon::Normal;
+ QIcon::State state = QIcon::Off;
};
Q_DECLARE_TYPEINFO(QPixmapIconEngineEntry, Q_RELOCATABLE_TYPE);
inline QPixmapIconEngineEntry::QPixmapIconEngineEntry(const QString &file, const QImage &image, QIcon::Mode m, QIcon::State s)
- : fileName(file), size(image.size()), scale(image.devicePixelRatio()), mode(m), state(s)
+ : fileName(file), size(image.size()), mode(m), state(s)
{
pixmap.convertFromImage(image);
}
@@ -91,7 +89,24 @@ public:
bool read(QDataStream &in) override;
bool write(QDataStream &out) const override;
+ static inline QSize adjustSize(const QSize &expectedSize, QSize size)
+ {
+ if (!size.isNull() && (size.width() > expectedSize.width() || size.height() > expectedSize.height()))
+ size.scale(expectedSize, Qt::KeepAspectRatio);
+ return size;
+ }
+
private:
+ void removePixmapEntry(QPixmapIconEngineEntry *pe)
+ {
+ auto idx = pixmaps.size();
+ while (--idx >= 0) {
+ if (pe == &pixmaps.at(idx)) {
+ pixmaps.remove(idx);
+ return;
+ }
+ }
+ }
QPixmapIconEngineEntry *tryMatch(const QSize &size, qreal scale, QIcon::Mode mode, QIcon::State state);
QList<QPixmapIconEngineEntry> pixmaps;
diff --git a/src/gui/image/qiconengine.cpp b/src/gui/image/qiconengine.cpp
index 78273bdeb3..efcc3824ba 100644
--- a/src/gui/image/qiconengine.cpp
+++ b/src/gui/image/qiconengine.cpp
@@ -114,7 +114,6 @@ void QIconEngine::addFile(const QString &/*fileName*/, const QSize &/*size*/, QI
/*!
\enum QIconEngine::IconEngineHook
- \since 4.5
These enum values are used for virtual_hook() to allow additional
queries to icon engine without breaking binary compatibility.
@@ -224,8 +223,6 @@ bool QIconEngine::write(QDataStream &) const
}
/*!
- \since 4.5
-
Additional method to allow extending QIconEngine without
adding new virtual methods (and without breaking binary compatibility).
The actual action and format of \a data depends on \a id argument
@@ -249,8 +246,6 @@ void QIconEngine::virtual_hook(int id, void *data)
}
/*!
- \since 4.5
-
Returns sizes of all images that are contained in the engine for the
specific \a mode and \a state.
*/
@@ -260,8 +255,6 @@ QList<QSize> QIconEngine::availableSizes(QIcon::Mode /*mode*/, QIcon::State /*st
}
/*!
- \since 4.7
-
Returns the name used to create the engine, if available.
*/
QString QIconEngine::iconName()
diff --git a/src/gui/image/qiconengine.h b/src/gui/image/qiconengine.h
index 61411b0660..f5c5184608 100644
--- a/src/gui/image/qiconengine.h
+++ b/src/gui/image/qiconengine.h
@@ -18,6 +18,7 @@ public:
virtual ~QIconEngine();
virtual void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) = 0;
virtual QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state);
+ // ### Qt7: add qreal scale argument and remove scaledPixmap
virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state);
virtual void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state);
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 982b9a26b4..97735e4af6 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -137,6 +137,10 @@ void QIconLoader::invalidateKey()
// recreating the actual engine the next time the icon is used.
// We don't need to clear the QIcon cache itself.
m_themeKey++;
+
+ // invalidating the factory results in us looking once for
+ // a plugin that provides icon for the new themeName()
+ m_factory = std::nullopt;
}
QString QIconLoader::themeName() const
@@ -650,7 +654,18 @@ QIconEngine *QIconLoader::iconEngine(const QString &iconName) const
qCDebug(lcIconLoader) << "Resolving icon engine for icon" << iconName;
std::unique_ptr<QIconEngine> iconEngine;
- if (hasUserTheme())
+
+ if (!m_factory) {
+ qCDebug(lcIconLoader) << "Finding a plugin for theme" << themeName();
+ // try to find a plugin that supports the current theme
+ const int factoryIndex = qt_iconEngineFactoryLoader()->indexOf(themeName());
+ if (factoryIndex >= 0)
+ m_factory = qobject_cast<QIconEnginePlugin *>(qt_iconEngineFactoryLoader()->instance(factoryIndex));
+ }
+ if (m_factory && *m_factory)
+ iconEngine.reset(m_factory.value()->create(iconName));
+
+ if (hasUserTheme() && (!iconEngine || iconEngine->isNull()))
iconEngine.reset(new QIconLoaderEngine(iconName));
if (!iconEngine || iconEngine->isNull()) {
qCDebug(lcIconLoader) << "Icon is not available from theme or fallback theme.";
@@ -894,18 +909,15 @@ QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st
if (basePixmap.isNull())
basePixmap.load(filename);
- QSize actualSize = basePixmap.size();
// If the size of the best match we have (basePixmap) is larger than the
// requested size, we downscale it to match.
- if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
- actualSize.scale(size, Qt::KeepAspectRatio);
-
+ const auto actualSize = QPixmapIconEngine::adjustSize(size, basePixmap.size());
QString key = "$qt_theme_"_L1
- % HexString<qint64>(basePixmap.cacheKey())
- % HexString<int>(mode)
- % HexString<qint64>(QGuiApplication::palette().cacheKey())
- % HexString<int>(actualSize.width())
- % HexString<int>(actualSize.height());
+ % HexString<quint64>(basePixmap.cacheKey())
+ % HexString<quint8>(mode)
+ % HexString<quint64>(QGuiApplication::palette().cacheKey())
+ % HexString<uint>(actualSize.width())
+ % HexString<uint>(actualSize.height());
QPixmap cachedPixmap;
if (QPixmapCache::find(key, &cachedPixmap)) {
diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h
index 3cfa9381d1..4a8079a3e9 100644
--- a/src/gui/image/qiconloader_p.h
+++ b/src/gui/image/qiconloader_p.h
@@ -30,6 +30,7 @@
#include <vector>
#include <memory>
+#include <optional>
QT_BEGIN_NAMESPACE
@@ -161,6 +162,8 @@ public:
QList<QSharedPointer<QIconCacheGtkReader>> m_gtkCaches;
};
+class QIconEnginePlugin;
+
class Q_GUI_EXPORT QIconLoader
{
public:
@@ -195,6 +198,7 @@ private:
QThemeIconInfo lookupFallbackIcon(const QString &iconName) const;
uint m_themeKey;
+ mutable std::optional<QIconEnginePlugin *> m_factory;
bool m_supportsSvg;
bool m_initialized;
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 3bbf21320e..175ff8cc49 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1093,7 +1093,6 @@ QImage &QImage::operator=(const QImage &image)
/*!
\fn void QImage::swap(QImage &other)
- \since 4.8
Swaps image \a other with this image. This operation is very
fast and never fails.
@@ -1412,7 +1411,6 @@ int QImage::depth() const
}
/*!
- \since 4.6
\fn int QImage::colorCount() const
Returns the size of the color table for the image.
@@ -1676,7 +1674,6 @@ const uchar *QImage::scanLine(int i) const
shared pixel data, because the returned data is const.
\sa scanLine(), constBits()
- \since 4.7
*/
const uchar *QImage::constScanLine(int i) const
{
@@ -1732,7 +1729,6 @@ const uchar *QImage::bits() const
shared pixel data, because the returned data is const.
\sa bits(), constScanLine()
- \since 4.7
*/
const uchar *QImage::constBits() const
{
@@ -1839,7 +1835,6 @@ void QImage::fill(uint pixel)
/*!
\fn void QImage::fill(Qt::GlobalColor color)
\overload
- \since 4.8
Fills the image with the given \a color, described as a standard global
color.
@@ -1865,8 +1860,6 @@ void QImage::fill(Qt::GlobalColor color)
If the depth of the image is 8, the image will be filled with the
index corresponding the \a color in the color table if present; it
will otherwise be filled with 0.
-
- \since 4.8
*/
void QImage::fill(const QColor &color)
@@ -2123,7 +2116,6 @@ void QImage::invertPixels(InvertMode mode)
#endif
/*!
- \since 4.6
Resizes the color table to contain \a colorCount entries.
If the color table is expanded, all the extra colors will be set to
@@ -4331,6 +4323,12 @@ int QImage::metric(PaintDeviceMetric metric) const
return d->devicePixelRatio * QPaintDevice::devicePixelRatioFScale();
break;
+ case PdmDevicePixelRatioF_EncodedA:
+ Q_FALLTHROUGH();
+ case PdmDevicePixelRatioF_EncodedB:
+ return QPaintDevice::encodeMetricF(metric, d->devicePixelRatio);
+ break;
+
default:
qWarning("QImage::metric(): Unhandled metric type %d", metric);
break;
@@ -4607,7 +4605,6 @@ bool QImage::hasAlphaChannel() const
}
/*!
- \since 4.7
Returns the number of bit planes in the image.
The number of bit planes is the number of bits of color and
@@ -4702,6 +4699,8 @@ QImage QImage::smoothScaled(int w, int h) const
src.convertTo(QImage::Format_RGBA32FPx4_Premultiplied);
break;
#endif
+ case QImage::Format_CMYK8888:
+ break;
default:
if (src.hasAlphaChannel())
src.convertTo(QImage::Format_ARGB32_Premultiplied);
@@ -4844,6 +4843,9 @@ QImage Q_TRACE_INSTRUMENT(qtgui) QImage::transformed(const QTransform &matrix, Q
// with scaling smoothly more than 2x down.
if (hd * 2 < hs || wd * 2 < ws)
nonpaintable_scale_xform = true;
+ // We cannot paint on a CMYK image, so don't try to do so
+ if (format() == QImage::Format_CMYK8888)
+ nonpaintable_scale_xform = true;
} else {
if (mat.type() <= QTransform::TxRotate && mat.m11() == 0 && mat.m22() == 0) {
if (mat.m12() == 1. && mat.m21() == -1.)
@@ -4875,6 +4877,7 @@ QImage Q_TRACE_INSTRUMENT(qtgui) QImage::transformed(const QTransform &matrix, Q
case QImage::Format_RGBX64:
case QImage::Format_RGBA64_Premultiplied:
#endif
+ case QImage::Format_CMYK8888:
// Use smoothScaled for scaling when we can do so without conversion.
if (mat.m11() > 0.0F && mat.m22() > 0.0F)
return smoothScaled(wd, hd);
@@ -4945,7 +4948,7 @@ QImage Q_TRACE_INSTRUMENT(qtgui) QImage::transformed(const QTransform &matrix, Q
} else
memset(dImage.bits(), 0x00, dImage.d->nbytes);
- if (target_format >= QImage::Format_RGB32) {
+ if (target_format >= QImage::Format_RGB32 && target_format != QImage::Format_CMYK8888) {
// Prevent QPainter from applying devicePixelRatio corrections
QImage sImage = (devicePixelRatio() != 1) ? QImage(constBits(), width(), height(), format()) : *this;
if (sImage.d != d
@@ -5024,7 +5027,7 @@ void QImage::setColorSpace(const QColorSpace &colorSpace)
return;
if (d->colorSpace == colorSpace)
return;
- if (colorSpace.isValid() && !qt_compatibleColorModel(pixelFormat().colorModel(), colorSpace.colorModel()))
+ if (colorSpace.isValid() && !qt_compatibleColorModelSource(pixelFormat().colorModel(), colorSpace.colorModel()))
return;
detachMetadata(false);
@@ -5054,7 +5057,7 @@ void QImage::convertToColorSpace(const QColorSpace &colorSpace)
}
if (d->colorSpace == colorSpace)
return;
- if (!qt_compatibleColorModel(pixelFormat().colorModel(), colorSpace.colorModel())) {
+ if (!qt_compatibleColorModelTarget(pixelFormat().colorModel(), colorSpace.colorModel(), colorSpace.transformModel())) {
*this = convertedToColorSpace(colorSpace);
return;
}
@@ -5085,7 +5088,7 @@ void QImage::convertToColorSpace(const QColorSpace &colorSpace, QImage::Format f
qWarning() << "QImage::convertToColorSpace: Output colorspace is not valid";
return;
}
- if (!qt_compatibleColorModel(toPixelFormat(format).colorModel(), colorSpace.colorModel())) {
+ if (!qt_compatibleColorModelTarget(toPixelFormat(format).colorModel(), colorSpace.colorModel(), colorSpace.transformModel())) {
qWarning() << "QImage::convertToColorSpace: Color space is not compatible with format";
return;
}
@@ -5145,7 +5148,7 @@ QImage QImage::convertedToColorSpace(const QColorSpace &colorSpace, QImage::Form
qWarning() << "QImage::convertedToColorSpace: Output colorspace is not valid";
return QImage();
}
- if (!qt_compatibleColorModel(toPixelFormat(format).colorModel(), colorSpace.colorModel())) {
+ if (!qt_compatibleColorModelTarget(toPixelFormat(format).colorModel(), colorSpace.colorModel(), colorSpace.transformModel())) {
qWarning() << "QImage::convertedToColorSpace: Color space is not compatible with format";
return QImage();
}
@@ -5178,8 +5181,9 @@ void QImage::applyColorTransform(const QColorTransform &transform)
if (transform.isIdentity())
return;
- if (!qt_compatibleColorModel(pixelFormat().colorModel(), QColorTransformPrivate::get(transform)->colorSpaceIn->colorModel) ||
- !qt_compatibleColorModel(pixelFormat().colorModel(), QColorTransformPrivate::get(transform)->colorSpaceOut->colorModel)) {
+ if (!qt_compatibleColorModelSource(pixelFormat().colorModel(), QColorTransformPrivate::get(transform)->colorSpaceIn->colorModel) ||
+ !qt_compatibleColorModelTarget(pixelFormat().colorModel(), QColorTransformPrivate::get(transform)->colorSpaceOut->colorModel,
+ QColorTransformPrivate::get(transform)->colorSpaceOut->transformModel)) {
qWarning() << "QImage::applyColorTransform can not apply format switching transform without switching format";
return;
}
@@ -5239,14 +5243,14 @@ void QImage::applyColorTransform(const QColorTransform &transform)
transformSegment = [&](int yStart, int yEnd) {
for (int y = yStart; y < yEnd; ++y) {
uint8_t *scanline = reinterpret_cast<uint8_t *>(d->data + y * d->bytes_per_line);
- QColorTransformPrivate::get(transform)->applyGray(scanline, scanline, width(), flags);
+ QColorTransformPrivate::get(transform)->apply(scanline, scanline, width(), flags);
}
};
} else if (format() == Format_Grayscale16) {
transformSegment = [&](int yStart, int yEnd) {
for (int y = yStart; y < yEnd; ++y) {
uint16_t *scanline = reinterpret_cast<uint16_t *>(d->data + y * d->bytes_per_line);
- QColorTransformPrivate::get(transform)->applyGray(scanline, scanline, width(), flags);
+ QColorTransformPrivate::get(transform)->apply(scanline, scanline, width(), flags);
}
};
} else if (qt_fpColorPrecision(format())) {
@@ -5340,15 +5344,15 @@ QImage QImage::colorTransformed(const QColorTransform &transform) const &
if (transform.isIdentity())
return *this;
- QColorSpace::ColorModel inColorModel = QColorTransformPrivate::get(transform)->colorSpaceIn->colorModel;
- QColorSpace::ColorModel outColorModel = QColorTransformPrivate::get(transform)->colorSpaceOut->colorModel;
- if (!qt_compatibleColorModel(pixelFormat().colorModel(), inColorModel)) {
+ const QColorSpacePrivate *inColorSpace = QColorTransformPrivate::get(transform)->colorSpaceIn.constData();
+ const QColorSpacePrivate *outColorSpace = QColorTransformPrivate::get(transform)->colorSpaceOut.constData();
+ if (!qt_compatibleColorModelSource(pixelFormat().colorModel(), inColorSpace->colorModel)) {
qWarning() << "QImage::colorTransformed: Invalid input color space for transform";
return QImage();
}
- if (!qt_compatibleColorModel(pixelFormat().colorModel(), outColorModel)) {
+ if (!qt_compatibleColorModelTarget(pixelFormat().colorModel(), outColorSpace->colorModel, outColorSpace->transformModel)) {
// All model switching transforms are opaque in at least one end.
- switch (outColorModel) {
+ switch (outColorSpace->colorModel) {
case QColorSpace::ColorModel::Rgb:
return colorTransformed(transform, qt_highColorPrecision(format(), true) ? QImage::Format_RGBX64 : QImage::Format_RGB32);
case QColorSpace::ColorModel::Gray:
@@ -5427,13 +5431,13 @@ QImage QImage::colorTransformed(const QColorTransform &transform, QImage::Format
if (transform.isIdentity())
return convertedTo(toFormat, flags);
- QColorSpace::ColorModel inColorModel = QColorTransformPrivate::get(transform)->colorSpaceIn->colorModel;
- QColorSpace::ColorModel outColorModel = QColorTransformPrivate::get(transform)->colorSpaceOut->colorModel;
- if (!qt_compatibleColorModel(pixelFormat().colorModel(), inColorModel)) {
+ const QColorSpacePrivate *inColorSpace = QColorTransformPrivate::get(transform)->colorSpaceIn.constData();
+ const QColorSpacePrivate *outColorSpace = QColorTransformPrivate::get(transform)->colorSpaceOut.constData();
+ if (!qt_compatibleColorModelSource(pixelFormat().colorModel(), inColorSpace->colorModel)) {
qWarning() << "QImage::colorTransformed: Invalid input color space for transform";
return QImage();
}
- if (!qt_compatibleColorModel(toPixelFormat(toFormat).colorModel(), outColorModel)) {
+ if (!qt_compatibleColorModelTarget(toPixelFormat(toFormat).colorModel(), outColorSpace->colorModel, outColorSpace->transformModel)) {
qWarning() << "QImage::colorTransformed: Invalid output color space for transform";
return QImage();
}
@@ -5530,7 +5534,7 @@ QImage QImage::colorTransformed(const QColorTransform &transform, QImage::Format
for (int y = yStart; y < yEnd; ++y) {
const quint8 *in_scanline = reinterpret_cast<const quint8 *>(d->data + y * d->bytes_per_line);
QRgb *out_scanline = reinterpret_cast<QRgb *>(toImage.d->data + y * toImage.bytesPerLine());
- QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
}
};
} else {
@@ -5538,7 +5542,7 @@ QImage QImage::colorTransformed(const QColorTransform &transform, QImage::Format
for (int y = yStart; y < yEnd; ++y) {
const quint16 *in_scanline = reinterpret_cast<const quint16 *>(d->data + y * d->bytes_per_line);
QRgba64 *out_scanline = reinterpret_cast<QRgba64 *>(toImage.d->data + y * toImage.bytesPerLine());
- QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
}
};
}
@@ -5549,7 +5553,7 @@ QImage QImage::colorTransformed(const QColorTransform &transform, QImage::Format
for (int y = yStart; y < yEnd; ++y) {
const quint8 *in_scanline = reinterpret_cast<const quint8 *>(d->data + y * d->bytes_per_line);
QCmyk32 *out_scanline = reinterpret_cast<QCmyk32 *>(toImage.d->data + y * toImage.bytesPerLine());
- QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
}
};
} else {
@@ -5557,7 +5561,7 @@ QImage QImage::colorTransformed(const QColorTransform &transform, QImage::Format
for (int y = yStart; y < yEnd; ++y) {
const quint16 *in_scanline = reinterpret_cast<const quint16 *>(d->data + y * d->bytes_per_line);
QCmyk32 *out_scanline = reinterpret_cast<QCmyk32 *>(toImage.d->data + y * toImage.bytesPerLine());
- QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
}
};
}
@@ -5569,7 +5573,7 @@ QImage QImage::colorTransformed(const QColorTransform &transform, QImage::Format
for (int y = yStart; y < yEnd; ++y) {
const QRgb *in_scanline = reinterpret_cast<const QRgb *>(fromImage.constBits() + y * fromImage.bytesPerLine());
quint8 *out_scanline = reinterpret_cast<quint8 *>(toImage.d->data + y * toImage.bytesPerLine());
- QColorTransformPrivate::get(transform)->applyReturnGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
}
};
} else {
@@ -5578,7 +5582,7 @@ QImage QImage::colorTransformed(const QColorTransform &transform, QImage::Format
for (int y = yStart; y < yEnd; ++y) {
const QRgba64 *in_scanline = reinterpret_cast<const QRgba64 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
quint16 *out_scanline = reinterpret_cast<quint16 *>(toImage.d->data + y * toImage.bytesPerLine());
- QColorTransformPrivate::get(transform)->applyReturnGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
}
};
}
@@ -5589,7 +5593,7 @@ QImage QImage::colorTransformed(const QColorTransform &transform, QImage::Format
for (int y = yStart; y < yEnd; ++y) {
const QCmyk32 *in_scanline = reinterpret_cast<const QCmyk32 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
quint8 *out_scanline = reinterpret_cast<quint8 *>(toImage.d->data + y * toImage.bytesPerLine());
- QColorTransformPrivate::get(transform)->applyReturnGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
}
};
} else {
@@ -5597,7 +5601,7 @@ QImage QImage::colorTransformed(const QColorTransform &transform, QImage::Format
for (int y = yStart; y < yEnd; ++y) {
const QCmyk32 *in_scanline = reinterpret_cast<const QCmyk32 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
quint16 *out_scanline = reinterpret_cast<quint16 *>(toImage.d->data + y * toImage.bytesPerLine());
- QColorTransformPrivate::get(transform)->applyReturnGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
}
};
}
@@ -5701,11 +5705,11 @@ QImage QImage::colorTransformed(const QColorTransform &transform, QImage::Format
const quint8 *in_scanline = reinterpret_cast<const quint8 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
if (tmpFormat == Format_Grayscale8) {
quint8 *out_scanline = reinterpret_cast<quint8 *>(toImage.d->data + y * toImage.bytesPerLine());
- QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), transFlags);
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), transFlags);
} else {
Q_ASSERT(tmpFormat == Format_Grayscale16);
quint16 *out_scanline = reinterpret_cast<quint16 *>(toImage.d->data + y * toImage.bytesPerLine());
- QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), transFlags);
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), transFlags);
}
}
};
@@ -5714,7 +5718,7 @@ QImage QImage::colorTransformed(const QColorTransform &transform, QImage::Format
for (int y = yStart; y < yEnd; ++y) {
const quint16 *in_scanline = reinterpret_cast<const quint16 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
quint16 *out_scanline = reinterpret_cast<quint16 *>(toImage.d->data + y * toImage.bytesPerLine());
- QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), transFlags);
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), transFlags);
}
};
} else if (fromImage.format() == Format_CMYK8888) {
@@ -5808,15 +5812,15 @@ QImage QImage::colorTransformed(const QColorTransform &transform) &&
if (!d)
return QImage();
- QColorSpace::ColorModel inColorModel = QColorTransformPrivate::get(transform)->colorSpaceIn->colorModel;
- QColorSpace::ColorModel outColorModel = QColorTransformPrivate::get(transform)->colorSpaceOut->colorModel;
- if (!qt_compatibleColorModel(pixelFormat().colorModel(), inColorModel)) {
+ const QColorSpacePrivate *inColorSpace = QColorTransformPrivate::get(transform)->colorSpaceIn.constData();
+ const QColorSpacePrivate *outColorSpace = QColorTransformPrivate::get(transform)->colorSpaceOut.constData();
+ if (!qt_compatibleColorModelSource(pixelFormat().colorModel(), inColorSpace->colorModel)) {
qWarning() << "QImage::colorTransformed: Invalid input color space for transform";
return QImage();
}
- if (!qt_compatibleColorModel(pixelFormat().colorModel(), outColorModel)) {
+ if (!qt_compatibleColorModelTarget(pixelFormat().colorModel(), outColorSpace->colorModel, outColorSpace->transformModel)) {
// There is currently no inplace conversion of both colorspace and format, so just use the normal version.
- switch (outColorModel) {
+ switch (outColorSpace->colorModel) {
case QColorSpace::ColorModel::Rgb:
return colorTransformed(transform, qt_highColorPrecision(format(), true) ? QImage::Format_RGBX64 : QImage::Format_RGB32);
case QColorSpace::ColorModel::Gray:
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index a806954df2..8d9e0b87e2 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -1424,7 +1424,7 @@ static void convert_ARGB_to_gray8(QImageData *dest, const QImageData *src, Qt::I
for (int i = 0; i < src->height; ++i) {
const QRgb *src_line = reinterpret_cast<const QRgb *>(src_data);
- tfd->applyReturnGray(dest_data, src_line, src->width, flags);
+ tfd->apply(dest_data, src_line, src->width, flags);
src_data += sbpl;
dest_data += dbpl;
}
@@ -1461,7 +1461,7 @@ static void convert_ARGB_to_gray16(QImageData *dest, const QImageData *src, Qt::
const int len = std::min(src->width - j, BufferSize);
for (int k = 0; k < len; ++k)
tmp_line[k] = QRgba64::fromArgb32(src_line[j + k]);
- tfd->applyReturnGray(dest_line + j, tmp_line, len, flags);
+ tfd->apply(dest_line + j, tmp_line, len, flags);
j += len;
}
src_data += sbpl;
@@ -1498,7 +1498,7 @@ static void convert_RGBA64_to_gray8(QImageData *dest, const QImageData *src, Qt:
int j = 0;
while (j < src->width) {
const int len = std::min(src->width - j, BufferSize);
- tfd->applyReturnGray(gray_line, src_line + j, len, flags);
+ tfd->apply(gray_line, src_line + j, len, flags);
for (int k = 0; k < len; ++k)
dest_line[j + k] = qt_div_257(gray_line[k]);
j += len;
@@ -1533,7 +1533,7 @@ static void convert_RGBA64_to_gray16(QImageData *dest, const QImageData *src, Qt
for (int i = 0; i < src->height; ++i) {
const QRgba64 *src_line = reinterpret_cast<const QRgba64 *>(src_data);
quint16 *dest_line = reinterpret_cast<quint16 *>(dest_data);
- tfd->applyReturnGray(dest_line, src_line, src->width, flags);
+ tfd->apply(dest_line, src_line, src->width, flags);
src_data += sbpl;
dest_data += dbpl;
}
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 0d42f94253..43b03ada7c 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -456,7 +456,7 @@ inline QColorSpace::ColorModel qt_csColorData(QPixelFormat::ColorModel format)
return QColorSpace::ColorModel::Undefined;
}
-inline bool qt_compatibleColorModel(QPixelFormat::ColorModel data, QColorSpace::ColorModel cs)
+inline bool qt_compatibleColorModelBase(QPixelFormat::ColorModel data, QColorSpace::ColorModel cs)
{
QColorSpace::ColorModel dataCs = qt_csColorData(data);
@@ -466,11 +466,27 @@ inline bool qt_compatibleColorModel(QPixelFormat::ColorModel data, QColorSpace::
if (cs == QColorSpace::ColorModel::Undefined || dataCs == QColorSpace::ColorModel::Undefined)
return false;
- if (dataCs == cs)
- return true; // Matching color models
+ return (dataCs == cs); // Matching color models
+}
+
+inline bool qt_compatibleColorModelSource(QPixelFormat::ColorModel data, QColorSpace::ColorModel cs)
+{
+ if (qt_compatibleColorModelBase(data, cs))
+ return true;
+
+ if (data == QPixelFormat::ColorModel::Grayscale && cs == QColorSpace::ColorModel::Rgb)
+ return true; // Can apply Rgb CS to Gray input data
+
+ return false;
+}
+
+inline bool qt_compatibleColorModelTarget(QPixelFormat::ColorModel data, QColorSpace::ColorModel cs, QColorSpace::TransformModel tm)
+{
+ if (qt_compatibleColorModelBase(data, cs))
+ return true;
- if (dataCs == QColorSpace::ColorModel::Gray)
- return true; // Can apply any CS with white point to Gray data
+ if (data == QPixelFormat::ColorModel::Grayscale && tm == QColorSpace::TransformModel::ThreeComponentMatrix)
+ return true; // Can apply three-component matrix CS to gray output
return false;
}
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 9366e9cbb1..1f85fef3bd 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -800,8 +800,6 @@ QString QImageReader::fileName() const
}
/*!
- \since 4.2
-
Sets the quality setting of the image format to \a quality.
Some image formats, in particular lossy ones, entail a tradeoff between a)
@@ -825,8 +823,6 @@ void QImageReader::setQuality(int quality)
}
/*!
- \since 4.2
-
Returns the quality setting of the image format.
\sa setQuality()
@@ -856,8 +852,6 @@ QSize QImageReader::size() const
}
/*!
- \since 4.5
-
Returns the format of the image, without actually reading the image
contents. The format describes the image format \l QImageReader::read()
returns, not the format of the actual image.
@@ -876,8 +870,6 @@ QImage::Format QImageReader::imageFormat() const
}
/*!
- \since 4.1
-
Returns the text keys for this image. You can use
these keys with text() to list the image text for
a certain key.
@@ -894,8 +886,6 @@ QStringList QImageReader::textKeys() const
}
/*!
- \since 4.1
-
Returns the image text associated with \a key.
Support for this option is implemented through
@@ -985,8 +975,6 @@ QRect QImageReader::scaledClipRect() const
}
/*!
- \since 4.1
-
Sets the background color to \a color.
Image formats that support this operation are expected to
initialize the background to \a color before reading an image.
@@ -1000,8 +988,6 @@ void QImageReader::setBackgroundColor(const QColor &color)
}
/*!
- \since 4.1
-
Returns the background color that's used when reading an image.
If the image format does not support setting the background color
an invalid color is returned.
@@ -1016,8 +1002,6 @@ QColor QImageReader::backgroundColor() const
}
/*!
- \since 4.1
-
Returns \c true if the image format supports animation;
otherwise, false is returned.
@@ -1432,8 +1416,6 @@ QString QImageReader::errorString() const
}
/*!
- \since 4.2
-
Returns \c true if the reader supports \a option; otherwise returns
false.
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index d2176e4189..0fcc783e6d 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -588,8 +588,6 @@ QImageIOHandler::Transformations QImageWriter::transformation() const
}
/*!
- \since 4.1
-
Sets the image text associated with the key \a key to
\a text. This is useful for storing copyright information
or other information about the image. Example:
@@ -710,8 +708,6 @@ QString QImageWriter::errorString() const
}
/*!
- \since 4.2
-
Returns \c true if the writer supports \a option; otherwise returns
false.
diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp
index 0d13639d35..8fd62c2361 100644
--- a/src/gui/image/qmovie.cpp
+++ b/src/gui/image/qmovie.cpp
@@ -103,7 +103,6 @@
*/
/*! \fn void QMovie::frameChanged(int frameNumber)
- \since 4.1
This signal is emitted when the frame number has changed to
\a frameNumber. You can call currentImage() or currentPixmap() to get a
@@ -973,8 +972,6 @@ void QMovie::stop()
}
/*!
- \since 4.1
-
Returns the scaled size of frames.
\sa QImageReader::scaledSize()
@@ -986,8 +983,6 @@ QSize QMovie::scaledSize()
}
/*!
- \since 4.1
-
Sets the scaled frame size to \a size.
\sa QImageReader::setScaledSize()
@@ -999,8 +994,6 @@ void QMovie::setScaledSize(const QSize &size)
}
/*!
- \since 4.1
-
Returns the list of image formats supported by QMovie.
\sa QImageReader::supportedImageFormats()
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index da8c5ef1e5..0bc21a3e9f 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -925,7 +925,6 @@ QPicture& QPicture::operator=(const QPicture &p)
/*!
\fn void QPicture::swap(QPicture &other)
- \since 4.8
Swaps picture \a other with this picture. This operation is very
fast and never fails.
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 89b8d5303b..afef16f867 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -289,7 +289,6 @@ QPixmap QPixmap::copy(const QRect &rect) const
/*!
\fn QPixmap::scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed)
- \since 4.6
This convenience function is equivalent to calling QPixmap::scroll(\a dx,
\a dy, QRect(\a x, \a y, \a width, \a height), \a exposed).
@@ -298,8 +297,6 @@ QPixmap QPixmap::copy(const QRect &rect) const
*/
/*!
- \since 4.6
-
Scrolls the area \a rect of this pixmap by (\a dx, \a dy). The exposed
region is left unchanged. You can optionally pass a pointer to an empty
QRegion to get the region that is \a exposed by the scroll operation.
@@ -371,7 +368,6 @@ QPixmap &QPixmap::operator=(const QPixmap &pixmap)
/*!
\fn void QPixmap::swap(QPixmap &other)
- \since 4.8
Swaps pixmap \a other with this pixmap. This operation is very
fast and never fails.
@@ -970,12 +966,7 @@ bool QPixmap::isDetached() const
Passing 0 for \a flags sets all the default options. Returns \c true
if the result is that this pixmap is not null.
- Note: this function was part of Qt 3 support in Qt 4.6 and earlier.
- It has been promoted to official API status in 4.7 to support updating
- the pixmap's image without creating a new QPixmap as fromImage() would.
-
\sa fromImage()
- \since 4.7
*/
bool QPixmap::convertFromImage(const QImage &image, Qt::ImageConversionFlags flags)
{
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index 41563bf380..925ac37be4 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -88,6 +88,10 @@ int QBlittablePlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) con
return devicePixelRatio();
case QPaintDevice::PdmDevicePixelRatioScaled:
return devicePixelRatio() * QPaintDevice::devicePixelRatioFScale();
+ case QPaintDevice::PdmDevicePixelRatioF_EncodedA:
+ Q_FALLTHROUGH();
+ case QPaintDevice::PdmDevicePixelRatioF_EncodedB:
+ return QPaintDevice::encodeMetricF(metric, devicePixelRatio());
default:
qWarning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric);
break;
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 6e10bdd562..a261bb7b5c 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -253,6 +253,10 @@ int QRasterPlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const
return image.devicePixelRatio();
case QPaintDevice::PdmDevicePixelRatioScaled:
return image.devicePixelRatio() * QPaintDevice::devicePixelRatioFScale();
+ case QPaintDevice::PdmDevicePixelRatioF_EncodedA:
+ Q_FALLTHROUGH();
+ case QPaintDevice::PdmDevicePixelRatioF_EncodedB:
+ return QPaintDevice::encodeMetricF(metric, image.devicePixelRatio());
default:
qWarning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric);
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 45c9743f93..b0db1f48cb 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -81,7 +81,6 @@ static inline bool qt_pixmapcache_thread_test()
\brief The QPixmapCache::Key class can be used for efficient access
to the QPixmapCache.
\inmodule QtGui
- \since 4.6
Use QPixmapCache::insert() to receive an instance of Key generated
by the pixmap cache. You can store the key in your own objects for
@@ -421,8 +420,6 @@ QPixmapCacheEntry::~QPixmapCacheEntry()
If the pixmap is found, the function sets \a pixmap to that pixmap and
returns \c true; otherwise it leaves \a pixmap alone and returns \c false.
- \since 4.6
-
Example:
\snippet code/src_gui_image_qpixmapcache.cpp 1
*/
@@ -443,8 +440,6 @@ bool QPixmapCache::find(const QString &key, QPixmap *pixmap)
returns \c true; otherwise it leaves \a pixmap alone and returns \c false. If
the pixmap is not found, it means that the \a key is no longer valid,
so it will be released for the next insertion.
-
- \since 4.6
*/
bool QPixmapCache::find(const Key &key, QPixmap *pixmap)
{
@@ -498,8 +493,6 @@ bool QPixmapCache::insert(const QString &key, const QPixmap &pixmap)
deleted when more space is needed.
\sa setCacheLimit(), replace()
-
- \since 4.6
*/
QPixmapCache::Key QPixmapCache::insert(const QPixmap &pixmap)
{
@@ -523,8 +516,6 @@ QPixmapCache::Key QPixmapCache::insert(const QPixmap &pixmap)
the cache by this function.
\sa setCacheLimit(), insert()
-
- \since 4.6
*/
#endif // QT_DEPRECATED_SINCE(6, 6)
@@ -571,8 +562,6 @@ void QPixmapCache::remove(const QString &key)
/*!
Removes the pixmap associated with \a key from the cache and releases
the key for a future insertion.
-
- \since 4.6
*/
void QPixmapCache::remove(const Key &key)
{
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index c97374e975..1630103afe 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -107,6 +107,8 @@
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcPopup, "qt.gui.popup");
+
using namespace Qt::StringLiterals;
using namespace QtMiscUtils;
@@ -180,12 +182,15 @@ Q_CONSTINIT QClipboard *QGuiApplicationPrivate::qt_clipboard = nullptr;
Q_CONSTINIT QList<QScreen *> QGuiApplicationPrivate::screen_list;
Q_CONSTINIT QWindowList QGuiApplicationPrivate::window_list;
+Q_CONSTINIT QWindowList QGuiApplicationPrivate::popup_list;
+Q_CONSTINIT const QWindow *QGuiApplicationPrivate::active_popup_on_press = nullptr;
Q_CONSTINIT QWindow *QGuiApplicationPrivate::focus_window = nullptr;
Q_CONSTINIT static QBasicMutex applicationFontMutex;
Q_CONSTINIT QFont *QGuiApplicationPrivate::app_font = nullptr;
Q_CONSTINIT QStyleHints *QGuiApplicationPrivate::styleHints = nullptr;
Q_CONSTINIT bool QGuiApplicationPrivate::obey_desktop_settings = true;
+Q_CONSTINIT bool QGuiApplicationPrivate::popup_closed_on_press = false;
Q_CONSTINIT QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = nullptr;
@@ -960,6 +965,43 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking
return false;
}
+QWindow *QGuiApplicationPrivate::activePopupWindow()
+{
+ // might be the same as focusWindow() if that's a popup
+ return QGuiApplicationPrivate::popup_list.isEmpty() ?
+ nullptr : QGuiApplicationPrivate::popup_list.constLast();
+}
+
+void QGuiApplicationPrivate::activatePopup(QWindow *popup)
+{
+ if (!popup->isVisible())
+ return;
+ popup_list.removeOne(popup); // ensure that there's only one entry, and it's the last
+ qCDebug(lcPopup) << "appending popup" << popup << "to existing" << popup_list;
+ popup_list.append(popup);
+}
+
+bool QGuiApplicationPrivate::closePopup(QWindow *popup)
+{
+ const auto removed = QGuiApplicationPrivate::popup_list.removeAll(popup);
+ qCDebug(lcPopup) << "removed?" << removed << "popup" << popup << "; remaining" << popup_list;
+ return removed; // >= 1 if something was removed
+}
+
+/*!
+ Returns \c true if there are no more open popups.
+*/
+bool QGuiApplicationPrivate::closeAllPopups()
+{
+ // Close all popups: In case some popup refuses to close,
+ // we give up after 1024 attempts (to avoid an infinite loop).
+ int maxiter = 1024;
+ QWindow *popup;
+ while ((popup = activePopupWindow()) && maxiter--)
+ popup->close(); // this will call QApplicationPrivate::closePopup
+ return QGuiApplicationPrivate::popup_list.isEmpty();
+}
+
/*!
Returns the QWindow that receives events tied to focus,
such as key events.
@@ -1785,6 +1827,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
platform_integration = nullptr;
window_list.clear();
+ popup_list.clear();
screen_list.clear();
self = nullptr;
@@ -2306,6 +2349,14 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
}
#endif
+ const auto *activePopup = activePopupWindow();
+ if (type == QEvent::MouseButtonPress)
+ active_popup_on_press = activePopup;
+ if (window->d_func()->blockedByModalWindow && !activePopup) {
+ // a modal window is blocking this window, don't allow mouse events through
+ return;
+ }
+
QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, e->buttons, e->modifiers, e->source, device);
Q_ASSERT(devPriv->pointById(0) == persistentEPD); // we don't expect reallocation in QPlatformCursor::pointerEvenmt()
// restore globalLastPosition to avoid invalidating the velocity calculations,
@@ -2314,9 +2365,15 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
persistentEPD = nullptr; // incoming and synth events can cause reallocation during delivery, so don't use this again
// ev now contains a detached copy of the QEventPoint from QPointingDevicePrivate::activePoints
ev.setTimestamp(e->timestamp);
- if (window->d_func()->blockedByModalWindow && !qApp->d_func()->popupActive()) {
- // a modal window is blocking this window, don't allow mouse events through
- return;
+
+ if (activePopup && activePopup != window && (!popup_closed_on_press || type == QEvent::MouseButtonRelease)) {
+ // If the popup handles the event, we're done.
+ auto *handlingPopup = window->d_func()->forwardToPopup(&ev, active_popup_on_press);
+ if (handlingPopup) {
+ if (type == QEvent::MouseButtonPress)
+ active_popup_on_press = handlingPopup;
+ return;
+ }
}
if (doubleClick && (ev.type() == QEvent::MouseButtonPress)) {
@@ -2368,6 +2425,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
}
}
if (type == QEvent::MouseButtonRelease && e->buttons == Qt::NoButton) {
+ popup_closed_on_press = false;
if (auto *persistentEPD = devPriv->queryPointById(0)) {
ev.setExclusiveGrabber(persistentEPD->eventPoint, nullptr);
ev.clearPassiveGrabbers(persistentEPD->eventPoint);
@@ -2422,6 +2480,11 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
window = QGuiApplication::focusWindow();
}
+ if (!window) {
+ e->eventAccepted = false;
+ return;
+ }
+
#if defined(Q_OS_ANDROID)
static bool backKeyPressAccepted = false;
static bool menuKeyPressAccepted = false;
@@ -2430,7 +2493,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
#if !defined(Q_OS_MACOS)
// FIXME: Include OS X in this code path by passing the key event through
// QPlatformInputContext::filterEvent().
- if (e->keyType == QEvent::KeyPress && window) {
+ if (e->keyType == QEvent::KeyPress) {
if (QWindowSystemInterface::handleShortcutEvent(window, e->timestamp, e->key, e->modifiers,
e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers, e->unicode, e->repeat, e->repeatCount)) {
#if defined(Q_OS_ANDROID)
@@ -2447,9 +2510,16 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
e->unicode, e->repeat, e->repeatCount);
ev.setTimestamp(e->timestamp);
+ const auto *activePopup = activePopupWindow();
+ if (activePopup && activePopup != window) {
+ // If the popup handles the event, we're done.
+ if (window->d_func()->forwardToPopup(&ev, active_popup_on_press))
+ return;
+ }
+
// only deliver key events when we have a window, and no modal window is blocking this window
- if (window && !window->d_func()->blockedByModalWindow)
+ if (!window->d_func()->blockedByModalWindow)
QGuiApplication::sendSpontaneousEvent(window, &ev);
#ifdef Q_OS_ANDROID
else
@@ -2520,10 +2590,15 @@ void QGuiApplicationPrivate::processFocusWindowEvent(QWindowSystemInterfacePriva
if (previous == newFocus)
return;
- if (newFocus)
+ bool activatedPopup = false;
+ if (newFocus) {
if (QPlatformWindow *platformWindow = newFocus->handle())
if (platformWindow->isAlertState())
platformWindow->setAlertState(false);
+ activatedPopup = (newFocus->flags() & Qt::WindowType_Mask) == Qt::Popup;
+ if (activatedPopup)
+ activatePopup(newFocus);
+ }
QObject *previousFocusObject = previous ? previous->focusObject() : nullptr;
@@ -2538,8 +2613,7 @@ void QGuiApplicationPrivate::processFocusWindowEvent(QWindowSystemInterfacePriva
if (previous) {
Qt::FocusReason r = e->reason;
- if ((r == Qt::OtherFocusReason || r == Qt::ActiveWindowFocusReason) &&
- newFocus && (newFocus->flags() & Qt::Popup) == Qt::Popup)
+ if ((r == Qt::OtherFocusReason || r == Qt::ActiveWindowFocusReason) && activatedPopup)
r = Qt::PopupFocusReason;
QFocusEvent focusOut(QEvent::FocusOut, r);
QCoreApplication::sendSpontaneousEvent(previous, &focusOut);
@@ -2782,6 +2856,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
}
if (!window)
return;
+ active_popup_on_press = activePopupWindow();
pointData.target = window;
} else {
if (e->nullWindow()) {
@@ -2809,12 +2884,25 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
}
}
+ const auto *activePopup = activePopupWindow();
+ if (window->d_func()->blockedByModalWindow && !activePopup) {
+ // a modal window is blocking this window, don't allow events through
+ return;
+ }
+
QTabletEvent tabletEvent(type, device, local, e->global,
e->pressure, e->xTilt, e->yTilt,
e->tangentialPressure, e->rotation, e->z,
e->modifiers, button, e->buttons);
tabletEvent.setAccepted(false);
tabletEvent.setTimestamp(e->timestamp);
+
+ if (activePopup && activePopup != window) {
+ // If the popup handles the event, we're done.
+ if (window->d_func()->forwardToPopup(&tabletEvent, active_popup_on_press))
+ return;
+ }
+
QGuiApplication::sendSpontaneousEvent(window, &tabletEvent);
pointData.state = e->buttons;
if (!tabletEvent.isAccepted()
@@ -2987,6 +3075,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
if (!window)
window = QGuiApplication::topLevelAt(tempPt.globalPosition().toPoint());
QMutableEventPoint::setWindow(ep, window);
+ active_popup_on_press = activePopupWindow();
break;
case QEventPoint::State::Released:
@@ -3057,7 +3146,8 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
break;
}
- if (window->d_func()->blockedByModalWindow && !qApp->d_func()->popupActive()) {
+ const auto *activePopup = activePopupWindow();
+ if (window->d_func()->blockedByModalWindow && !activePopup) {
// a modal window is blocking this window, don't allow touch events through
// QTBUG-37371 temporary fix; TODO: revisit when we have a forwarding solution
@@ -3071,6 +3161,12 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
continue;
}
+ if (activePopup && activePopup != window) {
+ // If the popup handles the event, we're done.
+ if (window->d_func()->forwardToPopup(&touchEvent, active_popup_on_press))
+ return;
+ }
+
// Note: after the call to sendSpontaneousEvent, touchEvent.position() will have
// changed to reflect the local position inside the last (random) widget it tried
// to deliver the touch event to, and will therefore be invalid afterwards.
@@ -3447,6 +3543,15 @@ void QGuiApplicationPrivate::updatePalette()
}
}
+QEvent::Type QGuiApplicationPrivate::contextMenuEventType()
+{
+ switch (QGuiApplication::styleHints()->contextMenuTrigger()) {
+ case Qt::ContextMenuTrigger::Press: return QEvent::MouseButtonPress;
+ case Qt::ContextMenuTrigger::Release: return QEvent::MouseButtonRelease;
+ }
+ return QEvent::None;
+}
+
void QGuiApplicationPrivate::clearPalette()
{
delete app_pal;
@@ -4316,7 +4421,7 @@ const QColorTrcLut *QGuiApplicationPrivate::colorProfileForA8Text()
{
#ifdef Q_OS_WIN
if (!m_a8ColorProfile)
- m_a8ColorProfile = QColorTrcLut::fromGamma(2.31); // This is a hard-coded thing for Windows text rendering
+ m_a8ColorProfile = QColorTrcLut::fromGamma(2.31f); // This is a hard-coded thing for Windows text rendering
return m_a8ColorProfile.get();
#else
return colorProfileForA32Text();
@@ -4326,7 +4431,7 @@ const QColorTrcLut *QGuiApplicationPrivate::colorProfileForA8Text()
const QColorTrcLut *QGuiApplicationPrivate::colorProfileForA32Text()
{
if (!m_a32ColorProfile)
- m_a32ColorProfile = QColorTrcLut::fromGamma(fontSmoothingGamma);
+ m_a32ColorProfile = QColorTrcLut::fromGamma(float(fontSmoothingGamma));
return m_a32ColorProfile.get();
}
@@ -4392,6 +4497,9 @@ void *QGuiApplication::resolveInterface(const char *name, int revision) const
#if QT_CONFIG(wayland)
QT_NATIVE_INTERFACE_RETURN_IF(QWaylandApplication, platformNativeInterface());
#endif
+#if defined(Q_OS_VISIONOS)
+ QT_NATIVE_INTERFACE_RETURN_IF(QVisionOSApplication, platformIntegration);
+#endif
return QCoreApplication::resolveInterface(name, revision);
}
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 14bce88c62..23d7fb3d65 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -42,7 +42,7 @@ class Q_GUI_EXPORT QGuiApplication : public QCoreApplication
Q_PROPERTY(QString desktopFileName READ desktopFileName WRITE setDesktopFileName)
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection
NOTIFY layoutDirectionChanged)
- Q_PROPERTY(QString platformName READ platformName STORED false)
+ Q_PROPERTY(QString platformName READ platformName STORED false CONSTANT)
Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed
WRITE setQuitOnLastWindowClosed)
Q_PROPERTY(QScreen *primaryScreen READ primaryScreen NOTIFY primaryScreenChanged STORED false)
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index cca79534fc..81f616e773 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -196,8 +196,11 @@ public:
virtual Qt::WindowModality defaultModality() const;
virtual bool windowNeverBlocked(QWindow *window) const;
bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = nullptr) const;
- virtual bool popupActive() { return false; }
- virtual bool closeAllPopups() { return false; }
+ static qsizetype popupCount() { return QGuiApplicationPrivate::popup_list.size(); }
+ static QWindow *activePopupWindow();
+ static void activatePopup(QWindow *popup);
+ static bool closePopup(QWindow *popup);
+ static bool closeAllPopups();
static Qt::MouseButton mousePressButton;
static struct QLastCursorPosition {
@@ -258,6 +261,8 @@ public:
static QPalette *app_pal;
static QWindowList window_list;
+ static QWindowList popup_list;
+ static const QWindow *active_popup_on_press;
static QWindow *focus_window;
#ifndef QT_NO_CURSOR
@@ -270,6 +275,7 @@ public:
static QString styleOverride;
static QStyleHints *styleHints;
static bool obey_desktop_settings;
+ static bool popup_closed_on_press;
QInputMethod *inputMethod;
QString firstWindowTitle;
@@ -323,6 +329,8 @@ public:
static void updatePalette();
+ static QEvent::Type contextMenuEventType();
+
protected:
virtual void handleThemeChanged();
@@ -338,6 +346,7 @@ private:
static void clearPalette();
friend class QDragManager;
+ friend class QWindowPrivate;
static QGuiApplicationPrivate *self;
static int m_fakeMouseSourcePointId;
diff --git a/src/gui/kernel/qguiapplication_platform.h b/src/gui/kernel/qguiapplication_platform.h
index 545bf75c84..98e19427ae 100644
--- a/src/gui/kernel/qguiapplication_platform.h
+++ b/src/gui/kernel/qguiapplication_platform.h
@@ -32,6 +32,22 @@ struct wl_pointer;
struct wl_touch;
#endif
+#if defined(Q_OS_VISIONOS) || defined(Q_QDOC)
+# ifdef __OBJC__
+Q_FORWARD_DECLARE_OBJC_CLASS(CP_OBJECT_cp_layer_renderer_capabilities);
+typedef CP_OBJECT_cp_layer_renderer_capabilities *cp_layer_renderer_capabilities_t;
+Q_FORWARD_DECLARE_OBJC_CLASS(CP_OBJECT_cp_layer_renderer_configuration);
+typedef CP_OBJECT_cp_layer_renderer_configuration *cp_layer_renderer_configuration_t;
+Q_FORWARD_DECLARE_OBJC_CLASS(CP_OBJECT_cp_layer_renderer);
+typedef CP_OBJECT_cp_layer_renderer *cp_layer_renderer_t;
+# else
+typedef struct cp_layer_renderer_capabilities_s *cp_layer_renderer_capabilities_t;
+typedef struct cp_layer_renderer_configuration_s *cp_layer_renderer_configuration_t;
+typedef struct cp_layer_renderer_s *cp_layer_renderer_t;
+# endif
+#endif
+
+
QT_BEGIN_NAMESPACE
namespace QNativeInterface
@@ -61,6 +77,21 @@ struct Q_GUI_EXPORT QWaylandApplication
};
#endif
+#if defined(Q_OS_VISIONOS) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QVisionOSApplication
+{
+ QT_DECLARE_NATIVE_INTERFACE(QVisionOSApplication, 1, QGuiApplication)
+ struct ImmersiveSpaceCompositorLayer {
+ virtual void configure(cp_layer_renderer_capabilities_t, cp_layer_renderer_configuration_t) const {}
+ virtual void render(cp_layer_renderer_t) = 0;
+ virtual void handleSpatialEvents(const QJsonObject &) {};
+ };
+ virtual void setImmersiveSpaceCompositorLayer(ImmersiveSpaceCompositorLayer *layer) = 0;
+ virtual void openImmersiveSpace() = 0;
+ virtual void dismissImmersiveSpace() = 0;
+};
+#endif
+
} // QNativeInterface
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index fe72e7782f..78a1660355 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -78,7 +78,9 @@ static constexpr struct : QMetaTypeModuleHelper
// either two nullptrs from canConvert, or two valid pointers
Q_ASSERT(onlyCheck || (bool(from) && bool(to)));
+#if QT_CONFIG(shortcut)
using Int = int;
+#endif
switch (makePair(toTypeId, fromTypeId)) {
QMETATYPE_CONVERTER(QByteArray, QColor,
result = source.name(source.alpha() != 255 ?
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
index 189f31fd0a..d6deb8a72a 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -172,7 +172,7 @@ inline QMargins scale(const QMargins &margins, qreal scaleFactor, QPoint origin
template<typename T>
QList<T> scale(const QList<T> &list, qreal scaleFactor, QPoint origin = QPoint(0, 0))
{
- if (!QHighDpiScaling::isActive())
+ if (qFuzzyCompare(scaleFactor, qreal(1)))
return list;
QList<T> scaled;
@@ -184,7 +184,7 @@ QList<T> scale(const QList<T> &list, qreal scaleFactor, QPoint origin = QPoint(0
inline QRegion scale(const QRegion &region, qreal scaleFactor, QPoint origin = QPoint(0, 0))
{
- if (!QHighDpiScaling::isActive())
+ if (qFuzzyCompare(scaleFactor, qreal(1)))
return region;
QRegion scaled = region.translated(-origin);
diff --git a/src/gui/kernel/qpaintdevicewindow.cpp b/src/gui/kernel/qpaintdevicewindow.cpp
index 9e8c6ae5a8..8531aeed51 100644
--- a/src/gui/kernel/qpaintdevicewindow.cpp
+++ b/src/gui/kernel/qpaintdevicewindow.cpp
@@ -136,6 +136,11 @@ int QPaintDeviceWindow::metric(PaintDeviceMetric metric) const
case PdmDevicePixelRatioScaled:
return int(QWindow::devicePixelRatio() * devicePixelRatioFScale());
break;
+ case PdmDevicePixelRatioF_EncodedA:
+ Q_FALLTHROUGH();
+ case PdmDevicePixelRatioF_EncodedB:
+ return QPaintDevice::encodeMetricF(metric, QWindow::devicePixelRatio());
+ break;
default:
break;
}
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 256ea52f01..e308b796ab 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -958,7 +958,10 @@ static constexpr QPalette::ResolveMask allResolveMask()
/*!
Returns a new QPalette that is a union of this instance and \a other.
- Color roles set in this instance take precedence.
+ Color roles set in this instance take precedence. Roles that are not
+ set in this instance will be taken from \a other.
+
+ \sa isBrushSet
*/
QPalette QPalette::resolve(const QPalette &other) const
{
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index 48978b849a..3d1319615e 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -447,6 +447,11 @@ Qt::ColorScheme QPlatformTheme::colorScheme() const
return Qt::ColorScheme::Unknown;
}
+void QPlatformTheme::requestColorScheme(Qt::ColorScheme scheme)
+{
+ Q_UNUSED(scheme);
+}
+
const QPalette *QPlatformTheme::palette(Palette type) const
{
Q_D(const QPlatformTheme);
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index c0193947b9..d007a19675 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -295,6 +295,7 @@ public:
#endif
virtual Qt::ColorScheme colorScheme() const;
+ virtual void requestColorScheme(Qt::ColorScheme scheme);
virtual const QPalette *palette(Palette type = SystemPalette) const;
diff --git a/src/gui/kernel/qplatformwindow_p.h b/src/gui/kernel/qplatformwindow_p.h
index 2bbdfd5bf9..0bbddea722 100644
--- a/src/gui/kernel/qplatformwindow_p.h
+++ b/src/gui/kernel/qplatformwindow_p.h
@@ -58,6 +58,8 @@ struct Q_GUI_EXPORT QCocoaWindow
QT_DECLARE_NATIVE_INTERFACE(QCocoaWindow, 1, QWindow)
virtual void setContentBorderEnabled(bool enable) = 0;
virtual QPoint bottomLeftClippedByNSWindowOffset() const = 0;
+
+ virtual bool inLiveResize() const = 0;
};
#endif
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index 5029701f24..73c6199733 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -123,8 +123,29 @@ int QStyleHints::touchDoubleTapDistance() const
/*!
\property QStyleHints::colorScheme
- \brief the color scheme of the platform theme.
- \sa Qt::ColorScheme
+ \brief the color scheme used by the application.
+
+ By default, this follows the system's default color scheme (also known as appearance),
+ and changes when the system color scheme changes (e.g. during dusk or dawn).
+ Setting the color scheme to an explicit value will override the system setting and
+ ignore any changes to the system's color scheme. However, doing so is a hint to the
+ system, and overriding the color scheme is not supported on all platforms.
+
+ Resetting this property, or setting it to \l{Qt::ColorScheme::Unknown}, will remove
+ the override and make the application follow the system default again. The property
+ value will change to the color scheme the system currently has.
+
+ When this property changes, Qt will read the system palette and update the default
+ palette, but won't overwrite palette entries that have been explicitly set by the
+ application. When the colorSchemeChange() signal gets emitted, the old palette is
+ still in effect.
+
+ Application-specific colors should be selected to work well with the effective
+ palette, taking the current color scheme into account. To update application-
+ specific colors when the effective palette changes, handle
+ \l{QEvent::}{PaletteChange} or \l{QEvent::}{ApplicationPaletteChange} events.
+
+ \sa Qt::ColorScheme, QGuiApplication::palette(), QEvent::PaletteChange
\since 6.5
*/
Qt::ColorScheme QStyleHints::colorScheme() const
@@ -134,6 +155,30 @@ Qt::ColorScheme QStyleHints::colorScheme() const
}
/*!
+ \since 6.8
+
+ Sets the color scheme used by the application to an explicit \a scheme, or
+ revert to the system's current color scheme if \a scheme is Qt::ColorScheme::Unknown.
+*/
+void QStyleHints::setColorScheme(Qt::ColorScheme scheme)
+{
+ if (!QCoreApplication::instance()) {
+ qWarning("Must construct a QGuiApplication before accessing a platform theme hint.");
+ return;
+ }
+ if (QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ theme->requestColorScheme(scheme);
+}
+
+/*!
+ \fn void QStyleHints::unsetColorScheme()
+ \since 6.8
+
+ Restores the color scheme to the system's current color scheme.
+*/
+
+
+/*!
Sets the \a mousePressAndHoldInterval.
\internal
\sa mousePressAndHoldInterval()
@@ -398,6 +443,40 @@ void QStyleHints::setShowShortcutsInContextMenus(bool s)
}
/*!
+ \property QStyleHints::contextMenuTrigger
+ \since 6.8
+ \brief mouse event used to trigger a context menu event.
+
+ The default on UNIX systems is to show context menu on mouse button press event, while on
+ Windows it is the mouse button release event. This property can be used to override the default
+ platform behavior.
+
+ \note Developers must use this property with great care, as it changes the default interaction
+ mode that their users will expect on the platform that they are running on.
+
+ \sa Qt::ContextMenuTrigger
+*/
+Qt::ContextMenuTrigger QStyleHints::contextMenuTrigger() const
+{
+ Q_D(const QStyleHints);
+ if (d->m_contextMenuTrigger == -1) {
+ return themeableHint(QPlatformTheme::ContextMenuOnMouseRelease).toBool()
+ ? Qt::ContextMenuTrigger::Release
+ : Qt::ContextMenuTrigger::Press;
+ }
+ return Qt::ContextMenuTrigger(d->m_contextMenuTrigger);
+}
+
+void QStyleHints::setContextMenuTrigger(Qt::ContextMenuTrigger contextMenuTrigger)
+{
+ Q_D(QStyleHints);
+ const Qt::ContextMenuTrigger currentTrigger = this->contextMenuTrigger();
+ d->m_contextMenuTrigger = int(contextMenuTrigger);
+ if (currentTrigger != contextMenuTrigger)
+ emit contextMenuTriggerChanged(contextMenuTrigger);
+}
+
+/*!
\property QStyleHints::passwordMaskDelay
\brief the time, in milliseconds, a typed letter is displayed unshrouded
in a text input field in password mode.
diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h
index 969bec4b35..97ef59f3cf 100644
--- a/src/gui/kernel/qstylehints.h
+++ b/src/gui/kernel/qstylehints.h
@@ -36,6 +36,8 @@ class Q_GUI_EXPORT QStyleHints : public QObject
Q_PROPERTY(bool showIsMaximized READ showIsMaximized STORED false CONSTANT FINAL)
Q_PROPERTY(bool showShortcutsInContextMenus READ showShortcutsInContextMenus
WRITE setShowShortcutsInContextMenus NOTIFY showShortcutsInContextMenusChanged FINAL)
+ Q_PROPERTY(Qt::ContextMenuTrigger contextMenuTrigger READ contextMenuTrigger WRITE
+ setContextMenuTrigger NOTIFY contextMenuTriggerChanged FINAL)
Q_PROPERTY(int startDragDistance READ startDragDistance NOTIFY startDragDistanceChanged FINAL)
Q_PROPERTY(int startDragTime READ startDragTime NOTIFY startDragTimeChanged FINAL)
Q_PROPERTY(int startDragVelocity READ startDragVelocity STORED false CONSTANT FINAL)
@@ -52,7 +54,8 @@ class Q_GUI_EXPORT QStyleHints : public QObject
Q_PROPERTY(int mouseDoubleClickDistance READ mouseDoubleClickDistance STORED false CONSTANT
FINAL)
Q_PROPERTY(int touchDoubleTapDistance READ touchDoubleTapDistance STORED false CONSTANT FINAL)
- Q_PROPERTY(Qt::ColorScheme colorScheme READ colorScheme NOTIFY colorSchemeChanged FINAL)
+ Q_PROPERTY(Qt::ColorScheme colorScheme READ colorScheme WRITE setColorScheme
+ RESET unsetColorScheme NOTIFY colorSchemeChanged FINAL)
public:
void setMouseDoubleClickInterval(int mouseDoubleClickInterval);
@@ -79,6 +82,8 @@ public:
bool showIsMaximized() const;
bool showShortcutsInContextMenus() const;
void setShowShortcutsInContextMenus(bool showShortcutsInContextMenus);
+ Qt::ContextMenuTrigger contextMenuTrigger() const;
+ void setContextMenuTrigger(Qt::ContextMenuTrigger contextMenuTrigger);
int passwordMaskDelay() const;
QChar passwordMaskCharacter() const;
qreal fontSmoothingGamma() const;
@@ -94,6 +99,8 @@ public:
void setMouseQuickSelectionThreshold(int threshold);
int mouseQuickSelectionThreshold() const;
Qt::ColorScheme colorScheme() const;
+ void setColorScheme(Qt::ColorScheme scheme);
+ void unsetColorScheme() { setColorScheme(Qt::ColorScheme::Unknown); }
Q_SIGNALS:
void cursorFlashTimeChanged(int cursorFlashTime);
@@ -105,6 +112,7 @@ Q_SIGNALS:
void tabFocusBehaviorChanged(Qt::TabFocusBehavior tabFocusBehavior);
void useHoverEffectsChanged(bool useHoverEffects);
void showShortcutsInContextMenusChanged(bool);
+ void contextMenuTriggerChanged(Qt::ContextMenuTrigger contextMenuTrigger);
void wheelScrollLinesChanged(int scrollLines);
void mouseQuickSelectionThresholdChanged(int threshold);
void colorSchemeChanged(Qt::ColorScheme colorScheme);
diff --git a/src/gui/kernel/qstylehints_p.h b/src/gui/kernel/qstylehints_p.h
index 2b3979512a..497bf95cbf 100644
--- a/src/gui/kernel/qstylehints_p.h
+++ b/src/gui/kernel/qstylehints_p.h
@@ -35,6 +35,7 @@ public:
int m_tabFocusBehavior = -1;
int m_uiEffects = -1;
int m_showShortcutsInContextMenus = -1;
+ int m_contextMenuTrigger = -1;
int m_wheelScrollLines = -1;
int m_mouseQuickSelectionThreshold = -1;
int m_mouseDoubleClickDistance = -1;
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index b40fd7e8e8..cd3af8598d 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -27,6 +27,8 @@
#endif // QT_CONFIG(draganddrop)
#include <private/qevent_p.h>
+#include <private/qeventpoint_p.h>
+#include <private/qguiapplication_p.h>
#include <QtCore/QTimer>
#include <QtCore/QDebug>
@@ -37,6 +39,8 @@
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcPopup)
+
/*!
\class QWindow
\inmodule QtGui
@@ -186,6 +190,7 @@ QWindow::~QWindow()
// Decouple from parent before window goes under
setParent(nullptr);
QGuiApplicationPrivate::window_list.removeAll(this);
+ QGuiApplicationPrivate::popup_list.removeAll(this);
if (!QGuiApplicationPrivate::is_app_closing)
QGuiApplicationPrivate::instance()->modalWindowList.removeOne(this);
@@ -411,6 +416,13 @@ void QWindowPrivate::setVisible(bool visible)
QGuiApplicationPrivate::updateBlockedStatus(q);
}
+ if (q->type() == Qt::Popup) {
+ if (visible)
+ QGuiApplicationPrivate::activatePopup(q);
+ else
+ QGuiApplicationPrivate::closePopup(q);
+ }
+
#ifndef QT_NO_CURSOR
if (visible && (hasCursor || QGuiApplication::overrideCursor()))
applyCursor();
@@ -2361,8 +2373,13 @@ bool QWindow::close()
if (!isTopLevel())
return false;
- if (!d->platformWindow)
+ if (!d->platformWindow) {
+ // dock widgets can transition back and forth to being popups;
+ // avoid getting stuck
+ if (QGuiApplicationPrivate::activePopupWindow() == this)
+ QGuiApplicationPrivate::closePopup(this);
return true;
+ }
// The window might be deleted during close,
// as a result of delivering the close event.
@@ -2402,6 +2419,52 @@ bool QWindowPrivate::treatAsVisible() const
return q->isVisible();
}
+/*! \internal
+ Returns the popup window that has consumed \a event, if any.
+ \a activePopupOnPress is the window that we have observed previously handling the press.
+*/
+const QWindow *QWindowPrivate::forwardToPopup(QEvent *event, const QWindow */*activePopupOnPress*/)
+{
+ Q_Q(const QWindow);
+ qCDebug(lcPopup) << "checking for popup alternative to" << q << "for" << event
+ << "active popup?" << QGuiApplicationPrivate::activePopupWindow();
+ QWindow *ret = nullptr;
+ if (QWindow *popupWindow = QGuiApplicationPrivate::activePopupWindow()) {
+ if (q == popupWindow)
+ return nullptr; // avoid infinite recursion: we're already handling it
+ if (event->isPointerEvent()) {
+ // detach eventPoints before modifying them
+ QScopedPointer<QPointerEvent> pointerEvent(static_cast<QPointerEvent *>(event)->clone());
+ for (int i = 0; i < pointerEvent->pointCount(); ++i) {
+ QEventPoint &eventPoint = pointerEvent->point(i);
+ const QPoint globalPos = eventPoint.globalPosition().toPoint();
+ const QPointF mapped = popupWindow->mapFromGlobal(globalPos);
+ QMutableEventPoint::setPosition(eventPoint, mapped);
+ QMutableEventPoint::setScenePosition(eventPoint, mapped);
+ }
+
+ /* Popups are expected to be able to directly handle the
+ drag-release sequence after pressing to open, as well as
+ any other mouse events that occur within the popup's bounds. */
+ if (QCoreApplication::sendEvent(popupWindow, pointerEvent.get())) {
+ event->setAccepted(pointerEvent->isAccepted());
+ if (pointerEvent->isAccepted())
+ ret = popupWindow;
+ }
+ qCDebug(lcPopup) << q << "forwarded" << event->type() << "to popup" << popupWindow
+ << "handled?" << (ret != nullptr) << event->isAccepted();
+ return ret;
+ } else if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
+ if (QCoreApplication::sendEvent(popupWindow, event))
+ ret = popupWindow;
+ qCDebug(lcPopup) << q << "forwarded" << event->type() << "to popup" << popupWindow
+ << "handled?" << (ret != nullptr) << event->isAccepted();
+ return ret;
+ }
+ }
+ return ret;
+}
+
/*!
The expose event (\a ev) is sent by the window system when a window moves
between the un-exposed and exposed states.
@@ -2654,16 +2717,14 @@ bool QWindow::event(QEvent *ev)
This logic could be simplified by always synthesizing events in
QGuiApplicationPrivate, or perhaps even in each QPA plugin. See QTBUG-93486.
*/
- static const QEvent::Type contextMenuTrigger =
- QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::ContextMenuOnMouseRelease).toBool() ?
- QEvent::MouseButtonRelease : QEvent::MouseButtonPress;
auto asMouseEvent = [](QEvent *ev) {
const auto t = ev->type();
return t == QEvent::MouseButtonPress || t == QEvent::MouseButtonRelease
? static_cast<QMouseEvent *>(ev) : nullptr ;
};
- if (QMouseEvent *me = asMouseEvent(ev); me &&
- ev->type() == contextMenuTrigger && me->button() == Qt::RightButton) {
+ if (QMouseEvent *me = asMouseEvent(ev);
+ me && ev->type() == QGuiApplicationPrivate::contextMenuEventType()
+ && me->button() == Qt::RightButton) {
QContextMenuEvent e(QContextMenuEvent::Mouse, me->position().toPoint(),
me->globalPosition().toPoint(), me->modifiers());
QGuiApplication::sendEvent(this, &e);
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index f6c8aee9f6..b3722a6ed8 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -84,7 +84,7 @@ public:
Next,
Prev
};
- virtual void setFocusToTarget(QWindowPrivate::FocusTarget) {}
+ virtual void setFocusToTarget(FocusTarget, Qt::FocusReason) {}
virtual QRectF closestAcceptableGeometry(const QRectF &rect) const;
@@ -97,6 +97,8 @@ public:
virtual bool participatesInLastWindowClosed() const;
virtual bool treatAsVisible() const;
+ const QWindow *forwardToPopup(QEvent *event, const QWindow *activePopupOnPress);
+
bool isPopup() const { return (windowFlags & Qt::WindowType_Mask) == Qt::Popup; }
void setAutomaticPositionAndResizeEnabled(bool a)
{ positionAutomatic = resizeAutomatic = a; }
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 2304ee2256..3b709ec77b 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -50,6 +50,7 @@ public:
QScopedPointer<QImage> highDpiBackingstore;
QRegion staticContents;
QSize size;
+ QSize nativeSize;
bool downscale = qEnvironmentVariableIntValue("QT_WIDGETS_HIGHDPI_DOWNSCALE") > 0;
};
@@ -115,14 +116,13 @@ QWindow* QBackingStore::window() const
void QBackingStore::beginPaint(const QRegion &region)
{
- const qreal dpr = d_ptr->backingStoreDevicePixelRatio();
+ const qreal toNativeFactor = d_ptr->deviceIndependentToNativeFactor();
- if (d_ptr->highDpiBackingstore &&
- d_ptr->highDpiBackingstore->devicePixelRatio() != dpr)
+ if (d_ptr->nativeSize != QHighDpi::scale(size(), toNativeFactor))
resize(size());
QPlatformBackingStore *platformBackingStore = handle();
- platformBackingStore->beginPaint(QHighDpi::scale(region, d_ptr->deviceIndependentToNativeFactor()));
+ platformBackingStore->beginPaint(QHighDpi::scale(region, toNativeFactor));
// When QtGui is applying a high-dpi scale factor the backing store
// creates a "large" backing store image. This image needs to be
@@ -131,18 +131,20 @@ void QBackingStore::beginPaint(const QRegion &region)
// the image data to avoid having the new devicePixelRatio be propagated
// back to the platform plugin.
QPaintDevice *device = platformBackingStore->paintDevice();
- if (QHighDpiScaling::isActive() && device->devType() == QInternal::Image) {
+ if (!qFuzzyCompare(toNativeFactor, qreal(1)) && device->devType() == QInternal::Image) {
QImage *source = static_cast<QImage *>(device);
const bool needsNewImage = d_ptr->highDpiBackingstore.isNull()
- || source->data_ptr() != d_ptr->highDpiBackingstore->data_ptr()
+ || source->constBits() != d_ptr->highDpiBackingstore->constBits()
|| source->size() != d_ptr->highDpiBackingstore->size()
- || source->devicePixelRatio() != d_ptr->highDpiBackingstore->devicePixelRatio();
- if (needsNewImage) {
+ || source->bytesPerLine() != d_ptr->highDpiBackingstore->bytesPerLine()
+ || source->format() != d_ptr->highDpiBackingstore->format();
+ if (needsNewImage)
d_ptr->highDpiBackingstore.reset(
new QImage(source->bits(), source->width(), source->height(), source->bytesPerLine(), source->format()));
- d_ptr->highDpiBackingstore->setDevicePixelRatio(dpr);
- }
+ d_ptr->highDpiBackingstore->setDevicePixelRatio(d_ptr->backingStoreDevicePixelRatio());
+ } else {
+ d_ptr->highDpiBackingstore.reset();
}
}
@@ -156,7 +158,7 @@ QPaintDevice *QBackingStore::paintDevice()
{
QPaintDevice *device = handle()->paintDevice();
- if (QHighDpiScaling::isActive() && device->devType() == QInternal::Image)
+ if (!qFuzzyCompare(d_ptr->deviceIndependentToNativeFactor(), qreal(1)) && device->devType() == QInternal::Image)
return d_ptr->highDpiBackingstore.data();
return device;
@@ -229,9 +231,10 @@ void QBackingStore::flush(const QRegion &region, QWindow *window, const QPoint &
*/
void QBackingStore::resize(const QSize &size)
{
- d_ptr->size = size;
const qreal factor = d_ptr->deviceIndependentToNativeFactor();
- handle()->resize(QHighDpi::scale(size, factor), QHighDpi::scale(d_ptr->staticContents, factor));
+ d_ptr->size = size;
+ d_ptr->nativeSize = QHighDpi::scale(size, factor);
+ handle()->resize(d_ptr->nativeSize, QHighDpi::scale(d_ptr->staticContents, factor));
}
/*!
diff --git a/src/gui/painting/qbackingstorerhisupport.cpp b/src/gui/painting/qbackingstorerhisupport.cpp
index fe5589dc2d..37c52155eb 100644
--- a/src/gui/painting/qbackingstorerhisupport.cpp
+++ b/src/gui/painting/qbackingstorerhisupport.cpp
@@ -114,8 +114,8 @@ bool QBackingStoreRhiSupport::create()
if (QRhi::probe(QRhi::Metal, &params)) {
rhi = QRhi::create(QRhi::Metal, &params, flags);
} else {
- qCDebug(lcQpaBackingStore, "Metal does not seem to be supported. Falling back to OpenGL.");
- rhi = QRhi::create(QRhi::OpenGLES2, &params, flags);
+ qCDebug(lcQpaBackingStore, "Metal does not seem to be supported");
+ return false;
}
}
#endif
diff --git a/src/gui/painting/qcmyk_p.h b/src/gui/painting/qcmyk_p.h
index d00a4b5a6e..1294a18244 100644
--- a/src/gui/painting/qcmyk_p.h
+++ b/src/gui/painting/qcmyk_p.h
@@ -24,6 +24,10 @@ class QCmyk32
{
private:
uint m_cmyk = 0;
+ friend constexpr bool comparesEqual(const QCmyk32 &lhs, const QCmyk32 &rhs) noexcept
+ {
+ return lhs.m_cmyk == rhs.m_cmyk;
+ }
public:
QCmyk32() = default;
@@ -77,6 +81,8 @@ public:
QColor c = color.toCmyk();
return QCmyk32(c.cyan(), c.magenta(), c.yellow(), c.black());
}
+
+ Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QCmyk32)
};
static_assert(sizeof(QCmyk32) == sizeof(int));
diff --git a/src/gui/painting/qcolormatrix_p.h b/src/gui/painting/qcolormatrix_p.h
index 6a9b9f4f9a..0c85222a9a 100644
--- a/src/gui/painting/qcolormatrix_p.h
+++ b/src/gui/painting/qcolormatrix_p.h
@@ -336,6 +336,12 @@ public:
{ 0.1351922452f, 0.7118769884f, 0.0000000000f },
{ 0.0313525312f, 0.0000856627f, 0.8251883388f } };
}
+ static QColorMatrix toXyzFromBt2020()
+ {
+ return QColorMatrix { { 0.673447f, 0.279037f, -0.00192261f },
+ { 0.165665f, 0.675339f, 0.0299835f },
+ { 0.125092f, 0.0456238f, 0.797134f } };
+ }
friend inline bool comparesEqual(const QColorMatrix &lhs, const QColorMatrix &rhs);
Q_DECLARE_EQUALITY_COMPARABLE(QColorMatrix);
};
diff --git a/src/gui/painting/qcolorspace.cpp b/src/gui/painting/qcolorspace.cpp
index 7a1d34a408..3d763d577c 100644
--- a/src/gui/painting/qcolorspace.cpp
+++ b/src/gui/painting/qcolorspace.cpp
@@ -21,7 +21,7 @@ QT_BEGIN_NAMESPACE
Q_CONSTINIT QBasicMutex QColorSpacePrivate::s_lutWriteLock;
-Q_CONSTINIT static QAtomicPointer<QColorSpacePrivate> s_predefinedColorspacePrivates[QColorSpace::ProPhotoRgb] = {};
+Q_CONSTINIT static QAtomicPointer<QColorSpacePrivate> s_predefinedColorspacePrivates[QColorSpace::Bt2100Hlg] = {};
static void cleanupPredefinedColorspaces()
{
for (QAtomicPointer<QColorSpacePrivate> &ptr : s_predefinedColorspacePrivates) {
@@ -60,6 +60,12 @@ QColorSpacePrimaries::QColorSpacePrimaries(QColorSpace::Primaries primaries)
bluePoint = QPointF(0.0366, 0.0001);
whitePoint = QColorVector::D50Chromaticity();
break;
+ case QColorSpace::Primaries::Bt2020:
+ redPoint = QPointF(0.708, 0.292);
+ greenPoint = QPointF(0.170, 0.797);
+ bluePoint = QPointF(0.131, 0.046);
+ whitePoint = QColorVector::D65Chromaticity();
+ break;
default:
Q_UNREACHABLE();
}
@@ -132,6 +138,21 @@ QColorSpacePrivate::QColorSpacePrivate(QColorSpace::NamedColorSpace namedColorSp
transferFunction = QColorSpace::TransferFunction::ProPhotoRgb;
description = QStringLiteral("ProPhoto RGB");
break;
+ case QColorSpace::Bt2020:
+ primaries = QColorSpace::Primaries::Bt2020;
+ transferFunction = QColorSpace::TransferFunction::Bt2020;
+ description = QStringLiteral("BT.2020");
+ break;
+ case QColorSpace::Bt2100Pq:
+ primaries = QColorSpace::Primaries::Bt2020;
+ transferFunction = QColorSpace::TransferFunction::St2084;
+ description = QStringLiteral("BT.2100(PQ)");
+ break;
+ case QColorSpace::Bt2100Hlg:
+ primaries = QColorSpace::Primaries::Bt2020;
+ transferFunction = QColorSpace::TransferFunction::Hlg;
+ description = QStringLiteral("BT.2100(HLG)");
+ break;
default:
Q_UNREACHABLE();
}
@@ -292,6 +313,26 @@ void QColorSpacePrivate::identifyColorSpace()
}
}
break;
+ case QColorSpace::Primaries::Bt2020:
+ if (transferFunction == QColorSpace::TransferFunction::Bt2020) {
+ namedColorSpace = QColorSpace::Bt2020;
+ if (description.isEmpty())
+ description = QStringLiteral("BT.2020");
+ return;
+ }
+ if (transferFunction == QColorSpace::TransferFunction::St2084) {
+ namedColorSpace = QColorSpace::Bt2100Pq;
+ if (description.isEmpty())
+ description = QStringLiteral("BT.2100(PQ)");
+ return;
+ }
+ if (transferFunction == QColorSpace::TransferFunction::Hlg) {
+ namedColorSpace = QColorSpace::Bt2100Hlg;
+ if (description.isEmpty())
+ description = QStringLiteral("BT.2100(HLG)");
+ return;
+ }
+ break;
default:
break;
}
@@ -337,7 +378,7 @@ void QColorSpacePrivate::setTransferFunctionTable(const QList<uint16_t> &transfe
} else if (curve.isSRgb()) {
transferFunction = QColorSpace::TransferFunction::SRgb;
}
- trc[0].m_type = QColorTrc::Type::Function;
+ trc[0].m_type = QColorTrc::Type::ParameterizedFunction;
trc[0].m_fun = curve;
} else {
trc[0].m_type = QColorTrc::Type::Table;
@@ -363,21 +404,21 @@ void QColorSpacePrivate::setTransferFunctionTables(const QList<uint16_t> &redTra
transferFunction = QColorSpace::TransferFunction::Custom;
QColorTransferFunction curve;
if (redTable.asColorTransferFunction(&curve)) {
- trc[0].m_type = QColorTrc::Type::Function;
+ trc[0].m_type = QColorTrc::Type::ParameterizedFunction;
trc[0].m_fun = curve;
} else {
trc[0].m_type = QColorTrc::Type::Table;
trc[0].m_table = redTable;
}
if (greenTable.asColorTransferFunction(&curve)) {
- trc[1].m_type = QColorTrc::Type::Function;
+ trc[1].m_type = QColorTrc::Type::ParameterizedFunction;
trc[1].m_fun = curve;
} else {
trc[1].m_type = QColorTrc::Type::Table;
trc[1].m_table = greenTable;
}
if (blueTable.asColorTransferFunction(&curve)) {
- trc[2].m_type = QColorTrc::Type::Function;
+ trc[2].m_type = QColorTrc::Type::ParameterizedFunction;
trc[2].m_fun = curve;
} else {
trc[2].m_type = QColorTrc::Type::Table;
@@ -390,27 +431,34 @@ void QColorSpacePrivate::setTransferFunction()
{
switch (transferFunction) {
case QColorSpace::TransferFunction::Linear:
- trc[0].m_type = QColorTrc::Type::Function;
- trc[0].m_fun = QColorTransferFunction();
+ trc[0] = QColorTransferFunction();
if (qFuzzyIsNull(gamma))
gamma = 1.0f;
break;
case QColorSpace::TransferFunction::Gamma:
- trc[0].m_type = QColorTrc::Type::Function;
- trc[0].m_fun = QColorTransferFunction::fromGamma(gamma);
+ trc[0] = QColorTransferFunction::fromGamma(gamma);
break;
case QColorSpace::TransferFunction::SRgb:
- trc[0].m_type = QColorTrc::Type::Function;
- trc[0].m_fun = QColorTransferFunction::fromSRgb();
+ trc[0] = QColorTransferFunction::fromSRgb();
if (qFuzzyIsNull(gamma))
gamma = 2.31f;
break;
case QColorSpace::TransferFunction::ProPhotoRgb:
- trc[0].m_type = QColorTrc::Type::Function;
- trc[0].m_fun = QColorTransferFunction::fromProPhotoRgb();
+ trc[0] = QColorTransferFunction::fromProPhotoRgb();
if (qFuzzyIsNull(gamma))
gamma = 1.8f;
break;
+ case QColorSpace::TransferFunction::Bt2020:
+ trc[0] = QColorTransferFunction::fromBt2020();
+ if (qFuzzyIsNull(gamma))
+ gamma = 2.1f;
+ break;
+ case QColorSpace::TransferFunction::St2084:
+ trc[0] = QColorTransferGenericFunction::pq();
+ break;
+ case QColorSpace::TransferFunction::Hlg:
+ trc[0] = QColorTransferGenericFunction::hlg();
+ break;
case QColorSpace::TransferFunction::Custom:
break;
default:
@@ -448,11 +496,13 @@ QColorTransform QColorSpacePrivate::transformationToXYZ() const
transform.d = ptr;
ptr->colorSpaceIn = this;
ptr->colorSpaceOut = this;
- // Convert to XYZ relative to our white point, not the regular D50 white point.
if (isThreeComponentMatrix())
- ptr->colorMatrix = QColorMatrix::chromaticAdaptation(whitePoint).inverted() * toXyz;
+ ptr->colorMatrix = toXyz;
else
ptr->colorMatrix = QColorMatrix::identity();
+ // Convert to XYZ relative to our white point, not the regular D50 white point.
+ if (!chad.isNull())
+ ptr->colorMatrix = chad.inverted() * ptr->colorMatrix;
return transform;
}
@@ -526,6 +576,13 @@ void QColorSpacePrivate::clearElementListProcessingForEdit()
\l{http://www.color.org/chardata/rgb/DCIP3.xalter}{ICC registration of DCI-P3}
\value ProPhotoRgb The Pro Photo RGB color space, also known as ROMM RGB is a very wide gamut color space.
\l{http://www.color.org/chardata/rgb/rommrgb.xalter}{ICC registration of ROMM RGB}
+ \value [since 6.8] Bt2020 BT.2020, also known as Rec.2020 is a basic colorspace of HDR TVs.
+ \l{http://www.color.org/chardata/rgb/BT2020.xalter}{ICC registration of BT.2020}
+ \value [since 6.8] Bt2100Pq BT.2100(PQ), also known as Rec.2100 or HDR10 is an HDR encoding with the same
+ primaries as Bt2020 but using the Perceptual Quantizer transfer function.
+ \l{http://www.color.org/chardata/rgb/BT2100.xalter}{ICC registration of BT.2100}
+ \value [since 6.8] Bt2100Hlg BT.2100 (HLG) is an HDR encoding with the same
+ primaries as Bt2020 but using the Hybrid Log-Gamma transfer function.
*/
/*!
@@ -538,6 +595,7 @@ void QColorSpacePrivate::clearElementListProcessingForEdit()
\value AdobeRgb The Adobe RGB primaries
\value DciP3D65 The DCI-P3 primaries with the D65 whitepoint
\value ProPhotoRgb The ProPhoto RGB primaries with the D50 whitepoint
+ \value [since 6.8] Bt2020 The BT.2020 primaries with a D65 whitepoint
*/
/*!
@@ -550,6 +608,10 @@ void QColorSpacePrivate::clearElementListProcessingForEdit()
\value Gamma A transfer function that is a real gamma curve based on the value of gamma()
\value SRgb The sRGB transfer function, composed of linear and gamma parts
\value ProPhotoRgb The ProPhoto RGB transfer function, composed of linear and gamma parts
+ \value [since 6.8] Bt2020 The BT.2020 transfer function, composited of linear and gamma parts
+ \value [since 6.8] St2084 The SMPTE ST 2084 transfer function, also known Perceptual Quantizer(PQ).
+ \value [since 6.8] Hlg The Hybrid log-gamma transfer function.
+
*/
/*!
@@ -592,7 +654,7 @@ void QColorSpacePrivate::clearElementListProcessingForEdit()
*/
QColorSpace::QColorSpace(NamedColorSpace namedColorSpace)
{
- if (namedColorSpace < QColorSpace::SRgb || namedColorSpace > QColorSpace::ProPhotoRgb) {
+ if (namedColorSpace < QColorSpace::SRgb || namedColorSpace > QColorSpace::Bt2100Hlg) {
qWarning() << "QColorSpace attempted constructed from invalid QColorSpace::NamedColorSpace: " << int(namedColorSpace);
return;
}
@@ -1129,9 +1191,11 @@ bool QColorSpacePrivate::isValid() const noexcept
if (colorModel == QColorSpace::ColorModel::Gray) {
if (!trc[0].isValid())
return false;
- } else {
+ } else if (colorModel == QColorSpace::ColorModel::Rgb){
if (!trc[0].isValid() || !trc[1].isValid() || !trc[2].isValid())
return false;
+ } else {
+ return false;
}
return true;
}
@@ -1419,13 +1483,16 @@ QDebug operator<<(QDebug dbg, const QColorSpace &colorSpace)
if (colorSpace.d_ptr) {
if (colorSpace.d_ptr->namedColorSpace)
dbg << colorSpace.d_ptr->namedColorSpace << ", ";
+ else
+ dbg << colorSpace.colorModel() << ", ";
if (!colorSpace.isValid()) {
dbg << "Invalid";
if (!colorSpace.d_ptr->iccProfile.isEmpty())
dbg << " with profile data";
} else if (colorSpace.d_ptr->isThreeComponentMatrix()) {
dbg << colorSpace.primaries() << ", " << colorSpace.transferFunction();
- dbg << ", gamma=" << colorSpace.gamma();
+ if (colorSpace.transferFunction() == QColorSpace::TransferFunction::Gamma)
+ dbg << "=" << colorSpace.gamma();
} else {
if (colorSpace.d_ptr->isPcsLab)
dbg << "PCSLab, ";
diff --git a/src/gui/painting/qcolorspace.h b/src/gui/painting/qcolorspace.h
index 488cbd6a53..ecf6614561 100644
--- a/src/gui/painting/qcolorspace.h
+++ b/src/gui/painting/qcolorspace.h
@@ -26,7 +26,10 @@ public:
SRgbLinear,
AdobeRgb,
DisplayP3,
- ProPhotoRgb
+ ProPhotoRgb,
+ Bt2020,
+ Bt2100Pq,
+ Bt2100Hlg,
};
Q_ENUM(NamedColorSpace)
enum class Primaries {
@@ -34,7 +37,8 @@ public:
SRgb,
AdobeRgb,
DciP3D65,
- ProPhotoRgb
+ ProPhotoRgb,
+ Bt2020,
};
Q_ENUM(Primaries)
enum class TransferFunction {
@@ -42,7 +46,10 @@ public:
Linear,
Gamma,
SRgb,
- ProPhotoRgb
+ ProPhotoRgb,
+ Bt2020,
+ St2084,
+ Hlg,
};
Q_ENUM(TransferFunction)
enum class TransformModel : uint8_t {
diff --git a/src/gui/painting/qcolortransferfunction_p.h b/src/gui/painting/qcolortransferfunction_p.h
index 484cc69114..b9a09b4646 100644
--- a/src/gui/painting/qcolortransferfunction_p.h
+++ b/src/gui/painting/qcolortransferfunction_p.h
@@ -114,6 +114,11 @@ public:
return QColorTransferFunction(1.0f, 0.0f, 1.0f / 16.0f, 16.0f / 512.0f, 0.0f, 0.0f, 1.8f,
Hints(Hint::Calculated));
}
+ static QColorTransferFunction fromBt2020()
+ {
+ return QColorTransferFunction(1.0f / 1.0993f, 0.0993f / 1.0993f, 1.0f / 4.5f, 0.08145f, 0.0f, 0.0f, 2.2f,
+ Hints(Hint::Calculated));
+ }
bool matches(const QColorTransferFunction &o) const
{
return paramCompare(m_a, o.m_a) && paramCompare(m_b, o.m_b)
diff --git a/src/gui/painting/qcolortransfergeneric_p.h b/src/gui/painting/qcolortransfergeneric_p.h
new file mode 100644
index 0000000000..b4e6e8dec7
--- /dev/null
+++ b/src/gui/painting/qcolortransfergeneric_p.h
@@ -0,0 +1,109 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QCOLORTRANSFERGENERIC_P_H
+#define QCOLORTRANSFERGENERIC_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+#include <cmath>
+
+QT_BEGIN_NAMESPACE
+
+// Defines the a generic transfer function for our HDR functions
+class QColorTransferGenericFunction
+{
+public:
+ using ConverterPtr = float (*)(float);
+ constexpr QColorTransferGenericFunction(ConverterPtr toLinear = nullptr, ConverterPtr fromLinear = nullptr) noexcept
+ : m_toLinear(toLinear), m_fromLinear(fromLinear)
+ {}
+
+ static QColorTransferGenericFunction hlg()
+ {
+ return QColorTransferGenericFunction(hlgToLinear, hlgFromLinear);
+ }
+ static QColorTransferGenericFunction pq()
+ {
+ return QColorTransferGenericFunction(pqToLinear, pqFromLinear);
+ }
+
+ float apply(float x) const
+ {
+ return m_toLinear(x);
+ }
+
+ float applyInverse(float x) const
+ {
+ return m_fromLinear(x);
+ }
+
+ bool operator==(const QColorTransferGenericFunction &o) const noexcept
+ {
+ return m_toLinear == o.m_toLinear && m_fromLinear == o.m_fromLinear;
+ }
+ bool operator!=(const QColorTransferGenericFunction &o) const noexcept
+ {
+ return m_toLinear != o.m_toLinear || m_fromLinear != o.m_fromLinear;
+ }
+
+private:
+ ConverterPtr m_toLinear = nullptr;
+ ConverterPtr m_fromLinear = nullptr;
+
+ // HLG from linear [0-12] -> [0-1]
+ static float hlgFromLinear(float x)
+ {
+ if (x > 1.f)
+ return m_hlg_a * std::log(x - m_hlg_b) + m_hlg_c;
+ return std::sqrt(x * 0.25f);
+ }
+
+ // HLG to linear [0-1] -> [0-12]
+ static float hlgToLinear(float x)
+ {
+ if (x < 0.5f)
+ return (x * x) * 4.f;
+ return std::exp((x - m_hlg_c) / m_hlg_a) + m_hlg_b;
+ }
+
+ constexpr static float m_hlg_a = 0.17883277f;
+ constexpr static float m_hlg_b = 1.f - (4.f * m_hlg_a);
+ constexpr static float m_hlg_c = 0.55991073f; // 0.5 - a * ln(4 * a)
+
+ // PQ from linear [0-64] -> [0-1]
+ static float pqFromLinear(float x)
+ {
+ x = std::pow(x * (1.f / m_pq_f), (1.f / m_pq_m1));
+ return std::pow((m_pq_c1 - x) / (m_pq_c3 * x - m_pq_c2), (1.f / m_pq_m2));
+ }
+
+ // PQ from linear [0-1] -> [0-64]
+ static float pqToLinear(float x)
+ {
+ x = std::pow(x, m_pq_m1);
+ return std::pow((m_pq_c1 + m_pq_c2 * x) / (1.f + m_pq_c3 * x), m_pq_m2) * m_pq_f;
+ }
+
+ constexpr static float m_pq_c1 = 107.f / 128.f; // c3 - c2 + 1
+ constexpr static float m_pq_c2 = 2413.f / 128.f;
+ constexpr static float m_pq_c3 = 2392.f / 128.f;
+ constexpr static float m_pq_m1 = 1305.f / 8192.f;
+ constexpr static float m_pq_m2 = 2523.f / 32.f;
+ constexpr static float m_pq_f = 64.f; // This might need to be set based on scene metadata
+};
+
+QT_END_NAMESPACE
+
+#endif // QCOLORTRANSFERGENERIC_P_H
diff --git a/src/gui/painting/qcolortransform.cpp b/src/gui/painting/qcolortransform.cpp
index aac07bdc09..f54dac9f26 100644
--- a/src/gui/painting/qcolortransform.cpp
+++ b/src/gui/painting/qcolortransform.cpp
@@ -22,16 +22,6 @@
QT_BEGIN_NAMESPACE
-std::shared_ptr<QColorTrcLut> lutFromTrc(const QColorTrc &trc)
-{
- if (trc.m_type == QColorTrc::Type::Table)
- return QColorTrcLut::fromTransferTable(trc.m_table);
- if (trc.m_type == QColorTrc::Type::Function)
- return QColorTrcLut::fromTransferFunction(trc.m_fun);
- qWarning() << "TRC uninitialized";
- return nullptr;
-}
-
void QColorTransformPrivate::updateLutsIn() const
{
if (colorSpaceIn->lut.generated.loadAcquire())
@@ -46,12 +36,12 @@ void QColorTransformPrivate::updateLutsIn() const
}
if (colorSpaceIn->trc[0] == colorSpaceIn->trc[1] && colorSpaceIn->trc[0] == colorSpaceIn->trc[2]) {
- colorSpaceIn->lut[0] = lutFromTrc(colorSpaceIn->trc[0]);
+ colorSpaceIn->lut[0] = QColorTrcLut::fromTrc(colorSpaceIn->trc[0]);
colorSpaceIn->lut[1] = colorSpaceIn->lut[0];
colorSpaceIn->lut[2] = colorSpaceIn->lut[0];
} else {
for (int i = 0; i < 3; ++i)
- colorSpaceIn->lut[i] = lutFromTrc(colorSpaceIn->trc[i]);
+ colorSpaceIn->lut[i] = QColorTrcLut::fromTrc(colorSpaceIn->trc[i]);
}
colorSpaceIn->lut.generated.storeRelease(1);
@@ -70,12 +60,12 @@ void QColorTransformPrivate::updateLutsOut() const
}
if (colorSpaceOut->trc[0] == colorSpaceOut->trc[1] && colorSpaceOut->trc[0] == colorSpaceOut->trc[2]) {
- colorSpaceOut->lut[0] = lutFromTrc(colorSpaceOut->trc[0]);
+ colorSpaceOut->lut[0] = QColorTrcLut::fromTrc(colorSpaceOut->trc[0]);
colorSpaceOut->lut[1] = colorSpaceOut->lut[0];
colorSpaceOut->lut[2] = colorSpaceOut->lut[0];
} else {
for (int i = 0; i < 3; ++i)
- colorSpaceOut->lut[i] = lutFromTrc(colorSpaceOut->trc[i]);
+ colorSpaceOut->lut[i] = QColorTrcLut::fromTrc(colorSpaceOut->trc[i]);
}
colorSpaceOut->lut.generated.storeRelease(1);
@@ -390,6 +380,14 @@ template<>
inline int getAlpha<QRgba64>(const QRgba64 &p)
{ return p.alpha(); }
+template<typename T>
+static inline constexpr int getFactor();
+template<>
+inline constexpr int getFactor<QRgb>()
+{ return 255; }
+template<>
+inline constexpr int getFactor<QRgba64>()
+{ return 65535; }
#endif
template<typename T>
@@ -823,8 +821,9 @@ static void storePremultiplied(D *dst, const S *src, const QColorVector *buffer,
const __m128 vTrcRes = _mm_set1_ps(float(QColorTrcLut::Resolution));
const __m128 iFF00 = _mm_set1_ps(1.0f / (255 * 256));
constexpr bool isARGB = isArgb<D>();
+ static_assert(getFactor<D>() >= getFactor<S>());
for (qsizetype i = 0; i < len; ++i) {
- const int a = getAlpha<S>(src[i]);
+ const int a = getAlpha<S>(src[i]) * (getFactor<D>() / getFactor<S>());
__m128 vf = _mm_loadu_ps(&buffer[i].x);
__m128i v = _mm_cvtps_epi32(_mm_mul_ps(vf, vTrcRes));
__m128 va = _mm_mul_ps(_mm_set1_ps(a), iFF00);
@@ -905,8 +904,9 @@ static void storeUnpremultiplied(D *dst, const S *src, const QColorVector *buffe
{
const __m128 vTrcRes = _mm_set1_ps(float(QColorTrcLut::Resolution));
constexpr bool isARGB = isArgb<D>();
+ static_assert(getFactor<D>() >= getFactor<S>());
for (qsizetype i = 0; i < len; ++i) {
- const int a = getAlpha<S>(src[i]);
+ const int a = getAlpha<S>(src[i]) * (getFactor<D>() / getFactor<S>());
__m128 vf = _mm_loadu_ps(&buffer[i].x);
__m128i v = _mm_cvtps_epi32(_mm_mul_ps(vf, vTrcRes));
const int ridx = _mm_extract_epi16(v, 0);
@@ -1029,8 +1029,9 @@ static void storePremultiplied(D *dst, const S *src, const QColorVector *buffer,
{
const float iFF00 = 1.0f / (255 * 256);
constexpr bool isARGB = isArgb<D>();
+ static_assert(getFactor<D>() >= getFactor<S>());
for (qsizetype i = 0; i < len; ++i) {
- const int a = getAlpha<S>(src[i]);
+ const int a = getAlpha<S>(src[i]) * (getFactor<D>() / getFactor<S>());
float32x4_t vf = vld1q_f32(&buffer[i].x);
uint32x4_t v = vcvtq_u32_f32(vaddq_f32(vmulq_n_f32(vf, float(QColorTrcLut::Resolution)), vdupq_n_f32(0.5f)));
const int ridx = vgetq_lane_u32(v, 0);
@@ -1073,8 +1074,9 @@ static void storeUnpremultiplied(D *dst, const S *src, const QColorVector *buffe
const QColorTransformPrivate *d_ptr)
{
constexpr bool isARGB = isArgb<D>();
+ static_assert(getFactor<D>() >= getFactor<S>());
for (qsizetype i = 0; i < len; ++i) {
- const int a = getAlpha<S>(src[i]);
+ const int a = getAlpha<S>(src[i]) * (getFactor<D>() / getFactor<S>());
float32x4_t vf = vld1q_f32(&buffer[i].x);
uint16x4_t v = vmovn_u32(vcvtq_u32_f32(vaddq_f32(vmulq_n_f32(vf, float(QColorTrcLut::Resolution)), vdupq_n_f32(0.5f))));
const int ridx = vget_lane_u16(v, 0);
@@ -1219,17 +1221,41 @@ static void storeOpaque(QRgbaFloat32 *dst, const QColorVector *buffer, const qsi
static void loadGray(QColorVector *buffer, const quint8 *src, const qsizetype len, const QColorTransformPrivate *d_ptr)
{
- for (qsizetype i = 0; i < len; ++i) {
- const float y = d_ptr->colorSpaceIn->lut[0]->u8ToLinearF32(src[i]);
- buffer[i] = d_ptr->colorSpaceIn->whitePoint * y;
+ if (d_ptr->colorSpaceIn->colorModel == QColorSpace::ColorModel::Gray ||
+ (d_ptr->colorSpaceIn->lut[0] == d_ptr->colorSpaceIn->lut[1] &&
+ d_ptr->colorSpaceIn->lut[0] == d_ptr->colorSpaceIn->lut[2])) {
+ for (qsizetype i = 0; i < len; ++i) {
+ const float y = d_ptr->colorSpaceIn->lut[0]->u8ToLinearF32(src[i]);
+ buffer[i] = d_ptr->colorSpaceIn->whitePoint * y;
+ }
+ } else {
+ for (qsizetype i = 0; i < len; ++i) {
+ QColorVector v;
+ v.x = d_ptr->colorSpaceIn->lut[0]->u8ToLinearF32(src[i]);
+ v.y = d_ptr->colorSpaceIn->lut[1]->u8ToLinearF32(src[i]);
+ v.z = d_ptr->colorSpaceIn->lut[2]->u8ToLinearF32(src[i]);
+ buffer[i] = d_ptr->colorSpaceIn->toXyz.map(v);
+ }
}
}
static void loadGray(QColorVector *buffer, const quint16 *src, const qsizetype len, const QColorTransformPrivate *d_ptr)
{
- for (qsizetype i = 0; i < len; ++i) {
- const float y = d_ptr->colorSpaceIn->lut[0]->u16ToLinearF32(src[i]);
- buffer[i] = d_ptr->colorSpaceIn->whitePoint * y;
+ if (d_ptr->colorSpaceIn->colorModel == QColorSpace::ColorModel::Gray ||
+ (d_ptr->colorSpaceIn->lut[0] == d_ptr->colorSpaceIn->lut[1] &&
+ d_ptr->colorSpaceIn->lut[0] == d_ptr->colorSpaceIn->lut[2])) {
+ for (qsizetype i = 0; i < len; ++i) {
+ const float y = d_ptr->colorSpaceIn->lut[0]->u16ToLinearF32(src[i]);
+ buffer[i] = d_ptr->colorSpaceIn->whitePoint * y;
+ }
+ } else {
+ for (qsizetype i = 0; i < len; ++i) {
+ QColorVector v;
+ v.x = d_ptr->colorSpaceIn->lut[0]->u16ToLinearF32(src[i]);
+ v.y = d_ptr->colorSpaceIn->lut[1]->u16ToLinearF32(src[i]);
+ v.z = d_ptr->colorSpaceIn->lut[2]->u16ToLinearF32(src[i]);
+ buffer[i] = d_ptr->colorSpaceIn->toXyz.map(v);
+ }
}
}
@@ -1258,6 +1284,28 @@ private:
alignas(T) char data[sizeof(T) * Count];
};
+void loadUnpremultipliedLUT(QColorVector *buffer, const uchar *src, const qsizetype len)
+{
+ const float f = 1.0f / 255.f;
+ for (qsizetype i = 0; i < len; ++i) {
+ const float p = src[i] * f;
+ buffer[i].x = p;
+ buffer[i].y = p;
+ buffer[i].z = p;
+ }
+}
+
+void loadUnpremultipliedLUT(QColorVector *buffer, const quint16 *src, const qsizetype len)
+{
+ const float f = 1.0f / 65535.f;
+ for (qsizetype i = 0; i < len; ++i) {
+ const float p = src[i] * f;
+ buffer[i].x = p;
+ buffer[i].y = p;
+ buffer[i].z = p;
+ }
+}
+
void loadUnpremultipliedLUT(QColorVector *buffer, const QRgb *src, const qsizetype len)
{
const float f = 1.0f / 255.f;
@@ -1300,6 +1348,16 @@ void loadUnpremultipliedLUT(QColorVector *buffer, const QRgbaFloat32 *src, const
}
}
+void loadPremultipliedLUT(QColorVector *, const uchar *, const qsizetype)
+{
+ Q_UNREACHABLE();
+}
+
+void loadPremultipliedLUT(QColorVector *, const quint16 *, const qsizetype)
+{
+ Q_UNREACHABLE();
+}
+
void loadPremultipliedLUT(QColorVector *buffer, const QRgb *src, const qsizetype len)
{
for (qsizetype i = 0; i < len; ++i) {
@@ -1420,7 +1478,15 @@ static void storeUnpremultipliedLUT(QRgbaFloat32 *dst, const T *src,
}
template<typename T>
-static void storePremultipliedLUT(QRgb *, const T *, const QColorVector *, const qsizetype);
+static void storePremultipliedLUT(QRgb *dst, const T *, const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int r = buffer[i].x * 255.f;
+ const int g = buffer[i].y * 255.f;
+ const int b = buffer[i].z * 255.f;
+ dst[i] = 0xff000000 | (r << 16) | (g << 8) | (b << 0);
+ }
+}
template<>
void storePremultipliedLUT(QRgb *dst, const QRgb *src, const QColorVector *buffer, const qsizetype len)
@@ -1434,18 +1500,6 @@ void storePremultipliedLUT(QRgb *dst, const QRgb *src, const QColorVector *buffe
}
}
-template<>
-void storePremultipliedLUT(QRgb *dst, const QCmyk32 *, const QColorVector *buffer, const qsizetype len)
-{
- for (qsizetype i = 0; i < len; ++i) {
- const int r = buffer[i].x * 255.f;
- const int g = buffer[i].y * 255.f;
- const int b = buffer[i].z * 255.f;
- dst[i] = 0xff000000 | (r << 16) | (g << 8) | (b << 0);
- }
-}
-
-
template<typename T>
static void storePremultipliedLUT(QCmyk32 *dst, const T *src, const QColorVector *buffer, const qsizetype len)
{
@@ -1453,7 +1507,15 @@ static void storePremultipliedLUT(QCmyk32 *dst, const T *src, const QColorVector
}
template<typename T>
-static void storePremultipliedLUT(QRgba64 *, const T *, const QColorVector *, const qsizetype);
+static void storePremultipliedLUT(QRgba64 *dst, const T *, const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int r = buffer[i].x * 65535.f;
+ const int g = buffer[i].y * 65535.f;
+ const int b = buffer[i].z * 65535.f;
+ dst[i] = qRgba64(r, g, b, 65535);
+ }
+}
template<>
void storePremultipliedLUT(QRgba64 *dst, const QRgb *src, const QColorVector *buffer, const qsizetype len)
@@ -1468,17 +1530,6 @@ void storePremultipliedLUT(QRgba64 *dst, const QRgb *src, const QColorVector *bu
}
template<>
-void storePremultipliedLUT(QRgba64 *dst, const QCmyk32 *, const QColorVector *buffer, const qsizetype len)
-{
- for (qsizetype i = 0; i < len; ++i) {
- const int r = buffer[i].x * 65535.f;
- const int g = buffer[i].y * 65535.f;
- const int b = buffer[i].z * 65535.f;
- dst[i] = qRgba64(r, g, b, 65535);
- }
-}
-
-template<>
void storePremultipliedLUT(QRgba64 *dst, const QRgba64 *src, const QColorVector *buffer, const qsizetype len)
{
for (qsizetype i = 0; i < len; ++i) {
@@ -1628,11 +1679,43 @@ QColorVector QColorTransformPrivate::mapExtended(QColorVector c) const
return c;
}
+template<typename T>
+constexpr bool IsGrayscale = std::is_same_v<T, uchar> || std::is_same_v<T, quint16>;
+template<typename T>
+constexpr bool IsAlwaysOpaque = std::is_same_v<T, QCmyk32> || IsGrayscale<T>;
+template<typename T>
+constexpr bool CanUseThreeComponent = !std::is_same_v<T, QCmyk32>;
+template<typename T>
+constexpr bool UnclampedValues = std::is_same_v<T, QRgbaFloat16> || std::is_same_v<T, QRgbaFloat32>;
+
+// Possible combos for data and color spaces:
+// DataCM ColorSpaceCM ColorSpacePM Notes
+// Gray Gray ThreeMatrix
+// Gray Rgb ThreeMatrix Invalid colorMatrix
+// Rgb Rgb ThreeMatrix
+// Rgb Rgb ElementProc
+// Gray Rgb ElementProc Only possible for input data
+// Cmyk Cmyk ElementProc
+//
+// Gray data can be uchar, quint16, and is always Opaque
+// Rgb data can be QRgb, QRgba64, or QRgbaFloat32, and is Unpremultiplied, Premultiplied, or Opaque
+// Cmyk data can be Cmyk32, and is always Opaque
+//
+// colorMatrix as setup for Gray on Gray or Rgb on Rgb, but not Gray data on Rgb colorspace.
+
template<typename S>
void QColorTransformPrivate::applyConvertIn(const S *src, QColorVector *buffer, qsizetype len, TransformFlags flags) const
{
- // Avoid compiling this part for S=QCmyk32:
- if constexpr (!std::is_same_v<S, QCmyk32>) {
+ if constexpr (IsGrayscale<S>) {
+ if (colorSpaceIn->isThreeComponentMatrix()) {
+ loadGray(buffer, src, len, this);
+ if (!colorSpaceOut->isThreeComponentMatrix() || colorSpaceIn->colorModel != QColorSpace::ColorModel::Gray) {
+ if (!colorSpaceIn->chad.isNull())
+ applyMatrix<DoClamp>(buffer, len, colorSpaceIn->chad);
+ }
+ return;
+ }
+ } else if constexpr (CanUseThreeComponent<S>) {
if (colorSpaceIn->isThreeComponentMatrix()) {
if (flags & InputPremultiplied)
loadPremultiplied(buffer, src, len, this);
@@ -1640,7 +1723,7 @@ void QColorTransformPrivate::applyConvertIn(const S *src, QColorVector *buffer,
loadUnpremultiplied(buffer, src, len, this);
if (!colorSpaceOut->isThreeComponentMatrix())
- applyMatrix<DoClamp>(buffer, len, colorMatrix); // colorMatrix should have the first half only.
+ applyMatrix<DoClamp>(buffer, len, colorMatrix);
return;
}
}
@@ -1651,9 +1734,6 @@ void QColorTransformPrivate::applyConvertIn(const S *src, QColorVector *buffer,
else
loadUnpremultipliedLUT(buffer, src, len);
- if constexpr (std::is_same_v<S, QRgbaFloat16> || std::is_same_v<S, QRgbaFloat32>)
- clampIfNeeded<DoClamp>(buffer, len);
-
// Do element based conversion
for (auto &&element : colorSpaceIn->mAB)
std::visit([&buffer, len](auto &&elm) { visitElement(elm, buffer, len); }, element);
@@ -1662,13 +1742,44 @@ void QColorTransformPrivate::applyConvertIn(const S *src, QColorVector *buffer,
template<typename D, typename S>
void QColorTransformPrivate::applyConvertOut(D *dst, const S *src, QColorVector *buffer, qsizetype len, TransformFlags flags) const
{
- constexpr ApplyMatrixForm doClamp = (std::is_same_v<D, QRgbaFloat16> || std::is_same_v<D, QRgbaFloat32>) ? DoNotClamp : DoClamp;
- // Avoid compiling this part for D=QCmyk32:
- if constexpr (!std::is_same_v<D, QCmyk32>) {
+ constexpr ApplyMatrixForm doClamp = UnclampedValues<D> ? DoNotClamp : DoClamp;
+ if constexpr (IsGrayscale<D>) {
+ Q_UNUSED(src); // dealing with buggy warnings in gcc 9
+ Q_UNUSED(flags);
+ // Calculate the matrix for grayscale conversion
+ QColorMatrix grayMatrix;
+ if (colorSpaceIn == colorSpaceOut ||
+ (colorSpaceIn->colorModel == QColorSpace::ColorModel::Gray &&
+ colorSpaceOut->colorModel == QColorSpace::ColorModel::Gray)) {
+ // colorMatrix already has the right form
+ grayMatrix = colorMatrix;
+ } else {
+ if constexpr (IsGrayscale<S>) {
+ if (colorSpaceIn->colorModel == QColorSpace::ColorModel::Gray)
+ grayMatrix = colorSpaceIn->chad;
+ else
+ grayMatrix = QColorMatrix::identity(); // Otherwise already handled in applyConvertIn
+ } else {
+ if (colorSpaceIn->isThreeComponentMatrix())
+ grayMatrix = colorSpaceIn->toXyz;
+ else
+ grayMatrix = QColorMatrix::identity();
+ }
+ if (!colorSpaceOut->chad.isNull())
+ grayMatrix = colorSpaceOut->chad.inverted() * grayMatrix;
+ }
+
+ applyMatrix<doClamp>(buffer, len, grayMatrix);
+ storeOpaque(dst, buffer, len, this);
+ return;
+ } else if constexpr (CanUseThreeComponent<D>) {
if (colorSpaceOut->isThreeComponentMatrix()) {
- applyMatrix<doClamp>(buffer, len, colorMatrix); // colorMatrix should have the latter half only.
+ if (IsGrayscale<S> && colorSpaceIn->colorModel != QColorSpace::ColorModel::Gray)
+ applyMatrix<doClamp>(buffer, len, colorSpaceOut->toXyz.inverted()); // colorMatrix wasnt prepared for gray input
+ else
+ applyMatrix<doClamp>(buffer, len, colorMatrix);
- if constexpr (std::is_same_v<S, QCmyk32>) {
+ if constexpr (IsAlwaysOpaque<S>) {
storeOpaque(dst, buffer, len, this);
} else {
if (flags & InputOpaque)
@@ -1681,91 +1792,37 @@ void QColorTransformPrivate::applyConvertOut(D *dst, const S *src, QColorVector
return;
}
}
- Q_ASSERT(!colorSpaceOut->isThreeComponentMatrix());
+ if constexpr (!IsGrayscale<D>) {
+ Q_ASSERT(!colorSpaceOut->isThreeComponentMatrix());
- // Do element based conversion
- for (auto &&element : colorSpaceOut->mBA)
- std::visit([&buffer, len](auto &&elm) { visitElement(elm, buffer, len); }, element);
-
- clampIfNeeded<doClamp>(buffer, len);
-
- if (flags & OutputPremultiplied)
- storePremultipliedLUT(dst, src, buffer, len);
- else
- storeUnpremultipliedLUT(dst, src, buffer, len);
-}
-
-template<typename D, typename S>
-void QColorTransformPrivate::applyElementListTransform(D *dst, const S *src, qsizetype count, TransformFlags flags) const
-{
- Q_ASSERT(!colorSpaceIn->isThreeComponentMatrix() || !colorSpaceOut->isThreeComponentMatrix());
-
- if (!colorMatrix.isValid())
- return;
-
- if (colorSpaceIn->isThreeComponentMatrix())
- updateLutsIn();
- if (colorSpaceOut->isThreeComponentMatrix())
- updateLutsOut();
-
- QUninitialized<QColorVector, WorkBlockSize> buffer;
- qsizetype i = 0;
- while (i < count) {
- const qsizetype len = qMin(count - i, WorkBlockSize);
-
- applyConvertIn(src + i, buffer, len, flags);
-
- // Match Profile Connection Spaces (PCS):
- if (colorSpaceOut->isPcsLab && !colorSpaceIn->isPcsLab) {
- for (qsizetype j = 0; j < len; ++j)
- buffer[j] = buffer[j].xyzToLab();
- } else if (colorSpaceIn->isPcsLab && !colorSpaceOut->isPcsLab) {
- for (qsizetype j = 0; j < len; ++j)
- buffer[j] = buffer[j].labToXyz();
- }
+ // Do element based conversion
+ for (auto &&element : colorSpaceOut->mBA)
+ std::visit([&buffer, len](auto &&elm) { visitElement(elm, buffer, len); }, element);
- applyConvertOut(dst + i, src + i, buffer, len, flags);
+ clampIfNeeded<doClamp>(buffer, len);
- i += len;
+ if (flags & OutputPremultiplied)
+ storePremultipliedLUT(dst, src, buffer, len);
+ else
+ storeUnpremultipliedLUT(dst, src, buffer, len);
+ } else {
+ Q_UNREACHABLE();
}
}
-template<typename D, typename S>
-void QColorTransformPrivate::applyThreeComponentMatrix(D *dst, const S *src, qsizetype count, TransformFlags flags) const
+/*!
+ \internal
+ Adapt Profile Connection Spaces.
+*/
+void QColorTransformPrivate::pcsAdapt(QColorVector *buffer, qsizetype count) const
{
- Q_ASSERT(colorSpaceIn->isThreeComponentMatrix() && colorSpaceOut->isThreeComponentMatrix());
-
- if (!colorMatrix.isValid())
- return;
-
- updateLutsIn();
- updateLutsOut();
-
- bool doApplyMatrix = !colorMatrix.isIdentity();
- constexpr ApplyMatrixForm doClamp = (std::is_same_v<D, QRgbaFloat16> || std::is_same_v<D, QRgbaFloat32>) ? DoNotClamp : DoClamp;
-
- QUninitialized<QColorVector, WorkBlockSize> buffer;
- qsizetype i = 0;
- while (i < count) {
- const qsizetype len = qMin(count - i, WorkBlockSize);
- if (flags & InputPremultiplied)
- loadPremultiplied(buffer, src + i, len, this);
- else
- loadUnpremultiplied(buffer, src + i, len, this);
-
- if (doApplyMatrix)
- applyMatrix<doClamp>(buffer, len, colorMatrix);
- else
- clampIfNeeded<doClamp>(buffer, len);
-
- if (flags & InputOpaque)
- storeOpaque(dst + i, buffer, len, this);
- else if (flags & OutputPremultiplied)
- storePremultiplied(dst + i, src + i, buffer, len, this);
- else
- storeUnpremultiplied(dst + i, src + i, buffer, len, this);
-
- i += len;
+ // Match Profile Connection Spaces (PCS):
+ if (colorSpaceOut->isPcsLab && !colorSpaceIn->isPcsLab) {
+ for (qsizetype j = 0; j < count; ++j)
+ buffer[j] = buffer[j].xyzToLab();
+ } else if (colorSpaceIn->isPcsLab && !colorSpaceOut->isPcsLab) {
+ for (qsizetype j = 0; j < count; ++j)
+ buffer[j] = buffer[j].labToXyz();
}
}
@@ -1781,137 +1838,23 @@ void QColorTransformPrivate::applyThreeComponentMatrix(D *dst, const S *src, qsi
template<typename D, typename S>
void QColorTransformPrivate::apply(D *dst, const S *src, qsizetype count, TransformFlags flags) const
{
- if constexpr (!std::is_same_v<D, QCmyk32> && !std::is_same_v<S, QCmyk32>) {
- if (isThreeComponentMatrix())
- return applyThreeComponentMatrix<D, S>(dst, src, count, flags);
- }
- applyElementListTransform<D, S>(dst, src, count, flags);
-}
-
-/*!
- \internal
- Is to be called on a color-transform to XYZ, returns only luminance values.
-
- */
-template<typename D, typename S>
-void QColorTransformPrivate::applyReturnGray(D *dst, const S *src, qsizetype count, TransformFlags flags) const
-{
- Q_ASSERT(colorSpaceOut->isThreeComponentMatrix());
- updateLutsOut();
- if (!colorSpaceIn->isThreeComponentMatrix()) {
- QUninitialized<QColorVector, WorkBlockSize> buffer;
-
- qsizetype i = 0;
- while (i < count) {
- const qsizetype len = qMin(count - i, WorkBlockSize);
-
- applyConvertIn(src, buffer, len, flags);
-
- // Match Profile Connection Spaces (PCS):
- if (colorSpaceOut->isPcsLab && !colorSpaceIn->isPcsLab) {
- for (qsizetype j = 0; j < len; ++j)
- buffer[j] = buffer[j].xyzToLab();
- } else if (colorSpaceIn->isPcsLab && !colorSpaceOut->isPcsLab) {
- for (qsizetype j = 0; j < len; ++j)
- buffer[j] = buffer[j].labToXyz();
- }
-
- applyMatrix<DoClamp>(buffer, len, colorMatrix);
- storeOpaque(dst + i, buffer, len, this);
-
- i += len;
- }
- return;
- }
- if constexpr (!std::is_same_v<S, QCmyk32>) {
- if (!colorMatrix.isValid())
- return;
-
+ if (colorSpaceIn->isThreeComponentMatrix())
updateLutsIn();
-
- QUninitialized<QColorVector, WorkBlockSize> buffer;
-
- qsizetype i = 0;
- while (i < count) {
- const qsizetype len = qMin(count - i, WorkBlockSize);
- if (flags & InputPremultiplied)
- loadPremultiplied(buffer, src + i, len, this);
- else
- loadUnpremultiplied(buffer, src + i, len, this);
-
- applyMatrix<DoClamp>(buffer, len, colorMatrix);
-
- storeOpaque(dst + i, buffer, len, this);
-
- i += len;
- }
- } else {
- Q_UNREACHABLE();
- }
-}
-
-/*!
- \internal
-*/
-template<typename D, typename S>
-void QColorTransformPrivate::applyGray(D *dst, const S *src, qsizetype count, TransformFlags) const
-{
- Q_ASSERT(colorSpaceIn->isThreeComponentMatrix());
- updateLutsIn();
- if constexpr (std::is_same_v<D, QRgb> || std::is_same_v<D, QRgba64> || std::is_same_v<D, QRgbaFloat32> || std::is_same_v<D, QCmyk32>) {
- if (!colorSpaceOut->isThreeComponentMatrix()) {
- QUninitialized<QColorVector, WorkBlockSize> buffer;
-
- qsizetype i = 0;
- while (i < count) {
- const qsizetype len = qMin(count - i, WorkBlockSize);
- loadGray(buffer, src + i, len, this);
-
- applyMatrix<DoClamp>(buffer, len, colorMatrix);
-
- // Match Profile Connection Spaces (PCS):
- if (colorSpaceOut->isPcsLab && !colorSpaceIn->isPcsLab) {
- for (qsizetype j = 0; j < len; ++j)
- buffer[j] = buffer[j].xyzToLab();
- } else if (colorSpaceIn->isPcsLab && !colorSpaceOut->isPcsLab) {
- for (qsizetype j = 0; j < len; ++j)
- buffer[j] = buffer[j].labToXyz();
- }
-
- // Do element based conversion
- for (auto &&element : colorSpaceOut->mBA)
- std::visit([&buffer, len](auto &&elm) { visitElement(elm, buffer, len); }, element);
-
- clampIfNeeded<DoClamp>(buffer, len);
-
- storeUnpremultipliedLUT(dst, src, buffer, len); // input is always opaque
-
- i += len;
- }
- return;
- }
- }
- Q_ASSERT(colorSpaceOut->isThreeComponentMatrix());
- if constexpr (!std::is_same_v<D, QCmyk32>) {
- if (!colorMatrix.isValid())
- return;
-
+ if (colorSpaceOut->isThreeComponentMatrix())
updateLutsOut();
- QUninitialized<QColorVector, WorkBlockSize> buffer;
+ QUninitialized<QColorVector, WorkBlockSize> buffer;
+ qsizetype i = 0;
+ while (i < count) {
+ const qsizetype len = qMin(count - i, WorkBlockSize);
- qsizetype i = 0;
- while (i < count) {
- const qsizetype len = qMin(count - i, WorkBlockSize);
- loadGray(buffer, src + i, len, this);
+ applyConvertIn(src + i, buffer, len, flags);
- applyMatrix<DoClamp>(buffer, len, colorMatrix);
+ pcsAdapt(buffer, len);
- storeOpaque(dst + i, buffer, len, this);
- i += len;
- }
- } else {
- Q_UNREACHABLE();
+ applyConvertOut(dst + i, src + i, buffer, len, flags);
+
+ i += len;
}
}
@@ -1943,25 +1886,24 @@ void QColorTransformPrivate::prepare()
updateLutsOut();
}
-// Only allow versions increasing precision
-template void QColorTransformPrivate::applyReturnGray<quint8, QRgb>(quint8 *dst, const QRgb *src, qsizetype count, TransformFlags flags) const;
-template void QColorTransformPrivate::applyReturnGray<quint8, QCmyk32>(quint8 *dst, const QCmyk32 *src, qsizetype count, TransformFlags flags) const;
-template void QColorTransformPrivate::applyReturnGray<quint16, QCmyk32>(quint16 *dst, const QCmyk32 *src, qsizetype count, TransformFlags flags) const;
-template void QColorTransformPrivate::applyReturnGray<quint16, QRgba64>(quint16 *dst, const QRgba64 *src, qsizetype count, TransformFlags flags) const;
-template void QColorTransformPrivate::applyGray<quint8, quint8>(quint8 *dst, const quint8 *src, qsizetype count, TransformFlags flags) const;
-template void QColorTransformPrivate::applyGray<quint16, quint8>(quint16 *dst, const quint8 *src, qsizetype count, TransformFlags flags) const;
-template void QColorTransformPrivate::applyGray<quint16, quint16>(quint16 *dst, const quint16 *src, qsizetype count, TransformFlags flags) const;
-template void QColorTransformPrivate::applyGray<QRgb, quint8>(QRgb *dst, const quint8 *src, qsizetype count, TransformFlags flags) const;
-template void QColorTransformPrivate::applyGray<QCmyk32, quint8>(QCmyk32 *dst, const quint8 *src, qsizetype count, TransformFlags flags) const;
-template void QColorTransformPrivate::applyGray<QCmyk32, quint16>(QCmyk32 *dst, const quint16 *src, qsizetype count, TransformFlags flags) const;
-template void QColorTransformPrivate::applyGray<QRgba64, quint16>(QRgba64 *dst, const quint16 *src, qsizetype count, TransformFlags flags) const;
-
+// Only some versions increasing precision 14/36 combos
+template void QColorTransformPrivate::apply<quint8, quint8>(quint8 *dst, const quint8 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<quint8, QRgb>(quint8 *dst, const QRgb *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<quint8, QCmyk32>(quint8 *dst, const QCmyk32 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<quint16, quint8>(quint16 *dst, const quint8 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<quint16, quint16>(quint16 *dst, const quint16 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<quint16, QCmyk32>(quint16 *dst, const QCmyk32 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<quint16, QRgba64>(quint16 *dst, const QRgba64 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QRgb, quint8>(QRgb *dst, const quint8 *src, qsizetype count, TransformFlags flags) const;
template void QColorTransformPrivate::apply<QRgb, QRgb>(QRgb *dst, const QRgb *src, qsizetype count, TransformFlags flags) const;
template void QColorTransformPrivate::apply<QRgb, QCmyk32>(QRgb *dst, const QCmyk32 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QCmyk32, quint8>(QCmyk32 *dst, const quint8 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QCmyk32, quint16>(QCmyk32 *dst, const quint16 *src, qsizetype count, TransformFlags flags) const;
template void QColorTransformPrivate::apply<QCmyk32, QRgb>(QCmyk32 *dst, const QRgb *src, qsizetype count, TransformFlags flags) const;
template void QColorTransformPrivate::apply<QCmyk32, QCmyk32>(QCmyk32 *dst, const QCmyk32 *src, qsizetype count, TransformFlags flags) const;
template void QColorTransformPrivate::apply<QCmyk32, QRgba64>(QCmyk32 *dst, const QRgba64 *src, qsizetype count, TransformFlags flags) const;
template void QColorTransformPrivate::apply<QCmyk32, QRgbaFloat32>(QCmyk32 *dst, const QRgbaFloat32 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QRgba64, quint16>(QRgba64 *dst, const quint16 *src, qsizetype count, TransformFlags flags) const;
template void QColorTransformPrivate::apply<QRgba64, QRgb>(QRgba64 *dst, const QRgb *src, qsizetype count, TransformFlags flags) const;
template void QColorTransformPrivate::apply<QRgba64, QCmyk32>(QRgba64 *dst, const QCmyk32 *src, qsizetype count, TransformFlags flags) const;
template void QColorTransformPrivate::apply<QRgba64, QRgba64>(QRgba64 *dst, const QRgba64 *src, qsizetype count, TransformFlags flags) const;
@@ -1970,15 +1912,6 @@ template void QColorTransformPrivate::apply<QRgbaFloat32, QCmyk32>(QRgbaFloat32
template void QColorTransformPrivate::apply<QRgbaFloat32, QRgba64>(QRgbaFloat32 *dst, const QRgba64 *src, qsizetype count, TransformFlags flags) const;
template void QColorTransformPrivate::apply<QRgbaFloat32, QRgbaFloat32>(QRgbaFloat32 *dst, const QRgbaFloat32 *src, qsizetype count, TransformFlags flags) const;
-bool QColorTransformPrivate::isThreeComponentMatrix() const
-{
- if (colorSpaceIn && !colorSpaceIn->isThreeComponentMatrix())
- return false;
- if (colorSpaceOut && !colorSpaceOut->isThreeComponentMatrix())
- return false;
- return true;
-}
-
/*!
\internal
*/
@@ -1991,7 +1924,7 @@ bool QColorTransformPrivate::isIdentity() const
if (colorSpaceIn && colorSpaceOut) {
if (colorSpaceIn->equals(colorSpaceOut.constData()))
return true;
- if (!isThreeComponentMatrix())
+ if (!colorSpaceIn->isThreeComponentMatrix() || !colorSpaceOut->isThreeComponentMatrix())
return false;
if (colorSpaceIn->transferFunction != colorSpaceOut->transferFunction)
return false;
@@ -2001,7 +1934,9 @@ bool QColorTransformPrivate::isIdentity() const
&& colorSpaceIn->trc[2] == colorSpaceOut->trc[2];
}
} else {
- if (!isThreeComponentMatrix())
+ if (colorSpaceIn && !colorSpaceIn->isThreeComponentMatrix())
+ return false;
+ if (colorSpaceOut && !colorSpaceOut->isThreeComponentMatrix())
return false;
if (colorSpaceIn && colorSpaceIn->transferFunction != QColorSpace::TransferFunction::Linear)
return false;
diff --git a/src/gui/painting/qcolortransform_p.h b/src/gui/painting/qcolortransform_p.h
index 59ea6a2405..3f11603420 100644
--- a/src/gui/painting/qcolortransform_p.h
+++ b/src/gui/painting/qcolortransform_p.h
@@ -27,7 +27,7 @@ class QCmyk32;
class QColorTransformPrivate : public QSharedData
{
public:
- QColorMatrix colorMatrix;
+ QColorMatrix colorMatrix; // Combined colorSpaceIn->toXyz and colorSpaceOut->toXyz.inverted()
QExplicitlySharedDataPointer<const QColorSpacePrivate> colorSpaceIn;
QExplicitlySharedDataPointer<const QColorSpacePrivate> colorSpaceOut;
@@ -37,7 +37,6 @@ public:
void updateLutsIn() const;
void updateLutsOut() const;
bool isIdentity() const;
- bool isThreeComponentMatrix() const;
Q_GUI_EXPORT void prepare();
enum TransformFlag {
@@ -54,20 +53,13 @@ public:
template<typename D, typename S>
void apply(D *dst, const S *src, qsizetype count, TransformFlags flags) const;
- template<typename D, typename S>
- void applyGray(D *dst, const S *src, qsizetype count, TransformFlags flags) const;
- template<typename D, typename S>
- void applyReturnGray(D *dst, const S *src, qsizetype count, TransformFlags flags) const;
private:
+ void pcsAdapt(QColorVector *buffer, qsizetype len) const;
template<typename S>
void applyConvertIn(const S *src, QColorVector *buffer, qsizetype len, TransformFlags flags) const;
template<typename D, typename S>
void applyConvertOut(D *dst, const S *src, QColorVector *buffer, qsizetype len, TransformFlags flags) const;
- template<typename D, typename S>
- void applyElementListTransform(D *dst, const S *src, qsizetype count, TransformFlags flags) const;
- template<typename D, typename S>
- void applyThreeComponentMatrix(D *dst, const S *src, qsizetype count, TransformFlags flags) const;
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qcolortrc_p.h b/src/gui/painting/qcolortrc_p.h
index d1ad1987df..dbca91c7f6 100644
--- a/src/gui/painting/qcolortrc_p.h
+++ b/src/gui/painting/qcolortrc_p.h
@@ -17,6 +17,7 @@
#include <QtGui/private/qtguiglobal_p.h>
#include "qcolortransferfunction_p.h"
+#include "qcolortransfergeneric_p.h"
#include "qcolortransfertable_p.h"
QT_BEGIN_NAMESPACE
@@ -26,20 +27,23 @@ class Q_GUI_EXPORT QColorTrc
{
public:
QColorTrc() noexcept : m_type(Type::Uninitialized) { }
- QColorTrc(const QColorTransferFunction &fun) : m_type(Type::Function), m_fun(fun) { }
+ QColorTrc(const QColorTransferFunction &fun) : m_type(Type::ParameterizedFunction), m_fun(fun) { }
QColorTrc(const QColorTransferTable &table) : m_type(Type::Table), m_table(table) { }
- QColorTrc(QColorTransferFunction &&fun) noexcept : m_type(Type::Function), m_fun(std::move(fun)) { }
+ QColorTrc(const QColorTransferGenericFunction &hdr) : m_type(Type::GenericFunction), m_hdr(hdr) { }
+ QColorTrc(QColorTransferFunction &&fun) noexcept : m_type(Type::ParameterizedFunction), m_fun(std::move(fun)) { }
QColorTrc(QColorTransferTable &&table) noexcept : m_type(Type::Table), m_table(std::move(table)) { }
+ QColorTrc(QColorTransferGenericFunction &&hdr) noexcept : m_type(Type::GenericFunction), m_hdr(std::move(hdr)) { }
enum class Type {
Uninitialized,
- Function,
- Table
+ ParameterizedFunction,
+ GenericFunction,
+ Table,
};
bool isIdentity() const
{
- return (m_type == Type::Function && m_fun.isIdentity())
+ return (m_type == Type::ParameterizedFunction && m_fun.isIdentity())
|| (m_type == Type::Table && m_table.isIdentity());
}
bool isValid() const
@@ -48,62 +52,87 @@ public:
}
float apply(float x) const
{
- if (m_type == Type::Table)
- return m_table.apply(x);
- if (m_type == Type::Function)
- return m_fun.apply(x);
+ switch (m_type) {
+ case Type::ParameterizedFunction:
+ return fun().apply(x);
+ case Type::GenericFunction:
+ return hdr().apply(x);
+ case Type::Table:
+ return table().apply(x);
+ default:
+ break;
+ }
return x;
}
float applyExtended(float x) const
{
- if (x >= 0.0f && x <= 1.0f)
- return apply(x);
- if (m_type == Type::Function)
- return std::copysign(m_fun.apply(std::abs(x)), x);
- if (m_type == Type::Table)
- return x < 0.0f ? 0.0f : 1.0f;
+ switch (m_type) {
+ case Type::ParameterizedFunction:
+ return std::copysign(fun().apply(std::abs(x)), x);
+ case Type::GenericFunction:
+ return hdr().apply(x);
+ case Type::Table:
+ return table().apply(x);
+ default:
+ break;
+ }
return x;
}
float applyInverse(float x) const
{
- if (m_type == Type::Table)
- return m_table.applyInverse(x);
- if (m_type == Type::Function)
- return m_fun.inverted().apply(x);
+ switch (m_type) {
+ case Type::ParameterizedFunction:
+ return fun().inverted().apply(x);
+ case Type::GenericFunction:
+ return hdr().applyInverse(x);
+ case Type::Table:
+ return table().applyInverse(x);
+ default:
+ break;
+ }
return x;
}
float applyInverseExtended(float x) const
{
- if (x >= 0.0f && x <= 1.0f)
- return applyInverse(x);
- if (m_type == Type::Function)
+ switch (m_type) {
+ case Type::ParameterizedFunction:
return std::copysign(applyInverse(std::abs(x)), x);
- if (m_type == Type::Table)
- return x < 0.0f ? 0.0f : 1.0f;
+ case Type::GenericFunction:
+ return hdr().applyInverse(x);
+ case Type::Table:
+ return table().applyInverse(x);
+ default:
+ break;
+ }
return x;
}
- friend inline bool operator!=(const QColorTrc &o1, const QColorTrc &o2);
- friend inline bool operator==(const QColorTrc &o1, const QColorTrc &o2);
+ const QColorTransferTable &table() const { return m_table; }
+ const QColorTransferFunction &fun() const{ return m_fun; }
+ const QColorTransferGenericFunction &hdr() const { return m_hdr; }
+ Type type() const noexcept { return m_type; }
Type m_type;
+
+ friend inline bool comparesEqual(const QColorTrc &lhs, const QColorTrc &rhs);
+ Q_DECLARE_EQUALITY_COMPARABLE(QColorTrc);
+
QColorTransferFunction m_fun;
QColorTransferTable m_table;
+ QColorTransferGenericFunction m_hdr;
};
-inline bool operator!=(const QColorTrc &o1, const QColorTrc &o2)
+inline bool comparesEqual(const QColorTrc &o1, const QColorTrc &o2)
{
if (o1.m_type != o2.m_type)
- return true;
- if (o1.m_type == QColorTrc::Type::Function)
- return o1.m_fun != o2.m_fun;
+ return false;
+ if (o1.m_type == QColorTrc::Type::ParameterizedFunction)
+ return o1.m_fun == o2.m_fun;
if (o1.m_type == QColorTrc::Type::Table)
- return o1.m_table != o2.m_table;
- return false;
-}
-inline bool operator==(const QColorTrc &o1, const QColorTrc &o2)
-{
- return !(o1 != o2);
+ return o1.m_table == o2.m_table;
+ if (o1.m_type == QColorTrc::Type::GenericFunction)
+ return o1.m_hdr == o2.m_hdr;
+ return true;
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qcolortrclut.cpp b/src/gui/painting/qcolortrclut.cpp
index 8a7673bc00..1357aa41a6 100644
--- a/src/gui/painting/qcolortrclut.cpp
+++ b/src/gui/painting/qcolortrclut.cpp
@@ -3,7 +3,9 @@
#include "qcolortrclut_p.h"
#include "qcolortransferfunction_p.h"
+#include "qcolortransfergeneric_p.h"
#include "qcolortransfertable_p.h"
+#include "qcolortrc_p.h"
#include <qmath.h>
QT_BEGIN_NAMESPACE
@@ -13,69 +15,86 @@ std::shared_ptr<QColorTrcLut> QColorTrcLut::create()
return std::make_shared<Access>();
}
-std::shared_ptr<QColorTrcLut> QColorTrcLut::fromGamma(qreal gamma, Direction dir)
+std::shared_ptr<QColorTrcLut> QColorTrcLut::fromGamma(float gamma, Direction dir)
{
auto cp = create();
cp->setFromGamma(gamma, dir);
return cp;
}
-std::shared_ptr<QColorTrcLut> QColorTrcLut::fromTransferFunction(const QColorTransferFunction &fun, Direction dir)
+std::shared_ptr<QColorTrcLut> QColorTrcLut::fromTrc(const QColorTrc &trc, Direction dir)
{
+ if (!trc.isValid())
+ return nullptr;
auto cp = create();
- cp->setFromTransferFunction(fun, dir);
+ cp->setFromTrc(trc, dir);
return cp;
}
-std::shared_ptr<QColorTrcLut> QColorTrcLut::fromTransferTable(const QColorTransferTable &table, Direction dir)
+void QColorTrcLut::setFromGamma(float gamma, Direction dir)
{
- auto cp = create();
- cp->setFromTransferTable(table, dir);
- return cp;
+ constexpr float iRes = 1.f / float(Resolution);
+ if (dir & ToLinear) {
+ if (!m_toLinear)
+ m_toLinear.reset(new ushort[Resolution + 1]);
+ for (int i = 0; i <= Resolution; ++i)
+ m_toLinear[i] = ushort(qRound(qBound(0.f, qPow(i * iRes, gamma), 1.f) * (255 * 256)));
+ }
+
+ if (dir & FromLinear) {
+ const float iGamma = 1.f / gamma;
+ if (!m_fromLinear)
+ m_fromLinear.reset(new ushort[Resolution + 1]);
+ for (int i = 0; i <= Resolution; ++i)
+ m_fromLinear[i] = ushort(qRound(qBound(0.f, qPow(i * iRes, iGamma), 1.f) * (255 * 256)));
+ }
}
-void QColorTrcLut::setFromGamma(qreal gamma, Direction dir)
+void QColorTrcLut::setFromTransferFunction(const QColorTransferFunction &fun, Direction dir)
{
+ constexpr float iRes = 1.f / float(Resolution);
if (dir & ToLinear) {
if (!m_toLinear)
m_toLinear.reset(new ushort[Resolution + 1]);
for (int i = 0; i <= Resolution; ++i)
- m_toLinear[i] = ushort(qRound(qPow(i / qreal(Resolution), gamma) * (255 * 256)));
+ m_toLinear[i] = ushort(qRound(qBound(0.f, fun.apply(i * iRes), 1.f) * (255 * 256)));
}
if (dir & FromLinear) {
if (!m_fromLinear)
m_fromLinear.reset(new ushort[Resolution + 1]);
+ QColorTransferFunction inv = fun.inverted();
for (int i = 0; i <= Resolution; ++i)
- m_fromLinear[i] = ushort(qRound(qPow(i / qreal(Resolution), qreal(1) / gamma) * (255 * 256)));
+ m_fromLinear[i] = ushort(qRound(qBound(0.f, inv.apply(i * iRes), 1.f) * (255 * 256)));
}
}
-void QColorTrcLut::setFromTransferFunction(const QColorTransferFunction &fun, Direction dir)
+void QColorTrcLut::setFromTransferGenericFunction(const QColorTransferGenericFunction &fun, Direction dir)
{
+ constexpr float iRes = 1.f / float(Resolution);
if (dir & ToLinear) {
if (!m_toLinear)
m_toLinear.reset(new ushort[Resolution + 1]);
for (int i = 0; i <= Resolution; ++i)
- m_toLinear[i] = ushort(qRound(fun.apply(i / qreal(Resolution)) * (255 * 256)));
+ m_toLinear[i] = ushort(qRound(qBound(0.f, fun.apply(i * iRes), 1.f) * (255 * 256)));
}
if (dir & FromLinear) {
if (!m_fromLinear)
m_fromLinear.reset(new ushort[Resolution + 1]);
- QColorTransferFunction inv = fun.inverted();
for (int i = 0; i <= Resolution; ++i)
- m_fromLinear[i] = ushort(qRound(inv.apply(i / qreal(Resolution)) * (255 * 256)));
+ m_fromLinear[i] = ushort(qRound(qBound(0.f, fun.applyInverse(i * iRes), 1.f) * (255 * 256)));
}
}
void QColorTrcLut::setFromTransferTable(const QColorTransferTable &table, Direction dir)
{
+ constexpr float iRes = 1.f / float(Resolution);
if (dir & ToLinear) {
if (!m_toLinear)
m_toLinear.reset(new ushort[Resolution + 1]);
for (int i = 0; i <= Resolution; ++i)
- m_toLinear[i] = ushort(qBound(0, qRound(table.apply(i / qreal(Resolution)) * (255 * 256)), 65280));
+ m_toLinear[i] = ushort(qRound(table.apply(i * iRes) * (255 * 256)));
}
if (dir & FromLinear) {
@@ -83,10 +102,24 @@ void QColorTrcLut::setFromTransferTable(const QColorTransferTable &table, Direct
m_fromLinear.reset(new ushort[Resolution + 1]);
float minInverse = 0.0f;
for (int i = 0; i <= Resolution; ++i) {
- minInverse = table.applyInverse(i / qreal(Resolution), minInverse);
- m_fromLinear[i] = ushort(qBound(0, qRound(minInverse * (255 * 256)), 65280));
+ minInverse = table.applyInverse(i * iRes, minInverse);
+ m_fromLinear[i] = ushort(qRound(minInverse * (255 * 256)));
}
}
}
+void QColorTrcLut::setFromTrc(const QColorTrc &trc, Direction dir)
+{
+ switch (trc.m_type) {
+ case QColorTrc::Type::ParameterizedFunction:
+ return setFromTransferFunction(trc.fun(), dir);
+ case QColorTrc::Type::Table:
+ return setFromTransferTable(trc.table(), dir);
+ case QColorTrc::Type::GenericFunction:
+ return setFromTransferGenericFunction(trc.hdr(), dir);
+ case QColorTrc::Type::Uninitialized:
+ break;
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/painting/qcolortrclut_p.h b/src/gui/painting/qcolortrclut_p.h
index 3ebab42809..15f7348836 100644
--- a/src/gui/painting/qcolortrclut_p.h
+++ b/src/gui/painting/qcolortrclut_p.h
@@ -30,8 +30,10 @@
QT_BEGIN_NAMESPACE
+class QColorTransferGenericFunction;
class QColorTransferFunction;
class QColorTransferTable;
+class QColorTrc;
class Q_GUI_EXPORT QColorTrcLut
{
@@ -46,12 +48,13 @@ public:
BiLinear = ToLinear | FromLinear
};
- static std::shared_ptr<QColorTrcLut> fromGamma(qreal gamma, Direction dir = BiLinear);
- static std::shared_ptr<QColorTrcLut> fromTransferFunction(const QColorTransferFunction &transFn, Direction dir = BiLinear);
- static std::shared_ptr<QColorTrcLut> fromTransferTable(const QColorTransferTable &transTable, Direction dir = BiLinear);
- void setFromGamma(qreal gamma, Direction dir = BiLinear);
+ static std::shared_ptr<QColorTrcLut> fromGamma(float gamma, Direction dir = BiLinear);
+ static std::shared_ptr<QColorTrcLut> fromTrc(const QColorTrc &trc, Direction dir = BiLinear);
+ void setFromGamma(float gamma, Direction dir = BiLinear);
void setFromTransferFunction(const QColorTransferFunction &transFn, Direction dir = BiLinear);
void setFromTransferTable(const QColorTransferTable &transTable, Direction dir = BiLinear);
+ void setFromTransferGenericFunction(const QColorTransferGenericFunction &transfn, Direction dir);
+ void setFromTrc(const QColorTrc &trc, Direction dir);
// The following methods all convert opaque or unpremultiplied colors:
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index b7a943be38..aaf57e19d1 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -644,7 +644,7 @@ static void QT_FASTCALL destStoreGray8(QRasterBuffer *rasterBuffer, int x, int y
QColorTransform tf = QColorSpacePrivate::get(fromCS)->transformationToXYZ();
QColorTransformPrivate *tfd = QColorTransformPrivate::get(tf);
- tfd->applyReturnGray(data, buffer, length, QColorTransformPrivate::InputPremultiplied);
+ tfd->apply(data, buffer, length, QColorTransformPrivate::InputPremultiplied);
}
}
@@ -668,7 +668,7 @@ static void QT_FASTCALL destStoreGray16(QRasterBuffer *rasterBuffer, int x, int
QRgba64 tmp_line[BufferSize];
for (int k = 0; k < length; ++k)
tmp_line[k] = QRgba64::fromArgb32(buffer[k]);
- tfd->applyReturnGray(data, tmp_line, length, QColorTransformPrivate::InputPremultiplied);
+ tfd->apply(data, tmp_line, length, QColorTransformPrivate::InputPremultiplied);
}
}
@@ -749,7 +749,7 @@ static void QT_FASTCALL destStore64Gray8(QRasterBuffer *rasterBuffer, int x, int
QColorTransformPrivate *tfd = QColorTransformPrivate::get(tf);
quint16 gray_line[BufferSize];
- tfd->applyReturnGray(gray_line, buffer, length, QColorTransformPrivate::InputPremultiplied);
+ tfd->apply(gray_line, buffer, length, QColorTransformPrivate::InputPremultiplied);
for (int k = 0; k < length; ++k)
data[k] = qt_div_257(gray_line[k]);
}
@@ -771,7 +771,7 @@ static void QT_FASTCALL destStore64Gray16(QRasterBuffer *rasterBuffer, int x, in
QColorSpace fromCS = rasterBuffer->colorSpace.isValid() ? rasterBuffer->colorSpace : QColorSpace::SRgb;
QColorTransform tf = QColorSpacePrivate::get(fromCS)->transformationToXYZ();
QColorTransformPrivate *tfd = QColorTransformPrivate::get(tf);
- tfd->applyReturnGray(data, buffer, length, QColorTransformPrivate::InputPremultiplied);
+ tfd->apply(data, buffer, length, QColorTransformPrivate::InputPremultiplied);
}
}
diff --git a/src/gui/painting/qicc.cpp b/src/gui/painting/qicc.cpp
index c01fa433ea..0323dd1195 100644
--- a/src/gui/painting/qicc.cpp
+++ b/src/gui/painting/qicc.cpp
@@ -116,6 +116,7 @@ enum class Tag : quint32 {
mAB_ = IccTag('m', 'A', 'B', ' '),
mBA_ = IccTag('m', 'B', 'A', ' '),
chad = IccTag('c', 'h', 'a', 'd'),
+ cicp = IccTag('c', 'i', 'c', 'p'),
gamt = IccTag('g', 'a', 'm', 't'),
sf32 = IccTag('s', 'f', '3', '2'),
@@ -247,6 +248,13 @@ struct Sf32TagData : GenericTagData {
quint32_be value[9];
};
+struct CicpTagData : GenericTagData {
+ quint8 colorPrimaries;
+ quint8 transferCharacteristics;
+ quint8 matrixCoefficients;
+ quint8 videoFullRangeFlag;
+};
+
struct MatrixElement {
qint32_be e0;
qint32_be e1;
@@ -264,7 +272,11 @@ struct MatrixElement {
static int toFixedS1516(float x)
{
- return int(x * 65536.0f + 0.5f);
+ if (x < float(SHRT_MIN))
+ return INT_MIN;
+ if (x > float(SHRT_MAX))
+ return INT_MAX;
+ return qRound(x * 65536.0f);
}
static float fromFixedS1516(int x)
@@ -327,7 +339,7 @@ static int writeColorTrc(QDataStream &stream, const QColorTrc &trc)
return 12;
}
- if (trc.m_type == QColorTrc::Type::Function) {
+ if (trc.m_type == QColorTrc::Type::ParameterizedFunction) {
const QColorTransferFunction &fun = trc.m_fun;
stream << uint(Tag::para) << uint(0);
if (fun.isGamma()) {
@@ -348,6 +360,14 @@ static int writeColorTrc(QDataStream &stream, const QColorTrc &trc)
stream << toFixedS1516(fun.m_f);
return 12 + 7 * 4;
}
+ if (trc.m_type != QColorTrc::Type::Table) {
+ stream << uint(Tag::curv) << uint(0);
+ stream << uint(16);
+ for (uint i = 0; i < 16; ++i) {
+ stream << ushort(qBound(0, qRound(trc.apply(i / 15.f) * 65535.f), 65535));
+ }
+ return 12 + 16 * 2;
+ }
Q_ASSERT(trc.m_type == QColorTrc::Type::Table);
stream << uint(Tag::curv) << uint(0);
@@ -368,31 +388,441 @@ static int writeColorTrc(QDataStream &stream, const QColorTrc &trc)
return 12 + 2 * trc.m_table.m_tableSize;
}
+// very simple version for small values (<=4) of exp.
+static constexpr qsizetype intPow(qsizetype x, qsizetype exp)
+{
+ return (exp <= 1) ? x : x * intPow(x, exp - 1);
+}
+
+struct ElementCombo
+{
+ const QColorMatrix *inMatrix = nullptr;
+ const QColorSpacePrivate::TransferElement *inTable = nullptr;
+ const QColorCLUT *clut = nullptr;
+ const QColorSpacePrivate::TransferElement *midTable = nullptr;
+ const QColorMatrix *midMatrix = nullptr;
+ const QColorVector *midOffset = nullptr;
+ const QColorSpacePrivate::TransferElement *outTable = nullptr;
+};
+
+static void visitElement(ElementCombo &combo, const QColorSpacePrivate::TransferElement &element, int number,
+ const QList<QColorSpacePrivate::Element> &list)
+{
+ if (number == 0)
+ combo.inTable = &element;
+ else if (number == list.size() - 1)
+ combo.outTable = &element;
+ else if (number == 1 && combo.inMatrix)
+ combo.inTable = &element;
+ else
+ combo.midTable = &element;
+}
+
+static void visitElement(ElementCombo &combo, const QColorMatrix &element, int number,
+ const QList<QColorSpacePrivate::Element> &)
+{
+ if (number == 0)
+ combo.inMatrix = &element;
+ else
+ combo.midMatrix = &element;
+}
+
+static void visitElement(ElementCombo &combo, const QColorVector &element, int,
+ const QList<QColorSpacePrivate::Element> &)
+{
+ combo.midOffset = &element;
+}
+
+static void visitElement(ElementCombo &combo, const QColorCLUT &element, int,
+ const QList<QColorSpacePrivate::Element> &)
+{
+ combo.clut = &element;
+}
+
+static bool isTableTrc(const QColorSpacePrivate::TransferElement *transfer)
+{
+ int i = 0;
+ while (i < 4 && transfer->trc[i].isValid()) {
+ if (transfer->trc[i].m_type != QColorTrc::Type::Table)
+ return false;
+ i++;
+ }
+ return i > 0;
+}
+
+static bool isTableTrcSingleSize(const QColorSpacePrivate::TransferElement *transfer)
+{
+ Q_ASSERT(transfer->trc[0].m_type == QColorTrc::Type::Table);
+ int i = 1;
+ const uint32_t size = transfer->trc[0].table().m_tableSize;
+ while (i < 4 && transfer->trc[i].isValid()) {
+ if (transfer->trc[i].table().m_tableSize != size)
+ return false;
+ i++;
+ }
+ return true;
+}
+
+static int writeMab(QDataStream &stream, const QList<QColorSpacePrivate::Element> &abList, bool isAb, bool pcsLab, bool isCmyk)
+{
+ int number = 0;
+ ElementCombo combo;
+ for (auto &&element : abList)
+ std::visit([&](auto &&elm) { visitElement(combo, elm, number++, abList); }, element);
+
+ Q_ASSERT(!(combo.inMatrix && combo.midMatrix));
+
+ // qWarning() << Q_FUNC_INFO << bool(combo.inMatrix) << bool(combo.inTable) << bool(combo.clut) << bool(combo.midTable) << bool(combo.midMatrix) << bool(combo.midOffset) << bool(combo.outTable);
+ bool lut16 = true;
+ if (combo.midMatrix || combo.midTable || combo.midOffset)
+ lut16 = false;
+ if (combo.clut && (combo.clut->gridPointsX != combo.clut->gridPointsY ||
+ combo.clut->gridPointsX != combo.clut->gridPointsZ ||
+ (combo.clut->gridPointsW > 1 && combo.clut->gridPointsX != combo.clut->gridPointsW)))
+ lut16 = false;
+ if (lut16 && combo.inTable)
+ lut16 = isTableTrc(combo.inTable) && isTableTrcSingleSize(combo.inTable);
+ if (lut16 && combo.outTable)
+ lut16 = isTableTrc(combo.outTable) && isTableTrcSingleSize(combo.outTable);
+
+ if (!lut16) {
+ if (combo.inMatrix)
+ qSwap(combo.inMatrix, combo.midMatrix);
+ if (isAb)
+ stream << uint(Tag::mAB_) << uint(0);
+ else
+ stream << uint(Tag::mBA_) << uint(0);
+ } else {
+ stream << uint(Tag::mft2) << uint(0);
+ }
+
+ const int inChannels = (isCmyk && isAb) ? 4 : 3;
+ const int outChannels = (isCmyk && !isAb) ? 4 : 3;
+ stream << uchar(inChannels) << uchar(outChannels);
+ qsizetype gridPointsLut16 = 0;
+ if (lut16 && combo.clut)
+ gridPointsLut16 = combo.clut->gridPointsX;
+ if (lut16)
+ stream << uchar(gridPointsLut16) << uchar(0);
+ else
+ stream << quint16(0);
+ if (lut16) {
+ if (combo.inMatrix) {
+ stream << toFixedS1516(combo.inMatrix->r.x);
+ stream << toFixedS1516(combo.inMatrix->g.x);
+ stream << toFixedS1516(combo.inMatrix->b.x);
+ stream << toFixedS1516(combo.inMatrix->r.y);
+ stream << toFixedS1516(combo.inMatrix->g.y);
+ stream << toFixedS1516(combo.inMatrix->b.y);
+ stream << toFixedS1516(combo.inMatrix->r.z);
+ stream << toFixedS1516(combo.inMatrix->g.z);
+ stream << toFixedS1516(combo.inMatrix->b.z);
+ } else {
+ stream << toFixedS1516(1.0f);
+ stream << toFixedS1516(0.0f);
+ stream << toFixedS1516(0.0f);
+ stream << toFixedS1516(0.0f);
+ stream << toFixedS1516(1.0f);
+ stream << toFixedS1516(0.0f);
+ stream << toFixedS1516(0.0f);
+ stream << toFixedS1516(0.0f);
+ stream << toFixedS1516(1.0f);
+ }
+ int inputEntries = 0, outputEntries = 0;
+ if (combo.inTable)
+ inputEntries = combo.inTable->trc[0].table().m_tableSize;
+ else
+ inputEntries = 2;
+ if (combo.outTable)
+ outputEntries = combo.outTable->trc[0].table().m_tableSize;
+ else
+ outputEntries = 2;
+ stream << quint16(inputEntries);
+ stream << quint16(outputEntries);
+ auto writeTable = [&](const QColorSpacePrivate::TransferElement *table, int entries, int channels) {
+ if (table) {
+ for (int j = 0; j < channels; ++j) {
+ if (!table->trc[j].table().m_table16.isEmpty()) {
+ for (int i = 0; i < entries; ++i)
+ stream << table->trc[j].table().m_table16[i];
+ } else {
+ for (int i = 0; i < entries; ++i)
+ stream << quint16(table->trc[j].table().m_table8[i] * 257);
+ }
+ }
+ } else {
+ for (int j = 0; j < channels; ++j)
+ stream << quint16(0) << quint16(65535);
+ }
+ };
+
+ writeTable(combo.inTable, inputEntries, inChannels);
+
+ if (combo.clut) {
+ if (isAb && pcsLab) {
+ for (const QColorVector &v : combo.clut->table) {
+ stream << quint16(v.x * 65280.0f + 0.5f);
+ stream << quint16(v.y * 65280.0f + 0.5f);
+ stream << quint16(v.z * 65280.0f + 0.5f);
+ }
+ } else {
+ if (outChannels == 4) {
+ for (const QColorVector &v : combo.clut->table) {
+ stream << quint16(v.x * 65535.0f + 0.5f);
+ stream << quint16(v.y * 65535.0f + 0.5f);
+ stream << quint16(v.z * 65535.0f + 0.5f);
+ stream << quint16(v.w * 65535.0f + 0.5f);
+ }
+ } else {
+ for (const QColorVector &v : combo.clut->table) {
+ stream << quint16(v.x * 65535.0f + 0.5f);
+ stream << quint16(v.y * 65535.0f + 0.5f);
+ stream << quint16(v.z * 65535.0f + 0.5f);
+ }
+ }
+ }
+ }
+
+ writeTable(combo.outTable, outputEntries, outChannels);
+
+ qsizetype offset = sizeof(Lut16TagData) + 2 * inChannels * inputEntries
+ + 2 * outChannels * outputEntries
+ + 2 * outChannels * intPow(gridPointsLut16, inChannels);
+ if (offset & 0x2) {
+ stream << quint16(0);
+ offset += 2;
+ }
+ return offset;
+ } else {
+ // mAB/mBA tag:
+ if (isAb) {
+ if (!combo.clut && combo.inTable && combo.midMatrix && !combo.midTable)
+ std::swap(combo.inTable, combo.midTable);
+ } else {
+ if (!combo.clut && combo.outTable && combo.midMatrix && !combo.midTable)
+ std::swap(combo.outTable, combo.midTable);
+ }
+ quint32 offset = sizeof(mABTagData);
+ QBuffer buffer2;
+ buffer2.open(QIODevice::WriteOnly);
+ QDataStream stream2(&buffer2);
+ quint32 bOffset = offset;
+ quint32 matrixOffset = 0;
+ quint32 mOffset = 0;
+ quint32 clutOffset = 0;
+ quint32 aOffset = 0;
+ // Tags must start on 4 byte offsets, but sampled curves might have sizes 2-byte aligned
+ auto alignTag = [&]() {
+ if (offset & 0x2) {
+ stream2 << quint16(0);
+ offset += 2;
+ }
+ };
+
+ const QColorSpacePrivate::TransferElement *aCurve, *bCurve;
+ int aChannels;
+ if (isAb) {
+ aCurve = combo.inTable;
+ aChannels = inChannels;
+ bCurve = combo.outTable;
+ Q_ASSERT(outChannels == 3);
+ } else {
+ aCurve = combo.outTable;
+ aChannels = outChannels;
+ bCurve = combo.inTable;
+ Q_ASSERT(inChannels == 3);
+ }
+ if (bCurve) {
+ offset += writeColorTrc(stream2, bCurve->trc[0]);
+ alignTag();
+ offset += writeColorTrc(stream2, bCurve->trc[1]);
+ alignTag();
+ offset += writeColorTrc(stream2, bCurve->trc[2]);
+ alignTag();
+ } else {
+ stream2 << uint(Tag::curv) << uint(0) << uint(0);
+ stream2 << uint(Tag::curv) << uint(0) << uint(0);
+ stream2 << uint(Tag::curv) << uint(0) << uint(0);
+ offset += 12 * 3;
+ }
+ if (combo.midMatrix || combo.midOffset || combo.midTable) {
+ matrixOffset = offset;
+ if (combo.midMatrix) {
+ stream2 << toFixedS1516(combo.midMatrix->r.x);
+ stream2 << toFixedS1516(combo.midMatrix->g.x);
+ stream2 << toFixedS1516(combo.midMatrix->b.x);
+ stream2 << toFixedS1516(combo.midMatrix->r.y);
+ stream2 << toFixedS1516(combo.midMatrix->g.y);
+ stream2 << toFixedS1516(combo.midMatrix->b.y);
+ stream2 << toFixedS1516(combo.midMatrix->r.z);
+ stream2 << toFixedS1516(combo.midMatrix->g.z);
+ stream2 << toFixedS1516(combo.midMatrix->b.z);
+ } else {
+ stream2 << toFixedS1516(1.0f);
+ stream2 << toFixedS1516(0.0f);
+ stream2 << toFixedS1516(0.0f);
+ stream2 << toFixedS1516(0.0f);
+ stream2 << toFixedS1516(1.0f);
+ stream2 << toFixedS1516(0.0f);
+ stream2 << toFixedS1516(0.0f);
+ stream2 << toFixedS1516(0.0f);
+ stream2 << toFixedS1516(1.0f);
+ }
+ if (combo.midOffset) {
+ stream2 << toFixedS1516(combo.midOffset->x);
+ stream2 << toFixedS1516(combo.midOffset->y);
+ stream2 << toFixedS1516(combo.midOffset->z);
+ } else {
+ stream2 << toFixedS1516(0.0f);
+ stream2 << toFixedS1516(0.0f);
+ stream2 << toFixedS1516(0.0f);
+ }
+ offset += 12 * 4;
+ mOffset = offset;
+ if (combo.midTable) {
+ offset += writeColorTrc(stream2, combo.midTable->trc[0]);
+ alignTag();
+ offset += writeColorTrc(stream2, combo.midTable->trc[1]);
+ alignTag();
+ offset += writeColorTrc(stream2, combo.midTable->trc[2]);
+ alignTag();
+ } else {
+ stream2 << uint(Tag::curv) << uint(0) << uint(0);
+ stream2 << uint(Tag::curv) << uint(0) << uint(0);
+ stream2 << uint(Tag::curv) << uint(0) << uint(0);
+ offset += 12 * 3;
+ }
+ }
+ if (combo.clut || aCurve) {
+ clutOffset = offset;
+ if (combo.clut) {
+ stream2 << uchar(combo.clut->gridPointsX);
+ stream2 << uchar(combo.clut->gridPointsY);
+ stream2 << uchar(combo.clut->gridPointsZ);
+ if (inChannels == 4)
+ stream2 << uchar(combo.clut->gridPointsW);
+ else
+ stream2 << uchar(0);
+ for (int i = 0; i < 12; ++i)
+ stream2 << uchar(0);
+ stream2 << uchar(2) << uchar(0) << uchar(0) << uchar(0);
+ offset += 20;
+ if (outChannels == 4) {
+ for (const QColorVector &v : combo.clut->table) {
+ stream2 << quint16(v.x * 65535.0f + 0.5f);
+ stream2 << quint16(v.y * 65535.0f + 0.5f);
+ stream2 << quint16(v.z * 65535.0f + 0.5f);
+ stream2 << quint16(v.w * 65535.0f + 0.5f);
+ }
+ } else {
+ for (const QColorVector &v : combo.clut->table) {
+ stream2 << quint16(v.x * 65535.0f + 0.5f);
+ stream2 << quint16(v.y * 65535.0f + 0.5f);
+ stream2 << quint16(v.z * 65535.0f + 0.5f);
+ }
+ }
+ offset += 2 * outChannels * combo.clut->table.size();
+ alignTag();
+ } else {
+ for (int i = 0; i < 16; ++i)
+ stream2 << uchar(0);
+ stream2 << uchar(1) << uchar(0) << uchar(0) << uchar(0);
+ offset += 20;
+ }
+ aOffset = offset;
+ if (aCurve) {
+ offset += writeColorTrc(stream2, aCurve->trc[0]);
+ alignTag();
+ offset += writeColorTrc(stream2, aCurve->trc[1]);
+ alignTag();
+ offset += writeColorTrc(stream2, aCurve->trc[2]);
+ alignTag();
+ if (aChannels == 4) {
+ offset += writeColorTrc(stream2, aCurve->trc[3]);
+ alignTag();
+ }
+ } else {
+ stream2 << uint(Tag::curv) << uint(0) << uint(0);
+ stream2 << uint(Tag::curv) << uint(0) << uint(0);
+ stream2 << uint(Tag::curv) << uint(0) << uint(0);
+ if (aChannels == 4)
+ stream2 << uint(Tag::curv) << uint(0) << uint(0);
+ offset += 12 * aChannels;
+ }
+ }
+ buffer2.close();
+ QByteArray tagData = buffer2.buffer();
+ stream << quint32(bOffset);
+ stream << quint32(matrixOffset);
+ stream << quint32(mOffset);
+ stream << quint32(clutOffset);
+ stream << quint32(aOffset);
+ stream.writeRawData(tagData.data(), tagData.size());
+
+ return int(sizeof(mABTagData) + tagData.size());
+ }
+}
+
QByteArray toIccProfile(const QColorSpace &space)
{
if (!space.isValid())
return QByteArray();
const QColorSpacePrivate *spaceDPtr = QColorSpacePrivate::get(space);
- // This should catch anything not three component matrix based as we can only get that from parsed ICC
if (!spaceDPtr->iccProfile.isEmpty())
return spaceDPtr->iccProfile;
- Q_ASSERT(spaceDPtr->isThreeComponentMatrix());
int fixedLengthTagCount = 5;
+ if (!spaceDPtr->isThreeComponentMatrix())
+ fixedLengthTagCount = 2;
+ else if (spaceDPtr->colorModel == QColorSpace::ColorModel::Gray)
+ fixedLengthTagCount = 2;
bool writeChad = false;
- if (!spaceDPtr->whitePoint.isNull() && spaceDPtr->whitePoint != QColorVector::D50()) {
+ bool writeB2a = true;
+ bool writeCicp = false;
+ if (spaceDPtr->isThreeComponentMatrix() && !spaceDPtr->chad.isIdentity()) {
writeChad = true;
fixedLengthTagCount++;
}
+ int varLengthTagCount = 4;
+ if (!spaceDPtr->isThreeComponentMatrix())
+ varLengthTagCount = 3;
+ else if (spaceDPtr->colorModel == QColorSpace::ColorModel::Gray)
+ varLengthTagCount = 2;
+
+ if (!space.isValidTarget()) {
+ writeB2a = false;
+ Q_ASSERT(!spaceDPtr->isThreeComponentMatrix());
+ varLengthTagCount--;
+ }
+ switch (spaceDPtr->transferFunction) {
+ case QColorSpace::TransferFunction::St2084:
+ case QColorSpace::TransferFunction::Hlg:
+ writeCicp = true;
+ fixedLengthTagCount++;
+ default:
+ break;
+ }
- const int tagCount = fixedLengthTagCount + 4;
+ const int tagCount = fixedLengthTagCount + varLengthTagCount;
const uint profileDataOffset = 128 + 4 + 12 * tagCount;
- const uint variableTagTableOffsets = 128 + 4 + 12 * fixedLengthTagCount;
+ uint variableTagTableOffsets = 128 + 4 + 12 * fixedLengthTagCount;
+
uint currentOffset = 0;
- uint rTrcOffset, gTrcOffset, bTrcOffset;
- uint rTrcSize, gTrcSize, bTrcSize;
- uint descOffset, descSize;
+ uint rTrcOffset = 0;
+ uint gTrcOffset = 0;
+ uint bTrcOffset = 0;
+ uint kTrcOffset = 0;
+ uint rTrcSize = 0;
+ uint gTrcSize = 0;
+ uint bTrcSize = 0;
+ uint kTrcSize = 0;
+ uint descOffset = 0;
+ uint descSize = 0;
+ uint mA2bOffset = 0;
+ uint mB2aOffset = 0;
+ uint mA2bSize = 0;
+ uint mB2aSize = 0;
QBuffer buffer;
buffer.open(QIODevice::WriteOnly);
@@ -403,13 +833,25 @@ QByteArray toIccProfile(const QColorSpace &space)
stream << uint(0);
stream << uint(0x04400000); // Version 4.4
stream << uint(ProfileClass::Display);
- stream << uint(Tag::RGB_);
+ switch (spaceDPtr->colorModel) {
+ case QColorSpace::ColorModel::Rgb:
+ stream << uint(ColorSpaceType::Rgb);
+ break;
+ case QColorSpace::ColorModel::Gray:
+ stream << uint(ColorSpaceType::Gray);
+ break;
+ case QColorSpace::ColorModel::Cmyk:
+ stream << uint(ColorSpaceType::Cmyk);
+ break;
+ case QColorSpace::ColorModel::Undefined:
+ Q_UNREACHABLE();
+ }
stream << (spaceDPtr->isPcsLab ? uint(Tag::Lab_) : uint(Tag::XYZ_));
stream << uint(0) << uint(0) << uint(0);
stream << uint(Tag::acsp);
stream << uint(0) << uint(0) << uint(0);
stream << uint(0) << uint(0) << uint(0);
- stream << uint(1); // Rendering intent
+ stream << uint(0); // Rendering intent
stream << uint(0x0000f6d6); // D50 X
stream << uint(0x00010000); // D50 Y
stream << uint(0x0000d32d); // D50 Z
@@ -417,81 +859,148 @@ QByteArray toIccProfile(const QColorSpace &space)
stream << uint(0) << uint(0) << uint(0) << uint(0);
stream << uint(0) << uint(0) << uint(0) << uint(0) << uint(0) << uint(0) << uint(0);
- // Tag table:
currentOffset = profileDataOffset;
- stream << uint(tagCount);
- stream << uint(Tag::rXYZ) << uint(profileDataOffset + 00) << uint(20);
- stream << uint(Tag::gXYZ) << uint(profileDataOffset + 20) << uint(20);
- stream << uint(Tag::bXYZ) << uint(profileDataOffset + 40) << uint(20);
- stream << uint(Tag::wtpt) << uint(profileDataOffset + 60) << uint(20);
- stream << uint(Tag::cprt) << uint(profileDataOffset + 80) << uint(34);
- currentOffset += 20 + 20 + 20 + 20 + 34 + 2;
- if (writeChad) {
- stream << uint(Tag::chad) << uint(currentOffset) << uint(44);
- currentOffset += 44;
- }
- // From here the offset and size will be updated later:
- stream << uint(Tag::rTRC) << uint(0) << uint(0);
- stream << uint(Tag::gTRC) << uint(0) << uint(0);
- stream << uint(Tag::bTRC) << uint(0) << uint(0);
- stream << uint(Tag::desc) << uint(0) << uint(0);
-
- // Tag data:
- stream << uint(Tag::XYZ_) << uint(0);
- stream << toFixedS1516(spaceDPtr->toXyz.r.x);
- stream << toFixedS1516(spaceDPtr->toXyz.r.y);
- stream << toFixedS1516(spaceDPtr->toXyz.r.z);
- stream << uint(Tag::XYZ_) << uint(0);
- stream << toFixedS1516(spaceDPtr->toXyz.g.x);
- stream << toFixedS1516(spaceDPtr->toXyz.g.y);
- stream << toFixedS1516(spaceDPtr->toXyz.g.z);
- stream << uint(Tag::XYZ_) << uint(0);
- stream << toFixedS1516(spaceDPtr->toXyz.b.x);
- stream << toFixedS1516(spaceDPtr->toXyz.b.y);
- stream << toFixedS1516(spaceDPtr->toXyz.b.z);
- stream << uint(Tag::XYZ_) << uint(0);
- stream << toFixedS1516(spaceDPtr->whitePoint.x);
- stream << toFixedS1516(spaceDPtr->whitePoint.y);
- stream << toFixedS1516(spaceDPtr->whitePoint.z);
- stream << uint(Tag::mluc) << uint(0);
- stream << uint(1) << uint(12);
- stream << uchar('e') << uchar('n') << uchar('U') << uchar('S');
- stream << uint(6) << uint(28);
- stream << ushort('N') << ushort('/') << ushort('A');
- stream << ushort(0); // 4-byte alignment
- if (writeChad) {
- QColorMatrix chad = QColorMatrix::chromaticAdaptation(spaceDPtr->whitePoint);
- stream << uint(Tag::sf32) << uint(0);
- stream << toFixedS1516(chad.r.x);
- stream << toFixedS1516(chad.g.x);
- stream << toFixedS1516(chad.b.x);
- stream << toFixedS1516(chad.r.y);
- stream << toFixedS1516(chad.g.y);
- stream << toFixedS1516(chad.b.y);
- stream << toFixedS1516(chad.r.z);
- stream << toFixedS1516(chad.g.z);
- stream << toFixedS1516(chad.b.z);
- }
-
- // From now on the data is variable sized:
- rTrcOffset = currentOffset;
- rTrcSize = writeColorTrc(stream, spaceDPtr->trc[0]);
- currentOffset += rTrcSize;
- if (spaceDPtr->trc[0] == spaceDPtr->trc[1]) {
- gTrcOffset = rTrcOffset;
- gTrcSize = rTrcSize;
- } else {
- gTrcOffset = currentOffset;
- gTrcSize = writeColorTrc(stream, spaceDPtr->trc[1]);
- currentOffset += gTrcSize;
- }
- if (spaceDPtr->trc[0] == spaceDPtr->trc[2]) {
- bTrcOffset = rTrcOffset;
- bTrcSize = rTrcSize;
+ if (spaceDPtr->isThreeComponentMatrix()) {
+ // Tag table:
+ stream << uint(tagCount);
+ if (spaceDPtr->colorModel == QColorSpace::ColorModel::Rgb) {
+ stream << uint(Tag::rXYZ) << uint(currentOffset + 00) << uint(20);
+ stream << uint(Tag::gXYZ) << uint(currentOffset + 20) << uint(20);
+ stream << uint(Tag::bXYZ) << uint(currentOffset + 40) << uint(20);
+ currentOffset += 20 + 20 + 20;
+ }
+ stream << uint(Tag::wtpt) << uint(currentOffset + 00) << uint(20);
+ stream << uint(Tag::cprt) << uint(currentOffset + 20) << uint(34);
+ currentOffset += 20 + 34 + 2;
+ if (writeChad) {
+ stream << uint(Tag::chad) << uint(currentOffset) << uint(44);
+ currentOffset += 44;
+ }
+ if (writeCicp) {
+ stream << uint(Tag::cicp) << uint(currentOffset) << uint(12);
+ currentOffset += 12;
+ }
+ // From here the offset and size will be updated later:
+ if (spaceDPtr->colorModel == QColorSpace::ColorModel::Rgb) {
+ stream << uint(Tag::rTRC) << uint(0) << uint(0);
+ stream << uint(Tag::gTRC) << uint(0) << uint(0);
+ stream << uint(Tag::bTRC) << uint(0) << uint(0);
+ } else {
+ stream << uint(Tag::kTRC) << uint(0) << uint(0);
+ }
+ stream << uint(Tag::desc) << uint(0) << uint(0);
+
+ // Tag data:
+ if (spaceDPtr->colorModel == QColorSpace::ColorModel::Rgb) {
+ stream << uint(Tag::XYZ_) << uint(0);
+ stream << toFixedS1516(spaceDPtr->toXyz.r.x);
+ stream << toFixedS1516(spaceDPtr->toXyz.r.y);
+ stream << toFixedS1516(spaceDPtr->toXyz.r.z);
+ stream << uint(Tag::XYZ_) << uint(0);
+ stream << toFixedS1516(spaceDPtr->toXyz.g.x);
+ stream << toFixedS1516(spaceDPtr->toXyz.g.y);
+ stream << toFixedS1516(spaceDPtr->toXyz.g.z);
+ stream << uint(Tag::XYZ_) << uint(0);
+ stream << toFixedS1516(spaceDPtr->toXyz.b.x);
+ stream << toFixedS1516(spaceDPtr->toXyz.b.y);
+ stream << toFixedS1516(spaceDPtr->toXyz.b.z);
+ }
+ stream << uint(Tag::XYZ_) << uint(0);
+ stream << toFixedS1516(spaceDPtr->whitePoint.x);
+ stream << toFixedS1516(spaceDPtr->whitePoint.y);
+ stream << toFixedS1516(spaceDPtr->whitePoint.z);
+ stream << uint(Tag::mluc) << uint(0);
+ stream << uint(1) << uint(12);
+ stream << uchar('e') << uchar('n') << uchar('U') << uchar('S');
+ stream << uint(6) << uint(28);
+ stream << ushort('N') << ushort('/') << ushort('A');
+ stream << ushort(0); // 4-byte alignment
+ if (writeChad) {
+ const QColorMatrix &chad = spaceDPtr->chad;
+ stream << uint(Tag::sf32) << uint(0);
+ stream << toFixedS1516(chad.r.x);
+ stream << toFixedS1516(chad.g.x);
+ stream << toFixedS1516(chad.b.x);
+ stream << toFixedS1516(chad.r.y);
+ stream << toFixedS1516(chad.g.y);
+ stream << toFixedS1516(chad.b.y);
+ stream << toFixedS1516(chad.r.z);
+ stream << toFixedS1516(chad.g.z);
+ stream << toFixedS1516(chad.b.z);
+ }
+ if (writeCicp) {
+ stream << uint(Tag::cicp) << uint(0);
+ stream << uchar(2); // Unspecified primaries
+ if (spaceDPtr->transferFunction == QColorSpace::TransferFunction::St2084)
+ stream << uchar(16);
+ else if (spaceDPtr->transferFunction == QColorSpace::TransferFunction::Hlg)
+ stream << uchar(18);
+ else
+ Q_UNREACHABLE();
+ stream << uchar(0); // Only for YCbCr, otherwise 0
+ stream << uchar(1); // Video full range
+ }
+
+ // From now on the data is variable sized:
+ if (spaceDPtr->colorModel == QColorSpace::ColorModel::Rgb) {
+ rTrcOffset = currentOffset;
+ rTrcSize = writeColorTrc(stream, spaceDPtr->trc[0]);
+ currentOffset += rTrcSize;
+ if (spaceDPtr->trc[0] == spaceDPtr->trc[1]) {
+ gTrcOffset = rTrcOffset;
+ gTrcSize = rTrcSize;
+ } else {
+ gTrcOffset = currentOffset;
+ gTrcSize = writeColorTrc(stream, spaceDPtr->trc[1]);
+ currentOffset += gTrcSize;
+ }
+ if (spaceDPtr->trc[0] == spaceDPtr->trc[2]) {
+ bTrcOffset = rTrcOffset;
+ bTrcSize = rTrcSize;
+ } else {
+ bTrcOffset = currentOffset;
+ bTrcSize = writeColorTrc(stream, spaceDPtr->trc[2]);
+ currentOffset += bTrcSize;
+ }
+ } else {
+ Q_ASSERT(spaceDPtr->colorModel == QColorSpace::ColorModel::Gray);
+ kTrcOffset = currentOffset;
+ kTrcSize = writeColorTrc(stream, spaceDPtr->trc[0]);
+ currentOffset += kTrcSize;
+ }
} else {
- bTrcOffset = currentOffset;
- bTrcSize = writeColorTrc(stream, spaceDPtr->trc[2]);
- currentOffset += bTrcSize;
+ // Tag table:
+ stream << uint(tagCount);
+ stream << uint(Tag::wtpt) << uint(profileDataOffset + 00) << uint(20);
+ stream << uint(Tag::cprt) << uint(profileDataOffset + 20) << uint(34);
+ currentOffset += 20 + 34 + 2;
+ // From here the offset and size will be updated later:
+ stream << uint(Tag::A2B0) << uint(0) << uint(0);
+ if (writeB2a)
+ stream << uint(Tag::B2A0) << uint(0) << uint(0);
+ stream << uint(Tag::desc) << uint(0) << uint(0);
+
+ // Fixed tag data
+ stream << uint(Tag::XYZ_) << uint(0);
+ stream << toFixedS1516(spaceDPtr->whitePoint.x);
+ stream << toFixedS1516(spaceDPtr->whitePoint.y);
+ stream << toFixedS1516(spaceDPtr->whitePoint.z);
+ stream << uint(Tag::mluc) << uint(0);
+ stream << uint(1) << uint(12);
+ stream << uchar('e') << uchar('n') << uchar('U') << uchar('S');
+ stream << uint(6) << uint(28);
+ stream << ushort('N') << ushort('/') << ushort('A');
+ stream << ushort(0); // 4-byte alignment
+
+ // From now on the data is variable sized:
+ mA2bOffset = currentOffset;
+ mA2bSize = writeMab(stream, spaceDPtr->mAB, true, spaceDPtr->isPcsLab, spaceDPtr->colorModel == QColorSpace::ColorModel::Cmyk);
+ currentOffset += mA2bSize;
+ if (writeB2a) {
+ mB2aOffset = currentOffset;
+ mB2aSize = writeMab(stream, spaceDPtr->mBA, false, spaceDPtr->isPcsLab, spaceDPtr->colorModel == QColorSpace::ColorModel::Cmyk);
+ currentOffset += mB2aSize;
+ }
}
// Writing description
@@ -515,14 +1024,34 @@ QByteArray toIccProfile(const QColorSpace &space)
// Now write final size
*(quint32_be *)iccProfile.data() = iccProfile.size();
// And the final indices and sizes of variable size tags:
- *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 4) = rTrcOffset;
- *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 8) = rTrcSize;
- *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 12 + 4) = gTrcOffset;
- *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 12 + 8) = gTrcSize;
- *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 2 * 12 + 4) = bTrcOffset;
- *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 2 * 12 + 8) = bTrcSize;
- *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 3 * 12 + 4) = descOffset;
- *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 3 * 12 + 8) = descSize;
+ if (spaceDPtr->isThreeComponentMatrix()) {
+ if (spaceDPtr->colorModel == QColorSpace::ColorModel::Rgb) {
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 4) = rTrcOffset;
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 8) = rTrcSize;
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 12 + 4) = gTrcOffset;
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 12 + 8) = gTrcSize;
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 2 * 12 + 4) = bTrcOffset;
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 2 * 12 + 8) = bTrcSize;
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 3 * 12 + 4) = descOffset;
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 3 * 12 + 8) = descSize;
+ } else {
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 4) = kTrcOffset;
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 8) = kTrcSize;
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 12 + 4) = descOffset;
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 12 + 8) = descSize;
+ }
+ } else {
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 4) = mA2bOffset;
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 8) = mA2bSize;
+ variableTagTableOffsets += 12;
+ if (writeB2a) {
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 4) = mB2aOffset;
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 8) = mB2aSize;
+ variableTagTableOffsets += 12;
+ }
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 4) = descOffset;
+ *(quint32_be *)(iccProfile.data() + variableTagTableOffsets + 8) = descSize;
+ }
#if !defined(QT_NO_DEBUG) || defined(QT_FORCE_ASSERTS)
const ICCProfileHeader *iccHeader = (const ICCProfileHeader *)iccProfile.constData();
@@ -559,21 +1088,27 @@ static bool parseXyzData(const QByteArray &data, const TagEntry &tagEntry, QColo
static quint32 parseTRC(const QByteArrayView &tagData, QColorTrc &gamma, QColorTransferTable::Type type = QColorTransferTable::TwoWay)
{
+ if (tagData.size() < 12)
+ return 0;
const GenericTagData trcData = qFromUnaligned<GenericTagData>(tagData.constData());
if (trcData.type == quint32(Tag::curv)) {
Q_STATIC_ASSERT(sizeof(CurvTagData) == 12);
const CurvTagData curv = qFromUnaligned<CurvTagData>(tagData.constData());
- if (curv.valueCount > (1 << 16))
+ if (curv.valueCount > (1 << 16)) {
+ qCWarning(lcIcc) << "Invalid count in curv table";
return 0;
- if (tagData.size() < qsizetype(12 + 2 * curv.valueCount))
+ }
+ if (tagData.size() < qsizetype(12 + 2 * curv.valueCount)) {
+ qCWarning(lcIcc) << "Truncated curv table";
return 0;
+ }
const auto valueOffset = sizeof(CurvTagData);
if (curv.valueCount == 0) {
- gamma.m_type = QColorTrc::Type::Function;
+ gamma.m_type = QColorTrc::Type::ParameterizedFunction;
gamma.m_fun = QColorTransferFunction(); // Linear
} else if (curv.valueCount == 1) {
const quint16 v = qFromBigEndian<quint16>(tagData.constData() + valueOffset);
- gamma.m_type = QColorTrc::Type::Function;
+ gamma.m_type = QColorTrc::Type::ParameterizedFunction;
gamma.m_fun = QColorTransferFunction::fromGamma(v * (1.0f / 256.0f));
} else {
QList<quint16> tabl;
@@ -591,7 +1126,7 @@ static quint32 parseTRC(const QByteArrayView &tagData, QColorTrc &gamma, QColorT
gamma.m_table = table;
} else {
qCDebug(lcIcc) << "Detected curv table as function";
- gamma.m_type = QColorTrc::Type::Function;
+ gamma.m_type = QColorTrc::Type::ParameterizedFunction;
gamma.m_fun = curve;
}
}
@@ -608,7 +1143,7 @@ static quint32 parseTRC(const QByteArrayView &tagData, QColorTrc &gamma, QColorT
return 0;
qFromBigEndian<quint32>(tagData.constData() + parametersOffset, 1, parameters);
float g = fromFixedS1516(parameters[0]);
- gamma.m_type = QColorTrc::Type::Function;
+ gamma.m_type = QColorTrc::Type::ParameterizedFunction;
gamma.m_fun = QColorTransferFunction::fromGamma(g);
return 12 + 1 * 4;
}
@@ -622,7 +1157,7 @@ static quint32 parseTRC(const QByteArrayView &tagData, QColorTrc &gamma, QColorT
float a = fromFixedS1516(parameters[1]);
float b = fromFixedS1516(parameters[2]);
float d = -b / a;
- gamma.m_type = QColorTrc::Type::Function;
+ gamma.m_type = QColorTrc::Type::ParameterizedFunction;
gamma.m_fun = QColorTransferFunction(a, b, 0.0f, d, 0.0f, 0.0f, g);
return 12 + 3 * 4;
}
@@ -637,7 +1172,7 @@ static quint32 parseTRC(const QByteArrayView &tagData, QColorTrc &gamma, QColorT
float b = fromFixedS1516(parameters[2]);
float c = fromFixedS1516(parameters[3]);
float d = -b / a;
- gamma.m_type = QColorTrc::Type::Function;
+ gamma.m_type = QColorTrc::Type::ParameterizedFunction;
gamma.m_fun = QColorTransferFunction(a, b, 0.0f, d, c, c, g);
return 12 + 4 * 4;
}
@@ -650,7 +1185,7 @@ static quint32 parseTRC(const QByteArrayView &tagData, QColorTrc &gamma, QColorT
float b = fromFixedS1516(parameters[2]);
float c = fromFixedS1516(parameters[3]);
float d = fromFixedS1516(parameters[4]);
- gamma.m_type = QColorTrc::Type::Function;
+ gamma.m_type = QColorTrc::Type::ParameterizedFunction;
gamma.m_fun = QColorTransferFunction(a, b, c, d, 0.0f, 0.0f, g);
return 12 + 5 * 4;
}
@@ -665,7 +1200,7 @@ static quint32 parseTRC(const QByteArrayView &tagData, QColorTrc &gamma, QColorT
float d = fromFixedS1516(parameters[4]);
float e = fromFixedS1516(parameters[5]);
float f = fromFixedS1516(parameters[6]);
- gamma.m_type = QColorTrc::Type::Function;
+ gamma.m_type = QColorTrc::Type::ParameterizedFunction;
gamma.m_fun = QColorTransferFunction(a, b, c, d, e, f, g);
return 12 + 7 * 4;
}
@@ -700,12 +1235,6 @@ static void parseCLUT(const T *tableData, const float f, QColorCLUT *clut, uchar
}
}
-// very simple version for small values (<=4) of exp.
-static constexpr qsizetype intPow(qsizetype x, qsizetype exp)
-{
- return (exp <= 1) ? x : x * intPow(x, exp - 1);
-}
-
// Parses lut8 and lut16 type elements
template<typename T>
static bool parseLutData(const QByteArray &data, const TagEntry &tagEntry, QColorSpacePrivate *colorSpacePrivate, bool isAb)
@@ -761,20 +1290,23 @@ static bool parseLutData(const QByteArray &data, const TagEntry &tagEntry, QColo
return false;
}
- if (lut.inputChannels != 3 && !(isAb && colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk && lut.inputChannels == 4)) {
+ const int inputChannels = (isAb && colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk) ? 4 : 3;
+ const int outputChannels = (!isAb && colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk) ? 4 : 3;
+
+ if (lut.inputChannels != inputChannels) {
qCWarning(lcIcc) << "Unsupported lut8/lut16 input channel count" << lut.inputChannels;
return false;
}
- if (lut.outputChannels != 3 && !(!isAb && colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk && lut.outputChannels == 4)) {
+ if (lut.outputChannels != outputChannels) {
qCWarning(lcIcc) << "Unsupported lut8/lut16 output channel count" << lut.outputChannels;
return false;
}
- const qsizetype clutTableSize = intPow(lut.clutGridPoints, lut.inputChannels);
- if (tagEntry.size < (sizeof(T) + precision * lut.inputChannels * inputTableEntries
- + precision * lut.outputChannels * outputTableEntries
- + precision * lut.outputChannels * clutTableSize)) {
+ const qsizetype clutTableSize = intPow(lut.clutGridPoints, inputChannels);
+ if (tagEntry.size < (sizeof(T) + precision * inputChannels * inputTableEntries
+ + precision * outputChannels * outputTableEntries
+ + precision * outputChannels * clutTableSize)) {
qCWarning(lcIcc) << "Undersized lut8/lut16 tag, no room for tables";
return false;
}
@@ -785,7 +1317,7 @@ static bool parseLutData(const QByteArray &data, const TagEntry &tagEntry, QColo
const uint8_t *tableData = reinterpret_cast<const uint8_t *>(data.constData() + tagEntry.offset + sizeof(T));
- for (int j = 0; j < lut.inputChannels; ++j) {
+ for (int j = 0; j < inputChannels; ++j) {
QList<S> input(inputTableEntries);
qFromBigEndian<S>(tableData, inputTableEntries, input.data());
QColorTransferTable table(inputTableEntries, input, QColorTransferTable::OneWay);
@@ -801,22 +1333,22 @@ static bool parseLutData(const QByteArray &data, const TagEntry &tagEntry, QColo
clutElement.table.resize(clutTableSize);
clutElement.gridPointsX = clutElement.gridPointsY = clutElement.gridPointsZ = lut.clutGridPoints;
- if (lut.inputChannels == 4)
+ if (inputChannels == 4)
clutElement.gridPointsW = lut.clutGridPoints;
if constexpr (std::is_same_v<T, Lut8TagData>) {
- parseCLUT(tableData, 1.f / 255.f, &clutElement, lut.outputChannels);
+ parseCLUT(tableData, 1.f / 255.f, &clutElement, outputChannels);
} else {
float f = 1.0f / 65535.f;
if (colorSpacePrivate->isPcsLab && isAb) // Legacy lut16 conversion to Lab
f = 1.0f / 65280.f;
- QList<S> clutTable(clutTableSize * lut.outputChannels);
+ QList<S> clutTable(clutTableSize * outputChannels);
qFromBigEndian<S>(tableData, clutTable.size(), clutTable.data());
- parseCLUT(clutTable.constData(), f, &clutElement, lut.outputChannels);
+ parseCLUT(clutTable.constData(), f, &clutElement, outputChannels);
}
- tableData += clutTableSize * lut.outputChannels * precision;
+ tableData += clutTableSize * outputChannels * precision;
- for (int j = 0; j < lut.outputChannels; ++j) {
+ for (int j = 0; j < outputChannels; ++j) {
QList<S> output(outputTableEntries);
qFromBigEndian<S>(tableData, outputTableEntries, output.data());
QColorTransferTable table(outputTableEntries, output, QColorTransferTable::OneWay);
@@ -868,12 +1400,15 @@ static bool parseMabData(const QByteArray &data, const TagEntry &tagEntry, QColo
return false;
}
- if (mab.inputChannels != 3 && !(isAb && colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk && mab.inputChannels == 4)) {
+ const int inputChannels = (isAb && colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk) ? 4 : 3;
+ const int outputChannels = (!isAb && colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk) ? 4 : 3;
+
+ if (mab.inputChannels != inputChannels) {
qCWarning(lcIcc) << "Unsupported mAB/mBA input channel count" << mab.inputChannels;
return false;
}
- if (mab.outputChannels != 3 && !(!isAb && colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk && mab.outputChannels == 4)) {
+ if (mab.outputChannels != outputChannels) {
qCWarning(lcIcc) << "Unsupported mAB/mBA output channel count" << mab.outputChannels;
return false;
}
@@ -923,7 +1458,7 @@ static bool parseMabData(const QByteArray &data, const TagEntry &tagEntry, QColo
bool bCurvesAreLinear = true, aCurvesAreLinear = true, mCurvesAreLinear = true;
// B Curves
- if (!parseCurves(mab.bCurvesOffset, bTableElement.trc, isAb ? mab.outputChannels : mab.inputChannels)) {
+ if (!parseCurves(mab.bCurvesOffset, bTableElement.trc, isAb ? outputChannels : inputChannels)) {
qCWarning(lcIcc) << "Invalid B curves";
return false;
} else {
@@ -932,7 +1467,7 @@ static bool parseMabData(const QByteArray &data, const TagEntry &tagEntry, QColo
// A Curves
if (mab.aCurvesOffset) {
- if (!parseCurves(mab.aCurvesOffset, aTableElement.trc, isAb ? mab.inputChannels : mab.outputChannels)) {
+ if (!parseCurves(mab.aCurvesOffset, aTableElement.trc, isAb ? inputChannels : outputChannels)) {
qCWarning(lcIcc) << "Invalid A curves";
return false;
} else {
@@ -987,19 +1522,19 @@ static bool parseMabData(const QByteArray &data, const TagEntry &tagEntry, QColo
return false;
}
const qsizetype clutTableSize = clutElement.gridPointsX * clutElement.gridPointsY * clutElement.gridPointsZ * clutElement.gridPointsW;
- if ((mab.clutOffset + 20 + clutTableSize * mab.outputChannels * precision) > tagEntry.size) {
+ if ((mab.clutOffset + 20 + clutTableSize * outputChannels * precision) > tagEntry.size) {
qCWarning(lcIcc) << "CLUT oversized for tag";
return false;
}
clutElement.table.resize(clutTableSize);
if (precision == 2) {
- QList<uint16_t> clutTable(clutTableSize * mab.outputChannels);
+ QList<uint16_t> clutTable(clutTableSize * outputChannels);
qFromBigEndian<uint16_t>(data.constData() + tagEntry.offset + mab.clutOffset + 20, clutTable.size(), clutTable.data());
- parseCLUT(clutTable.constData(), (1.f/65535.f), &clutElement, mab.outputChannels);
+ parseCLUT(clutTable.constData(), (1.f/65535.f), &clutElement, outputChannels);
} else {
const uint8_t *clutTable = reinterpret_cast<const uint8_t *>(data.constData() + tagEntry.offset + mab.clutOffset + 20);
- parseCLUT(clutTable, (1.f/255.f), &clutElement, mab.outputChannels);
+ parseCLUT(clutTable, (1.f/255.f), &clutElement, outputChannels);
}
} else if (colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk) {
qCWarning(lcIcc) << "Cmyk conversion must have a CLUT";
@@ -1013,7 +1548,7 @@ static bool parseMabData(const QByteArray &data, const TagEntry &tagEntry, QColo
if (!clutElement.isEmpty())
colorSpacePrivate->mAB.append(std::move(clutElement));
}
- if (mab.mCurvesOffset && mab.outputChannels == 3) {
+ if (mab.mCurvesOffset && outputChannels == 3) {
if (!mCurvesAreLinear)
colorSpacePrivate->mAB.append(std::move(mTableElement));
if (!matrixElement.isIdentity())
@@ -1026,7 +1561,7 @@ static bool parseMabData(const QByteArray &data, const TagEntry &tagEntry, QColo
} else {
if (!bCurvesAreLinear)
colorSpacePrivate->mBA.append(std::move(bTableElement));
- if (mab.mCurvesOffset && mab.inputChannels == 3) {
+ if (mab.mCurvesOffset && inputChannels == 3) {
if (!matrixElement.isIdentity())
colorSpacePrivate->mBA.append(std::move(matrixElement));
if (!offsetElement.isNull())
@@ -1067,6 +1602,8 @@ static bool parseDesc(const QByteArray &data, const TagEntry &tagEntry, QString
// Either 'desc' (ICCv2) or 'mluc' (ICCv4)
if (tag.type == quint32(Tag::desc)) {
+ if (tagEntry.size < sizeof(DescTagData))
+ return false;
Q_STATIC_ASSERT(sizeof(DescTagData) == 12);
const DescTagData desc = qFromUnaligned<DescTagData>(data.constData() + tagEntry.offset);
const quint32 len = desc.asciiDescriptionLength;
@@ -1134,10 +1671,12 @@ static bool parseRgbMatrix(const QByteArray &data, const QHash<Tag, TagEntry> &t
} else if (colorspaceDPtr->toXyz == QColorMatrix::toXyzFromDciP3D65()) {
qCDebug(lcIcc) << "fromIccProfile: DCI-P3 D65 primaries detected";
colorspaceDPtr->primaries = QColorSpace::Primaries::DciP3D65;
- }
- if (colorspaceDPtr->toXyz == QColorMatrix::toXyzFromProPhotoRgb()) {
+ } else if (colorspaceDPtr->toXyz == QColorMatrix::toXyzFromProPhotoRgb()) {
qCDebug(lcIcc) << "fromIccProfile: ProPhoto RGB primaries detected";
colorspaceDPtr->primaries = QColorSpace::Primaries::ProPhotoRgb;
+ } else if (colorspaceDPtr->toXyz == QColorMatrix::toXyzFromBt2020()) {
+ qCDebug(lcIcc) << "fromIccProfile: BT.2020 primaries detected";
+ colorspaceDPtr->primaries = QColorSpace::Primaries::Bt2020;
}
return true;
}
@@ -1225,12 +1764,12 @@ static bool parseTRCs(const QByteArray &data, const QHash<Tag, TagEntry> &tagInd
colorspaceDPtr->trc[0] = QColorTransferFunction();
colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::Linear;
colorspaceDPtr->gamma = 1.0f;
- } else if (rCurve.m_type == QColorTrc::Type::Function && rCurve.m_fun.isGamma()) {
+ } else if (rCurve.m_type == QColorTrc::Type::ParameterizedFunction && rCurve.m_fun.isGamma()) {
qCDebug(lcIcc) << "fromIccProfile: Simple gamma detected";
colorspaceDPtr->trc[0] = QColorTransferFunction::fromGamma(rCurve.m_fun.m_g);
colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::Gamma;
colorspaceDPtr->gamma = rCurve.m_fun.m_g;
- } else if (rCurve.m_type == QColorTrc::Type::Function && rCurve.m_fun.isSRgb()) {
+ } else if (rCurve.m_type == QColorTrc::Type::ParameterizedFunction && rCurve.m_fun.isSRgb()) {
qCDebug(lcIcc) << "fromIccProfile: sRGB gamma detected";
colorspaceDPtr->trc[0] = QColorTransferFunction::fromSRgb();
colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::SRgb;
@@ -1249,6 +1788,63 @@ static bool parseTRCs(const QByteArray &data, const QHash<Tag, TagEntry> &tagInd
return true;
}
+static bool parseCicp(const QByteArray &data, const TagEntry &tagEntry, QColorSpacePrivate *colorspaceDPtr)
+{
+ if (colorspaceDPtr->isPcsLab)
+ return false;
+ if (tagEntry.size < sizeof(CicpTagData) || qsizetype(tagEntry.size) > data.size())
+ return false;
+ const CicpTagData cicp = qFromUnaligned<CicpTagData>(data.constData() + tagEntry.offset);
+ if (cicp.type != uint32_t(Tag::cicp)) {
+ qCWarning(lcIcc, "fromIccProfile: bad cicp data type");
+ return false;
+ }
+ switch (cicp.transferCharacteristics) {
+ case 4:
+ colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::Gamma;
+ colorspaceDPtr->gamma = 2.2f;
+ break;
+ case 5:
+ colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::Gamma;
+ colorspaceDPtr->gamma = 2.8f;
+ break;
+ case 8:
+ colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::Linear;
+ break;
+ case 13:
+ colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::SRgb;
+ break;
+ case 1:
+ case 6:
+ case 14:
+ case 15:
+ colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::Bt2020;
+ break;
+ case 16:
+ colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::St2084;
+ break;
+ case 18:
+ colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::Hlg;
+ break;
+ default:
+ return false;
+ }
+ switch (cicp.colorPrimaries) {
+ case 1:
+ colorspaceDPtr->primaries = QColorSpace::Primaries::SRgb;
+ break;
+ case 9:
+ colorspaceDPtr->primaries = QColorSpace::Primaries::Bt2020;
+ break;
+ case 12:
+ colorspaceDPtr->primaries = QColorSpace::Primaries::DciP3D65;
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
{
if (data.size() < qsizetype(sizeof(ICCProfileHeader))) {
@@ -1287,7 +1883,7 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
qCWarning(lcIcc) << "fromIccProfile: failed tag offset sanity 2";
return false;
}
- if (tagTable.size < 12) {
+ if (tagTable.size < 8) {
qCWarning(lcIcc) << "fromIccProfile: failed minimal tag size sanity";
return false;
}
@@ -1337,12 +1933,22 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
colorSpace->detach();
QColorSpacePrivate *colorspaceDPtr = QColorSpacePrivate::get(*colorSpace);
+ colorspaceDPtr->isPcsLab = (header.pcs == uint(Tag::Lab_));
+ if (tagIndex.contains(Tag::cicp)) {
+ // Let cicp override nLut profiles if we fully recognize it.
+ if (parseCicp(data, tagIndex[Tag::cicp], colorspaceDPtr))
+ threeComponentMatrix = true;
+ if (colorspaceDPtr->primaries != QColorSpace::Primaries::Custom)
+ colorspaceDPtr->setToXyzMatrix();
+ if (colorspaceDPtr->transferFunction != QColorSpace::TransferFunction::Custom)
+ colorspaceDPtr->setTransferFunction();
+ }
+
if (threeComponentMatrix) {
- colorspaceDPtr->isPcsLab = false;
colorspaceDPtr->transformModel = QColorSpace::TransformModel::ThreeComponentMatrix;
if (header.inputColorSpace == uint(ColorSpaceType::Rgb)) {
- if (!parseRgbMatrix(data, tagIndex, colorspaceDPtr))
+ if (colorspaceDPtr->primaries == QColorSpace::Primaries::Custom && !parseRgbMatrix(data, tagIndex, colorspaceDPtr))
return false;
colorspaceDPtr->colorModel = QColorSpace::ColorModel::Rgb;
} else if (header.inputColorSpace == uint(ColorSpaceType::Gray)) {
@@ -1365,10 +1971,10 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
if (colorspaceDPtr->primaries != QColorSpace::Primaries::Custom)
colorspaceDPtr->setToXyzMatrix();
- if (!parseTRCs(data, tagIndex, colorspaceDPtr, header.inputColorSpace == uint(ColorSpaceType::Gray)))
+ if (colorspaceDPtr->transferFunction == QColorSpace::TransferFunction::Custom &&
+ !parseTRCs(data, tagIndex, colorspaceDPtr, header.inputColorSpace == uint(ColorSpaceType::Gray)))
return false;
} else {
- colorspaceDPtr->isPcsLab = (header.pcs == uint(Tag::Lab_));
colorspaceDPtr->transformModel = QColorSpace::TransformModel::ElementListProcessing;
if (header.inputColorSpace == uint(ColorSpaceType::Cmyk))
colorspaceDPtr->colorModel = QColorSpace::ColorModel::Cmyk;
@@ -1387,6 +1993,12 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
if (!parseXyzData(data, it.value(), colorspaceDPtr->whitePoint))
return false;
}
+ if (auto it = tagIndex.constFind(Tag::chad); it != tagIndex.constEnd()) {
+ if (!parseChad(data, it.value(), colorspaceDPtr))
+ return false;
+ } else if (!colorspaceDPtr->whitePoint.isNull()) {
+ colorspaceDPtr->chad = QColorMatrix::chromaticAdaptation(colorspaceDPtr->whitePoint);
+ }
}
if (auto it = tagIndex.constFind(Tag::desc); it != tagIndex.constEnd()) {
diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp
index a636635fd5..eb5f12389f 100644
--- a/src/gui/painting/qimagescale.cpp
+++ b/src/gui/painting/qimagescale.cpp
@@ -1208,7 +1208,7 @@ QImage qSmoothScaleImage(const QImage &src, int dw, int dh)
dw, dh, dw, src.bytesPerLine() / 8);
else
#endif
- if (src.hasAlphaChannel())
+ if (src.hasAlphaChannel() || src.format() == QImage::Format_CMYK8888)
qt_qimageScaleAARGBA(scaleinfo, (unsigned int *)buffer.scanLine(0),
dw, dh, dw, src.bytesPerLine() / 4);
else
diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp
index 14e2d7cd8e..de21901e23 100644
--- a/src/gui/painting/qpaintdevice.cpp
+++ b/src/gui/painting/qpaintdevice.cpp
@@ -17,6 +17,39 @@ QPaintDevice::~QPaintDevice()
"painted");
}
+/*!
+ \internal
+*/
+// ### Qt 7: Replace this workaround mechanism: virtual devicePixelRatio() and virtual metricF()
+inline double QPaintDevice::getDecodedMetricF(PaintDeviceMetric metricA, PaintDeviceMetric metricB) const
+{
+ qint32 buf[2];
+ // The Encoded metric enum values come in pairs of one odd and one even value.
+ // We map those to the 0 and 1 indexes of buf by taking just the least significant bit.
+ // Same mapping here as in the encodeMetricF() function, to ensure correct order.
+ buf[metricA & 1] = metric(metricA);
+ buf[metricB & 1] = metric(metricB);
+ double res;
+ memcpy(&res, buf, sizeof(res));
+ return res;
+}
+
+qreal QPaintDevice::devicePixelRatio() const
+{
+ Q_STATIC_ASSERT((PdmDevicePixelRatioF_EncodedA & 1) != (PdmDevicePixelRatioF_EncodedB & 1));
+ double res;
+ int scaledDpr = metric(PdmDevicePixelRatioScaled);
+ if (scaledDpr == int(devicePixelRatioFScale())) {
+ res = 1; // Shortcut for common case
+ } else if (scaledDpr == 2 * int(devicePixelRatioFScale())) {
+ res = 2; // Shortcut for common case
+ } else {
+ res = getDecodedMetricF(PdmDevicePixelRatioF_EncodedA, PdmDevicePixelRatioF_EncodedB);
+ if (res <= 0) // These metrics not implemented, fall back to PdmDevicePixelRatioScaled
+ res = scaledDpr / devicePixelRatioFScale();
+ }
+ return res;
+}
/*!
\internal
@@ -64,6 +97,8 @@ int QPaintDevice::metric(PaintDeviceMetric m) const
return 256;
} else if (m == PdmDevicePixelRatio) {
return 1;
+ } else if (m == PdmDevicePixelRatioF_EncodedA || m == PdmDevicePixelRatioF_EncodedB) {
+ return 0;
} else {
qDebug("Unrecognised metric %d!",m);
return 0;
diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h
index ceccac5e7e..c39d8a059d 100644
--- a/src/gui/painting/qpaintdevice.h
+++ b/src/gui/painting/qpaintdevice.h
@@ -29,7 +29,9 @@ public:
PdmPhysicalDpiX,
PdmPhysicalDpiY,
PdmDevicePixelRatio,
- PdmDevicePixelRatioScaled
+ PdmDevicePixelRatioScaled,
+ PdmDevicePixelRatioF_EncodedA,
+ PdmDevicePixelRatioF_EncodedB
};
virtual ~QPaintDevice();
@@ -46,18 +48,20 @@ public:
int logicalDpiY() const { return metric(PdmDpiY); }
int physicalDpiX() const { return metric(PdmPhysicalDpiX); }
int physicalDpiY() const { return metric(PdmPhysicalDpiY); }
- qreal devicePixelRatio() const { return metric(PdmDevicePixelRatioScaled) / devicePixelRatioFScale(); }
+ qreal devicePixelRatio() const;
qreal devicePixelRatioF() const { return devicePixelRatio(); }
int colorCount() const { return metric(PdmNumColors); }
int depth() const { return metric(PdmDepth); }
static inline qreal devicePixelRatioFScale() { return 0x10000; }
+ static inline int encodeMetricF(PaintDeviceMetric metric, double value);
protected:
QPaintDevice() noexcept;
virtual int metric(PaintDeviceMetric metric) const;
virtual void initPainter(QPainter *painter) const;
virtual QPaintDevice *redirected(QPoint *offset) const;
virtual QPainter *sharedPainter() const;
+ double getDecodedMetricF(PaintDeviceMetric metricA, PaintDeviceMetric metricB) const;
ushort painters; // refcount
private:
@@ -80,6 +84,14 @@ inline int QPaintDevice::devType() const
inline bool QPaintDevice::paintingActive() const
{ return painters != 0; }
+inline int QPaintDevice::encodeMetricF(PaintDeviceMetric metric, double value)
+{
+ qint32 buf[2];
+ Q_STATIC_ASSERT(sizeof(buf) == sizeof(double));
+ memcpy(buf, &value, sizeof(buf));
+ return buf[metric & 1];
+}
+
QT_END_NAMESPACE
#endif // QPAINTDEVICE_H
diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc
index d63fdcb92b..9b9a6facb8 100644
--- a/src/gui/painting/qpaintdevice.qdoc
+++ b/src/gui/painting/qpaintdevice.qdoc
@@ -99,6 +99,14 @@
The constant scaling factor used is devicePixelRatioFScale(). This enum value
has been introduced in Qt 5.6.
+ \value [since 6.8] PdmDevicePixelRatioF_EncodedA This enum item, together with the
+ corresponding \c B item, are used together for the device pixel ratio of the device, as an
+ encoded \c double floating point value. A QPaintDevice subclass that supports \e fractional DPR
+ values should implement support for these two enum items in its override of the metric()
+ function. The return value is expected to be the result of the encodeMetricF() function.
+
+ \value [since 6.8] PdmDevicePixelRatioF_EncodedB See PdmDevicePixelRatioF_EncodedA.
+
\sa metric(), devicePixelRatio()
*/
@@ -288,3 +296,15 @@
\since 5.6
*/
+
+/*!
+ \fn int QPaintDevice::encodeMetricF(PaintDeviceMetric metric, double value)
+
+ \internal
+
+ Returns \a value encoded for the metric \a metric. Subclasses implementing metric() should use
+ this function to encode \value as an integer return value when the query metric specifies an
+ encoded floating-point value.
+
+ \since 6.8
+*/
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 38f2a9b803..716cf35ee6 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -20,8 +20,11 @@
#include <qimagewriter.h>
#include <qnumeric.h>
#include <qtemporaryfile.h>
+#include <qtimezone.h>
#include <quuid.h>
+#include <map>
+
#ifndef QT_NO_COMPRESS
#include <zlib.h>
#endif
@@ -1035,6 +1038,7 @@ void QPdfEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
*d->currentPage << "Q\n";
}
+// Used by QtWebKit
void QPdfEngine::drawHyperlink(const QRectF &r, const QUrl &url)
{
Q_D(QPdfEngine);
@@ -1564,7 +1568,7 @@ void QPdfEnginePrivate::writeHeader()
int metaDataObj = -1;
int outputIntentObj = -1;
if (pdfVersion == QPdfEngine::Version_A1b || !xmpDocumentMetadata.isEmpty()) {
- metaDataObj = writeXmpDcumentMetaData();
+ metaDataObj = writeXmpDocumentMetaData();
}
if (pdfVersion == QPdfEngine::Version_A1b) {
outputIntentObj = writeOutputIntent();
@@ -1740,11 +1744,12 @@ void QPdfEnginePrivate::writeInfo()
xprintf("+%02d'%02d')\n", hours , mins);
else
xprintf("Z)\n");
+ xprintf("/Trapped /False\n");
xprintf(">>\n"
"endobj\n");
}
-int QPdfEnginePrivate::writeXmpDcumentMetaData()
+int QPdfEnginePrivate::writeXmpDocumentMetaData()
{
const int metaDataObj = addXrefEntry(-1);
QByteArray metaDataContent;
@@ -1752,26 +1757,12 @@ int QPdfEnginePrivate::writeXmpDcumentMetaData()
if (xmpDocumentMetadata.isEmpty()) {
const QString producer(QString::fromLatin1("Qt " QT_VERSION_STR));
- const QDateTime now = QDateTime::currentDateTime();
- const QDate date = now.date();
- const QTime time = now.time();
- const QString timeStr =
- QString::asprintf("%d-%02d-%02dT%02d:%02d:%02d",
- date.year(), date.month(), date.day(),
- time.hour(), time.minute(), time.second());
-
- const int offset = now.offsetFromUtc();
- const int hours = (offset / 60) / 60;
- const int mins = (offset / 60) % 60;
- QString tzStr;
- if (offset < 0)
- tzStr = QString::asprintf("-%02d:%02d", -hours, -mins);
- else if (offset > 0)
- tzStr = QString::asprintf("+%02d:%02d", hours , mins);
- else
- tzStr = "Z"_L1;
-
- const QString metaDataDate = timeStr + tzStr;
+#if QT_CONFIG(timezone)
+ const QDateTime now = QDateTime::currentDateTime(QTimeZone::systemTimeZone());
+#else
+ const QDateTime now = QDateTime::currentDateTimeUtc();
+#endif
+ const QString metaDataDate = now.toString(Qt::ISODate);
QFile metaDataFile(":/qpdf/qpdfa_metadata.xml"_L1);
bool ok = metaDataFile.open(QIODevice::ReadOnly);
@@ -1813,7 +1804,8 @@ int QPdfEnginePrivate::writeOutputIntent()
s << "/N 3\n";
s << "/Alternate /DeviceRGB\n";
s << "/Length " << length_object << "0 R\n";
- s << "/Filter /FlateDecode\n";
+ if (do_compress)
+ s << "/Filter /FlateDecode\n";
s << ">>\n";
s << "stream\n";
write(data);
@@ -1867,7 +1859,7 @@ void QPdfEnginePrivate::writeDestsRoot()
if (destCache.isEmpty())
return;
- QHash<QString, int> destObjects;
+ std::map<QString, int> destObjects;
QByteArray xs, ys;
for (const DestInfo &destInfo : std::as_const(destCache)) {
int destObj = addXrefEntry(-1);
@@ -1875,21 +1867,19 @@ void QPdfEnginePrivate::writeDestsRoot()
ys.setNum(static_cast<double>(destInfo.coords.y()), 'f');
xprintf("[%d 0 R /XYZ %s %s 0]\n", destInfo.pageObj, xs.constData(), ys.constData());
xprintf("endobj\n");
- destObjects.insert(destInfo.anchor, destObj);
+ destObjects.insert_or_assign(destInfo.anchor, destObj);
}
// names
destsRoot = addXrefEntry(-1);
- QStringList anchors = destObjects.keys();
- anchors.sort();
xprintf("<<\n/Limits [");
- printString(anchors.constFirst());
+ printString(destObjects.begin()->first);
xprintf(" ");
- printString(anchors.constLast());
+ printString(destObjects.rbegin()->first);
xprintf("]\n/Names [\n");
- for (const QString &anchor : std::as_const(anchors)) {
+ for (const auto &[anchor, destObject] : destObjects) {
printString(anchor);
- xprintf(" %d 0 R\n", destObjects[anchor]);
+ xprintf(" %d 0 R\n", destObject);
}
xprintf("]\n>>\n"
"endobj\n");
@@ -1922,7 +1912,8 @@ void QPdfEnginePrivate::writeAttachmentRoot()
attachments.push_back(addXrefEntry(-1));
xprintf("<<\n"
- "/F (%s)", attachment.fileName.toLatin1().constData());
+ "/F ");
+ printString(attachment.fileName);
xprintf("\n/EF <</F %d 0 R>>\n"
"/Type/Filespec\n"
@@ -2135,17 +2126,24 @@ void QPdfEnginePrivate::writePage()
qreal userUnit = calcUserUnit();
addXrefEntry(pages.constLast());
+
+ // make sure we use the pagesize from when we started the page, since the user may have changed it
+ const QByteArray formattedPageWidth = QByteArray::number(currentPage->pageSize.width() / userUnit, 'f');
+ const QByteArray formattedPageHeight = QByteArray::number(currentPage->pageSize.height() / userUnit, 'f');
+
xprintf("<<\n"
"/Type /Page\n"
"/Parent %d 0 R\n"
"/Contents %d 0 R\n"
"/Resources %d 0 R\n"
"/Annots %d 0 R\n"
- "/MediaBox [0 0 %s %s]\n",
+ "/MediaBox [0 0 %s %s]\n"
+ "/TrimBox [0 0 %s %s]\n",
pageRoot, pageStream, resources, annots,
- // make sure we use the pagesize from when we started the page, since the user may have changed it
- QByteArray::number(currentPage->pageSize.width() / userUnit, 'f').constData(),
- QByteArray::number(currentPage->pageSize.height() / userUnit, 'f').constData());
+ formattedPageWidth.constData(),
+ formattedPageHeight.constData(),
+ formattedPageWidth.constData(),
+ formattedPageHeight.constData());
if (pdfVersion >= QPdfEngine::Version_1_6)
xprintf("/UserUnit %s\n", QByteArray::number(userUnit, 'f').constData());
diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h
index 3c34e0bd7a..54d37b00a8 100644
--- a/src/gui/painting/qpdf_p.h
+++ b/src/gui/painting/qpdf_p.h
@@ -290,7 +290,7 @@ private:
QPdfEngine::ColorModel colorModelForColor(const QColor &color) const;
void writeColor(ColorDomain domain, const QColor &color);
void writeInfo();
- int writeXmpDcumentMetaData();
+ int writeXmpDocumentMetaData();
int writeOutputIntent();
void writePageRoot();
void writeDestsRoot();
@@ -319,7 +319,7 @@ private:
int addXrefEntry(int object, bool printostr = true);
void printString(QStringView string);
void xprintf(const char* fmt, ...);
- inline void write(const QByteArray &data) {
+ inline void write(QByteArrayView data) {
stream->writeRawData(data.constData(), data.size());
streampos += data.size();
}
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index f7c4df40c8..21e89d67fd 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -10,6 +10,8 @@
#include <QtCore/private/qobject_p.h>
+#include <unordered_map>
+
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQpaBackingStore, "qt.qpa.backingstore", QtWarningMsg);
@@ -26,11 +28,14 @@ public:
QWindow *window;
QBackingStore *backingStore;
- // The order matters. if it needs to be rearranged in the future, call
- // reset() explicitly from the dtor in the correct order.
- // (first the compositor, then the rhiSupport)
- QBackingStoreRhiSupport rhiSupport;
- QBackingStoreDefaultCompositor compositor;
+ struct SurfaceSupport {
+ // The order matters. if it needs to be rearranged in the future, call
+ // reset() explicitly from the dtor in the correct order.
+ // (first the compositor, then the rhiSupport)
+ QBackingStoreRhiSupport rhiSupport;
+ QBackingStoreDefaultCompositor compositor;
+ };
+ std::unordered_map<QSurface::SurfaceType, SurfaceSupport> surfaceSupport;
};
struct QBackingstoreTextureInfo
@@ -210,8 +215,12 @@ QPlatformBackingStore::FlushResult QPlatformBackingStore::rhiFlush(QWindow *wind
QPlatformTextureList *textures,
bool translucentBackground)
{
- return d_ptr->compositor.flush(this, d_ptr->rhiSupport.rhi(), d_ptr->rhiSupport.swapChainForWindow(window),
- window, sourceDevicePixelRatio, region, offset, textures, translucentBackground);
+ auto &surfaceSupport = d_ptr->surfaceSupport[window->surfaceType()];
+ return surfaceSupport.compositor.flush(this,
+ surfaceSupport.rhiSupport.rhi(),
+ surfaceSupport.rhiSupport.swapChainForWindow(window),
+ window, sourceDevicePixelRatio, region, offset, textures,
+ translucentBackground);
}
/*!
@@ -261,7 +270,10 @@ QRhiTexture *QPlatformBackingStore::toTexture(QRhiResourceUpdateBatch *resourceU
const QRegion &dirtyRegion,
TextureFlags *flags) const
{
- return d_ptr->compositor.toTexture(this, d_ptr->rhiSupport.rhi(), resourceUpdates, dirtyRegion, flags);
+ auto &surfaceSupport = d_ptr->surfaceSupport[window()->surfaceType()];
+ return surfaceSupport.compositor.toTexture(this,
+ surfaceSupport.rhiSupport.rhi(), resourceUpdates,
+ dirtyRegion, flags);
}
/*!
@@ -356,33 +368,44 @@ bool QPlatformBackingStore::scroll(const QRegion &area, int dx, int dy)
return false;
}
-void QPlatformBackingStore::setRhiConfig(const QPlatformBackingStoreRhiConfig &config)
+void QPlatformBackingStore::createRhi(QWindow *window, QPlatformBackingStoreRhiConfig config)
{
if (!config.isEnabled())
return;
- d_ptr->rhiSupport.setConfig(config);
- d_ptr->rhiSupport.setWindow(d_ptr->window);
- d_ptr->rhiSupport.setFormat(d_ptr->window->format());
- d_ptr->rhiSupport.create();
+ qCDebug(lcQpaBackingStore) << "Setting up RHI support in" << this
+ << "for" << window << "with" << window->surfaceType()
+ << "and requested API" << config.api();
+
+ auto &support = d_ptr->surfaceSupport[window->surfaceType()];
+ if (!support.rhiSupport.rhi()) {
+ support.rhiSupport.setConfig(config);
+ support.rhiSupport.setWindow(window);
+ support.rhiSupport.setFormat(window->format());
+ support.rhiSupport.create();
+ } else {
+ qCDebug(lcQpaBackingStore) << "Window already has RHI support"
+ << "with backend" << support.rhiSupport.rhi()->backendName();
+ }
}
-QRhi *QPlatformBackingStore::rhi() const
+QRhi *QPlatformBackingStore::rhi(QWindow *window) const
{
// Returning null is valid, and means this is not a QRhi-capable backingstore.
- return d_ptr->rhiSupport.rhi();
+ return d_ptr->surfaceSupport[window->surfaceType()].rhiSupport.rhi();
}
-void QPlatformBackingStore::graphicsDeviceReportedLost()
+void QPlatformBackingStore::graphicsDeviceReportedLost(QWindow *window)
{
- if (!d_ptr->rhiSupport.rhi())
+ auto &surfaceSupport = d_ptr->surfaceSupport[window->surfaceType()];
+ if (!surfaceSupport.rhiSupport.rhi())
return;
qWarning("Rhi backingstore: graphics device lost, attempting to reinitialize");
- d_ptr->compositor.reset();
- d_ptr->rhiSupport.reset();
- d_ptr->rhiSupport.create();
- if (!d_ptr->rhiSupport.rhi())
+ surfaceSupport.compositor.reset();
+ surfaceSupport.rhiSupport.reset();
+ surfaceSupport.rhiSupport.create();
+ if (!surfaceSupport.rhiSupport.rhi())
qWarning("Rhi backingstore: failed to reinitialize after losing the device");
}
diff --git a/src/gui/painting/qplatformbackingstore.h b/src/gui/painting/qplatformbackingstore.h
index 1d55e9ab6a..2f27a2aa2c 100644
--- a/src/gui/painting/qplatformbackingstore.h
+++ b/src/gui/painting/qplatformbackingstore.h
@@ -39,6 +39,8 @@ class QRhiResourceUpdateBatch;
struct Q_GUI_EXPORT QPlatformBackingStoreRhiConfig
{
+ Q_GADGET
+public:
enum Api {
OpenGL,
Metal,
@@ -47,6 +49,7 @@ struct Q_GUI_EXPORT QPlatformBackingStoreRhiConfig
D3D12,
Null
};
+ Q_ENUM(Api)
QPlatformBackingStoreRhiConfig()
: m_enable(false)
@@ -171,10 +174,10 @@ public:
virtual void beginPaint(const QRegion &);
virtual void endPaint();
- void setRhiConfig(const QPlatformBackingStoreRhiConfig &config);
- QRhi *rhi() const;
+ void createRhi(QWindow *window, QPlatformBackingStoreRhiConfig config);
+ QRhi *rhi(QWindow *window) const;
void surfaceAboutToBeDestroyed();
- void graphicsDeviceReportedLost();
+ void graphicsDeviceReportedLost(QWindow *window);
private:
QPlatformBackingStorePrivate *d_ptr;
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 8b712ee46d..f9089d7bba 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -876,9 +876,15 @@ QRegion QRegion::intersect(const QRect &r) const
/*!
\fn void QRegion::setRects(const QRect *rects, int number)
+ \overload
+ \obsolete Use the QSpan overload instead.
+*/
+
+/*!
+ \fn void QRegion::setRects(QSpan<const QRect> rects)
+ \since 6.8
- Sets the region using the array of rectangles specified by \a rects and
- \a number.
+ Sets the region using the array of rectangles specified by \a rects.
The rectangles \e must be optimally Y-X sorted and follow these restrictions:
\list
@@ -892,6 +898,11 @@ QRegion QRegion::intersect(const QRect &r) const
\omit
Only some platforms have these restrictions (Qt for Embedded Linux, X11 and \macos).
\endomit
+
+ \note For historical reasons, \c{rects.size()} must be less than \c{INT_MAX}
+ (see rectCount()).
+
+ \sa rects()
*/
namespace {
@@ -4214,18 +4225,39 @@ QRegion::const_iterator QRegion::end() const noexcept
return d->qt_rgn ? d->qt_rgn->end() : nullptr;
}
-void QRegion::setRects(const QRect *rects, int num)
+static Q_DECL_COLD_FUNCTION
+void set_rects_warn(const char *what)
+{
+ qWarning("QRegion::setRects(): %s", what);
+}
+
+void QRegion::setRects(const QRect *r, int n)
{
+ if (!r && n) { // old setRects() allowed this, but QSpan doesn't
+ set_rects_warn("passing num != 0 when rects == nullptr is deprecated.");
+ n = 0;
+ }
+ setRects(QSpan<const QRect>(r, n));
+}
+
+void QRegion::setRects(QSpan<const QRect> rects)
+{
+ const auto num = int(rects.size());
+ if (num != rects.size()) {
+ set_rects_warn("span size exceeds INT_MAX, ignoring");
+ return;
+ }
+
*this = QRegion();
- if (!rects || num == 0 || (num == 1 && rects->isEmpty()))
+ if (!rects.data() || num == 0 || (num == 1 && rects.front().isEmpty()))
return;
detach();
d->qt_rgn->numRects = num;
if (num == 1) {
- d->qt_rgn->extents = *rects;
- d->qt_rgn->innerRect = *rects;
+ d->qt_rgn->extents = rects.front();
+ d->qt_rgn->innerRect = rects.front();
} else {
d->qt_rgn->rects.resize(num);
@@ -4246,12 +4278,30 @@ void QRegion::setRects(const QRect *rects, int num)
}
}
+/*!
+ \since 6.8
+
+ Returns a span of non-overlapping rectangles that make up the region. The
+ span remains valid until the next call of a mutating (non-const) method on
+ this region.
+
+ The union of all the rectangles is equal to the original region.
+
+ \note This functions existed in Qt 5, too, but returned QVector<QRect>
+ instead.
+
+ \sa setRects()
+*/
+QSpan<const QRect> QRegion::rects() const noexcept
+{
+ return {begin(), end()};
+};
+
int QRegion::rectCount() const noexcept
{
return (d->qt_rgn ? d->qt_rgn->numRects : 0);
}
-
bool QRegion::operator==(const QRegion &r) const
{
if (!d->qt_rgn)
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index b0051b6067..4b852815f3 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -8,11 +8,11 @@
#include <QtCore/qatomic.h>
#include <QtCore/qrect.h>
#include <QtGui/qwindowdefs.h>
-#include <QtCore/qcontainerfwd.h>
#ifndef QT_NO_DATASTREAM
#include <QtCore/qdatastream.h>
#endif
+#include <QtCore/qspan.h>
QT_BEGIN_NAMESPACE
@@ -75,6 +75,8 @@ public:
QRect boundingRect() const noexcept;
void setRects(const QRect *rect, int num);
+ void setRects(QSpan<const QRect> r);
+ QSpan<const QRect> rects() const noexcept;
int rectCount() const noexcept;
QRegion operator|(const QRegion &r) const;
diff --git a/src/gui/painting/qrhibackingstore.cpp b/src/gui/painting/qrhibackingstore.cpp
index 586dfb44a4..d59cc2d83c 100644
--- a/src/gui/painting/qrhibackingstore.cpp
+++ b/src/gui/painting/qrhibackingstore.cpp
@@ -20,30 +20,27 @@ void QRhiBackingStore::flush(QWindow *flushedWindow, const QRegion &region, cons
Q_UNUSED(region);
Q_UNUSED(offset);
- if (flushedWindow->surfaceType() != window()->surfaceType()) {
- qWarning() << "Cannot flush child window" << flushedWindow
- << "with surface type" << flushedWindow->surfaceType() << ";"
- << "Must match" << window()->surfaceType() << "of" << window();
-
- // FIXME: Support different surface types by not tying the
- // RHI config to the backing store itself (per window config).
- return;
- }
-
- if (!rhi()) {
+ if (!rhi(flushedWindow)) {
QPlatformBackingStoreRhiConfig rhiConfig;
- switch (window()->surfaceType()) {
+ switch (flushedWindow->surfaceType()) {
case QSurface::OpenGLSurface:
rhiConfig.setApi(QPlatformBackingStoreRhiConfig::OpenGL);
break;
case QSurface::MetalSurface:
rhiConfig.setApi(QPlatformBackingStoreRhiConfig::Metal);
break;
+ case QSurface::Direct3DSurface:
+ rhiConfig.setApi(QPlatformBackingStoreRhiConfig::D3D11);
+ break;
+ case QSurface::VulkanSurface:
+ rhiConfig.setApi(QPlatformBackingStoreRhiConfig::Vulkan);
+ break;
default:
Q_UNREACHABLE();
}
+
rhiConfig.setEnabled(true);
- setRhiConfig(rhiConfig);
+ createRhi(flushedWindow, rhiConfig);
}
static QPlatformTextureList emptyTextureList;
diff --git a/src/gui/platform/darwin/qmetallayer.mm b/src/gui/platform/darwin/qmetallayer.mm
new file mode 100644
index 0000000000..e8a27a7b06
--- /dev/null
+++ b/src/gui/platform/darwin/qmetallayer.mm
@@ -0,0 +1,73 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmetallayer_p.h"
+
+#include <QtCore/qreadwritelock.h>
+#include <QtCore/qrect.h>
+
+using namespace std::chrono_literals;
+
+QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcMetalLayer, "qt.gui.metal")
+QT_END_NAMESPACE
+
+QT_USE_NAMESPACE
+
+@implementation QMetalLayer
+{
+ std::unique_ptr<QReadWriteLock> m_displayLock;
+}
+
+- (instancetype)init
+{
+ if ((self = [super init])) {
+ m_displayLock.reset(new QReadWriteLock(QReadWriteLock::Recursive));
+ self.mainThreadPresentation = nil;
+ }
+
+ return self;
+}
+
+- (QReadWriteLock &)displayLock
+{
+ return *m_displayLock.get();
+}
+
+- (void)setNeedsDisplay
+{
+ [self setNeedsDisplayInRect:CGRectInfinite];
+}
+
+- (void)setNeedsDisplayInRect:(CGRect)rect
+{
+ if (!self.needsDisplay) {
+ // We lock for writing here, blocking in case a secondary thread is in
+ // the middle of presenting to the layer, as we want the main thread's
+ // display to happen after the secondary thread finishes presenting.
+ qCDebug(lcMetalLayer) << "Locking" << self << "for writing"
+ << "due to needing display in rect" << QRectF::fromCGRect(rect);
+
+ // For added safety, we use a 5 second timeout, and try to fail
+ // gracefully by not marking the layer as needing display, as
+ // doing so would lead us to unlock and unheld lock in displayLayer.
+ if (!self.displayLock.tryLockForWrite(5s)) {
+ qCWarning(lcMetalLayer) << "Timed out waiting for display lock";
+ return;
+ }
+ }
+
+ [super setNeedsDisplayInRect:rect];
+}
+
+- (id<CAMetalDrawable>)nextDrawable
+{
+ // Drop the presentation block early, so that if the main thread for
+ // some reason doesn't handle the presentation, the block won't hold on
+ // to a drawable unnecessarily.
+ self.mainThreadPresentation = nil;
+ return [super nextDrawable];
+}
+
+
+@end
diff --git a/src/gui/platform/darwin/qmetallayer_p.h b/src/gui/platform/darwin/qmetallayer_p.h
new file mode 100644
index 0000000000..1c19f21866
--- /dev/null
+++ b/src/gui/platform/darwin/qmetallayer_p.h
@@ -0,0 +1,41 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMETALLAYER_P_H
+#define QMETALLAYER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qtguiglobal.h>
+
+#include <QtCore/qreadwritelock.h>
+#include <QtCore/qloggingcategory.h>
+#include <QtCore/private/qcore_mac_p.h>
+
+#include <QuartzCore/CAMetalLayer.h>
+
+QT_BEGIN_NAMESPACE
+class QReadWriteLock;
+
+Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcMetalLayer, Q_GUI_EXPORT)
+
+QT_END_NAMESPACE
+
+#if defined(__OBJC__)
+Q_GUI_EXPORT
+#endif
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QMetalLayer, CAMetalLayer
+@property (nonatomic, readonly) QT_PREPEND_NAMESPACE(QReadWriteLock) &displayLock;
+@property (atomic, copy) void (^mainThreadPresentation)();
+)
+
+#endif // QMETALLAYER_P_H
diff --git a/src/gui/platform/ios/qiosnativeinterface.cpp b/src/gui/platform/ios/qiosnativeinterface.cpp
new file mode 100644
index 0000000000..c942709e33
--- /dev/null
+++ b/src/gui/platform/ios/qiosnativeinterface.cpp
@@ -0,0 +1,26 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtGui/private/qguiapplication_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QNativeInterface::Private;
+
+#if defined(Q_OS_VISIONOS)
+
+/*!
+ \class QNativeInterface::QVisionOSApplication
+ \since 6.8
+ \internal
+ \preliminary
+ \brief Native interface to QGuiApplication, to be retrieved from QPlatformIntegration.
+ \inmodule QtGui
+ \ingroup native-interfaces
+*/
+
+QT_DEFINE_NATIVE_INTERFACE(QVisionOSApplication);
+
+#endif // Q_OS_VISIONOS
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/unix/qgenericunixthemes.cpp b/src/gui/platform/unix/qgenericunixthemes.cpp
index fc4b2296d2..53142d8196 100644
--- a/src/gui/platform/unix/qgenericunixthemes.cpp
+++ b/src/gui/platform/unix/qgenericunixthemes.cpp
@@ -78,17 +78,19 @@ static const char defaultFixedFontNameC[] = "monospace";
enum { defaultSystemFontSize = 9 };
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
-static bool isDBusTrayAvailable() {
- static bool dbusTrayAvailable = false;
- static bool dbusTrayAvailableKnown = false;
- if (!dbusTrayAvailableKnown) {
+static bool shouldUseDBusTray() {
+ // There's no other tray implementation to fallback to on non-X11
+ // and QDBusTrayIcon can register the icon on the fly after creation
+ static bool result = QGuiApplication::platformName() != "xcb"_L1;
+ static bool resultKnown = result;
+ if (!resultKnown) {
QDBusMenuConnection conn;
if (conn.isWatcherRegistered())
- dbusTrayAvailable = true;
- dbusTrayAvailableKnown = true;
- qCDebug(qLcTray) << "D-Bus tray available:" << dbusTrayAvailable;
+ result = true;
+ resultKnown = true;
+ qCDebug(qLcTray) << "D-Bus tray available:" << result;
}
- return dbusTrayAvailable;
+ return result;
}
#endif
@@ -476,7 +478,7 @@ QPlatformMenuBar *QGenericUnixTheme::createPlatformMenuBar() const
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
QPlatformSystemTrayIcon *QGenericUnixTheme::createPlatformSystemTrayIcon() const
{
- if (isDBusTrayAvailable())
+ if (shouldUseDBusTray())
return new QDBusTrayIcon();
return nullptr;
}
@@ -541,6 +543,48 @@ class QKdeThemePrivate : public QPlatformThemePrivate
{
public:
+ enum class KdeSettingType {
+ Root,
+ KDE,
+ Icons,
+ ToolBarIcons,
+ ToolBarStyle,
+ Fonts,
+ Colors,
+ };
+
+ enum class KdeSetting {
+ WidgetStyle,
+ ColorScheme,
+ SingleClick,
+ ShowIconsOnPushButtons,
+ IconTheme,
+ ToolBarIconSize,
+ ToolButtonStyle,
+ WheelScrollLines,
+ DoubleClickInterval,
+ StartDragDistance,
+ StartDragTime,
+ CursorBlinkRate,
+ Font,
+ Fixed,
+ MenuFont,
+ ToolBarFont,
+ ButtonBackground,
+ WindowBackground,
+ ViewForeground,
+ WindowForeground,
+ ViewBackground,
+ SelectionBackground,
+ SelectionForeground,
+ ViewBackgroundAlternate,
+ ButtonForeground,
+ ViewForegroundLink,
+ ViewForegroundVisited,
+ TooltipBackground,
+ TooltipForeground,
+ };
+
QKdeThemePrivate(const QStringList &kdeDirs, int kdeVersion);
static QString kdeGlobals(const QString &kdeDir, int kdeVersion)
@@ -551,7 +595,9 @@ public:
}
void refresh();
- static QVariant readKdeSetting(const QString &key, const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings);
+ static QVariant readKdeSetting(KdeSetting s, const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &settings);
+ QVariant readKdeSetting(KdeSetting s) const;
+ void clearKdeSettings() const;
static void readKdeSystemPalette(const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings, QPalette *pal);
static QFont *kdeFont(const QVariant &fontValue);
static QStringList kdeIconThemeSearchPaths(const QStringList &kdeDirs);
@@ -575,8 +621,9 @@ public:
Qt::ColorScheme m_colorScheme = Qt::ColorScheme::Unknown;
void updateColorScheme(const QString &themeName);
-#ifndef QT_NO_DBUS
private:
+ mutable QHash<QString, QSettings *> kdeSettings;
+#ifndef QT_NO_DBUS
std::unique_ptr<QGenericUnixThemeDBusListener> dbus;
bool initDbus();
void settingChangedHandler(QGenericUnixThemeDBusListener::Provider provider,
@@ -632,9 +679,136 @@ QKdeThemePrivate::QKdeThemePrivate(const QStringList &kdeDirs, int kdeVersion)
#endif // QT_NO_DBUS
}
+static constexpr QLatin1StringView settingsPrefix(QKdeThemePrivate::KdeSettingType type)
+{
+ switch (type) {
+ case QKdeThemePrivate::KdeSettingType::Root:
+ return QLatin1StringView();
+ case QKdeThemePrivate::KdeSettingType::KDE:
+ return QLatin1StringView("KDE/");
+ case QKdeThemePrivate::KdeSettingType::Fonts:
+ return QLatin1StringView();
+ case QKdeThemePrivate::KdeSettingType::Colors:
+ return QLatin1StringView("Colors:");
+ case QKdeThemePrivate::KdeSettingType::Icons:
+ return QLatin1StringView("Icons/");
+ case QKdeThemePrivate::KdeSettingType::ToolBarIcons:
+ return QLatin1StringView("ToolbarIcons/");
+ case QKdeThemePrivate::KdeSettingType::ToolBarStyle:
+ return QLatin1StringView("Toolbar style/");
+ }
+ Q_UNREACHABLE_RETURN(QLatin1StringView());
+}
+
+static constexpr QKdeThemePrivate::KdeSettingType settingsType(QKdeThemePrivate::KdeSetting setting)
+{
+#define CASE(s, type) case QKdeThemePrivate::KdeSetting::s:\
+ return QKdeThemePrivate::KdeSettingType::type
+
+ switch (setting) {
+ CASE(WidgetStyle, Root);
+ CASE(ColorScheme, Root);
+ CASE(SingleClick, KDE);
+ CASE(ShowIconsOnPushButtons, KDE);
+ CASE(IconTheme, Icons);
+ CASE(ToolBarIconSize, ToolBarIcons);
+ CASE(ToolButtonStyle, ToolBarStyle);
+ CASE(WheelScrollLines, KDE);
+ CASE(DoubleClickInterval, KDE);
+ CASE(StartDragDistance, KDE);
+ CASE(StartDragTime, KDE);
+ CASE(CursorBlinkRate, KDE);
+ CASE(Font, Root);
+ CASE(Fixed, Root);
+ CASE(MenuFont, Root);
+ CASE(ToolBarFont, Root);
+ CASE(ButtonBackground, Colors);
+ CASE(WindowBackground, Colors);
+ CASE(ViewForeground, Colors);
+ CASE(WindowForeground, Colors);
+ CASE(ViewBackground, Colors);
+ CASE(SelectionBackground, Colors);
+ CASE(SelectionForeground, Colors);
+ CASE(ViewBackgroundAlternate, Colors);
+ CASE(ButtonForeground, Colors);
+ CASE(ViewForegroundLink, Colors);
+ CASE(ViewForegroundVisited, Colors);
+ CASE(TooltipBackground, Colors);
+ CASE(TooltipForeground, Colors);
+ };
+ Q_UNREACHABLE_RETURN(QKdeThemePrivate::KdeSettingType::Root);
+}
+#undef CASE
+
+static constexpr QLatin1StringView settingsKey(QKdeThemePrivate::KdeSetting setting)
+{
+ switch (setting) {
+ case QKdeThemePrivate::KdeSetting::WidgetStyle:
+ return QLatin1StringView("widgetStyle");
+ case QKdeThemePrivate::KdeSetting::ColorScheme:
+ return QLatin1StringView("ColorScheme");
+ case QKdeThemePrivate::KdeSetting::SingleClick:
+ return QLatin1StringView("SingleClick");
+ case QKdeThemePrivate::KdeSetting::ShowIconsOnPushButtons:
+ return QLatin1StringView("ShowIconsOnPushButtons");
+ case QKdeThemePrivate::KdeSetting::IconTheme:
+ return QLatin1StringView("Theme");
+ case QKdeThemePrivate::KdeSetting::ToolBarIconSize:
+ return QLatin1StringView("Size");
+ case QKdeThemePrivate::KdeSetting::ToolButtonStyle:
+ return QLatin1StringView("ToolButtonStyle");
+ case QKdeThemePrivate::KdeSetting::WheelScrollLines:
+ return QLatin1StringView("WheelScrollLines");
+ case QKdeThemePrivate::KdeSetting::DoubleClickInterval:
+ return QLatin1StringView("DoubleClickInterval");
+ case QKdeThemePrivate::KdeSetting::StartDragDistance:
+ return QLatin1StringView("StartDragDist");
+ case QKdeThemePrivate::KdeSetting::StartDragTime:
+ return QLatin1StringView("StartDragTime");
+ case QKdeThemePrivate::KdeSetting::CursorBlinkRate:
+ return QLatin1StringView("CursorBlinkRate");
+ case QKdeThemePrivate::KdeSetting::Font:
+ return QLatin1StringView("font");
+ case QKdeThemePrivate::KdeSetting::Fixed:
+ return QLatin1StringView("fixed");
+ case QKdeThemePrivate::KdeSetting::MenuFont:
+ return QLatin1StringView("menuFont");
+ case QKdeThemePrivate::KdeSetting::ToolBarFont:
+ return QLatin1StringView("toolBarFont");
+ case QKdeThemePrivate::KdeSetting::ButtonBackground:
+ return QLatin1StringView("Button/BackgroundNormal");
+ case QKdeThemePrivate::KdeSetting::WindowBackground:
+ return QLatin1StringView("Window/BackgroundNormal");
+ case QKdeThemePrivate::KdeSetting::ViewForeground:
+ return QLatin1StringView("View/ForegroundNormal");
+ case QKdeThemePrivate::KdeSetting::WindowForeground:
+ return QLatin1StringView("Window/ForegroundNormal");
+ case QKdeThemePrivate::KdeSetting::ViewBackground:
+ return QLatin1StringView("View/BackgroundNormal");
+ case QKdeThemePrivate::KdeSetting::SelectionBackground:
+ return QLatin1StringView("Selection/BackgroundNormal");
+ case QKdeThemePrivate::KdeSetting::SelectionForeground:
+ return QLatin1StringView("Selection/ForegroundNormal");
+ case QKdeThemePrivate::KdeSetting::ViewBackgroundAlternate:
+ return QLatin1StringView("View/BackgroundAlternate");
+ case QKdeThemePrivate::KdeSetting::ButtonForeground:
+ return QLatin1StringView("Button/ForegroundNormal");
+ case QKdeThemePrivate::KdeSetting::ViewForegroundLink:
+ return QLatin1StringView("View/ForegroundLink");
+ case QKdeThemePrivate::KdeSetting::ViewForegroundVisited:
+ return QLatin1StringView("View/ForegroundVisited");
+ case QKdeThemePrivate::KdeSetting::TooltipBackground:
+ return QLatin1StringView("Tooltip/BackgroundNormal");
+ case QKdeThemePrivate::KdeSetting::TooltipForeground:
+ return QLatin1StringView("Tooltip/ForegroundNormal");
+ };
+ Q_UNREACHABLE_RETURN(QLatin1StringView());
+}
+
void QKdeThemePrivate::refresh()
{
resources.clear();
+ clearKdeSettings();
toolButtonStyle = Qt::ToolButtonTextBesideIcon;
toolBarIconSize = 0;
@@ -647,45 +821,39 @@ void QKdeThemePrivate::refresh()
else
iconFallbackThemeName = iconThemeName = QStringLiteral("oxygen");
- QHash<QString, QSettings*> kdeSettings;
-
QPalette systemPalette = QPalette();
readKdeSystemPalette(kdeDirs, kdeVersion, kdeSettings, &systemPalette);
resources.palettes[QPlatformTheme::SystemPalette] = new QPalette(systemPalette);
//## TODO tooltip color
- const QVariant styleValue = readKdeSetting(QStringLiteral("widgetStyle"), kdeDirs, kdeVersion, kdeSettings);
+ const QVariant styleValue = readKdeSetting(KdeSetting::WidgetStyle);
if (styleValue.isValid()) {
const QString style = styleValue.toString();
if (style != styleNames.front())
styleNames.push_front(style);
}
- const QVariant colorScheme = readKdeSetting(QStringLiteral("ColorScheme"), kdeDirs,
- kdeVersion, kdeSettings);
+ const QVariant colorScheme = readKdeSetting(KdeSetting::ColorScheme);
- if (colorScheme.isValid())
- updateColorScheme(colorScheme.toString());
- else
- m_colorScheme = Qt::ColorScheme::Unknown;
+ updateColorScheme(colorScheme.toString());
- const QVariant singleClickValue = readKdeSetting(QStringLiteral("KDE/SingleClick"), kdeDirs, kdeVersion, kdeSettings);
+ const QVariant singleClickValue = readKdeSetting(KdeSetting::SingleClick);
if (singleClickValue.isValid())
singleClick = singleClickValue.toBool();
- const QVariant showIconsOnPushButtonsValue = readKdeSetting(QStringLiteral("KDE/ShowIconsOnPushButtons"), kdeDirs, kdeVersion, kdeSettings);
+ const QVariant showIconsOnPushButtonsValue = readKdeSetting(KdeSetting::ShowIconsOnPushButtons);
if (showIconsOnPushButtonsValue.isValid())
showIconsOnPushButtons = showIconsOnPushButtonsValue.toBool();
- const QVariant themeValue = readKdeSetting(QStringLiteral("Icons/Theme"), kdeDirs, kdeVersion, kdeSettings);
+ const QVariant themeValue = readKdeSetting(KdeSetting::IconTheme);
if (themeValue.isValid())
iconThemeName = themeValue.toString();
- const QVariant toolBarIconSizeValue = readKdeSetting(QStringLiteral("ToolbarIcons/Size"), kdeDirs, kdeVersion, kdeSettings);
+ const QVariant toolBarIconSizeValue = readKdeSetting(KdeSetting::ToolBarIconSize);
if (toolBarIconSizeValue.isValid())
toolBarIconSize = toolBarIconSizeValue.toInt();
- const QVariant toolbarStyleValue = readKdeSetting(QStringLiteral("Toolbar style/ToolButtonStyle"), kdeDirs, kdeVersion, kdeSettings);
+ const QVariant toolbarStyleValue = readKdeSetting(KdeSetting::ToolButtonStyle);
if (toolbarStyleValue.isValid()) {
const QString toolBarStyle = toolbarStyleValue.toString();
if (toolBarStyle == "TextBesideIcon"_L1)
@@ -696,35 +864,35 @@ void QKdeThemePrivate::refresh()
toolButtonStyle = Qt::ToolButtonTextUnderIcon;
}
- const QVariant wheelScrollLinesValue = readKdeSetting(QStringLiteral("KDE/WheelScrollLines"), kdeDirs, kdeVersion, kdeSettings);
+ const QVariant wheelScrollLinesValue = readKdeSetting(KdeSetting::WheelScrollLines);
if (wheelScrollLinesValue.isValid())
wheelScrollLines = wheelScrollLinesValue.toInt();
- const QVariant doubleClickIntervalValue = readKdeSetting(QStringLiteral("KDE/DoubleClickInterval"), kdeDirs, kdeVersion, kdeSettings);
+ const QVariant doubleClickIntervalValue = readKdeSetting(KdeSetting::DoubleClickInterval);
if (doubleClickIntervalValue.isValid())
doubleClickInterval = doubleClickIntervalValue.toInt();
- const QVariant startDragDistValue = readKdeSetting(QStringLiteral("KDE/StartDragDist"), kdeDirs, kdeVersion, kdeSettings);
+ const QVariant startDragDistValue = readKdeSetting(KdeSetting::StartDragDistance);
if (startDragDistValue.isValid())
startDragDist = startDragDistValue.toInt();
- const QVariant startDragTimeValue = readKdeSetting(QStringLiteral("KDE/StartDragTime"), kdeDirs, kdeVersion, kdeSettings);
+ const QVariant startDragTimeValue = readKdeSetting(KdeSetting::StartDragTime);
if (startDragTimeValue.isValid())
startDragTime = startDragTimeValue.toInt();
- const QVariant cursorBlinkRateValue = readKdeSetting(QStringLiteral("KDE/CursorBlinkRate"), kdeDirs, kdeVersion, kdeSettings);
+ const QVariant cursorBlinkRateValue = readKdeSetting(KdeSetting::CursorBlinkRate);
if (cursorBlinkRateValue.isValid()) {
cursorBlinkRate = cursorBlinkRateValue.toInt();
cursorBlinkRate = cursorBlinkRate > 0 ? qBound(200, cursorBlinkRate, 2000) : 0;
}
// Read system font, ignore 'smallestReadableFont'
- if (QFont *systemFont = kdeFont(readKdeSetting(QStringLiteral("font"), kdeDirs, kdeVersion, kdeSettings)))
+ if (QFont *systemFont = kdeFont(readKdeSetting(KdeSetting::Font)))
resources.fonts[QPlatformTheme::SystemFont] = systemFont;
else
resources.fonts[QPlatformTheme::SystemFont] = new QFont(QLatin1StringView(defaultSystemFontNameC), defaultSystemFontSize);
- if (QFont *fixedFont = kdeFont(readKdeSetting(QStringLiteral("fixed"), kdeDirs, kdeVersion, kdeSettings))) {
+ if (QFont *fixedFont = kdeFont(readKdeSetting(KdeSetting::Fixed))) {
resources.fonts[QPlatformTheme::FixedFont] = fixedFont;
} else {
fixedFont = new QFont(QLatin1StringView(defaultFixedFontNameC), defaultSystemFontSize);
@@ -732,12 +900,12 @@ void QKdeThemePrivate::refresh()
resources.fonts[QPlatformTheme::FixedFont] = fixedFont;
}
- if (QFont *menuFont = kdeFont(readKdeSetting(QStringLiteral("menuFont"), kdeDirs, kdeVersion, kdeSettings))) {
+ if (QFont *menuFont = kdeFont(readKdeSetting(KdeSetting::MenuFont))) {
resources.fonts[QPlatformTheme::MenuFont] = menuFont;
resources.fonts[QPlatformTheme::MenuBarFont] = new QFont(*menuFont);
}
- if (QFont *toolBarFont = kdeFont(readKdeSetting(QStringLiteral("toolBarFont"), kdeDirs, kdeVersion, kdeSettings)))
+ if (QFont *toolBarFont = kdeFont(readKdeSetting(KdeSetting::ToolBarFont)))
resources.fonts[QPlatformTheme::ToolButtonFont] = toolBarFont;
QWindowSystemInterface::handleThemeChange();
@@ -747,7 +915,7 @@ void QKdeThemePrivate::refresh()
qDeleteAll(kdeSettings);
}
-QVariant QKdeThemePrivate::readKdeSetting(const QString &key, const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings)
+QVariant QKdeThemePrivate::readKdeSetting(KdeSetting s, const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings)
{
for (const QString &kdeDir : kdeDirs) {
QSettings *settings = kdeSettings.value(kdeDir);
@@ -759,6 +927,7 @@ QVariant QKdeThemePrivate::readKdeSetting(const QString &key, const QStringList
}
}
if (settings) {
+ const QString key = settingsPrefix(settingsType(s)) + settingsKey(s);
const QVariant value = settings->value(key);
if (value.isValid())
return value;
@@ -767,6 +936,16 @@ QVariant QKdeThemePrivate::readKdeSetting(const QString &key, const QStringList
return QVariant();
}
+QVariant QKdeThemePrivate::readKdeSetting(KdeSetting s) const
+{
+ return readKdeSetting(s, kdeDirs, kdeVersion, kdeSettings);
+}
+
+void QKdeThemePrivate::clearKdeSettings() const
+{
+ kdeSettings.clear();
+}
+
// Reads the color from the KDE configuration, and store it in the
// palette with the given color role if found.
static inline bool kdeColor(QPalette *pal, QPalette::ColorRole role, const QVariant &value)
@@ -782,7 +961,7 @@ static inline bool kdeColor(QPalette *pal, QPalette::ColorRole role, const QVari
void QKdeThemePrivate::readKdeSystemPalette(const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings, QPalette *pal)
{
- if (!kdeColor(pal, QPalette::Button, readKdeSetting(QStringLiteral("Colors:Button/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings))) {
+ if (!kdeColor(pal, QPalette::Button, readKdeSetting(KdeSetting::ButtonBackground, kdeDirs, kdeVersion, kdeSettings))) {
// kcolorscheme.cpp: SetDefaultColors
const QColor defaultWindowBackground(214, 210, 208);
const QColor defaultButtonBackground(223, 220, 217);
@@ -790,18 +969,18 @@ void QKdeThemePrivate::readKdeSystemPalette(const QStringList &kdeDirs, int kdeV
return;
}
- kdeColor(pal, QPalette::Window, readKdeSetting(QStringLiteral("Colors:Window/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings));
- kdeColor(pal, QPalette::Text, readKdeSetting(QStringLiteral("Colors:View/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
- kdeColor(pal, QPalette::WindowText, readKdeSetting(QStringLiteral("Colors:Window/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
- kdeColor(pal, QPalette::Base, readKdeSetting(QStringLiteral("Colors:View/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings));
- kdeColor(pal, QPalette::Highlight, readKdeSetting(QStringLiteral("Colors:Selection/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings));
- kdeColor(pal, QPalette::HighlightedText, readKdeSetting(QStringLiteral("Colors:Selection/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
- kdeColor(pal, QPalette::AlternateBase, readKdeSetting(QStringLiteral("Colors:View/BackgroundAlternate"), kdeDirs, kdeVersion, kdeSettings));
- kdeColor(pal, QPalette::ButtonText, readKdeSetting(QStringLiteral("Colors:Button/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
- kdeColor(pal, QPalette::Link, readKdeSetting(QStringLiteral("Colors:View/ForegroundLink"), kdeDirs, kdeVersion, kdeSettings));
- kdeColor(pal, QPalette::LinkVisited, readKdeSetting(QStringLiteral("Colors:View/ForegroundVisited"), kdeDirs, kdeVersion, kdeSettings));
- kdeColor(pal, QPalette::ToolTipBase, readKdeSetting(QStringLiteral("Colors:Tooltip/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings));
- kdeColor(pal, QPalette::ToolTipText, readKdeSetting(QStringLiteral("Colors:Tooltip/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::Window, readKdeSetting(KdeSetting::WindowBackground, kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::Text, readKdeSetting(KdeSetting::ViewForeground, kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::WindowText, readKdeSetting(KdeSetting::WindowForeground, kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::Base, readKdeSetting(KdeSetting::ViewBackground, kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::Highlight, readKdeSetting(KdeSetting::SelectionBackground, kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::HighlightedText, readKdeSetting(KdeSetting::SelectionForeground, kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::AlternateBase, readKdeSetting(KdeSetting::ViewBackgroundAlternate, kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::ButtonText, readKdeSetting(KdeSetting::ButtonForeground, kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::Link, readKdeSetting(KdeSetting::ViewForegroundLink, kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::LinkVisited, readKdeSetting(KdeSetting::ViewForegroundVisited, kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::ToolTipBase, readKdeSetting(KdeSetting::TooltipBackground, kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::ToolTipText, readKdeSetting(KdeSetting::TooltipForeground, kdeDirs, kdeVersion, kdeSettings));
// The above code sets _all_ color roles to "normal" colors. In KDE, the disabled
// color roles are calculated by applying various effects described in kdeglobals.
@@ -957,13 +1136,13 @@ Qt::ColorScheme QKdeTheme::colorScheme() const
/*!
\internal
- \brief QKdeTheme::updateColorScheme - guess and set appearance for unix themes.
- KDE themes do not have an appearance property.
- The key words "dark" or "light" should be part of the theme name.
+ \brief QKdeTheme::updateColorScheme - guess and set a color scheme for unix themes.
+ KDE themes do not have a color scheme property.
+ The key words "dark" or "light" are usually part of the theme name.
This is, however, not a mandatory convention.
- If \param themeName contains a key word, the respective appearance is set.
- If it doesn't, the appearance is heuristically determined by comparing text and base color
+ If \param themeName contains a valid key word, the respective color scheme is set.
+ If it doesn't, the color scheme is heuristically determined by comparing text and base color
of the system palette.
*/
void QKdeThemePrivate::updateColorScheme(const QString &themeName)
@@ -991,7 +1170,6 @@ void QKdeThemePrivate::updateColorScheme(const QString &themeName)
m_colorScheme = Qt::ColorScheme::Unknown;
}
-
const QPalette *QKdeTheme::palette(Palette type) const
{
Q_D(const QKdeTheme);
@@ -1071,7 +1249,7 @@ QPlatformMenuBar *QKdeTheme::createPlatformMenuBar() const
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
QPlatformSystemTrayIcon *QKdeTheme::createPlatformSystemTrayIcon() const
{
- if (isDBusTrayAvailable())
+ if (shouldUseDBusTray())
return new QDBusTrayIcon();
return nullptr;
}
@@ -1266,7 +1444,7 @@ Qt::ColorScheme QGnomeTheme::colorScheme() const
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
QPlatformSystemTrayIcon *QGnomeTheme::createPlatformSystemTrayIcon() const
{
- if (isDBusTrayAvailable())
+ if (shouldUseDBusTray())
return new QDBusTrayIcon();
return nullptr;
}
diff --git a/src/gui/qt_cmdline.cmake b/src/gui/qt_cmdline.cmake
index 379cc417e7..446618ebc4 100644
--- a/src/gui/qt_cmdline.cmake
+++ b/src/gui/qt_cmdline.cmake
@@ -27,7 +27,8 @@ qt_commandline_option(opengl TYPE optionalString VALUES no yes desktop es2 dynam
qt_commandline_option(opengl-es-2 TYPE void NAME opengl VALUE es2)
qt_commandline_option(opengles3 TYPE boolean)
qt_commandline_option(openvg TYPE boolean)
-qt_commandline_option(qpa TYPE string NAME qpa_default_platform)
+qt_commandline_option(qpa TYPE string NAME qpa_platforms)
+qt_commandline_option(default-qpa TYPE string NAME qpa_default_platform)
qt_commandline_option(sm TYPE boolean NAME sessionmanager)
qt_commandline_option(tslib TYPE boolean)
qt_commandline_option(vulkan TYPE boolean)
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp
index f54371da66..dcaa87a5ff 100644
--- a/src/gui/rhi/qrhigles2.cpp
+++ b/src/gui/rhi/qrhigles2.cpp
@@ -2377,7 +2377,15 @@ void QRhiGles2::enqueueSubresUpload(QGles2Texture *texD, QGles2CommandBuffer *cb
const QPoint sp = subresDesc.sourceTopLeft();
if (!subresDesc.sourceSize().isEmpty())
size = subresDesc.sourceSize();
- img = img.copy(sp.x(), sp.y(), size.width(), size.height());
+
+ if (caps.unpackRowLength) {
+ cbD->retainImage(img);
+ // create a non-owning wrapper for the subimage
+ const uchar *data = img.constBits() + sp.y() * img.bytesPerLine() + sp.x() * (qMax(1, img.depth() / 8));
+ img = QImage(data, size.width(), size.height(), img.bytesPerLine(), img.format());
+ } else {
+ img = img.copy(sp.x(), sp.y(), size.width(), size.height());
+ }
}
setCmdByNotCompressedData(cbD->retainImage(img), size, img.bytesPerLine());
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm
index 212f9c8240..887d40c7a5 100644
--- a/src/gui/rhi/qrhimetal.mm
+++ b/src/gui/rhi/qrhimetal.mm
@@ -13,6 +13,7 @@
#include <QOperatingSystemVersion>
#include <QtCore/private/qcore_mac_p.h>
+#include <QtGui/private/qmetallayer_p.h>
#ifdef Q_OS_MACOS
#include <AppKit/AppKit.h>
@@ -20,8 +21,9 @@
#include <UIKit/UIKit.h>
#endif
+#include <QuartzCore/CATransaction.h>
+
#include <Metal/Metal.h>
-#include <QuartzCore/CAMetalLayer.h>
QT_BEGIN_NAMESPACE
@@ -461,11 +463,6 @@ struct QMetalSwapChainData
id<MTLTexture> msaaTex[QMTL_FRAMES_IN_FLIGHT];
QRhiTexture::Format rhiColorFormat;
MTLPixelFormat colorFormat;
-#ifdef Q_OS_MACOS
- bool liveResizeObserverSet = false;
- QMacNotificationObserver liveResizeStartObserver;
- QMacNotificationObserver liveResizeEndObserver;
-#endif
};
QRhiMetal::QRhiMetal(QRhiMetalInitParams *params, QRhiMetalNativeHandles *importDevice)
@@ -2396,8 +2393,11 @@ QRhi::FrameOpResult QRhiMetal::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrame
QMetalSwapChain *swapChainD = QRHI_RES(QMetalSwapChain, swapChain);
Q_ASSERT(currentSwapChain == swapChainD);
+ // Keep strong reference to command buffer
+ id<MTLCommandBuffer> commandBuffer = swapChainD->cbWrapper.d->cb;
+
__block int thisFrameSlot = currentFrameSlot;
- [swapChainD->cbWrapper.d->cb addCompletedHandler: ^(id<MTLCommandBuffer> cb) {
+ [commandBuffer addCompletedHandler: ^(id<MTLCommandBuffer> cb) {
swapChainD->d->lastGpuTime[thisFrameSlot] += cb.GPUEndTime - cb.GPUStartTime;
dispatch_semaphore_signal(swapChainD->d->sem[thisFrameSlot]);
}];
@@ -2407,30 +2407,75 @@ QRhi::FrameOpResult QRhiMetal::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrame
// released before the command buffer is done with it. Manually keep it alive
// to work around this.
id<MTLTexture> drawableTexture = [swapChainD->d->curDrawable.texture retain];
- [swapChainD->cbWrapper.d->cb addCompletedHandler:^(id<MTLCommandBuffer>) {
+ [commandBuffer addCompletedHandler:^(id<MTLCommandBuffer>) {
[drawableTexture release];
}];
#endif
- const bool needsPresent = !flags.testFlag(QRhi::SkipPresent);
- const bool presentsWithTransaction = swapChainD->d->layer.presentsWithTransaction;
- if (!presentsWithTransaction && needsPresent) {
- // beginFrame-endFrame without a render pass inbetween means there is no drawable.
- if (id<CAMetalDrawable> drawable = swapChainD->d->curDrawable)
- [swapChainD->cbWrapper.d->cb presentDrawable: drawable];
- }
-
- [swapChainD->cbWrapper.d->cb commit];
-
- if (presentsWithTransaction && needsPresent) {
- // beginFrame-endFrame without a render pass inbetween means there is no drawable.
+ if (flags.testFlag(QRhi::SkipPresent)) {
+ // Just need to commit, that's it
+ [commandBuffer commit];
+ } else {
if (id<CAMetalDrawable> drawable = swapChainD->d->curDrawable) {
- // The layer has presentsWithTransaction set to true to avoid flicker on resizing,
- // so here it is important to follow what the Metal docs say when it comes to the
- // issuing the present.
- [swapChainD->cbWrapper.d->cb waitUntilScheduled];
- [drawable present];
+ // Got something to present
+ if (swapChainD->d->layer.presentsWithTransaction) {
+ [commandBuffer commit];
+ // Keep strong reference to Metal layer
+ auto *metalLayer = swapChainD->d->layer;
+ auto presentWithTransaction = ^{
+ [commandBuffer waitUntilScheduled];
+ // If the layer has been resized while we waited to be scheduled we bail out,
+ // as the drawable is no longer valid for the layer, and we'll get a follow-up
+ // display with the right size. We know we are on the main thread here, which
+ // means we can access the layer directly. We also know that the layer is valid,
+ // since the block keeps a strong reference to it, compared to the QRhiSwapChain
+ // that can go away under our feet by the time we're scheduled.
+ const auto surfaceSize = QSizeF::fromCGSize(metalLayer.bounds.size) * metalLayer.contentsScale;
+ const auto textureSize = QSizeF(drawable.texture.width, drawable.texture.height);
+ if (textureSize == surfaceSize) {
+ [drawable present];
+ } else {
+ qCDebug(QRHI_LOG_INFO) << "Skipping" << drawable << "due to texture size"
+ << textureSize << "not matching surface size" << surfaceSize;
+ }
+ };
+
+ if (NSThread.currentThread == NSThread.mainThread) {
+ presentWithTransaction();
+ } else {
+ auto *qtMetalLayer = qt_objc_cast<QMetalLayer*>(swapChainD->d->layer);
+ Q_ASSERT(qtMetalLayer);
+ // Let the main thread present the drawable from displayLayer
+ qtMetalLayer.mainThreadPresentation = presentWithTransaction;
+ }
+ } else {
+ // Keep strong reference to Metal layer so it's valid in the block
+ auto *qtMetalLayer = qt_objc_cast<QMetalLayer*>(swapChainD->d->layer);
+ [commandBuffer addScheduledHandler:^(id<MTLCommandBuffer>) {
+ if (qtMetalLayer) {
+ // The schedule handler comes in on the com.Metal.CompletionQueueDispatch
+ // thread, which means we might be racing against a display cycle on the
+ // main thread. If the displayLayer is already in progress, we don't want
+ // to step on its toes.
+ if (qtMetalLayer.displayLock.tryLockForRead()) {
+ [drawable present];
+ qtMetalLayer.displayLock.unlock();
+ } else {
+ qCDebug(QRHI_LOG_INFO) << "Skipping" << drawable
+ << "due to" << qtMetalLayer << "needing display";
+ }
+ } else {
+ [drawable present];
+ }
+ }];
+ [commandBuffer commit];
+ }
+ } else {
+ // Still need to commit, even if we don't have a drawable
+ [commandBuffer commit];
}
+
+ swapChainD->currentFrameSlot = (swapChainD->currentFrameSlot + 1) % QMTL_FRAMES_IN_FLIGHT;
}
// Must not hold on to the drawable, regardless of needsPresent
@@ -2439,9 +2484,6 @@ QRhi::FrameOpResult QRhiMetal::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrame
[d->captureScope endScope];
- if (needsPresent)
- swapChainD->currentFrameSlot = (swapChainD->currentFrameSlot + 1) % QMTL_FRAMES_IN_FLIGHT;
-
swapChainD->frameCount += 1;
currentSwapChain = nullptr;
return QRhi::FrameOpSuccess;
@@ -2589,7 +2631,6 @@ void QRhiMetal::enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEnc
int w = img.width();
int h = img.height();
int bpl = img.bytesPerLine();
- int srcOffset = 0;
if (!subresDesc.sourceSize().isEmpty() || !subresDesc.sourceTopLeft().isNull()) {
const int sx = subresDesc.sourceTopLeft().x();
@@ -2598,10 +2639,12 @@ void QRhiMetal::enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEnc
w = subresDesc.sourceSize().width();
h = subresDesc.sourceSize().height();
}
- if (img.depth() == 32) {
- memcpy(reinterpret_cast<char *>(mp) + *curOfs, img.constBits(), size_t(fullImageSizeBytes));
- srcOffset = sy * bpl + sx * 4;
- // bpl remains set to the original image's row stride
+ if (w == img.width()) {
+ const int bpc = qMax(1, img.depth() / 8);
+ Q_ASSERT(h * img.bytesPerLine() <= fullImageSizeBytes);
+ memcpy(reinterpret_cast<char *>(mp) + *curOfs,
+ img.constBits() + sy * img.bytesPerLine() + sx * bpc,
+ h * img.bytesPerLine());
} else {
img = img.copy(sx, sy, w, h);
bpl = img.bytesPerLine();
@@ -2613,7 +2656,7 @@ void QRhiMetal::enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEnc
}
[blitEnc copyFromBuffer: texD->d->stagingBuf[currentFrameSlot]
- sourceOffset: NSUInteger(*curOfs + srcOffset)
+ sourceOffset: NSUInteger(*curOfs)
sourceBytesPerRow: NSUInteger(bpl)
sourceBytesPerImage: 0
sourceSize: MTLSizeMake(NSUInteger(w), NSUInteger(h), 1)
@@ -4856,7 +4899,7 @@ void QMetalGraphicsPipeline::setupAttachmentsInMetalRenderPassDescriptor(void *m
}
QRHI_RES_RHI(QRhiMetal);
- rpDesc.sampleCount = NSUInteger(rhiD->effectiveSampleCount(m_sampleCount));
+ rpDesc.rasterSampleCount = NSUInteger(rhiD->effectiveSampleCount(m_sampleCount));
}
void QMetalGraphicsPipeline::setupMetalDepthStencilDescriptor(void *metalDsDesc)
@@ -6167,12 +6210,6 @@ void QMetalSwapChain::destroy()
d->msaaTex[i] = nil;
}
-#ifdef Q_OS_MACOS
- d->liveResizeStartObserver.remove();
- d->liveResizeEndObserver.remove();
- d->liveResizeObserverSet = false;
-#endif
-
d->layer = nullptr;
m_proxyData = {};
@@ -6379,34 +6416,6 @@ bool QMetalSwapChain::createOrResize()
[d->layer setDevice: rhiD->d->dev];
-#ifdef Q_OS_MACOS
- // Can only use presentsWithTransaction (to get smooth resizing) when
- // presenting from the main (gui) thread. We predict that based on the
- // thread this function is called on since if the QRhiSwapChain is
- // initialied on a given thread then that's almost certainly the thread on
- // which the QRhi renders and presents.
- const bool canUsePresentsWithTransaction = NSThread.isMainThread;
-
- // Have an env.var. just in case it turns out presentsWithTransaction is
- // not desired in some specific case.
- static bool allowPresentsWithTransaction = !qEnvironmentVariableIntValue("QT_MTL_NO_TRANSACTION");
-
- if (allowPresentsWithTransaction && canUsePresentsWithTransaction && !d->liveResizeObserverSet) {
- d->liveResizeObserverSet = true;
- NSView *view = reinterpret_cast<NSView *>(window->winId());
- NSWindow *window = view.window;
- if (window) {
- qCDebug(QRHI_LOG_INFO, "will set presentsWithTransaction during live resize");
- d->liveResizeStartObserver = QMacNotificationObserver(window, NSWindowWillStartLiveResizeNotification, [this] {
- d->layer.presentsWithTransaction = true;
- });
- d->liveResizeEndObserver = QMacNotificationObserver(window, NSWindowDidEndLiveResizeNotification, [this] {
- d->layer.presentsWithTransaction = false;
- });
- }
- }
-#endif
-
[d->curDrawable release];
d->curDrawable = nil;
diff --git a/src/gui/text/coretext/qfontengine_coretext.mm b/src/gui/text/coretext/qfontengine_coretext.mm
index 1050c03d75..87ed95f3ac 100644
--- a/src/gui/text/coretext/qfontengine_coretext.mm
+++ b/src/gui/text/coretext/qfontengine_coretext.mm
@@ -336,7 +336,10 @@ void QCoreTextFontEngine::initializeHeightMetrics() const
m_descent = QFixed::fromReal(CTFontGetDescent(ctfont));
m_leading = QFixed::fromReal(CTFontGetLeading(ctfont));
- m_heightMetricsQueried = true;
+ if (preferTypoLineMetrics())
+ QFontEngine::initializeHeightMetrics();
+ else
+ m_heightMetricsQueried = true;
}
QFixed QCoreTextFontEngine::capHeight() const
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index e5815ffce2..7886d9ba91 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -12,6 +12,7 @@
#include <qfontmetrics.h>
#include <qbrush.h>
#include <qimagereader.h>
+#include <qtextformat.h>
#include <algorithm>
@@ -35,6 +36,7 @@ struct QCssKnownValue
quint64 id;
};
+// This array is sorted alphabetically.
static const QCssKnownValue properties[NumProperties - 1] = {
{ "-qt-background-role", QtBackgroundRole },
{ "-qt-block-indent", QtBlockIndent },
@@ -46,6 +48,11 @@ static const QCssKnownValue properties[NumProperties - 1] = {
{ "-qt-list-number-suffix", QtListNumberSuffix },
{ "-qt-paragraph-type", QtParagraphType },
{ "-qt-stroke-color", QtStrokeColor },
+ { "-qt-stroke-dasharray", QtStrokeDashArray },
+ { "-qt-stroke-dashoffset", QtStrokeDashOffset },
+ { "-qt-stroke-linecap", QtStrokeLineCap },
+ { "-qt-stroke-linejoin", QtStrokeLineJoin },
+ { "-qt-stroke-miterlimit", QtStrokeMiterLimit },
{ "-qt-stroke-width", QtStrokeWidth },
{ "-qt-style-features", QtStyleFeatures },
{ "-qt-table-type", QtTableType },
@@ -159,6 +166,7 @@ static const QCssKnownValue values[NumKnownValues - 1] = {
{ "always", Value_Always },
{ "auto", Value_Auto },
{ "base", Value_Base },
+ { "beveljoin", Value_BevelJoin},
{ "bold", Value_Bold },
{ "bottom", Value_Bottom },
{ "bright-text", Value_BrightText },
@@ -175,6 +183,7 @@ static const QCssKnownValue values[NumKnownValues - 1] = {
{ "dot-dot-dash", Value_DotDotDash },
{ "dotted", Value_Dotted },
{ "double", Value_Double },
+ { "flatcap", Value_FlatCap},
{ "groove", Value_Groove },
{ "highlight", Value_Highlight },
{ "highlighted-text", Value_HighlightedText },
@@ -193,6 +202,7 @@ static const QCssKnownValue values[NumKnownValues - 1] = {
{ "mid", Value_Mid },
{ "middle", Value_Middle },
{ "midlight", Value_Midlight },
+ { "miterjoin", Value_MiterJoin},
{ "native", Value_Native },
{ "none", Value_None },
{ "normal", Value_Normal },
@@ -207,14 +217,18 @@ static const QCssKnownValue values[NumKnownValues - 1] = {
{ "pre-wrap", Value_PreWrap },
{ "ridge", Value_Ridge },
{ "right", Value_Right },
+ { "roundcap", Value_RoundCap},
+ { "roundjoin", Value_RoundJoin},
{ "selected", Value_Selected },
{ "shadow", Value_Shadow },
{ "small" , Value_Small },
{ "small-caps", Value_SmallCaps },
{ "solid", Value_Solid },
{ "square", Value_Square },
+ { "squarecap", Value_SquareCap},
{ "sub", Value_Sub },
{ "super", Value_Super },
+ { "svgmiterjoin", Value_SvgMiterJoin},
{ "text", Value_Text },
{ "top", Value_Top },
{ "transparent", Value_Transparent },
@@ -230,10 +244,10 @@ static const QCssKnownValue values[NumKnownValues - 1] = {
};
//Map id to strings as they appears in the 'values' array above
-static const short indexOfId[NumKnownValues] = { 0, 41, 48, 42, 49, 50, 55, 35, 26, 71, 72, 25, 43, 5, 64, 48,
- 29, 59, 60, 27, 52, 62, 6, 10, 39, 56, 19, 13, 17, 18, 20, 21, 51, 24, 46, 68, 37, 3, 2, 40, 63, 16,
- 11, 58, 14, 32, 65, 33, 66, 56, 67, 34, 70, 8, 28, 38, 12, 36, 61, 7, 9, 4, 69, 54, 22, 23, 30, 31,
- 1, 15, 0, 53, 45, 44 };
+static const short indexOfId[NumKnownValues] = { 0, 44, 51, 45, 52, 53, 60, 37, 28, 78, 79, 27, 46, 6, 71, 50,
+ 31, 65, 66, 29, 55, 69, 7, 11, 42, 62, 20, 14, 18, 19, 21, 23, 54, 26, 49, 75, 39, 3, 2, 43, 70, 17, 12,
+ 63, 15, 34, 72, 35, 73, 61, 74, 36, 64, 22, 56, 41, 5, 57, 67, 77, 9, 30, 40, 13, 38, 68, 8, 10, 4, 76,
+ 59, 24, 25, 32, 33, 1, 16, 0, 58, 48, 47 };
QString Value::toString() const
{
@@ -396,6 +410,8 @@ LengthData ValueExtractor::lengthValue(const Value& v)
if (data.unit != LengthData::None)
s.chop(2);
+ else if (v.type == Value::Percentage)
+ data.unit = LengthData::Percent;
data.number = s.toDouble();
return data;
@@ -409,6 +425,15 @@ static int lengthValueFromData(const LengthData& data, const QFont& f)
return qRound(qBound(double(INT_MIN) + 0.1, scale * data.number, double(INT_MAX)));
}
+QTextLength ValueExtractor::textLength(const Declaration &decl)
+{
+ const LengthData data = lengthValue(decl.d->values.at(0));
+ if (data.unit == LengthData::Percent)
+ return QTextLength(QTextLength::PercentageLength, data.number);
+
+ return QTextLength(QTextLength::FixedLength, lengthValueFromData(data, f));
+}
+
int ValueExtractor::lengthValue(const Declaration &decl)
{
if (decl.d->parsed.isValid())
@@ -1823,6 +1848,35 @@ bool Declaration::borderCollapseValue() const
return d->values.at(0).toString() == "collapse"_L1;
}
+QList<qreal> Declaration::dashArray() const
+{
+ if (d->propertyId != Property::QtStrokeDashArray || d->values.empty())
+ return QList<qreal>();
+
+ bool isValid = true;
+ QList<qreal> dashes;
+ for (int i = 0; i < d->values.size(); i++) {
+ Value v = d->values[i];
+ // Separators must be at odd indices and Numbers at even indices.
+ bool isValidSeparator = (i & 1) && v.type == Value::TermOperatorComma;
+ bool isValidNumber = !(i & 1) && v.type == Value::Number;
+ if (!isValidNumber && !isValidSeparator) {
+ isValid = false;
+ break;
+ } else if (isValidNumber) {
+ bool ok;
+ dashes.append(v.variant.toReal(&ok));
+ if (!ok) {
+ isValid = false;
+ break;
+ }
+ }
+ }
+
+ isValid &= !(dashes.size() & 1);
+ return isValid ? dashes : QList<qreal>();
+}
+
QIcon Declaration::iconValue() const
{
if (d->parsed.isValid())
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index c1cfb1ac9b..ba4a611df3 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -169,6 +169,11 @@ enum Property {
QtAccent,
QtStrokeWidth,
QtStrokeColor,
+ QtStrokeLineCap,
+ QtStrokeLineJoin,
+ QtStrokeMiterLimit,
+ QtStrokeDashArray,
+ QtStrokeDashOffset,
QtForeground,
NumProperties
};
@@ -226,6 +231,13 @@ enum KnownValue {
Value_SmallCaps,
Value_Uppercase,
Value_Lowercase,
+ Value_SquareCap,
+ Value_FlatCap,
+ Value_RoundCap,
+ Value_MiterJoin,
+ Value_BevelJoin,
+ Value_RoundJoin,
+ Value_SvgMiterJoin,
/* keep these in same order as QPalette::ColorRole */
Value_FirstColorRole,
@@ -392,7 +404,7 @@ QT_CSS_DECLARE_TYPEINFO(BackgroundData, Q_RELOCATABLE_TYPE)
struct LengthData {
qreal number;
- enum { None, Px, Ex, Em } unit;
+ enum { None, Px, Ex, Em, Percent } unit;
};
QT_CSS_DECLARE_TYPEINFO(LengthData, Q_PRIMITIVE_TYPE)
@@ -451,6 +463,8 @@ struct Q_GUI_EXPORT Declaration
void borderImageValue(QString *image, int *cuts, TileMode *h, TileMode *v) const;
bool borderCollapseValue() const;
+
+ QList<qreal> dashArray() const;
};
QT_CSS_DECLARE_TYPEINFO(Declaration, Q_RELOCATABLE_TYPE)
@@ -835,6 +849,7 @@ struct Q_GUI_EXPORT ValueExtractor
bool extractIcon(QIcon *icon, QSize *size);
void lengthValues(const Declaration &decl, int *m);
+ QTextLength textLength(const Declaration &decl);
private:
void extractFont();
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index f3b861957e..c8881a9bf8 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -1470,6 +1470,23 @@ QFont::StyleHint QFont::styleHint() const
font that matches the largest subset of the input string instead. This will be more
expensive for strings where missing glyphs occur, but may give more consistent results.
If \c NoFontMerging is set, then \c ContextFontMerging will have no effect.
+ \value [since 6.8] PreferTypoLineMetrics For compatibility reasons, OpenType fonts contain
+ two competing sets of the vertical line metrics that provide the
+ \l{QFontMetricsF::ascent()}{ascent}, \l{QFontMetricsF::descent()}{descent} and
+ \l{QFontMetricsF::leading()}{leading} of the font. These are often referred to as the
+ \l{https://learn.microsoft.com/en-us/typography/opentype/spec/os2#uswinascent}{win}
+ (Windows) metrics and the
+ \l{https://learn.microsoft.com/en-us/typography/opentype/spec/os2#sta}{typo}
+ (typographical) metrics. While the specification recommends using the \c typo metrics for
+ line spacing, many applications prefer the \c win metrics unless the \c{USE_TYPO_METRICS}
+ flag is set in the
+ \l{https://learn.microsoft.com/en-us/typography/opentype/spec/os2#fsselection}{fsSelection}
+ field of the font. For backwards-compatibility reasons, this is also the case for Qt
+ applications. This is not an issue for fonts that set the \c{USE_TYPO_METRICS} flag to
+ indicate that the \c{typo} metrics are valid, nor for fonts where the \c{win} metrics
+ and \c{typo} metrics match up. However, for certain fonts the \c{win} metrics may be
+ larger than the preferable line spacing and the \c{USE_TYPO_METRICS} flag may be unset
+ by mistake. For such fonts, setting \c{PreferTypoLineMetrics} may give superior results.
\value NoFontMerging If the font selected for a certain writing system
does not contain a character requested to draw, then Qt automatically chooses a similar
looking font that contains the character. The NoFontMerging flag disables this feature.
@@ -2435,9 +2452,7 @@ std::optional<QFont::Tag> QFont::Tag::fromString(QAnyStringView view) noexcept
By default, no variable axes are set.
- \note In order to use variable axes on Windows, the application has to run with either the
- FreeType or DirectWrite font databases. See the documentation for
- QGuiApplication::QGuiApplication() for more information on how to select these technologies.
+ \note On Windows, variable axes are not supported if the optional GDI font backend is in use.
\sa unsetVariableAxis
*/
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 66a5f7c155..0b41e31bdb 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -36,19 +36,20 @@ public:
Q_ENUM(StyleHint)
enum StyleStrategy {
- PreferDefault = 0x0001,
- PreferBitmap = 0x0002,
- PreferDevice = 0x0004,
- PreferOutline = 0x0008,
- ForceOutline = 0x0010,
- PreferMatch = 0x0020,
- PreferQuality = 0x0040,
- PreferAntialias = 0x0080,
- NoAntialias = 0x0100,
- NoSubpixelAntialias = 0x0800,
- PreferNoShaping = 0x1000,
- ContextFontMerging = 0x2000,
- NoFontMerging = 0x8000
+ PreferDefault = 0x0001,
+ PreferBitmap = 0x0002,
+ PreferDevice = 0x0004,
+ PreferOutline = 0x0008,
+ ForceOutline = 0x0010,
+ PreferMatch = 0x0020,
+ PreferQuality = 0x0040,
+ PreferAntialias = 0x0080,
+ NoAntialias = 0x0100,
+ NoSubpixelAntialias = 0x0800,
+ PreferNoShaping = 0x1000,
+ ContextFontMerging = 0x2000,
+ PreferTypoLineMetrics = 0x4000,
+ NoFontMerging = 0x8000
};
Q_ENUM(StyleStrategy)
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index d3a13d801b..3d6d3b7886 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -670,7 +670,7 @@ static QStringList fallbacksForFamily(const QString &family, QFont::Style style,
return *fallbacks;
// make sure that the db has all fallback families
- QStringList userFallbacks = db->applicationFallbackFontFamilies.value(script == QChar::Script_Common ? QChar::Script_Latin : script);
+ QStringList userFallbacks = db->applicationFallbackFontFamilies.value(script == QChar::Script_Latin ? QChar::Script_Common : script);
QStringList retList = userFallbacks + QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
QStringList::iterator i;
@@ -2187,6 +2187,8 @@ int QFontDatabasePrivate::addAppFont(const QByteArray &fontData, const QString &
// loaded, so it has to be flushed.
QFontCache::instance()->clear();
+ fallbacksCache.clear();
+
emit qApp->fontDatabaseChanged();
return i;
@@ -2386,23 +2388,32 @@ bool QFontDatabase::removeAllApplicationFonts()
be prioritized in reverse order, so that the last family added will be checked first and so
on.
+ \note Qt's font matching algorithm considers \c{QChar::Script_Common} (undetermined script)
+ and \c{QChar::Script_Latin} the same. Adding a fallback for either of these will also apply
+ to the other.
+
\sa setApplicationFallbackFontFamilies(), removeApplicationFallbackFontFamily(), applicationFallbackFontFamilies()
*/
void QFontDatabase::addApplicationFallbackFontFamily(QChar::Script script, const QString &familyName)
{
QMutexLocker locker(fontDatabaseMutex());
- if (script < QChar::Script_Latin) {
+ if (script < QChar::Script_Common) {
qCWarning(lcFontDb) << "Invalid script passed to addApplicationFallbackFontFamily:" << script;
return;
}
+ if (script == QChar::Script_Latin)
+ script = QChar::Script_Common;
+
auto *db = QFontDatabasePrivate::instance();
auto it = db->applicationFallbackFontFamilies.find(script);
if (it == db->applicationFallbackFontFamilies.end())
it = db->applicationFallbackFontFamilies.insert(script, QStringList{});
it->prepend(familyName);
+
+ QFontCache::instance()->clear();
db->fallbacksCache.clear();
}
@@ -2420,6 +2431,14 @@ bool QFontDatabase::removeApplicationFallbackFontFamily(QChar::Script script, co
{
QMutexLocker locker(fontDatabaseMutex());
+ if (script < QChar::Script_Common) {
+ qCWarning(lcFontDb) << "Invalid script passed to removeApplicationFallbackFontFamily:" << script;
+ return false;
+ }
+
+ if (script == QChar::Script_Latin)
+ script = QChar::Script_Common;
+
auto *db = QFontDatabasePrivate::instance();
auto it = db->applicationFallbackFontFamilies.find(script);
if (it != db->applicationFallbackFontFamilies.end()) {
@@ -2452,11 +2471,14 @@ void QFontDatabase::setApplicationFallbackFontFamilies(QChar::Script script, con
{
QMutexLocker locker(fontDatabaseMutex());
- if (script < QChar::Script_Latin) {
+ if (script < QChar::Script_Common) {
qCWarning(lcFontDb) << "Invalid script passed to setApplicationFallbackFontFamilies:" << script;
return;
}
+ if (script == QChar::Script_Latin)
+ script = QChar::Script_Common;
+
auto *db = QFontDatabasePrivate::instance();
db->applicationFallbackFontFamilies[script] = familyNames;
@@ -2476,6 +2498,9 @@ QStringList QFontDatabase::applicationFallbackFontFamilies(QChar::Script script)
{
QMutexLocker locker(fontDatabaseMutex());
+ if (script == QChar::Script_Latin)
+ script = QChar::Script_Common;
+
auto *db = QFontDatabasePrivate::instance();
return db->applicationFallbackFontFamilies.value(script);
}
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 4e78aaac2e..ee74c7f8fb 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -430,6 +430,11 @@ void QFontEngine::initializeHeightMetrics() const
m_heightMetricsQueried = true;
}
+bool QFontEngine::preferTypoLineMetrics() const
+{
+ return (fontDef.styleStrategy & QFont::PreferTypoLineMetrics) != 0;
+}
+
bool QFontEngine::processOS2Table() const
{
QByteArray os2 = getSfntTable(QFont::Tag("OS/2").value());
@@ -444,7 +449,7 @@ bool QFontEngine::processOS2Table() const
enum { USE_TYPO_METRICS = 0x80 };
QFixed unitsPerEm = emSquareSize();
- if (fsSelection & USE_TYPO_METRICS) {
+ if (preferTypoLineMetrics() || fsSelection & USE_TYPO_METRICS) {
// Some fonts may have invalid OS/2 data. We detect this and bail out.
if (typoAscent == 0 && typoDescent == 0)
return false;
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index a0e0801354..807f02fdc7 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -148,6 +148,7 @@ public:
return subPixelPositionFor(QFixedPoint(x, 0)).x;
}
+ bool preferTypoLineMetrics() const;
bool isColorFont() const { return glyphFormat == Format_ARGB; }
static bool isIgnorableChar(char32_t ucs4)
{
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 15a313e13d..c39d3514c5 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -53,6 +53,9 @@ namespace {
QTextDocument::ResourceProvider qt_defaultResourceProvider;
};
+QAbstractUndoItem::~QAbstractUndoItem()
+ = default;
+
/*!
\fn bool Qt::mightBeRichText(QAnyStringView text)
@@ -2757,6 +2760,51 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
html += " -qt-stroke-width:"_L1;
html += QString::number(outlinePen.widthF());
html += "px;"_L1;
+
+ html += " -qt-stroke-linecap:"_L1;
+ if (outlinePen.capStyle() == Qt::SquareCap)
+ html += "squarecap;"_L1;
+ else if (outlinePen.capStyle() == Qt::FlatCap)
+ html += "flatcap;"_L1;
+ else if (outlinePen.capStyle() == Qt::RoundCap)
+ html += "roundcap;"_L1;
+
+ html += " -qt-stroke-linejoin:"_L1;
+ if (outlinePen.joinStyle() == Qt::MiterJoin)
+ html += "miterjoin;"_L1;
+ else if (outlinePen.joinStyle() == Qt::SvgMiterJoin)
+ html += "svgmiterjoin;"_L1;
+ else if (outlinePen.joinStyle() == Qt::BevelJoin)
+ html += "beveljoin;"_L1;
+ else if (outlinePen.joinStyle() == Qt::RoundJoin)
+ html += "roundjoin;"_L1;
+
+ if (outlinePen.joinStyle() == Qt::MiterJoin ||
+ outlinePen.joinStyle() == Qt::SvgMiterJoin) {
+ html += " -qt-stroke-miterlimit:"_L1;
+ html += QString::number(outlinePen.miterLimit());
+ html += u';';
+ }
+
+ if (outlinePen.style() == Qt::CustomDashLine && !outlinePen.dashPattern().empty()) {
+ html += " -qt-stroke-dasharray:"_L1;
+ QString dashArrayString;
+ QList<qreal> dashes = outlinePen.dashPattern();
+
+ for (int i = 0; i < dashes.length() - 1; i++) {
+ qreal dash = dashes[i];
+ dashArrayString += QString::number(dash) + u',';
+ }
+
+ dashArrayString += QString::number(dashes.last());
+ html += dashArrayString;
+ html += u';';
+
+ html += " -qt-stroke-dashoffset:"_L1;
+ html += QString::number(outlinePen.dashOffset());
+ html += u';';
+ }
+
attributesEmitted = true;
}
@@ -2944,6 +2992,17 @@ void QTextHtmlExporter::emitFragment(const QTextFragment &fragment)
html += "<img"_L1;
+ QString maxWidthCss;
+
+ if (imgFmt.hasProperty(QTextFormat::ImageMaxWidth)) {
+ auto length = imgFmt.lengthProperty(QTextFormat::ImageMaxWidth);
+ maxWidthCss += "max-width:"_L1;
+ if (length.type() == QTextLength::PercentageLength)
+ maxWidthCss += QString::number(length.rawValue()) + "%;"_L1;
+ else if (length.type() == QTextLength::FixedLength)
+ maxWidthCss += QString::number(length.rawValue()) + "px;"_L1;
+ }
+
if (imgFmt.hasProperty(QTextFormat::ImageName))
emitAttribute("src", imgFmt.name());
@@ -2960,9 +3019,11 @@ void QTextHtmlExporter::emitFragment(const QTextFragment &fragment)
emitAttribute("height", QString::number(imgFmt.height()));
if (imgFmt.verticalAlignment() == QTextCharFormat::AlignMiddle)
- html += " style=\"vertical-align: middle;\""_L1;
+ html += " style=\"vertical-align: middle;"_L1 + maxWidthCss + u'\"';
else if (imgFmt.verticalAlignment() == QTextCharFormat::AlignTop)
- html += " style=\"vertical-align: top;\""_L1;
+ html += " style=\"vertical-align: top;"_L1 + maxWidthCss + u'\"';
+ else if (!maxWidthCss.isEmpty())
+ html += " style=\""_L1 + maxWidthCss + u'\"';
if (QTextFrame *imageFrame = qobject_cast<QTextFrame *>(doc->objectForFormat(imgFmt)))
emitFloatStyle(imageFrame->frameFormat().position());
diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h
index b6253bfa46..11a8abcb50 100644
--- a/src/gui/text/qtextdocument.h
+++ b/src/gui/text/qtextdocument.h
@@ -45,15 +45,11 @@ namespace Qt
class Q_GUI_EXPORT QAbstractUndoItem
{
public:
- virtual ~QAbstractUndoItem() = 0;
+ virtual ~QAbstractUndoItem();
virtual void undo() = 0;
virtual void redo() = 0;
};
-inline QAbstractUndoItem::~QAbstractUndoItem()
-{
-}
-
class QTextDocumentPrivate;
class Q_GUI_EXPORT QTextDocument : public QObject
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index a18157ab9b..08512bead5 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1396,7 +1396,9 @@ void QTextEngine::shapeText(int item) const
QFontEngine *fontEngine = this->fontEngine(si, &si.ascent, &si.descent, &si.leading);
+#if QT_CONFIG(harfbuzz)
bool kerningEnabled;
+#endif
bool letterSpacingIsAbsolute;
bool shapingEnabled = false;
QHash<QFont::Tag, quint32> features;
@@ -1405,8 +1407,8 @@ void QTextEngine::shapeText(int item) const
if (useRawFont) {
QTextCharFormat f = format(&si);
QFont font = f.font();
- kerningEnabled = font.kerning();
# if QT_CONFIG(harfbuzz)
+ kerningEnabled = font.kerning();
shapingEnabled = QFontEngine::scriptRequiresOpenType(QChar::Script(si.analysis.script))
|| (font.styleStrategy() & QFont::PreferNoShaping) == 0;
# endif
@@ -1418,8 +1420,8 @@ void QTextEngine::shapeText(int item) const
#endif
{
QFont font = this->font(si);
- kerningEnabled = font.d->kerning;
#if QT_CONFIG(harfbuzz)
+ kerningEnabled = font.d->kerning;
shapingEnabled = QFontEngine::scriptRequiresOpenType(QChar::Script(si.analysis.script))
|| (font.d->request.styleStrategy & QFont::PreferNoShaping) == 0;
#endif
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index daa79a55d2..dacef70812 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -745,6 +745,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextTableCellFormat &
\value ImageWidth
\value ImageHeight
\value ImageQuality
+ \value ImageMaxWidth This enum value has been added in Qt 6.8.
Selection properties
@@ -3426,7 +3427,7 @@ QTextImageFormat::QTextImageFormat(const QTextFormat &fmt)
Sets the \a width of the rectangle occupied by the image.
- \sa width(), setHeight()
+ \sa width(), setHeight(), maximumWidth()
*/
@@ -3438,6 +3439,24 @@ QTextImageFormat::QTextImageFormat(const QTextFormat &fmt)
\sa height(), setWidth()
*/
+/*!
+ \fn void QTextImageFormat::setMaximumWidth(QTextLength maximumWidth)
+
+ Sets the \a maximumWidth of the rectangle occupied by the image. This
+ can be an absolute number or a percentage of the available document size.
+
+ \sa width(), setHeight()
+*/
+
+
+/*!
+ \fn QTextLength QTextImageFormat::maximumWidth() const
+
+ Returns the maximum width of the rectangle occupied by the image.
+
+ \sa width(), setMaximumWidth()
+*/
+
/*!
\fn void QTextImageFormat::setHeight(qreal height)
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h
index c009d328cb..2fa86ed0d1 100644
--- a/src/gui/text/qtextformat.h
+++ b/src/gui/text/qtextformat.h
@@ -241,6 +241,7 @@ public:
ImageWidth = 0x5010,
ImageHeight = 0x5011,
ImageQuality = 0x5014,
+ ImageMaxWidth = 0x5015,
// internal
/*
@@ -796,6 +797,10 @@ public:
inline qreal width() const
{ return doubleProperty(ImageWidth); }
+ inline void setMaximumWidth(QTextLength maxWidth);
+ inline QTextLength maximumWidth() const
+ { return lengthProperty(ImageMaxWidth); }
+
inline void setHeight(qreal height);
inline qreal height() const
{ return doubleProperty(ImageHeight); }
@@ -823,6 +828,9 @@ inline void QTextImageFormat::setName(const QString &aname)
inline void QTextImageFormat::setWidth(qreal awidth)
{ setProperty(ImageWidth, awidth); }
+inline void QTextImageFormat::setMaximumWidth(QTextLength maxWidth)
+{ setProperty(ImageMaxWidth, maxWidth); }
+
inline void QTextImageFormat::setHeight(qreal aheight)
{ setProperty(ImageHeight, aheight); }
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index ee92cece78..54c291b82e 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1422,12 +1422,74 @@ void QTextHtmlParserNode::applyCssDeclarations(const QList<QCss::Declaration> &d
}
break;
}
+ case QCss::QtStrokeLineCap:
+ {
+ QPen pen = charFormat.textOutline();
+ switch (identifier) {
+ case QCss::Value_SquareCap: pen.setCapStyle(Qt::SquareCap); break;
+ case QCss::Value_FlatCap: pen.setCapStyle(Qt::FlatCap); break;
+ case QCss::Value_RoundCap: pen.setCapStyle(Qt::RoundCap); break;
+ default: break;
+ }
+ charFormat.setTextOutline(pen);
+ break;
+ }
+ case QCss::QtStrokeLineJoin:
+ {
+ QPen pen = charFormat.textOutline();
+ switch (identifier) {
+ case QCss::Value_MiterJoin: pen.setJoinStyle(Qt::MiterJoin); break;
+ case QCss::Value_BevelJoin: pen.setJoinStyle(Qt::BevelJoin); break;
+ case QCss::Value_RoundJoin: pen.setJoinStyle(Qt::RoundJoin); break;
+ case QCss::Value_SvgMiterJoin: pen.setJoinStyle(Qt::SvgMiterJoin); break;
+ default: break;
+ }
+ charFormat.setTextOutline(pen);
+ break;
+ }
+ case QCss::QtStrokeMiterLimit:
+ {
+ qreal miterLimit;
+ if (decl.realValue(&miterLimit)) {
+ QPen pen = charFormat.textOutline();
+ pen.setMiterLimit(miterLimit);
+ charFormat.setTextOutline(pen);
+ }
+ break;
+ }
+ case QCss::QtStrokeDashArray:
+ {
+ QList<qreal> dashes = decl.dashArray();
+ if (!dashes.empty()) {
+ QPen pen = charFormat.textOutline();
+ pen.setDashPattern(dashes);
+ charFormat.setTextOutline(pen);
+ }
+ break;
+ }
+ case QCss::QtStrokeDashOffset:
+ {
+ qreal dashOffset;
+ if (decl.realValue(&dashOffset)) {
+ QPen pen = charFormat.textOutline();
+ pen.setDashOffset(dashOffset);
+ charFormat.setTextOutline(pen);
+ }
+ break;
+ }
case QCss::QtForeground:
{
QBrush brush = decl.brushValue();
charFormat.setForeground(brush);
break;
}
+ case QCss::MaximumWidth:
+ if (id == Html_img) {
+ auto imageFormat = charFormat.toImageFormat();
+ imageFormat.setMaximumWidth(extractor.textLength(decl));
+ charFormat = imageFormat;
+ }
+ break;
default: break;
}
}
diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp
index 5c56c30711..920e6c689c 100644
--- a/src/gui/text/qtextimagehandler.cpp
+++ b/src/gui/text/qtextimagehandler.cpp
@@ -12,6 +12,7 @@
#include <private/qtextengine_p.h>
#include <qpalette.h>
#include <qthread.h>
+#include <limits>
QT_BEGIN_NAMESPACE
@@ -72,21 +73,40 @@ template<typename T>
static QSize getSize(QTextDocument *doc, const QTextImageFormat &format)
{
const bool hasWidth = format.hasProperty(QTextFormat::ImageWidth);
- const int width = qRound(format.width());
+ int width = qRound(format.width());
const bool hasHeight = format.hasProperty(QTextFormat::ImageHeight);
const int height = qRound(format.height());
+ const bool hasMaxWidth = format.hasProperty(QTextFormat::ImageMaxWidth);
+ const auto maxWidth = format.maximumWidth();
+
+ int effectiveMaxWidth = std::numeric_limits<int>::max();
+ if (hasMaxWidth) {
+ if (maxWidth.type() == QTextLength::PercentageLength)
+ effectiveMaxWidth = (doc->pageSize().width() - 2 * doc->documentMargin()) * maxWidth.value(100) / 100;
+ else
+ effectiveMaxWidth = maxWidth.rawValue();
+
+ width = qMin(effectiveMaxWidth, width);
+ }
+
T source;
QSize size(width, height);
if (!hasWidth || !hasHeight) {
source = getAs<T>(doc, format);
- const QSizeF sourceSize = source.deviceIndependentSize();
+ QSizeF sourceSize = source.deviceIndependentSize();
+
+ if (sourceSize.width() > effectiveMaxWidth) {
+ // image is bigger than effectiveMaxWidth, scale it down
+ sourceSize.setHeight(effectiveMaxWidth * (sourceSize.height() / qreal(sourceSize.width())));
+ sourceSize.setWidth(effectiveMaxWidth);
+ }
if (!hasWidth) {
if (!hasHeight)
size.setWidth(sourceSize.width());
else
- size.setWidth(qRound(height * (sourceSize.width() / qreal(sourceSize.height()))));
+ size.setWidth(qMin(effectiveMaxWidth, qRound(height * (sourceSize.width() / qreal(sourceSize.height())))));
}
if (!hasHeight) {
if (!hasWidth)
diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp
index 4a12f6db6f..4d98faf398 100644
--- a/src/gui/util/qdesktopservices.cpp
+++ b/src/gui/util/qdesktopservices.cpp
@@ -18,8 +18,6 @@
#include <qpa/qplatformintegration.h>
#include <qdir.h>
-#include <QtCore/private/qlocking_p.h>
-
QT_BEGIN_NAMESPACE
class QOpenUrlHandlerRegistry
@@ -36,36 +34,10 @@ public:
};
typedef QHash<QString, Handler> HandlerHash;
HandlerHash handlers;
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
- QObject context;
-
- void handlerDestroyed(QObject *handler);
-#endif
-
};
Q_GLOBAL_STATIC(QOpenUrlHandlerRegistry, handlerRegistry)
-#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
-void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler)
-{
- const auto lock = qt_scoped_lock(mutex);
- HandlerHash::Iterator it = handlers.begin();
- while (it != handlers.end()) {
- if (it->receiver == handler) {
- it = handlers.erase(it);
- qWarning("Please call QDesktopServices::unsetUrlHandler() before destroying a "
- "registered URL handler object.\n"
- "Support for destroying a registered URL handler object is deprecated, "
- "and will be removed in Qt 6.6.");
- } else {
- ++it;
- }
- }
-}
-#endif
-
/*!
\class QDesktopServices
\brief The QDesktopServices class provides methods for accessing common desktop services.
@@ -238,10 +210,11 @@ bool QDesktopServices::openUrl(const QUrl &url)
the destruction of the handler object does not overlap with concurrent
invocations of openUrl() using it.
- \section1 iOS
+ \section1 iOS and \macos
- To use this function for receiving data from other apps on iOS you also need to
- add the custom scheme to the \c CFBundleURLSchemes list in your Info.plist file:
+ To use this function for receiving data from other apps on iOS/\macos
+ you also need to add the custom scheme to the \c CFBundleURLSchemes
+ list in your Info.plist file:
\snippet code/src_gui_util_qdesktopservices.cpp 4
@@ -256,7 +229,7 @@ bool QDesktopServices::openUrl(const QUrl &url)
\snippet code/src_gui_util_qdesktopservices.cpp 7
- iOS will search for /.well-known/apple-app-site-association on your domain,
+ iOS/\macos will search for /.well-known/apple-app-site-association on your domain,
when the application is installed. If you want to listen to
\c{https://your.domain.com/help?topic=ABCDEF} you need to provide the following
content there:
@@ -306,11 +279,6 @@ void QDesktopServices::setUrlHandler(const QString &scheme, QObject *receiver, c
h.receiver = receiver;
h.name = method;
registry->handlers.insert(scheme.toLower(), h);
-#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
- QObject::connect(receiver, &QObject::destroyed, &registry->context,
- [registry](QObject *obj) { registry->handlerDestroyed(obj); },
- Qt::DirectConnection);
-#endif
}
/*!
diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt
index e977400245..08789d89de 100644
--- a/src/network/CMakeLists.txt
+++ b/src/network/CMakeLists.txt
@@ -110,6 +110,7 @@ qt_internal_extend_target(Network CONDITION APPLE
qt_internal_extend_target(Network CONDITION WASM
SOURCES
+ access/qformdatabuilder.cpp access/qformdatabuilder.h
access/qhttpmultipart.cpp access/qhttpmultipart.h access/qhttpmultipart_p.h
access/qhttpnetworkheader.cpp access/qhttpnetworkheader_p.h
access/qnetworkreplywasmimpl.cpp access/qnetworkreplywasmimpl_p.h
@@ -126,6 +127,7 @@ qt_internal_extend_target(Network CONDITION QT_FEATURE_http
access/http2/huffman.cpp access/http2/huffman_p.h
access/qabstractprotocolhandler.cpp access/qabstractprotocolhandler_p.h
access/qdecompresshelper.cpp access/qdecompresshelper_p.h
+ access/qformdatabuilder.cpp access/qformdatabuilder.h
access/qhttp1configuration.cpp access/qhttp1configuration.h
access/qhttp2configuration.cpp access/qhttp2configuration.h
access/qhttp2connection.cpp access/qhttp2connection_p.h
diff --git a/src/network/access/http2/http2protocol_p.h b/src/network/access/http2/http2protocol_p.h
index fb5ff199c5..f0f18d1dd5 100644
--- a/src/network/access/http2/http2protocol_p.h
+++ b/src/network/access/http2/http2protocol_p.h
@@ -117,7 +117,7 @@ const qint32 maxSessionReceiveWindowSize((quint32(1) << 31) - 1);
// Presumably, we never use up to 100 streams so let it be 10 simultaneous:
const qint32 qtDefaultStreamReceiveWindowSize = maxSessionReceiveWindowSize / 10;
-struct Frame configurationToSettingsFrame(const QHttp2Configuration &configuration);
+struct Frame Q_AUTOTEST_EXPORT configurationToSettingsFrame(const QHttp2Configuration &configuration);
QByteArray settingsFrameToBase64(const Frame &settingsFrame);
void appendProtocolUpgradeHeaders(const QHttp2Configuration &configuration, QHttpNetworkRequest *request);
std::vector<uchar> assemble_hpack_block(const std::vector<Frame> &frames);
diff --git a/src/network/access/qformdatabuilder.cpp b/src/network/access/qformdatabuilder.cpp
new file mode 100644
index 0000000000..dbbb3a49a6
--- /dev/null
+++ b/src/network/access/qformdatabuilder.cpp
@@ -0,0 +1,313 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qformdatabuilder.h"
+
+#include <QtCore/private/qstringconverter_p.h>
+#if QT_CONFIG(mimetype)
+#include "QtCore/qmimedatabase.h"
+#endif
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QFormDataPartBuilder
+ \brief The QFormDataPartBuilder class is a convenience class to simplify
+ the construction of QHttpPart objects.
+ \since 6.8
+
+ \ingroup network
+ \ingroup shared
+ \inmodule QtNetwork
+
+ The QFormDataPartBuilder class can be used to build a QHttpPart object with
+ the content disposition header set to be form-data by default. Then the
+ generated object can be used as part of a multipart message (which is
+ represented by the QHttpMultiPart class).
+
+ \sa QHttpPart, QHttpMultiPart, QFormDataBuilder
+*/
+
+/*!
+ Constructs a QFormDataPartBuilder object and sets \a name as the name
+ parameter of the form-data.
+*/
+QFormDataPartBuilder::QFormDataPartBuilder(QLatin1StringView name, PrivateConstructor /*unused*/)
+{
+ static_assert(std::is_nothrow_move_constructible_v<decltype(m_body)>);
+ static_assert(std::is_nothrow_move_assignable_v<decltype(m_body)>);
+
+ m_headerValue += "form-data; name=\"";
+ for (auto c : name) {
+ if (c == '"' || c == '\\')
+ m_headerValue += '\\';
+ m_headerValue += c;
+ }
+ m_headerValue += "\"";
+}
+
+/*!
+ \fn QFormDataPartBuilder::QFormDataPartBuilder(QFormDataPartBuilder &&other) noexcept
+
+ Move-constructs a QFormDataPartBuilder instance, making it point at the same
+ object that \a other was pointing to.
+*/
+
+/*!
+ \fn QFormDataPartBuilder &QFormDataPartBuilder::operator=(QFormDataPartBuilder &&other)
+
+ Move-assigns \a other to this QFormDataPartBuilder instance.
+*/
+
+/*!
+ Destroys the QFormDataPartBuilder object.
+*/
+
+QFormDataPartBuilder::~QFormDataPartBuilder()
+ = default;
+
+
+static auto encodeFileName(QStringView view)
+{
+ struct R { QByteArrayView encoding; QByteArray encoded; };
+
+ QByteArrayView encoding = "=";
+ bool needsUtf8 = false;
+
+ for (QChar c : view) {
+ if (c > u'\xff') {
+ encoding = "*=UTF-8''";
+ needsUtf8 = true;
+ break;
+ } else if (c > u'\x7f') {
+ encoding = "*=ISO-8859-1''";
+ }
+ }
+
+ return R{encoding, needsUtf8 ? view.toUtf8() : view.toLatin1()};
+}
+
+static void convertInto_impl(QByteArray &dst, QUtf8StringView in)
+{
+ dst.clear();
+ dst += QByteArrayView{in}; // it's ASCII, anyway
+}
+
+static void convertInto_impl(QByteArray &dst, QLatin1StringView in)
+{
+ dst.clear();
+ dst += QByteArrayView{in}; // it's ASCII, anyway
+}
+
+static void convertInto_impl(QByteArray &dst, QStringView in)
+{
+ dst.resize(in.size());
+ (void)QLatin1::convertFromUnicode(dst.data(), in);
+}
+
+static void convertInto(QByteArray &dst, QAnyStringView in)
+{
+ in.visit([&dst](auto in) { convertInto_impl(dst, in); });
+}
+
+QFormDataPartBuilder &QFormDataPartBuilder::setBodyHelper(const QByteArray &data,
+ QAnyStringView name,
+ QAnyStringView mimeType)
+{
+ m_originalBodyName = name.toString();
+ convertInto(m_mimeType, mimeType);
+ m_body = data;
+ return *this;
+}
+
+/*!
+ Sets \a data as the body of this MIME part and, if given, \a fileName as the
+ file name parameter in the content disposition header.
+
+ If \a mimeType is not given (is empty), then QFormDataPartBuilder tries to
+ auto-detect the mime-type of \a data using QMimeDatabase.
+
+ A subsequent call to setBodyDevice() discards the body and the device will
+ be used instead.
+
+ For a large amount of data (e.g. an image), setBodyDevice() is preferred,
+ which will not copy the data internally.
+
+ \sa setBodyDevice()
+*/
+
+QFormDataPartBuilder &QFormDataPartBuilder::setBody(QByteArrayView data,
+ QAnyStringView fileName,
+ QAnyStringView mimeType)
+{
+ return setBody(data.toByteArray(), fileName, mimeType);
+}
+
+/*!
+ Sets \a body as the body device of this part and \a fileName as the file
+ name parameter in the content disposition header.
+
+ If \a mimeType is not given (is empty), then QFormDataPartBuilder tries to
+ auto-detect the mime-type of \a body using QMimeDatabase.
+
+ A subsequent call to setBody() discards the body device and the data set by
+ setBody() will be used instead.
+
+ For large amounts of data this method should be preferred over setBody(),
+ because the content is not copied when using this method, but read
+ directly from the device.
+
+ \a body must be open and readable. QFormDataPartBuilder does not take
+ ownership of \a body, i.e. the device must be closed and destroyed if
+ necessary.
+
+ \sa setBody(), QHttpPart::setBodyDevice()
+ */
+
+QFormDataPartBuilder &QFormDataPartBuilder::setBodyDevice(QIODevice *body, QAnyStringView fileName,
+ QAnyStringView mimeType)
+{
+ m_originalBodyName = fileName.toString();
+ convertInto(m_mimeType, mimeType);
+ m_body = body;
+ return *this;
+}
+
+/*!
+ Sets the headers specified in \a headers.
+
+ \note The "content-type" and "content-disposition" headers, if any are
+ specified in \a headers, will be overwritten by the class.
+*/
+
+QFormDataPartBuilder &QFormDataPartBuilder::setHeaders(const QHttpHeaders &headers)
+{
+ m_httpHeaders = headers;
+ return *this;
+}
+
+/*!
+ Generates a QHttpPart and sets the content disposition header as form-data.
+
+ When this function called, it uses the MIME database to deduce the type the
+ body based on its name and then sets the deduced type as the content type
+ header.
+*/
+
+QHttpPart QFormDataPartBuilder::build()
+{
+ QHttpPart httpPart;
+
+ if (!m_originalBodyName.isNull()) {
+ const auto enc = encodeFileName(m_originalBodyName);
+ m_headerValue += "; filename" + enc.encoding
+ + enc.encoded.toPercentEncoding(); // RFC 5987 Section 3.2.1
+ }
+
+#if QT_CONFIG(mimetype)
+ if (m_mimeType.isEmpty()) {
+ // auto-detect
+ QMimeDatabase db;
+ convertInto(m_mimeType, std::visit([&](auto &arg) {
+ return db.mimeTypeForFileNameAndData(m_originalBodyName, arg);
+ }, m_body).name());
+ }
+#endif
+
+ for (qsizetype i = 0; i < m_httpHeaders.size(); i++) {
+ httpPart.setRawHeader(QByteArrayView(m_httpHeaders.nameAt(i)).toByteArray(),
+ m_httpHeaders.valueAt(i).toByteArray());
+ }
+
+ if (!m_mimeType.isEmpty())
+ httpPart.setHeader(QNetworkRequest::ContentTypeHeader, m_mimeType);
+
+ httpPart.setHeader(QNetworkRequest::ContentDispositionHeader, m_headerValue);
+
+ if (auto d = std::get_if<QIODevice*>(&m_body))
+ httpPart.setBodyDevice(*d);
+ else if (auto b = std::get_if<QByteArray>(&m_body))
+ httpPart.setBody(*b);
+ else
+ Q_UNREACHABLE();
+
+ return httpPart;
+}
+
+/*!
+ \class QFormDataBuilder
+ \brief The QFormDataBuilder class is a convenience class to simplify
+ the construction of QHttpMultiPart objects.
+ \since 6.8
+
+ \ingroup network
+ \ingroup shared
+ \inmodule QtNetwork
+
+ The QFormDataBuilder class can be used to build a QHttpMultiPart object
+ with the content type set to be FormDataType by default.
+
+ \sa QHttpPart, QHttpMultiPart, QFormDataPartBuilder
+*/
+
+/*!
+ Constructs an empty QFormDataBuilder object.
+*/
+
+QFormDataBuilder::QFormDataBuilder()
+ = default;
+
+/*!
+ Destroys the QFormDataBuilder object.
+*/
+
+QFormDataBuilder::~QFormDataBuilder()
+ = default;
+
+/*!
+ \fn QFormDataBuilder::QFormDataBuilder(QFormDataBuilder &&other) noexcept
+
+ Move-constructs a QFormDataBuilder instance, making it point at the same
+ object that \a other was pointing to.
+*/
+
+/*!
+ \fn QFormDataBuilder &QFormDataBuilder::operator=(QFormDataBuilder &&other) noexcept
+
+ Move-assigns \a other to this QFormDataBuilder instance.
+*/
+
+/*!
+ Constructs and returns a reference to a QFormDataPartBuilder object and sets
+ \a name as the name parameter of the form-data. The returned reference is
+ valid until the next call to this function.
+
+ \sa QFormDataPartBuilder, QHttpPart
+*/
+
+QFormDataPartBuilder &QFormDataBuilder::part(QLatin1StringView name)
+{
+ static_assert(std::is_nothrow_move_constructible_v<decltype(m_parts)>);
+ static_assert(std::is_nothrow_move_assignable_v<decltype(m_parts)>);
+
+ return m_parts.emplace_back(name, QFormDataPartBuilder::PrivateConstructor());
+}
+
+/*!
+ Constructs and returns a pointer to a QHttpMultipart object. The caller
+ takes ownership of the generated QHttpMultiPart object.
+
+ \sa QHttpMultiPart
+*/
+
+std::unique_ptr<QHttpMultiPart> QFormDataBuilder::buildMultiPart()
+{
+ auto multiPart = std::make_unique<QHttpMultiPart>(QHttpMultiPart::FormDataType);
+
+ for (auto &part : m_parts)
+ multiPart->append(part.build());
+
+ return multiPart;
+}
+
+QT_END_NAMESPACE
diff --git a/src/network/access/qformdatabuilder.h b/src/network/access/qformdatabuilder.h
new file mode 100644
index 0000000000..68f9f3742c
--- /dev/null
+++ b/src/network/access/qformdatabuilder.h
@@ -0,0 +1,126 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QFORMDATABUILDER_H
+#define QFORMDATABUILDER_H
+
+#include <QtNetwork/qtnetworkglobal.h>
+#include <QtNetwork/qhttpheaders.h>
+#include <QtNetwork/qhttpmultipart.h>
+
+#include <QtCore/qbytearray.h>
+#include <QtCore/qiodevice.h>
+#include <QtCore/qstring.h>
+
+#include <memory>
+#include <variant>
+#include <vector>
+
+#ifndef Q_OS_WASM
+QT_REQUIRE_CONFIG(http);
+#endif
+
+class tst_QFormDataBuilder;
+
+QT_BEGIN_NAMESPACE
+
+class QHttpPartPrivate;
+class QHttpMultiPart;
+class QDebug;
+
+class QFormDataPartBuilder
+{
+ struct PrivateConstructor { explicit PrivateConstructor() = default; };
+public:
+ Q_NETWORK_EXPORT explicit QFormDataPartBuilder(QLatin1StringView name, PrivateConstructor);
+
+ QFormDataPartBuilder(QFormDataPartBuilder &&other) noexcept
+ : m_headerValue(std::move(other.m_headerValue)),
+ m_originalBodyName(std::move(other.m_originalBodyName)),
+ m_httpHeaders(std::move(other.m_httpHeaders)),
+ m_body(std::move(other.m_body)),
+ m_reserved(std::exchange(other.m_reserved, nullptr))
+ {
+
+ }
+
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFormDataPartBuilder)
+ void swap(QFormDataPartBuilder &other) noexcept
+ {
+ m_headerValue.swap(other.m_headerValue);
+ m_originalBodyName.swap(other.m_originalBodyName);
+ m_httpHeaders.swap(other.m_httpHeaders);
+ m_body.swap(other.m_body);
+ qt_ptr_swap(m_reserved, other.m_reserved);
+ }
+
+ Q_NETWORK_EXPORT ~QFormDataPartBuilder();
+
+ Q_WEAK_OVERLOAD QFormDataPartBuilder &setBody(const QByteArray &data,
+ QAnyStringView fileName = {},
+ QAnyStringView mimeType = {})
+ { return setBodyHelper(data, fileName, mimeType); }
+
+ Q_NETWORK_EXPORT QFormDataPartBuilder &setBody(QByteArrayView data,
+ QAnyStringView fileName = {},
+ QAnyStringView mimeType = {});
+ Q_NETWORK_EXPORT QFormDataPartBuilder &setBodyDevice(QIODevice *body,
+ QAnyStringView fileName = {},
+ QAnyStringView mimeType = {});
+ Q_NETWORK_EXPORT QFormDataPartBuilder &setHeaders(const QHttpHeaders &headers);
+private:
+ Q_DISABLE_COPY(QFormDataPartBuilder)
+
+ Q_NETWORK_EXPORT QFormDataPartBuilder &setBodyHelper(const QByteArray &data,
+ QAnyStringView fileName,
+ QAnyStringView mimeType);
+ Q_NETWORK_EXPORT QHttpPart build();
+
+ QByteArray m_headerValue;
+ QByteArray m_mimeType;
+ QString m_originalBodyName;
+ QHttpHeaders m_httpHeaders;
+ std::variant<QIODevice*, QByteArray> m_body;
+ void *m_reserved = nullptr;
+
+ friend class QFormDataBuilder;
+ friend class ::tst_QFormDataBuilder;
+ friend void swap(QFormDataPartBuilder &lhs, QFormDataPartBuilder &rhs) noexcept
+ { lhs.swap(rhs); }
+};
+
+class QFormDataBuilder
+{
+public:
+ Q_NETWORK_EXPORT explicit QFormDataBuilder();
+
+ QFormDataBuilder(QFormDataBuilder &&other) noexcept
+ : m_parts(std::move(other.m_parts)),
+ m_reserved(std::exchange(other.m_reserved, nullptr))
+ {
+
+ }
+
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFormDataBuilder)
+ void swap(QFormDataBuilder &other) noexcept
+ {
+ m_parts.swap(other.m_parts);
+ qt_ptr_swap(m_reserved, other.m_reserved);
+ }
+
+ Q_NETWORK_EXPORT ~QFormDataBuilder();
+ Q_NETWORK_EXPORT QFormDataPartBuilder &part(QLatin1StringView name);
+ Q_NETWORK_EXPORT std::unique_ptr<QHttpMultiPart> buildMultiPart();
+private:
+ std::vector<QFormDataPartBuilder> m_parts;
+ void *m_reserved = nullptr;
+
+ friend void swap(QFormDataBuilder &lhs, QFormDataBuilder &rhs) noexcept
+ { lhs.swap(rhs); }
+
+ Q_DISABLE_COPY(QFormDataBuilder)
+};
+
+QT_END_NAMESPACE
+
+#endif // QFORMDATABUILDER_H
diff --git a/src/network/access/qhttpmultipart.cpp b/src/network/access/qhttpmultipart.cpp
index 6d81f1b957..a695969f00 100644
--- a/src/network/access/qhttpmultipart.cpp
+++ b/src/network/access/qhttpmultipart.cpp
@@ -386,9 +386,12 @@ void QHttpPartPrivate::checkHeaderCreated() const
{
if (!headerCreated) {
// copied from QHttpNetworkRequestPrivate::header() and adapted
- const auto fields = allRawHeaders();
- for (const auto &[name, value] : fields)
- header += name + ": " + value + "\r\n";
+ const auto h = headers();
+ for (qsizetype i = 0; i < h.size(); ++i) {
+ const auto name = h.nameAt(i);
+ header += QByteArrayView(name.data(), name.size()) + ": " + h.valueAt(i) + "\r\n";
+ }
+
header += "\r\n";
headerCreated = true;
}
@@ -511,6 +514,48 @@ qint64 QHttpMultiPartIODevice::writeData(const char *data, qint64 maxSize)
return -1;
}
+#ifndef QT_NO_DEBUG_STREAM
+
+/*!
+ \fn QDebug QHttpPart::operator<<(QDebug debug, const QHttpPart &part)
+
+ Writes the \a part into the \a debug object for debugging purposes.
+ Unless a device is set, the size of the body is shown.
+
+ \sa {Debugging Techniques}
+ \since 6.8
+*/
+
+QDebug operator<<(QDebug debug, const QHttpPart &part)
+{
+ const QDebugStateSaver saver(debug);
+ debug.resetFormat().nospace().noquote();
+
+ debug << "QHttpPart(headers = ["
+ << part.d->cookedHeaders
+ << "], http headers = ["
+ << part.d->httpHeaders
+ << "],";
+
+ if (part.d->bodyDevice) {
+ debug << " bodydevice = ["
+ << part.d->bodyDevice
+ << ", is open: "
+ << part.d->bodyDevice->isOpen()
+ << "]";
+ } else {
+ debug << " size of body = "
+ << part.d->body.size()
+ << " bytes";
+ }
+
+ debug << ")";
+
+ return debug;
+}
+
+#endif // QT_NO_DEBUG_STREAM
+
QT_END_NAMESPACE
diff --git a/src/network/access/qhttpmultipart.h b/src/network/access/qhttpmultipart.h
index 26e5fafdf2..9732bbd99d 100644
--- a/src/network/access/qhttpmultipart.h
+++ b/src/network/access/qhttpmultipart.h
@@ -19,6 +19,7 @@ QT_BEGIN_NAMESPACE
class QHttpPartPrivate;
class QHttpMultiPart;
+class QDebug;
class Q_NETWORK_EXPORT QHttpPart
{
@@ -45,6 +46,9 @@ private:
QSharedDataPointer<QHttpPartPrivate> d;
friend class QHttpMultiPartIODevice;
+#ifndef QT_NO_DEBUG_STREAM
+ friend Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QHttpPart &httpPart);
+#endif
};
Q_DECLARE_SHARED(QHttpPart)
diff --git a/src/network/access/qhttpmultipart_p.h b/src/network/access/qhttpmultipart_p.h
index d485fcf5cd..7a12ce8424 100644
--- a/src/network/access/qhttpmultipart_p.h
+++ b/src/network/access/qhttpmultipart_p.h
@@ -18,6 +18,7 @@
#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "QtCore/qshareddata.h"
#include "qnetworkrequest_p.h" // for deriving QHttpPartPrivate from QNetworkHeadersPrivate
+#include "qhttpheadershelper_p.h"
#include "private/qobject_p.h"
#ifndef Q_OS_WASM
@@ -47,8 +48,10 @@ public:
inline bool operator==(const QHttpPartPrivate &other) const
{
- return rawHeaders == other.rawHeaders && body == other.body &&
- bodyDevice == other.bodyDevice && readPointer == other.readPointer;
+ return QHttpHeadersHelper::compareStrict(httpHeaders, other.httpHeaders)
+ && body == other.body
+ && bodyDevice == other.bodyDevice
+ && readPointer == other.readPointer;
}
void setBodyDevice(QIODevice *device) {
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 419491a711..3ef07c6993 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -52,10 +52,11 @@ static int getPreferredActiveChannelCount(QHttpNetworkConnection::ConnectionType
QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(
quint16 connectionCount, const QString &hostName, quint16 port, bool encrypt,
- QHttpNetworkConnection::ConnectionType type)
+ bool isLocalSocket, QHttpNetworkConnection::ConnectionType type)
: hostName(hostName),
port(port),
encrypt(encrypt),
+ isLocalSocket(isLocalSocket),
activeChannelCount(getPreferredActiveChannelCount(type, connectionCount)),
channelCount(connectionCount),
channels(new QHttpNetworkConnectionChannel[channelCount]),
@@ -64,6 +65,8 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(
#endif
connectionType(type)
{
+ if (isLocalSocket) // Don't try to do host lookup for local sockets
+ networkLayerState = IPv4;
// We allocate all 6 channels even if it's an HTTP/2-enabled
// connection: in case the protocol negotiation via NPN/ALPN fails,
// we will have normally working HTTP/1.1.
@@ -102,13 +105,18 @@ void QHttpNetworkConnectionPrivate::pauseConnection()
// Disable all socket notifiers
for (int i = 0; i < activeChannelCount; i++) {
- if (channels[i].socket) {
+ if (auto *absSocket = qobject_cast<QAbstractSocket *>(channels[i].socket)) {
#ifndef QT_NO_SSL
if (encrypt)
- QSslSocketPrivate::pauseSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
+ QSslSocketPrivate::pauseSocketNotifiers(static_cast<QSslSocket*>(absSocket));
else
#endif
- QAbstractSocketPrivate::pauseSocketNotifiers(channels[i].socket);
+ QAbstractSocketPrivate::pauseSocketNotifiers(absSocket);
+ } else if (qobject_cast<QLocalSocket *>(channels[i].socket)) {
+ // @todo how would we do this?
+#if 0 // @todo Enable this when there is a debug category for this
+ qDebug() << "Should pause socket but there is no way to do it for local sockets";
+#endif
}
}
}
@@ -118,17 +126,21 @@ void QHttpNetworkConnectionPrivate::resumeConnection()
state = RunningState;
// Enable all socket notifiers
for (int i = 0; i < activeChannelCount; i++) {
- if (channels[i].socket) {
+ if (auto *absSocket = qobject_cast<QAbstractSocket *>(channels[i].socket)) {
#ifndef QT_NO_SSL
if (encrypt)
- QSslSocketPrivate::resumeSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
+ QSslSocketPrivate::resumeSocketNotifiers(static_cast<QSslSocket*>(absSocket));
else
#endif
- QAbstractSocketPrivate::resumeSocketNotifiers(channels[i].socket);
+ QAbstractSocketPrivate::resumeSocketNotifiers(absSocket);
// Resume pending upload if needed
if (channels[i].state == QHttpNetworkConnectionChannel::WritingState)
QMetaObject::invokeMethod(&channels[i], "_q_uploadDataReadyRead", Qt::QueuedConnection);
+ } else if (qobject_cast<QLocalSocket *>(channels[i].socket)) {
+#if 0 // @todo Enable this when there is a debug category for this
+ qDebug() << "Should resume socket but there is no way to do it for local sockets";
+#endif
}
}
@@ -292,7 +304,12 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair)
request.setHeaderField("User-Agent", "Mozilla/5.0");
// set the host
value = request.headerField("host");
- if (value.isEmpty()) {
+ if (isLocalSocket && value.isEmpty()) {
+ // The local socket connections might have a full file path, and that
+ // may not be suitable for the Host header. But we can use whatever the
+ // user has set in the URL.
+ request.prependHeaderField("Host", request.url().host().toLocal8Bit());
+ } else if (value.isEmpty()) {
QHostAddress add;
QByteArray host;
if (add.setAddress(hostName)) {
@@ -524,7 +541,9 @@ QHttpNetworkConnectionPrivate::parseRedirectResponse(QHttpNetworkReply *reply)
// Check redirect url protocol
const QUrl priorUrl(reply->request().url());
- if (redirectUrl.scheme() == "http"_L1 || redirectUrl.scheme() == "https"_L1) {
+ const QString targetUrlScheme = redirectUrl.scheme();
+ if (targetUrlScheme == "http"_L1 || targetUrlScheme == "https"_L1
+ || targetUrlScheme.startsWith("unix"_L1)) {
switch (reply->request().redirectPolicy()) {
case QNetworkRequest::NoLessSafeRedirectPolicy:
// Here we could handle https->http redirects as InsecureProtocolError.
@@ -535,7 +554,7 @@ QHttpNetworkConnectionPrivate::parseRedirectResponse(QHttpNetworkReply *reply)
break;
case QNetworkRequest::SameOriginRedirectPolicy:
if (priorUrl.host() != redirectUrl.host()
- || priorUrl.scheme() != redirectUrl.scheme()
+ || priorUrl.scheme() != targetUrlScheme
|| priorUrl.port() != redirectUrl.port()) {
return {{}, QNetworkReply::InsecureRedirectError};
}
@@ -1024,7 +1043,7 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
for (int i = 0; i < activeChannelCount; ++i) {
if (channels[i].resendCurrent && (channels[i].state != QHttpNetworkConnectionChannel::ClosingState)) {
if (!channels[i].socket
- || channels[i].socket->state() == QAbstractSocket::UnconnectedState) {
+ || QSocketAbstraction::socketState(channels[i].socket) == QAbstractSocket::UnconnectedState) {
if (!channels[i].ensureConnection())
continue;
}
@@ -1048,7 +1067,9 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
// try to get a free AND connected socket
for (int i = 0; i < activeChannelCount; ++i) {
if (channels[i].socket) {
- if (!channels[i].reply && !channels[i].isSocketBusy() && channels[i].socket->state() == QAbstractSocket::ConnectedState) {
+ if (!channels[i].reply && !channels[i].isSocketBusy()
+ && QSocketAbstraction::socketState(channels[i].socket)
+ == QAbstractSocket::ConnectedState) {
if (dequeueRequest(channels[i].socket))
channels[i].sendRequest();
}
@@ -1068,7 +1089,8 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
else if (networkLayerState == IPv6)
channels[0].networkLayerPreference = QAbstractSocket::IPv6Protocol;
channels[0].ensureConnection();
- if (channels[0].socket && channels[0].socket->state() == QAbstractSocket::ConnectedState
+ if (auto *s = channels[0].socket; s
+ && QSocketAbstraction::socketState(s) == QAbstractSocket::ConnectedState
&& !channels[0].pendingEncrypt) {
if (channels[0].h2RequestsToSend.size()) {
channels[0].sendRequest();
@@ -1095,9 +1117,13 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
// return fast if there is nothing to pipeline
if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
return;
- for (int i = 0; i < activeChannelCount; i++)
- if (channels[i].socket && channels[i].socket->state() == QAbstractSocket::ConnectedState)
+ for (int i = 0; i < activeChannelCount; i++) {
+ if (channels[i].socket
+ && QSocketAbstraction::socketState(channels[i].socket)
+ == QAbstractSocket::ConnectedState) {
fillPipeline(channels[i].socket);
+ }
+ }
// If there is not already any connected channels we need to connect a new one.
// We do not pair the channel with the request until we know if it is
@@ -1122,15 +1148,16 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
if (!channels[i].socket)
continue;
- if ((channels[i].socket->state() == QAbstractSocket::ConnectingState)
- || (channels[i].socket->state() == QAbstractSocket::HostLookupState)
+ using State = QAbstractSocket::SocketState;
+ if ((QSocketAbstraction::socketState(channels[i].socket) == State::ConnectingState)
+ || (QSocketAbstraction::socketState(channels[i].socket) == State::HostLookupState)
|| channels[i].pendingEncrypt) { // pendingEncrypt == "EncryptingState"
neededOpenChannels--;
continue;
}
if (!channels[i].reply && !channels[i].isSocketBusy()
- && (channels[i].socket->state() == QAbstractSocket::UnconnectedState)) {
+ && (QSocketAbstraction::socketState(channels[i].socket) == State::UnconnectedState)) {
channelsToConnect.push_back(i);
neededOpenChannels--;
}
@@ -1329,9 +1356,9 @@ void QHttpNetworkConnectionPrivate::_q_connectDelayedChannel()
}
QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount, const QString &hostName,
- quint16 port, bool encrypt, QObject *parent,
+ quint16 port, bool encrypt, bool isLocalSocket, QObject *parent,
QHttpNetworkConnection::ConnectionType connectionType)
- : QObject(*(new QHttpNetworkConnectionPrivate(connectionCount, hostName, port, encrypt,
+ : QObject(*(new QHttpNetworkConnectionPrivate(connectionCount, hostName, port, encrypt, isLocalSocket,
connectionType)), parent)
{
Q_D(QHttpNetworkConnection);
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index c2d062fb16..5e4bce5eb0 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -64,7 +64,8 @@ public:
};
QHttpNetworkConnection(quint16 channelCount, const QString &hostName, quint16 port = 80,
- bool encrypt = false, QObject *parent = nullptr,
+ bool encrypt = false, bool isLocalSocket = false,
+ QObject *parent = nullptr,
ConnectionType connectionType = ConnectionTypeHTTP);
~QHttpNetworkConnection();
@@ -155,7 +156,8 @@ public:
};
QHttpNetworkConnectionPrivate(quint16 connectionCount, const QString &hostName, quint16 port,
- bool encrypt, QHttpNetworkConnection::ConnectionType type);
+ bool encrypt, bool isLocalSocket,
+ QHttpNetworkConnection::ConnectionType type);
~QHttpNetworkConnectionPrivate();
void init();
@@ -205,6 +207,7 @@ public:
QString hostName;
quint16 port;
bool encrypt;
+ bool isLocalSocket;
bool delayIpv4 = true;
// Number of channels we are trying to use at the moment:
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 71b880f6f8..8688e4b8d7 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -12,6 +12,7 @@
#include <private/qhttp2protocolhandler_p.h>
#include <private/qhttpprotocolhandler_p.h>
#include <private/http2protocol_p.h>
+#include <private/qsocketabstraction_p.h>
#ifndef QT_NO_SSL
# include <private/qsslsocket_p.h>
@@ -78,6 +79,8 @@ void QHttpNetworkConnectionChannel::init()
#ifndef QT_NO_SSL
if (connection->d_func()->encrypt)
socket = new QSslSocket;
+ else if (connection->d_func()->isLocalSocket)
+ socket = new QLocalSocket;
else
socket = new QTcpSocket;
#else
@@ -85,7 +88,8 @@ void QHttpNetworkConnectionChannel::init()
#endif
#ifndef QT_NO_NETWORKPROXY
// Set by QNAM anyway, but let's be safe here
- socket->setProxy(QNetworkProxy::NoProxy);
+ if (auto s = qobject_cast<QAbstractSocket *>(socket))
+ s->setProxy(QNetworkProxy::NoProxy);
#endif
// After some back and forth in all the last years, this is now a DirectConnection because otherwise
@@ -94,32 +98,48 @@ void QHttpNetworkConnectionChannel::init()
QObject::connect(socket, &QIODevice::bytesWritten,
this, &QHttpNetworkConnectionChannel::_q_bytesWritten,
Qt::DirectConnection);
- QObject::connect(socket, &QAbstractSocket::connected,
- this, &QHttpNetworkConnectionChannel::_q_connected,
- Qt::DirectConnection);
QObject::connect(socket, &QIODevice::readyRead,
this, &QHttpNetworkConnectionChannel::_q_readyRead,
Qt::DirectConnection);
- // The disconnected() and error() signals may already come
- // while calling connectToHost().
- // In case of a cached hostname or an IP this
- // will then emit a signal to the user of QNetworkReply
- // but cannot be caught because the user did not have a chance yet
- // to connect to QNetworkReply's signals.
- qRegisterMetaType<QAbstractSocket::SocketError>();
- QObject::connect(socket, &QAbstractSocket::disconnected,
- this, &QHttpNetworkConnectionChannel::_q_disconnected,
- Qt::DirectConnection);
- QObject::connect(socket, &QAbstractSocket::errorOccurred,
- this, &QHttpNetworkConnectionChannel::_q_error,
- Qt::DirectConnection);
+
+ QSocketAbstraction::visit([this](auto *socket){
+ using SocketType = std::remove_pointer_t<decltype(socket)>;
+ QObject::connect(socket, &SocketType::connected,
+ this, &QHttpNetworkConnectionChannel::_q_connected,
+ Qt::DirectConnection);
+
+ // The disconnected() and error() signals may already come
+ // while calling connectToHost().
+ // In case of a cached hostname or an IP this
+ // will then emit a signal to the user of QNetworkReply
+ // but cannot be caught because the user did not have a chance yet
+ // to connect to QNetworkReply's signals.
+ QObject::connect(socket, &SocketType::disconnected,
+ this, &QHttpNetworkConnectionChannel::_q_disconnected,
+ Qt::DirectConnection);
+ if constexpr (std::is_same_v<SocketType, QAbstractSocket>) {
+ QObject::connect(socket, &QAbstractSocket::errorOccurred,
+ this, &QHttpNetworkConnectionChannel::_q_error,
+ Qt::DirectConnection);
+ } else if constexpr (std::is_same_v<SocketType, QLocalSocket>) {
+ auto convertAndForward = [this](QLocalSocket::LocalSocketError error) {
+ _q_error(static_cast<QAbstractSocket::SocketError>(error));
+ };
+ QObject::connect(socket, &SocketType::errorOccurred,
+ this, std::move(convertAndForward),
+ Qt::DirectConnection);
+ }
+ }, socket);
+
#ifndef QT_NO_NETWORKPROXY
- QObject::connect(socket, &QAbstractSocket::proxyAuthenticationRequired,
- this, &QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired,
- Qt::DirectConnection);
+ if (auto *s = qobject_cast<QAbstractSocket *>(socket)) {
+ QObject::connect(s, &QAbstractSocket::proxyAuthenticationRequired,
+ this, &QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired,
+ Qt::DirectConnection);
+ }
#endif
#ifndef QT_NO_SSL
@@ -156,8 +176,10 @@ void QHttpNetworkConnectionChannel::init()
#endif
#ifndef QT_NO_NETWORKPROXY
- if (proxy.type() != QNetworkProxy::NoProxy)
- socket->setProxy(proxy);
+ if (auto *s = qobject_cast<QAbstractSocket *>(socket);
+ s && proxy.type() != QNetworkProxy::NoProxy) {
+ s->setProxy(proxy);
+ }
#endif
isInitialized = true;
}
@@ -170,7 +192,7 @@ void QHttpNetworkConnectionChannel::close()
if (!socket)
state = QHttpNetworkConnectionChannel::IdleState;
- else if (socket->state() == QAbstractSocket::UnconnectedState)
+ else if (QSocketAbstraction::socketState(socket) == QAbstractSocket::UnconnectedState)
state = QHttpNetworkConnectionChannel::IdleState;
else
state = QHttpNetworkConnectionChannel::ClosingState;
@@ -190,7 +212,7 @@ void QHttpNetworkConnectionChannel::abort()
{
if (!socket)
state = QHttpNetworkConnectionChannel::IdleState;
- else if (socket->state() == QAbstractSocket::UnconnectedState)
+ else if (QSocketAbstraction::socketState(socket) == QAbstractSocket::UnconnectedState)
state = QHttpNetworkConnectionChannel::IdleState;
else
state = QHttpNetworkConnectionChannel::ClosingState;
@@ -201,7 +223,10 @@ void QHttpNetworkConnectionChannel::abort()
if (socket) {
// socket can be 0 since the host lookup is done from qhttpnetworkconnection.cpp while
// there is no socket yet.
- socket->abort();
+ auto callAbort = [](auto *s) {
+ s->abort();
+ };
+ QSocketAbstraction::visit(callAbort, socket);
}
}
@@ -268,7 +293,7 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
if (!isInitialized)
init();
- QAbstractSocket::SocketState socketState = socket->state();
+ QAbstractSocket::SocketState socketState = QSocketAbstraction::socketState(socket);
// resend this request after we receive the disconnected signal
// If !socket->isOpen() then we have already called close() on the socket, but there was still a
@@ -335,7 +360,8 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
connectHost = connection->d_func()->networkProxy.hostName();
connectPort = connection->d_func()->networkProxy.port();
}
- if (socket->proxy().type() == QNetworkProxy::HttpProxy) {
+ if (auto *abSocket = qobject_cast<QAbstractSocket *>(socket);
+ abSocket && abSocket->proxy().type() == QNetworkProxy::HttpProxy) {
// Make user-agent field available to HTTP proxy socket engine (QTBUG-17223)
QByteArray value;
// ensureConnection is called before any request has been assigned, but can also be
@@ -353,9 +379,11 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
value = request.headerField("user-agent");
}
if (!value.isEmpty()) {
- QNetworkProxy proxy(socket->proxy());
- proxy.setRawHeader("User-Agent", value); //detaches
- socket->setProxy(proxy);
+ QNetworkProxy proxy(abSocket->proxy());
+ auto h = proxy.headers();
+ h.replaceOrAppend(QHttpHeaders::WellKnownHeader::UserAgent, value);
+ proxy.setHeaders(std::move(h));
+ abSocket->setProxy(proxy);
}
}
#endif
@@ -378,7 +406,7 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
// limit the socket read buffer size. we will read everything into
// the QHttpNetworkReply anyway, so let's grow only that and not
// here and there.
- socket->setReadBufferSize(64*1024);
+ sslSocket->setReadBufferSize(64*1024);
#else
// Need to dequeue the request so that we can emit the error.
if (!reply)
@@ -392,17 +420,24 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
&& connection->cacheProxy().type() == QNetworkProxy::NoProxy
&& connection->transparentProxy().type() == QNetworkProxy::NoProxy) {
#endif
- socket->connectToHost(connectHost, connectPort, QIODevice::ReadWrite | QIODevice::Unbuffered, networkLayerPreference);
- // For an Unbuffered QTcpSocket, the read buffer size has a special meaning.
- socket->setReadBufferSize(1*1024);
+ if (auto *s = qobject_cast<QAbstractSocket *>(socket)) {
+ s->connectToHost(connectHost, connectPort,
+ QIODevice::ReadWrite | QIODevice::Unbuffered,
+ networkLayerPreference);
+ // For an Unbuffered QTcpSocket, the read buffer size has a special meaning.
+ s->setReadBufferSize(1 * 1024);
+ } else if (auto *s = qobject_cast<QLocalSocket *>(socket)) {
+ s->connectToServer(connectHost);
+ }
#ifndef QT_NO_NETWORKPROXY
} else {
- socket->connectToHost(connectHost, connectPort, QIODevice::ReadWrite, networkLayerPreference);
-
+ auto *s = qobject_cast<QAbstractSocket *>(socket);
+ Q_ASSERT(s);
// limit the socket read buffer size. we will read everything into
// the QHttpNetworkReply anyway, so let's grow only that and not
// here and there.
- socket->setReadBufferSize(64*1024);
+ s->connectToHost(connectHost, connectPort, QIODevice::ReadWrite, networkLayerPreference);
+ s->setReadBufferSize(64 * 1024);
}
#endif
}
@@ -505,7 +540,7 @@ void QHttpNetworkConnectionChannel::allDone()
// move next from pipeline to current request
if (!alreadyPipelinedRequests.isEmpty()) {
- if (resendCurrent || connectionCloseEnabled || socket->state() != QAbstractSocket::ConnectedState) {
+ if (resendCurrent || connectionCloseEnabled || QSocketAbstraction::socketState(socket) != QAbstractSocket::ConnectedState) {
// move the pipelined ones back to the main queue
requeueCurrentlyPipelinedRequests();
close();
@@ -536,7 +571,7 @@ void QHttpNetworkConnectionChannel::allDone()
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
} else if (alreadyPipelinedRequests.isEmpty()) {
if (connectionCloseEnabled)
- if (socket->state() != QAbstractSocket::UnconnectedState)
+ if (QSocketAbstraction::socketState(socket) != QAbstractSocket::UnconnectedState)
close();
if (qobject_cast<QHttpNetworkConnection*>(connection))
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
@@ -554,7 +589,7 @@ void QHttpNetworkConnectionChannel::detectPipeliningSupport()
// check for not having connection close
&& (!reply->d_func()->isConnectionCloseEnabled())
// check if it is still connected
- && (socket->state() == QAbstractSocket::ConnectedState)
+ && (QSocketAbstraction::socketState(socket) == QAbstractSocket::ConnectedState)
// check for broken servers in server reply header
// this is adapted from http://mxr.mozilla.org/firefox/ident?i=SupportsPipelining
&& (serverHeaderField = reply->headerField("Server"), !serverHeaderField.contains("Microsoft-IIS/4."))
@@ -677,8 +712,8 @@ bool QHttpNetworkConnectionChannel::resetUploadData()
void QHttpNetworkConnectionChannel::setProxy(const QNetworkProxy &networkProxy)
{
- if (socket)
- socket->setProxy(networkProxy);
+ if (auto *s = qobject_cast<QAbstractSocket *>(socket))
+ s->setProxy(networkProxy);
proxy = networkProxy;
}
@@ -839,7 +874,7 @@ void QHttpNetworkConnectionChannel::_q_disconnected()
}
-void QHttpNetworkConnectionChannel::_q_connected()
+void QHttpNetworkConnectionChannel::_q_connected_abstract_socket(QAbstractSocket *absSocket)
{
// For the Happy Eyeballs we need to check if this is the first channel to connect.
if (connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::HostLookupPending || connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv4or6) {
@@ -850,7 +885,7 @@ void QHttpNetworkConnectionChannel::_q_connected()
else if (networkLayerPreference == QAbstractSocket::IPv6Protocol)
connection->d_func()->networkLayerState = QHttpNetworkConnectionPrivate::IPv6;
else {
- if (socket->peerAddress().protocol() == QAbstractSocket::IPv4Protocol)
+ if (absSocket->peerAddress().protocol() == QAbstractSocket::IPv4Protocol)
connection->d_func()->networkLayerState = QHttpNetworkConnectionPrivate::IPv4;
else
connection->d_func()->networkLayerState = QHttpNetworkConnectionPrivate::IPv6;
@@ -873,7 +908,7 @@ void QHttpNetworkConnectionChannel::_q_connected()
}
// improve performance since we get the request sent by the kernel ASAP
- //socket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
+ //absSocket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
// We have this commented out now. It did not have the effect we wanted. If we want to
// do this properly, Qt has to combine multiple HTTP requests into one buffer
// and send this to the kernel in one syscall and then the kernel immediately sends
@@ -882,7 +917,7 @@ void QHttpNetworkConnectionChannel::_q_connected()
// the requests into one TCP packet.
// not sure yet if it helps, but it makes sense
- socket->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
+ absSocket->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningSupportUnknown;
@@ -891,7 +926,7 @@ void QHttpNetworkConnectionChannel::_q_connected()
if (!connectionPrivate->connectionMonitor.isMonitoring()) {
// Now that we have a pair of addresses, we can start monitoring the
// connection status to handle its loss properly.
- if (connectionPrivate->connectionMonitor.setTargets(socket->localAddress(), socket->peerAddress()))
+ if (connectionPrivate->connectionMonitor.setTargets(absSocket->localAddress(), absSocket->peerAddress()))
connectionPrivate->connectionMonitor.startMonitoring();
}
}
@@ -903,7 +938,7 @@ void QHttpNetworkConnectionChannel::_q_connected()
if (!connection->sslContext()) {
// this socket is making the 1st handshake for this connection,
// we need to set the SSL context so new sockets can reuse it
- if (auto socketSslContext = QSslSocketPrivate::sslContext(static_cast<QSslSocket*>(socket)))
+ if (auto socketSslContext = QSslSocketPrivate::sslContext(static_cast<QSslSocket*>(absSocket)))
connection->setSslContext(std::move(socketSslContext));
}
#endif
@@ -925,7 +960,7 @@ void QHttpNetworkConnectionChannel::_q_connected()
switchedToHttp2 = false;
if (!reply)
- connection->d_func()->dequeueRequest(socket);
+ connection->d_func()->dequeueRequest(absSocket);
if (reply) {
if (tryProtocolUpgrade) {
@@ -938,6 +973,22 @@ void QHttpNetworkConnectionChannel::_q_connected()
}
}
+void QHttpNetworkConnectionChannel::_q_connected_local_socket(QLocalSocket *localSocket)
+{
+ state = QHttpNetworkConnectionChannel::IdleState;
+ if (!reply) // No reply object, try to dequeue a request (which is paired with a reply):
+ connection->d_func()->dequeueRequest(localSocket);
+ if (reply)
+ sendRequest();
+}
+
+void QHttpNetworkConnectionChannel::_q_connected()
+{
+ if (auto *s = qobject_cast<QAbstractSocket *>(socket))
+ _q_connected_abstract_socket(s);
+ else if (auto *s = qobject_cast<QLocalSocket *>(socket))
+ _q_connected_local_socket(s);
+}
void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socketError)
{
@@ -1114,7 +1165,7 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
//signal emission triggered event loop
if (!socket)
state = QHttpNetworkConnectionChannel::IdleState;
- else if (socket->state() == QAbstractSocket::UnconnectedState)
+ else if (QSocketAbstraction::socketState(socket) == QAbstractSocket::UnconnectedState)
state = QHttpNetworkConnectionChannel::IdleState;
else
state = QHttpNetworkConnectionChannel::ClosingState;
diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h
index c42290feca..853b647ecc 100644
--- a/src/network/access/qhttpnetworkconnectionchannel_p.h
+++ b/src/network/access/qhttpnetworkconnectionchannel_p.h
@@ -19,6 +19,7 @@
#include <QtNetwork/qnetworkrequest.h>
#include <QtNetwork/qnetworkreply.h>
#include <QtNetwork/qabstractsocket.h>
+#include <QtNetwork/qlocalsocket.h>
#include <private/qobject_p.h>
#include <qauthenticator.h>
@@ -71,7 +72,7 @@ public:
ClosingState = 16,
BusyState = (ConnectingState|WritingState|WaitingState|ReadingState|ClosingState)
};
- QAbstractSocket *socket;
+ QIODevice *socket;
bool ssl;
bool isInitialized;
ChannelState state;
@@ -156,6 +157,8 @@ public:
void _q_bytesWritten(qint64 bytes); // proceed sending
void _q_readyRead(); // pending data to read
void _q_disconnected(); // disconnected from host
+ void _q_connected_abstract_socket(QAbstractSocket *socket);
+ void _q_connected_local_socket(QLocalSocket *socket);
void _q_connected(); // start sending request
void _q_error(QAbstractSocket::SocketError); // error from socket
#ifndef QT_NO_NETWORKPROXY
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index 7a4ffb1684..06cc0b4464 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -381,5 +381,15 @@ void QHttpNetworkRequest::setPeerVerifyName(const QString &peerName)
d->peerVerifyName = peerName;
}
+QString QHttpNetworkRequest::fullLocalServerName() const
+{
+ return d->fullLocalServerName;
+}
+
+void QHttpNetworkRequest::setFullLocalServerName(const QString &fullServerName)
+{
+ d->fullLocalServerName = fullServerName;
+}
+
QT_END_NAMESPACE
diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h
index 131885f6d2..4444020402 100644
--- a/src/network/access/qhttpnetworkrequest_p.h
+++ b/src/network/access/qhttpnetworkrequest_p.h
@@ -117,6 +117,9 @@ public:
QString peerVerifyName() const;
void setPeerVerifyName(const QString &peerName);
+ QString fullLocalServerName() const;
+ void setFullLocalServerName(const QString &fullServerName);
+
private:
QSharedDataPointer<QHttpNetworkRequestPrivate> d;
friend class QHttpNetworkRequestPrivate;
@@ -140,6 +143,7 @@ public:
QHttpNetworkRequest::Operation operation;
QByteArray customVerb;
+ QString fullLocalServerName; // for local sockets
QHttpNetworkRequest::Priority priority;
mutable QNonContiguousByteDevice* uploadByteDevice;
bool autoDecompress;
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index b0ae0dcf44..4e5cf05aef 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -95,7 +95,9 @@ static QByteArray makeCacheKey(QUrl &url, QNetworkProxy *proxy, const QString &p
QUrl copy = url;
QString scheme = copy.scheme();
bool isEncrypted = scheme == "https"_L1 || scheme == "preconnect-https"_L1;
- copy.setPort(copy.port(isEncrypted ? 443 : 80));
+ const bool isLocalSocket = scheme.startsWith("unix"_L1);
+ if (!isLocalSocket)
+ copy.setPort(copy.port(isEncrypted ? 443 : 80));
if (scheme == "preconnect-http"_L1)
copy.setScheme("http"_L1);
else if (scheme == "preconnect-https"_L1)
@@ -145,9 +147,9 @@ class QNetworkAccessCachedHttpConnection: public QHttpNetworkConnection,
{
// Q_OBJECT
public:
- QNetworkAccessCachedHttpConnection(quint16 connectionCount, const QString &hostName, quint16 port, bool encrypt,
+ QNetworkAccessCachedHttpConnection(quint16 connectionCount, const QString &hostName, quint16 port, bool encrypt, bool isLocalSocket,
QHttpNetworkConnection::ConnectionType connectionType)
- : QHttpNetworkConnection(connectionCount, hostName, port, encrypt, /*parent=*/nullptr, connectionType)
+ : QHttpNetworkConnection(connectionCount, hostName, port, encrypt, isLocalSocket, /*parent=*/nullptr, connectionType)
{
setExpires(true);
setShareable(true);
@@ -244,7 +246,9 @@ void QHttpThreadDelegate::startRequest()
// check if we have an open connection to this host
QUrl urlCopy = httpRequest.url();
- urlCopy.setPort(urlCopy.port(ssl ? 443 : 80));
+ const bool isLocalSocket = urlCopy.scheme().startsWith("unix"_L1);
+ if (!isLocalSocket)
+ urlCopy.setPort(urlCopy.port(ssl ? 443 : 80));
QHttpNetworkConnection::ConnectionType connectionType
= httpRequest.isHTTP2Allowed() ? QHttpNetworkConnection::ConnectionTypeHTTP2
@@ -279,10 +283,19 @@ void QHttpThreadDelegate::startRequest()
} else
#endif // QT_CONFIG(ssl)
{
- urlCopy.setScheme(QStringLiteral("h2"));
+ if (isLocalSocket)
+ urlCopy.setScheme(QStringLiteral("unix+h2"));
+ else
+ urlCopy.setScheme(QStringLiteral("h2"));
}
}
+ QString extraData = httpRequest.peerVerifyName();
+ if (isLocalSocket) {
+ if (QString path = httpRequest.fullLocalServerName(); !path.isEmpty())
+ extraData = path;
+ }
+
#ifndef QT_NO_NETWORKPROXY
if (transparentProxy.type() != QNetworkProxy::NoProxy)
cacheKey = makeCacheKey(urlCopy, &transparentProxy, httpRequest.peerVerifyName());
@@ -295,10 +308,19 @@ void QHttpThreadDelegate::startRequest()
// the http object is actually a QHttpNetworkConnection
httpConnection = static_cast<QNetworkAccessCachedHttpConnection *>(connections.localData()->requestEntryNow(cacheKey));
if (!httpConnection) {
+
+ QString host = urlCopy.host();
+ // Update the host if a unix socket path or named pipe is used:
+ if (isLocalSocket) {
+ if (QString path = httpRequest.fullLocalServerName(); !path.isEmpty())
+ host = path;
+ }
+
// no entry in cache; create an object
// the http object is actually a QHttpNetworkConnection
- httpConnection = new QNetworkAccessCachedHttpConnection(http1Parameters.numberOfConnectionsPerHost(), urlCopy.host(), urlCopy.port(), ssl,
- connectionType);
+ httpConnection = new QNetworkAccessCachedHttpConnection(
+ http1Parameters.numberOfConnectionsPerHost(), host, urlCopy.port(), ssl,
+ isLocalSocket, connectionType);
if (connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2
|| connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
httpConnection->setHttp2Parameters(http2Parameters);
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp
index 5dbcef4bbe..3c7fee567d 100644
--- a/src/network/access/qnetworkaccessbackend.cpp
+++ b/src/network/access/qnetworkaccessbackend.cpp
@@ -568,6 +568,43 @@ void QNetworkAccessBackend::setRawHeader(const QByteArray &header, const QByteAr
}
/*!
+ \since 6.8
+
+ Returns headers that are set in this QNetworkAccessBackend instance.
+
+ \sa setHeaders()
+*/
+QHttpHeaders QNetworkAccessBackend::headers() const
+{
+ return d_func()->m_reply->headers();
+}
+
+/*!
+ \since 6.8
+
+ Sets \a newHeaders as headers, overriding any previously set headers.
+
+ These headers are accessible on the QNetworkReply instance which was
+ returned when calling one of the appropriate functions on
+ QNetworkAccessManager.
+
+ \sa headers()
+*/
+void QNetworkAccessBackend::setHeaders(QHttpHeaders &&newHeaders)
+{
+ d_func()->m_reply->setHeaders(std::move(newHeaders));
+}
+
+/*!
+ \overload
+ \since 6.8
+*/
+void QNetworkAccessBackend::setHeaders(const QHttpHeaders &newHeaders)
+{
+ d_func()->m_reply->setHeaders(newHeaders);
+}
+
+/*!
Returns the operation which was requested when calling
QNetworkAccessManager.
*/
diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h
index 799ae3faad..4f8d7e4372 100644
--- a/src/network/access/qnetworkaccessbackend_p.h
+++ b/src/network/access/qnetworkaccessbackend_p.h
@@ -104,6 +104,9 @@ public:
void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value);
QByteArray rawHeader(const QByteArray &header) const;
void setRawHeader(const QByteArray &header, const QByteArray &value);
+ QHttpHeaders headers() const;
+ void setHeaders(const QHttpHeaders &newHeaders);
+ void setHeaders(QHttpHeaders &&newHeaders);
QNetworkAccessManager::Operation operation() const;
bool isCachingEnabled() const;
diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp
index fd8174c143..ead5fe2ef5 100644
--- a/src/network/access/qnetworkaccesscachebackend.cpp
+++ b/src/network/access/qnetworkaccesscachebackend.cpp
@@ -47,21 +47,21 @@ bool QNetworkAccessCacheBackend::sendCacheContents()
return false;
QNetworkCacheMetaData::AttributesMap attributes = item.attributes();
- setAttribute(QNetworkRequest::HttpStatusCodeAttribute, attributes.value(QNetworkRequest::HttpStatusCodeAttribute));
- setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, attributes.value(QNetworkRequest::HttpReasonPhraseAttribute));
-
- // set the raw headers
- const QNetworkCacheMetaData::RawHeaderList rawHeaders = item.rawHeaders();
- for (const auto &header : rawHeaders) {
- if (header.first.compare("cache-control", Qt::CaseInsensitive) == 0) {
- const QLatin1StringView cacheControlValue(header.second);
- if (cacheControlValue.contains("must-revalidate"_L1, Qt::CaseInsensitive)
- || cacheControlValue.contains("no-cache"_L1, Qt::CaseInsensitive)) {
- return false;
- }
- }
- setRawHeader(header.first, header.second);
+ setAttribute(QNetworkRequest::HttpStatusCodeAttribute,
+ attributes.value(QNetworkRequest::HttpStatusCodeAttribute));
+ setAttribute(QNetworkRequest::HttpReasonPhraseAttribute,
+ attributes.value(QNetworkRequest::HttpReasonPhraseAttribute));
+
+ // set the headers
+ auto headers = item.headers();
+ const auto cacheControlValue = QLatin1StringView(
+ headers.value(QHttpHeaders::WellKnownHeader::CacheControl));
+ // RFC 9111 Section 5.2 Cache Control
+ if (cacheControlValue.contains("must-revalidate"_L1, Qt::CaseInsensitive)
+ || cacheControlValue.contains("no-cache"_L1, Qt::CaseInsensitive)) {
+ return false;
}
+ setHeaders(std::move(headers));
// handle a possible redirect
QVariant redirectionTarget = attributes.value(QNetworkRequest::RedirectionTargetAttribute);
diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp
index 4b12f9fe31..e0a89e3646 100644
--- a/src/network/access/qnetworkaccessdebugpipebackend.cpp
+++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp
@@ -97,7 +97,9 @@ qint64 QNetworkAccessDebugPipeBackend::read(char *data, qint64 maxlen)
if (haveRead == -1) {
hasDownloadFinished = true;
// this ensures a good last downloadProgress is emitted
- setHeader(QNetworkRequest::ContentLengthHeader, QVariant());
+ auto h = headers();
+ h.removeAll(QHttpHeaders::WellKnownHeader::ContentLength);
+ setHeaders(std::move(h));
possiblyFinish();
return haveRead;
}
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 4e13c9924b..ae99721758 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -1220,6 +1220,13 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
bool isLocalFile = req.url().isLocalFile();
QString scheme = req.url().scheme();
+ // Remap local+http to unix+http to make further processing easier
+ if (scheme == "local+http"_L1) {
+ scheme = u"unix+http"_s;
+ QUrl url = req.url();
+ url.setScheme(scheme);
+ req.setUrl(url);
+ }
// fast path for GET on file:// URLs
// The QNetworkAccessFileBackend will right now only be used for PUT
@@ -1255,12 +1262,14 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
}
}
QNetworkRequest request = req;
+ auto h = request.headers();
#ifndef Q_OS_WASM // Content-length header is not allowed to be set by user in wasm
- if (!request.header(QNetworkRequest::ContentLengthHeader).isValid() &&
+ if (!h.contains(QHttpHeaders::WellKnownHeader::ContentLength) &&
outgoingData && !outgoingData->isSequential()) {
// request has no Content-Length
// but the data that is outgoing is random-access
- request.setHeader(QNetworkRequest::ContentLengthHeader, outgoingData->size());
+ h.append(QHttpHeaders::WellKnownHeader::ContentLength,
+ QByteArray::number(outgoingData->size()));
}
#endif
if (static_cast<QNetworkRequest::LoadControl>
@@ -1269,9 +1278,11 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
if (d->cookieJar) {
QList<QNetworkCookie> cookies = d->cookieJar->cookiesForUrl(request.url());
if (!cookies.isEmpty())
- request.setHeader(QNetworkRequest::CookieHeader, QVariant::fromValue(cookies));
+ h.replaceOrAppend(QHttpHeaders::WellKnownHeader::Cookie,
+ QNetworkHeadersPrivate::fromCookieList(cookies));
}
}
+ request.setHeaders(std::move(h));
#ifdef Q_OS_WASM
Q_UNUSED(isLocalFile);
// Support http, https, and relative urls
@@ -1292,11 +1303,15 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
u"https",
u"preconnect-https",
#endif
+ u"unix+http",
};
// Since Qt 5 we use the new QNetworkReplyHttpImpl
if (std::find(std::begin(httpSchemes), std::end(httpSchemes), scheme) != std::end(httpSchemes)) {
+
#ifndef QT_NO_SSL
- if (isStrictTransportSecurityEnabled() && d->stsCache.isKnownHost(request.url())) {
+ const bool isLocalSocket = scheme.startsWith("unix"_L1);
+ if (!isLocalSocket && isStrictTransportSecurityEnabled()
+ && d->stsCache.isKnownHost(request.url())) {
QUrl stsUrl(request.url());
// RFC6797, 8.3:
// The UA MUST replace the URI scheme with "https" [RFC2818],
@@ -1387,6 +1402,8 @@ QStringList QNetworkAccessManager::supportedSchemesImplementation() const
// Those ones don't exist in backends
#if QT_CONFIG(http)
schemes << QStringLiteral("http");
+ schemes << QStringLiteral("unix+http");
+ schemes << QStringLiteral("local+http");
#ifndef QT_NO_SSL
if (QSslSocket::supportsSsl())
schemes << QStringLiteral("https");
@@ -1746,9 +1763,10 @@ QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkReq
{
// copy the request, we probably need to add some headers
QNetworkRequest newRequest(request);
+ auto h = newRequest.headers();
// add Content-Type header if not there already
- if (!request.header(QNetworkRequest::ContentTypeHeader).isValid()) {
+ if (!h.contains(QHttpHeaders::WellKnownHeader::ContentType)) {
QByteArray contentType;
contentType.reserve(34 + multiPart->d_func()->boundary.size());
contentType += "multipart/";
@@ -1768,14 +1786,15 @@ QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkReq
}
// putting the boundary into quotes, recommended in RFC 2046 section 5.1.1
contentType += "; boundary=\"" + multiPart->d_func()->boundary + '"';
- newRequest.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(contentType));
+ h.append(QHttpHeaders::WellKnownHeader::ContentType, contentType);
}
// add MIME-Version header if not there already (we must include the header
// if the message conforms to RFC 2045, see section 4 of that RFC)
- auto mimeHeader = "MIME-Version"_ba;
- if (!request.hasRawHeader(mimeHeader))
- newRequest.setRawHeader(mimeHeader, "1.0"_ba);
+ if (!h.contains(QHttpHeaders::WellKnownHeader::MIMEVersion))
+ h.append(QHttpHeaders::WellKnownHeader::MIMEVersion, "1.0"_ba);
+
+ newRequest.setHeaders(std::move(h));
QIODevice *device = multiPart->d_func()->device;
if (!device->isReadable()) {
diff --git a/src/network/access/qnetworkfile.cpp b/src/network/access/qnetworkfile.cpp
index bfedf044de..fb9ce8232d 100644
--- a/src/network/access/qnetworkfile.cpp
+++ b/src/network/access/qnetworkfile.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qnetworkfile_p.h"
+#include "qnetworkrequest_p.h"
#include <QtCore/QDebug>
#include <QNetworkReply>
@@ -31,8 +32,10 @@ void QNetworkFile::open()
"Cannot open %1: Path is a directory").arg(fileName());
emit error(QNetworkReply::ContentOperationNotPermittedError, msg);
} else {
- emit headerRead(QNetworkRequest::LastModifiedHeader, QVariant::fromValue(fi.lastModified()));
- emit headerRead(QNetworkRequest::ContentLengthHeader, QVariant::fromValue(fi.size()));
+ emit headerRead(QHttpHeaders::WellKnownHeader::LastModified,
+ QNetworkHeadersPrivate::toHttpDate(fi.lastModified()));
+ emit headerRead(QHttpHeaders::WellKnownHeader::ContentLength,
+ QByteArray::number(fi.size()));
opened = QFile::open(QIODevice::ReadOnly | QIODevice::Unbuffered);
if (!opened) {
QString msg = QCoreApplication::translate("QNetworkAccessFileBackend",
diff --git a/src/network/access/qnetworkfile_p.h b/src/network/access/qnetworkfile_p.h
index df772251b4..9dcb63711e 100644
--- a/src/network/access/qnetworkfile_p.h
+++ b/src/network/access/qnetworkfile_p.h
@@ -35,7 +35,7 @@ public Q_SLOTS:
Q_SIGNALS:
void finished(bool ok);
- void headerRead(QNetworkRequest::KnownHeaders header, const QVariant &value);
+ void headerRead(QHttpHeaders::WellKnownHeader, const QByteArray &value);
void error(QNetworkReply::NetworkError error, const QString &message);
};
diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp
index 0613a65c34..3301ae85d2 100644
--- a/src/network/access/qnetworkreply.cpp
+++ b/src/network/access/qnetworkreply.cpp
@@ -617,7 +617,7 @@ QVariant QNetworkReply::header(QNetworkRequest::KnownHeaders header) const
bool QNetworkReply::hasRawHeader(QAnyStringView headerName) const
{
Q_D(const QNetworkReply);
- return d->findRawHeader(headerName) != d->rawHeaders.constEnd();
+ return d->headers().contains(headerName);
}
/*!
@@ -633,9 +633,7 @@ bool QNetworkReply::hasRawHeader(QAnyStringView headerName) const
QByteArray QNetworkReply::rawHeader(QAnyStringView headerName) const
{
Q_D(const QNetworkReply);
- if (const auto it = d->findRawHeader(headerName); it != d->rawHeaders.constEnd())
- return it->second;
- return QByteArray();
+ return d->rawHeader(headerName);
}
/*! \typedef QNetworkReply::RawHeaderPair
@@ -650,7 +648,7 @@ QByteArray QNetworkReply::rawHeader(QAnyStringView headerName) const
const QList<QNetworkReply::RawHeaderPair>& QNetworkReply::rawHeaderPairs() const
{
Q_D(const QNetworkReply);
- return d->rawHeaders;
+ return d->allRawHeaders();
}
/*!
diff --git a/src/network/access/qnetworkreplydataimpl.cpp b/src/network/access/qnetworkreplydataimpl.cpp
index 7cb7621bca..006cfd57cb 100644
--- a/src/network/access/qnetworkreplydataimpl.cpp
+++ b/src/network/access/qnetworkreplydataimpl.cpp
@@ -36,8 +36,11 @@ QNetworkReplyDataImpl::QNetworkReplyDataImpl(QObject *parent, const QNetworkRequ
QByteArray payload;
if (qDecodeDataUrl(url, mimeType, payload)) {
qint64 size = payload.size();
- setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
- setHeader(QNetworkRequest::ContentLengthHeader, size);
+ auto h = headers();
+ h.replaceOrAppend(QHttpHeaders::WellKnownHeader::ContentType, mimeType);
+ h.replaceOrAppend(QHttpHeaders::WellKnownHeader::ContentLength, QByteArray::number(size));
+ setHeaders(std::move(h));
+
QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection);
d->decodedData.setData(payload);
diff --git a/src/network/access/qnetworkreplyfileimpl.cpp b/src/network/access/qnetworkreplyfileimpl.cpp
index e6208a5c85..bad0bb7b0a 100644
--- a/src/network/access/qnetworkreplyfileimpl.cpp
+++ b/src/network/access/qnetworkreplyfileimpl.cpp
@@ -85,7 +85,7 @@ QNetworkReplyFileImpl::QNetworkReplyFileImpl(QNetworkAccessManager *manager, con
if (req.attribute(QNetworkRequest::BackgroundRequestAttribute).toBool()) { // Asynchronous open
auto realFile = new QNetworkFile(fileName);
- connect(realFile, &QNetworkFile::headerRead, this, &QNetworkReplyFileImpl::setHeader,
+ connect(realFile, &QNetworkFile::headerRead, this, &QNetworkReplyFileImpl::setWellKnownHeader,
Qt::QueuedConnection);
connect(realFile, &QNetworkFile::error, this, &QNetworkReplyFileImpl::setError,
Qt::QueuedConnection);
@@ -128,8 +128,12 @@ QNetworkReplyFileImpl::QNetworkReplyFileImpl(QNetworkAccessManager *manager, con
QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
return;
}
- setHeader(QNetworkRequest::LastModifiedHeader, fi.lastModified());
- setHeader(QNetworkRequest::ContentLengthHeader, fi.size());
+ auto h = headers();
+ h.replaceOrAppend(QHttpHeaders::WellKnownHeader::LastModified,
+ QNetworkHeadersPrivate::toHttpDate(fi.lastModified()));
+ h.replaceOrAppend(QHttpHeaders::WellKnownHeader::ContentLength,
+ QByteArray::number(fi.size()));
+ setHeaders(std::move(h));
QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "downloadProgress", Qt::QueuedConnection,
@@ -171,9 +175,9 @@ bool QNetworkReplyFileImpl::isSequential () const
qint64 QNetworkReplyFileImpl::size() const
{
- bool ok;
- int size = header(QNetworkRequest::ContentLengthHeader).toInt(&ok);
- return ok ? size : 0;
+ const auto totalSizeOpt = QNetworkHeadersPrivate::toInt(
+ headers().value(QHttpHeaders::WellKnownHeader::ContentLength));
+ return totalSizeOpt.value_or(0);
}
/*!
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 1eee98f834..89458825e9 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -202,7 +202,10 @@ QNetworkReplyHttpImpl::QNetworkReplyHttpImpl(QNetworkAccessManager* const manage
if (bufferingDisallowed) {
// if a valid content-length header for the request was supplied, we can disable buffering
// if not, we will buffer anyway
- if (request.header(QNetworkRequest::ContentLengthHeader).isValid()) {
+
+ const auto sizeOpt = QNetworkHeadersPrivate::toInt(
+ request.headers().value(QHttpHeaders::WellKnownHeader::ContentLength));
+ if (sizeOpt) {
QMetaObject::invokeMethod(this, "_q_startOperation", Qt::QueuedConnection);
// FIXME make direct call?
} else {
@@ -478,10 +481,12 @@ bool QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed(QHttpNetworkRequest &h
{
QNetworkRequest::CacheLoadControl CacheLoadControlAttribute =
(QNetworkRequest::CacheLoadControl)request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt();
+
+ auto requestHeaders = request.headers();
if (CacheLoadControlAttribute == QNetworkRequest::AlwaysNetwork) {
// If the request does not already specify preferred cache-control
// force reload from the network and tell any caching proxy servers to reload too
- if (!request.rawHeaderList().contains(cacheControlName())) {
+ if (!requestHeaders.contains(QHttpHeaders::WellKnownHeader::CacheControl)) {
const auto noCache = "no-cache"_ba;
httpRequest.setHeaderField(cacheControlName(), noCache);
httpRequest.setHeaderField("Pragma"_ba, noCache);
@@ -491,7 +496,7 @@ bool QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed(QHttpNetworkRequest &h
// The disk cache API does not currently support partial content retrieval.
// That is why we don't use the disk cache for any such requests.
- if (request.hasRawHeader(rangeName()))
+ if (requestHeaders.contains(QHttpHeaders::WellKnownHeader::Range))
return false;
QAbstractNetworkCache *nc = managerPrivate->networkCache;
@@ -505,28 +510,27 @@ bool QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed(QHttpNetworkRequest &h
if (!metaData.saveToDisk())
return false;
- QNetworkHeadersPrivate cacheHeaders;
- QNetworkHeadersPrivate::RawHeadersList::ConstIterator it;
- cacheHeaders.setAllRawHeaders(metaData.rawHeaders());
+ QHttpHeaders cacheHeaders = metaData.headers();
- it = cacheHeaders.findRawHeader("content-length");
- if (it != cacheHeaders.rawHeaders.constEnd()) {
+ const auto sizeOpt = QNetworkHeadersPrivate::toInt(
+ cacheHeaders.value(QHttpHeaders::WellKnownHeader::ContentLength));
+ if (sizeOpt) {
std::unique_ptr<QIODevice> data(nc->data(httpRequest.url()));
- if (!data || data->size() < it->second.toLongLong())
+ if (!data || data->size() < sizeOpt.value())
return false; // The data is smaller than the content-length specified
}
- it = cacheHeaders.findRawHeader("etag");
- if (it != cacheHeaders.rawHeaders.constEnd())
- httpRequest.setHeaderField("If-None-Match"_ba, it->second);
+ auto value = cacheHeaders.value(QHttpHeaders::WellKnownHeader::ETag);
+ if (!value.empty())
+ httpRequest.setHeaderField("If-None-Match"_ba, value.toByteArray());
QDateTime lastModified = metaData.lastModified();
if (lastModified.isValid())
httpRequest.setHeaderField("If-Modified-Since"_ba, QNetworkHeadersPrivate::toHttpDate(lastModified));
- it = cacheHeaders.findRawHeader(cacheControlName());
- if (it != cacheHeaders.rawHeaders.constEnd()) {
- QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second);
+ value = cacheHeaders.value(QHttpHeaders::WellKnownHeader::CacheControl);
+ if (!value.empty()) {
+ QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(value);
if (cacheControl.contains("must-revalidate"_ba))
return false;
if (cacheControl.contains("no-cache"_ba))
@@ -553,16 +557,15 @@ bool QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed(QHttpNetworkRequest &h
* now
* is the current (local) time
*/
- qint64 age_value = 0;
- it = cacheHeaders.findRawHeader("age");
- if (it != cacheHeaders.rawHeaders.constEnd())
- age_value = it->second.toLongLong();
+ const auto ageOpt = QNetworkHeadersPrivate::toInt(
+ cacheHeaders.value(QHttpHeaders::WellKnownHeader::Age));
+ const qint64 age_value = ageOpt.value_or(0);
QDateTime dateHeader;
qint64 date_value = 0;
- it = cacheHeaders.findRawHeader("date");
- if (it != cacheHeaders.rawHeaders.constEnd()) {
- dateHeader = QNetworkHeadersPrivate::fromHttpDate(it->second);
+ value = cacheHeaders.value(QHttpHeaders::WellKnownHeader::Date);
+ if (!value.empty()) {
+ dateHeader = QNetworkHeadersPrivate::fromHttpDate(value);
date_value = dateHeader.toSecsSinceEpoch();
}
@@ -744,18 +747,17 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
break; // can't happen
}
- QList<QByteArray> headers = newHttpRequest.rawHeaderList();
+ QHttpHeaders newRequestHeaders = newHttpRequest.headers();
if (resumeOffset != 0) {
- const int rangeIndex = headers.indexOf(rangeName());
- if (rangeIndex != -1) {
+ if (newRequestHeaders.contains(QHttpHeaders::WellKnownHeader::Range)) {
// Need to adjust resume offset for user specified range
- headers.removeAt(rangeIndex);
-
// We've already verified that requestRange starts with "bytes=", see canResume.
- const auto rangeHeader = newHttpRequest.rawHeader(rangeName());
+ const auto rangeHeader = newRequestHeaders.value(QHttpHeaders::WellKnownHeader::Range);
const auto requestRange = QByteArrayView(rangeHeader).mid(bytesEqualPrefix().size());
+ newRequestHeaders.removeAll(QHttpHeaders::WellKnownHeader::Range);
+
int index = requestRange.indexOf('-');
quint64 requestStartOffset = requestRange.left(index).toULongLong();
@@ -771,8 +773,11 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
}
}
- for (const QByteArray &header : std::as_const(headers))
- httpRequest.setHeaderField(header, newHttpRequest.rawHeader(header));
+ for (int i = 0; i < newRequestHeaders.size(); i++) {
+ const auto name = newRequestHeaders.nameAt(i);
+ const auto value = newRequestHeaders.valueAt(i);
+ httpRequest.setHeaderField(QByteArray(name.data(), name.size()), value.toByteArray());
+ }
if (newHttpRequest.attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool())
httpRequest.setPipeliningAllowed(true);
@@ -804,6 +809,13 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
httpRequest.setPeerVerifyName(newHttpRequest.peerVerifyName());
+ if (scheme.startsWith(("unix"_L1))) {
+ if (QVariant path = newHttpRequest.attribute(QNetworkRequest::FullLocalServerNameAttribute);
+ path.isValid() && path.canConvert<QString>()) {
+ httpRequest.setFullLocalServerName(path.toString());
+ }
+ }
+
// Create the HTTP thread delegate
QHttpThreadDelegate *delegate = new QHttpThreadDelegate;
// Propagate Http/2 settings:
@@ -1151,7 +1163,8 @@ void QNetworkReplyHttpImplPrivate::replyDownloadData(QByteArray d)
}
lastReadyReadEmittedSize = bytesDownloaded;
- QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);
+ const auto totalSizeOpt = QNetworkHeadersPrivate::toInt(
+ headers().value(QHttpHeaders::WellKnownHeader::ContentLength));
emit q->readyRead();
// emit readyRead before downloadProgress in case this will cause events to be
@@ -1159,8 +1172,7 @@ void QNetworkReplyHttpImplPrivate::replyDownloadData(QByteArray d)
if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval
&& (!decompressHelper.isValid() || decompressHelper.isCountingBytes())) {
downloadProgressSignalChoke.restart();
- emit q->downloadProgress(bytesDownloaded,
- totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong());
+ emit q->downloadProgress(bytesDownloaded, totalSizeOpt.value_or(-1));
}
}
@@ -1223,7 +1235,8 @@ void QNetworkReplyHttpImplPrivate::onRedirected(const QUrl &redirectUrl, int htt
if (httpRequest.isFollowRedirects()) // update the reply's url as it could've changed
url = redirectUrl;
- if (managerPrivate->stsEnabled && managerPrivate->stsCache.isKnownHost(url)) {
+ const bool wasLocalSocket = schemeBefore.startsWith("unix"_L1);
+ if (!wasLocalSocket && managerPrivate->stsEnabled && managerPrivate->stsCache.isKnownHost(url)) {
// RFC6797, 8.3:
// The UA MUST replace the URI scheme with "https" [RFC2818],
// and if the URI contains an explicit port component of "80",
@@ -1237,9 +1250,12 @@ void QNetworkReplyHttpImplPrivate::onRedirected(const QUrl &redirectUrl, int htt
url.setPort(443);
}
- const bool isLessSafe = schemeBefore == "https"_L1 && url.scheme() == "http"_L1;
- if (httpRequest.redirectPolicy() == QNetworkRequest::NoLessSafeRedirectPolicy
- && isLessSafe) {
+ // Just to be on the safe side for local sockets, any changes to the scheme
+ // are considered less safe
+ const bool changingLocalScheme = wasLocalSocket && url.scheme() != schemeBefore;
+ const bool isLessSafe = changingLocalScheme
+ || (schemeBefore == "https"_L1 && url.scheme() == "http"_L1);
+ if (httpRequest.redirectPolicy() == QNetworkRequest::NoLessSafeRedirectPolicy && isLessSafe) {
error(QNetworkReply::InsecureRedirectError,
QCoreApplication::translate("QHttp", "Insecure redirect"));
return;
@@ -1255,6 +1271,7 @@ void QNetworkReplyHttpImplPrivate::onRedirected(const QUrl &redirectUrl, int htt
// Clear stale headers, the relevant ones get set again later
httpRequest.clearHeaders();
+ auto newHeaders = redirectRequest.headers();
if ((operation == QNetworkAccessManager::GetOperation
|| operation == QNetworkAccessManager::HeadOperation) && !getOperationKeepsBody) {
// possibly changed from not-GET/HEAD to GET/HEAD, make sure to get rid of upload device
@@ -1269,18 +1286,20 @@ void QNetworkReplyHttpImplPrivate::onRedirected(const QUrl &redirectUrl, int htt
outgoingData = nullptr;
outgoingDataBuffer.reset();
// We need to explicitly unset these headers so they're not reapplied to the httpRequest
- redirectRequest.setHeader(QNetworkRequest::ContentLengthHeader, QVariant());
- redirectRequest.setHeader(QNetworkRequest::ContentTypeHeader, QVariant());
+ newHeaders.removeAll(QHttpHeaders::WellKnownHeader::ContentLength);
+ newHeaders.removeAll(QHttpHeaders::WellKnownHeader::ContentType);
}
if (const QNetworkCookieJar *const cookieJar = manager->cookieJar()) {
auto cookies = cookieJar->cookiesForUrl(url);
if (!cookies.empty()) {
- redirectRequest.setHeader(QNetworkRequest::KnownHeaders::CookieHeader,
- QVariant::fromValue(cookies));
+ auto cookieHeader = QNetworkHeadersPrivate::fromCookieList(cookies);
+ newHeaders.replaceOrAppend(QHttpHeaders::WellKnownHeader::Cookie, cookieHeader);
}
}
+ redirectRequest.setHeaders(std::move(newHeaders));
+
if (httpRequest.redirectPolicy() != QNetworkRequest::UserVerifiedRedirectPolicy)
followRedirect();
@@ -1293,8 +1312,7 @@ void QNetworkReplyHttpImplPrivate::followRedirect()
Q_ASSERT(managerPrivate);
decompressHelper.clear();
- rawHeaders.clear();
- cookedHeaders.clear();
+ clearHeaders();
if (managerPrivate->thread)
managerPrivate->thread->disconnect();
@@ -1317,7 +1335,7 @@ void QNetworkReplyHttpImplPrivate::checkForRedirect(const int statusCode)
// What do we do about the caching of the HTML note?
// The response to a 303 MUST NOT be cached, while the response to
// all of the others is cacheable if the headers indicate it to be
- QByteArray header = q->rawHeader(locationHeader());
+ QByteArrayView header = q->headers().value(locationHeader());
QUrl url = QUrl(QString::fromUtf8(header));
if (!url.isValid())
url = QUrl(QLatin1StringView(header));
@@ -1361,20 +1379,19 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QHttpHeaders &hm,
// A user having manually defined which encodings they accept is, for
// somwehat unknown (presumed legacy compatibility) reasons treated as
// disabling our decompression:
- const bool autoDecompress = request.rawHeader("accept-encoding").isEmpty();
+ const bool autoDecompress = !request.headers().contains(QHttpHeaders::WellKnownHeader::AcceptEncoding);
const bool shouldDecompress = isCompressed && autoDecompress;
// reconstruct the HTTP header
+ auto h = q->headers();
for (qsizetype i = 0; i < hm.size(); ++i) {
const auto key = hm.nameAt(i);
const auto originValue = hm.valueAt(i);
- QByteArray value = q->rawHeader(key);
-
// Reset any previous "location" header set in the reply. In case of
// redirects, we don't want to 'append' multiple location header values,
// rather we keep only the latest one
- if (key == locationHeader())
- value.clear();
+ if (key.compare(locationHeader(), Qt::CaseInsensitive) == 0)
+ h.removeAll(key);
if (shouldDecompress && !decompressHelper.isValid() && key == "content-encoding"_L1) {
if (!synchronous) // with synchronous all the data is expected to be handled at once
@@ -1390,17 +1407,9 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QHttpHeaders &hm,
request.decompressedSafetyCheckThreshold());
}
- if (!value.isEmpty()) {
- // Why are we appending values for headers which are already
- // present?
- if (key == "set-cookie"_L1)
- value += '\n';
- else
- value += ", ";
- }
- value += originValue;
- q->setRawHeader({key.data(), key.size()}, value);
+ h.append(key, originValue);
}
+ q->setHeaders(std::move(h));
q->setAttribute(QNetworkRequest::HttpStatusCodeAttribute, statusCode);
q->setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, reasonPhrase);
@@ -1415,13 +1424,10 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QHttpHeaders &hm,
QAbstractNetworkCache *nc = managerPrivate->networkCache;
if (nc) {
QNetworkCacheMetaData metaData = nc->metaData(httpRequest.url());
- QNetworkHeadersPrivate cacheHeaders;
- cacheHeaders.setAllRawHeaders(metaData.rawHeaders());
- QNetworkHeadersPrivate::RawHeadersList::ConstIterator it;
- it = cacheHeaders.findRawHeader(cacheControlName());
+ auto value = metaData.headers().value(QHttpHeaders::WellKnownHeader::CacheControl);
bool mustReValidate = false;
- if (it != cacheHeaders.rawHeaders.constEnd()) {
- QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second);
+ if (!value.empty()) {
+ QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(value);
if (cacheControl.contains("must-revalidate"_ba))
mustReValidate = true;
}
@@ -1660,16 +1666,21 @@ bool QNetworkReplyHttpImplPrivate::sendCacheContents(const QNetworkCacheMetaData
q->setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, attributes.value(QNetworkRequest::HttpReasonPhraseAttribute));
q->setAttribute(QNetworkRequest::SourceIsFromCacheAttribute, true);
- QNetworkCacheMetaData::RawHeaderList rawHeaders = metaData.rawHeaders();
- QNetworkCacheMetaData::RawHeaderList::ConstIterator it = rawHeaders.constBegin(),
- end = rawHeaders.constEnd();
+ QHttpHeaders cachedHeaders = metaData.headers();
+ QHttpHeaders h = headers();
QUrl redirectUrl;
- for ( ; it != end; ++it) {
- if (httpRequest.isFollowRedirects() &&
- !it->first.compare(locationHeader(), Qt::CaseInsensitive))
- redirectUrl = QUrl::fromEncoded(it->second);
- setRawHeader(it->first, it->second);
+ for (qsizetype i = 0; i < cachedHeaders.size(); ++i) {
+ const auto name = cachedHeaders.nameAt(i);
+ const auto value = cachedHeaders.valueAt(i);
+
+ if (httpRequest.isFollowRedirects()
+ && !name.compare(locationHeader(), Qt::CaseInsensitive)) {
+ redirectUrl = QUrl::fromEncoded(value);
+ }
+
+ h.replaceOrAppend(name, value);
}
+ setHeaders(std::move(h));
if (!isHttpRedirectResponse())
checkForRedirect(status);
@@ -1729,17 +1740,17 @@ QNetworkCacheMetaData QNetworkReplyHttpImplPrivate::fetchCacheMetaData(const QNe
Q_Q(const QNetworkReplyHttpImpl);
QNetworkCacheMetaData metaData = oldMetaData;
+ QHttpHeaders cacheHeaders = metaData.headers();
- QNetworkHeadersPrivate cacheHeaders;
- cacheHeaders.setAllRawHeaders(metaData.rawHeaders());
- QNetworkHeadersPrivate::RawHeadersList::ConstIterator it;
+ const auto newHeaders = q->headers();
+ for (qsizetype i = 0; i < newHeaders.size(); ++i) {
+ const auto name = newHeaders.nameAt(i);
+ const auto value = newHeaders.valueAt(i);
- const QList<QByteArray> newHeaders = q->rawHeaderList();
- for (const QByteArray& header : newHeaders) {
- if (isHopByHop(header))
+ if (isHopByHop(name))
continue;
- if (header.compare("set-cookie", Qt::CaseInsensitive) == 0)
+ if (name.compare("set-cookie", Qt::CaseInsensitive) == 0)
continue;
// for 4.6.0, we were planning to not store the date header in the
@@ -1752,50 +1763,46 @@ QNetworkCacheMetaData QNetworkReplyHttpImplPrivate::fetchCacheMetaData(const QNe
//continue;
// Don't store Warning 1xx headers
- if (header.compare("warning", Qt::CaseInsensitive) == 0) {
- const QByteArray v = q->rawHeader(header);
- if (v.size() == 3
- && v[0] == '1'
- && isAsciiDigit(v[1])
- && isAsciiDigit(v[2]))
+ if (name.compare("warning", Qt::CaseInsensitive) == 0) {
+ if (value.size() == 3
+ && value[0] == '1'
+ && isAsciiDigit(value[1])
+ && isAsciiDigit(value[2]))
continue;
}
- it = cacheHeaders.findRawHeader(header);
- if (it != cacheHeaders.rawHeaders.constEnd()) {
+ if (cacheHeaders.contains(name)) {
// Match the behavior of Firefox and assume Cache-Control: "no-transform"
constexpr QByteArrayView headers[]=
{"content-encoding", "content-range", "content-type"};
- if (std::any_of(std::begin(headers), std::end(headers), caseInsensitiveCompare(header)))
+ if (std::any_of(std::begin(headers), std::end(headers), caseInsensitiveCompare(name)))
continue;
}
// IIS has been known to send "Content-Length: 0" on 304 responses, so
// ignore this too
- if (statusCode == 304 && header.compare("content-length", Qt::CaseInsensitive) == 0)
+ if (statusCode == 304 && name.compare("content-length", Qt::CaseInsensitive) == 0)
continue;
#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
- QByteArray n = q->rawHeader(header);
- QByteArray o;
- if (it != cacheHeaders.rawHeaders.constEnd())
- o = (*it).second;
- if (n != o && headerheader.compare("date", Qt::CaseInsensitive) != 0) {
- qDebug() << "replacing" << header;
+ QByteArrayView n = newHeaders.value(name);
+ QByteArrayView o = cacheHeaders.value(name);
+ if (n != o && name.compare("date", Qt::CaseInsensitive) != 0) {
+ qDebug() << "replacing" << name;
qDebug() << "new" << n;
qDebug() << "old" << o;
}
#endif
- cacheHeaders.setRawHeader(header, q->rawHeader(header));
+ cacheHeaders.replaceOrAppend(name, value);
}
- metaData.setRawHeaders(cacheHeaders.rawHeaders);
+ metaData.setHeaders(cacheHeaders);
bool checkExpired = true;
QHash<QByteArray, QByteArray> cacheControl;
- it = cacheHeaders.findRawHeader(cacheControlName());
- if (it != cacheHeaders.rawHeaders.constEnd()) {
- cacheControl = parseHttpOptionHeader(it->second);
+ auto value = cacheHeaders.value(QHttpHeaders::WellKnownHeader::CacheControl);
+ if (!value.empty()) {
+ cacheControl = parseHttpOptionHeader(value);
QByteArray maxAge = cacheControl.value("max-age"_ba);
if (!maxAge.isEmpty()) {
checkExpired = false;
@@ -1805,16 +1812,18 @@ QNetworkCacheMetaData QNetworkReplyHttpImplPrivate::fetchCacheMetaData(const QNe
}
}
if (checkExpired) {
- it = cacheHeaders.findRawHeader("expires");
- if (it != cacheHeaders.rawHeaders.constEnd()) {
- QDateTime expiredDateTime = QNetworkHeadersPrivate::fromHttpDate(it->second);
+ if (const auto value = cacheHeaders.value(
+ QHttpHeaders::WellKnownHeader::Expires); !value.isEmpty()) {
+ QDateTime expiredDateTime = QNetworkHeadersPrivate::fromHttpDate(value);
metaData.setExpirationDate(expiredDateTime);
}
}
- it = cacheHeaders.findRawHeader("last-modified");
- if (it != cacheHeaders.rawHeaders.constEnd())
- metaData.setLastModified(QNetworkHeadersPrivate::fromHttpDate(it->second));
+ if (const auto value = cacheHeaders.value(
+ QHttpHeaders::WellKnownHeader::LastModified); !value.isEmpty()) {
+ metaData.setLastModified(QNetworkHeadersPrivate::fromHttpDate(value));
+ }
+
bool canDiskCache;
// only cache GET replies by default, all other replies (POST, PUT, DELETE)
@@ -1862,14 +1871,16 @@ bool QNetworkReplyHttpImplPrivate::canResume() const
if (operation != QNetworkAccessManager::GetOperation)
return false;
+ const auto h = q->headers();
+
// Can only resume if server/resource supports Range header.
- constexpr auto acceptRangesheaderName = QByteArrayView("Accept-Ranges");
- if (!q->hasRawHeader(acceptRangesheaderName) || q->rawHeader(acceptRangesheaderName) == "none")
+ const auto acceptRanges = h.value(QHttpHeaders::WellKnownHeader::AcceptRanges);
+ if (acceptRanges.empty() || acceptRanges == "none")
return false;
// We only support resuming for byte ranges.
- if (request.hasRawHeader(rangeName())) {
- QByteArray range = request.rawHeader(rangeName());
+ const auto range = h.value(QHttpHeaders::WellKnownHeader::Range);
+ if (!range.empty()) {
if (!range.startsWith(bytesEqualPrefix()))
return false;
}
@@ -1918,8 +1929,8 @@ void QNetworkReplyHttpImplPrivate::_q_cacheLoadReadyRead()
// Needs to be done where sendCacheContents() (?) of HTTP is emitting
// metaDataChanged ?
-
- QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);
+ const auto totalSizeOpt = QNetworkHeadersPrivate::toInt(
+ headers().value(QHttpHeaders::WellKnownHeader::ContentLength));
// emit readyRead before downloadProgress in case this will cause events to be
// processed and we get into a recursive call (as in QProgressDialog).
@@ -1930,8 +1941,7 @@ void QNetworkReplyHttpImplPrivate::_q_cacheLoadReadyRead()
if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval) {
downloadProgressSignalChoke.restart();
- emit q->downloadProgress(bytesDownloaded,
- totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong());
+ emit q->downloadProgress(bytesDownloaded, totalSizeOpt.value_or(-1));
}
}
@@ -2118,11 +2128,13 @@ void QNetworkReplyHttpImplPrivate::finished()
if (state == Finished || state == Aborted)
return;
- QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);
+ const auto totalSizeOpt = QNetworkHeadersPrivate::toInt(
+ headers().value(QHttpHeaders::WellKnownHeader::ContentLength));
+ const qint64 totalSize = totalSizeOpt.value_or(-1);
// if we don't know the total size of or we received everything save the cache.
// If the data is compressed then this is done in readData()
- if ((totalSize.isNull() || totalSize == -1 || bytesDownloaded == totalSize)
+ if ((totalSize == -1 || bytesDownloaded == totalSize)
&& !decompressHelper.isValid()) {
completeCacheSave();
}
@@ -2135,10 +2147,10 @@ void QNetworkReplyHttpImplPrivate::finished()
state = Finished;
q->setFinished(true);
- if (totalSize.isNull() || totalSize == -1) {
+ if (totalSize == -1) {
emit q->downloadProgress(bytesDownloaded, bytesDownloaded);
} else {
- emit q->downloadProgress(bytesDownloaded, totalSize.toLongLong());
+ emit q->downloadProgress(bytesDownloaded, totalSize);
}
if (bytesUploaded == -1 && (outgoingData || outgoingDataBuffer))
@@ -2182,14 +2194,15 @@ void QNetworkReplyHttpImplPrivate::_q_metaDataChanged()
// 1. do we have cookies?
// 2. are we allowed to set them?
Q_ASSERT(manager);
- const auto it = cookedHeaders.constFind(QNetworkRequest::SetCookieHeader);
- if (it != cookedHeaders.cend()
+
+ const auto cookiesOpt = QNetworkHeadersPrivate::toSetCookieList(
+ headers().values(QHttpHeaders::WellKnownHeader::SetCookie));
+ const auto cookies = cookiesOpt.value_or(QList<QNetworkCookie>());
+ if (!cookies.empty()
&& request.attribute(QNetworkRequest::CookieSaveControlAttribute,
QNetworkRequest::Automatic).toInt() == QNetworkRequest::Automatic) {
QNetworkCookieJar *jar = manager->cookieJar();
if (jar) {
- QList<QNetworkCookie> cookies =
- qvariant_cast<QList<QNetworkCookie> >(it.value());
jar->setCookiesFromUrl(cookies, url);
}
}
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 8b2acfdb4e..b90ec1cc4c 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -118,15 +118,16 @@ void QNetworkReplyImplPrivate::_q_copyReadyRead()
return;
}
- QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);
+ const auto totalSizeOpt = QNetworkHeadersPrivate::toInt(
+ headers().value(QHttpHeaders::WellKnownHeader::ContentLength));
+
pauseNotificationHandling();
// emit readyRead before downloadProgress in case this will cause events to be
// processed and we get into a recursive call (as in QProgressDialog).
emit q->readyRead();
if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval) {
downloadProgressSignalChoke.restart();
- emit q->downloadProgress(bytesDownloaded,
- totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong());
+ emit q->downloadProgress(bytesDownloaded, totalSizeOpt.value_or(-1));
}
resumeNotificationHandling();
}
@@ -243,7 +244,10 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const
if (bufferingDisallowed) {
// if a valid content-length header for the request was supplied, we can disable buffering
// if not, we will buffer anyway
- if (req.header(QNetworkRequest::ContentLengthHeader).isValid()) {
+ const auto sizeOpt = QNetworkHeadersPrivate::toInt(
+ headers().value(QHttpHeaders::WellKnownHeader::ContentLength));
+
+ if (sizeOpt) {
QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
} else {
state = Buffering;
@@ -478,7 +482,8 @@ void QNetworkReplyImplPrivate::appendDownstreamDataSignalEmissions()
{
Q_Q(QNetworkReplyImpl);
- QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);
+ const auto totalSizeOpt = QNetworkHeadersPrivate::toInt(
+ headers().value(QHttpHeaders::WellKnownHeader::ContentLength));
pauseNotificationHandling();
// important: At the point of this readyRead(), the data parameter list must be empty,
// else implicit sharing will trigger memcpy when the user is reading data!
@@ -487,8 +492,7 @@ void QNetworkReplyImplPrivate::appendDownstreamDataSignalEmissions()
// processed and we get into a recursive call (as in QProgressDialog).
if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval) {
downloadProgressSignalChoke.restart();
- emit q->downloadProgress(bytesDownloaded,
- totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong());
+ emit q->downloadProgress(bytesDownloaded, totalSizeOpt.value_or(-1));
}
resumeNotificationHandling();
@@ -589,7 +593,9 @@ void QNetworkReplyImplPrivate::finished()
return;
pauseNotificationHandling();
- QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);
+ const auto totalSizeOpt = QNetworkHeadersPrivate::toInt(
+ headers().value(QHttpHeaders::WellKnownHeader::ContentLength));
+ const auto totalSize = totalSizeOpt.value_or(-1);
resumeNotificationHandling();
@@ -599,10 +605,10 @@ void QNetworkReplyImplPrivate::finished()
pendingNotifications.clear();
pauseNotificationHandling();
- if (totalSize.isNull() || totalSize == -1) {
+ if (totalSize == -1) {
emit q->downloadProgress(bytesDownloaded, bytesDownloaded);
} else {
- emit q->downloadProgress(bytesDownloaded, totalSize.toLongLong());
+ emit q->downloadProgress(bytesDownloaded, totalSize);
}
if (bytesUploaded == -1 && (outgoingData || outgoingDataBuffer))
@@ -610,7 +616,7 @@ void QNetworkReplyImplPrivate::finished()
resumeNotificationHandling();
// if we don't know the total size of or we received everything save the cache
- if (totalSize.isNull() || totalSize == -1 || bytesDownloaded == totalSize)
+ if (totalSize == -1 || bytesDownloaded == totalSize)
completeCacheSave();
// note: might not be a good idea, since users could decide to delete us
@@ -646,14 +652,14 @@ void QNetworkReplyImplPrivate::metaDataChanged()
// 1. do we have cookies?
// 2. are we allowed to set them?
if (!manager.isNull()) {
- const auto it = cookedHeaders.constFind(QNetworkRequest::SetCookieHeader);
- if (it != cookedHeaders.cend()
+ const auto cookiesOpt = QNetworkHeadersPrivate::toSetCookieList(
+ headers().values(QHttpHeaders::WellKnownHeader::SetCookie));
+ const auto cookies = cookiesOpt.value_or(QList<QNetworkCookie>());
+ if (!cookies.empty()
&& request.attribute(QNetworkRequest::CookieSaveControlAttribute,
QNetworkRequest::Automatic).toInt() == QNetworkRequest::Automatic) {
QNetworkCookieJar *jar = manager->cookieJar();
if (jar) {
- QList<QNetworkCookie> cookies =
- qvariant_cast<QList<QNetworkCookie> >(it.value());
jar->setCookiesFromUrl(cookies, url);
}
}
@@ -857,9 +863,10 @@ qint64 QNetworkReplyImpl::readData(char *data, qint64 maxlen)
break;
}
}
- QVariant totalSize = d->cookedHeaders.value(QNetworkRequest::ContentLengthHeader);
- emit downloadProgress(bytesRead,
- totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong());
+
+ const auto totalSizeOpt = QNetworkHeadersPrivate::toInt(
+ headers().value(QHttpHeaders::WellKnownHeader::ContentLength));
+ emit downloadProgress(bytesRead, totalSizeOpt.value_or(-1));
return bytesRead;
} else if (d->backend && d->backend->bytesAvailable()) {
return d->backend->read(data, maxlen);
diff --git a/src/network/access/qnetworkreplywasmimpl.cpp b/src/network/access/qnetworkreplywasmimpl.cpp
index c02f0b4e61..7d2b6a701e 100644
--- a/src/network/access/qnetworkreplywasmimpl.cpp
+++ b/src/network/access/qnetworkreplywasmimpl.cpp
@@ -9,6 +9,7 @@
#include <QtCore/qcoreapplication.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qthread.h>
+#include <QtCore/private/qeventdispatcher_wasm_p.h>
#include <QtCore/private/qoffsetstringarray_p.h>
#include <QtCore/private/qtools_p.h>
@@ -63,11 +64,27 @@ QNetworkReplyWasmImplPrivate::QNetworkReplyWasmImplPrivate()
, totalDownloadSize(0)
, percentFinished(0)
, m_fetch(nullptr)
+ , m_fetchContext(nullptr)
{
}
QNetworkReplyWasmImplPrivate::~QNetworkReplyWasmImplPrivate()
{
+
+ if (m_fetchContext) { // fetch has been initiated
+ std::unique_lock lock{ m_fetchContext->mutex };
+
+ if (m_fetchContext->state == FetchContext::State::SCHEDULED
+ || m_fetchContext->state == FetchContext::State::SENT
+ || m_fetchContext->state == FetchContext::State::CANCELED) {
+ m_fetchContext->reply = nullptr;
+ m_fetchContext->state = FetchContext::State::TO_BE_DESTROYED;
+ } else if (m_fetchContext->state == FetchContext::State::FINISHED) {
+ lock.unlock();
+ delete m_fetchContext;
+ }
+ }
+
}
QNetworkReplyWasmImpl::QNetworkReplyWasmImpl(QObject *parent)
@@ -116,7 +133,7 @@ void QNetworkReplyWasmImpl::close()
d->state = QNetworkReplyPrivate::Finished;
d->setCanceled();
}
-
+ emscripten_fetch_close(d->m_fetch);
QNetworkReply::close();
}
@@ -134,8 +151,14 @@ void QNetworkReplyWasmImpl::abort()
void QNetworkReplyWasmImplPrivate::setCanceled()
{
Q_Q(QNetworkReplyWasmImpl);
- if (m_fetch)
- m_fetch->userData = nullptr;
+ {
+ if (m_fetchContext) {
+ std::scoped_lock lock{ m_fetchContext->mutex };
+ if (m_fetchContext->state == FetchContext::State::SCHEDULED
+ || m_fetchContext->state == FetchContext::State::SENT)
+ m_fetchContext->state = FetchContext::State::CANCELED;
+ }
+ }
emitReplyError(QNetworkReply::OperationCanceledError, QStringLiteral("Operation canceled"));
q->setFinished(true);
@@ -227,48 +250,7 @@ void QNetworkReplyWasmImplPrivate::doSendRequest()
emscripten_fetch_attr_t attr;
emscripten_fetch_attr_init(&attr);
- strcpy(attr.requestMethod, q->methodName().constData());
-
- QList<QByteArray> headersData = request.rawHeaderList();
- int arrayLength = getArraySize(headersData.count());
- const char *customHeaders[arrayLength];
- QStringList trimmedHeaders;
-
- if (headersData.count() > 0) {
- int i = 0;
- for (const auto &headerName : headersData) {
- if (isUnsafeHeader(QLatin1StringView(headerName.constData()))) {
- trimmedHeaders.push_back(QString::fromLatin1(headerName));
- } else {
- customHeaders[i++] = headerName.constData();
- customHeaders[i++] = request.rawHeader(headerName).constData();
- }
- }
- if (!trimmedHeaders.isEmpty()) {
- qWarning() << "Qt has trimmed the following forbidden headers from the request:"
- << trimmedHeaders.join(QLatin1StringView(", "));
- }
- customHeaders[i] = nullptr;
- attr.requestHeaders = customHeaders;
- }
-
- if (outgoingData) { // data from post request
- // handle extra data
- requestData = outgoingData->readAll(); // is there a size restriction here?
- if (!requestData.isEmpty()) {
- attr.requestData = requestData.data();
- attr.requestDataSize = requestData.size();
- }
- }
-
- QByteArray userName, password;
- // username & password
- if (!request.url().userInfo().isEmpty()) {
- userName = request.url().userName().toUtf8();
- password = request.url().password().toUtf8();
- attr.userName = userName.constData();
- attr.password = password.constData();
- }
+ qstrncpy(attr.requestMethod, q->methodName().constData(), 32); // requestMethod is char[32] in emscripten
attr.attributes = EMSCRIPTEN_FETCH_LOAD_TO_MEMORY;
@@ -293,13 +275,67 @@ void QNetworkReplyWasmImplPrivate::doSendRequest()
attr.onprogress = QNetworkReplyWasmImplPrivate::downloadProgress;
attr.onreadystatechange = QNetworkReplyWasmImplPrivate::stateChange;
attr.timeoutMSecs = request.transferTimeout();
- attr.userData = reinterpret_cast<void *>(this);
- QString dPath = "/home/web_user/"_L1 + request.url().fileName();
- QByteArray destinationPath = dPath.toUtf8();
- attr.destinationPath = destinationPath.constData();
+ m_fetchContext = new FetchContext(this);;
+ attr.userData = static_cast<void *>(m_fetchContext);
+ if (outgoingData) { // data from post request
+ m_fetchContext->requestData = outgoingData->readAll(); // is there a size restriction here?
+ if (!m_fetchContext->requestData.isEmpty()) {
+ attr.requestData = m_fetchContext->requestData.data();
+ attr.requestDataSize = m_fetchContext->requestData.size();
+ }
+ }
- m_fetch = emscripten_fetch(&attr, request.url().toString().toUtf8().constData());
+ QEventDispatcherWasm::runOnMainThread([attr, fetchContext = m_fetchContext]() mutable {
+ std::unique_lock lock{ fetchContext->mutex };
+ if (fetchContext->state == FetchContext::State::CANCELED) {
+ fetchContext->state = FetchContext::State::FINISHED;
+ return;
+ } else if (fetchContext->state == FetchContext::State::TO_BE_DESTROYED) {
+ lock.unlock();
+ delete fetchContext;
+ return;
+ }
+ const auto reply = fetchContext->reply;
+ const auto &request = reply->request;
+
+ QByteArray userName, password;
+ if (!request.url().userInfo().isEmpty()) {
+ userName = request.url().userName().toUtf8();
+ password = request.url().password().toUtf8();
+ attr.userName = userName.constData();
+ attr.password = password.constData();
+ }
+
+ QList<QByteArray> headersData = request.rawHeaderList();
+ int arrayLength = getArraySize(headersData.count());
+ const char *customHeaders[arrayLength];
+ QStringList trimmedHeaders;
+ if (headersData.count() > 0) {
+ int i = 0;
+ for (const auto &headerName : headersData) {
+ if (isUnsafeHeader(QLatin1StringView(headerName.constData()))) {
+ trimmedHeaders.push_back(QString::fromLatin1(headerName));
+ } else {
+ customHeaders[i++] = headerName.constData();
+ customHeaders[i++] = request.rawHeader(headerName).constData();
+ }
+ }
+ if (!trimmedHeaders.isEmpty()) {
+ qWarning() << "Qt has trimmed the following forbidden headers from the request:"
+ << trimmedHeaders.join(QLatin1StringView(", "));
+ }
+ customHeaders[i] = nullptr;
+ attr.requestHeaders = customHeaders;
+ }
+
+ auto url = request.url().toString().toUtf8();
+ QString dPath = "/home/web_user/"_L1 + request.url().fileName();
+ QByteArray destinationPath = dPath.toUtf8();
+ attr.destinationPath = destinationPath.constData();
+ reply->m_fetch = emscripten_fetch(&attr, url.constData());
+ fetchContext->state = FetchContext::State::SENT;
+ });
state = Working;
}
@@ -477,8 +513,18 @@ void QNetworkReplyWasmImplPrivate::_q_bufferOutgoingData()
void QNetworkReplyWasmImplPrivate::downloadSucceeded(emscripten_fetch_t *fetch)
{
- auto reply = reinterpret_cast<QNetworkReplyWasmImplPrivate*>(fetch->userData);
- if (reply) {
+ auto fetchContext = static_cast<FetchContext *>(fetch->userData);
+ std::unique_lock lock{ fetchContext->mutex };
+
+ if (fetchContext->state == FetchContext::State::TO_BE_DESTROYED) {
+ lock.unlock();
+ delete fetchContext;
+ return;
+ } else if (fetchContext->state == FetchContext::State::CANCELED) {
+ fetchContext->state = FetchContext::State::FINISHED;
+ return;
+ } else if (fetchContext->state == FetchContext::State::SENT) {
+ const auto reply = fetchContext->reply;
if (reply->state != QNetworkReplyPrivate::Aborted) {
QByteArray buffer(fetch->data, fetch->numBytes);
reply->dataReceived(buffer);
@@ -487,8 +533,8 @@ void QNetworkReplyWasmImplPrivate::downloadSucceeded(emscripten_fetch_t *fetch)
reply->setReplyFinished();
}
reply->m_fetch = nullptr;
+ fetchContext->state = FetchContext::State::FINISHED;
}
- emscripten_fetch_close(fetch);
}
void QNetworkReplyWasmImplPrivate::setReplyFinished()
@@ -509,7 +555,8 @@ void QNetworkReplyWasmImplPrivate::setStatusCode(int status, const QByteArray &s
void QNetworkReplyWasmImplPrivate::stateChange(emscripten_fetch_t *fetch)
{
- auto reply = reinterpret_cast<QNetworkReplyWasmImplPrivate*>(fetch->userData);
+ const auto fetchContext = static_cast<FetchContext*>(fetch->userData);
+ const auto reply = fetchContext->reply;
if (reply && reply->state != QNetworkReplyPrivate::Aborted) {
if (fetch->readyState == /*HEADERS_RECEIVED*/ 2) {
size_t headerLength = emscripten_fetch_get_response_headers_length(fetch);
@@ -522,7 +569,8 @@ void QNetworkReplyWasmImplPrivate::stateChange(emscripten_fetch_t *fetch)
void QNetworkReplyWasmImplPrivate::downloadProgress(emscripten_fetch_t *fetch)
{
- auto reply = reinterpret_cast<QNetworkReplyWasmImplPrivate*>(fetch->userData);
+ const auto fetchContext = static_cast<FetchContext*>(fetch->userData);
+ const auto reply = fetchContext->reply;
if (reply && reply->state != QNetworkReplyPrivate::Aborted) {
if (fetch->status < 400) {
uint64_t bytes = fetch->dataOffset + fetch->numBytes;
@@ -536,8 +584,18 @@ void QNetworkReplyWasmImplPrivate::downloadProgress(emscripten_fetch_t *fetch)
void QNetworkReplyWasmImplPrivate::downloadFailed(emscripten_fetch_t *fetch)
{
- auto reply = reinterpret_cast<QNetworkReplyWasmImplPrivate*>(fetch->userData);
- if (reply) {
+ const auto fetchContext = static_cast<FetchContext*>(fetch->userData);
+ std::unique_lock lock{ fetchContext->mutex };
+
+ if (fetchContext->state == FetchContext::State::TO_BE_DESTROYED) {
+ lock.unlock();
+ delete fetchContext;
+ return;
+ } else if (fetchContext->state == FetchContext::State::CANCELED) {
+ fetchContext->state = FetchContext::State::FINISHED;
+ return;
+ } else if (fetchContext->state == FetchContext::State::SENT) {
+ const auto reply = fetchContext->reply;
if (reply->state != QNetworkReplyPrivate::Aborted) {
QString reasonStr;
if (fetch->status > 600)
@@ -548,12 +606,13 @@ void QNetworkReplyWasmImplPrivate::downloadFailed(emscripten_fetch_t *fetch)
reply->dataReceived(buffer);
QByteArray statusText(fetch->statusText);
reply->setStatusCode(fetch->status, statusText);
- reply->emitReplyError(reply->statusCodeFromHttp(fetch->status, reply->request.url()), reasonStr);
+ reply->emitReplyError(reply->statusCodeFromHttp(fetch->status, reply->request.url()),
+ reasonStr);
reply->setReplyFinished();
}
reply->m_fetch = nullptr;
+ fetchContext->state = FetchContext::State::FINISHED;
}
- emscripten_fetch_close(fetch);
}
//taken from qhttpthreaddelegate.cpp
diff --git a/src/network/access/qnetworkreplywasmimpl_p.h b/src/network/access/qnetworkreplywasmimpl_p.h
index ae167799d7..4b00bb09ea 100644
--- a/src/network/access/qnetworkreplywasmimpl_p.h
+++ b/src/network/access/qnetworkreplywasmimpl_p.h
@@ -28,6 +28,7 @@
#include <emscripten/fetch.h>
#include <memory>
+#include <mutex>
QT_BEGIN_NAMESPACE
@@ -63,6 +64,29 @@ private:
QByteArray methodName() const;
};
+class QNetworkReplyWasmImplPrivate;
+
+/*!
+ The FetchContext class ensures the requestData object remains valid
+ while a fetch operation is pending. Since Emscripten fetch is asynchronous,
+ requestData must persist until one of the final callbacks is invoked.
+ Additionally, there's a potential race condition between the thread
+ scheduling the fetch operation and the one executing it. Since fetch must
+ occur on the main thread due to browser limitations,
+ a mutex safeguards the FetchContext to ensure atomic state transitions.
+*/
+struct FetchContext
+{
+ enum class State { SCHEDULED, SENT, FINISHED, CANCELED, TO_BE_DESTROYED };
+
+ FetchContext(QNetworkReplyWasmImplPrivate *networkReply) : reply(networkReply) { }
+
+ QNetworkReplyWasmImplPrivate *reply{ nullptr };
+ std::mutex mutex;
+ QByteArray requestData;
+ State state{ State::SCHEDULED };
+};
+
class QNetworkReplyWasmImplPrivate: public QNetworkReplyPrivate
{
public:
@@ -101,7 +125,6 @@ public:
QIODevice *outgoingData;
std::shared_ptr<QRingBuffer> outgoingDataBuffer;
- QByteArray requestData;
static void downloadProgress(emscripten_fetch_t *fetch);
static void downloadFailed(emscripten_fetch_t *fetch);
@@ -111,6 +134,7 @@ public:
static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url);
emscripten_fetch_t *m_fetch;
+ FetchContext *m_fetchContext;
void setReplyFinished();
void setCanceled();
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index a59de42a44..0e1172b15c 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -17,6 +17,7 @@
#include "QtCore/qlocale.h"
#include "QtCore/qshareddata.h"
#include "QtCore/qtimezone.h"
+#include "QtCore/private/qduplicatetracker_p.h"
#include "QtCore/private/qtools_p.h"
#include <ctype.h>
@@ -25,6 +26,7 @@
#endif
#include <algorithm>
+#include <q20algorithm.h>
QT_BEGIN_NAMESPACE
@@ -110,6 +112,8 @@ QT_IMPL_METATYPE_EXTERN_TAGGED(QNetworkRequest::RedirectPolicy, QNetworkRequest_
\value ServerHeader The Server header received by HTTP clients.
+ \omitvalue NumKnownHeaders
+
\sa header(), setHeader(), rawHeader(), setRawHeader()
*/
@@ -320,6 +324,16 @@ QT_IMPL_METATYPE_EXTERN_TAGGED(QNetworkRequest::RedirectPolicy, QNetworkRequest_
same-origin requests. This only affects the WebAssembly platform.
(This value was introduced in 6.5.)
+ \value FullLocalServerNameAttribute
+ Requests only, type: QMetaType::String
+ Holds the full local server name to be used for the underlying
+ QLocalSocket. This attribute is used by the QNetworkAccessManager
+ to connect to a specific local server, when QLocalSocket's behavior for
+ a simple name isn't enough. The URL in the QNetworkRequest must still
+ use unix+http: or local+http: scheme. And the hostname in the URL will
+ be used for the Host header in the HTTP request.
+ (This value was introduced in 6.8.)
+
\value User
Special type. Additional information can be passed in
QVariants with types ranging from User to UserMax. The default
@@ -466,7 +480,6 @@ public:
{
return url == other.url &&
priority == other.priority &&
- rawHeaders == other.rawHeaders &&
attributes == other.attributes &&
maxRedirectsAllowed == other.maxRedirectsAllowed &&
peerVerifyName == other.peerVerifyName
@@ -672,7 +685,7 @@ void QNetworkRequest::setHeader(KnownHeaders header, const QVariant &value)
*/
bool QNetworkRequest::hasRawHeader(QAnyStringView headerName) const
{
- return d->findRawHeader(headerName) != d->rawHeaders.constEnd();
+ return d->headers().contains(headerName);
}
/*!
@@ -688,9 +701,7 @@ bool QNetworkRequest::hasRawHeader(QAnyStringView headerName) const
*/
QByteArray QNetworkRequest::rawHeader(QAnyStringView headerName) const
{
- if (const auto it = d->findRawHeader(headerName); it != d->rawHeaders.constEnd())
- return it->second;
- return QByteArray();
+ return d->rawHeader(headerName);
}
/*!
@@ -1077,63 +1088,72 @@ void QNetworkRequest::setTransferTimeout(std::chrono::milliseconds duration)
}
#endif // QT_CONFIG(http) || defined (Q_OS_WASM)
-static QByteArray headerName(QNetworkRequest::KnownHeaders header)
-{
- switch (header) {
- case QNetworkRequest::ContentTypeHeader:
- return "Content-Type"_ba;
-
- case QNetworkRequest::ContentLengthHeader:
- return "Content-Length"_ba;
-
- case QNetworkRequest::LocationHeader:
- return "Location"_ba;
-
- case QNetworkRequest::LastModifiedHeader:
- return "Last-Modified"_ba;
+namespace {
- case QNetworkRequest::IfModifiedSinceHeader:
- return "If-Modified-Since"_ba;
-
- case QNetworkRequest::ETagHeader:
- return "ETag"_ba;
-
- case QNetworkRequest::IfMatchHeader:
- return "If-Match"_ba;
-
- case QNetworkRequest::IfNoneMatchHeader:
- return "If-None-Match"_ba;
+struct HeaderPair {
+ QHttpHeaders::WellKnownHeader wellKnownHeader;
+ QNetworkRequest::KnownHeaders knownHeader;
+};
- case QNetworkRequest::CookieHeader:
- return "Cookie"_ba;
+constexpr bool operator<(const HeaderPair &lhs, const HeaderPair &rhs)
+{
+ return lhs.wellKnownHeader < rhs.wellKnownHeader;
+}
- case QNetworkRequest::SetCookieHeader:
- return "Set-Cookie"_ba;
+constexpr bool operator<(const HeaderPair &lhs, QHttpHeaders::WellKnownHeader rhs)
+{
+ return lhs.wellKnownHeader < rhs;
+}
- case QNetworkRequest::ContentDispositionHeader:
- return "Content-Disposition"_ba;
+constexpr bool operator<(QHttpHeaders::WellKnownHeader lhs, const HeaderPair &rhs)
+{
+ return lhs < rhs.wellKnownHeader;
+}
- case QNetworkRequest::UserAgentHeader:
- return "User-Agent"_ba;
+} // anonymous namespace
- case QNetworkRequest::ServerHeader:
- return "Server"_ba;
+static constexpr HeaderPair knownHeadersArr[] = {
+ { QHttpHeaders::WellKnownHeader::ContentDisposition, QNetworkRequest::KnownHeaders::ContentDispositionHeader },
+ { QHttpHeaders::WellKnownHeader::ContentLength, QNetworkRequest::KnownHeaders::ContentLengthHeader },
+ { QHttpHeaders::WellKnownHeader::ContentType, QNetworkRequest::KnownHeaders::ContentTypeHeader },
+ { QHttpHeaders::WellKnownHeader::Cookie, QNetworkRequest::KnownHeaders::CookieHeader },
+ { QHttpHeaders::WellKnownHeader::ETag, QNetworkRequest::KnownHeaders::ETagHeader },
+ { QHttpHeaders::WellKnownHeader::IfMatch , QNetworkRequest::KnownHeaders::IfMatchHeader },
+ { QHttpHeaders::WellKnownHeader::IfModifiedSince, QNetworkRequest::KnownHeaders::IfModifiedSinceHeader },
+ { QHttpHeaders::WellKnownHeader::IfNoneMatch, QNetworkRequest::KnownHeaders::IfNoneMatchHeader },
+ { QHttpHeaders::WellKnownHeader::LastModified, QNetworkRequest::KnownHeaders::LastModifiedHeader},
+ { QHttpHeaders::WellKnownHeader::Location, QNetworkRequest::KnownHeaders::LocationHeader},
+ { QHttpHeaders::WellKnownHeader::Server, QNetworkRequest::KnownHeaders::ServerHeader },
+ { QHttpHeaders::WellKnownHeader::SetCookie, QNetworkRequest::KnownHeaders::SetCookieHeader },
+ { QHttpHeaders::WellKnownHeader::UserAgent, QNetworkRequest::KnownHeaders::UserAgentHeader }
+};
- // no default:
- // if new values are added, this will generate a compiler warning
- }
+static_assert(std::size(knownHeadersArr) == size_t(QNetworkRequest::KnownHeaders::NumKnownHeaders));
+static_assert(q20::is_sorted(std::begin(knownHeadersArr), std::end(knownHeadersArr)));
- return QByteArray();
+static std::optional<QNetworkRequest::KnownHeaders> toKnownHeader(QHttpHeaders::WellKnownHeader key)
+{
+ const auto it = std::lower_bound(std::begin(knownHeadersArr), std::end(knownHeadersArr), key);
+ if (it == std::end(knownHeadersArr) || key < *it)
+ return std::nullopt;
+ return it->knownHeader;
}
-static QByteArray makeCookieHeader(const QVariant &value, QNetworkCookie::RawForm type, QByteArrayView separator)
+static std::optional<QHttpHeaders::WellKnownHeader> toWellKnownHeader(QNetworkRequest::KnownHeaders key)
{
- QList<QNetworkCookie> cookies = qvariant_cast<QList<QNetworkCookie> >(value);
- if (cookies.isEmpty() && value.userType() == qMetaTypeId<QNetworkCookie>())
- cookies << qvariant_cast<QNetworkCookie>(value);
+ auto pred = [key](const HeaderPair &pair) { return pair.knownHeader == key; };
+ const auto it = std::find_if(std::begin(knownHeadersArr), std::end(knownHeadersArr), pred);
+ if (it == std::end(knownHeadersArr))
+ return std::nullopt;
+ return it->wellKnownHeader;
+}
+static QByteArray makeCookieHeader(const QList<QNetworkCookie> &cookies,
+ QNetworkCookie::RawForm type,
+ QByteArrayView separator)
+{
QByteArray result;
- for (const QNetworkCookie &cookie : std::as_const(cookies)) {
+ for (const QNetworkCookie &cookie : cookies) {
result += cookie.toRawForm(type);
result += separator;
}
@@ -1142,6 +1162,15 @@ static QByteArray makeCookieHeader(const QVariant &value, QNetworkCookie::RawFor
return result;
}
+static QByteArray makeCookieHeader(const QVariant &value, QNetworkCookie::RawForm type,
+ QByteArrayView separator)
+{
+ const QList<QNetworkCookie> *cookies = get_if<QList<QNetworkCookie>>(&value);
+ if (!cookies)
+ return {};
+ return makeCookieHeader(*cookies, type, separator);
+}
+
static QByteArray headerValue(QNetworkRequest::KnownHeaders header, const QVariant &value)
{
switch (header) {
@@ -1182,9 +1211,10 @@ static QByteArray headerValue(QNetworkRequest::KnownHeaders header, const QVaria
case QNetworkRequest::SetCookieHeader:
return makeCookieHeader(value, QNetworkCookie::Full, ", ");
- }
- return QByteArray();
+ default:
+ Q_UNREACHABLE_RETURN({});
+ }
}
static int parseHeaderName(QByteArrayView headerName)
@@ -1245,7 +1275,7 @@ static int parseHeaderName(QByteArrayView headerName)
return -1; // nothing found
}
-static QVariant parseHttpDate(const QByteArray &raw)
+static QVariant parseHttpDate(QByteArrayView raw)
{
QDateTime dt = QNetworkHeadersPrivate::fromHttpDate(raw);
if (dt.isValid())
@@ -1253,18 +1283,18 @@ static QVariant parseHttpDate(const QByteArray &raw)
return QVariant(); // transform an invalid QDateTime into a null QVariant
}
-static QVariant parseCookieHeader(QByteArrayView raw)
+static QList<QNetworkCookie> parseCookieHeader(QByteArrayView raw)
{
QList<QNetworkCookie> result;
for (auto cookie : QLatin1StringView(raw).tokenize(';'_L1)) {
QList<QNetworkCookie> parsed = QNetworkCookie::parseCookies(cookie.trimmed());
if (parsed.size() != 1)
- return QVariant(); // invalid Cookie: header
+ return {}; // invalid Cookie: header
result += parsed;
}
- return QVariant::fromValue(result);
+ return result;
}
static QVariant parseETag(QByteArrayView raw)
@@ -1280,7 +1310,7 @@ static QVariant parseETag(QByteArrayView raw)
}
template<typename T>
-static QVariant parseMatchImpl(QByteArrayView raw, T op)
+static QStringList parseMatchImpl(QByteArrayView raw, T op)
{
const QByteArrayView trimmedRaw = raw.trimmed();
if (trimmedRaw == "*")
@@ -1295,14 +1325,14 @@ static QVariant parseMatchImpl(QByteArrayView raw, T op)
}
-static QVariant parseIfMatch(QByteArrayView raw)
+static QStringList parseIfMatch(QByteArrayView raw)
{
return parseMatchImpl(raw, [](QByteArrayView element) {
return element.startsWith('"') && element.endsWith('"');
});
}
-static QVariant parseIfNoneMatch(QByteArrayView raw)
+static QStringList parseIfNoneMatch(QByteArrayView raw)
{
return parseMatchImpl(raw, [](QByteArrayView element) {
return (element.startsWith('"') || element.startsWith(R"(W/")")) && element.endsWith('"');
@@ -1310,7 +1340,7 @@ static QVariant parseIfNoneMatch(QByteArrayView raw)
}
-static QVariant parseHeaderValue(QNetworkRequest::KnownHeaders header, const QByteArray &value)
+static QVariant parseHeaderValue(QNetworkRequest::KnownHeaders header, QByteArrayView value)
{
// header is always a valid value
switch (header) {
@@ -1350,40 +1380,127 @@ static QVariant parseHeaderValue(QNetworkRequest::KnownHeaders header, const QBy
return parseIfNoneMatch(value);
case QNetworkRequest::CookieHeader:
- return parseCookieHeader(value);
+ return QVariant::fromValue(parseCookieHeader(value));
case QNetworkRequest::SetCookieHeader:
return QVariant::fromValue(QNetworkCookie::parseCookies(value));
default:
- Q_ASSERT(0);
+ Q_UNREACHABLE_RETURN({});
+ }
+}
+
+static QVariant parseHeaderValue(QNetworkRequest::KnownHeaders header, QList<QByteArray> values)
+{
+ if (values.empty())
+ return QVariant();
+
+ // header is always a valid value
+ switch (header) {
+ case QNetworkRequest::IfMatchHeader: {
+ QStringList res;
+ for (const auto &val : values)
+ res << parseIfMatch(val);
+ return res;
+ }
+ case QNetworkRequest::IfNoneMatchHeader: {
+ QStringList res;
+ for (const auto &val : values)
+ res << parseIfNoneMatch(val);
+ return res;
+ }
+ case QNetworkRequest::CookieHeader: {
+ auto listOpt = QNetworkHeadersPrivate::toCookieList(values);
+ return listOpt.has_value() ? QVariant::fromValue(listOpt.value()) : QVariant();
+ }
+ case QNetworkRequest::SetCookieHeader: {
+ QList<QNetworkCookie> res;
+ for (const auto &val : values)
+ res << QNetworkCookie::parseCookies(val);
+ return QVariant::fromValue(res);
+ }
+ default:
+ return parseHeaderValue(header, values.first());
}
return QVariant();
}
-QNetworkHeadersPrivate::RawHeadersList::ConstIterator
-QNetworkHeadersPrivate::findRawHeader(QAnyStringView key) const
+static bool isSetCookie(QByteArrayView name)
{
- auto isKeyEqual = [key](const auto &headerPair)
- {
- QLatin1StringView name{headerPair.first};
- return QAnyStringView::compare(name, key, Qt::CaseInsensitive) == 0;
- };
- return std::find_if(rawHeaders.begin(), rawHeaders.end(), isKeyEqual);
+ return name.compare(QHttpHeaders::wellKnownHeaderName(QHttpHeaders::WellKnownHeader::SetCookie),
+ Qt::CaseInsensitive) == 0;
}
-QNetworkHeadersPrivate::RawHeadersList QNetworkHeadersPrivate::allRawHeaders() const
+static bool isSetCookie(QHttpHeaders::WellKnownHeader name)
{
- return rawHeaders;
+ return name == QHttpHeaders::WellKnownHeader::SetCookie;
+}
+
+template<class HeaderName>
+static void setFromRawHeader(QHttpHeaders &headers, HeaderName header,
+ QByteArrayView value)
+{
+ headers.removeAll(header);
+
+ if (value.isNull())
+ // only wanted to erase key
+ return;
+
+ if (isSetCookie(header)) {
+ for (auto cookie : QLatin1StringView(value).tokenize('\n'_L1))
+ headers.append(QHttpHeaders::WellKnownHeader::SetCookie, cookie);
+ } else {
+ headers.append(header, value);
+ }
+}
+
+const QNetworkHeadersPrivate::RawHeadersList &QNetworkHeadersPrivate::allRawHeaders() const
+{
+ if (rawHeaderCache.isCached)
+ return rawHeaderCache.headersList;
+
+ rawHeaderCache.headersList = fromHttpToRaw(httpHeaders);
+ rawHeaderCache.isCached = true;
+ return rawHeaderCache.headersList;
}
QList<QByteArray> QNetworkHeadersPrivate::rawHeadersKeys() const
{
+ if (httpHeaders.isEmpty())
+ return {};
+
QList<QByteArray> result;
- result.reserve(rawHeaders.size());
- for (const auto &pair : rawHeaders)
- result << pair.first;
+ result.reserve(httpHeaders.size());
+ QDuplicateTracker<QByteArray> seen(httpHeaders.size());
+
+ for (qsizetype i = 0; i < httpHeaders.size(); i++) {
+ const auto nameL1 = httpHeaders.nameAt(i);
+ const auto name = QByteArray(nameL1.data(), nameL1.size());
+ if (seen.hasSeen(name))
+ continue;
+
+ result << name;
+ }
+
+ return result;
+}
+QByteArray QNetworkHeadersPrivate::rawHeader(QAnyStringView headerName) const
+{
+ QByteArrayView setCookieStr = QHttpHeaders::wellKnownHeaderName(
+ QHttpHeaders::WellKnownHeader::SetCookie);
+ if (QAnyStringView::compare(headerName, setCookieStr, Qt::CaseInsensitive) != 0)
+ return httpHeaders.combinedValue(headerName);
+
+ QByteArray result;
+ const char* separator = "";
+ for (qsizetype i = 0; i < httpHeaders.size(); ++i) {
+ if (QAnyStringView::compare(httpHeaders.nameAt(i), headerName, Qt::CaseInsensitive) == 0) {
+ result.append(separator);
+ result.append(httpHeaders.valueAt(i));
+ separator = "\n";
+ }
+ }
return result;
}
@@ -1393,51 +1510,39 @@ void QNetworkHeadersPrivate::setRawHeader(const QByteArray &key, const QByteArra
// refuse to accept an empty raw header
return;
- setRawHeaderInternal(key, value);
+ setFromRawHeader(httpHeaders, key, value);
parseAndSetHeader(key, value);
-}
-
-/*!
- \internal
- Sets the internal raw headers list to match \a list. The cooked headers
- will also be updated.
- If \a list contains duplicates, they will be stored, but only the first one
- is usually accessed.
-*/
-void QNetworkHeadersPrivate::setAllRawHeaders(const RawHeadersList &list)
-{
- cookedHeaders.clear();
- rawHeaders = list;
-
- for (const auto &[key, value] : std::as_const(rawHeaders))
- parseAndSetHeader(key, value);
+ invalidateHeaderCache();
}
void QNetworkHeadersPrivate::setCookedHeader(QNetworkRequest::KnownHeaders header,
const QVariant &value)
{
- QByteArray name = headerName(header);
- if (name.isEmpty()) {
- // headerName verifies that \a header is a known value
+ const auto wellKnownOpt = toWellKnownHeader(header);
+ if (!wellKnownOpt) {
+ // verifies that \a header is a known value
qWarning("QNetworkRequest::setHeader: invalid header value KnownHeader(%d) received", header);
return;
}
if (value.isNull()) {
- setRawHeaderInternal(name, QByteArray());
+ httpHeaders.removeAll(wellKnownOpt.value());
cookedHeaders.remove(header);
} else {
QByteArray rawValue = headerValue(header, value);
if (rawValue.isEmpty()) {
qWarning("QNetworkRequest::setHeader: QVariant of type %s cannot be used with header %s",
- value.typeName(), name.constData());
+ value.typeName(),
+ QHttpHeaders::wellKnownHeaderName(wellKnownOpt.value()).constData());
return;
}
- setRawHeaderInternal(name, rawValue);
+ setFromRawHeader(httpHeaders, wellKnownOpt.value(), rawValue);
cookedHeaders.insert(header, value);
}
+
+ invalidateHeaderCache();
}
QHttpHeaders QNetworkHeadersPrivate::headers() const
@@ -1448,58 +1553,58 @@ QHttpHeaders QNetworkHeadersPrivate::headers() const
void QNetworkHeadersPrivate::setHeaders(const QHttpHeaders &newHeaders)
{
httpHeaders = newHeaders;
+ setCookedFromHttp(httpHeaders);
+ invalidateHeaderCache();
}
void QNetworkHeadersPrivate::setHeaders(QHttpHeaders &&newHeaders)
{
httpHeaders = std::move(newHeaders);
+ setCookedFromHttp(httpHeaders);
+ invalidateHeaderCache();
}
void QNetworkHeadersPrivate::setHeader(QHttpHeaders::WellKnownHeader name, QByteArrayView value)
{
httpHeaders.replaceOrAppend(name, value);
+
+ // set cooked header
+ const auto knownHeaderOpt = toKnownHeader(name);
+ if (knownHeaderOpt)
+ parseAndSetHeader(knownHeaderOpt.value(), value);
+
+ invalidateHeaderCache();
}
void QNetworkHeadersPrivate::clearHeaders()
{
httpHeaders.clear();
- rawHeaders.clear();
cookedHeaders.clear();
+ invalidateHeaderCache();
}
-void QNetworkHeadersPrivate::setRawHeaderInternal(const QByteArray &key, const QByteArray &value)
-{
- auto firstEqualsKey = [&key](const RawHeaderPair &header) {
- return header.first.compare(key, Qt::CaseInsensitive) == 0;
- };
- rawHeaders.removeIf(firstEqualsKey);
-
- if (value.isNull())
- return; // only wanted to erase key
-
- RawHeaderPair pair;
- pair.first = key;
- pair.second = value;
- rawHeaders.append(pair);
-}
-
-void QNetworkHeadersPrivate::parseAndSetHeader(const QByteArray &key, const QByteArray &value)
+void QNetworkHeadersPrivate::parseAndSetHeader(QByteArrayView key, QByteArrayView value)
{
// is it a known header?
const int parsedKeyAsInt = parseHeaderName(key);
if (parsedKeyAsInt != -1) {
const QNetworkRequest::KnownHeaders parsedKey
= static_cast<QNetworkRequest::KnownHeaders>(parsedKeyAsInt);
- if (value.isNull()) {
- cookedHeaders.remove(parsedKey);
- } else if (parsedKey == QNetworkRequest::ContentLengthHeader
- && cookedHeaders.contains(QNetworkRequest::ContentLengthHeader)) {
- // Only set the cooked header "Content-Length" once.
- // See bug QTBUG-15311
- } else {
- cookedHeaders.insert(parsedKey, parseHeaderValue(parsedKey, value));
- }
+ parseAndSetHeader(parsedKey, value);
+ }
+}
+void QNetworkHeadersPrivate::parseAndSetHeader(QNetworkRequest::KnownHeaders key,
+ QByteArrayView value)
+{
+ if (value.isNull()) {
+ cookedHeaders.remove(key);
+ } else if (key == QNetworkRequest::ContentLengthHeader
+ && cookedHeaders.contains(QNetworkRequest::ContentLengthHeader)) {
+ // Only set the cooked header "Content-Length" once.
+ // See bug QTBUG-15311
+ } else {
+ cookedHeaders.insert(key, parseHeaderValue(key, value));
}
}
@@ -1553,7 +1658,7 @@ static int name_to_month(const char* month_str)
return 0;
}
-QDateTime QNetworkHeadersPrivate::fromHttpDate(const QByteArray &value)
+QDateTime QNetworkHeadersPrivate::fromHttpDate(QByteArrayView value)
{
// HTTP dates have three possible formats:
// RFC 1123/822 - ddd, dd MMM yyyy hh:mm:ss "GMT"
@@ -1602,7 +1707,8 @@ QByteArray QNetworkHeadersPrivate::toHttpDate(const QDateTime &dt)
return QLocale::c().toString(dt.toUTC(), u"ddd, dd MMM yyyy hh:mm:ss 'GMT'").toLatin1();
}
-QNetworkHeadersPrivate::RawHeadersList QNetworkHeadersPrivate::fromHttpToRaw(const QHttpHeaders &headers)
+QNetworkHeadersPrivate::RawHeadersList QNetworkHeadersPrivate::fromHttpToRaw(
+ const QHttpHeaders &headers)
{
if (headers.isEmpty())
return {};
@@ -1655,6 +1761,83 @@ QHttpHeaders QNetworkHeadersPrivate::fromRawToHttp(const RawHeadersList &raw)
return headers;
}
+std::optional<qint64> QNetworkHeadersPrivate::toInt(QByteArrayView value)
+{
+ if (value.empty())
+ return std::nullopt;
+
+ bool ok;
+ qint64 res = value.toLongLong(&ok);
+ if (ok)
+ return res;
+ return std::nullopt;
+}
+
+std::optional<QNetworkHeadersPrivate::NetworkCookieList> QNetworkHeadersPrivate::toSetCookieList(
+ const QList<QByteArray> &values)
+{
+ if (values.empty())
+ return std::nullopt;
+
+ QList<QNetworkCookie> cookies;
+ for (const auto &s : values)
+ cookies += QNetworkCookie::parseCookies(s);
+
+ if (cookies.empty())
+ return std::nullopt;
+ return cookies;
+}
+
+QByteArray QNetworkHeadersPrivate::fromCookieList(const QList<QNetworkCookie> &cookies)
+{
+ return makeCookieHeader(cookies, QNetworkCookie::NameAndValueOnly, "; ");
+}
+
+std::optional<QNetworkHeadersPrivate::NetworkCookieList> QNetworkHeadersPrivate::toCookieList(
+ const QList<QByteArray> &values)
+{
+ if (values.empty())
+ return std::nullopt;
+
+ QList<QNetworkCookie> cookies;
+ for (const auto &s : values)
+ cookies += parseCookieHeader(s);
+
+ if (cookies.empty())
+ return std::nullopt;
+ return cookies;
+}
+
+void QNetworkHeadersPrivate::invalidateHeaderCache()
+{
+ rawHeaderCache.headersList.clear();
+ rawHeaderCache.isCached = false;
+}
+
+void QNetworkHeadersPrivate::setCookedFromHttp(const QHttpHeaders &newHeaders)
+{
+ cookedHeaders.clear();
+
+ QMap<QNetworkRequest::KnownHeaders, QList<QByteArray>> multipleHeadersMap;
+ for (int i = 0; i < newHeaders.size(); ++i) {
+ const auto name = newHeaders.nameAt(i);
+ const auto value = newHeaders.valueAt(i);
+
+ const int parsedKeyAsInt = parseHeaderName(name);
+ if (parsedKeyAsInt == -1)
+ continue;
+
+ const QNetworkRequest::KnownHeaders parsedKey
+ = static_cast<QNetworkRequest::KnownHeaders>(parsedKeyAsInt);
+
+ auto &list = multipleHeadersMap[parsedKey];
+ list.append(value.toByteArray());
+ }
+
+ for (auto i = multipleHeadersMap.cbegin(), end = multipleHeadersMap.cend(); i != end; ++i)
+ cookedHeaders.insert(i.key(), parseHeaderValue(i.key(), i.value()));
+}
+
QT_END_NAMESPACE
#include "moc_qnetworkrequest.cpp"
diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h
index 875c787673..368eb99d95 100644
--- a/src/network/access/qnetworkrequest.h
+++ b/src/network/access/qnetworkrequest.h
@@ -35,7 +35,8 @@ public:
IfModifiedSinceHeader,
ETagHeader,
IfMatchHeader,
- IfNoneMatchHeader
+ IfNoneMatchHeader,
+ NumKnownHeaders
};
Q_ENUM(KnownHeaders)
@@ -69,6 +70,7 @@ public:
ConnectionCacheExpiryTimeoutSecondsAttribute,
Http2CleartextAllowedAttribute,
UseCredentialsAttribute,
+ FullLocalServerNameAttribute,
User = 1000,
UserMax = 32767
diff --git a/src/network/access/qnetworkrequest_p.h b/src/network/access/qnetworkrequest_p.h
index a73d8f2162..7268e1a4aa 100644
--- a/src/network/access/qnetworkrequest_p.h
+++ b/src/network/access/qnetworkrequest_p.h
@@ -27,6 +27,8 @@
QT_BEGIN_NAMESPACE
+class QNetworkCookie;
+
// this is the common part between QNetworkRequestPrivate, QNetworkReplyPrivate and QHttpPartPrivate
class QNetworkHeadersPrivate
{
@@ -36,17 +38,20 @@ public:
typedef QHash<QNetworkRequest::KnownHeaders, QVariant> CookedHeadersMap;
typedef QHash<QNetworkRequest::Attribute, QVariant> AttributesMap;
- RawHeadersList rawHeaders;
+ mutable struct {
+ RawHeadersList headersList;
+ bool isCached = false;
+ } rawHeaderCache;
+
QHttpHeaders httpHeaders;
CookedHeadersMap cookedHeaders;
AttributesMap attributes;
QPointer<QObject> originatingObject;
- RawHeadersList::ConstIterator findRawHeader(QAnyStringView key) const;
- RawHeadersList allRawHeaders() const;
+ const RawHeadersList &allRawHeaders() const;
QList<QByteArray> rawHeadersKeys() const;
+ QByteArray rawHeader(QAnyStringView headerName) const;
void setRawHeader(const QByteArray &key, const QByteArray &value);
- void setAllRawHeaders(const RawHeadersList &list);
void setCookedHeader(QNetworkRequest::KnownHeaders header, const QVariant &value);
QHttpHeaders headers() const;
@@ -56,15 +61,26 @@ public:
void clearHeaders();
- static QDateTime fromHttpDate(const QByteArray &value);
+ static QDateTime fromHttpDate(QByteArrayView value);
static QByteArray toHttpDate(const QDateTime &dt);
+ static std::optional<qint64> toInt(QByteArrayView value);
+
+ typedef QList<QNetworkCookie> NetworkCookieList;
+ static QByteArray fromCookieList(const NetworkCookieList &cookies);
+ static std::optional<NetworkCookieList> toSetCookieList(const QList<QByteArray> &values);
+ static std::optional<NetworkCookieList> toCookieList(const QList<QByteArray> &values);
+
static RawHeadersList fromHttpToRaw(const QHttpHeaders &headers);
static QHttpHeaders fromRawToHttp(const RawHeadersList &raw);
private:
- void setRawHeaderInternal(const QByteArray &key, const QByteArray &value);
- void parseAndSetHeader(const QByteArray &key, const QByteArray &value);
+ void invalidateHeaderCache();
+
+ void setCookedFromHttp(const QHttpHeaders &newHeaders);
+ void parseAndSetHeader(QByteArrayView key, QByteArrayView value);
+ void parseAndSetHeader(QNetworkRequest::KnownHeaders key, QByteArrayView value);
+
};
Q_DECLARE_TYPEINFO(QNetworkHeadersPrivate::RawHeaderPair, Q_RELOCATABLE_TYPE);
diff --git a/src/network/access/qnetworkrequestfactory.cpp b/src/network/access/qnetworkrequestfactory.cpp
index 87738d9086..d9c536cef2 100644
--- a/src/network/access/qnetworkrequestfactory.cpp
+++ b/src/network/access/qnetworkrequestfactory.cpp
@@ -615,17 +615,11 @@ QNetworkRequest QNetworkRequestFactoryPrivate::newRequest(const QUrl &url) const
if (!sslConfig.isNull())
request.setSslConfiguration(sslConfig);
#endif
- // Set the header entries to the request. Combine values as there
- // may be multiple values per name. Note: this would not necessarily
- // produce right result for 'Set-Cookie' header if it has multiple values,
- // but since it is a purely server-side (response) header, not relevant here.
- const auto headerNames = headers.toMultiMap().uniqueKeys(); // ### fixme: port QNR to QHH
- for (const auto &name : headerNames)
- request.setRawHeader(name, headers.combinedValue(name));
-
+ auto h = headers;
constexpr char Bearer[] = "Bearer ";
if (!bearerToken.isEmpty())
- request.setRawHeader("Authorization"_ba, Bearer + bearerToken);
+ h.replaceOrAppend(QHttpHeaders::WellKnownHeader::Authorization, Bearer + bearerToken);
+ request.setHeaders(std::move(h));
request.setTransferTimeout(transferTimeout);
request.setPriority(priority);
diff --git a/src/network/access/qrestaccessmanager_p.h b/src/network/access/qrestaccessmanager_p.h
index 51af299f5c..2e6c1afb90 100644
--- a/src/network/access/qrestaccessmanager_p.h
+++ b/src/network/access/qrestaccessmanager_p.h
@@ -61,10 +61,12 @@ public:
return warnNoAccessManager();
verifyThreadAffinity(context);
QNetworkRequest req(request);
- if (!request.header(QNetworkRequest::ContentTypeHeader).isValid()) {
- req.setHeader(QNetworkRequest::ContentTypeHeader,
- QLatin1StringView{"application/json"});
+ auto h = req.headers();
+ if (!h.contains(QHttpHeaders::WellKnownHeader::ContentType)) {
+ h.append(QHttpHeaders::WellKnownHeader::ContentType,
+ QLatin1StringView{"application/json"});
}
+ req.setHeaders(std::move(h));
QNetworkReply *reply = requestOperation(qnam, req, jsonDoc.toJson(QJsonDocument::Compact));
return createActiveRequest(reply, context, slot);
}
diff --git a/src/network/access/qrestreply.cpp b/src/network/access/qrestreply.cpp
index cdd264ba6e..2d8d101084 100644
--- a/src/network/access/qrestreply.cpp
+++ b/src/network/access/qrestreply.cpp
@@ -335,7 +335,7 @@ QDebug operator<<(QDebug debug, const QRestReply &reply)
<< ", bytesAvailable = " << reply.networkReply()->bytesAvailable()
<< ", url " << reply.networkReply()->url()
<< ", operation = " << operationName(reply.networkReply()->operation())
- << ", reply headers = " << reply.networkReply()->rawHeaderPairs()
+ << ", reply headers = " << reply.networkReply()->headers()
<< ")";
return debug;
}
@@ -596,7 +596,7 @@ QByteArray QRestReplyPrivate::contentCharset(const QNetworkReply* reply)
// text/plain; charset ="utf-8"
const QByteArray contentTypeValue =
- reply->header(QNetworkRequest::KnownHeaders::ContentTypeHeader).toByteArray();
+ reply->headers().value(QHttpHeaders::WellKnownHeader::ContentType).toByteArray();
const auto r = parse_content_type(contentTypeValue);
if (r && !r.charset.empty())
diff --git a/src/network/android/jar/build.gradle b/src/network/android/jar/build.gradle
index 68a9381ad2..ea6d06c257 100644
--- a/src/network/android/jar/build.gradle
+++ b/src/network/android/jar/build.gradle
@@ -7,7 +7,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:8.0.2'
+ classpath 'com.android.tools.build:gradle:8.4.0'
}
}
@@ -26,7 +26,7 @@ android {
compileSdk 34
defaultConfig {
- minSdkVersion 23
+ minSdkVersion 28
}
sourceSets {
diff --git a/src/network/compat/removed_api.cpp b/src/network/compat/removed_api.cpp
index 86951d9222..ceda117538 100644
--- a/src/network/compat/removed_api.cpp
+++ b/src/network/compat/removed_api.cpp
@@ -58,6 +58,9 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
#if QT_NETWORK_REMOVED_SINCE(6, 8)
+#if QT_CONFIG(dnslookup)
+# include "qdnslookup.h" // inlined API
+#endif
#include "qnetworkrequest.h" // inlined API
// #include "qotherheader.h"
diff --git a/src/network/kernel/qdnslookup.cpp b/src/network/kernel/qdnslookup.cpp
index c310c7e28e..1b4db7130b 100644
--- a/src/network/kernel/qdnslookup.cpp
+++ b/src/network/kernel/qdnslookup.cpp
@@ -8,14 +8,22 @@
#include <qapplicationstatic.h>
#include <qcoreapplication.h>
#include <qdatetime.h>
+#include <qendian.h>
#include <qloggingcategory.h>
#include <qrandom.h>
+#include <qspan.h>
#include <qurl.h>
+#if QT_CONFIG(ssl)
+# include <qsslsocket.h>
+#endif
+
#include <algorithm>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static Q_LOGGING_CATEGORY(lcDnsLookup, "qt.network.dnslookup", QtCriticalMsg)
namespace {
@@ -159,6 +167,42 @@ static void qt_qdnsservicerecord_sort(QList<QDnsServiceRecord> &records)
\note If you simply want to find the IP address(es) associated with a host
name, or the host name associated with an IP address you should use
QHostInfo instead.
+
+ \section1 DNS-over-TLS and Authentic Data
+
+ QDnsLookup supports DNS-over-TLS (DoT, as specified by \l{RFC 7858}) on
+ some platforms. That currently includes all Unix platforms where regular
+ queries are supported, if \l QSslSocket support is present in Qt. To query
+ if support is present at runtime, use isProtocolSupported().
+
+ When using DNS-over-TLS, QDnsLookup only implements the "Opportunistic
+ Privacy Profile" method of authentication, as described in \l{RFC 7858}
+ section 4.1. In this mode, QDnsLookup (through \l QSslSocket) only
+ validates that the server presents a certificate that is valid for the
+ server being connected to. Clients may use setSslConfiguration() to impose
+ additional restrictions and sslConfiguration() to obtain information after
+ the query is complete.
+
+ QDnsLookup will request DNS servers queried over TLS to perform
+ authentication on the data they return. If they confirm the data is valid,
+ the \l authenticData property will be set to true. QDnsLookup does not
+ verify the integrity of the data by itself, so applications should only
+ trust this property on servers they have confirmed through other means to
+ be trustworthy.
+
+ \section2 Authentic Data without TLS
+
+ QDnsLookup request Authentic Data for any server set with setNameserver(),
+ even if TLS encryption is not required. This is useful when querying a
+ caching nameserver on the same host as the application or on a trusted
+ network. Though similar to the TLS case, the application is responsible for
+ determining if the server it chose to use is trustworthy, and if the
+ unencrypted connection cannot be tampered with.
+
+ QDnsLookup obeys the system configuration to request Authentic Data on the
+ default nameserver (that is, if setNameserver() is not called). This is
+ currently only supported on Linux systems using glibc 2.31 or later. On any
+ other systems, QDnsLookup will ignore the AD bit in the query header.
*/
/*!
@@ -213,10 +257,72 @@ static void qt_qdnsservicerecord_sort(QList<QDnsServiceRecord> &records)
\value SRV service records.
+ \value[since 6.8] TLSA TLS association records.
+
\value TXT text records.
*/
/*!
+ \enum QDnsLookup::Protocol
+
+ Indicates the type of DNS server that is being queried.
+
+ \value Standard
+ Regular, unencrypted DNS, using UDP and falling back to TCP as necessary
+ (default port: 53)
+
+ \value DnsOverTls
+ Encrypted DNS over TLS (DoT, as specified by \l{RFC 7858}), over TCP
+ (default port: 853)
+
+ \sa isProtocolSupported(), nameserverProtocol, setNameserver()
+*/
+
+/*!
+ \since 6.8
+
+ Returns true if DNS queries using \a protocol are supported with QDnsLookup.
+
+ \sa nameserverProtocol
+*/
+bool QDnsLookup::isProtocolSupported(Protocol protocol)
+{
+#if QT_CONFIG(libresolv) || defined(Q_OS_WIN)
+ switch (protocol) {
+ case QDnsLookup::Standard:
+ return true;
+ case QDnsLookup::DnsOverTls:
+# if QT_CONFIG(ssl)
+ if (QSslSocket::supportsSsl())
+ return true;
+# endif
+ return false;
+ }
+#else
+ Q_UNUSED(protocol)
+#endif
+ return false;
+}
+
+/*!
+ \since 6.8
+
+ Returns the standard (default) port number for the protocol \a protocol.
+
+ \sa isProtocolSupported()
+*/
+quint16 QDnsLookup::defaultPortForProtocol(Protocol protocol) noexcept
+{
+ switch (protocol) {
+ case QDnsLookup::Standard:
+ return DnsPort;
+ case QDnsLookup::DnsOverTls:
+ return DnsOverTlsPort;
+ }
+ return 0; // will probably fail somewhere
+}
+
+/*!
\fn void QDnsLookup::finished()
This signal is emitted when the reply has finished processing.
@@ -270,7 +376,7 @@ QDnsLookup::QDnsLookup(Type type, const QString &name, QObject *parent)
*/
QDnsLookup::QDnsLookup(Type type, const QString &name, const QHostAddress &nameserver, QObject *parent)
- : QDnsLookup(type, name, nameserver, DnsPort, parent)
+ : QDnsLookup(type, name, nameserver, 0, parent)
{
}
@@ -285,8 +391,9 @@ QDnsLookup::QDnsLookup(Type type, const QString &name, const QHostAddress &names
//! [nameserver-port]
\note Setting the port number to any value other than the default (53) can
cause the name resolution to fail, depending on the operating system
- limitations and firewalls. Notably, the Windows API used by QDnsLookup is
- unable to handle alternate port numbers.
+ limitations and firewalls, if the nameserverProtocol() to be used
+ QDnsLookup::Standard. Notably, the Windows API used by QDnsLookup is unable
+ to handle alternate port numbers.
//! [nameserver-port]
*/
QDnsLookup::QDnsLookup(Type type, const QString &name, const QHostAddress &nameserver, quint16 port, QObject *parent)
@@ -300,6 +407,30 @@ QDnsLookup::QDnsLookup(Type type, const QString &name, const QHostAddress &names
}
/*!
+ \since 6.8
+
+ Constructs a QDnsLookup object to issue a query for \a name of record type
+ \a type, using the DNS server \a nameserver running on port \a port, and
+ sets \a parent as the parent object.
+
+ The query will be sent using \a protocol, if supported. Use
+ isProtocolSupported() to check if it is supported.
+
+ \include qdnslookup.cpp nameserver-port
+*/
+QDnsLookup::QDnsLookup(Type type, const QString &name, Protocol protocol,
+ const QHostAddress &nameserver, quint16 port, QObject *parent)
+ : QObject(*new QDnsLookupPrivate, parent)
+{
+ Q_D(QDnsLookup);
+ d->name = name;
+ d->type = type;
+ d->nameserver = nameserver;
+ d->port = port;
+ d->protocol = protocol;
+}
+
+/*!
Destroys the QDnsLookup object.
It is safe to delete a QDnsLookup object even if it is not finished, you
@@ -311,6 +442,28 @@ QDnsLookup::~QDnsLookup()
}
/*!
+ \since 6.8
+ \property QDnsLookup::authenticData
+ \brief whether the reply was authenticated by the resolver.
+
+ QDnsLookup does not perform the authentication itself. Instead, it trusts
+ the name server that was queried to perform the authentication and report
+ it. The application is responsible for determining if any servers it
+ configured with setNameserver() are trustworthy; if no server was set,
+ QDnsLookup obeys system configuration on whether responses should be
+ trusted.
+
+ This property may be set even if error() indicates a resolver error
+ occurred.
+
+ \sa setNameserver(), nameserverProtocol()
+*/
+bool QDnsLookup::isAuthenticData() const
+{
+ return d_func()->reply.authenticData;
+}
+
+/*!
\property QDnsLookup::error
\brief the type of error that occurred if the DNS lookup failed, or NoError.
*/
@@ -416,6 +569,10 @@ QBindable<QHostAddress> QDnsLookup::bindableNameserver()
\property QDnsLookup::nameserverPort
\since 6.6
\brief the port number of nameserver to use for DNS lookup.
+
+ The value of 0 indicates that QDnsLookup should use the default port for
+ the nameserverProtocol().
+
\include qdnslookup.cpp nameserver-port
*/
@@ -437,18 +594,44 @@ QBindable<quint16> QDnsLookup::bindableNameserverPort()
}
/*!
+ \property QDnsLookup::nameserverProtocol
+ \since 6.8
+ \brief the protocol to use when sending the DNS query
+
+ \sa isProtocolSupported()
+*/
+QDnsLookup::Protocol QDnsLookup::nameserverProtocol() const
+{
+ return d_func()->protocol;
+}
+
+void QDnsLookup::setNameserverProtocol(Protocol protocol)
+{
+ d_func()->protocol = protocol;
+}
+
+QBindable<QDnsLookup::Protocol> QDnsLookup::bindableNameserverProtocol()
+{
+ return &d_func()->protocol;
+}
+
+/*!
+ \fn void QDnsLookup::setNameserver(const QHostAddress &nameserver, quint16 port)
\since 6.6
+
Sets the nameserver to \a nameserver and the port to \a port.
\include qdnslookup.cpp nameserver-port
\sa QDnsLookup::nameserver, QDnsLookup::nameserverPort
*/
-void QDnsLookup::setNameserver(const QHostAddress &nameserver, quint16 port)
+
+void QDnsLookup::setNameserver(Protocol protocol, const QHostAddress &nameserver, quint16 port)
{
Qt::beginPropertyUpdateGroup();
setNameserver(nameserver);
setNameserverPort(port);
+ setNameserverProtocol(protocol);
Qt::endPropertyUpdateGroup();
}
@@ -524,6 +707,46 @@ QList<QDnsTextRecord> QDnsLookup::textRecords() const
}
/*!
+ \since 6.8
+ Returns the list of TLS association records associated with this lookup.
+
+ According to the standards relating to DNS-based Authentication of Named
+ Entities (DANE), this field should be ignored and must not be used for
+ verifying the authentity of a given server if the authenticity of the DNS
+ reply cannot itself be confirmed. See isAuthenticData() for more
+ information.
+ */
+QList<QDnsTlsAssociationRecord> QDnsLookup::tlsAssociationRecords() const
+{
+ return d_func()->reply.tlsAssociationRecords;
+}
+
+#if QT_CONFIG(ssl)
+/*!
+ \since 6.8
+ Sets the \a sslConfiguration to use for outgoing DNS-over-TLS connections.
+
+ \sa sslConfiguration(), QSslSocket::setSslConfiguration()
+*/
+void QDnsLookup::setSslConfiguration(const QSslConfiguration &sslConfiguration)
+{
+ Q_D(QDnsLookup);
+ d->sslConfiguration.emplace(sslConfiguration);
+}
+
+/*!
+ Returns the current SSL configuration.
+
+ \sa setSslConfiguration()
+*/
+QSslConfiguration QDnsLookup::sslConfiguration() const
+{
+ const Q_D(QDnsLookup);
+ return d->sslConfiguration.value_or(QSslConfiguration::defaultConfiguration());
+}
+#endif
+
+/*!
Aborts the DNS lookup operation.
If the lookup is already finished, does nothing.
@@ -565,6 +788,9 @@ void QDnsLookup::lookup()
#ifdef QDNSLOOKUP_DEBUG
qDebug("DNS reply for %s: %i (%s)", qPrintable(d->name), reply.error, qPrintable(reply.errorString));
#endif
+#if QT_CONFIG(ssl)
+ d->sslConfiguration = std::move(reply.sslConfiguration);
+#endif
d->reply = reply;
d->runnable = nullptr;
d->isFinished = true;
@@ -1052,6 +1278,223 @@ QDnsTextRecord &QDnsTextRecord::operator=(const QDnsTextRecord &other)
very fast and never fails.
*/
+/*!
+ \class QDnsTlsAssociationRecord
+ \since 6.8
+ \brief The QDnsTlsAssociationRecord class stores information about a DNS TLSA record.
+
+ \inmodule QtNetwork
+ \ingroup network
+ \ingroup shared
+
+ When performing a text lookup, zero or more records will be returned. Each
+ record is represented by a QDnsTlsAssociationRecord instance.
+
+ The meaning of the fields is defined in \l{RFC 6698}.
+
+ \sa QDnsLookup
+*/
+
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QDnsTlsAssociationRecordPrivate)
+
+/*!
+ \enum QDnsTlsAssociationRecord::CertificateUsage
+
+ This enumeration contains valid values for the certificate usage field of
+ TLS Association queries. The following list is up-to-date with \l{RFC 6698}
+ section 2.1.1 and RFC 7218 section 2.1. Please refer to those documents for
+ authoritative instructions on interpreting this enumeration.
+
+ \value CertificateAuthorityConstrait
+ Indicates the record includes an association to a specific Certificate
+ Authority that must be found in the TLS server's certificate chain and
+ must pass PKIX validation.
+
+ \value ServiceCertificateConstraint
+ Indicates the record includes an association to a certificate that must
+ match the end entity certificate provided by the TLS server and must
+ pass PKIX validation.
+
+ \value TrustAnchorAssertion
+ Indicates the record includes an association to a certificate that MUST
+ be used as the ultimate trust anchor to validate the TLS server's
+ certificate and must pass PKIX validation.
+
+ \value DomainIssuedCertificate
+ Indicates the record includes an association to a certificate that must
+ match the end entity certificate provided by the TLS server. PKIX
+ validation is not tested.
+
+ \value PrivateUse
+ No standard meaning applied.
+
+ \value PKIX_TA
+ Alias; mnemonic for Public Key Infrastructure Trust Anchor
+
+ \value PKIX_EE
+ Alias; mnemonic for Public Key Infrastructure End Entity
+
+ \value DANE_TA
+ Alias; mnemonic for DNS-based Authentication of Named Entities Trust Anchor
+
+ \value DANE_EE
+ Alias; mnemonic for DNS-based Authentication of Named Entities End Entity
+
+ \value PrivCert
+ Alias
+
+ Other values are currently reserved, but may be unreserved by future
+ standards. This enumeration can be used for those values even if no
+ enumerator is provided.
+
+ \sa certificateUsage()
+*/
+
+/*!
+ \enum QDnsTlsAssociationRecord::Selector
+
+ This enumeration contains valid values for the selector field of TLS
+ Association queries. The following list is up-to-date with \l{RFC 6698}
+ section 2.1.2 and RFC 7218 section 2.2. Please refer to those documents for
+ authoritative instructions on interpreting this enumeration.
+
+ \value FullCertificate
+ Indicates this record refers to the full certificate in its binary
+ structure form.
+
+ \value SubjectPublicKeyInfo
+ Indicates the record refers to the certificate's subject and public
+ key information, in DER-encoded binary structure form.
+
+ \value PrivateUse
+ No standard meaning applied.
+
+ \value Cert
+ Alias
+
+ \value SPKI
+ Alias
+
+ \value PrivSel
+ Alias
+
+ Other values are currently reserved, but may be unreserved by future
+ standards. This enumeration can be used for those values even if no
+ enumerator is provided.
+
+ \sa selector()
+*/
+
+/*!
+ \enum QDnsTlsAssociationRecord::MatchingType
+
+ This enumeration contains valid values for the matching type field of TLS
+ Association queries. The following list is up-to-date with \l{RFC 6698}
+ section 2.1.3 and RFC 7218 section 2.3. Please refer to those documents for
+ authoritative instructions on interpreting this enumeration.
+
+ \value Exact
+ Indicates this the certificate or SPKI data is stored verbatim in this
+ record.
+
+ \value Sha256
+ Indicates this a SHA-256 checksum of the the certificate or SPKI data
+ present in this record.
+
+ \value Sha512
+ Indicates this a SHA-512 checksum of the the certificate or SPKI data
+ present in this record.
+
+ \value PrivateUse
+ No standard meaning applied.
+
+ \value PrivMatch
+ Alias
+
+ Other values are currently reserved, but may be unreserved by future
+ standards. This enumeration can be used for those values even if no
+ enumerator is provided.
+
+ \sa matchingType()
+*/
+
+/*!
+ Constructs an empty TLS Association record.
+ */
+QDnsTlsAssociationRecord::QDnsTlsAssociationRecord()
+ : d(new QDnsTlsAssociationRecordPrivate)
+{
+}
+
+/*!
+ Constructs a copy of \a other.
+ */
+QDnsTlsAssociationRecord::QDnsTlsAssociationRecord(const QDnsTlsAssociationRecord &other) = default;
+
+/*!
+ Moves the content of \a other into this object.
+ */
+QDnsTlsAssociationRecord &
+QDnsTlsAssociationRecord::operator=(const QDnsTlsAssociationRecord &other) = default;
+
+/*!
+ Destroys this TLS Association record object.
+ */
+QDnsTlsAssociationRecord::~QDnsTlsAssociationRecord() = default;
+
+/*!
+ Returns the name of this record.
+*/
+QString QDnsTlsAssociationRecord::name() const
+{
+ return d->name;
+}
+
+/*!
+ Returns the duration in seconds for which this record is valid.
+*/
+quint32 QDnsTlsAssociationRecord::timeToLive() const
+{
+ return d->timeToLive;
+}
+
+/*!
+ Returns the certificate usage field for this record.
+ */
+QDnsTlsAssociationRecord::CertificateUsage QDnsTlsAssociationRecord::usage() const
+{
+ return d->usage;
+}
+
+/*!
+ Returns the selector field for this record.
+ */
+QDnsTlsAssociationRecord::Selector QDnsTlsAssociationRecord::selector() const
+{
+ return d->selector;
+}
+
+/*!
+ Returns the match type field for this record.
+ */
+QDnsTlsAssociationRecord::MatchingType QDnsTlsAssociationRecord::matchType() const
+{
+ return d->matchType;
+}
+
+/*!
+ Returns the binary data field for this record. The interpretation of this
+ binary data depends on the three numeric fields provided by
+ certificateUsage(), selector(), and matchType().
+
+ Do note this is a binary field, even for the checksums, similar to what
+ QCyrptographicHash::result() returns.
+ */
+QByteArray QDnsTlsAssociationRecord::value() const
+{
+ return d->value;
+}
+
static QDnsLookupRunnable::EncodedLabel encodeLabel(const QString &label)
{
QDnsLookupRunnable::EncodedLabel::value_type rootDomain = u'.';
@@ -1070,8 +1513,14 @@ inline QDnsLookupRunnable::QDnsLookupRunnable(const QDnsLookupPrivate *d)
: requestName(encodeLabel(d->name)),
nameserver(d->nameserver),
requestType(d->type),
- port(d->port)
+ port(d->port),
+ protocol(d->protocol)
{
+ if (port == 0)
+ port = QDnsLookup::defaultPortForProtocol(protocol);
+#if QT_CONFIG(ssl)
+ sslConfiguration = d->sslConfiguration;
+#endif
}
void QDnsLookupRunnable::run()
@@ -1120,12 +1569,103 @@ inline QDebug operator<<(QDebug &d, QDnsLookupRunnable *r)
if (r->requestName.size() > MaxDomainNameLength)
d << "... (truncated)";
d << " type " << r->requestType;
- if (!r->nameserver.isNull())
+ if (!r->nameserver.isNull()) {
d << " to nameserver " << qUtf16Printable(r->nameserver.toString())
- << " port " << (r->port ? r->port : DnsPort);
+ << " port " << (r->port ? r->port : QDnsLookup::defaultPortForProtocol(r->protocol));
+ switch (r->protocol) {
+ case QDnsLookup::Standard:
+ break;
+ case QDnsLookup::DnsOverTls:
+ d << " (TLS)";
+ }
+ }
return d;
}
+#if QT_CONFIG(ssl)
+static constexpr std::chrono::milliseconds DnsOverTlsConnectTimeout(15'000);
+static constexpr std::chrono::milliseconds DnsOverTlsTimeout(120'000);
+static constexpr quint8 DnsAuthenticDataBit = 0x20;
+
+static int makeReplyErrorFromSocket(QDnsLookupReply *reply, const QAbstractSocket *socket)
+{
+ QDnsLookup::Error error = [&] {
+ switch (socket->error()) {
+ case QAbstractSocket::SocketTimeoutError:
+ case QAbstractSocket::ProxyConnectionTimeoutError:
+ return QDnsLookup::TimeoutError;
+ default:
+ return QDnsLookup::ResolverError;
+ }
+ }();
+ reply->setError(error, socket->errorString());
+ return false;
+}
+
+bool QDnsLookupRunnable::sendDnsOverTls(QDnsLookupReply *reply, QSpan<unsigned char> query,
+ ReplyBuffer &response)
+{
+ QSslSocket socket;
+ socket.setSslConfiguration(sslConfiguration.value_or(QSslConfiguration::defaultConfiguration()));
+
+# if QT_CONFIG(networkproxy)
+ socket.setProtocolTag("domain-s"_L1);
+# endif
+
+ // Request the name server attempt to authenticate the reply.
+ query[3] |= DnsAuthenticDataBit;
+
+ do {
+ quint16 size = qToBigEndian<quint16>(query.size());
+ QDeadlineTimer timeout(DnsOverTlsTimeout);
+
+ socket.connectToHostEncrypted(nameserver.toString(), port);
+ socket.write(reinterpret_cast<const char *>(&size), sizeof(size));
+ socket.write(reinterpret_cast<const char *>(query.data()), query.size());
+ if (!socket.waitForEncrypted(DnsOverTlsConnectTimeout.count()))
+ break;
+
+ reply->sslConfiguration = socket.sslConfiguration();
+
+ // accumulate reply
+ auto waitForBytes = [&](void *buffer, int count) {
+ int remaining = timeout.remainingTime();
+ while (remaining >= 0 && socket.bytesAvailable() < count) {
+ if (!socket.waitForReadyRead(remaining))
+ return false;
+ }
+ return socket.read(static_cast<char *>(buffer), count) == count;
+ };
+ if (!waitForBytes(&size, sizeof(size)))
+ break;
+
+ // note: strictly speaking, we're allocating memory based on untrusted data
+ // but in practice, due to limited range of the data type (16 bits),
+ // the maximum allocation is small.
+ size = qFromBigEndian(size);
+ response.resize(size);
+ if (waitForBytes(response.data(), size)) {
+ // check if the AD bit is set; we'll trust it over TLS requests
+ if (size >= 4)
+ reply->authenticData = response[3] & DnsAuthenticDataBit;
+ return true;
+ }
+ } while (false);
+
+ // handle errors
+ return makeReplyErrorFromSocket(reply, &socket);
+}
+#else
+bool QDnsLookupRunnable::sendDnsOverTls(QDnsLookupReply *reply, QSpan<unsigned char> query,
+ ReplyBuffer &response)
+{
+ Q_UNUSED(query)
+ Q_UNUSED(response)
+ reply->setError(QDnsLookup::ResolverError, QDnsLookup::tr("SSL/TLS support not present"));
+ return false;
+}
+#endif
+
QT_END_NAMESPACE
#include "moc_qdnslookup.cpp"
diff --git a/src/network/kernel/qdnslookup.h b/src/network/kernel/qdnslookup.h
index ae89a0a11f..8d21e99c84 100644
--- a/src/network/kernel/qdnslookup.h
+++ b/src/network/kernel/qdnslookup.h
@@ -22,6 +22,10 @@ class QDnsHostAddressRecordPrivate;
class QDnsMailExchangeRecordPrivate;
class QDnsServiceRecordPrivate;
class QDnsTextRecordPrivate;
+class QDnsTlsAssociationRecordPrivate;
+class QSslConfiguration;
+
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR(QDnsTlsAssociationRecordPrivate)
class Q_NETWORK_EXPORT QDnsDomainNameRecord
{
@@ -137,10 +141,83 @@ private:
Q_DECLARE_SHARED(QDnsTextRecord)
+class Q_NETWORK_EXPORT QDnsTlsAssociationRecord
+{
+ Q_GADGET
+public:
+ enum class CertificateUsage : quint8 {
+ // https://www.iana.org/assignments/dane-parameters/dane-parameters.xhtml#certificate-usages
+ // RFC 6698
+ CertificateAuthorityConstrait = 0,
+ ServiceCertificateConstraint = 1,
+ TrustAnchorAssertion = 2,
+ DomainIssuedCertificate = 3,
+ PrivateUse = 255,
+
+ // Aliases by RFC 7218
+ PKIX_TA = 0,
+ PKIX_EE = 1,
+ DANE_TA = 2,
+ DANE_EE = 3,
+ PrivCert = 255,
+ };
+ Q_ENUM(CertificateUsage)
+
+ enum class Selector : quint8 {
+ // https://www.iana.org/assignments/dane-parameters/dane-parameters.xhtml#selectors
+ // RFC 6698
+ FullCertificate = 0,
+ SubjectPublicKeyInfo = 1,
+ PrivateUse = 255,
+
+ // Aliases by RFC 7218
+ Cert = FullCertificate,
+ SPKI = SubjectPublicKeyInfo,
+ PrivSel = PrivateUse,
+ };
+ Q_ENUM(Selector)
+
+ enum class MatchingType : quint8 {
+ // https://www.iana.org/assignments/dane-parameters/dane-parameters.xhtml#matching-types
+ // RFC 6698
+ Exact = 0,
+ Sha256 = 1,
+ Sha512 = 2,
+ PrivateUse = 255,
+ PrivMatch = PrivateUse,
+ };
+ Q_ENUM(MatchingType)
+
+ QDnsTlsAssociationRecord();
+ QDnsTlsAssociationRecord(const QDnsTlsAssociationRecord &other);
+ QDnsTlsAssociationRecord(QDnsTlsAssociationRecord &&other)
+ : d(std::move(other.d))
+ {}
+ QDnsTlsAssociationRecord &operator=(QDnsTlsAssociationRecord &&other) noexcept { swap(other); return *this; }
+ QDnsTlsAssociationRecord &operator=(const QDnsTlsAssociationRecord &other);
+ ~QDnsTlsAssociationRecord();
+
+ void swap(QDnsTlsAssociationRecord &other) noexcept { d.swap(other.d); }
+
+ QString name() const;
+ quint32 timeToLive() const;
+ CertificateUsage usage() const;
+ Selector selector() const;
+ MatchingType matchType() const;
+ QByteArray value() const;
+
+private:
+ QSharedDataPointer<QDnsTlsAssociationRecordPrivate> d;
+ friend class QDnsLookupRunnable;
+};
+
+Q_DECLARE_SHARED(QDnsTlsAssociationRecord)
+
class Q_NETWORK_EXPORT QDnsLookup : public QObject
{
Q_OBJECT
Q_PROPERTY(Error error READ error NOTIFY finished)
+ Q_PROPERTY(bool authenticData READ isAuthenticData NOTIFY finished)
Q_PROPERTY(QString errorString READ errorString NOTIFY finished)
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged BINDABLE bindableName)
Q_PROPERTY(Type type READ type WRITE setType NOTIFY typeChanged BINDABLE bindableType)
@@ -148,6 +225,8 @@ class Q_NETWORK_EXPORT QDnsLookup : public QObject
BINDABLE bindableNameserver)
Q_PROPERTY(quint16 nameserverPort READ nameserverPort WRITE setNameserverPort
NOTIFY nameserverPortChanged BINDABLE bindableNameserverPort)
+ Q_PROPERTY(Protocol nameserverProtocol READ nameserverProtocol WRITE setNameserverProtocol
+ NOTIFY nameserverProtocolChanged BINDABLE bindableNameserverProtocol)
public:
enum Error
@@ -174,17 +253,27 @@ public:
NS = 2,
PTR = 12,
SRV = 33,
+ TLSA = 52,
TXT = 16
};
Q_ENUM(Type)
+ enum Protocol : quint8 {
+ Standard = 0,
+ DnsOverTls,
+ };
+ Q_ENUM(Protocol)
+
explicit QDnsLookup(QObject *parent = nullptr);
QDnsLookup(Type type, const QString &name, QObject *parent = nullptr);
QDnsLookup(Type type, const QString &name, const QHostAddress &nameserver, QObject *parent = nullptr);
QDnsLookup(Type type, const QString &name, const QHostAddress &nameserver, quint16 port,
QObject *parent = nullptr);
+ QDnsLookup(Type type, const QString &name, Protocol protocol, const QHostAddress &nameserver,
+ quint16 port = 0, QObject *parent = nullptr);
~QDnsLookup();
+ bool isAuthenticData() const;
Error error() const;
QString errorString() const;
bool isFinished() const;
@@ -203,6 +292,11 @@ public:
quint16 nameserverPort() const;
void setNameserverPort(quint16 port);
QBindable<quint16> bindableNameserverPort();
+ Protocol nameserverProtocol() const;
+ void setNameserverProtocol(Protocol protocol);
+ QBindable<Protocol> bindableNameserverProtocol();
+ void setNameserver(Protocol protocol, const QHostAddress &nameserver, quint16 port = 0);
+ QT_NETWORK_INLINE_SINCE(6, 8)
void setNameserver(const QHostAddress &nameserver, quint16 port);
QList<QDnsDomainNameRecord> canonicalNameRecords() const;
@@ -212,7 +306,15 @@ public:
QList<QDnsDomainNameRecord> pointerRecords() const;
QList<QDnsServiceRecord> serviceRecords() const;
QList<QDnsTextRecord> textRecords() const;
+ QList<QDnsTlsAssociationRecord> tlsAssociationRecords() const;
+
+#if QT_CONFIG(ssl)
+ void setSslConfiguration(const QSslConfiguration &sslConfiguration);
+ QSslConfiguration sslConfiguration() const;
+#endif
+ static bool isProtocolSupported(Protocol protocol);
+ static quint16 defaultPortForProtocol(Protocol protocol) noexcept Q_DECL_CONST_FUNCTION;
public Q_SLOTS:
void abort();
@@ -224,11 +326,19 @@ Q_SIGNALS:
void typeChanged(Type type);
void nameserverChanged(const QHostAddress &nameserver);
void nameserverPortChanged(quint16 port);
+ void nameserverProtocolChanged(Protocol protocol);
private:
Q_DECLARE_PRIVATE(QDnsLookup)
};
+#if QT_NETWORK_INLINE_IMPL_SINCE(6, 8)
+void QDnsLookup::setNameserver(const QHostAddress &nameserver, quint16 port)
+{
+ setNameserver(Standard, nameserver, port);
+}
+#endif
+
QT_END_NAMESPACE
#endif // QDNSLOOKUP_H
diff --git a/src/network/kernel/qdnslookup_p.h b/src/network/kernel/qdnslookup_p.h
index da4721411b..1f32b4ee4f 100644
--- a/src/network/kernel/qdnslookup_p.h
+++ b/src/network/kernel/qdnslookup_p.h
@@ -27,6 +27,10 @@
#include "private/qobject_p.h"
#include "private/qurl_p.h"
+#if QT_CONFIG(ssl)
+# include "qsslconfiguration.h"
+#endif
+
QT_REQUIRE_CONFIG(dnslookup);
QT_BEGIN_NAMESPACE
@@ -35,6 +39,7 @@ QT_BEGIN_NAMESPACE
constexpr qsizetype MaxDomainNameLength = 255;
constexpr quint16 DnsPort = 53;
+constexpr quint16 DnsOverTlsPort = 853;
class QDnsLookupRunnable;
QDebug operator<<(QDebug &, QDnsLookupRunnable *);
@@ -43,6 +48,7 @@ class QDnsLookupReply
{
public:
QDnsLookup::Error error = QDnsLookup::NoError;
+ bool authenticData = false;
QString errorString;
QList<QDnsDomainNameRecord> canonicalNameRecords;
@@ -51,8 +57,13 @@ public:
QList<QDnsDomainNameRecord> nameServerRecords;
QList<QDnsDomainNameRecord> pointerRecords;
QList<QDnsServiceRecord> serviceRecords;
+ QList<QDnsTlsAssociationRecord> tlsAssociationRecords;
QList<QDnsTextRecord> textRecords;
+#if QT_CONFIG(ssl)
+ std::optional<QSslConfiguration> sslConfiguration;
+#endif
+
// helper methods
void setError(QDnsLookup::Error err, QString &&msg)
{
@@ -120,6 +131,7 @@ private:
&& nameServerRecords.isEmpty()
&& pointerRecords.isEmpty()
&& serviceRecords.isEmpty()
+ && tlsAssociationRecords.isEmpty()
&& textRecords.isEmpty();
}
};
@@ -129,7 +141,8 @@ class QDnsLookupPrivate : public QObjectPrivate
public:
QDnsLookupPrivate()
: type(QDnsLookup::A)
- , port(DnsPort)
+ , port(0)
+ , protocol(QDnsLookup::Standard)
{ }
void nameChanged()
@@ -162,11 +175,22 @@ public:
Q_OBJECT_BINDABLE_PROPERTY(QDnsLookupPrivate, quint16,
port, &QDnsLookupPrivate::nameserverPortChanged);
+ void nameserverProtocolChanged()
+ {
+ emit q_func()->nameserverProtocolChanged(protocol);
+ }
+
+ Q_OBJECT_BINDABLE_PROPERTY(QDnsLookupPrivate, QDnsLookup::Protocol,
+ protocol, &QDnsLookupPrivate::nameserverProtocolChanged);
QDnsLookupReply reply;
QDnsLookupRunnable *runnable = nullptr;
bool isFinished = false;
+#if QT_CONFIG(ssl)
+ std::optional<QSslConfiguration> sslConfiguration;
+#endif
+
Q_DECLARE_PUBLIC(QDnsLookup)
};
@@ -180,9 +204,13 @@ public:
#else
using EncodedLabel = QByteArray;
#endif
+ // minimum IPv6 MTU (1280) minus the IPv6 (40) and UDP headers (8)
+ static constexpr qsizetype ReplyBufferSize = 1280 - 40 - 8;
+ using ReplyBuffer = QVarLengthArray<unsigned char, ReplyBufferSize>;
QDnsLookupRunnable(const QDnsLookupPrivate *d);
void run() override;
+ bool sendDnsOverTls(QDnsLookupReply *reply, QSpan<unsigned char> query, ReplyBuffer &response);
signals:
void finished(const QDnsLookupReply &reply);
@@ -198,6 +226,11 @@ private:
QHostAddress nameserver;
QDnsLookup::Type requestType;
quint16 port;
+ QDnsLookup::Protocol protocol;
+
+#if QT_CONFIG(ssl)
+ std::optional<QSslConfiguration> sslConfiguration;
+#endif
friend QDebug operator<<(QDebug &, QDnsLookupRunnable *);
};
@@ -265,6 +298,15 @@ public:
QList<QByteArray> values;
};
+class QDnsTlsAssociationRecordPrivate : public QDnsRecordPrivate
+{
+public:
+ QDnsTlsAssociationRecord::CertificateUsage usage;
+ QDnsTlsAssociationRecord::Selector selector;
+ QDnsTlsAssociationRecord::MatchingType matchType;
+ QByteArray value;
+};
+
QT_END_NAMESPACE
#endif // QDNSLOOKUP_P_H
diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp
index 5696a3ca70..9de073b781 100644
--- a/src/network/kernel/qdnslookup_unix.cpp
+++ b/src/network/kernel/qdnslookup_unix.cpp
@@ -6,6 +6,7 @@
#include <qendian.h>
#include <qscopedpointer.h>
+#include <qspan.h>
#include <qurl.h>
#include <qvarlengtharray.h>
#include <private/qnativesocketengine_p.h> // for setSockAddr
@@ -32,15 +33,13 @@ QT_REQUIRE_CONFIG(libresolv);
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-
-// minimum IPv6 MTU (1280) minus the IPv6 (40) and UDP headers (8)
-static constexpr qsizetype ReplyBufferSize = 1280 - 40 - 8;
+using ReplyBuffer = QDnsLookupRunnable::ReplyBuffer;
// https://www.rfc-editor.org/rfc/rfc6891
static constexpr unsigned char Edns0Record[] = {
0x00, // root label
T_OPT >> 8, T_OPT & 0xff, // type OPT
- ReplyBufferSize >> 8, ReplyBufferSize & 0xff, // payload size
+ ReplyBuffer::PreallocatedSize >> 8, ReplyBuffer::PreallocatedSize & 0xff, // payload size
NOERROR, // extended rcode
0, // version
0x00, 0x00, // flags
@@ -68,11 +67,9 @@ using Cache = QList<QDnsCachedName>; // QHash or QMap are overkill
// https://docs.oracle.com/cd/E86824_01/html/E54774/res-setservers-3resolv.html
static bool applyNameServer(res_state state, const QHostAddress &nameserver, quint16 port)
{
- if (!nameserver.isNull()) {
- union res_sockaddr_union u;
- setSockaddr(reinterpret_cast<sockaddr *>(&u.sin), nameserver, port);
- res_setservers(state, &u, 1);
- }
+ union res_sockaddr_union u;
+ setSockaddr(reinterpret_cast<sockaddr *>(&u.sin), nameserver, port);
+ res_setservers(state, &u, 1);
return true;
}
#else
@@ -123,9 +120,6 @@ template <typename State> bool setIpv6NameServer(State *, const void *, quint16)
static bool applyNameServer(res_state state, const QHostAddress &nameserver, quint16 port)
{
- if (nameserver.isNull())
- return true;
-
state->nscount = 1;
state->nsaddr_list[0].sin_family = AF_UNSPEC;
if (nameserver.protocol() == QAbstractSocket::IPv6Protocol)
@@ -153,36 +147,30 @@ prepareQueryBuffer(res_state state, QueryBuffer &buffer, const char *label, ns_r
return queryLength + sizeof(Edns0Record);
}
-void QDnsLookupRunnable::query(QDnsLookupReply *reply)
+static int sendStandardDns(QDnsLookupReply *reply, res_state state, QSpan<unsigned char> qbuffer,
+ ReplyBuffer &buffer, const QHostAddress &nameserver, quint16 port)
{
- // Initialize state.
- std::remove_pointer_t<res_state> state = {};
- if (res_ninit(&state) < 0) {
- int error = errno;
- qErrnoWarning(error, "QDnsLookup: Resolver initialization failed");
- return reply->makeResolverSystemError(error);
- }
- auto guard = qScopeGuard([&] { res_nclose(&state); });
+ // Check if a nameserver was set. If so, use it.
+ if (!nameserver.isNull()) {
+ if (!applyNameServer(state, nameserver, port)) {
+ reply->setError(QDnsLookup::ResolverError,
+ QDnsLookup::tr("IPv6 nameservers are currently not supported on this OS"));
+ return -1;
+ }
- //Check if a nameserver was set. If so, use it
- if (!applyNameServer(&state, nameserver, port))
- return reply->setError(QDnsLookup::ResolverError,
- QDnsLookup::tr("IPv6 nameservers are currently not supported on this OS"));
-#ifdef QDNSLOOKUP_DEBUG
- state.options |= RES_DEBUG;
-#endif
+ // Request the name server attempt to authenticate the reply.
+ reinterpret_cast<HEADER *>(buffer.data())->ad = true;
- // Prepare the DNS query.
- QueryBuffer qbuffer;
- int queryLength = prepareQueryBuffer(&state, qbuffer, requestName.constData(), ns_rcode(requestType));
- if (Q_UNLIKELY(queryLength < 0))
- return reply->makeResolverSystemError();
+#ifdef RES_TRUSTAD
+ // Need to set this option even though we set the AD bit, otherwise
+ // glibc turns it off.
+ state->options |= RES_TRUSTAD;
+#endif
+ }
- // Perform DNS query.
- QVarLengthArray<unsigned char, ReplyBufferSize> buffer(ReplyBufferSize);
auto attemptToSend = [&]() {
std::memset(buffer.data(), 0, HFIXEDSZ); // the header is enough
- int responseLength = res_nsend(&state, qbuffer.data(), queryLength, buffer.data(), buffer.size());
+ int responseLength = res_nsend(state, qbuffer.data(), qbuffer.size(), buffer.data(), buffer.size());
if (responseLength >= 0)
return responseLength; // success
@@ -202,10 +190,10 @@ void QDnsLookupRunnable::query(QDnsLookupReply *reply)
};
// strictly use UDP, we'll deal with truncated replies ourselves
- state.options |= RES_IGNTC;
+ state->options |= RES_IGNTC;
int responseLength = attemptToSend();
if (responseLength < 0)
- return;
+ return responseLength;
// check if we need to use the virtual circuit (TCP)
auto header = reinterpret_cast<HEADER *>(buffer.data());
@@ -216,17 +204,65 @@ void QDnsLookupRunnable::query(QDnsLookupReply *reply)
// remove the EDNS record in the query
reinterpret_cast<HEADER *>(qbuffer.data())->arcount = 0;
- queryLength -= sizeof(Edns0Record);
+ qbuffer = qbuffer.first(qbuffer.size() - sizeof(Edns0Record));
// send using the virtual circuit
- state.options |= RES_USEVC;
+ state->options |= RES_USEVC;
responseLength = attemptToSend();
if (Q_UNLIKELY(responseLength > buffer.size())) {
// Ok, we give up.
- return reply->setError(QDnsLookup::ResolverError,
- QDnsLookup::tr("Reply was too large"));
+ reply->setError(QDnsLookup::ResolverError, QDnsLookup::tr("Reply was too large"));
+ return -1;
}
}
+
+ // We only trust the AD bit in the reply if we're querying a custom name
+ // server or if we can tell the system administrator configured the resolver
+ // to trust replies.
+#ifndef RES_TRUSTAD
+ if (nameserver.isNull())
+ header->ad = false;
+#endif
+ reply->authenticData = header->ad;
+
+ return responseLength;
+}
+
+void QDnsLookupRunnable::query(QDnsLookupReply *reply)
+{
+ // Initialize state.
+ std::remove_pointer_t<res_state> state = {};
+ if (res_ninit(&state) < 0) {
+ int error = errno;
+ qErrnoWarning(error, "QDnsLookup: Resolver initialization failed");
+ return reply->makeResolverSystemError(error);
+ }
+ auto guard = qScopeGuard([&] { res_nclose(&state); });
+
+#ifdef QDNSLOOKUP_DEBUG
+ state.options |= RES_DEBUG;
+#endif
+
+ // Prepare the DNS query.
+ QueryBuffer qbuffer;
+ int queryLength = prepareQueryBuffer(&state, qbuffer, requestName.constData(), ns_rcode(requestType));
+ if (Q_UNLIKELY(queryLength < 0))
+ return reply->makeResolverSystemError();
+
+ // Perform DNS query.
+ ReplyBuffer buffer(ReplyBufferSize);
+ int responseLength = -1;
+ switch (protocol) {
+ case QDnsLookup::Standard:
+ responseLength = sendStandardDns(reply, &state, qbuffer, buffer, nameserver, port);
+ break;
+ case QDnsLookup::DnsOverTls:
+ if (!sendDnsOverTls(reply, qbuffer, buffer))
+ return;
+ responseLength = buffer.size();
+ break;
+ }
+
if (responseLength < 0)
return;
@@ -235,6 +271,7 @@ void QDnsLookupRunnable::query(QDnsLookupReply *reply)
return reply->makeInvalidReplyError();
// Parse the reply.
+ auto header = reinterpret_cast<HEADER *>(buffer.data());
if (header->rcode)
return reply->makeDnsRcodeError(header->rcode);
@@ -273,7 +310,7 @@ void QDnsLookupRunnable::query(QDnsLookupReply *reply)
expandHost(offset);
if (status < 0)
return;
- if (offset + status + 4 >= responseLength)
+ if (offset + status + 4 > responseLength)
header->qdcount = 0xffff; // invalid reply below
else
offset += status + 4;
@@ -356,6 +393,8 @@ void QDnsLookupRunnable::query(QDnsLookupReply *reply)
return reply->makeInvalidReplyError(QDnsLookup::tr("Invalid mail exchange record"));
reply->mailExchangeRecords.append(record);
} else if (type == QDnsLookup::SRV) {
+ if (size < 7)
+ return reply->makeInvalidReplyError(QDnsLookup::tr("Invalid service record"));
const quint16 priority = qFromBigEndian<quint16>(response + offset);
const quint16 weight = qFromBigEndian<quint16>(response + offset + 2);
const quint16 port = qFromBigEndian<quint16>(response + offset + 4);
@@ -369,6 +408,23 @@ void QDnsLookupRunnable::query(QDnsLookupReply *reply)
if (status < 0)
return reply->makeInvalidReplyError(QDnsLookup::tr("Invalid service record"));
reply->serviceRecords.append(record);
+ } else if (type == QDnsLookup::TLSA) {
+ // https://datatracker.ietf.org/doc/html/rfc6698#section-2.1
+ if (size < 3)
+ return reply->makeInvalidReplyError(QDnsLookup::tr("Invalid TLS association record"));
+
+ const quint8 usage = response[offset];
+ const quint8 selector = response[offset + 1];
+ const quint8 matchType = response[offset + 2];
+
+ QDnsTlsAssociationRecord record;
+ record.d->name = name;
+ record.d->timeToLive = ttl;
+ record.d->usage = QDnsTlsAssociationRecord::CertificateUsage(usage);
+ record.d->selector = QDnsTlsAssociationRecord::Selector(selector);
+ record.d->matchType = QDnsTlsAssociationRecord::MatchingType(matchType);
+ record.d->value.assign(response + offset + 3, response + offset + size);
+ reply->tlsAssociationRecords.append(std::move(record));
} else if (type == QDnsLookup::TXT) {
QDnsTextRecord record;
record.d->name = name;
diff --git a/src/network/kernel/qdnslookup_win.cpp b/src/network/kernel/qdnslookup_win.cpp
index 72d5ae5c86..1b07776db9 100644
--- a/src/network/kernel/qdnslookup_win.cpp
+++ b/src/network/kernel/qdnslookup_win.cpp
@@ -5,9 +5,11 @@
#include <winsock2.h>
#include "qdnslookup_p.h"
-#include <qurl.h>
+#include <qendian.h>
#include <private/qnativesocketengine_p.h>
#include <private/qsystemerror_p.h>
+#include <qurl.h>
+#include <qspan.h>
#include <qt_windows.h>
#include <windns.h>
@@ -63,6 +65,58 @@ DNS_STATUS WINAPI DnsQueryEx(PDNS_QUERY_REQUEST pQueryRequest,
QT_BEGIN_NAMESPACE
+static DNS_STATUS sendAlternate(QDnsLookupRunnable *self, QDnsLookupReply *reply,
+ PDNS_QUERY_REQUEST request, PDNS_QUERY_RESULT results)
+{
+ // WinDNS wants MTU - IP Header - UDP header for some reason, in spite
+ // of never needing that much
+ QVarLengthArray<unsigned char, 1472> query(1472);
+
+ auto dnsBuffer = new (query.data()) DNS_MESSAGE_BUFFER;
+ DWORD dnsBufferSize = query.size();
+ WORD xid = 0;
+ bool recursionDesired = true;
+
+ SetLastError(ERROR_SUCCESS);
+
+ // MinGW winheaders incorrectly declare the third parameter as LPWSTR
+ if (!DnsWriteQuestionToBuffer_W(dnsBuffer, &dnsBufferSize,
+ const_cast<LPWSTR>(request->QueryName), request->QueryType,
+ xid, recursionDesired)) {
+ // let's try reallocating
+ query.resize(dnsBufferSize);
+ if (!DnsWriteQuestionToBuffer_W(dnsBuffer, &dnsBufferSize,
+ const_cast<LPWSTR>(request->QueryName), request->QueryType,
+ xid, recursionDesired)) {
+ return GetLastError();
+ }
+ }
+
+ // set AD bit: we want to trust this server
+ dnsBuffer->MessageHead.AuthenticatedData = true;
+
+ QDnsLookupRunnable::ReplyBuffer replyBuffer;
+ if (!self->sendDnsOverTls(reply, { query.data(), qsizetype(dnsBufferSize) }, replyBuffer))
+ return DNS_STATUS(-1); // error set in reply
+
+ // interpret the RCODE in the reply
+ auto response = reinterpret_cast<PDNS_MESSAGE_BUFFER>(replyBuffer.data());
+ DNS_HEADER *header = &response->MessageHead;
+ if (!header->IsResponse)
+ return DNS_ERROR_BAD_PACKET; // not a reply
+
+ // Convert the byte order for the 16-bit quantities in the header, so
+ // DnsExtractRecordsFromMessage can parse the contents.
+ //header->Xid = qFromBigEndian(header->Xid);
+ header->QuestionCount = qFromBigEndian(header->QuestionCount);
+ header->AnswerCount = qFromBigEndian(header->AnswerCount);
+ header->NameServerCount = qFromBigEndian(header->NameServerCount);
+ header->AdditionalCount = qFromBigEndian(header->AdditionalCount);
+
+ results->QueryOptions = request->QueryOptions;
+ return DnsExtractRecordsFromMessage_W(response, replyBuffer.size(), &results->pQueryRecords);
+}
+
void QDnsLookupRunnable::query(QDnsLookupReply *reply)
{
// Perform DNS query.
@@ -73,7 +127,7 @@ void QDnsLookupRunnable::query(QDnsLookupReply *reply)
request.QueryType = requestType;
request.QueryOptions = DNS_QUERY_STANDARD | DNS_QUERY_TREAT_AS_FQDN;
- if (!nameserver.isNull()) {
+ if (protocol == QDnsLookup::Standard && !nameserver.isNull()) {
memset(dnsAddresses, 0, sizeof(dnsAddresses));
request.pDnsServerList = new (dnsAddresses) DNS_ADDR_ARRAY;
auto addr = new (request.pDnsServerList->AddrArray) DNS_ADDR[1];
@@ -87,7 +141,18 @@ void QDnsLookupRunnable::query(QDnsLookupReply *reply)
DNS_QUERY_RESULT results = {};
results.Version = 1;
- const DNS_STATUS status = DnsQueryEx(&request, &results, nullptr);
+ DNS_STATUS status = ERROR_INVALID_PARAMETER;
+ switch (protocol) {
+ case QDnsLookup::Standard:
+ status = DnsQueryEx(&request, &results, nullptr);
+ break;
+ case QDnsLookup::DnsOverTls:
+ status = sendAlternate(this, reply, &request, &results);
+ break;
+ }
+
+ if (status == DNS_STATUS(-1))
+ return; // error already set in reply
if (status >= DNS_ERROR_RCODE_FORMAT_ERROR && status <= DNS_ERROR_RCODE_LAST)
return reply->makeDnsRcodeError(status - DNS_ERROR_RCODE_FORMAT_ERROR + 1);
else if (status == ERROR_TIMEOUT)
@@ -159,6 +224,25 @@ void QDnsLookupRunnable::query(QDnsLookupReply *reply)
record.d->timeToLive = ptr->dwTtl;
record.d->weight = ptr->Data.Srv.wWeight;
reply->serviceRecords.append(record);
+ } else if (ptr->wType == QDnsLookup::TLSA) {
+ // Note: untested, because the DNS_RECORD reply appears to contain
+ // no records relating to TLSA. Maybe WinDNS filters them out of
+ // zones without DNSSEC.
+ QDnsTlsAssociationRecord record;
+ record.d->name = name;
+ record.d->timeToLive = ptr->dwTtl;
+
+ const auto &tlsa = ptr->Data.Tlsa;
+ const quint8 usage = tlsa.bCertUsage;
+ const quint8 selector = tlsa.bSelector;
+ const quint8 matchType = tlsa.bMatchingType;
+
+ record.d->usage = QDnsTlsAssociationRecord::CertificateUsage(usage);
+ record.d->selector = QDnsTlsAssociationRecord::Selector(selector);
+ record.d->matchType = QDnsTlsAssociationRecord::MatchingType(matchType);
+ record.d->value.assign(tlsa.bCertificateAssociationData,
+ tlsa.bCertificateAssociationData + tlsa.bCertificateAssociationDataLength);
+ reply->tlsAssociationRecords.append(std::move(record));
} else if (ptr->wType == QDnsLookup::TXT) {
QDnsTextRecord record;
record.d->name = name;
diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp
index c0a7d9e00d..39ff8dbb92 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -310,12 +310,20 @@ QT_BEGIN_INCLUDE_NAMESPACE
QT_END_INCLUDE_NAMESPACE
# endif
+static int openSocket(int &socket)
+{
+ if (socket == -1)
+ socket = qt_safe_socket(AF_INET, SOCK_DGRAM, 0);
+ return socket;
+}
+
# if defined(Q_OS_LINUX) && __GLIBC__ - 0 >= 2 && __GLIBC_MINOR__ - 0 >= 1 && !defined(QT_LINUXBASE)
# include <netpacket/packet.h>
static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
{
Q_UNUSED(getMtu);
+ Q_UNUSED(openSocket);
QList<QNetworkInterfacePrivate *> interfaces;
QDuplicateTracker<QString> seenInterfaces;
QDuplicateTracker<int> seenIndexes;
@@ -387,13 +395,6 @@ QT_BEGIN_INCLUDE_NAMESPACE
#endif // QT_PLATFORM_UIKIT
QT_END_INCLUDE_NAMESPACE
-static int openSocket(int &socket)
-{
- if (socket == -1)
- socket = qt_safe_socket(AF_INET, SOCK_DGRAM, 0);
- return socket;
-}
-
static QNetworkInterface::InterfaceType probeIfType(int socket, int iftype, struct ifmediareq *req)
{
// Determine the interface type.
@@ -537,8 +538,8 @@ static void getAddressExtraInfo(QNetworkAddressEntry *entry, struct sockaddr *sa
static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
{
- Q_UNUSED(getMtu);
QList<QNetworkInterfacePrivate *> interfaces;
+ int socket = -1;
// make sure there's one entry for each interface
for (ifaddrs *ptr = rawList; ptr; ptr = ptr->ifa_next) {
@@ -559,9 +560,18 @@ static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
iface->index = ifindex;
iface->name = QString::fromLatin1(ptr->ifa_name);
iface->flags = convertFlags(ptr->ifa_flags);
+
+ if ((socket = openSocket(socket)) >= 0) {
+ struct ifreq ifr;
+ qstrncpy(ifr.ifr_name, ptr->ifa_name, sizeof(ifr.ifr_name));
+ iface->mtu = getMtu(socket, &ifr);
+ }
}
}
+ if (socket != -1)
+ qt_safe_close(socket);
+
return interfaces;
}
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index 62bba24bce..9b91b11d6b 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -752,6 +752,53 @@ QNetworkProxy QNetworkProxy::applicationProxy()
}
/*!
+ \since 6.8
+
+ Returns headers that are set in this network request.
+
+ If the proxy is not of type HttpProxy or HttpCachingProxy,
+ default constructed QHttpHeaders is returned.
+
+ \sa setHeaders()
+*/
+QHttpHeaders QNetworkProxy::headers() const
+{
+ if (d->type != HttpProxy && d->type != HttpCachingProxy)
+ return {};
+ return d->headers.headers();
+}
+
+/*!
+ \since 6.8
+
+ Sets \a newHeaders as headers in this network request, overriding
+ any previously set headers.
+
+ If some headers correspond to the known headers, the values will
+ be parsed and the corresponding parsed form will also be set.
+
+ If the proxy is not of type HttpProxy or HttpCachingProxy this has no
+ effect.
+
+ \sa headers(), QNetworkRequest::KnownHeaders
+*/
+void QNetworkProxy::setHeaders(QHttpHeaders &&newHeaders)
+{
+ if (d->type == HttpProxy || d->type == HttpCachingProxy)
+ d->headers.setHeaders(std::move(newHeaders));
+}
+
+/*!
+ \overload
+ \since 6.8
+*/
+void QNetworkProxy::setHeaders(const QHttpHeaders &newHeaders)
+{
+ if (d->type == HttpProxy || d->type == HttpCachingProxy)
+ d->headers.setHeaders(newHeaders);
+}
+
+/*!
\since 5.0
Returns the value of the known network header \a header if it is
in use for this proxy. If it is not present, returns QVariant()
@@ -795,7 +842,7 @@ bool QNetworkProxy::hasRawHeader(const QByteArray &headerName) const
{
if (d->type != HttpProxy && d->type != HttpCachingProxy)
return false;
- return d->headers.findRawHeader(headerName) != d->headers.rawHeaders.constEnd();
+ return d->headers.headers().contains(headerName);
}
/*!
@@ -814,11 +861,7 @@ QByteArray QNetworkProxy::rawHeader(const QByteArray &headerName) const
{
if (d->type != HttpProxy && d->type != HttpCachingProxy)
return QByteArray();
- QNetworkHeadersPrivate::RawHeadersList::ConstIterator it =
- d->headers.findRawHeader(headerName);
- if (it != d->headers.rawHeaders.constEnd())
- return it->second;
- return QByteArray();
+ return d->headers.rawHeader(headerName);
}
/*!
diff --git a/src/network/kernel/qnetworkproxy.h b/src/network/kernel/qnetworkproxy.h
index d04bd9ee13..9f92ffeb12 100644
--- a/src/network/kernel/qnetworkproxy.h
+++ b/src/network/kernel/qnetworkproxy.h
@@ -136,6 +136,10 @@ public:
static void setApplicationProxy(const QNetworkProxy &proxy);
static QNetworkProxy applicationProxy();
+ QHttpHeaders headers() const;
+ void setHeaders(const QHttpHeaders &newHeaders);
+ void setHeaders(QHttpHeaders &&newHeaders);
+
// "cooked" headers
QVariant header(QNetworkRequest::KnownHeaders header) const;
void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value);
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index a700023bd5..725bc21359 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -467,11 +467,14 @@ void QHttpSocketEngine::slotSocketConnected()
data += " HTTP/1.1\r\n";
data += "Proxy-Connection: keep-alive\r\n";
data += "Host: " + peerAddress + "\r\n";
- if (!d->proxy.hasRawHeader("User-Agent"))
+ const auto headers = d->proxy.headers();
+ if (!headers.contains(QHttpHeaders::WellKnownHeader::UserAgent))
data += "User-Agent: Mozilla/5.0\r\n";
- const auto headers = d->proxy.rawHeaderList();
- for (const QByteArray &header : headers)
- data += header + ": " + d->proxy.rawHeader(header) + "\r\n";
+ for (qsizetype i = 0; i < headers.size(); ++i) {
+ const auto name = headers.nameAt(i);
+ data += QByteArrayView(name.data(), name.size()) + ": "
+ + headers.valueAt(i) + "\r\n";
+ }
QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(d->authenticator);
//qDebug() << "slotSocketConnected: priv=" << priv << (priv ? (int)priv->method : -1);
if (priv && priv->method != QAuthenticatorPrivate::None) {
diff --git a/src/opengl/qopenglcompositorbackingstore.cpp b/src/opengl/qopenglcompositorbackingstore.cpp
index 931734cf60..371ca868f8 100644
--- a/src/opengl/qopenglcompositorbackingstore.cpp
+++ b/src/opengl/qopenglcompositorbackingstore.cpp
@@ -144,11 +144,7 @@ void QOpenGLCompositorBackingStore::flush(QWindow *window, const QRegion &region
Q_UNUSED(region);
Q_UNUSED(offset);
- m_rhi = rhi();
- if (!m_rhi) {
- setRhiConfig(QPlatformBackingStoreRhiConfig(QPlatformBackingStoreRhiConfig::OpenGL));
- m_rhi = rhi();
- }
+ m_rhi = rhi(window);
Q_ASSERT(m_rhi);
QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
@@ -184,11 +180,7 @@ QPlatformBackingStore::FlushResult QOpenGLCompositorBackingStore::rhiFlush(QWind
Q_UNUSED(translucentBackground);
Q_UNUSED(sourceDevicePixelRatio);
- m_rhi = rhi();
- if (!m_rhi) {
- setRhiConfig(QPlatformBackingStoreRhiConfig(QPlatformBackingStoreRhiConfig::OpenGL));
- m_rhi = rhi();
- }
+ m_rhi = rhi(window);
Q_ASSERT(m_rhi);
QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
diff --git a/src/opengl/qopenglpaintdevice.cpp b/src/opengl/qopenglpaintdevice.cpp
index fbc54c46fb..aaee7f18fe 100644
--- a/src/opengl/qopenglpaintdevice.cpp
+++ b/src/opengl/qopenglpaintdevice.cpp
@@ -247,6 +247,10 @@ int QOpenGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
return d_ptr->devicePixelRatio;
case PdmDevicePixelRatioScaled:
return d_ptr->devicePixelRatio * QPaintDevice::devicePixelRatioFScale();
+ case PdmDevicePixelRatioF_EncodedA:
+ Q_FALLTHROUGH();
+ case PdmDevicePixelRatioF_EncodedB:
+ return QPaintDevice::encodeMetricF(metric, d_ptr->devicePixelRatio);
default:
qWarning("QOpenGLPaintDevice::metric() - metric %d not known", metric);
diff --git a/src/opengl/qopenglpaintengine_p.h b/src/opengl/qopenglpaintengine_p.h
index 40ed7fe609..df407444be 100644
--- a/src/opengl/qopenglpaintengine_p.h
+++ b/src/opengl/qopenglpaintengine_p.h
@@ -243,7 +243,7 @@ public:
QOpenGLEngineShaderManager* shaderManager;
QOpenGLPaintDevice* device;
int width, height;
- QOpenGLContext *ctx;
+ QPointer<QOpenGLContext> ctx;
EngineMode mode;
QFontEngine::GlyphFormat glyphCacheFormat;
diff --git a/src/openglwidgets/qopenglwidget.cpp b/src/openglwidgets/qopenglwidget.cpp
index 4a0bf7f492..cf70e16990 100644
--- a/src/openglwidgets/qopenglwidget.cpp
+++ b/src/openglwidgets/qopenglwidget.cpp
@@ -1640,6 +1640,10 @@ int QOpenGLWidget::metric(QPaintDevice::PaintDeviceMetric metric) const
return QWidget::metric(metric);
case PdmDevicePixelRatioScaled:
return QWidget::metric(metric);
+ case PdmDevicePixelRatioF_EncodedA:
+ Q_FALLTHROUGH();
+ case PdmDevicePixelRatioF_EncodedB:
+ return QWidget::metric(metric);
default:
qWarning("QOpenGLWidget::metric(): unknown metric %d", metric);
return 0;
diff --git a/src/plugins/networkinformation/android/jar/build.gradle b/src/plugins/networkinformation/android/jar/build.gradle
index 68a9381ad2..ea6d06c257 100644
--- a/src/plugins/networkinformation/android/jar/build.gradle
+++ b/src/plugins/networkinformation/android/jar/build.gradle
@@ -7,7 +7,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:8.0.2'
+ classpath 'com.android.tools.build:gradle:8.4.0'
}
}
@@ -26,7 +26,7 @@ android {
compileSdk 34
defaultConfig {
- minSdkVersion 23
+ minSdkVersion 28
}
sourceSets {
diff --git a/src/plugins/platforms/android/CMakeLists.txt b/src/plugins/platforms/android/CMakeLists.txt
index d5a275a76c..aaf62dd7e7 100644
--- a/src/plugins/platforms/android/CMakeLists.txt
+++ b/src/plugins/platforms/android/CMakeLists.txt
@@ -9,7 +9,7 @@ qt_find_package(EGL)
qt_internal_add_plugin(QAndroidIntegrationPlugin
OUTPUT_NAME qtforandroid
PLUGIN_TYPE platforms
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES android
+ DEFAULT_IF "android" IN_LIST QT_QPA_PLATFORMS
SOURCES
androidcontentfileengine.cpp androidcontentfileengine.h
androiddeadlockprotector.h
@@ -41,6 +41,7 @@ qt_internal_add_plugin(QAndroidIntegrationPlugin
qandroidplatformwindow.cpp qandroidplatformwindow.h
qandroidsystemlocale.cpp qandroidsystemlocale.h
androidwindowembedding.cpp androidwindowembedding.h
+ androidbackendregister.cpp androidbackendregister.h
NO_UNITY_BUILD_SOURCES
# Conflicting symbols and macros with androidjnimain.cpp
# TODO: Unify the usage of FIND_AND_CHECK_CLASS, and similar
diff --git a/src/plugins/platforms/android/androidbackendregister.cpp b/src/plugins/platforms/android/androidbackendregister.cpp
new file mode 100644
index 0000000000..bfd86138aa
--- /dev/null
+++ b/src/plugins/platforms/android/androidbackendregister.cpp
@@ -0,0 +1,52 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "androidbackendregister.h"
+
+#include "androidjnimain.h"
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(lcAndroidBackendRegister, "qt.qpa.androidbackendregister")
+
+Q_DECLARE_JNI_CLASS(BackendRegister, "org/qtproject/qt/android/BackendRegister");
+
+bool AndroidBackendRegister::registerNatives()
+{
+ return QtJniTypes::BackendRegister::registerNativeMethods(
+ { Q_JNI_NATIVE_SCOPED_METHOD(registerBackend, AndroidBackendRegister),
+ Q_JNI_NATIVE_SCOPED_METHOD(unregisterBackend, AndroidBackendRegister) });
+}
+
+void AndroidBackendRegister::registerBackend(JNIEnv *, jclass, jclass interfaceClass,
+ jobject interface)
+{
+ if (AndroidBackendRegister *reg = QtAndroid::backendRegister()) {
+ const QJniObject classObject(static_cast<jobject>(interfaceClass));
+ QString name = classObject.callMethod<jstring>("getName").toString();
+ name.replace('.', '/');
+
+ QMutexLocker lock(&reg->m_registerMutex);
+ reg->m_register[name] = QJniObject(interface);
+ } else {
+ qCWarning(lcAndroidBackendRegister)
+ << "AndroidBackendRegister pointer is null, cannot register functionality";
+ }
+}
+
+void AndroidBackendRegister::unregisterBackend(JNIEnv *, jclass, jclass interfaceClass)
+{
+ if (AndroidBackendRegister *reg = QtAndroid::backendRegister()) {
+ const QJniObject classObject(static_cast<jobject>(interfaceClass));
+ QString name = classObject.callMethod<jstring>("getName").toString();
+ name.replace('.', '/');
+
+ QMutexLocker lock(&reg->m_registerMutex);
+ reg->m_register.remove(name);
+ } else {
+ qCWarning(lcAndroidBackendRegister)
+ << "AndroidBackendRegister pointer is null, cannot unregister functionality";
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/androidbackendregister.h b/src/plugins/platforms/android/androidbackendregister.h
new file mode 100644
index 0000000000..c186f7e107
--- /dev/null
+++ b/src/plugins/platforms/android/androidbackendregister.h
@@ -0,0 +1,67 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef ANDROIDBACKENDREGISTER_H
+#define ANDROIDBACKENDREGISTER_H
+
+#include <type_traits>
+
+#include <QtCore/qjnienvironment.h>
+#include <QtCore/qjnitypes.h>
+#include <QtCore/qjniobject.h>
+
+#include <QtCore/qstring.h>
+#include <QtCore/qmap.h>
+#include <QtCore/qmutex.h>
+#include <QtCore/qloggingcategory.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(lcAndroidBackendRegister)
+
+template <typename T>
+using ValidInterfaceType = std::enable_if_t<std::is_base_of_v<QtJniTypes::JObjectBase, T>, bool>;
+
+class AndroidBackendRegister
+{
+public:
+ static bool registerNatives();
+
+ template <typename T, ValidInterfaceType<T> = true>
+ [[nodiscard]] T getInterface()
+ {
+ QMutexLocker lock(&m_registerMutex);
+ return m_register.value(QString(QtJniTypes::Traits<T>::className().data()));
+ }
+
+ template <typename Object>
+ using IsObjectType =
+ typename std::disjunction<std::is_base_of<QJniObject, Object>,
+ std::is_base_of<QtJniTypes::JObjectBase, Object>>;
+
+ template <typename Interface, typename Ret, typename... Args,
+ ValidInterfaceType<Interface> = true>
+ auto callInterface(const char *func, Args... args)
+ {
+ if (const auto obj = getInterface<Interface>(); obj.isValid())
+ return obj.template callMethod<Ret, Args...>(func, std::forward<Args>(args)...);
+
+ if constexpr (IsObjectType<Ret>::value)
+ return Ret(QJniObject());
+ if constexpr (!std::is_same_v<Ret, void>)
+ return Ret{};
+ }
+
+private:
+ QMutex m_registerMutex;
+ QMap<QString, QJniObject> m_register;
+
+ static void registerBackend(JNIEnv *, jclass, jclass interfaceClass, jobject interface);
+ Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(registerBackend)
+ static void unregisterBackend(JNIEnv *, jclass, jclass interfaceClass);
+ Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(unregisterBackend)
+};
+
+QT_END_NAMESPACE
+
+#endif // ANDROIDBACKENDREGISTER_H
diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp
index da5b63ef21..805616e481 100644
--- a/src/plugins/platforms/android/androidjniaccessibility.cpp
+++ b/src/plugins/platforms/android/androidjniaccessibility.cpp
@@ -82,7 +82,7 @@ namespace QtAndroidAccessibility
void initialize()
{
- QtAndroid::qtActivityDelegate().callMethod<void>("initializeAccessibility");
+ QtAndroid::initializeAccessibility();
}
bool isActive()
diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp
index d074e73b9e..266d027b3c 100644
--- a/src/plugins/platforms/android/androidjniinput.cpp
+++ b/src/plugins/platforms/android/androidjniinput.cpp
@@ -24,6 +24,8 @@ Q_LOGGING_CATEGORY(lcQpaInputMethods, "qt.qpa.input.methods");
using namespace QtAndroid;
Q_DECLARE_JNI_CLASS(QtLayout, "org/qtproject/qt/android/QtLayout")
+Q_DECLARE_JNI_CLASS(QtLayoutInterface, "org/qtproject/qt/android/QtLayoutInterface")
+Q_DECLARE_JNI_CLASS(QtInputInterface, "org/qtproject/qt/android/QtInputInterface")
namespace QtAndroidInput
{
@@ -98,48 +100,48 @@ namespace QtAndroidInput
QJniObject qtLayout()
{
- return qtActivityDelegate().callMethod<QtJniTypes::QtLayout>("getQtLayout");
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ return reg->callInterface<QtJniTypes::QtLayoutInterface, QtJniTypes::QtLayout>(
+ "getQtLayout");
}
void updateSelection(int selStart, int selEnd, int candidatesStart, int candidatesEnd)
{
qCDebug(lcQpaInputMethods) << ">>> UPDATESELECTION" << selStart << selEnd << candidatesStart << candidatesEnd;
- qtInputDelegate().callMethod<void>("updateSelection",
- selStart,
- selEnd,
- candidatesStart,
- candidatesEnd);
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtInputInterface, void>("updateSelection", selStart, selEnd,
+ candidatesStart, candidatesEnd);
}
void showSoftwareKeyboard(int left, int top, int width, int height, int inputHints, int enterKeyType)
{
- qtInputDelegate().callMethod<void>("showSoftwareKeyboard",
- QtAndroidPrivate::activity(),
- qtLayout().object<QtJniTypes::QtLayout>(),
- left,
- top,
- width,
- height,
- inputHints,
- enterKeyType);
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtInputInterface, void>(
+ "showSoftwareKeyboard", QtAndroidPrivate::activity(),
+ qtLayout().object<QtJniTypes::QtLayout>(), left, top, width, height, inputHints,
+ enterKeyType);
qCDebug(lcQpaInputMethods) << "@@@ SHOWSOFTWAREKEYBOARD" << left << top << width << height << inputHints << enterKeyType;
}
void resetSoftwareKeyboard()
{
- qtInputDelegate().callMethod<void>("resetSoftwareKeyboard");
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtInputInterface, void>("resetSoftwareKeyboard");
qCDebug(lcQpaInputMethods) << "@@@ RESETSOFTWAREKEYBOARD";
}
void hideSoftwareKeyboard()
{
- qtInputDelegate().callMethod<void>("hideSoftwareKeyboard");
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtInputInterface, void>("hideSoftwareKeyboard");
qCDebug(lcQpaInputMethods) << "@@@ HIDESOFTWAREKEYBOARD";
}
bool isSoftwareKeyboardVisible()
{
- return qtInputDelegate().callMethod<jboolean>("isSoftwareKeyboardVisible");
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ return reg->callInterface<QtJniTypes::QtInputInterface, jboolean>(
+ "isSoftwareKeyboardVisible");
}
QRect softwareKeyboardRect()
@@ -149,17 +151,17 @@ namespace QtAndroidInput
int getSelectHandleWidth()
{
- return qtInputDelegate().callMethod<jint>("getSelectHandleWidth");
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ return reg->callInterface<QtJniTypes::QtInputInterface, jint>("getSelectHandleWidth");
}
void updateHandles(int mode, QPoint editMenuPos, uint32_t editButtons, QPoint cursor, QPoint anchor, bool rtl)
{
- qtInputDelegate().callMethod<void>("updateHandles",
- QtAndroidPrivate::activity(),
- qtLayout().object<QtJniTypes::QtLayout>(),
- mode, editMenuPos.x(), editMenuPos.y(), editButtons,
- cursor.x(), cursor.y(),
- anchor.x(), anchor.y(), rtl);
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtInputInterface, void>(
+ "updateHandles", QtAndroidPrivate::activity(),
+ qtLayout().object<QtJniTypes::QtLayout>(), mode, editMenuPos.x(), editMenuPos.y(),
+ editButtons, cursor.x(), cursor.y(), anchor.x(), anchor.y(), rtl);
}
// from https://developer.android.com/reference/android/view/MotionEvent#getButtonState()
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 9fdcf3936b..5bd2b924fc 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -54,9 +54,6 @@ static jobject m_resourcesObj = nullptr;
static jclass m_qtActivityClass = nullptr;
static jclass m_qtServiceClass = nullptr;
-static QtJniTypes::QtActivityDelegateBase m_activityDelegate = nullptr;
-static QtJniTypes::QtInputDelegate m_inputDelegate = nullptr;
-
static int m_pendingApplicationState = -1;
static QBasicMutex m_platformMutex;
@@ -85,7 +82,7 @@ static double m_density = 1.0;
static AndroidAssetsFileEngineHandler *m_androidAssetsFileEngineHandler = nullptr;
static AndroidContentFileEngineHandler *m_androidContentFileEngineHandler = nullptr;
-
+static AndroidBackendRegister *m_backendRegister = nullptr;
static const char m_qtTag[] = "Qt";
static const char m_classErrorMsg[] = "Can't find class \"%s\"";
@@ -93,7 +90,8 @@ static const char m_methodErrorMsg[] = "Can't find method \"%s%s\"";
Q_CONSTINIT static QBasicAtomicInt startQtAndroidPluginCalled = Q_BASIC_ATOMIC_INITIALIZER(0);
-Q_DECLARE_JNI_CLASS(QtEmbeddedDelegateFactory, "org/qtproject/qt/android/QtEmbeddedDelegateFactory")
+Q_DECLARE_JNI_CLASS(QtWindowInterface, "org/qtproject/qt/android/QtWindowInterface")
+Q_DECLARE_JNI_CLASS(QtAccessibilityInterface, "org/qtproject/qt/android/QtAccessibilityInterface");
namespace QtAndroid
{
@@ -184,36 +182,9 @@ namespace QtAndroid
// TODO move calls from here to where they logically belong
void setSystemUiVisibility(SystemUiVisibility uiVisibility)
{
- qtActivityDelegate().callMethod<void>("setSystemUiVisibility", jint(uiVisibility));
- }
-
- // FIXME: avoid direct access to QtActivityDelegate
- QtJniTypes::QtActivityDelegateBase qtActivityDelegate()
- {
- using namespace QtJniTypes;
- if (!m_activityDelegate.isValid()) {
- if (isQtApplication()) {
- auto context = QtAndroidPrivate::activity();
- m_activityDelegate = context.callMethod<QtActivityDelegateBase>("getActivityDelegate");
- } else {
- m_activityDelegate = QJniObject::callStaticMethod<QtActivityDelegateBase>(
- Traits<QtEmbeddedDelegateFactory>::className(),
- "getActivityDelegate",
- QtAndroidPrivate::activity());
- }
- }
-
- return m_activityDelegate;
- }
-
- QtJniTypes::QtInputDelegate qtInputDelegate()
- {
- if (!m_inputDelegate.isValid()) {
- m_inputDelegate = qtActivityDelegate().callMethod<QtJniTypes::QtInputDelegate>(
- "getInputDelegate");
- }
-
- return m_inputDelegate;
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtWindowInterface, void>("setSystemUiVisibility",
+ jint(uiVisibility));
}
bool isQtApplication()
@@ -234,36 +205,46 @@ namespace QtAndroid
return true;
}
+ void initializeAccessibility()
+ {
+ m_backendRegister->callInterface<QtJniTypes::QtAccessibilityInterface, void>(
+ "initializeAccessibility");
+ }
+
void notifyAccessibilityLocationChange(uint accessibilityObjectId)
{
- qtActivityDelegate().callMethod<void>("notifyLocationChange", accessibilityObjectId);
+ m_backendRegister->callInterface<QtJniTypes::QtAccessibilityInterface, void>(
+ "notifyLocationChange", accessibilityObjectId);
}
void notifyObjectHide(uint accessibilityObjectId, uint parentObjectId)
{
- qtActivityDelegate().callMethod<void>("notifyObjectHide",
- accessibilityObjectId, parentObjectId);
+ m_backendRegister->callInterface<QtJniTypes::QtAccessibilityInterface, void>(
+ "notifyObjectHide", accessibilityObjectId, parentObjectId);
}
void notifyObjectShow(uint parentObjectId)
{
- qtActivityDelegate().callMethod<void>("notifyObjectShow",
- parentObjectId);
+ m_backendRegister->callInterface<QtJniTypes::QtAccessibilityInterface, void>(
+ "notifyObjectShow", parentObjectId);
}
void notifyObjectFocus(uint accessibilityObjectId)
{
- qtActivityDelegate().callMethod<void>("notifyObjectFocus", accessibilityObjectId);
+ m_backendRegister->callInterface<QtJniTypes::QtAccessibilityInterface, void>(
+ "notifyObjectFocus", accessibilityObjectId);
}
void notifyValueChanged(uint accessibilityObjectId, jstring value)
{
- qtActivityDelegate().callMethod<void>("notifyValueChanged", accessibilityObjectId, value);
+ m_backendRegister->callInterface<QtJniTypes::QtAccessibilityInterface, void>(
+ "notifyValueChanged", accessibilityObjectId, value);
}
void notifyScrolledEvent(uint accessibilityObjectId)
{
- qtActivityDelegate().callMethod<void>("notifyScrolledEvent", accessibilityObjectId);
+ m_backendRegister->callInterface<QtJniTypes::QtAccessibilityInterface, void>(
+ "notifyScrolledEvent", accessibilityObjectId);
}
void notifyNativePluginIntegrationReady(bool ready)
@@ -387,6 +368,11 @@ namespace QtAndroid
return m_assets;
}
+ AndroidBackendRegister *backendRegister()
+ {
+ return m_backendRegister;
+ }
+
} // namespace QtAndroid
static jboolean startQtAndroidPlugin(JNIEnv *env, jobject /*object*/, jstring paramsString)
@@ -397,6 +383,7 @@ static jboolean startQtAndroidPlugin(JNIEnv *env, jobject /*object*/, jstring pa
m_androidAssetsFileEngineHandler = new AndroidAssetsFileEngineHandler();
m_androidContentFileEngineHandler = new AndroidContentFileEngineHandler();
m_mainLibraryHnd = nullptr;
+ m_backendRegister = new AndroidBackendRegister();
const QStringList argsList = QProcess::splitCommand(QJniObject(paramsString).toString());
@@ -544,6 +531,8 @@ static void terminateQt(JNIEnv *env, jclass /*clazz*/)
m_androidPlatformIntegration = nullptr;
delete m_androidAssetsFileEngineHandler;
m_androidAssetsFileEngineHandler = nullptr;
+ delete m_backendRegister;
+ m_backendRegister = nullptr;
sem_post(&m_exitSemaphore);
}
@@ -891,7 +880,8 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/)
|| !QtAndroidDialogHelpers::registerNatives(env)
|| !QAndroidPlatformClipboard::registerNatives(env)
|| !QAndroidPlatformWindow::registerNatives(env)
- || !QtAndroidWindowEmbedding::registerNatives(env)) {
+ || !QtAndroidWindowEmbedding::registerNatives(env)
+ || !AndroidBackendRegister::registerNatives()) {
__android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed");
return -1;
}
diff --git a/src/plugins/platforms/android/androidjnimain.h b/src/plugins/platforms/android/androidjnimain.h
index 99fff96d2b..9d616b18fb 100644
--- a/src/plugins/platforms/android/androidjnimain.h
+++ b/src/plugins/platforms/android/androidjnimain.h
@@ -13,6 +13,7 @@
#include <QImage>
#include <private/qjnihelpers_p.h>
#include <QtCore/QJniObject>
+#include <androidbackendregister.h>
QT_BEGIN_NAMESPACE
@@ -33,6 +34,7 @@ namespace QtAndroid
{
QBasicMutex *platformInterfaceMutex();
QAndroidPlatformIntegration *androidPlatformIntegration();
+ AndroidBackendRegister *backendRegister();
void setAndroidPlatformIntegration(QAndroidPlatformIntegration *androidPlatformIntegration);
void setQtThread(QThread *thread);
void setViewVisibility(jobject view, bool visible);
@@ -48,9 +50,6 @@ namespace QtAndroid
AAssetManager *assetManager();
jclass applicationClass();
- QtJniTypes::QtActivityDelegateBase qtActivityDelegate();
- QtJniTypes::QtInputDelegate qtInputDelegate();
-
// Keep synchronized with flags in ActivityDelegate.java
enum SystemUiVisibility {
SYSTEM_UI_VISIBILITY_NORMAL = 0,
@@ -63,6 +62,7 @@ namespace QtAndroid
jobject createBitmap(int width, int height, QImage::Format format, JNIEnv *env);
jobject createBitmapDrawable(jobject bitmap, JNIEnv *env = nullptr);
+ void initializeAccessibility();
void notifyAccessibilityLocationChange(uint accessibilityObjectId);
void notifyObjectHide(uint accessibilityObjectId, uint parentObjectId);
void notifyObjectShow(uint parentObjectId);
diff --git a/src/plugins/platforms/android/androidjnimenu.cpp b/src/plugins/platforms/android/androidjnimenu.cpp
index 8bf37d1af2..5f8a0b92e9 100644
--- a/src/plugins/platforms/android/androidjnimenu.cpp
+++ b/src/plugins/platforms/android/androidjnimenu.cpp
@@ -20,6 +20,8 @@ QT_BEGIN_NAMESPACE
using namespace QtAndroid;
+Q_DECLARE_JNI_CLASS(QtMenuInterface, "org/qtproject/qt/android/QtMenuInterface");
+
namespace QtAndroidMenu
{
static QList<QAndroidPlatformMenu *> pendingContextMenus;
@@ -44,12 +46,14 @@ namespace QtAndroidMenu
void resetMenuBar()
{
- qtActivityDelegate().callMethod<void>("resetOptionsMenu");
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtMenuInterface, void>("resetOptionsMenu");
}
void openOptionsMenu()
{
- qtActivityDelegate().callMethod<void>("openOptionsMenu");
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtMenuInterface, void>("openOptionsMenu");
}
void showContextMenu(QAndroidPlatformMenu *menu, const QRect &anchorRect)
@@ -59,16 +63,18 @@ namespace QtAndroidMenu
pendingContextMenus.append(visibleMenu);
visibleMenu = menu;
menu->aboutToShow();
- qtActivityDelegate().callMethod<void>("openContextMenu",
- anchorRect.x(), anchorRect.y(),
- anchorRect.width(), anchorRect.height());
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtMenuInterface, void>("openContextMenu", anchorRect.x(),
+ anchorRect.y(), anchorRect.width(),
+ anchorRect.height());
}
void hideContextMenu(QAndroidPlatformMenu *menu)
{
QMutexLocker lock(&visibleMenuMutex);
if (visibleMenu == menu) {
- qtActivityDelegate().callMethod<void>("closeContextMenu");
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtMenuInterface, void>("closeContextMenu");
pendingContextMenus.clear();
} else {
pendingContextMenus.removeOne(menu);
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp
index 9e20b7ac4b..4d752a3cc3 100644
--- a/src/plugins/platforms/android/qandroidplatformscreen.cpp
+++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp
@@ -57,6 +57,7 @@ Q_DECLARE_JNI_CLASS(Resources, "android/content/res/Resources")
Q_DECLARE_JNI_CLASS(Size, "android/util/Size")
Q_DECLARE_JNI_CLASS(QtNative, "org/qtproject/qt/android/QtNative")
Q_DECLARE_JNI_CLASS(QtDisplayManager, "org/qtproject/qt/android/QtDisplayManager")
+Q_DECLARE_JNI_CLASS(QtWindowInterface, "org/qtproject/qt/android/QtWindowInterface")
Q_DECLARE_JNI_CLASS(DisplayMode, "android/view/Display$Mode")
@@ -162,7 +163,10 @@ void QAndroidPlatformScreen::addWindow(QAndroidPlatformWindow *window)
return;
m_windowStack.prepend(window);
- QtAndroid::qtActivityDelegate().callMethod<void>("addTopLevelWindow", window->nativeWindow());
+
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtWindowInterface, void>("addTopLevelWindow",
+ window->nativeWindow());
if (window->window()->isVisible())
topVisibleWindowChanged();
@@ -175,7 +179,9 @@ void QAndroidPlatformScreen::removeWindow(QAndroidPlatformWindow *window)
if (m_windowStack.contains(window))
qWarning() << "Failed to remove window";
- QtAndroid::qtActivityDelegate().callMethod<void>("removeTopLevelWindow", window->nativeViewId());
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtWindowInterface, void>("removeTopLevelWindow",
+ window->nativeViewId());
topVisibleWindowChanged();
}
@@ -187,7 +193,10 @@ void QAndroidPlatformScreen::raise(QAndroidPlatformWindow *window)
return;
if (index > 0) {
m_windowStack.move(index, 0);
- QtAndroid::qtActivityDelegate().callMethod<void>("bringChildToFront", window->nativeViewId());
+
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtWindowInterface, void>("bringChildToFront",
+ window->nativeViewId());
}
topVisibleWindowChanged();
}
@@ -198,7 +207,10 @@ void QAndroidPlatformScreen::lower(QAndroidPlatformWindow *window)
if (index == -1 || index == (m_windowStack.size() - 1))
return;
m_windowStack.move(index, m_windowStack.size() - 1);
- QtAndroid::qtActivityDelegate().callMethod<void>("bringChildToBack", window->nativeViewId());
+
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ reg->callInterface<QtJniTypes::QtWindowInterface, void>("bringChildToBack",
+ window->nativeViewId());
topVisibleWindowChanged();
}
diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp
index 7b9072df69..99eeabac1d 100644
--- a/src/plugins/platforms/android/qandroidplatformtheme.cpp
+++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp
@@ -161,7 +161,10 @@ QJsonObject AndroidStyle::loadStyleData()
if (!stylePath.isEmpty() && !stylePath.endsWith(slashChar))
stylePath += slashChar;
- if (QAndroidPlatformIntegration::colorScheme() == Qt::ColorScheme::Dark)
+ const Qt::ColorScheme colorScheme = QAndroidPlatformTheme::instance()
+ ? QAndroidPlatformTheme::instance()->colorScheme()
+ : QAndroidPlatformIntegration::colorScheme();
+ if (colorScheme == Qt::ColorScheme::Dark)
stylePath += "darkUiMode/"_L1;
Q_ASSERT(!stylePath.isEmpty());
@@ -423,9 +426,19 @@ void QAndroidPlatformTheme::showPlatformMenuBar()
Qt::ColorScheme QAndroidPlatformTheme::colorScheme() const
{
+ if (m_colorSchemeOverride != Qt::ColorScheme::Unknown)
+ return m_colorSchemeOverride;
return QAndroidPlatformIntegration::colorScheme();
}
+void QAndroidPlatformTheme::requestColorScheme(Qt::ColorScheme scheme)
+{
+ m_colorSchemeOverride = scheme;
+ QMetaObject::invokeMethod(qGuiApp, [this]{
+ updateColorScheme();
+ });
+}
+
static inline int paletteType(QPlatformTheme::Palette type)
{
switch (type) {
diff --git a/src/plugins/platforms/android/qandroidplatformtheme.h b/src/plugins/platforms/android/qandroidplatformtheme.h
index ce3d6d5f73..1b4ab5664d 100644
--- a/src/plugins/platforms/android/qandroidplatformtheme.h
+++ b/src/plugins/platforms/android/qandroidplatformtheme.h
@@ -40,6 +40,8 @@ public:
QPlatformMenuItem *createPlatformMenuItem() const override;
void showPlatformMenuBar() override;
Qt::ColorScheme colorScheme() const override;
+ void requestColorScheme(Qt::ColorScheme scheme) override;
+
const QPalette *palette(Palette type = SystemPalette) const override;
const QFont *font(Font type = SystemFont) const override;
QIconEngine *createIconEngine(const QString &iconName) const override;
@@ -57,6 +59,7 @@ private:
std::shared_ptr<AndroidStyle> m_androidStyleData;
QPalette m_defaultPalette;
QFont m_systemFont;
+ Qt::ColorScheme m_colorSchemeOverride = Qt::ColorScheme::Unknown;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/qandroidplatformwindow.cpp b/src/plugins/platforms/android/qandroidplatformwindow.cpp
index 979f0fb98a..2482160573 100644
--- a/src/plugins/platforms/android/qandroidplatformwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformwindow.cpp
@@ -16,6 +16,10 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window")
+Q_DECLARE_JNI_CLASS(QtInputInterface, "org/qtproject/qt/android/QtInputInterface")
+Q_DECLARE_JNI_CLASS(QtInputConnectionListener,
+ "org/qtproject/qt/android/QtInputConnection$QtInputConnectionListener")
+
QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window)
: QPlatformWindow(window), m_nativeQtWindow(nullptr),
m_surfaceContainerType(SurfaceContainer::TextureView), m_nativeParentQtWindow(nullptr),
@@ -55,10 +59,13 @@ QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window)
m_nativeParentQtWindow = androidParent->nativeWindow();
}
+ AndroidBackendRegister *reg = QtAndroid::backendRegister();
+ QtJniTypes::QtInputConnectionListener listener =
+ reg->callInterface<QtJniTypes::QtInputInterface, QtJniTypes::QtInputConnectionListener>(
+ "getInputConnectionListener");
+
m_nativeQtWindow = QJniObject::construct<QtJniTypes::QtWindow>(
- QNativeInterface::QAndroidApplication::context(),
- m_nativeParentQtWindow,
- QtAndroid::qtInputDelegate());
+ QNativeInterface::QAndroidApplication::context(), m_nativeParentQtWindow, listener);
m_nativeViewId = m_nativeQtWindow.callMethod<jint>("getId");
if (window->isTopLevel())
diff --git a/src/plugins/platforms/cocoa/CMakeLists.txt b/src/plugins/platforms/cocoa/CMakeLists.txt
index 92e681d8fb..491c61703f 100644
--- a/src/plugins/platforms/cocoa/CMakeLists.txt
+++ b/src/plugins/platforms/cocoa/CMakeLists.txt
@@ -7,7 +7,7 @@
qt_internal_add_plugin(QCocoaIntegrationPlugin
OUTPUT_NAME qcocoa
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES cocoa
+ DEFAULT_IF "cocoa" IN_LIST QT_QPA_PLATFORMS
PLUGIN_TYPE platforms
SOURCES
main.mm
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
index c5e40a4087..40c1e90511 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
@@ -36,6 +36,23 @@ void QCocoaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
}
switch (event->type()) {
+ case QAccessible::Announcement: {
+ auto *announcementEvent = static_cast<QAccessibleAnnouncementEvent *>(event);
+ auto priorityLevel = (announcementEvent->priority() == QAccessible::AnnouncementPriority::Assertive)
+ ? NSAccessibilityPriorityHigh
+ : NSAccessibilityPriorityMedium;
+ NSDictionary *announcementInfo = @{
+ NSAccessibilityPriorityKey: [NSNumber numberWithInt:priorityLevel],
+ NSAccessibilityAnnouncementKey: announcementEvent->message().toNSString()
+ };
+ // post event for application element, as the comment for
+ // NSAccessibilityAnnouncementRequestedNotification in the
+ // NSAccessibilityConstants.h header says
+ NSAccessibilityPostNotificationWithUserInfo(NSApp,
+ NSAccessibilityAnnouncementRequestedNotification,
+ announcementInfo);
+ break;
+ }
case QAccessible::Focus: {
NSAccessibilityPostNotification(element, NSAccessibilityFocusedUIElementChangedNotification);
break;
diff --git a/src/plugins/platforms/cocoa/qcocoascreen.mm b/src/plugins/platforms/cocoa/qcocoascreen.mm
index be562e5455..2249658189 100644
--- a/src/plugins/platforms/cocoa/qcocoascreen.mm
+++ b/src/plugins/platforms/cocoa/qcocoascreen.mm
@@ -471,25 +471,6 @@ void QCocoaScreen::deliverUpdateRequests()
if (!platformWindow->updatesWithDisplayLink())
continue;
- // QTBUG-107198: Skip updates in a live resize for a better resize experience.
- if (platformWindow->isContentView() && platformWindow->view().inLiveResize) {
- const QSurface::SurfaceType surfaceType = window->surfaceType();
- const bool usesMetalLayer = surfaceType == QWindow::MetalSurface || surfaceType == QWindow::VulkanSurface;
- const bool usesNonDefaultContentsPlacement = [platformWindow->view() layerContentsPlacement]
- != NSViewLayerContentsPlacementScaleAxesIndependently;
- if (usesMetalLayer && usesNonDefaultContentsPlacement) {
- static bool deliverDisplayLinkUpdatesDuringLiveResize =
- qEnvironmentVariableIsSet("QT_MAC_DISPLAY_LINK_UPDATE_IN_RESIZE");
- if (!deliverDisplayLinkUpdatesDuringLiveResize) {
- // Must keep the link running, we do not know what the event
- // handlers for UpdateRequest (which is not sent now) would do,
- // would they trigger a new requestUpdate() or not.
- pauseUpdates = false;
- continue;
- }
- }
- }
-
platformWindow->deliverUpdateRequest();
// Another update request was triggered, keep the display link running
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.h b/src/plugins/platforms/cocoa/qcocoatheme.h
index c49d83feae..97e0f633a7 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.h
+++ b/src/plugins/platforms/cocoa/qcocoatheme.h
@@ -44,6 +44,7 @@ public:
static const char *name;
+ void requestColorScheme(Qt::ColorScheme scheme) override;
void handleSystemThemeChange();
#ifndef QT_NO_SHORTCUT
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index f4fbfadbe4..d9135c76c8 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -478,6 +478,23 @@ Qt::ColorScheme QCocoaTheme::colorScheme() const
return m_colorScheme;
}
+void QCocoaTheme::requestColorScheme(Qt::ColorScheme scheme)
+{
+ NSAppearance *appearance = nil;
+ switch (scheme) {
+ case Qt::ColorScheme::Dark:
+ appearance = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
+ break;
+ case Qt::ColorScheme::Light:
+ appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
+ break;
+ case Qt::ColorScheme::Unknown:
+ break;
+ }
+ if (appearance != NSApp.effectiveAppearance)
+ NSApplication.sharedApplication.appearance = appearance;
+}
+
/*
Update the theme's color scheme based on the current appearance.
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index ba1bc052fb..2036d4bf4c 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -80,6 +80,8 @@ public:
QRect normalGeometry() const override;
void setCocoaGeometry(const QRect &rect);
+ QMargins safeAreaMargins() const override;
+
void setVisible(bool visible) override;
void setWindowFlags(Qt::WindowFlags flags) override;
void setWindowState(Qt::WindowStates state) override;
@@ -122,6 +124,7 @@ public:
Q_NOTIFICATION_HANDLER(NSWindowDidMoveNotification) void windowDidMove();
Q_NOTIFICATION_HANDLER(NSWindowDidResizeNotification) void windowDidResize();
+ Q_NOTIFICATION_HANDLER(NSWindowWillStartLiveResizeNotification) void windowWillStartLiveResize();
Q_NOTIFICATION_HANDLER(NSWindowDidEndLiveResizeNotification) void windowDidEndLiveResize();
Q_NOTIFICATION_HANDLER(NSWindowDidBecomeKeyNotification) void windowDidBecomeKey();
Q_NOTIFICATION_HANDLER(NSWindowDidResignKeyNotification) void windowDidResignKey();
@@ -186,6 +189,8 @@ public:
Q_DECLARE_FLAGS(RecreationReasons, RecreationReason)
Q_FLAG(RecreationReasons)
+ bool inLiveResize() const override;
+
protected:
void recreateWindowIfNeeded();
QCocoaNSWindow *createNSWindow(bool shouldBePanel);
@@ -232,6 +237,7 @@ public: // for QNSView
bool m_inSetVisible = false;
bool m_inSetGeometry = false;
bool m_inSetStyleMask = false;
+ bool m_inLiveResize = false;
QCocoaMenuBar *m_menubar = nullptr;
@@ -241,6 +247,8 @@ public: // for QNSView
int m_registerTouchCount = 0;
bool m_resizableTransientParent = false;
+ QMargins m_lastReportedSafeAreaMargins;
+
static const int NoAlertRequest;
NSInteger m_alertRequest = NoAlertRequest;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 4a245a0f8a..b4c8ae4ba1 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -24,6 +24,7 @@
#include <qpa/qplatformscreen.h>
#include <QtGui/private/qcoregraphics_p.h>
#include <QtGui/private/qhighdpiscaling_p.h>
+#include <QtGui/private/qmetallayer_p.h>
#include <QDebug>
@@ -285,6 +286,54 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect)
// will call QPlatformWindow::setGeometry(rect) during resize confirmation (see qnsview.mm)
}
+QMargins QCocoaWindow::safeAreaMargins() const
+{
+ // The safe area of the view reflects the area not covered by navigation
+ // bars, tab bars, toolbars, and other ancestor views that might obscure
+ // the current view (by setting additionalSafeAreaInsets). If the window
+ // uses NSWindowStyleMaskFullSizeContentView this also includes the area
+ // of the view covered by the title bar.
+ QMarginsF viewSafeAreaMargins = {
+ m_view.safeAreaInsets.left,
+ m_view.safeAreaInsets.top,
+ m_view.safeAreaInsets.right,
+ m_view.safeAreaInsets.bottom
+ };
+
+ // The screen's safe area insets represent the distances from the screen's
+ // edges at which content isn't obscured. The view's safe area margins do
+ // not include the screen's insets automatically, so we need to manually
+ // merge them.
+ auto screenRect = m_view.window.screen.frame;
+ auto screenInsets = m_view.window.screen.safeAreaInsets;
+ auto screenRelativeViewBounds = QCocoaScreen::mapFromNative(
+ [m_view.window convertRectToScreen:
+ [m_view convertRect:m_view.bounds toView:nil]]
+ );
+
+ // The margins are relative to the screen the window is on.
+ // Note that we do not want represent the area outside of the
+ // screen as being outside of the safe area.
+ QMarginsF screenSafeAreaMargins = {
+ screenInsets.left ?
+ qMax(0.0f, screenInsets.left - screenRelativeViewBounds.left())
+ : 0.0f,
+ screenInsets.top ?
+ qMax(0.0f, screenInsets.top - screenRelativeViewBounds.top())
+ : 0.0f,
+ screenInsets.right ?
+ qMax(0.0f, screenInsets.right
+ - (screenRect.size.width - screenRelativeViewBounds.right()))
+ : 0.0f,
+ screenInsets.bottom ?
+ qMax(0.0f, screenInsets.bottom
+ - (screenRect.size.height - screenRelativeViewBounds.bottom()))
+ : 0.0f
+ };
+
+ return (screenSafeAreaMargins | viewSafeAreaMargins).toMargins();
+}
+
bool QCocoaWindow::startSystemMove()
{
switch (NSApp.currentEvent.type) {
@@ -514,7 +563,7 @@ NSInteger QCocoaWindow::windowLevel(Qt::WindowFlags flags)
auto *nsWindow = transientCocoaWindow->nativeWindow();
// We only upgrade the window level for "special" windows, to work
- // around Qt Designer parenting the designer windows to the widget
+ // around Qt Widgets Designer parenting the designer windows to the widget
// palette window (QTBUG-31779). This should be fixed in designer.
if (type != Qt::Window)
windowLevel = qMax(windowLevel, nsWindow.level);
@@ -1236,8 +1285,26 @@ void QCocoaWindow::windowDidResize()
handleWindowStateChanged();
}
+void QCocoaWindow::windowWillStartLiveResize()
+{
+ // Track live resizing for all windows, including
+ // child windows, so we know if it's safe to update
+ // the window unthrottled outside of the main thread.
+ m_inLiveResize = true;
+}
+
+bool QCocoaWindow::inLiveResize() const
+{
+ // Use member variable to track this instead of reflecting
+ // NSView.inLiveResize directly, so it can be called from
+ // non-main threads.
+ return m_inLiveResize;
+}
+
void QCocoaWindow::windowDidEndLiveResize()
{
+ m_inLiveResize = false;
+
if (!isContentView())
return;
@@ -1435,6 +1502,12 @@ void QCocoaWindow::handleGeometryChange()
QWindowSystemInterface::handleGeometryChange(window(), newGeometry);
+ // Changing the window geometry may affect the safe area margins
+ if (safeAreaMargins() != m_lastReportedSafeAreaMargins) {
+ m_lastReportedSafeAreaMargins = safeAreaMargins();
+ QWindowSystemInterface::handleSafeAreaMarginsChanged(window());
+ }
+
// Guard against processing window system events during QWindow::setGeometry
// calls, which Qt and Qt applications do not expect.
if (!m_inSetGeometry)
@@ -1617,6 +1690,23 @@ bool QCocoaWindow::updatesWithDisplayLink() const
void QCocoaWindow::deliverUpdateRequest()
{
qCDebug(lcQpaDrawing) << "Delivering update request to" << window();
+
+ if (auto *qtMetalLayer = qt_objc_cast<QMetalLayer*>(m_view.layer)) {
+ // We attempt a read lock here, so that the animation/render thread is
+ // prioritized lower than the main thread's displayLayer processing.
+ // Without this the two threads might fight over the next drawable,
+ // starving the main thread's presentation of the resized layer.
+ if (!qtMetalLayer.displayLock.tryLockForRead()) {
+ qCDebug(lcQpaDrawing) << "Deferring update request"
+ << "due to" << qtMetalLayer << "needing display";
+ return;
+ }
+
+ // But we don't hold the lock, as the update request can recurse
+ // back into setNeedsDisplay, which would deadlock.
+ qtMetalLayer.displayLock.unlock();
+ }
+
QPlatformWindow::deliverUpdateRequest();
}
@@ -1663,7 +1753,7 @@ void QCocoaWindow::setupPopupMonitor()
| NSEventMaskMouseMoved;
s_globalMouseMonitor = [NSEvent addGlobalMonitorForEventsMatchingMask:mouseButtonMask
handler:^(NSEvent *e){
- if (!QGuiApplicationPrivate::instance()->popupActive()) {
+ if (!QGuiApplicationPrivate::instance()->activePopupWindow()) {
removePopupMonitor();
return;
}
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 48ffa5c1cc..c63a8e2879 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -36,6 +36,9 @@
#endif
#include "qcocoaintegration.h"
#include <QtGui/private/qmacmimeregistry_p.h>
+#include <QtGui/private/qmetallayer_p.h>
+
+#include <QuartzCore/CATransaction.h>
@interface QNSView (Drawing) <CALayerDelegate>
- (void)initDrawing;
diff --git a/src/plugins/platforms/cocoa/qnsview_drawing.mm b/src/plugins/platforms/cocoa/qnsview_drawing.mm
index bf102e43f8..61691ab4fb 100644
--- a/src/plugins/platforms/cocoa/qnsview_drawing.mm
+++ b/src/plugins/platforms/cocoa/qnsview_drawing.mm
@@ -75,7 +75,10 @@
// too late at this point and the QWindow will be non-functional,
// but we can at least print a warning.
if ([MTLCreateSystemDefaultDevice() autorelease]) {
- return [CAMetalLayer layer];
+ static bool allowPresentsWithTransaction =
+ !qEnvironmentVariableIsSet("QT_MTL_NO_TRANSACTION");
+ return allowPresentsWithTransaction ?
+ [QMetalLayer layer] : [CAMetalLayer layer];
} else {
qCWarning(lcQpaDrawing) << "Failed to create QWindow::MetalSurface."
<< "Metal is not supported by any of the GPUs in this system.";
@@ -222,8 +225,39 @@
return;
}
- qCDebug(lcQpaDrawing) << "[QNSView displayLayer]" << m_platformWindow->window();
- m_platformWindow->handleExposeEvent(QRectF::fromCGRect(self.bounds).toRect());
+ const auto handleExposeEvent = [&]{
+ const auto bounds = QRectF::fromCGRect(self.bounds).toRect();
+ qCDebug(lcQpaDrawing) << "[QNSView displayLayer]" << m_platformWindow->window() << bounds;
+ m_platformWindow->handleExposeEvent(bounds);
+ };
+
+ if (auto *qtMetalLayer = qt_objc_cast<QMetalLayer*>(self.layer)) {
+ const bool presentedWithTransaction = qtMetalLayer.presentsWithTransaction;
+ qtMetalLayer.presentsWithTransaction = YES;
+
+ handleExposeEvent();
+
+ // If the expose event resulted in a secondary thread requesting that its
+ // drawable should be presented on the main thread with transaction, do so.
+ if (auto mainThreadPresentation = qtMetalLayer.mainThreadPresentation) {
+ mainThreadPresentation();
+ qtMetalLayer.mainThreadPresentation = nil;
+ }
+
+ qtMetalLayer.presentsWithTransaction = presentedWithTransaction;
+
+ // We're done presenting, but we must wait to unlock the display lock
+ // until the display cycle finishes, as otherwise the render thread may
+ // step in and present before the transaction commits. The display lock
+ // is recursive, so setNeedsDisplay can be safely called in the meantime
+ // without any issue.
+ QMetaObject::invokeMethod(m_platformWindow, [qtMetalLayer]{
+ qCDebug(lcMetalLayer) << "Unlocking" << qtMetalLayer << "after finishing display-cycle";
+ qtMetalLayer.displayLock.unlock();
+ }, Qt::QueuedConnection);
+ } else {
+ handleExposeEvent();
+ }
}
@end
diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm
index 74ba6f65ac..78ad1a7e99 100644
--- a/src/plugins/platforms/cocoa/qnswindow.mm
+++ b/src/plugins/platforms/cocoa/qnswindow.mm
@@ -351,7 +351,7 @@ NSWindow<QNSWindowProtocol> *qnswindow_cast(NSWindow *window)
// not Qt). However, an active popup is expected to grab any mouse event within the
// application, so we need to handle those explicitly and trust Qt's isWindowBlocked
// implementation to eat events that shouldn't be delivered anyway.
- if (isMouseEvent(theEvent) && QGuiApplicationPrivate::instance()->popupActive()
+ if (isMouseEvent(theEvent) && QGuiApplicationPrivate::instance()->activePopupWindow()
&& QGuiApplicationPrivate::instance()->isWindowBlocked(m_platformWindow->window(), nullptr)) {
qCDebug(lcQpaWindow) << "Mouse event over modally blocked window" << m_platformWindow->window()
<< "while popup is open - redirecting";
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp
index 2866c68de2..71a59cb08f 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp
@@ -84,10 +84,12 @@ QT_WARNING_POP
case QPaintDevice::PdmDevicePixelRatio:
return 1;
case QPaintDevice::PdmDevicePixelRatioScaled:
- return qRound(devicePixelRatioFScale());
+ return int(devicePixelRatioFScale());
case QPaintDevice::PdmWidthMM:
case QPaintDevice::PdmHeightMM:
break;
+ default:
+ break;
}
return -1;
diff --git a/src/plugins/platforms/eglfs/CMakeLists.txt b/src/plugins/platforms/eglfs/CMakeLists.txt
index a0a6116a45..cb4b5d1eb9 100644
--- a/src/plugins/platforms/eglfs/CMakeLists.txt
+++ b/src/plugins/platforms/eglfs/CMakeLists.txt
@@ -92,7 +92,7 @@ endif()
qt_internal_add_plugin(QEglFSIntegrationPlugin
OUTPUT_NAME qeglfs
PLUGIN_TYPE platforms
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES eglfs
+ DEFAULT_IF "eglfs" IN_LIST QT_QPA_PLATFORMS
SOURCES
qeglfsmain.cpp
DEFINES
diff --git a/src/plugins/platforms/ios/CMakeLists.txt b/src/plugins/platforms/ios/CMakeLists.txt
index 4cc3efc91e..51c1b52cf3 100644
--- a/src/plugins/platforms/ios/CMakeLists.txt
+++ b/src/plugins/platforms/ios/CMakeLists.txt
@@ -5,10 +5,23 @@
## QIOSIntegrationPlugin Plugin:
#####################################################################
+if(VISIONOS)
+ include(SwiftIntegration.cmake)
+
+ qt_install(TARGETS QIOSIntegrationPluginSwift
+ EXPORT "${INSTALL_CMAKE_NAMESPACE}QIOSIntegrationPluginTargets"
+ DESTINATION "${INSTALL_LIBDIR}"
+ )
+ qt_internal_add_targets_to_additional_targets_export_file(
+ TARGETS QIOSIntegrationPluginSwift
+ EXPORT_NAME_PREFIX "${INSTALL_CMAKE_NAMESPACE}QIOSIntegrationPlugin"
+ )
+endif()
+
qt_internal_add_plugin(QIOSIntegrationPlugin
OUTPUT_NAME qios
STATIC # Force static, even in shared builds
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES ios
+ DEFAULT_IF "ios" IN_LIST QT_QPA_PLATFORMS
PLUGIN_TYPE platforms
SOURCES
plugin.mm
@@ -86,3 +99,7 @@ qt_internal_extend_target(QIOSIntegrationPlugin CONDITION NOT (TVOS OR VISIONOS)
)
add_subdirectory(optional)
+
+if(VISIONOS)
+ target_link_libraries(QIOSIntegrationPlugin PRIVATE QIOSIntegrationPluginSwift)
+endif()
diff --git a/src/plugins/platforms/ios/SwiftIntegration.cmake b/src/plugins/platforms/ios/SwiftIntegration.cmake
new file mode 100644
index 0000000000..d52edb3ad2
--- /dev/null
+++ b/src/plugins/platforms/ios/SwiftIntegration.cmake
@@ -0,0 +1,78 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+set(CMAKE_Swift_COMPILER_TARGET arm64-apple-xros)
+if($CACHE{CMAKE_OSX_SYSROOT} MATCHES "^[a-z]+simulator$")
+ set(CMAKE_Swift_COMPILER_TARGET "${CMAKE_Swift_COMPILER_TARGET}-simulator")
+endif()
+
+cmake_policy(SET CMP0157 NEW)
+enable_language(Swift)
+
+# Verify that we have a new enough compiler
+if("${CMAKE_Swift_COMPILER_VERSION}" VERSION_LESS 5.9)
+ message(FATAL_ERROR "Swift 5.9 required for C++ interoperability")
+endif()
+
+get_target_property(QT_CORE_INCLUDES Qt6::Core INTERFACE_INCLUDE_DIRECTORIES)
+get_target_property(QT_GUI_INCLUDES Qt6::Gui INTERFACE_INCLUDE_DIRECTORIES)
+get_target_property(QT_CORE_PRIVATE_INCLUDES Qt6::CorePrivate INTERFACE_INCLUDE_DIRECTORIES)
+get_target_property(QT_GUI_PRIVATE_INCLUDES Qt6::GuiPrivate INTERFACE_INCLUDE_DIRECTORIES)
+
+set(target QIOSIntegrationPluginSwift)
+# Swift library
+set(SWIFT_SOURCES
+ "${CMAKE_CURRENT_SOURCE_DIR}/qiosapplication.swift"
+)
+add_library(${target} STATIC ${SWIFT_SOURCES})
+set_target_properties(${target} PROPERTIES
+ Swift_MODULE_NAME ${target})
+target_include_directories(${target} PUBLIC
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ "${QT_CORE_INCLUDES}"
+ "${QT_GUI_INCLUDES}"
+ "${QT_CORE_PRIVATE_INCLUDES}"
+ "${QT_GUI_PRIVATE_INCLUDES}"
+
+)
+target_compile_options(${target} PUBLIC
+ $<$<COMPILE_LANGUAGE:Swift>:-cxx-interoperability-mode=default>
+ $<$<COMPILE_LANGUAGE:Swift>:-Xcc -std=c++17>)
+
+# Swift to C++ bridging header
+set(SWIFT_BRIDGING_HEADER "${CMAKE_CURRENT_BINARY_DIR}/qiosswiftintegration.h")
+list(TRANSFORM QT_CORE_INCLUDES PREPEND "-I")
+list(TRANSFORM QT_GUI_INCLUDES PREPEND "-I")
+list(TRANSFORM QT_CORE_PRIVATE_INCLUDES PREPEND "-I")
+list(TRANSFORM QT_GUI_PRIVATE_INCLUDES PREPEND "-I")
+add_custom_command(
+ COMMAND
+ ${CMAKE_Swift_COMPILER} -frontend -typecheck
+ ${SWIFT_SOURCES}
+ -I ${CMAKE_CURRENT_SOURCE_DIR}
+ ${QT_CORE_INCLUDES}
+ ${QT_GUI_INCLUDES}
+ ${QT_CORE_PRIVATE_INCLUDES}
+ ${QT_GUI_PRIVATE_INCLUDES}
+ -sdk ${CMAKE_OSX_SYSROOT}
+ -module-name ${target}
+ -cxx-interoperability-mode=default
+ -Xcc -std=c++17
+ -emit-clang-header-path "${SWIFT_BRIDGING_HEADER}"
+ -target ${CMAKE_Swift_COMPILER_TARGET}
+ OUTPUT
+ "${SWIFT_BRIDGING_HEADER}"
+ DEPENDS
+ ${SWIFT_SOURCES}
+ )
+
+set(header_target "${target}Header")
+add_custom_target(${header_target}
+ DEPENDS "${SWIFT_BRIDGING_HEADER}"
+)
+# Make sure the "'__bridge_transfer' casts have no effect when not using ARC"
+# warning doesn't break warnings-are-error builds.
+target_compile_options(${target} INTERFACE
+ -Wno-error=arc-bridge-casts-disallowed-in-nonarc)
+
+add_dependencies(${target} ${header_target})
diff --git a/src/plugins/platforms/ios/module.modulemap b/src/plugins/platforms/ios/module.modulemap
new file mode 100644
index 0000000000..af42b3e1f5
--- /dev/null
+++ b/src/plugins/platforms/ios/module.modulemap
@@ -0,0 +1,4 @@
+module QIOSIntegrationPlugin {
+ header "qiosapplicationdelegate.h"
+ header "qiosintegration.h"
+}
diff --git a/src/plugins/platforms/ios/qiosapplication.swift b/src/plugins/platforms/ios/qiosapplication.swift
new file mode 100644
index 0000000000..9eb172a896
--- /dev/null
+++ b/src/plugins/platforms/ios/qiosapplication.swift
@@ -0,0 +1,198 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import SwiftUI
+import CompositorServices
+import QIOSIntegrationPlugin
+import RealityKit
+
+struct QIOSSwiftApplication: App {
+ @UIApplicationDelegateAdaptor private var appDelegate: QIOSApplicationDelegate
+
+ var body: some SwiftUI.Scene {
+ WindowGroup() {
+ ImmersiveSpaceControlView()
+ }
+
+ ImmersiveSpace(id: "QIOSImmersiveSpace") {
+ CompositorLayer(configuration: QIOSLayerConfiguration()) { layerRenderer in
+ QIOSIntegration.instance().renderCompositorLayer(layerRenderer)
+
+ // Handle any events in the scene.
+ layerRenderer.onSpatialEvent = { eventCollection in
+ QIOSIntegration.instance().handleSpatialEvents(jsonStringFromEventCollection(eventCollection))
+ }
+ }
+ }
+ // CompositorLayer immersive spaces are always full, and should not need
+ // to set the immersion style, but lacking this we get a warning in the
+ // console about not being able to "configure an immersive space with
+ // selected style 'AutomaticImmersionStyle' since it is not in the list
+ // of supported styles for this type of content: 'FullImmersionStyle'."
+ .immersionStyle(selection: .constant(.full), in: .full)
+ }
+}
+
+public struct QIOSLayerConfiguration: CompositorLayerConfiguration {
+ public func makeConfiguration(capabilities: LayerRenderer.Capabilities,
+ configuration: inout LayerRenderer.Configuration) {
+ // Use reflection to pull out underlying C handles
+ // FIXME: Use proper bridging APIs when available
+ let capabilitiesMirror = Mirror(reflecting: capabilities)
+ let configurationMirror = Mirror(reflecting: configuration)
+ QIOSIntegration.instance().configureCompositorLayer(
+ capabilitiesMirror.descendant("c_capabilities") as? cp_layer_renderer_capabilities_t,
+ configurationMirror.descendant("box", "value") as? cp_layer_renderer_configuration_t
+ )
+ }
+}
+
+public func runSwiftAppMain() {
+ QIOSSwiftApplication.main()
+}
+
+public class ImmersiveState: ObservableObject {
+ static let shared = ImmersiveState()
+ @Published var showImmersiveSpace: Bool = false
+}
+
+struct ImmersiveSpaceControlView: View {
+ @ObservedObject private var immersiveState = ImmersiveState.shared
+
+ @Environment(\.openImmersiveSpace) var openImmersiveSpace
+ @Environment(\.dismissImmersiveSpace) var dismissImmersiveSpace
+
+ var body: some View {
+ VStack {}
+ .onChange(of: immersiveState.showImmersiveSpace) { _, newValue in
+ Task {
+ if newValue {
+ await openImmersiveSpace(id: "QIOSImmersiveSpace")
+ } else {
+ await dismissImmersiveSpace()
+ }
+ }
+ }
+ }
+}
+
+public class ImmersiveSpaceManager : NSObject {
+ @objc public static func openImmersiveSpace() {
+ ImmersiveState.shared.showImmersiveSpace = true
+ }
+
+ @objc public static func dismissImmersiveSpace() {
+ ImmersiveState.shared.showImmersiveSpace = false
+ }
+}
+
+extension SpatialEventCollection.Event.Kind: Encodable {
+ enum CodingKeys: String, CodingKey {
+ case touch
+ case directPinch
+ case indirectPinch
+ case pointer
+ }
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.singleValueContainer()
+ switch self {
+ case .touch:
+ try container.encode("touch")
+ case .directPinch:
+ try container.encode("directPinch")
+ case .indirectPinch:
+ try container.encode("indirectPinch")
+ case .pointer:
+ try container.encode("pointer")
+ @unknown default:
+ try container.encode("unknown")
+ }
+ }
+}
+extension SpatialEventCollection.Event.Phase: Encodable {
+ enum CodingKeys: String, CodingKey {
+ case active
+ case ending
+ case cancled
+ }
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.singleValueContainer()
+ switch self {
+ case .active:
+ try container.encode("active")
+ case .ended:
+ try container.encode("ended")
+ case .cancelled:
+ try container.encode("canceled")
+ @unknown default:
+ try container.encode("unknown")
+ }
+ }
+}
+extension SpatialEventCollection.Event.InputDevicePose: Encodable {
+ enum CodingKeys: String, CodingKey {
+ case altitude
+ case azimuth
+ case pose3D
+ }
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(altitude.radians, forKey: .altitude)
+ try container.encode(azimuth.radians, forKey: .azimuth)
+ try container.encode(pose3D, forKey: .pose3D)
+ }
+}
+
+extension SpatialEventCollection.Event: Encodable {
+ enum CodingKeys: String, CodingKey {
+ case id
+ case timestamp
+ case kind
+ case location
+ case phase
+ case modifierKeys
+ case inputDevicePose
+ case location3D
+ case selectionRay
+ }
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(id.hashValue, forKey: .id)
+ try container.encode(timestamp, forKey: .timestamp)
+ try container.encode(kind, forKey: .kind)
+ try container.encode(location, forKey: .location)
+ try container.encode(phase, forKey: .phase)
+ try container.encode(modifierKeys.rawValue, forKey: .modifierKeys)
+ try container.encode(inputDevicePose, forKey: .inputDevicePose)
+ try container.encode(location3D, forKey: .location3D)
+ try container.encode(selectionRay, forKey: .selectionRay)
+ }
+}
+
+extension SpatialEventCollection: Encodable {
+ enum CodingKeys: String, CodingKey {
+ case events
+ }
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(Array(self), forKey: .events)
+ }
+}
+
+func jsonStringFromEventCollection(_ eventCollection: SpatialEventCollection) -> String {
+ let encoder = JSONEncoder()
+ encoder.dateEncodingStrategy = .iso8601
+
+ do {
+ let jsonData = try encoder.encode(eventCollection)
+ return String(data: jsonData, encoding: .utf8) ?? "{}"
+ } catch {
+ print("Failed to encode event collection: \(error)")
+ return "{}"
+ }
+}
diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.h b/src/plugins/platforms/ios/qiosapplicationdelegate.h
index 39bb9fdedb..7e12d64cbf 100644
--- a/src/plugins/platforms/ios/qiosapplicationdelegate.h
+++ b/src/plugins/platforms/ios/qiosapplicationdelegate.h
@@ -1,6 +1,9 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#ifndef QIOSAPPLICATIONDELEGATE_H
+#define QIOSAPPLICATIONDELEGATE_H
+
#import <UIKit/UIKit.h>
#import <QtGui/QtGui>
@@ -8,3 +11,5 @@
@interface QIOSApplicationDelegate : UIResponder <UIApplicationDelegate>
@end
+
+#endif // QIOSAPPLICATIONDELEGATE_H
diff --git a/src/plugins/platforms/ios/qiosdocumentpickercontroller.mm b/src/plugins/platforms/ios/qiosdocumentpickercontroller.mm
index fca0432426..09e2f2f4c3 100644
--- a/src/plugins/platforms/ios/qiosdocumentpickercontroller.mm
+++ b/src/plugins/platforms/ios/qiosdocumentpickercontroller.mm
@@ -30,14 +30,14 @@
case QFileDialogOptions::AnyFile:
case QFileDialogOptions::ExistingFile:
case QFileDialogOptions::ExistingFiles:
- [docTypes addObject:[UTType typeWithIdentifier:(__bridge NSString *)UTTypeContent]];
- [docTypes addObject:[UTType typeWithIdentifier:(__bridge NSString *)UTTypeItem]];
- [docTypes addObject:[UTType typeWithIdentifier:(__bridge NSString *)UTTypeData]];
+ [docTypes addObject:UTTypeContent];
+ [docTypes addObject:UTTypeItem];
+ [docTypes addObject:UTTypeData];
break;
// Showing files is not supported in Directory mode in iOS
case QFileDialogOptions::Directory:
case QFileDialogOptions::DirectoryOnly:
- [docTypes addObject:[UTType typeWithIdentifier:(__bridge NSString *)UTTypeFolder]];
+ [docTypes addObject:UTTypeFolder];
break;
}
}
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.h b/src/plugins/platforms/ios/qioseventdispatcher.h
index b40024ec19..5eee0556f5 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.h
+++ b/src/plugins/platforms/ios/qioseventdispatcher.h
@@ -16,6 +16,8 @@ public:
static QIOSEventDispatcher* create();
bool processPostedEvents() override;
+ static bool isQtApplication();
+
protected:
explicit QIOSEventDispatcher(QObject *parent = nullptr);
};
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm
index 24d9d88294..710a834bfd 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.mm
+++ b/src/plugins/platforms/ios/qioseventdispatcher.mm
@@ -5,6 +5,10 @@
#include "qiosapplicationdelegate.h"
#include "qiosglobal.h"
+#if defined(Q_OS_VISIONOS)
+#include "qiosswiftintegration.h"
+#endif
+
#include <QtCore/qprocessordetection.h>
#include <QtCore/private/qcoreapplication_p.h>
#include <QtCore/private/qthread_p.h>
@@ -173,12 +177,16 @@ namespace
QAppleLogActivity UIApplicationMain;
QAppleLogActivity applicationDidFinishLaunching;
} logActivity;
+
+ static bool s_isQtApplication = false;
}
using namespace QT_PREPEND_NAMESPACE(QtPrivate);
extern "C" int qt_main_wrapper(int argc, char *argv[])
{
+ s_isQtApplication = true;
+
@autoreleasepool {
size_t defaultStackSize = 512 * kBytesPerKiloByte; // Same as secondary threads
@@ -202,8 +210,16 @@ extern "C" int qt_main_wrapper(int argc, char *argv[])
logActivity.UIApplicationMain = QT_APPLE_LOG_ACTIVITY(
lcEventDispatcher().isDebugEnabled(), "UIApplicationMain").enter();
+#if defined(Q_OS_VISIONOS)
+ Q_UNUSED(argc);
+ Q_UNUSED(argv);
+ qCDebug(lcEventDispatcher) << "Starting Swift app";
+ QIOSIntegrationPluginSwift::runSwiftAppMain();
+ Q_UNREACHABLE();
+#else
qCDebug(lcEventDispatcher) << "Running UIApplicationMain";
return UIApplicationMain(argc, argv, nil, NSStringFromClass([QIOSApplicationDelegate class]));
+#endif
}
}
@@ -424,6 +440,11 @@ QIOSEventDispatcher::QIOSEventDispatcher(QObject *parent)
QWindowSystemInterface::setSynchronousWindowSystemEvents(true);
}
+bool QIOSEventDispatcher::isQtApplication()
+{
+ return s_isQtApplication;
+}
+
/*!
Override of the CoreFoundation posted events runloop source callback
so that we can send window system (QPA) events in addition to sending
diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm
index 25ccf2961b..1722e09aaa 100644
--- a/src/plugins/platforms/ios/qiosglobal.mm
+++ b/src/plugins/platforms/ios/qiosglobal.mm
@@ -5,6 +5,8 @@
#include "qiosapplicationdelegate.h"
#include "qiosviewcontroller.h"
#include "qiosscreen.h"
+#include "quiwindow.h"
+#include "qioseventdispatcher.h"
#include <QtCore/private/qcore_mac_p.h>
@@ -17,17 +19,13 @@ Q_LOGGING_CATEGORY(lcQpaWindowScene, "qt.qpa.window.scene");
bool isQtApplication()
{
- if (qt_apple_isApplicationExtension())
- return false;
-
// Returns \c true if the plugin is in full control of the whole application. This means
// that we control the application delegate and the top view controller, and can take
// actions that impacts all parts of the application. The opposite means that we are
// embedded inside a native iOS application, and should be more focused on playing along
// with native UIControls, and less inclined to change structures that lies outside the
// scope of our QWindows/UIViews.
- static bool isQt = ([qt_apple_sharedApplication().delegate isKindOfClass:[QIOSApplicationDelegate class]]);
- return isQt;
+ return QIOSEventDispatcher::isQtApplication();
}
bool isRunningOnVisionOS()
@@ -126,9 +124,15 @@ UIView *rootViewForScreen(QScreen *screen)
Q_UNUSED(iosScreen);
#endif
- UIWindow *uiWindow = windowScene.keyWindow;
- if (!uiWindow && windowScene.windows.count)
- uiWindow = windowScene.windows[0];
+ UIWindow *uiWindow = qt_objc_cast<QUIWindow*>(windowScene.keyWindow);
+ if (!uiWindow) {
+ for (UIWindow *win in windowScene.windows) {
+ if (qt_objc_cast<QUIWindow*>(win)) {
+ uiWindow = win;
+ break;
+ }
+ }
+ }
return uiWindow.rootViewController.view;
}
diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h
index 2c7d33cc94..6c2014d048 100644
--- a/src/plugins/platforms/ios/qiosintegration.h
+++ b/src/plugins/platforms/ios/qiosintegration.h
@@ -16,11 +16,24 @@
#include "qiostextinputoverlay.h"
#endif
+#if defined(Q_OS_VISIONOS)
+#include <swift/bridging>
+#endif
+
QT_BEGIN_NAMESPACE
+using namespace QNativeInterface;
+
class QIOSServices;
-class QIOSIntegration : public QPlatformNativeInterface, public QPlatformIntegration
+class
+#if defined(Q_OS_VISIONOS)
+ SWIFT_IMMORTAL_REFERENCE
+#endif
+QIOSIntegration : public QPlatformNativeInterface, public QPlatformIntegration
+#if defined(Q_OS_VISIONOS)
+ , public QVisionOSApplication
+#endif
{
Q_OBJECT
public:
@@ -77,6 +90,18 @@ public:
QIOSApplicationState applicationState;
+#if defined(Q_OS_VISIONOS)
+ void openImmersiveSpace() override;
+ void dismissImmersiveSpace() override;
+
+ using CompositorLayer = QVisionOSApplication::ImmersiveSpaceCompositorLayer;
+ void setImmersiveSpaceCompositorLayer(CompositorLayer *layer) override;
+
+ void configureCompositorLayer(cp_layer_renderer_capabilities_t, cp_layer_renderer_configuration_t);
+ void renderCompositorLayer(cp_layer_renderer_t);
+ void handleSpatialEvents(const char *jsonString);
+#endif
+
private:
QPlatformFontDatabase *m_fontDatabase;
#if QT_CONFIG(clipboard)
@@ -90,6 +115,10 @@ private:
#if !defined(Q_OS_TVOS) && !defined(Q_OS_VISIONOS)
QIOSTextInputOverlay m_textInputOverlay;
#endif
+
+#if defined(Q_OS_VISIONOS)
+ CompositorLayer *m_immersiveSpaceCompositorLayer = nullptr;
+#endif
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm
index 7cd21f83f6..76173ce830 100644
--- a/src/plugins/platforms/ios/qiosintegration.mm
+++ b/src/plugins/platforms/ios/qiosintegration.mm
@@ -17,6 +17,10 @@
#include "qiosservices.h"
#include "qiosoptionalplugininterface.h"
+#if defined(Q_OS_VISIONOS)
+#include "qiosswiftintegration.h"
+#endif
+
#include <QtGui/qpointingdevice.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qrhibackingstore_p.h>
@@ -296,6 +300,52 @@ void QIOSIntegration::setApplicationBadge(qint64 number)
// ---------------------------------------------------------
+#if defined(Q_OS_VISIONOS)
+void QIOSIntegration::openImmersiveSpace()
+{
+ [ImmersiveSpaceManager openImmersiveSpace];
+}
+
+void QIOSIntegration::dismissImmersiveSpace()
+{
+ [ImmersiveSpaceManager dismissImmersiveSpace];
+}
+
+void QIOSIntegration::setImmersiveSpaceCompositorLayer(CompositorLayer *layer)
+{
+ m_immersiveSpaceCompositorLayer = layer;
+}
+
+void QIOSIntegration::configureCompositorLayer(cp_layer_renderer_capabilities_t capabilities,
+ cp_layer_renderer_configuration_t configuration)
+{
+ if (m_immersiveSpaceCompositorLayer)
+ m_immersiveSpaceCompositorLayer->configure(capabilities, configuration);
+}
+
+void QIOSIntegration::renderCompositorLayer(cp_layer_renderer_t renderer)
+{
+ if (m_immersiveSpaceCompositorLayer)
+ m_immersiveSpaceCompositorLayer->render(renderer);
+}
+
+void QIOSIntegration::handleSpatialEvents(const char *jsonString)
+{
+ if (m_immersiveSpaceCompositorLayer) {
+ QJsonParseError error;
+ QJsonDocument doc = QJsonDocument::fromJson(QByteArray(jsonString), &error);
+ if (error.error != QJsonParseError::NoError) {
+ qWarning() << "Error parsing JSON: " << error.errorString();
+ return;
+ }
+ m_immersiveSpaceCompositorLayer->handleSpatialEvents(doc.object());
+ }
+}
+
+#endif
+
+// ---------------------------------------------------------
+
void *QIOSIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
{
if (!window || !window->handle())
diff --git a/src/plugins/platforms/ios/qiostextinputoverlay.mm b/src/plugins/platforms/ios/qiostextinputoverlay.mm
index 01046334a1..83170c1851 100644
--- a/src/plugins/platforms/ios/qiostextinputoverlay.mm
+++ b/src/plugins/platforms/ios/qiostextinputoverlay.mm
@@ -434,7 +434,7 @@ static void executeBlockWithoutAnimation(Block block)
if (enabled) {
_focusView = [reinterpret_cast<UIView *>(qApp->focusWindow()->winId()) retain];
- _desktopView = [qt_apple_sharedApplication().keyWindow.rootViewController.view retain];
+ _desktopView = [presentationWindow(nullptr).rootViewController.view retain];
Q_ASSERT(_focusView && _desktopView && _desktopView.superview);
[_desktopView addGestureRecognizer:self];
} else {
diff --git a/src/plugins/platforms/ios/qiostheme.h b/src/plugins/platforms/ios/qiostheme.h
index f0a404a61a..70e2c37ff1 100644
--- a/src/plugins/platforms/ios/qiostheme.h
+++ b/src/plugins/platforms/ios/qiostheme.h
@@ -4,6 +4,8 @@
#ifndef QIOSTHEME_H
#define QIOSTHEME_H
+#import <UIKit/UIKit.h>
+
#include <QtCore/QHash>
#include <QtGui/QPalette>
#include <qpa/qplatformtheme.h>
@@ -22,6 +24,7 @@ public:
QVariant themeHint(ThemeHint hint) const override;
Qt::ColorScheme colorScheme() const override;
+ void requestColorScheme(Qt::ColorScheme scheme) override;
#if !defined(Q_OS_TVOS) && !defined(Q_OS_VISIONOS)
QPlatformMenuItem* createPlatformMenuItem() const override;
@@ -37,9 +40,11 @@ public:
static const char *name;
static void initializeSystemPalette();
+ static void applyTheme(UIWindow *window);
private:
static QPalette s_systemPalette;
+ static inline Qt::ColorScheme s_colorSchemeOverride = Qt::ColorScheme::Unknown;
QMacNotificationObserver m_contentSizeCategoryObserver;
};
diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm
index 3853de9cf1..0b420a875a 100644
--- a/src/plugins/platforms/ios/qiostheme.mm
+++ b/src/plugins/platforms/ios/qiostheme.mm
@@ -154,6 +154,9 @@ Qt::ColorScheme QIOSTheme::colorScheme() const
// the OS reports itself as always being in dark mode.
return Qt::ColorScheme::Dark;
#else
+ if (s_colorSchemeOverride != Qt::ColorScheme::Unknown)
+ return s_colorSchemeOverride;
+
// Set the appearance based on the QUIWindow
// Fallback to the UIScreen if no window is created yet
UIUserInterfaceStyle appearance = UIScreen.mainScreen.traitCollection.userInterfaceStyle;
@@ -171,6 +174,38 @@ Qt::ColorScheme QIOSTheme::colorScheme() const
#endif
}
+void QIOSTheme::requestColorScheme(Qt::ColorScheme scheme)
+{
+#if defined(Q_OS_VISIONOS)
+ Q_UNUSED(scheme);
+#else
+ s_colorSchemeOverride = scheme;
+
+ const NSArray<UIWindow *> *windows = qt_apple_sharedApplication().windows;
+ for (UIWindow *window in windows) {
+ // don't apply a theme to windows we don't own
+ if (qt_objc_cast<QUIWindow*>(window))
+ applyTheme(window);
+ }
+#endif
+}
+
+void QIOSTheme::applyTheme(UIWindow *window)
+{
+ const UIUserInterfaceStyle style = []{
+ switch (s_colorSchemeOverride) {
+ case Qt::ColorScheme::Dark:
+ return UIUserInterfaceStyleDark;
+ case Qt::ColorScheme::Light:
+ return UIUserInterfaceStyleLight;
+ case Qt::ColorScheme::Unknown:
+ return UIUserInterfaceStyleUnspecified;
+ }
+ }();
+
+ window.overrideUserInterfaceStyle = style;
+}
+
const QFont *QIOSTheme::font(Font type) const
{
const auto *platformIntegration = QGuiApplicationPrivate::platformIntegration();
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 6a1080e238..f461a5f55b 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -55,8 +55,10 @@ QIOSWindow::QIOSWindow(QWindow *window, WId nativeHandle)
connect(qGuiApp, &QGuiApplication::applicationStateChanged, this, &QIOSWindow::applicationStateChanged);
- if (QPlatformWindow::parent())
- setParent(QPlatformWindow::parent());
+ // Always set parent, even if we don't have a parent window,
+ // as we use setParent to reparent top levels into our desktop
+ // manager view.
+ setParent(QPlatformWindow::parent());
if (!isForeignWindow()) {
// Resolve default window geometry in case it was not set before creating the
diff --git a/src/plugins/platforms/ios/quiwindow.mm b/src/plugins/platforms/ios/quiwindow.mm
index 7c910b6d9e..783e243e10 100644
--- a/src/plugins/platforms/ios/quiwindow.mm
+++ b/src/plugins/platforms/ios/quiwindow.mm
@@ -22,6 +22,15 @@
return self;
}
+- (instancetype)initWithWindowScene:(UIWindowScene *)windowScene
+{
+ if ((self = [super initWithWindowScene:windowScene]))
+ self->_sendingEvent = NO;
+
+ QIOSTheme::applyTheme(self);
+ return self;
+}
+
- (void)sendEvent:(UIEvent *)event
{
QScopedValueRollback<BOOL> sendingEvent(self->_sendingEvent, YES);
diff --git a/src/plugins/platforms/linuxfb/CMakeLists.txt b/src/plugins/platforms/linuxfb/CMakeLists.txt
index 9f75f53828..ba18cea50c 100644
--- a/src/plugins/platforms/linuxfb/CMakeLists.txt
+++ b/src/plugins/platforms/linuxfb/CMakeLists.txt
@@ -8,7 +8,7 @@
qt_internal_add_plugin(QLinuxFbIntegrationPlugin
OUTPUT_NAME qlinuxfb
PLUGIN_TYPE platforms
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES linuxfb
+ DEFAULT_IF "linuxfb" IN_LIST QT_QPA_PLATFORMS
SOURCES
main.cpp
qlinuxfbintegration.cpp qlinuxfbintegration.h
diff --git a/src/plugins/platforms/minimal/CMakeLists.txt b/src/plugins/platforms/minimal/CMakeLists.txt
index f3683deccf..18d8828134 100644
--- a/src/plugins/platforms/minimal/CMakeLists.txt
+++ b/src/plugins/platforms/minimal/CMakeLists.txt
@@ -10,7 +10,7 @@ qt_find_package(WrapFreetype PROVIDED_TARGETS WrapFreetype::WrapFreetype)
qt_internal_add_plugin(QMinimalIntegrationPlugin
OUTPUT_NAME qminimal
PLUGIN_TYPE platforms
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES minimal
+ DEFAULT_IF "minimal" IN_LIST QT_QPA_PLATFORMS
SOURCES
main.cpp
qminimalbackingstore.cpp qminimalbackingstore.h
diff --git a/src/plugins/platforms/minimalegl/CMakeLists.txt b/src/plugins/platforms/minimalegl/CMakeLists.txt
index a6ec8be781..b93f325b8f 100644
--- a/src/plugins/platforms/minimalegl/CMakeLists.txt
+++ b/src/plugins/platforms/minimalegl/CMakeLists.txt
@@ -10,7 +10,7 @@ qt_find_package(EGL)
qt_internal_add_plugin(QMinimalEglIntegrationPlugin
OUTPUT_NAME qminimalegl
PLUGIN_TYPE platforms
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES minimalegl
+ DEFAULT_IF "minimalegl" IN_LIST QT_QPA_PLATFORMS
SOURCES
main.cpp
qminimaleglintegration.cpp qminimaleglintegration.h
diff --git a/src/plugins/platforms/offscreen/CMakeLists.txt b/src/plugins/platforms/offscreen/CMakeLists.txt
index 09ad9a384d..907c2c9cc6 100644
--- a/src/plugins/platforms/offscreen/CMakeLists.txt
+++ b/src/plugins/platforms/offscreen/CMakeLists.txt
@@ -8,7 +8,7 @@
qt_internal_add_plugin(QOffscreenIntegrationPlugin
OUTPUT_NAME qoffscreen
PLUGIN_TYPE platforms
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES offscreen
+ DEFAULT_IF "offscreen" IN_LIST QT_QPA_PLATFORMS
SOURCES
main.cpp
qoffscreencommon.cpp qoffscreencommon.h
diff --git a/src/plugins/platforms/qnx/CMakeLists.txt b/src/plugins/platforms/qnx/CMakeLists.txt
index 9fb412d8a4..0f9deaa00b 100644
--- a/src/plugins/platforms/qnx/CMakeLists.txt
+++ b/src/plugins/platforms/qnx/CMakeLists.txt
@@ -8,7 +8,7 @@
qt_internal_add_plugin(QQnxIntegrationPlugin
OUTPUT_NAME qqnx
PLUGIN_TYPE platforms
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES qnx
+ DEFAULT_IF "qnx" IN_LIST QT_QPA_PLATFORMS
SOURCES
main.cpp main.h
qqnxabstractcover.h
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index cc10f6a00e..b308c956f2 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -49,6 +49,7 @@
#include <qpa/qwindowsysteminterface.h>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qrhibackingstore_p.h>
#if !defined(QT_NO_OPENGL)
#include "qqnxglcontext.h"
@@ -328,8 +329,19 @@ QPlatformWindow *QQnxIntegration::createPlatformWindow(QWindow *window) const
QPlatformBackingStore *QQnxIntegration::createPlatformBackingStore(QWindow *window) const
{
- qCDebug(lcQpaQnx) << Q_FUNC_INFO;
- return new QQnxRasterBackingStore(window);
+ QSurface::SurfaceType surfaceType = window->surfaceType();
+ qCDebug(lcQpaQnx) << Q_FUNC_INFO << surfaceType;
+ switch (surfaceType) {
+ case QSurface::RasterSurface:
+ return new QQnxRasterBackingStore(window);
+#if !defined(QT_NO_OPENGL)
+ // Return a QRhiBackingStore for non-raster surface windows
+ case QSurface::OpenGLSurface:
+ return new QRhiBackingStore(window);
+#endif
+ default:
+ return nullptr;
+ }
}
#if !defined(QT_NO_OPENGL)
diff --git a/src/plugins/platforms/vkkhrdisplay/CMakeLists.txt b/src/plugins/platforms/vkkhrdisplay/CMakeLists.txt
index 719e5c45e6..406487f1e9 100644
--- a/src/plugins/platforms/vkkhrdisplay/CMakeLists.txt
+++ b/src/plugins/platforms/vkkhrdisplay/CMakeLists.txt
@@ -6,7 +6,7 @@ qt_find_package(WrapFreetype PROVIDED_TARGETS WrapFreetype::WrapFreetype)
qt_internal_add_plugin(QVkKhrDisplayIntegrationPlugin
OUTPUT_NAME qvkkhrdisplay
PLUGIN_TYPE platforms
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES vkkhrdisplay
+ DEFAULT_IF "vkkhrdisplay" IN_LIST QT_QPA_PLATFORMS
SOURCES
main.cpp
qvkkhrdisplayintegration.cpp qvkkhrdisplayintegration.h
diff --git a/src/plugins/platforms/vnc/CMakeLists.txt b/src/plugins/platforms/vnc/CMakeLists.txt
index 25cb399bd0..34370807ae 100644
--- a/src/plugins/platforms/vnc/CMakeLists.txt
+++ b/src/plugins/platforms/vnc/CMakeLists.txt
@@ -8,7 +8,7 @@
qt_internal_add_plugin(QVncIntegrationPlugin
OUTPUT_NAME qvnc
PLUGIN_TYPE platforms
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES vnc
+ DEFAULT_IF "vnc" IN_LIST QT_QPA_PLATFORMS
SOURCES
main.cpp
qvnc.cpp qvnc_p.h
diff --git a/src/plugins/platforms/wasm/CMakeLists.txt b/src/plugins/platforms/wasm/CMakeLists.txt
index 185b921a4f..775946aaf9 100644
--- a/src/plugins/platforms/wasm/CMakeLists.txt
+++ b/src/plugins/platforms/wasm/CMakeLists.txt
@@ -7,9 +7,8 @@
qt_internal_add_plugin(QWasmIntegrationPlugin
OUTPUT_NAME qwasm
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES wasm
+ DEFAULT_IF "wasm" IN_LIST QT_QPA_PLATFORMS
PLUGIN_TYPE platforms
- STATIC
SOURCES
main.cpp
qwasmaccessibility.cpp qwasmaccessibility.h
diff --git a/src/plugins/platforms/wasm/qwasmdom.cpp b/src/plugins/platforms/wasm/qwasmdom.cpp
index 6b2b3d0933..96790ca71f 100644
--- a/src/plugins/platforms/wasm/qwasmdom.cpp
+++ b/src/plugins/platforms/wasm/qwasmdom.cpp
@@ -104,7 +104,10 @@ void DataTransfer::toMimeDataWithFile(std::function<void(QMimeData *)> callback)
if (--m_remainingItemCount > 0)
return;
- mimeData->setUrls(fileUrls);
+ QList<QUrl> allUrls;
+ allUrls.append(mimeData->urls());
+ allUrls.append(fileUrls);
+ mimeData->setUrls(allUrls);
m_callback(mimeData);
@@ -201,7 +204,11 @@ void DataTransfer::toMimeDataWithFile(std::function<void(QMimeData *)> callback)
mimeContext->mimeData->setHtml(data);
else if (itemMimeType.isEmpty() || itemMimeType == "text/plain")
mimeContext->mimeData->setText(data); // the type can be empty
- else {
+ else if (itemMimeType.isEmpty() || itemMimeType == "text/uri-list") {
+ QList<QUrl> urls;
+ urls.append(data);
+ mimeContext->mimeData->setUrls(urls);
+ } else {
// TODO improve encoding
if (data.startsWith("QB64")) {
data.remove(0, 4);
diff --git a/src/plugins/platforms/wasm/qwasmevent.cpp b/src/plugins/platforms/wasm/qwasmevent.cpp
index c1d6ce3a2a..e418263655 100644
--- a/src/plugins/platforms/wasm/qwasmevent.cpp
+++ b/src/plugins/platforms/wasm/qwasmevent.cpp
@@ -106,7 +106,7 @@ KeyEvent::KeyEvent(EventType type, emscripten::val event) : Event(type, event)
const auto code = event["code"].as<std::string>();
const auto webKey = event["key"].as<std::string>();
deadKey = isDeadKeyEvent(webKey.c_str());
-
+ autoRepeat = event["repeat"].as<bool>();
modifiers = KeyboardModifier::getForEvent(event);
key = webKeyToQtKey(code, webKey, deadKey, modifiers);
diff --git a/src/plugins/platforms/wasm/qwasmevent.h b/src/plugins/platforms/wasm/qwasmevent.h
index 6ada5393e3..bd0fb39f11 100644
--- a/src/plugins/platforms/wasm/qwasmevent.h
+++ b/src/plugins/platforms/wasm/qwasmevent.h
@@ -153,6 +153,7 @@ struct KeyEvent : public Event
QFlags<Qt::KeyboardModifier> modifiers;
bool deadKey;
QString text;
+ bool autoRepeat;
};
struct MouseEvent : public Event
diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp
index ddf8140c48..0490b2bfe0 100644
--- a/src/plugins/platforms/wasm/qwasmscreen.cpp
+++ b/src/plugins/platforms/wasm/qwasmscreen.cpp
@@ -361,10 +361,14 @@ QList<QWasmWindow *> QWasmScreen::allWindows()
{
QList<QWasmWindow *> windows;
for (auto *child : childStack()) {
- QWindowList list = child->window()->findChildren<QWindow *>(Qt::FindChildrenRecursively);
- std::transform(
- list.begin(), list.end(), std::back_inserter(windows),
- [](const QWindow *window) { return static_cast<QWasmWindow *>(window->handle()); });
+ const QWindowList list = child->window()->findChildren<QWindow *>(Qt::FindChildrenRecursively);
+ for (auto child : list) {
+ auto handle = child->handle();
+ if (handle) {
+ auto wnd = static_cast<QWasmWindow *>(handle);
+ windows.push_back(wnd);
+ }
+ }
windows.push_back(child);
}
return windows;
diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp
index b8197c5113..0513f46e5b 100644
--- a/src/plugins/platforms/wasm/qwasmwindow.cpp
+++ b/src/plugins/platforms/wasm/qwasmwindow.cpp
@@ -502,7 +502,7 @@ bool QWasmWindow::processKey(const KeyEvent &event)
const auto result = QWindowSystemInterface::handleKeyEvent(
0, event.type == EventType::KeyDown ? QEvent::KeyPress : QEvent::KeyRelease, event.key,
- event.modifiers, event.text);
+ event.modifiers, event.text, event.autoRepeat);
return clipboardResult == ProcessKeyboardResult::NativeClipboardEventAndCopiedDataNeeded
? ProceedToNativeEvent
: result;
diff --git a/src/plugins/platforms/wasm/wasm_shell.html b/src/plugins/platforms/wasm/wasm_shell.html
index 702ea1f59d..6e93955552 100644
--- a/src/plugins/platforms/wasm/wasm_shell.html
+++ b/src/plugins/platforms/wasm/wasm_shell.html
@@ -1,3 +1,8 @@
+<!--
+Copyright (C) 2024 The Qt Company Ltd.
+SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+-->
+
<!doctype html>
<html lang="en-us">
<head>
diff --git a/src/plugins/platforms/windows/CMakeLists.txt b/src/plugins/platforms/windows/CMakeLists.txt
index 4b92317978..8cd84e208b 100644
--- a/src/plugins/platforms/windows/CMakeLists.txt
+++ b/src/plugins/platforms/windows/CMakeLists.txt
@@ -8,7 +8,7 @@
qt_internal_add_plugin(QWindowsIntegrationPlugin
OUTPUT_NAME qwindows
PLUGIN_TYPE platforms
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES windows
+ DEFAULT_IF "windows" IN_LIST QT_QPA_PLATFORMS
SOURCES
main.cpp
qtwindowsglobal.h
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index de65a2171d..8c0261d568 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -201,6 +201,8 @@ QWindowsContext::~QWindowsContext()
if (d->m_powerDummyWindow)
DestroyWindow(d->m_powerDummyWindow);
+ d->m_screenManager.destroyWindow();
+
unregisterWindowClasses();
if (d->m_oleInitializeResult == S_OK || d->m_oleInitializeResult == S_FALSE) {
#ifdef QT_USE_FACTORY_CACHE_REGISTRATION
diff --git a/src/plugins/platforms/windows/qwindowsmimeregistry.cpp b/src/plugins/platforms/windows/qwindowsmimeregistry.cpp
index 8d147e8fa0..00cd792b5c 100644
--- a/src/plugins/platforms/windows/qwindowsmimeregistry.cpp
+++ b/src/plugins/platforms/windows/qwindowsmimeregistry.cpp
@@ -944,7 +944,7 @@ QVariant QWindowsMimeImage::convertToMime(const QString &mimeType, IDataObject *
if (canGetData(CF_DIB, pDataObj)) {
qCDebug(lcQpaMime) << "Decoding DIB";
QImage img;
- QByteArray data = getData(CF_DIBV5, pDataObj);
+ QByteArray data = getData(CF_DIB, pDataObj);
QBuffer buffer(&data);
if (readDib(buffer, img))
return img;
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index a50f9fd4b0..1f22fb4f60 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -698,11 +698,15 @@ void QWindowsScreenManager::initialize()
handleScreenChanges();
}
-QWindowsScreenManager::~QWindowsScreenManager()
+void QWindowsScreenManager::destroyWindow()
{
+ qCDebug(lcQpaScreen) << "Destroying display change observer" << m_displayChangeObserver;
DestroyWindow(m_displayChangeObserver);
+ m_displayChangeObserver = nullptr;
}
+QWindowsScreenManager::~QWindowsScreenManager() = default;
+
bool QWindowsScreenManager::isSingleScreen()
{
return QWindowsContext::instance()->screenManager().screens().size() < 2;
diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h
index 0467ab2a0c..ea6a29efe3 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.h
+++ b/src/plugins/platforms/windows/qwindowsscreen.h
@@ -105,6 +105,7 @@ public:
QWindowsScreenManager();
void initialize();
+ void destroyWindow();
~QWindowsScreenManager();
void clearScreens();
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index fb5874fd8b..b6017c7692 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -301,6 +301,9 @@ void QWindowsTheme::populateLightSystemBasePalette(QPalette &result)
void QWindowsTheme::populateDarkSystemBasePalette(QPalette &result)
{
+ QColor foreground, background,
+ accent, accentDark, accentDarker, accentDarkest,
+ accentLight, accentLighter, accentLightest;
#if QT_CONFIG(cpp_winrt)
using namespace winrt::Windows::UI::ViewManagement;
const auto settings = UISettings();
@@ -308,32 +311,37 @@ void QWindowsTheme::populateDarkSystemBasePalette(QPalette &result)
// We have to craft a palette from these colors. The settings.UIElementColor(UIElementType) API
// returns the old system colors, not the dark mode colors. If the background is black (which it
// usually), then override it with a dark gray instead so that we can go up and down the lightness.
- const QColor foreground = getSysColor(settings.GetColorValue(UIColorType::Foreground));
- const QColor background = [&settings]() -> QColor {
- auto systemBackground = getSysColor(settings.GetColorValue(UIColorType::Background));
- if (systemBackground == Qt::black)
- systemBackground = QColor(0x1E, 0x1E, 0x1E);
- return systemBackground;
- }();
-
- const QColor accent = getSysColor(settings.GetColorValue(UIColorType::Accent));
- const QColor accentDark = getSysColor(settings.GetColorValue(UIColorType::AccentDark1));
- const QColor accentDarker = getSysColor(settings.GetColorValue(UIColorType::AccentDark2));
- const QColor accentDarkest = getSysColor(settings.GetColorValue(UIColorType::AccentDark3));
- const QColor accentLight = getSysColor(settings.GetColorValue(UIColorType::AccentLight1));
- const QColor accentLighter = getSysColor(settings.GetColorValue(UIColorType::AccentLight2));
- const QColor accentLightest = getSysColor(settings.GetColorValue(UIColorType::AccentLight3));
-#else
- const QColor foreground = Qt::white;
- const QColor background = QColor(0x1E, 0x1E, 0x1E);
- const QColor accent = qt_accentColor(AccentColorNormal);
- const QColor accentDark = accent.darker(120);
- const QColor accentDarker = accentDark.darker(120);
- const QColor accentDarkest = accentDarker.darker(120);
- const QColor accentLight = accent.lighter(120);
- const QColor accentLighter = accentLight.lighter(120);
- const QColor accentLightest = accentLighter.lighter(120);
+ if (QWindowsTheme::queryColorScheme() == Qt::ColorScheme::Dark) {
+ // the system is actually running in dark mode, so UISettings will give us dark colors
+ foreground = getSysColor(settings.GetColorValue(UIColorType::Foreground));
+ background = [&settings]() -> QColor {
+ auto systemBackground = getSysColor(settings.GetColorValue(UIColorType::Background));
+ if (systemBackground == Qt::black)
+ systemBackground = QColor(0x1E, 0x1E, 0x1E);
+ return systemBackground;
+ }();
+
+ accent = getSysColor(settings.GetColorValue(UIColorType::Accent));
+ accentDark = getSysColor(settings.GetColorValue(UIColorType::AccentDark1));
+ accentDarker = getSysColor(settings.GetColorValue(UIColorType::AccentDark2));
+ accentDarkest = getSysColor(settings.GetColorValue(UIColorType::AccentDark3));
+ accentLight = getSysColor(settings.GetColorValue(UIColorType::AccentLight1));
+ accentLighter = getSysColor(settings.GetColorValue(UIColorType::AccentLight2));
+ accentLightest = getSysColor(settings.GetColorValue(UIColorType::AccentLight3));
+ } else
#endif
+ {
+ // If the system is running in light mode, then we need to make up our own dark palette
+ foreground = Qt::white;
+ background = QColor(0x1E, 0x1E, 0x1E);
+ accent = qt_accentColor(AccentColorNormal);
+ accentDark = accent.darker(120);
+ accentDarker = accentDark.darker(120);
+ accentDarkest = accentDarker.darker(120);
+ accentLight = accent.lighter(120);
+ accentLighter = accentLight.lighter(120);
+ accentLightest = accentLighter.lighter(120);
+ }
const QColor linkColor = accent;
const QColor buttonColor = background.lighter(200);
@@ -549,25 +557,35 @@ Qt::ColorScheme QWindowsTheme::effectiveColorScheme()
{
if (queryHighContrast())
return Qt::ColorScheme::Unknown;
- return s_colorScheme;
+ if (s_colorSchemeOverride != Qt::ColorScheme::Unknown)
+ return s_colorSchemeOverride;
+ if (s_colorScheme != Qt::ColorScheme::Unknown)
+ return s_colorScheme;
+ return queryColorScheme();
+}
+
+void QWindowsTheme::requestColorScheme(Qt::ColorScheme scheme)
+{
+ s_colorSchemeOverride = scheme;
+ handleSettingsChanged();
}
void QWindowsTheme::handleSettingsChanged()
{
- const auto newColorScheme = QWindowsTheme::queryColorScheme();
- const bool colorSchemeChanged = newColorScheme != QWindowsTheme::s_colorScheme;
+ const auto oldColorScheme = s_colorScheme;
+ s_colorScheme = Qt::ColorScheme::Unknown; // make effectiveColorScheme() query registry
+ const auto newColorScheme = effectiveColorScheme();
+ const bool colorSchemeChanged = newColorScheme != oldColorScheme;
s_colorScheme = newColorScheme;
auto integration = QWindowsIntegration::instance();
integration->updateApplicationBadge();
if (integration->darkModeHandling().testFlag(QWindowsApplication::DarkModeStyle)) {
QWindowsTheme::instance()->refresh();
- QWindowSystemInterface::handleThemeChange();
+ QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>();
}
if (colorSchemeChanged) {
- if (integration->darkModeHandling().testFlag(QWindowsApplication::DarkModeWindowFrames)) {
- for (QWindowsWindow *w : std::as_const(QWindowsContext::instance()->windows()))
- w->setDarkBorder(s_colorScheme == Qt::ColorScheme::Dark);
- }
+ for (QWindowsWindow *w : std::as_const(QWindowsContext::instance()->windows()))
+ w->setDarkBorder(s_colorScheme == Qt::ColorScheme::Dark);
}
}
diff --git a/src/plugins/platforms/windows/qwindowstheme.h b/src/plugins/platforms/windows/qwindowstheme.h
index 6109122944..a89fb1e5bd 100644
--- a/src/plugins/platforms/windows/qwindowstheme.h
+++ b/src/plugins/platforms/windows/qwindowstheme.h
@@ -32,6 +32,7 @@ public:
QVariant themeHint(ThemeHint) const override;
Qt::ColorScheme colorScheme() const override;
+ void requestColorScheme(Qt::ColorScheme scheme) override;
static void handleSettingsChanged();
@@ -79,6 +80,8 @@ private:
static QWindowsTheme *m_instance;
static inline Qt::ColorScheme s_colorScheme = Qt::ColorScheme::Unknown;
+ static inline Qt::ColorScheme s_colorSchemeOverride = Qt::ColorScheme::Unknown;
+
QPalette *m_palettes[NPalettes];
QFont *m_fonts[NFonts];
QList<QSize> m_fileIconSizes;
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 03c5d149a6..4b7ce0a979 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -850,7 +850,8 @@ static inline bool shouldApplyDarkFrame(const QWindow *w)
{
if (!w->isTopLevel() || w->flags().testFlag(Qt::FramelessWindowHint))
return false;
- // the application has explicitly opted out of dark frames
+
+ // the user of the application has explicitly opted out of dark frames
if (!QWindowsIntegration::instance()->darkModeHandling().testFlag(QWindowsApplication::DarkModeWindowFrames))
return false;
@@ -2481,6 +2482,11 @@ void QWindowsWindow::handleWindowStateChange(Qt::WindowStates state)
GetWindowPlacement(m_data.hwnd, &windowPlacement);
const RECT geometry = RECTfromQRect(m_data.restoreGeometry);
windowPlacement.rcNormalPosition = geometry;
+ // Even if the window is hidden, windowPlacement's showCmd is not SW_HIDE, so change it
+ // manually to avoid unhiding a hidden window with the subsequent call to
+ // SetWindowPlacement().
+ if (!isVisible())
+ windowPlacement.showCmd = SW_HIDE;
SetWindowPlacement(m_data.hwnd, &windowPlacement);
}
// QTBUG-17548: We send expose events when receiving WM_Paint, but for
@@ -3286,17 +3292,6 @@ enum : WORD {
DwmwaUseImmersiveDarkModeBefore20h1 = 19
};
-static bool queryDarkBorder(HWND hwnd)
-{
- BOOL result = FALSE;
- const bool ok =
- SUCCEEDED(DwmGetWindowAttribute(hwnd, DwmwaUseImmersiveDarkMode, &result, sizeof(result)))
- || SUCCEEDED(DwmGetWindowAttribute(hwnd, DwmwaUseImmersiveDarkModeBefore20h1, &result, sizeof(result)));
- if (!ok)
- qCWarning(lcQpaWindow, "%s: Unable to retrieve dark window border setting.", __FUNCTION__);
- return result == TRUE;
-}
-
bool QWindowsWindow::setDarkBorderToWindow(HWND hwnd, bool d)
{
const BOOL darkBorder = d ? TRUE : FALSE;
@@ -3312,8 +3307,6 @@ void QWindowsWindow::setDarkBorder(bool d)
{
// respect explicit opt-out and incompatible palettes or styles
d = d && shouldApplyDarkFrame(window());
- if (queryDarkBorder(m_data.hwnd) == d)
- return;
setDarkBorderToWindow(m_data.hwnd, d);
}
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp
index 1abb412ccd..5892493281 100644
--- a/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp
@@ -127,6 +127,9 @@ void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event
return;
switch (event->type()) {
+ case QAccessible::Announcement:
+ QWindowsUiaMainProvider::raiseNotification(static_cast<QAccessibleAnnouncementEvent *>(event));
+ break;
case QAccessible::Focus:
QWindowsUiaMainProvider::notifyFocusChange(event);
break;
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
index 95ddbcced6..be88ab4ae8 100644
--- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
@@ -204,6 +204,24 @@ void QWindowsUiaMainProvider::notifyTextChange(QAccessibleEvent *event)
}
}
+void QWindowsUiaMainProvider::raiseNotification(QAccessibleAnnouncementEvent *event)
+{
+ if (QAccessibleInterface *accessible = event->accessibleInterface()) {
+ if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) {
+ BSTR message = bStrFromQString(event->message());
+ QAccessible::AnnouncementPriority prio = event->priority();
+ NotificationProcessing processing = (prio == QAccessible::AnnouncementPriority::Assertive)
+ ? NotificationProcessing_ImportantAll
+ : NotificationProcessing_All;
+ BSTR activityId = bStrFromQString(QString::fromLatin1(""));
+ UiaRaiseNotificationEvent(provider, NotificationKind_Other, processing, message, activityId);
+
+ ::SysFreeString(message);
+ ::SysFreeString(activityId);
+ }
+ }
+}
+
HRESULT STDMETHODCALLTYPE QWindowsUiaMainProvider::QueryInterface(REFIID iid, LPVOID *iface)
{
HRESULT result = QComObject::QueryInterface(iid, iface);
@@ -370,6 +388,93 @@ void QWindowsUiaMainProvider::fillVariantArrayForRelation(QAccessibleInterface*
pRetVal->parray = elements;
}
+void QWindowsUiaMainProvider::setAriaProperties(QAccessibleInterface *accessible, VARIANT *pRetVal)
+{
+ Q_ASSERT(accessible);
+
+ QAccessibleAttributesInterface *attributesIface = accessible->attributesInterface();
+ if (!attributesIface)
+ return;
+
+ QString ariaString;
+ const QList<QAccessible::Attribute> attrKeys = attributesIface->attributeKeys();
+ for (qsizetype i = 0; i < attrKeys.size(); ++i) {
+ if (i != 0)
+ ariaString += QStringLiteral(";");
+ const QAccessible::Attribute key = attrKeys.at(i);
+ const QVariant value = attributesIface->attributeValue(key);
+ // see "Core Accessibility API Mappings" spec: https://www.w3.org/TR/core-aam-1.2/
+ switch (key) {
+ case QAccessible::Attribute::Custom:
+ {
+ // forward custom attributes as-is
+ Q_ASSERT((value.canConvert<QHash<QString, QString>>()));
+ const QHash<QString, QString> attrMap = value.value<QHash<QString, QString>>();
+ for (auto [name, val] : attrMap.asKeyValueRange()) {
+ if (name != *attrMap.keyBegin())
+ ariaString += QStringLiteral(";");
+ ariaString += name + QStringLiteral("=") + val;
+ }
+ break;
+ }
+ case QAccessible::Attribute::Level:
+ Q_ASSERT(value.canConvert<int>());
+ ariaString += QStringLiteral("level=") + QString::number(value.toInt());
+ break;
+ default:
+ break;
+ }
+ }
+
+ setVariantString(ariaString, pRetVal);
+}
+
+void QWindowsUiaMainProvider::setStyle(QAccessibleInterface *accessible, VARIANT *pRetVal)
+{
+ Q_ASSERT(accessible);
+
+ QAccessibleAttributesInterface *attributesIface = accessible->attributesInterface();
+ if (!attributesIface)
+ return;
+
+ // currently, only heading styles are implemented here
+ if (accessible->role() != QAccessible::Role::Heading)
+ return;
+
+ const QVariant levelVariant = attributesIface->attributeValue(QAccessible::Attribute::Level);
+ if (!levelVariant.isValid())
+ return;
+
+ Q_ASSERT(levelVariant.canConvert<int>());
+ // UIA only has styles for heading levels 1-9
+ const int level = levelVariant.toInt();
+ if (level < 1 || level > 9)
+ return;
+
+ const int styleId = styleIdForHeadingLevel(level);
+ setVariantI4(styleId, pRetVal);
+}
+
+int QWindowsUiaMainProvider::styleIdForHeadingLevel(int headingLevel)
+{
+ // only heading levels 1-9 have a corresponding UIA style ID
+ Q_ASSERT(headingLevel > 0 && headingLevel <= 9);
+
+ static constexpr int styles[] = {
+ StyleId_Heading1,
+ StyleId_Heading2,
+ StyleId_Heading3,
+ StyleId_Heading4,
+ StyleId_Heading5,
+ StyleId_Heading6,
+ StyleId_Heading7,
+ StyleId_Heading8,
+ StyleId_Heading9,
+ };
+
+ return styles[headingLevel - 1];
+}
+
HRESULT QWindowsUiaMainProvider::GetPropertyValue(PROPERTYID idProp, VARIANT *pRetVal)
{
qCDebug(lcQpaUiAutomation) << __FUNCTION__ << idProp;
@@ -393,6 +498,9 @@ HRESULT QWindowsUiaMainProvider::GetPropertyValue(PROPERTYID idProp, VARIANT *pR
// Accelerator key.
setVariantString(accessible->text(QAccessible::Accelerator), pRetVal);
break;
+ case UIA_AriaPropertiesPropertyId:
+ setAriaProperties(accessible, pRetVal);
+ break;
case UIA_AutomationIdPropertyId:
// Automation ID, which can be used by tools to select a specific control in the UI.
setVariantString(automationIdForAccessible(accessible), pRetVal);
@@ -493,6 +601,9 @@ HRESULT QWindowsUiaMainProvider::GetPropertyValue(PROPERTYID idProp, VARIANT *pR
setVariantString(name, pRetVal);
break;
}
+ case UIA_StyleIdAttributeId:
+ setStyle(accessible, pRetVal);
+ break;
default:
break;
}
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h
index 99db0ed318..dafe877974 100644
--- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h
@@ -34,6 +34,7 @@ public:
static void notifyNameChange(QAccessibleEvent *event);
static void notifySelectionChange(QAccessibleEvent *event);
static void notifyTextChange(QAccessibleEvent *event);
+ static void raiseNotification(QAccessibleAnnouncementEvent *event);
// IUnknown
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, LPVOID *iface) override;
@@ -60,6 +61,10 @@ public:
private:
QString automationIdForAccessible(const QAccessibleInterface *accessible);
static void fillVariantArrayForRelation(QAccessibleInterface *accessible, QAccessible::Relation relation, VARIANT *pRetVal);
+ static void setAriaProperties(QAccessibleInterface *accessible, VARIANT *pRetVal);
+ static void setStyle(QAccessibleInterface *accessible, VARIANT *pRetVal);
+ /** Returns the UIA style ID for a heading level from 1 to 9. */
+ static int styleIdForHeadingLevel(int headingLevel);
static QMutex m_mutex;
};
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiautomation.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiautomation.cpp
index 1593a07202..6954a881d0 100644
--- a/src/plugins/platforms/windows/uiautomation/qwindowsuiautomation.cpp
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiautomation.cpp
@@ -69,6 +69,14 @@ HRESULT WINAPI UiaRaiseAutomationEvent(IRawElementProviderSimple *pProvider, EVE
return func.invoke(pProvider, id);
}
+HRESULT WINAPI UiaRaiseNotificationEvent(
+ IRawElementProviderSimple *pProvider, NotificationKind notificationKind,
+ NotificationProcessing notificationProcessing, BSTR displayString, BSTR activityId)
+{
+ static auto func = winapi_func("uiautomationcore", FN(UiaRaiseNotificationEvent));
+ return func.invoke(pProvider, notificationKind, notificationProcessing, displayString, activityId);
+}
+
#endif // defined(__MINGW32__) || defined(__MINGW64__)
#endif // QT_CONFIG(accessibility)
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiautomation.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiautomation.h
index a192b9b0fb..4eb37bafa0 100644
--- a/src/plugins/platforms/windows/uiautomation/qwindowsuiautomation.h
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiautomation.h
@@ -14,8 +14,19 @@
#define UIA_SelectionPattern2Id 10034
#define UIA_IsReadOnlyAttributeId 40015
#define UIA_StrikethroughStyleAttributeId 40026
+#define UIA_StyleIdAttributeId 40034
#define UIA_CaretPositionAttributeId 40038
+#define StyleId_Heading1 70001
+#define StyleId_Heading2 70002
+#define StyleId_Heading3 70003
+#define StyleId_Heading4 70004
+#define StyleId_Heading5 70005
+#define StyleId_Heading6 70006
+#define StyleId_Heading7 70007
+#define StyleId_Heading8 70008
+#define StyleId_Heading9 70009
+
enum CaretPosition {
CaretPosition_Unknown = 0,
CaretPosition_EndOfLine = 1,
diff --git a/src/plugins/platforms/xcb/CMakeLists.txt b/src/plugins/platforms/xcb/CMakeLists.txt
index e8fb442dd4..96758e7181 100644
--- a/src/plugins/platforms/xcb/CMakeLists.txt
+++ b/src/plugins/platforms/xcb/CMakeLists.txt
@@ -164,7 +164,7 @@ endif()
qt_internal_add_plugin(QXcbIntegrationPlugin
OUTPUT_NAME qxcb
PLUGIN_TYPE platforms
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES xcb
+ DEFAULT_IF "xcb" IN_LIST QT_QPA_PLATFORMS
SOURCES
qxcbmain.cpp
DEFINES
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index 40e2f47354..77157595b8 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -61,7 +61,7 @@ protected:
// get the list of targets from the current clipboard owner - we do this
// once so that multiple calls to this function don't require multiple
// server round trips...
- that->format_atoms = m_clipboard->getDataInFormat(modeAtom, m_clipboard->atom(QXcbAtom::AtomTARGETS));
+ that->format_atoms = m_clipboard->getDataInFormat(modeAtom, m_clipboard->atom(QXcbAtom::AtomTARGETS)).value_or(QByteArray());
if (format_atoms.size() > 0) {
const xcb_atom_t *targets = (const xcb_atom_t *) format_atoms.data();
@@ -91,7 +91,7 @@ protected:
{
auto requestedType = type;
if (fmt.isEmpty() || isEmpty())
- return QByteArray();
+ return QVariant();
(void)formats(); // trigger update of format list
@@ -108,7 +108,11 @@ protected:
if (fmtatom == 0)
return QVariant();
- return mimeConvertToFormat(m_clipboard->connection(), fmtatom, m_clipboard->getDataInFormat(modeAtom, fmtatom), fmt, requestedType, hasUtf8);
+ const std::optional<QByteArray> result = m_clipboard->getDataInFormat(modeAtom, fmtatom);
+ if (!result.has_value())
+ return QVariant();
+
+ return mimeConvertToFormat(m_clipboard->connection(), fmtatom, result.value(), fmt, requestedType, hasUtf8);
}
private:
@@ -776,7 +780,7 @@ xcb_generic_event_t *QXcbClipboard::waitForClipboardEvent(xcb_window_t window, i
return nullptr;
}
-QByteArray QXcbClipboard::clipboardReadIncrementalProperty(xcb_window_t win, xcb_atom_t property, int nbytes, bool nullterm)
+std::optional<QByteArray> QXcbClipboard::clipboardReadIncrementalProperty(xcb_window_t win, xcb_atom_t property, int nbytes, bool nullterm)
{
QByteArray buf;
QByteArray tmp_buf;
@@ -841,17 +845,16 @@ QByteArray QXcbClipboard::clipboardReadIncrementalProperty(xcb_window_t win, xcb
// could consider next request to be still part of this timed out request
setRequestor(0);
- return QByteArray();
+ return std::nullopt;
}
-QByteArray QXcbClipboard::getDataInFormat(xcb_atom_t modeAtom, xcb_atom_t fmtAtom)
+std::optional<QByteArray> QXcbClipboard::getDataInFormat(xcb_atom_t modeAtom, xcb_atom_t fmtAtom)
{
return getSelection(modeAtom, fmtAtom, atom(QXcbAtom::Atom_QT_SELECTION));
}
-QByteArray QXcbClipboard::getSelection(xcb_atom_t selection, xcb_atom_t target, xcb_atom_t property, xcb_timestamp_t time)
+std::optional<QByteArray> QXcbClipboard::getSelection(xcb_atom_t selection, xcb_atom_t target, xcb_atom_t property, xcb_timestamp_t time)
{
- QByteArray buf;
xcb_window_t win = requestor();
if (time == 0) time = connection()->time();
@@ -866,17 +869,19 @@ QByteArray QXcbClipboard::getSelection(xcb_atom_t selection, xcb_atom_t target,
free(ge);
if (no_selection)
- return buf;
+ return std::nullopt;
xcb_atom_t type;
+ QByteArray buf;
if (clipboardReadProperty(win, property, true, &buf, nullptr, &type, nullptr)) {
if (type == atom(QXcbAtom::AtomINCR)) {
int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0;
- buf = clipboardReadIncrementalProperty(win, property, nbytes, false);
+ return clipboardReadIncrementalProperty(win, property, nbytes, false);
}
+ return buf;
}
- return buf;
+ return std::nullopt;
}
#endif // QT_NO_CLIPBOARD
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.h b/src/plugins/platforms/xcb/qxcbclipboard.h
index 79c48a0af5..134daf4be7 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.h
+++ b/src/plugins/platforms/xcb/qxcbclipboard.h
@@ -67,13 +67,13 @@ public:
void handleXFixesSelectionRequest(xcb_xfixes_selection_notify_event_t *event);
bool clipboardReadProperty(xcb_window_t win, xcb_atom_t property, bool deleteProperty, QByteArray *buffer, int *size, xcb_atom_t *type, int *format);
- QByteArray clipboardReadIncrementalProperty(xcb_window_t win, xcb_atom_t property, int nbytes, bool nullterm);
+ std::optional<QByteArray> clipboardReadIncrementalProperty(xcb_window_t win, xcb_atom_t property, int nbytes, bool nullterm);
- QByteArray getDataInFormat(xcb_atom_t modeAtom, xcb_atom_t fmtatom);
+ std::optional<QByteArray> getDataInFormat(xcb_atom_t modeAtom, xcb_atom_t fmtatom);
bool handlePropertyNotify(const xcb_generic_event_t *event);
- QByteArray getSelection(xcb_atom_t selection, xcb_atom_t target, xcb_atom_t property, xcb_timestamp_t t = 0);
+ std::optional<QByteArray> getSelection(xcb_atom_t selection, xcb_atom_t target, xcb_atom_t property, xcb_timestamp_t t = 0);
int increment() const { return m_maxPropertyRequestDataBytes; }
int clipboardTimeout() const { return clipboard_timeout; }
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 6e5dd770b9..7a44e4bb4f 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -1306,32 +1306,33 @@ QVariant QXcbDropData::retrieveData_sys(const QString &mimetype, QMetaType reque
QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QMetaType requestedType) const
{
- QByteArray result;
-
QXcbConnection *c = drag->connection();
QXcbWindow *xcb_window = c->platformWindowFromId(drag->xdnd_dragsource);
if (xcb_window && drag->currentDrag() && xcb_window->window()->type() != Qt::Desktop) {
QMimeData *data = drag->currentDrag()->mimeData();
if (data->hasFormat(QLatin1StringView(format)))
- result = data->data(QLatin1StringView(format));
- return result;
+ return data->data(QLatin1StringView(format));
+ return QVariant();
}
QList<xcb_atom_t> atoms = drag->xdnd_types;
bool hasUtf8 = false;
xcb_atom_t a = mimeAtomForFormat(c, QLatin1StringView(format), requestedType, atoms, &hasUtf8);
if (a == XCB_NONE)
- return result;
+ return QVariant();
#ifndef QT_NO_CLIPBOARD
if (c->selectionOwner(c->atom(QXcbAtom::AtomXdndSelection)) == XCB_NONE)
- return result; // should never happen?
+ return QVariant(); // should never happen?
xcb_atom_t xdnd_selection = c->atom(QXcbAtom::AtomXdndSelection);
- result = c->clipboard()->getSelection(xdnd_selection, a, xdnd_selection, drag->targetTime());
+ const std::optional<QByteArray> result = c->clipboard()->getSelection(xdnd_selection, a, xdnd_selection, drag->targetTime());
+ if (!result.has_value())
+ return QVariant();
+ return mimeConvertToFormat(c, a, result.value(), QLatin1StringView(format), requestedType, hasUtf8);
+#else
+ return QVariant();
#endif
-
- return mimeConvertToFormat(c, a, result, QLatin1StringView(format), requestedType, hasUtf8);
}
bool QXcbDropData::hasFormat_sys(const QString &format) const
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 06f4b66edb..0ce337726e 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -23,6 +23,7 @@ QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t
: QXcbObject(connection)
, m_screen(screen)
, m_number(number)
+ , m_xSettings(new QXcbXSettings(this))
{
const QByteArray cmAtomName = "_NET_WM_CM_S" + QByteArray::number(m_number);
m_net_wm_cm_atom = connection->internAtom(cmAtomName.constData());
@@ -129,10 +130,6 @@ void QXcbVirtualDesktop::setPrimaryScreen(QPlatformScreen *s)
QXcbXSettings *QXcbVirtualDesktop::xSettings() const
{
- if (!m_xSettings) {
- QXcbVirtualDesktop *self = const_cast<QXcbVirtualDesktop *>(this);
- self->m_xSettings = new QXcbXSettings(self);
- }
return m_xSettings;
}
diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
index f6eed5e227..6df7aa9507 100644
--- a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
+++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
@@ -3,11 +3,13 @@
#include "qsql_ibase_p.h"
#include <QtCore/qcoreapplication.h>
+#include <QtCore/qendian.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qtimezone.h>
#include <QtCore/qdeadlinetimer.h>
#include <QtCore/qdebug.h>
#include <QtCore/qlist.h>
+#include <QtCore/private/qlocale_tools_p.h>
#include <QtCore/qloggingcategory.h>
#include <QtCore/qmap.h>
#include <QtCore/qmutex.h>
@@ -41,6 +43,10 @@ using namespace Qt::StringLiterals;
#define blr_boolean_dtype blr_bool
#endif
+#if (defined(QT_SUPPORTS_INT128) || defined(Q_CC_MSVC)) && (FB_API_VER >= 40)
+#define IBASE_INT128_SUPPORTED
+#endif
+
constexpr qsizetype QIBaseChunkSize = SHRT_MAX / 2;
#if (FB_API_VER >= 40)
@@ -100,6 +106,9 @@ static void initDA(XSQLDA *sqlda)
case SQL_TIMESTAMP:
#if (FB_API_VER >= 40)
case SQL_TIMESTAMP_TZ:
+#ifdef IBASE_INT128_SUPPORTED
+ case SQL_INT128:
+#endif
#endif
case SQL_TYPE_TIME:
case SQL_TYPE_DATE:
@@ -347,21 +356,14 @@ public:
QSqlQuery qry(q->createResult());
qry.setForwardOnly(true);
qry.exec(QString("select * from RDB$TIME_ZONES"_L1));
- if (qry.lastError().type()) {
- q->setLastError(QSqlError(
- QCoreApplication::translate("QIBaseDriver",
- "failed to query time zone mapping from system table"),
- qry.lastError().databaseText(),
- QSqlError::StatementError,
- qry.lastError().nativeErrorCode()));
-
+ if (qry.lastError().isValid()) {
+ qCInfo(lcIbase) << "Table 'RDB$TIME_ZONES' not found - not timezone support available";
return;
}
while (qry.next()) {
- auto record = qry.record();
- quint16 fbTzId = record.value(0).value<quint16>();
- QByteArray ianaId = record.value(1).toByteArray().simplified();
+ quint16 fbTzId = qry.value(0).value<quint16>();
+ QByteArray ianaId = qry.value(1).toByteArray().simplified();
qFbTzIdToIanaIdMap()->insert(fbTzId, ianaId);
qIanaIdToFbTzIdMap()->insert(ianaId, fbTzId);
}
@@ -408,6 +410,32 @@ protected:
QSqlRecord record() const override;
template<typename T>
+ static QString numberToHighPrecision(T val, int scale)
+ {
+ const bool negative = val < 0;
+ QString number;
+#ifdef IBASE_INT128_SUPPORTED
+ if constexpr (std::is_same_v<qinternalint128, T>) {
+ number = negative ? qint128toBasicLatin(val * -1)
+ : qint128toBasicLatin(val);
+ } else
+#endif
+ number = negative ? QString::number(qAbs(val))
+ : QString::number(val);
+ auto len = number.size();
+ scale *= -1;
+ if (scale >= len) {
+ number = QString(scale - len + 1, u'0') + number;
+ len = number.size();
+ }
+ const auto sepPos = len - scale;
+ number = number.left(sepPos) + u'.' + number.mid(sepPos);
+ if (negative)
+ number = u'-' + number;
+ return number;
+ }
+
+ template<typename T>
QVariant applyScale(T val, int scale) const
{
if (scale >= 0)
@@ -420,28 +448,36 @@ protected:
return QVariant(qint64(val * pow(10.0, scale)));
case QSql::LowPrecisionDouble:
return QVariant(double(val * pow(10.0, scale)));
- case QSql::HighPrecision: {
- const bool negative = val < 0;
- QString number;
- if constexpr (std::is_signed_v<T> || negative)
- number = QString::number(qAbs(val));
- else
- number = QString::number(val);
- auto len = number.size();
- scale *= -1;
- if (scale >= len) {
- number = QString(scale - len + 1, u'0') + number;
- len = number.size();
- }
- const auto sepPos = len - scale;
- number = number.left(sepPos) + u'.' + number.mid(sepPos);
- if (negative)
- number = u'-' + number;
- return QVariant(number);
- }
+ case QSql::HighPrecision:
+ return QVariant(numberToHighPrecision(val, scale));
}
return QVariant(val);
}
+
+ template<typename T>
+ void setWithScale(const QVariant &val, int scale, char *data)
+ {
+ auto ptr = reinterpret_cast<T *>(data);
+ if (scale < 0) {
+ double d = floor(0.5 + val.toDouble() * pow(10.0, scale * -1));
+#ifdef IBASE_INT128_SUPPORTED
+ if constexpr (std::is_same_v<qinternalint128, T>) {
+ quint64 lower = quint64(d);
+ quint64 tmp = quint64(std::numeric_limits<quint32>::max()) + 1;
+ d /= tmp;
+ d /= tmp;
+ quint64 higher = quint64(d);
+ qinternalint128 result = higher;
+ result <<= 64;
+ result += lower;
+ *ptr = static_cast<T>(result);
+ } else
+#endif
+ *ptr = static_cast<T>(d);
+ }
+ else
+ *ptr = val.value<T>();
+ }
};
class QIBaseResultPrivate: public QSqlCachedResultPrivate
@@ -1102,32 +1138,25 @@ bool QIBaseResult::exec()
}
switch(d->inda->sqlvar[para].sqltype & ~1) {
case SQL_INT64:
- if (d->inda->sqlvar[para].sqlscale < 0)
- *((qint64*)d->inda->sqlvar[para].sqldata) =
- (qint64)floor(0.5 + val.toDouble() * pow(10.0, d->inda->sqlvar[para].sqlscale * -1));
- else
- *((qint64*)d->inda->sqlvar[para].sqldata) = val.toLongLong();
+ setWithScale<qint64>(val, d->inda->sqlvar[para].sqlscale, d->inda->sqlvar[para].sqldata);
break;
+#ifdef IBASE_INT128_SUPPORTED
+ case SQL_INT128:
+ setWithScale<qinternalint128>(val, d->inda->sqlvar[para].sqlscale,
+ d->inda->sqlvar[para].sqldata);
+ break;
+#endif
case SQL_LONG:
- if (d->inda->sqlvar[para].sqllen == 4) {
- if (d->inda->sqlvar[para].sqlscale < 0)
- *((qint32*)d->inda->sqlvar[para].sqldata) =
- (qint32)floor(0.5 + val.toDouble() * pow(10.0, d->inda->sqlvar[para].sqlscale * -1));
- else
- *((qint32*)d->inda->sqlvar[para].sqldata) = (qint32)val.toInt();
- } else {
- *((qint64*)d->inda->sqlvar[para].sqldata) = val.toLongLong();
- }
+ if (d->inda->sqlvar[para].sqllen == 4)
+ setWithScale<qint32>(val, d->inda->sqlvar[para].sqlscale, d->inda->sqlvar[para].sqldata);
+ else
+ setWithScale<qint64>(val, 0, d->inda->sqlvar[para].sqldata);
break;
case SQL_SHORT:
- if (d->inda->sqlvar[para].sqlscale < 0)
- *((short*)d->inda->sqlvar[para].sqldata) =
- (short)floor(0.5 + val.toDouble() * pow(10.0, d->inda->sqlvar[para].sqlscale * -1));
- else
- *((short*)d->inda->sqlvar[para].sqldata) = (short)val.toInt();
+ setWithScale<qint16>(val, d->inda->sqlvar[para].sqlscale, d->inda->sqlvar[para].sqldata);
break;
case SQL_FLOAT:
- *((float*)d->inda->sqlvar[para].sqldata) = (float)val.toDouble();
+ *((float*)d->inda->sqlvar[para].sqldata) = val.toFloat();
break;
case SQL_DOUBLE:
*((double*)d->inda->sqlvar[para].sqldata) = val.toDouble();
@@ -1282,6 +1311,17 @@ bool QIBaseResult::gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx)
row[idx] = applyScale(val, scale);
break;
}
+#ifdef IBASE_INT128_SUPPORTED
+ case SQL_INT128: {
+ Q_ASSERT(d->sqlda->sqlvar[i].sqllen == sizeof(qinternalint128));
+ const qinternalint128 val128 = qFromUnaligned<qinternalint128>(buf);
+ const auto scale = d->sqlda->sqlvar[i].sqlscale;
+ row[idx] = numberToHighPrecision(val128, scale);
+ if (numericalPrecisionPolicy() != QSql::HighPrecision)
+ row[idx] = applyScale(row[idx].toDouble(), 0);
+ break;
+ }
+#endif
case SQL_LONG:
if (d->sqlda->sqlvar[i].sqllen == 4) {
const auto val = *(qint32 *)buf;
diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp
index 111a37ea2c..63663c74aa 100644
--- a/src/plugins/styles/modernwindows/qwindows11style.cpp
+++ b/src/plugins/styles/modernwindows/qwindows11style.cpp
@@ -9,12 +9,15 @@
#include <qstyleoption.h>
#include <qpainter.h>
#include <QGraphicsDropShadowEffect>
+#include <QLatin1StringView>
#include <QtWidgets/qcombobox.h>
#include <QtWidgets/qcommandlinkbutton.h>
#include <QtWidgets/qgraphicsview.h>
#include <QtWidgets/qlistview.h>
#include <QtWidgets/qmenu.h>
+#if QT_CONFIG(mdiarea)
#include <QtWidgets/qmdiarea.h>
+#endif
#include <QtWidgets/qtextedit.h>
#include <QtWidgets/qtreeview.h>
@@ -25,6 +28,7 @@ QT_BEGIN_NAMESPACE
const static int topLevelRoundingRadius = 8; //Radius for toplevel items like popups for round corners
const static int secondLevelRoundingRadius = 4; //Radius for second level items like hovered menu item round corners
+constexpr QLatin1StringView originalWidthProperty("_q_windows11_style_original_width");
enum WINUI3Color {
subtleHighlightColor, //Subtle highlight based on alpha used for hovered elements
@@ -134,6 +138,8 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
*/
QWindows11Style::QWindows11Style() : QWindowsVistaStyle(*new QWindows11StylePrivate)
{
+ highContrastTheme = QGuiApplicationPrivate::styleHints->colorScheme() == Qt::ColorScheme::Unknown;
+ colorSchemeIndex = QGuiApplicationPrivate::styleHints->colorScheme() == Qt::ColorScheme::Light ? 0 : 1;
}
/*!
@@ -142,6 +148,8 @@ QWindows11Style::QWindows11Style() : QWindowsVistaStyle(*new QWindows11StylePriv
*/
QWindows11Style::QWindows11Style(QWindows11StylePrivate &dd) : QWindowsVistaStyle(dd)
{
+ highContrastTheme = QGuiApplicationPrivate::styleHints->colorScheme() == Qt::ColorScheme::Unknown;
+ colorSchemeIndex = QGuiApplicationPrivate::styleHints->colorScheme() == Qt::ColorScheme::Light ? 0 : 1;
}
/*!
@@ -1121,7 +1129,7 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
rect.translate(shiftX, shiftY);
painter->setFont(toolbutton->font);
const QString text = d->toolButtonElideText(toolbutton, rect, alignment);
- if (toolbutton->state & State_Raised || d->defaultPalette.buttonText() != toolbutton->palette.buttonText())
+ if (toolbutton->state & State_Raised || toolbutton->palette.isBrushSet(QPalette::Current, QPalette::ButtonText))
painter->setPen(QPen(toolbutton->palette.buttonText().color()));
else
painter->setPen(QPen(WINUI3Colors[colorSchemeIndex][controlTextSecondary]));
@@ -1175,7 +1183,7 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
}
tr.translate(shiftX, shiftY);
const QString text = d->toolButtonElideText(toolbutton, tr, alignment);
- if (toolbutton->state & State_Raised || d->defaultPalette.buttonText() != toolbutton->palette.buttonText())
+ if (toolbutton->state & State_Raised || toolbutton->palette.isBrushSet(QPalette::Current, QPalette::ButtonText))
painter->setPen(QPen(toolbutton->palette.buttonText().color()));
else
painter->setPen(QPen(WINUI3Colors[colorSchemeIndex][controlTextSecondary]));
@@ -1738,6 +1746,10 @@ int QWindows11Style::styleHint(StyleHint hint, const QStyleOption *opt,
return 0;
case QStyle::SH_ItemView_ShowDecorationSelected:
return 1;
+ case QStyle::SH_Slider_AbsoluteSetButtons:
+ return Qt::LeftButton;
+ case QStyle::SH_Slider_PageSetButtons:
+ return 0;
default:
return QWindowsVistaStyle::styleHint(hint, opt, widget, returnData);
}
@@ -2036,6 +2048,13 @@ void QWindows11Style::polish(QWidget* widget)
QLineEdit *le = cb->lineEdit();
le->setFrame(false);
}
+ } else if (widget->inherits("QAbstractSpinBox")) {
+ const int minWidth = 2 * 24 + 40;
+ const int originalWidth = widget->size().width();
+ if (originalWidth < minWidth) {
+ widget->resize(minWidth, widget->size().height());
+ widget->setProperty(originalWidthProperty.constData(), originalWidth);
+ }
} else if (widget->inherits("QAbstractButton") || widget->inherits("QToolButton")) {
widget->setAutoFillBackground(false);
} else if (qobject_cast<QGraphicsView *>(widget) && !qobject_cast<QTextEdit *>(widget)) {
@@ -2043,7 +2062,11 @@ void QWindows11Style::polish(QWidget* widget)
pal.setColor(QPalette::Base, pal.window().color());
widget->setPalette(pal);
} else if (const auto *scrollarea = qobject_cast<QAbstractScrollArea *>(widget);
- scrollarea && !qobject_cast<QMdiArea *>(widget)) {
+ scrollarea
+#if QT_CONFIG(mdiarea)
+ && !qobject_cast<QMdiArea *>(widget)
+#endif
+ ) {
QPalette pal = scrollarea->viewport()->palette();
const QPalette originalPalette = pal;
pal.setColor(scrollarea->viewport()->backgroundRole(), Qt::transparent);
@@ -2062,59 +2085,57 @@ void QWindows11Style::unpolish(QWidget *widget)
{
QWindowsVistaStyle::unpolish(widget);
if (const auto *scrollarea = qobject_cast<QAbstractScrollArea *>(widget);
- scrollarea && !qobject_cast<QMdiArea *>(widget)) {
+ scrollarea
+#if QT_CONFIG(mdiarea)
+ && !qobject_cast<QMdiArea *>(widget)
+#endif
+ ) {
const QPalette pal = scrollarea->viewport()->property("_q_original_background_palette").value<QPalette>();
scrollarea->viewport()->setPalette(pal);
scrollarea->viewport()->setProperty("_q_original_background_palette", QVariant());
}
+ if (widget->inherits("QAbstractSpinBox")) {
+ const QVariant originalWidth = widget->property(originalWidthProperty.constData());
+ if (originalWidth.isValid()) {
+ widget->resize(originalWidth.toInt(), widget->size().height());
+ widget->setProperty(originalWidthProperty.constData(), QVariant());
+ }
+ }
}
/*
The colors for Windows 11 are taken from the official WinUI3 Figma style at
https://www.figma.com/community/file/1159947337437047524
*/
+#define SET_IF_UNRESOLVED(GROUP, ROLE, VALUE) \
+ if (!result.isBrushSet(QPalette::Inactive, ROLE) || styleSheetChanged) \
+ result.setColor(GROUP, ROLE, VALUE)
+
static void populateLightSystemBasePalette(QPalette &result)
{
static QString oldStyleSheet;
const bool styleSheetChanged = oldStyleSheet != qApp->styleSheet();
- QPalette standardPalette = QApplication::palette();
const QColor textColor = QColor(0x00,0x00,0x00,0xE4);
-
const QColor btnFace = QColor(0xFF,0xFF,0xFF,0xB3);
const QColor btnHighlight = result.accent().color();
const QColor btnColor = result.button().color();
- if (standardPalette.color(QPalette::Highlight) == result.color(QPalette::Highlight) || styleSheetChanged)
- result.setColor(QPalette::Highlight, btnHighlight);
- if (standardPalette.color(QPalette::WindowText) == result.color(QPalette::WindowText) || styleSheetChanged)
- result.setColor(QPalette::WindowText, textColor);
- if (standardPalette.color(QPalette::Button) == result.color(QPalette::Button) || styleSheetChanged)
- result.setColor(QPalette::Button, btnFace);
- if (standardPalette.color(QPalette::Light) == result.color(QPalette::Light) || styleSheetChanged)
- result.setColor(QPalette::Light, btnColor.lighter(150));
- if (standardPalette.color(QPalette::Dark) == result.color(QPalette::Dark) || styleSheetChanged)
- result.setColor(QPalette::Dark, btnColor.darker(200));
- if (standardPalette.color(QPalette::Mid) == result.color(QPalette::Mid) || styleSheetChanged)
- result.setColor(QPalette::Mid, btnColor.darker(150));
- if (standardPalette.color(QPalette::Text) == result.color(QPalette::Text) || styleSheetChanged)
- result.setColor(QPalette::Text, textColor);
- if (standardPalette.color(QPalette::BrightText) != result.color(QPalette::BrightText) || styleSheetChanged)
- result.setColor(QPalette::BrightText, btnHighlight);
- if (standardPalette.color(QPalette::Base) == result.color(QPalette::Base) || styleSheetChanged)
- result.setColor(QPalette::Base, btnFace);
- if (standardPalette.color(QPalette::Window) == result.color(QPalette::Window) || styleSheetChanged)
- result.setColor(QPalette::Window, QColor(0xF3,0xF3,0xF3,0xFF));
- if (standardPalette.color(QPalette::ButtonText) == result.color(QPalette::ButtonText) || styleSheetChanged)
- result.setColor(QPalette::ButtonText, textColor);
- if (standardPalette.color(QPalette::Midlight) == result.color(QPalette::Midlight) || styleSheetChanged)
- result.setColor(QPalette::Midlight, btnColor.lighter(125));
- if (standardPalette.color(QPalette::Shadow) == result.color(QPalette::Shadow) || styleSheetChanged)
- result.setColor(QPalette::Shadow, Qt::black);
- if (standardPalette.color(QPalette::ToolTipBase) == result.color(QPalette::ToolTipBase) || styleSheetChanged)
- result.setColor(QPalette::ToolTipBase, result.window().color());
- if (standardPalette.color(QPalette::ToolTipText) == result.color(QPalette::ToolTipText) || styleSheetChanged)
- result.setColor(QPalette::ToolTipText, result.windowText().color());
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::Highlight, btnHighlight);
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::WindowText, textColor);
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::Button, btnFace);
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::Light, btnColor.lighter(150));
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::Dark, btnColor.darker(200));
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::Mid, btnColor.darker(150));
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::Text, textColor);
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::BrightText, btnHighlight);
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::Base, btnFace);
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::Window, QColor(0xF3,0xF3,0xF3,0xFF));
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::ButtonText, textColor);
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::Midlight, btnColor.lighter(125));
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::Shadow, Qt::black);
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::ToolTipBase, result.window().color());
+ SET_IF_UNRESOLVED(QPalette::All, QPalette::ToolTipText, result.windowText().color());
if (result.midlight() == result.button())
result.setColor(QPalette::Midlight, btnColor.lighter(110));
@@ -2124,38 +2145,30 @@ static void populateLightSystemBasePalette(QPalette &result)
/*!
\internal
*/
-void QWindows11Style::polish(QPalette& pal)
+void QWindows11Style::polish(QPalette& result)
{
- Q_D(QWindows11Style);
-
highContrastTheme = QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Unknown;
colorSchemeIndex = QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Light ? 0 : 1;
if (!highContrastTheme && colorSchemeIndex == 0)
- populateLightSystemBasePalette(pal);
-
- if (standardPalette().color(QPalette::Inactive, QPalette::Button) == pal.color(QPalette::Inactive, QPalette::Button))
- pal.setColor(QPalette::Inactive, QPalette::Button, pal.button().color());
- if (standardPalette().color(QPalette::Inactive, QPalette::Window) == pal.color(QPalette::Inactive, QPalette::Window))
- pal.setColor(QPalette::Inactive, QPalette::Window, pal.window().color());
- if (standardPalette().color(QPalette::Inactive, QPalette::Light) == pal.color(QPalette::Inactive, QPalette::Light))
- pal.setColor(QPalette::Inactive, QPalette::Light, pal.light().color());
- if (standardPalette().color(QPalette::Inactive, QPalette::Dark) == pal.color(QPalette::Inactive, QPalette::Dark))
- pal.setColor(QPalette::Inactive, QPalette::Dark, pal.dark().color());
- if (standardPalette().color(QPalette::Inactive, QPalette::Accent) == pal.color(QPalette::Inactive, QPalette::Accent))
- pal.setColor(QPalette::Inactive, QPalette::Accent, pal.accent().color());
- if (standardPalette().color(QPalette::Inactive, QPalette::Highlight) == pal.color(QPalette::Inactive, QPalette::Highlight))
- pal.setColor(QPalette::Inactive, QPalette::Highlight, pal.highlight().color());
- if (standardPalette().color(QPalette::Inactive, QPalette::HighlightedText) == pal.color(QPalette::Inactive, QPalette::HighlightedText))
- pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.highlightedText().color());
- if (standardPalette().color(QPalette::Inactive, QPalette::Text) == pal.color(QPalette::Inactive, QPalette::Text))
- pal.setColor(QPalette::Inactive, QPalette::Text, pal.text().color());
- if (standardPalette().color(QPalette::Inactive, QPalette::WindowText) == pal.color(QPalette::Inactive, QPalette::WindowText))
- pal.setColor(QPalette::Inactive, QPalette::WindowText, pal.windowText().color());
+ populateLightSystemBasePalette(result);
+
+ const bool styleSheetChanged = false; // so the macro works
+
+ SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Button, result.button().color());
+ SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Window, result.window().color());
+ SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Light, result.light().color());
+ SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Dark, result.dark().color());
+ SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Accent, result.accent().color());
+ SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Highlight, result.highlight().color());
+ SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::HighlightedText, result.highlightedText().color());
+ SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Text, result.text().color());
+ SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::WindowText, result.windowText().color());
if (highContrastTheme)
- pal.setColor(QPalette::Active, QPalette::HighlightedText, pal.windowText().color());
- d->defaultPalette = pal;
+ result.setColor(QPalette::Active, QPalette::HighlightedText, result.windowText().color());
}
+#undef SET_IF_UNRESOLVED
+
QT_END_NAMESPACE
diff --git a/src/plugins/styles/modernwindows/qwindows11style_p.h b/src/plugins/styles/modernwindows/qwindows11style_p.h
index 2fa195a405..9c54afd967 100644
--- a/src/plugins/styles/modernwindows/qwindows11style_p.h
+++ b/src/plugins/styles/modernwindows/qwindows11style_p.h
@@ -63,7 +63,6 @@ private:
class QWindows11StylePrivate : public QWindowsVistaStylePrivate {
Q_DECLARE_PUBLIC(QWindows11Style)
- QPalette defaultPalette;
};
QT_END_NAMESPACE
diff --git a/src/printsupport/CMakeLists.txt b/src/printsupport/CMakeLists.txt
index 25aad04caf..f6d84be7c2 100644
--- a/src/printsupport/CMakeLists.txt
+++ b/src/printsupport/CMakeLists.txt
@@ -14,7 +14,7 @@ qt_internal_add_module(PrintSupport
kernel/qplatformprintplugin.cpp kernel/qplatformprintplugin.h
kernel/qprint.cpp kernel/qprint_p.h
kernel/qprintdevice.cpp kernel/qprintdevice_p.h
- kernel/qprintengine.h
+ kernel/qprintengine.cpp kernel/qprintengine.h
kernel/qprintengine_pdf.cpp kernel/qprintengine_pdf_p.h
kernel/qprinter.cpp kernel/qprinter.h kernel/qprinter_p.h
kernel/qprinterinfo.cpp kernel/qprinterinfo.h kernel/qprinterinfo_p.h
@@ -179,7 +179,7 @@ qt_internal_extend_target(PrintSupport CONDITION QT_FEATURE_printdialog AND WIN3
dialogs/qprintdialog_win.cpp
)
-qt_internal_extend_target(PrintSupport CONDITION QT_FEATURE_printdialog AND UNIX AND NOT APPLE
+qt_internal_extend_target(PrintSupport CONDITION QT_FEATURE_printdialog AND UNIX AND NOT MACOS
SOURCES
dialogs/qpagesetupdialog_unix.cpp dialogs/qpagesetupdialog_unix_p.h
dialogs/qprintdialog_unix.cpp
diff --git a/src/printsupport/configure.cmake b/src/printsupport/configure.cmake
index 2287789ac1..a8b4ed3803 100644
--- a/src/printsupport/configure.cmake
+++ b/src/printsupport/configure.cmake
@@ -40,7 +40,7 @@ qt_feature("printer" PUBLIC
SECTION "Painting"
LABEL "QPrinter"
PURPOSE "Provides a printer backend of QPainter."
- CONDITION NOT UIKIT AND QT_FEATURE_picture AND QT_FEATURE_temporaryfile AND QT_FEATURE_pdf
+ CONDITION QT_FEATURE_picture AND QT_FEATURE_temporaryfile AND QT_FEATURE_pdf
)
qt_feature_definition("printer" "QT_NO_PRINTER" NEGATE VALUE "1")
qt_feature("printpreviewwidget" PUBLIC
diff --git a/src/printsupport/dialogs/qabstractprintdialog.cpp b/src/printsupport/dialogs/qabstractprintdialog.cpp
index 9cbba6bdbb..30276a6121 100644
--- a/src/printsupport/dialogs/qabstractprintdialog.cpp
+++ b/src/printsupport/dialogs/qabstractprintdialog.cpp
@@ -365,9 +365,15 @@ void QAbstractPrintDialog::setOptionTabs(const QList<QWidget*> &tabs)
void QPrintDialog::done(int result)
{
auto *d = static_cast<QAbstractPrintDialogPrivate *>(d_ptr.data());
+ if (result == Accepted) {
+ // Emit accepted(QPrinter*) at the same time as the dialog
+ // is accepted. Doing it here is too late, as done() will
+ // also emit finished().
+ QObject::connect(this, &QDialog::accepted, this, [this]{
+ emit accepted(printer());
+ }, Qt::SingleShotConnection);
+ }
QDialog::done(result);
- if (result == Accepted)
- emit accepted(printer());
if (d->receiverToDisconnectOnClose) {
disconnect(this, SIGNAL(accepted(QPrinter*)),
d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);
diff --git a/src/printsupport/dialogs/qpagesetupdialog.cpp b/src/printsupport/dialogs/qpagesetupdialog.cpp
index 0bc80c1f6f..40893cddab 100644
--- a/src/printsupport/dialogs/qpagesetupdialog.cpp
+++ b/src/printsupport/dialogs/qpagesetupdialog.cpp
@@ -100,7 +100,7 @@ void QPageSetupDialog::open(QObject *receiver, const char *member)
QDialog::open();
}
-#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
+#if defined(Q_OS_MACOS) || defined(Q_OS_WIN)
/*! \fn void QPageSetupDialog::setVisible(bool visible)
\reimp
*/
diff --git a/src/printsupport/dialogs/qpagesetupdialog.h b/src/printsupport/dialogs/qpagesetupdialog.h
index 80d9c7a7fd..89056c70dd 100644
--- a/src/printsupport/dialogs/qpagesetupdialog.h
+++ b/src/printsupport/dialogs/qpagesetupdialog.h
@@ -25,7 +25,7 @@ public:
explicit QPageSetupDialog(QWidget *parent = nullptr);
~QPageSetupDialog();
-#if defined(Q_OS_MAC) || defined(Q_OS_WIN) || defined(Q_QDOC)
+#if defined(Q_OS_MACOS) || defined(Q_OS_WIN) || defined(Q_QDOC)
void setVisible(bool visible) override;
#endif
int exec() override;
diff --git a/src/printsupport/dialogs/qprintdialog.h b/src/printsupport/dialogs/qprintdialog.h
index fa05f42bea..4ba6ddfd48 100644
--- a/src/printsupport/dialogs/qprintdialog.h
+++ b/src/printsupport/dialogs/qprintdialog.h
@@ -28,7 +28,7 @@ public:
~QPrintDialog();
int exec() override;
-#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
virtual void accept() override;
#endif
void done(int result) override;
@@ -55,7 +55,7 @@ Q_SIGNALS:
void accepted(QPrinter *printer);
private:
-#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
Q_PRIVATE_SLOT(d_func(), void _q_togglePageSetCombo(bool))
Q_PRIVATE_SLOT(d_func(), void _q_collapseOrExpandDialog())
#if QT_CONFIG(messagebox)
diff --git a/src/printsupport/dialogs/qprintpreviewdialog.cpp b/src/printsupport/dialogs/qprintpreviewdialog.cpp
index 2028287b55..3c19e25c64 100644
--- a/src/printsupport/dialogs/qprintpreviewdialog.cpp
+++ b/src/printsupport/dialogs/qprintpreviewdialog.cpp
@@ -250,7 +250,7 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
QWidget *pageEdit = new QWidget(toolbar);
QVBoxLayout *vboxLayout = new QVBoxLayout;
vboxLayout->setContentsMargins(0, 0, 0, 0);
-#ifdef Q_OS_MAC
+#ifdef Q_OS_MACOS
// We query the widgets about their size and then we fix the size.
// This should do the trick for the laying out part...
QSize pageNumEditSize, pageNumLabelSize;
@@ -260,7 +260,7 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
pageNumLabel->resize(pageNumLabelSize);
#endif
QFormLayout *formLayout = new QFormLayout;
-#ifdef Q_OS_MAC
+#ifdef Q_OS_MACOS
// We have to change the growth policy in Mac.
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
#endif
@@ -310,7 +310,7 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
q->setWindowTitle(caption);
if (!printer->isValid()
-#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
+#if defined(Q_OS_WIN) || defined(Q_OS_APPLE)
|| printer->outputFormat() != QPrinter::NativeFormat
#endif
)
@@ -539,7 +539,7 @@ void QPrintPreviewDialogPrivate::_q_print()
{
Q_Q(QPrintPreviewDialog);
-#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
+#if defined(Q_OS_WIN) || defined(Q_OS_APPLE)
if (printer->outputFormat() != QPrinter::NativeFormat) {
QString title = QCoreApplication::translate("QPrintPreviewDialog", "Export to PDF");
QString suffix = ".pdf"_L1;
diff --git a/src/printsupport/kernel/qprintengine.cpp b/src/printsupport/kernel/qprintengine.cpp
new file mode 100644
index 0000000000..b9afb28292
--- /dev/null
+++ b/src/printsupport/kernel/qprintengine.cpp
@@ -0,0 +1,15 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtPrintSupport/qprintengine.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_PRINTER
+
+QPrintEngine::~QPrintEngine()
+ = default;
+
+#endif // QT_NO_PRINTER
+
+QT_END_NAMESPACE
diff --git a/src/printsupport/kernel/qprintengine.h b/src/printsupport/kernel/qprintengine.h
index 65d9ed9a06..a18930c9a9 100644
--- a/src/printsupport/kernel/qprintengine.h
+++ b/src/printsupport/kernel/qprintengine.h
@@ -19,7 +19,8 @@ QT_BEGIN_NAMESPACE
class Q_PRINTSUPPORT_EXPORT QPrintEngine
{
public:
- virtual ~QPrintEngine() {}
+ virtual ~QPrintEngine();
+
enum PrintEnginePropertyKey {
PPK_CollateCopies,
PPK_ColorMode,
diff --git a/src/printsupport/widgets/qprintpreviewwidget.cpp b/src/printsupport/widgets/qprintpreviewwidget.cpp
index 637eb42505..eb111a6efc 100644
--- a/src/printsupport/widgets/qprintpreviewwidget.cpp
+++ b/src/printsupport/widgets/qprintpreviewwidget.cpp
@@ -111,7 +111,7 @@ public:
GraphicsView(QWidget* parent = nullptr)
: QGraphicsView(parent)
{
-#ifdef Q_OS_MAC
+#ifdef Q_OS_APPLE
setFrameStyle(QFrame::NoFrame);
#endif
}
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
index fdbb16a589..c25fabf0a4 100644
--- a/src/sql/kernel/qsqldatabase.cpp
+++ b/src/sql/kernel/qsqldatabase.cpp
@@ -239,6 +239,8 @@ void QSqlDatabasePrivate::disable()
Destroys the SQL driver creator object.
*/
+QSqlDriverCreatorBase::~QSqlDriverCreatorBase()
+ = default;
/*!
\fn QSqlDriver *QSqlDriverCreatorBase::createObject() const
@@ -1375,7 +1377,7 @@ bool QSqlDatabase::moveToThread(QThread *targetThread)
Returns a pointer to the associated QThread instance.
*/
-QThread *QSqlDatabase::currentThread() const
+QThread *QSqlDatabase::thread() const
{
if (auto drv = driver())
return drv->thread();
diff --git a/src/sql/kernel/qsqldatabase.h b/src/sql/kernel/qsqldatabase.h
index 5059dbba83..85d6b4d9d9 100644
--- a/src/sql/kernel/qsqldatabase.h
+++ b/src/sql/kernel/qsqldatabase.h
@@ -23,7 +23,7 @@ class QThread;
class Q_SQL_EXPORT QSqlDriverCreatorBase
{
public:
- virtual ~QSqlDriverCreatorBase() {}
+ virtual ~QSqlDriverCreatorBase();
virtual QSqlDriver *createObject() const = 0;
};
@@ -82,7 +82,7 @@ public:
void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy);
QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const;
bool moveToThread(QThread *targetThread);
- QThread *currentThread() const;
+ QThread *thread() const;
QSqlDriver* driver() const;
diff --git a/src/sql/kernel/qsqlrecord.cpp b/src/sql/kernel/qsqlrecord.cpp
index 53b64c1464..138f19e1cb 100644
--- a/src/sql/kernel/qsqlrecord.cpp
+++ b/src/sql/kernel/qsqlrecord.cpp
@@ -19,6 +19,32 @@ public:
return index >= 0 && index < fields.size();
}
+ qsizetype indexOfImpl(QStringView name)
+ {
+ QStringView tableName;
+ QStringView fieldName;
+ const auto it = std::find(name.begin(), name.end(), u'.');
+ const auto idx = (it == name.end()) ? -1 : it - name.begin();
+ if (idx != -1) {
+ tableName = name.left(idx);
+ fieldName = name.mid(idx + 1);
+ }
+ const auto cnt = fields.size();
+ for (qsizetype i = 0; i < cnt; ++i) {
+ // Check the passed in name first in case it is an alias using a dot.
+ // Then check if both the table and field match when there is a table name specified.
+ const auto &currentField = fields.at(i);
+ const auto &currentFieldName = currentField.name();
+ if (name.compare(currentFieldName, Qt::CaseInsensitive) == 0)
+ return i;
+ if (idx != -1 &&
+ tableName.compare(currentField.tableName(), Qt::CaseInsensitive) == 0 &&
+ fieldName.compare(currentFieldName, Qt::CaseInsensitive) == 0)
+ return i;
+ }
+ return -1;
+ }
+
QList<QSqlField> fields;
};
QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QSqlRecordPrivate)
@@ -211,26 +237,7 @@ int QSqlRecord::indexOf(const QString &name) const
*/
int QSqlRecord::indexOf(QStringView name) const
{
- QStringView tableName;
- QStringView fieldName(name);
- const qsizetype idx = name.indexOf(u'.');
- if (idx != -1) {
- tableName = fieldName.left(idx);
- fieldName = fieldName.mid(idx + 1);
- }
- const int cnt = count();
- for (int i = 0; i < cnt; ++i) {
- // Check the passed in name first in case it is an alias using a dot.
- // Then check if both the table and field match when there is a table name specified.
- const auto &currentField = d->fields.at(i);
- const auto &currentFieldName = currentField.name();
- if (currentFieldName.compare(name, Qt::CaseInsensitive) == 0
- || (idx != -1 && currentFieldName.compare(fieldName, Qt::CaseInsensitive) == 0
- && currentField.tableName().compare(tableName, Qt::CaseInsensitive) == 0)) {
- return i;
- }
- }
- return -1;
+ return d->indexOfImpl(name);
}
/*!
diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp
index 6f91fb9739..1aae088c64 100644
--- a/src/sql/models/qsqlquerymodel.cpp
+++ b/src/sql/models/qsqlquerymodel.cpp
@@ -618,7 +618,7 @@ bool QSqlQueryModel::insertColumns(int column, int count, const QModelIndex &par
d->colOffsets.append(nVal);
Q_ASSERT(d->colOffsets.size() >= d->rec.count());
}
- for (int i = column + 1; i < d->colOffsets.size(); ++i)
+ for (qsizetype i = column + 1; i < d->colOffsets.size(); ++i)
++d->colOffsets[i];
}
endInsertColumns();
@@ -644,10 +644,9 @@ bool QSqlQueryModel::removeColumns(int column, int count, const QModelIndex &par
beginRemoveColumns(parent, column, column + count - 1);
- int i;
- for (i = 0; i < count; ++i)
+ for (int i = 0; i < count; ++i)
d->rec.remove(column);
- for (i = column; i < d->colOffsets.size(); ++i)
+ for (qsizetype i = column; i < d->colOffsets.size(); ++i)
d->colOffsets[i] -= count;
endRemoveColumns();
diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp
index c086d88ffe..1218514778 100644
--- a/src/sql/models/qsqlrelationaltablemodel.cpp
+++ b/src/sql/models/qsqlrelationaltablemodel.cpp
@@ -21,7 +21,7 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-class QSqlRelationalTableModelSql: public QSqlTableModelSql
+class QSqlRelationalTableModelSql: public QSqlQueryModelSql
{
public:
inline const static QString relTablePrefix(int i) { return QString::number(i).prepend("relTblAl_"_L1); }
@@ -108,12 +108,12 @@ struct QRelation
void populateModel();
- bool isDictionaryInitialized();
+ bool isDictionaryInitialized() const;
void populateDictionary();
void clearDictionary();
void clear();
- bool isValid();
+ bool isValid() const;
QSqlRelation rel;
QRelatedTableModel *model;
@@ -158,7 +158,7 @@ void QRelation::populateModel()
}
}
-bool QRelation::isDictionaryInitialized()
+bool QRelation::isDictionaryInitialized() const
{
return m_dictInitialized;
}
@@ -204,7 +204,7 @@ void QRelation::clear()
clearDictionary();
}
-bool QRelation::isValid()
+bool QRelation::isValid() const
{
return (rel.isValid() && m_parent != nullptr);
}
@@ -253,10 +253,8 @@ public:
void QSqlRelationalTableModelPrivate::clearChanges()
{
- for (int i = 0; i < relations.size(); ++i) {
- QRelation &rel = relations[i];
+ for (auto &rel : relations)
rel.clear();
- }
}
void QSqlRelationalTableModelPrivate::revertCachedRow(int row)
@@ -277,8 +275,8 @@ int QSqlRelationalTableModelPrivate::nameToIndex(const QString &name) const
void QSqlRelationalTableModelPrivate::clearCache()
{
- for (int i = 0; i < relations.size(); ++i)
- relations[i].clearDictionary();
+ for (auto &rel : relations)
+ rel.clearDictionary();
QSqlTableModelPrivate::clearCache();
}
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index 265d7782a0..0d17194287 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -19,12 +19,7 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-using SqlTm = QSqlTableModelSql;
-
-QSqlTableModelPrivate::~QSqlTableModelPrivate()
-{
-
-}
+using SqlTm = QSqlQueryModelSql;
/*! \internal
Populates our record with values.
@@ -143,11 +138,10 @@ bool QSqlTableModelPrivate::exec(const QString &stmt, bool prepStatement,
return false;
}
}
- int i;
- for (i = 0; i < rec.count(); ++i)
+ for (int i = 0; i < rec.count(); ++i)
if (rec.isGenerated(i))
editQuery.addBindValue(rec.value(i));
- for (i = 0; i < whereValues.count(); ++i)
+ for (int i = 0; i < whereValues.count(); ++i)
if (whereValues.isGenerated(i) && !whereValues.isNull(i))
editQuery.addBindValue(whereValues.value(i));
@@ -475,10 +469,8 @@ QVariant QSqlTableModel::headerData(int section, Qt::Orientation orientation, in
bool QSqlTableModel::isDirty() const
{
Q_D(const QSqlTableModel);
- QSqlTableModelPrivate::CacheMap::ConstIterator i = d->cache.constBegin();
- const QSqlTableModelPrivate::CacheMap::ConstIterator e = d->cache.constEnd();
- for (; i != e; ++i) {
- if (!i.value().submitted())
+ for (const auto &val : std::as_const(d->cache)) {
+ if (!val.submitted())
return true;
}
return false;
@@ -1360,8 +1352,7 @@ bool QSqlTableModel::setRecord(int row, const QSqlRecord &values)
return false;
// Check field names and remember mapping
- typedef QMap<int, int> Map;
- Map map;
+ QMap<int, int> map;
for (int i = 0; i < values.count(); ++i) {
int idx = d->nameToIndex(values.fieldName(i));
if (idx == -1)
@@ -1374,18 +1365,16 @@ bool QSqlTableModel::setRecord(int row, const QSqlRecord &values)
mrow = QSqlTableModelPrivate::ModifiedRow(QSqlTableModelPrivate::Update,
QSqlQueryModel::record(row));
- Map::const_iterator i = map.constBegin();
- const Map::const_iterator e = map.constEnd();
- for ( ; i != e; ++i) {
+ for (const auto i : map.asKeyValueRange()) {
// have to use virtual setData() here rather than mrow.setValue()
EditStrategy strategy = d->strategy;
d->strategy = OnManualSubmit;
- QModelIndex cIndex = createIndex(row, i.value());
- setData(cIndex, values.value(i.key()));
+ QModelIndex cIndex = createIndex(row, i.second);
+ setData(cIndex, values.value(i.first));
d->strategy = strategy;
// setData() sets generated to TRUE, but source record should prevail.
- if (!values.isGenerated(i.key()))
- mrow.recRef().setGenerated(i.value(), false);
+ if (!values.isGenerated(i.first))
+ mrow.recRef().setGenerated(i.second, false);
}
if (d->strategy != OnManualSubmit)
diff --git a/src/sql/models/qsqltablemodel_p.h b/src/sql/models/qsqltablemodel_p.h
index 9c6425ded4..864c977ebb 100644
--- a/src/sql/models/qsqltablemodel_p.h
+++ b/src/sql/models/qsqltablemodel_p.h
@@ -35,7 +35,6 @@ public:
strategy(QSqlTableModel::OnRowChange),
busyInsertingRows(false)
{}
- ~QSqlTableModelPrivate();
void clear();
virtual void clearCache();
@@ -154,11 +153,6 @@ public:
CacheMap cache;
};
-class QSqlTableModelSql: public QSqlQueryModelSql
-{
-public:
-};
-
QT_END_NAMESPACE
#endif // QSQLTABLEMODEL_P_H
diff --git a/src/testlib/qsignalspy.cpp b/src/testlib/qsignalspy.cpp
index a45ca59378..116ce87c3e 100644
--- a/src/testlib/qsignalspy.cpp
+++ b/src/testlib/qsignalspy.cpp
@@ -216,7 +216,7 @@ QSignalSpy::ObjectSignal QSignalSpy::verify(const QObject *obj, QMetaMethod sign
return {};
}
-QList<int> QSignalSpy::makeArgs(const QMetaMethod &member, const QObject *obj)
+static QList<int> makeArgs(QMetaMethod member, const QObject *obj)
{
QList<int> result;
result.reserve(member.parameterCount());
@@ -250,7 +250,8 @@ public:
};
QSignalSpy::QSignalSpy(ObjectSignal os)
- : args(os.obj ? makeArgs(os.sig, os.obj) : QList<int>{})
+ : sig(os.sig.methodSignature()),
+ args(os.obj ? makeArgs(os.sig, os.obj) : QList<int>{})
{
if (!os.obj)
return;
@@ -266,8 +267,6 @@ QSignalSpy::QSignalSpy(ObjectSignal os)
}
d_ptr = std::move(i);
-
- sig = os.sig.methodSignature();
}
/*!
diff --git a/src/testlib/qsignalspy.h b/src/testlib/qsignalspy.h
index 591545b4d5..b8df2a4deb 100644
--- a/src/testlib/qsignalspy.h
+++ b/src/testlib/qsignalspy.h
@@ -41,7 +41,7 @@ public:
: QSignalSpy(verify(obj, signal)) {}
Q_TESTLIB_EXPORT ~QSignalSpy();
- inline bool isValid() const { return !sig.isEmpty(); }
+ bool isValid() const noexcept { return d_ptr != nullptr; }
inline QByteArray signal() const { return sig; }
bool wait(int timeout)
@@ -55,11 +55,10 @@ private:
Q_TESTLIB_EXPORT static ObjectSignal verify(const QObject *obj, QMetaMethod signal);
Q_TESTLIB_EXPORT static ObjectSignal verify(const QObject *obj, const char *aSignal);
- Q_TESTLIB_EXPORT static QList<int> makeArgs(const QMetaMethod &member, const QObject *obj);
Q_TESTLIB_EXPORT void appendArgs(void **a);
// the full, normalized signal name
- QByteArray sig;
+ const QByteArray sig;
// holds the QMetaType types for the argument list of the signal
const QList<int> args;
diff --git a/src/testlib/qtestaccessible.h b/src/testlib/qtestaccessible.h
index a4236aa5f3..fcf95ee62b 100644
--- a/src/testlib/qtestaccessible.h
+++ b/src/testlib/qtestaccessible.h
@@ -228,6 +228,17 @@ private:
newEvent->setLastRow(oldEvent->lastRow());
newEvent->setLastColumn(oldEvent->lastColumn());
ev = newEvent;
+ } else if (event->type() == QAccessible::Announcement) {
+ QAccessibleAnnouncementEvent *oldEvent =
+ static_cast<QAccessibleAnnouncementEvent *>(event);
+ QAccessibleAnnouncementEvent *newEvent;
+ if (event->object())
+ newEvent = new QAccessibleAnnouncementEvent(event->object(), oldEvent->message());
+ else
+ newEvent = new QAccessibleAnnouncementEvent(event->accessibleInterface(),
+ oldEvent->message());
+ newEvent->setPriority(oldEvent->priority());
+ ev = newEvent;
} else {
if (event->object())
ev = new QAccessibleEvent(event->object(), event->type());
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 2ab55cac36..5648fedd63 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -2202,6 +2202,19 @@ void QTest::ignoreMessage(QtMsgType type, const QRegularExpression &messagePatte
#endif // QT_CONFIG(regularexpression)
/*!
+ \since 6.8
+ \overload failOnWarning()
+
+ Appends a test failure to the test log if any warning is output.
+
+ \sa failOnWarning()
+*/
+void QTest::failOnWarning()
+{
+ return QTestLog::failOnWarning();
+}
+
+/*!
\since 6.3
\overload failOnWarning()
@@ -2247,7 +2260,17 @@ void QTest::failOnWarning(const char *message)
\code
void FileTest::init()
{
- QTest::failOnWarning(QRegularExpression(".?"));
+ QTest::failOnWarning(
+ QRegularExpression("QFile::.*: File(.*) already open"));
+ }
+ \endcode
+
+ For the common case of failing on \e any warning pass no parameter:
+
+ \code
+ void FileTest::init()
+ {
+ QTest::failOnWarning();
}
\endcode
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index 0ae1a787e2..a855ace6a9 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -435,6 +435,7 @@ namespace QTest
#if QT_CONFIG(regularexpression)
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern);
#endif
+ Q_TESTLIB_EXPORT void failOnWarning();
Q_TESTLIB_EXPORT void failOnWarning(const char *message);
#if QT_CONFIG(regularexpression)
Q_TESTLIB_EXPORT void failOnWarning(const QRegularExpression &messagePattern);
diff --git a/src/testlib/qtestevent.h b/src/testlib/qtestevent.h
index 8f092cf8c9..3b75e07f62 100644
--- a/src/testlib/qtestevent.h
+++ b/src/testlib/qtestevent.h
@@ -28,6 +28,9 @@ QT_BEGIN_NAMESPACE
# define QT_ONLY_WIDGETLIB_USES Q_DECL_UNUSED_MEMBER
#endif
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wweak-vtables") // QTBUG-1044486
+
class QTestEvent
{
public:
@@ -36,13 +39,15 @@ public:
#endif
virtual QTestEvent *clone() const = 0;
- virtual ~QTestEvent() {}
+ virtual ~QTestEvent() = default; // ### FIXME: weak vtable (QTBUG-104486)
};
#ifdef QT_GUI_LIB
class QTestKeyEvent: public QTestEvent
{
public:
+ ~QTestKeyEvent() override = default; // ### FIXME: weak vtable (QTBUG-104486)
+
inline QTestKeyEvent(QTest::KeyAction action, Qt::Key key, Qt::KeyboardModifiers modifiers, int delay)
: _action(action), _delay(delay), _modifiers(modifiers), _ascii(0), _key(key) {}
inline QTestKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers, int delay)
@@ -71,6 +76,8 @@ protected:
class QTestKeyClicksEvent: public QTestEvent
{
public:
+ ~QTestKeyClicksEvent() override = default; // ### FIXME: weak vtables (QTBUG-104486)
+
inline QTestKeyClicksEvent(const QString &keys, Qt::KeyboardModifiers modifiers, int delay)
: _keys(keys), _modifiers(modifiers), _delay(delay) {}
inline QTestEvent *clone() const override { return new QTestKeyClicksEvent(*this); }
@@ -91,6 +98,8 @@ private:
class QTestMouseEvent: public QTestEvent
{
public:
+ ~QTestMouseEvent() override = default; // ### FIXME: weak vtables (QTBUG-104486)
+
inline QTestMouseEvent(QTest::MouseAction action, Qt::MouseButton button,
Qt::KeyboardModifiers modifiers, QPoint position, int delay)
: _action(action), _button(button), _modifiers(modifiers), _pos(position), _delay(delay) {}
@@ -117,6 +126,8 @@ class QTestDelayEvent: public QTestEvent
{
public:
inline QTestDelayEvent(int msecs): _delay(msecs) {}
+ ~QTestDelayEvent() override = default; // ### FIXME: weak vtables (QTBUG-104486)
+
inline QTestEvent *clone() const override { return new QTestDelayEvent(*this); }
#ifdef QT_WIDGETS_LIB
@@ -190,6 +201,8 @@ public:
#undef QT_ONLY_WIDGETLIB_USES
+QT_WARNING_POP // Clang -Wweak-vtables
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QTestEventList)
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index 4b6df54e91..929ccb370b 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -629,6 +629,11 @@ void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expressio
}
#endif // QT_CONFIG(regularexpression)
+void QTestLog::failOnWarning()
+{
+ QTest::failOnWarningList.push_back({});
+}
+
void QTestLog::failOnWarning(const char *msg)
{
QTest::failOnWarningList.push_back(QString::fromUtf8(msg));
diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h
index f9bbfa158d..ab5fb593d4 100644
--- a/src/testlib/qtestlog_p.h
+++ b/src/testlib/qtestlog_p.h
@@ -71,6 +71,7 @@ public:
#ifndef QT_NO_REGULAREXPRESSION
static void ignoreMessage(QtMsgType type, const QRegularExpression &expression);
#endif
+ static void failOnWarning();
static void failOnWarning(const char *msg);
#ifndef QT_NO_REGULAREXPRESSION
static void failOnWarning(const QRegularExpression &expression);
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp
index 6125b405b5..eab943c049 100644
--- a/src/tools/androiddeployqt/main.cpp
+++ b/src/tools/androiddeployqt/main.cpp
@@ -20,6 +20,7 @@
#include <QHash>
#include <QSet>
#include <QMap>
+#include <QProcess>
#include <depfile_shared.h>
#include <shellquote_shared.h>
@@ -44,15 +45,16 @@ static const bool mustReadOutputAnyway = true; // pclose seems to return the wro
static QStringList dependenciesForDepfile;
-FILE *openProcess(const QString &command)
+auto openProcess(const QString &command)
{
#if defined(Q_OS_WIN32)
QString processedCommand = u'\"' + command + u'\"';
#else
const QString& processedCommand = command;
#endif
-
- return popen(processedCommand.toLocal8Bit().constData(), QT_POPEN_READ);
+ struct Closer { void operator()(FILE *proc) const { if (proc) (void)pclose(proc); } };
+ using UP = std::unique_ptr<FILE, Closer>;
+ return UP{popen(processedCommand.toLocal8Bit().constData(), QT_POPEN_READ)};
}
struct QtDependency
@@ -104,6 +106,9 @@ struct Options
, installApk(false)
, uninstallApk(false)
, qmlImportScannerBinaryPath()
+ , buildAar(false)
+ , qmlDomBinaryPath()
+ , generateJavaQmlComponents(false)
{}
enum DeploymentMechanism
@@ -163,7 +168,7 @@ struct Options
// Versioning
QString versionName;
QString versionCode;
- QByteArray minSdkVersion{"23"};
+ QByteArray minSdkVersion{"28"};
QByteArray targetSdkVersion{"34"};
// lib c++ path
@@ -239,6 +244,10 @@ struct Options
// Override qml import scanner path
QString qmlImportScannerBinaryPath;
bool qmlSkipImportScanning = false;
+ bool buildAar;
+ QString qmlDomBinaryPath;
+ bool generateJavaQmlComponents;
+ QSet<QString> selectedJavaQmlComponents;
};
static const QHash<QByteArray, QByteArray> elfArchitectures = {
@@ -310,23 +319,21 @@ QString fileArchitecture(const Options &options, const QString &path)
readElf = "%1 --needed-libs %2"_L1.arg(shellQuote(readElf), shellQuote(path));
- FILE *readElfCommand = openProcess(readElf);
+ auto readElfCommand = openProcess(readElf);
if (!readElfCommand) {
fprintf(stderr, "Cannot execute command %s\n", qPrintable(readElf));
return {};
}
char buffer[512];
- while (fgets(buffer, sizeof(buffer), readElfCommand) != nullptr) {
+ while (fgets(buffer, sizeof(buffer), readElfCommand.get()) != nullptr) {
QByteArray line = QByteArray::fromRawData(buffer, qstrlen(buffer));
line = line.trimmed();
if (line.startsWith("Arch: ")) {
auto it = elfArchitectures.find(line.mid(6));
- pclose(readElfCommand);
return it != elfArchitectures.constEnd() ? QString::fromLatin1(it.value()) : QString{};
}
}
- pclose(readElfCommand);
return {};
}
@@ -527,6 +534,8 @@ Options parseOptions()
options.protectedAuthenticationPath = true;
} else if (argument.compare("--aux-mode"_L1, Qt::CaseInsensitive) == 0) {
options.auxMode = true;
+ } else if (argument.compare("--build-aar"_L1, Qt::CaseInsensitive) == 0) {
+ options.buildAar = true;
} else if (argument.compare("--qml-importscanner-binary"_L1, Qt::CaseInsensitive) == 0) {
options.qmlImportScannerBinaryPath = arguments.at(++i).trimmed();
} else if (argument.compare("--no-rcc-bundle-cleanup"_L1,
@@ -538,6 +547,23 @@ Options parseOptions()
}
}
+ if (options.buildAar) {
+ if (options.installApk || options.uninstallApk) {
+ fprintf(stderr, "Warning: Skipping %s, AAR packages are not installable.\n",
+ options.uninstallApk ? "--reinstall" : "--install");
+ options.installApk = false;
+ options.uninstallApk = false;
+ }
+ if (options.buildAAB) {
+ fprintf(stderr, "Warning: Skipping -aab as --build-aar is present.\n");
+ options.buildAAB = false;
+ }
+ if (!options.keyStore.isEmpty()) {
+ fprintf(stderr, "Warning: Skipping --sign, signing AAR packages is not supported.\n");
+ options.keyStore.clear();
+ }
+ }
+
if (options.buildDirectory.isEmpty() && !options.depFilePath.isEmpty())
options.helpRequested = true;
@@ -615,7 +641,7 @@ Optional arguments:
--tsa <url>: Location of the Time Stamping Authority.
--tsacert <alias>: Public key certificate for TSA.
--internalsf: Include the .SF file inside the signature block.
- --sectionsonly: Don't compute hash of entire manifest.
+ --sectionsonly: Do not compute hash of entire manifest.
--protected: Keystore has protected authentication path.
--jarsigner: Deprecated, ignored.
@@ -645,6 +671,9 @@ Optional arguments:
--apk <path/where/to/copy/the/apk>: Path where to copy the built apk.
+ --build-aar: Build an AAR package. This option skips --aab, --install,
+ --reinstall, and --sign options if they are provided.
+
--qml-importscanner-binary <path/to/qmlimportscanner>: Override the
default qmlimportscanner binary path. By default the
qmlimportscanner binary is located using the Qt directory
@@ -658,7 +687,7 @@ Optional arguments:
--no-rcc-bundle-cleanup: skip cleaning rcc bundle directory after
running androiddeployqt. This option simplifies debugging of
the resource bundle content, but it should not be used when deploying
- a project, since it litters the 'assets' directory.
+ a project, since it litters the "assets" directory.
--copy-dependencies-only: resolve application dependencies and stop
deploying process after all libraries and resources that the
@@ -732,18 +761,72 @@ bool copyFileIfNewer(const QString &sourceFileName,
return true;
}
-QString cleanPackageName(QString packageName)
+struct GradleBuildConfigs {
+ QString appNamespace;
+ bool setsLegacyPackaging = false;
+ bool usesIntegerCompileSdkVersion = false;
+};
+
+GradleBuildConfigs gradleBuildConfigs(const QString &path)
+{
+ GradleBuildConfigs configs;
+
+ QFile file(path);
+ if (!file.open(QIODevice::ReadOnly))
+ return configs;
+
+ auto isComment = [](const QByteArray &trimmed) {
+ return trimmed.startsWith("//") || trimmed.startsWith('*') || trimmed.startsWith("/*");
+ };
+
+ auto extractValue = [](const QByteArray &trimmed) {
+ int idx = trimmed.indexOf('=');
+
+ if (idx == -1)
+ idx = trimmed.indexOf(' ');
+
+ if (idx > -1)
+ return trimmed.mid(idx + 1).trimmed();
+
+ return QByteArray();
+ };
+
+ const auto lines = file.readAll().split('\n');
+ for (const auto &line : lines) {
+ const QByteArray trimmedLine = line.trimmed();
+ if (isComment(trimmedLine))
+ continue;
+ if (trimmedLine.contains("useLegacyPackaging")) {
+ configs.setsLegacyPackaging = true;
+ } else if (trimmedLine.contains("compileSdkVersion androidCompileSdkVersion.toInteger()")) {
+ configs.usesIntegerCompileSdkVersion = true;
+ } else if (trimmedLine.contains("namespace")) {
+ configs.appNamespace = QString::fromUtf8(extractValue(trimmedLine));
+ }
+ }
+
+ return configs;
+}
+
+QString cleanPackageName(QString packageName, bool *cleaned = nullptr)
{
auto isLegalChar = [] (QChar c) -> bool {
ushort ch = c.unicode();
return (ch >= '0' && ch <= '9') ||
(ch >= 'A' && ch <= 'Z') ||
(ch >= 'a' && ch <= 'z') ||
- ch == '.';
+ ch == '.' || ch == '_';
};
+
+ if (cleaned)
+ *cleaned = false;
+
for (QChar &c : packageName) {
- if (!isLegalChar(c))
+ if (!isLegalChar(c)) {
c = u'_';
+ if (cleaned)
+ *cleaned = true;
+ }
}
static QStringList keywords;
@@ -778,12 +861,16 @@ QString cleanPackageName(QString packageName)
QChar c = word[0];
if ((c >= u'0' && c <= u'9') || c == u'_') {
packageName.insert(index + 1, u'a');
+ if (cleaned)
+ *cleaned = true;
index = next + 1;
continue;
}
}
if (keywords.contains(word)) {
packageName.insert(next, "_"_L1);
+ if (cleaned)
+ *cleaned = true;
index = next + 1;
} else {
index = next;
@@ -813,18 +900,31 @@ QString detectLatestAndroidPlatform(const QString &sdkPath)
return latestPlatform.baseName();
}
-QString packageNameFromAndroidManifest(const QString &androidManifestPath)
+QString extractPackageName(Options *options)
{
- QFile androidManifestXml(androidManifestPath);
+ {
+ const QString gradleBuildFile = options->androidSourceDirectory + "/build.gradle"_L1;
+ QString packageName = gradleBuildConfigs(gradleBuildFile).appNamespace;
+
+ if (!packageName.isEmpty() && packageName != "androidPackageName"_L1)
+ return packageName;
+ }
+
+ QFile androidManifestXml(options->androidSourceDirectory + "/AndroidManifest.xml"_L1);
if (androidManifestXml.open(QIODevice::ReadOnly)) {
QXmlStreamReader reader(&androidManifestXml);
while (!reader.atEnd()) {
reader.readNext();
- if (reader.isStartElement() && reader.name() == "manifest"_L1)
- return cleanPackageName(reader.attributes().value("package"_L1).toString());
+ if (reader.isStartElement() && reader.name() == "manifest"_L1) {
+ QString packageName = reader.attributes().value("package"_L1).toString();
+ if (!packageName.isEmpty() && packageName != "org.qtproject.example"_L1)
+ return packageName;
+ break;
+ }
}
}
- return {};
+
+ return QString();
}
bool parseCmakeBoolean(const QJsonValue &value)
@@ -1202,6 +1302,40 @@ bool readInputFile(Options *options)
}
{
+ const QJsonValue genJavaQmlComponents = jsonObject.value("generate-java-qml-components"_L1);
+ if (!genJavaQmlComponents.isUndefined() && genJavaQmlComponents.isBool()) {
+ options->generateJavaQmlComponents = genJavaQmlComponents.toBool(false);
+ if (options->generateJavaQmlComponents && !options->buildAar) {
+ fprintf(stderr,
+ "Warning: Skipping the generation of Java components from QML as it can be "
+ "enabled only for an AAR target.\n");
+ options->generateJavaQmlComponents = false;
+ }
+ }
+ }
+
+ {
+ const QJsonValue qmlDomBinaryPath = jsonObject.value("qml-dom-binary"_L1);
+ if (!qmlDomBinaryPath.isUndefined()) {
+ options->qmlDomBinaryPath = qmlDomBinaryPath.toString();
+ } else if (options->generateJavaQmlComponents) {
+ fprintf(stderr,
+ "No qmldom binary defined in json file which is required when "
+ "building with QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS flag.\n");
+ return false;
+ }
+ }
+
+ {
+ const QJsonValue qmlFiles = jsonObject.value("qml-files-for-code-generator"_L1);
+ if (!qmlFiles.isUndefined() && qmlFiles.isArray()) {
+ const QJsonArray jArray = qmlFiles.toArray();
+ for (auto &item : jArray)
+ options->selectedJavaQmlComponents << item.toString();
+ }
+ }
+
+ {
const QJsonValue applicationBinary = jsonObject.value("application-binary"_L1);
if (applicationBinary.isUndefined()) {
fprintf(stderr, "No application binary defined in json file.\n");
@@ -1222,6 +1356,24 @@ bool readInputFile(Options *options)
}
{
+ const QJsonValue androidPackageName = jsonObject.value("android-package-name"_L1);
+ const QString extractedPackageName = extractPackageName(options);
+ if (!extractedPackageName.isEmpty())
+ options->packageName = extractedPackageName;
+ else if (!androidPackageName.isUndefined())
+ options->packageName = androidPackageName.toString();
+ else
+ options->packageName = "org.qtproject.example.%1"_L1.arg(options->applicationBinary);
+
+ bool cleaned;
+ options->packageName = cleanPackageName(options->packageName, &cleaned);
+ if (cleaned) {
+ fprintf(stderr, "Warning: Package name contained illegal characters and was cleaned "
+ "to \"%s\"\n", qPrintable(options->packageName));
+ }
+ }
+
+ {
using ItFlag = QDirListing::IteratorFlag;
const QJsonValue deploymentDependencies = jsonObject.value("deployment-dependencies"_L1);
if (!deploymentDependencies.isUndefined()) {
@@ -1278,9 +1430,6 @@ bool readInputFile(Options *options)
options->isZstdCompressionEnabled = zstdCompressionFlag.toBool();
}
}
- options->packageName = packageNameFromAndroidManifest(options->androidSourceDirectory + "/AndroidManifest.xml"_L1);
- if (options->packageName.isEmpty())
- options->packageName = cleanPackageName("org.qtproject.example.%1"_L1.arg(options->applicationBinary));
return true;
}
@@ -1380,6 +1529,9 @@ bool copyAndroidTemplate(const Options &options)
if (!copyAndroidTemplate(options, "/src/android/templates"_L1))
return false;
+ if (options.buildAar)
+ return copyAndroidTemplate(options, "/src/android/templates_aar"_L1);
+
return true;
}
@@ -1735,16 +1887,10 @@ bool updateAndroidManifest(Options &options)
reader.readNext();
if (reader.isStartElement()) {
- if (reader.name() == "manifest"_L1) {
- if (!reader.attributes().hasAttribute("package"_L1)) {
- fprintf(stderr, "Invalid android manifest file: %s\n", qPrintable(androidManifestPath));
- return false;
- }
- options.packageName = reader.attributes().value("package"_L1).toString();
- } else if (reader.name() == "uses-sdk"_L1) {
+ if (reader.name() == "uses-sdk"_L1) {
if (reader.attributes().hasAttribute("android:minSdkVersion"_L1))
- if (reader.attributes().value("android:minSdkVersion"_L1).toInt() < 23) {
- fprintf(stderr, "Invalid minSdkVersion version, minSdkVersion must be >= 23\n");
+ if (reader.attributes().value("android:minSdkVersion"_L1).toInt() < 28) {
+ fprintf(stderr, "Invalid minSdkVersion version, minSdkVersion must be >= 28\n");
return false;
}
} else if ((reader.name() == "application"_L1 ||
@@ -2014,7 +2160,7 @@ QStringList getQtLibsFromElf(const Options &options, const QString &fileName)
readElf = "%1 --needed-libs %2"_L1.arg(shellQuote(readElf), shellQuote(fileName));
- FILE *readElfCommand = openProcess(readElf);
+ auto readElfCommand = openProcess(readElf);
if (!readElfCommand) {
fprintf(stderr, "Cannot execute command %s\n", qPrintable(readElf));
return QStringList();
@@ -2024,7 +2170,7 @@ QStringList getQtLibsFromElf(const Options &options, const QString &fileName)
bool readLibs = false;
char buffer[512];
- while (fgets(buffer, sizeof(buffer), readElfCommand) != nullptr) {
+ while (fgets(buffer, sizeof(buffer), readElfCommand.get()) != nullptr) {
QByteArray line = QByteArray::fromRawData(buffer, qstrlen(buffer));
QString library;
line = line.trimmed();
@@ -2034,7 +2180,6 @@ QStringList getQtLibsFromElf(const Options &options, const QString &fileName)
if (it == elfArchitectures.constEnd() || *it != options.currentArchitecture.toLatin1()) {
if (options.verbose)
fprintf(stdout, "Skipping \"%s\", architecture mismatch\n", qPrintable(fileName));
- pclose(readElfCommand);
return {};
}
}
@@ -2049,8 +2194,6 @@ QStringList getQtLibsFromElf(const Options &options, const QString &fileName)
ret += libraryName;
}
- pclose(readElfCommand);
-
return ret;
}
@@ -2188,7 +2331,7 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
qmlImportScanner.toLocal8Bit().constData());
}
- FILE *qmlImportScannerCommand = popen(qmlImportScanner.toLocal8Bit().constData(), QT_POPEN_READ);
+ auto qmlImportScannerCommand = openProcess(qmlImportScanner);
if (qmlImportScannerCommand == 0) {
fprintf(stderr, "Couldn't run qmlimportscanner.\n");
return false;
@@ -2196,13 +2339,12 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
QByteArray output;
char buffer[512];
- while (fgets(buffer, sizeof(buffer), qmlImportScannerCommand) != 0)
+ while (fgets(buffer, sizeof(buffer), qmlImportScannerCommand.get()) != nullptr)
output += QByteArray(buffer, qstrlen(buffer));
QJsonDocument jsonDocument = QJsonDocument::fromJson(output);
if (jsonDocument.isNull()) {
fprintf(stderr, "Invalid json output from qmlimportscanner.\n");
- pclose(qmlImportScannerCommand);
return false;
}
@@ -2211,7 +2353,6 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
QJsonValue value = jsonArray.at(i);
if (!value.isObject()) {
fprintf(stderr, "Invalid format of qmlimportscanner output.\n");
- pclose(qmlImportScannerCommand);
return false;
}
@@ -2257,7 +2398,6 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
if (importPathOfThisImport.isEmpty()) {
fprintf(stderr, "Import found outside of import paths: %s.\n", qPrintable(info.absoluteFilePath()));
- pclose(qmlImportScannerCommand);
return false;
}
@@ -2325,7 +2465,6 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
}
}
- pclose(qmlImportScannerCommand);
return true;
}
@@ -2344,17 +2483,17 @@ bool runCommand(const Options &options, const QString &command)
if (options.verbose)
fprintf(stdout, "Running command '%s'\n", qPrintable(command));
- FILE *runCommand = openProcess(command);
+ auto runCommand = openProcess(command);
if (runCommand == nullptr) {
fprintf(stderr, "Cannot run command '%s'\n", qPrintable(command));
return false;
}
char buffer[4096];
- while (fgets(buffer, sizeof(buffer), runCommand) != nullptr) {
+ while (fgets(buffer, sizeof(buffer), runCommand.get()) != nullptr) {
if (options.verbose)
fprintf(stdout, "%s", buffer);
}
- pclose(runCommand);
+ runCommand.reset();
fflush(stdout);
fflush(stderr);
return true;
@@ -2505,7 +2644,8 @@ bool containsApplicationBinary(Options *options)
return true;
}
-FILE *runAdb(const Options &options, const QString &arguments)
+auto runAdb(const Options &options, const QString &arguments)
+ -> decltype(openProcess({}))
{
QString adb = execSuffixAppended(options.sdkPath + "/platform-tools/adb"_L1);
if (!QFile::exists(adb)) {
@@ -2521,7 +2661,7 @@ FILE *runAdb(const Options &options, const QString &arguments)
if (options.verbose)
fprintf(stdout, "Running command \"%s\"\n", adb.toLocal8Bit().constData());
- FILE *adbCommand = openProcess(adb);
+ auto adbCommand = openProcess(adb);
if (adbCommand == 0) {
fprintf(stderr, "Cannot start adb: %s\n", qPrintable(adb));
return 0;
@@ -2745,38 +2885,6 @@ void checkAndWarnGradleLongPaths(const QString &outputDirectory)
}
#endif
-struct GradleFlags {
- bool setsLegacyPackaging = false;
- bool usesIntegerCompileSdkVersion = false;
-};
-
-GradleFlags gradleBuildFlags(const QString &path)
-{
- GradleFlags flags;
-
- QFile file(path);
- if (!file.open(QIODevice::ReadOnly))
- return flags;
-
- auto isComment = [](const QByteArray &line) {
- const auto trimmed = line.trimmed();
- return trimmed.startsWith("//") || trimmed.startsWith('*') || trimmed.startsWith("/*");
- };
-
- const auto lines = file.readAll().split('\n');
- for (const auto &line : lines) {
- if (isComment(line))
- continue;
- if (line.contains("useLegacyPackaging")) {
- flags.setsLegacyPackaging = true;
- } else if (line.contains("compileSdkVersion androidCompileSdkVersion.toInteger()")) {
- flags.usesIntegerCompileSdkVersion = true;
- }
- }
-
- return flags;
-}
-
bool buildAndroidProject(const Options &options)
{
GradleProperties localProperties;
@@ -2789,8 +2897,8 @@ bool buildAndroidProject(const Options &options)
GradleProperties gradleProperties = readGradleProperties(gradlePropertiesPath);
const QString gradleBuildFilePath = options.outputDirectory + "build.gradle"_L1;
- GradleFlags gradleFlags = gradleBuildFlags(gradleBuildFilePath);
- if (!gradleFlags.setsLegacyPackaging)
+ GradleBuildConfigs gradleConfigs = gradleBuildConfigs(gradleBuildFilePath);
+ if (!gradleConfigs.setsLegacyPackaging)
gradleProperties["android.bundle.enableUncompressedNativeLibs"] = "false";
gradleProperties["buildDir"] = "build";
@@ -2809,7 +2917,7 @@ bool buildAndroidProject(const Options &options)
QByteArray sdkPlatformVersion;
// Provide the integer version only if build.gradle explicitly converts to Integer,
// to avoid regression to existing projects that build for sdk platform of form android-xx.
- if (gradleFlags.usesIntegerCompileSdkVersion) {
+ if (gradleConfigs.usesIntegerCompileSdkVersion) {
const QByteArray tmp = options.androidPlatform.split(u'-').last().toLocal8Bit();
bool ok;
tmp.toInt(&ok);
@@ -2824,6 +2932,7 @@ bool buildAndroidProject(const Options &options)
if (sdkPlatformVersion.isEmpty())
sdkPlatformVersion = options.androidPlatform.toLocal8Bit();
+ gradleProperties["androidPackageName"] = options.packageName.toLocal8Bit();
gradleProperties["androidCompileSdkVersion"] = sdkPlatformVersion;
gradleProperties["qtMinSdkVersion"] = options.minSdkVersion;
gradleProperties["qtTargetSdkVersion"] = options.targetSdkVersion;
@@ -2839,6 +2948,9 @@ bool buildAndroidProject(const Options &options)
abiList.append(it.key());
}
gradleProperties["qtTargetAbiList"] = abiList.toLocal8Bit();// armeabi-v7a or arm64-v8a or ...
+ gradleProperties["qtGradlePluginType"] = options.buildAar
+ ? "com.android.library"
+ : "com.android.application";
if (!mergeGradleProperties(gradlePropertiesPath, gradleProperties))
return false;
@@ -2864,19 +2976,19 @@ bool buildAndroidProject(const Options &options)
if (options.verbose)
commandLine += " --info"_L1;
- FILE *gradleCommand = openProcess(commandLine);
+ auto gradleCommand = openProcess(commandLine);
if (gradleCommand == 0) {
fprintf(stderr, "Cannot run gradle command: %s\n.", qPrintable(commandLine));
return false;
}
char buffer[512];
- while (fgets(buffer, sizeof(buffer), gradleCommand) != 0) {
+ while (fgets(buffer, sizeof(buffer), gradleCommand.get()) != nullptr) {
fprintf(stdout, "%s", buffer);
fflush(stdout);
}
- int errorCode = pclose(gradleCommand);
+ const int errorCode = pclose(gradleCommand.release());
if (errorCode != 0) {
fprintf(stderr, "Building the android package failed!\n");
if (!options.verbose)
@@ -2902,18 +3014,18 @@ bool uninstallApk(const Options &options)
fprintf(stdout, "Uninstalling old Android package %s if present.\n", qPrintable(options.packageName));
- FILE *adbCommand = runAdb(options, " uninstall "_L1 + shellQuote(options.packageName));
+ auto adbCommand = runAdb(options, " uninstall "_L1 + shellQuote(options.packageName));
if (adbCommand == 0)
return false;
if (options.verbose || mustReadOutputAnyway) {
char buffer[512];
- while (fgets(buffer, sizeof(buffer), adbCommand) != 0)
+ while (fgets(buffer, sizeof(buffer), adbCommand.get()) != nullptr)
if (options.verbose)
fprintf(stdout, "%s", buffer);
}
- int returnCode = pclose(adbCommand);
+ const int returnCode = pclose(adbCommand.release());
if (returnCode != 0) {
fprintf(stderr, "Warning: Uninstall failed!\n");
if (!options.verbose)
@@ -2926,39 +3038,43 @@ bool uninstallApk(const Options &options)
enum PackageType {
AAB,
+ AAR,
UnsignedAPK,
SignedAPK
};
-QString packagePath(const Options &options, PackageType pt)
-{
- QString path(options.outputDirectory);
- path += "/build/outputs/%1/"_L1.arg(pt >= UnsignedAPK ? QStringLiteral("apk") : QStringLiteral("bundle"));
- QString buildType(options.releasePackage ? "release/"_L1 : "debug/"_L1);
- if (QDir(path + buildType).exists())
- path += buildType;
- path += QDir(options.outputDirectory).dirName() + u'-';
- if (options.releasePackage) {
- path += "release-"_L1;
- if (pt >= UnsignedAPK) {
- if (pt == UnsignedAPK)
- path += "un"_L1;
- path += "signed.apk"_L1;
- } else {
- path.chop(1);
- path += ".aab"_L1;
- }
- } else {
- path += "debug"_L1;
- if (pt >= UnsignedAPK) {
- if (pt == SignedAPK)
- path += "-signed"_L1;
- path += ".apk"_L1;
- } else {
- path += ".aab"_L1;
- }
- }
- return path;
+QString packagePath(const Options &options, PackageType packageType)
+{
+ // The package type is always AAR if option.buildAar has been set
+ if (options.buildAar)
+ packageType = AAR;
+
+ static const QHash<PackageType, QLatin1StringView> packageTypeToPath{
+ { AAB, "bundle"_L1 }, { AAR, "aar"_L1 }, { UnsignedAPK, "apk"_L1 }, { SignedAPK, "apk"_L1 }
+ };
+ static const QHash<PackageType, QLatin1StringView> packageTypeToExtension{
+ { AAB, "aab"_L1 }, { AAR, "aar"_L1 }, { UnsignedAPK, "apk"_L1 }, { SignedAPK, "apk"_L1 }
+ };
+
+ const QString buildType(options.releasePackage ? "release"_L1 : "debug"_L1);
+ QString signedSuffix;
+ if (packageType == SignedAPK)
+ signedSuffix = "-signed"_L1;
+ else if (packageType == UnsignedAPK && options.releasePackage)
+ signedSuffix = "-unsigned"_L1;
+
+ QString dirPath(options.outputDirectory);
+ dirPath += "/build/outputs/%1/"_L1.arg(packageTypeToPath[packageType]);
+ if (QDir(dirPath + buildType).exists())
+ dirPath += buildType;
+
+ const QString fileName = "/%1-%2%3.%4"_L1.arg(
+ QDir(options.outputDirectory).dirName(),
+ buildType,
+ signedSuffix,
+ packageTypeToExtension[packageType]);
+
+ return dirPath + fileName;
}
bool installApk(const Options &options)
@@ -2971,20 +3087,20 @@ bool installApk(const Options &options)
if (options.verbose)
fprintf(stdout, "Installing Android package to device.\n");
- FILE *adbCommand = runAdb(options, " install -r "_L1
- + packagePath(options, options.keyStore.isEmpty() ? UnsignedAPK
- : SignedAPK));
+ auto adbCommand = runAdb(options, " install -r "_L1
+ + packagePath(options, options.keyStore.isEmpty() ? UnsignedAPK
+ : SignedAPK));
if (adbCommand == 0)
return false;
if (options.verbose || mustReadOutputAnyway) {
char buffer[512];
- while (fgets(buffer, sizeof(buffer), adbCommand) != 0)
+ while (fgets(buffer, sizeof(buffer), adbCommand.get()) != nullptr)
if (options.verbose)
fprintf(stdout, "%s", buffer);
}
- int returnCode = pclose(adbCommand);
+ const int returnCode = pclose(adbCommand.release());
if (returnCode != 0) {
fprintf(stderr, "Installing to device failed!\n");
if (!options.verbose)
@@ -3102,7 +3218,7 @@ bool signAAB(const Options &options)
QString command = jarSignerTool + " %1 %2"_L1.arg(shellQuote(file))
.arg(shellQuote(options.keyStoreAlias));
- FILE *jarSignerCommand = openProcess(command);
+ auto jarSignerCommand = openProcess(command);
if (jarSignerCommand == 0) {
fprintf(stderr, "Couldn't run jarsigner.\n");
return false;
@@ -3110,11 +3226,11 @@ bool signAAB(const Options &options)
if (options.verbose) {
char buffer[512];
- while (fgets(buffer, sizeof(buffer), jarSignerCommand) != 0)
+ while (fgets(buffer, sizeof(buffer), jarSignerCommand.get()) != nullptr)
fprintf(stdout, "%s", buffer);
}
- int errorCode = pclose(jarSignerCommand);
+ const int errorCode = pclose(jarSignerCommand.release());
if (errorCode != 0) {
fprintf(stderr, "jarsigner command failed.\n");
if (!options.verbose)
@@ -3142,17 +3258,17 @@ bool signPackage(const Options &options)
return false;
auto zipalignRunner = [](const QString &zipAlignCommandLine) {
- FILE *zipAlignCommand = openProcess(zipAlignCommandLine);
+ auto zipAlignCommand = openProcess(zipAlignCommandLine);
if (zipAlignCommand == 0) {
fprintf(stderr, "Couldn't run zipalign.\n");
return false;
}
char buffer[512];
- while (fgets(buffer, sizeof(buffer), zipAlignCommand) != 0)
+ while (fgets(buffer, sizeof(buffer), zipAlignCommand.get()) != nullptr)
fprintf(stdout, "%s", buffer);
- return pclose(zipAlignCommand) == 0;
+ return pclose(zipAlignCommand.release()) == 0;
};
const QString verifyZipAlignCommandLine =
@@ -3209,17 +3325,17 @@ bool signPackage(const Options &options)
apkSignCommand += " %1"_L1.arg(shellQuote(packagePath(options, SignedAPK)));
auto apkSignerRunner = [](const QString &command, bool verbose) {
- FILE *apkSigner = openProcess(command);
+ auto apkSigner = openProcess(command);
if (apkSigner == 0) {
fprintf(stderr, "Couldn't run apksigner.\n");
return false;
}
char buffer[512];
- while (fgets(buffer, sizeof(buffer), apkSigner) != 0)
+ while (fgets(buffer, sizeof(buffer), apkSigner.get()) != nullptr)
fprintf(stdout, "%s", buffer);
- int errorCode = pclose(apkSigner);
+ const int errorCode = pclose(apkSigner.release());
if (errorCode != 0) {
fprintf(stderr, "apksigner command failed.\n");
if (!verbose)
@@ -3263,7 +3379,8 @@ enum ErrorCode
CannotInstallApk = 16,
CannotCopyAndroidExtraResources = 19,
CannotCopyApk = 20,
- CannotCreateRcc = 21
+ CannotCreateRcc = 21,
+ CannotGenerateJavaQmlComponents = 22
};
bool writeDependencyFile(const Options &options)
@@ -3296,6 +3413,362 @@ bool writeDependencyFile(const Options &options)
return true;
}
+int generateJavaQmlComponents(const Options &options)
+{
+ // TODO QTBUG-125892: Current method of path discovery are to be improved
+ // For instance, it does not discover statically linked **inner** QML modules.
+ const auto getImportPaths = [](const QString &buildPath, const QString &libName,
+ QStringList &appImports, QStringList &externalImports) -> bool {
+ QFile confRspFile("/%1/.qt/qml_imports/%2_conf.rsp"_L1.arg(buildPath, libName));
+ if (!confRspFile.exists() || !confRspFile.open(QFile::ReadOnly))
+ return false;
+ QTextStream rspStream(&confRspFile);
+ while (!rspStream.atEnd()) {
+ QString currentLine = rspStream.readLine();
+ if (currentLine.compare("-importPath"_L1) == 0) {
+ currentLine = rspStream.readLine();
+ if (QDir::cleanPath(currentLine).startsWith(QDir::cleanPath(buildPath)))
+ appImports << currentLine;
+ else
+ externalImports << currentLine;
+ }
+ }
+ return appImports.count() + externalImports.count();
+ };
+
+ struct ComponentInfo {
+ QString name;
+ QString path;
+ };
+
+ struct ModuleInfo
+ {
+ QString moduleName;
+ QString preferPath;
+ QList<ComponentInfo> qmlComponents;
+ bool isValid() { return qmlComponents.size() && moduleName.size(); }
+ };
+
+ const auto getModuleInfo = [](const QString &qmldirPath) -> ModuleInfo {
+ QFile qmlDirFile(qmldirPath + "/qmldir"_L1);
+ if (!qmlDirFile.exists() || !qmlDirFile.open(QFile::ReadOnly))
+ return ModuleInfo();
+ ModuleInfo moduleInfo;
+ QTextStream qmldirStream(&qmlDirFile);
+ while (!qmldirStream.atEnd()) {
+ const QString currentLine = qmldirStream.readLine();
+ if (currentLine.size() && currentLine[0].isLower()) {
+ // TODO QTBUG-125891: Handling of QML modules with dotted URI
+ if (currentLine.startsWith("module "_L1))
+ moduleInfo.moduleName = currentLine.split(" "_L1)[1];
+ else if (currentLine.startsWith("prefer "_L1))
+ moduleInfo.preferPath = currentLine.split(" "_L1)[1];
+ } else if (currentLine.size()
+ && (currentLine[0].isUpper() || currentLine.startsWith("singleton"_L1))) {
+ const QStringList parts = currentLine.split(" "_L1);
+ if (parts.size() > 2)
+ moduleInfo.qmlComponents.append({ parts.first(), parts.last() });
+ }
+ }
+ return moduleInfo;
+ };
+
+ const auto extractDomInfo = [](const QString &qmlDomExecPath, const QString &qmldirPath,
+ const QString &qmlFile,
+ const QStringList &otherImportPaths) -> QJsonObject {
+ QByteArray domInfo;
+ QString importFlags;
+ for (auto &importPath : otherImportPaths)
+ importFlags.append(" -i %1"_L1.arg(shellQuote(importPath)));
+
+ const QString qmlDomCmd = "%1 -d -D required -f +:propertyInfos %2 %3"_L1.arg(
+ shellQuote(qmlDomExecPath), importFlags,
+ shellQuote("%1/%2"_L1.arg(qmldirPath, qmlFile)));
+ const QStringList qmlDomCmdParts = QProcess::splitCommand(qmlDomCmd);
+ QProcess process;
+ process.start(qmlDomCmdParts.first(), qmlDomCmdParts.sliced(1));
+ if (!process.waitForStarted()) {
+ fprintf(stderr, "Cannot execute command %s\n", qPrintable(qmlDomCmd));
+ return QJsonObject();
+ }
+ // Wait, maximum 30 seconds
+ if (!process.waitForFinished(30000)) {
+ fprintf(stderr, "Execution of command %s timed out.\n", qPrintable(qmlDomCmd));
+ return QJsonObject();
+ }
+ domInfo = process.readAllStandardOutput();
+
+ QJsonParseError jsonError;
+ const QJsonDocument jsonDoc = QJsonDocument::fromJson(domInfo, &jsonError);
+ if (jsonError.error != QJsonParseError::NoError)
+ fprintf(stderr, "Output of %s is not valid JSON document.", qPrintable(qmlDomCmd));
+ return jsonDoc.object();
+ };
+
+ const auto getComponent = [](const QJsonObject &dom) -> QJsonObject {
+ if (dom.isEmpty())
+ return QJsonObject();
+
+ const QJsonObject currentItem = dom.value("currentItem"_L1).toObject();
+ if (!currentItem.value("isValid"_L1).toBool(false))
+ return QJsonObject();
+
+ const QJsonArray components =
+ currentItem.value("components"_L1).toObject().value(""_L1).toArray();
+ if (components.isEmpty())
+ return QJsonObject();
+ return components.constBegin()->toObject();
+ };
+
+ const auto getProperties = [](const QJsonObject &component) -> QJsonArray {
+ QJsonArray properties;
+ const QJsonArray objects = component.value("objects"_L1).toArray();
+ if (objects.isEmpty())
+ return QJsonArray();
+ const QJsonObject propertiesObject =
+ objects[0].toObject().value("propertyInfos"_L1).toObject();
+ for (const auto &jsonProperty : propertiesObject) {
+ const QJsonArray propertyDefs =
+ jsonProperty.toObject().value("propertyDefs"_L1).toArray();
+ if (propertyDefs.isEmpty())
+ continue;
+
+ properties.append(propertyDefs[0].toObject());
+ }
+ return properties;
+ };
+
+ const auto getMethods = [](const QJsonObject &component) -> QJsonArray {
+ QJsonArray methods;
+ const QJsonArray objects = component.value("objects"_L1).toArray();
+ if (objects.isEmpty())
+ return QJsonArray();
+ const QJsonObject methodsObject = objects[0].toObject().value("methods"_L1).toObject();
+ for (const auto &jsonMethod : methodsObject) {
+ const QJsonArray overloads = jsonMethod.toArray();
+ for (const auto &m : overloads)
+ methods.append(m);
+ }
+ return methods;
+ };
+
+ const static QHash<QString, QString> qmlToJavaType = {
+ { "qreal"_L1, "Double"_L1 }, { "double"_L1, "Double"_L1 }, { "int"_L1, "Integer"_L1 },
+ { "float"_L1, "Float"_L1 }, { "bool"_L1, "Boolean"_L1 }, { "string"_L1, "String"_L1 },
+ { "void"_L1, "Void"_L1 }
+ };
+
+ const auto endBlock = [](QTextStream &stream, int indentWidth = 0) {
+ stream << QString(indentWidth, u' ') << "}\n";
+ };
+
+ const auto createHeaderBlock = [](QTextStream &stream, const QString &javaPackage) {
+ stream << "/* This file is autogenerated by androiddeployqt. Do not edit */\n\n"
+ << "package %1;\n\n"_L1.arg(javaPackage)
+ << "import org.qtproject.qt.android.QtSignalListener;\n"
+ << "import org.qtproject.qt.android.QtQmlComponent;\n\n";
+ };
+
+ const auto beginLibraryBlock = [](QTextStream &stream, const QString &libName) {
+ stream << QLatin1StringView("public final class %1 {\n").arg(libName);
+ };
+
+ const auto beginModuleBlock = [](QTextStream &stream, const QString &moduleName,
+ bool topLevel = false, int indentWidth = 4) {
+ const QString indent(indentWidth, u' ');
+ stream << indent
+ << "public final%1 class %2 {\n"_L1.arg(topLevel ? ""_L1 : " static"_L1, moduleName);
+ };
+
+ const auto beginComponentBlock = [](QTextStream &stream, const QString &libName,
+ const QString &moduleName, const QString &preferPath,
+ const ComponentInfo &componentInfo, int indentWidth = 8) {
+ const QString indent(indentWidth, u' ');
+
+ stream << indent
+ << "public final static class %1 extends QtQmlComponent {\n"_L1
+ .arg(componentInfo.name)
+ << indent << " @Override public String getLibraryName() {\n"_L1
+ << indent << " return \"%1\";\n"_L1.arg(libName)
+ << indent << " }\n"_L1
+ << indent << " @Override public String getModuleName() {\n"_L1
+ << indent << " return \"%1\";\n"_L1.arg(moduleName)
+ << indent << " }\n"_L1
+ << indent << " @Override public String getFilePath() {\n"_L1
+ << indent << " return \"qrc%1%2\";\n"_L1.arg(preferPath)
+ .arg(componentInfo.path)
+ << indent << " }\n"_L1;
+ };
+
+ const auto beginPropertyBlock = [](QTextStream &stream, const QJsonObject &propertyData,
+ int indentWidth = 8) {
+ const QString indent(indentWidth, u' ');
+ const QString propertyName = propertyData["name"_L1].toString();
+ if (propertyName.isEmpty())
+ return;
+ const QString upperPropertyName =
+ propertyName[0].toUpper() + propertyName.last(propertyName.size() - 1);
+ const QString typeName = propertyData["typeName"_L1].toString();
+ const bool isReadyonly = propertyData["isReadonly"_L1].toBool();
+
+ const QString javaTypeName = qmlToJavaType.value(typeName, "Object"_L1);
+
+ if (!isReadyonly) {
+ stream << indent
+ << "public void set%1(%2 %3) { setProperty(\"%3\", %3); }\n"_L1.arg(
+ upperPropertyName, javaTypeName, propertyName);
+ }
+
+ stream << indent
+ << "public %2 get%1() { return this.<%2>getProperty(\"%3\"); }\n"_L1
+ .arg(upperPropertyName, javaTypeName, propertyName)
+ << indent
+ << "public int connect%1ChangeListener(QtSignalListener<%2> signalListener) {\n"_L1
+ .arg(upperPropertyName, javaTypeName)
+ << indent
+ << " return connectSignalListener(\"%1\", %2.class, signalListener);\n"_L1.arg(
+ propertyName, javaTypeName)
+ << indent << "}\n";
+ };
+
+ const auto beginSignalBlock = [](QTextStream &stream, const QJsonObject &methodData,
+ int indentWidth = 8) {
+ const QString indent(indentWidth, u' ');
+ if (methodData["methodType"_L1] != 0)
+ return;
+ const QJsonArray parameters = methodData["parameters"_L1].toArray();
+ if (parameters.size() > 1)
+ return;
+
+ const QString methodName = methodData["name"_L1].toString();
+ if (methodName.isEmpty())
+ return;
+ const QString upperMethodName =
+ methodName[0].toUpper() + methodName.last(methodName.size() - 1);
+ const QString typeName = !parameters.isEmpty()
+ ? parameters[0].toObject()["typeName"_L1].toString()
+ : "void"_L1;
+
+ const QString javaTypeName = qmlToJavaType.value(typeName, "Object"_L1);
+ stream << indent
+ << "public int connect%1Listener(QtSignalListener<%2> signalListener) {\n"_L1.arg(
+ upperMethodName, javaTypeName)
+ << indent
+ << " return connectSignalListener(\"%1\", %2.class, signalListener);\n"_L1.arg(
+ methodName, javaTypeName)
+ << indent << "}\n";
+ };
+
+ const QString libName(options.applicationBinary);
+ const QString libClassname = libName[0].toUpper() + libName.last(libName.size() - 1);
+ const QString javaPackage = options.packageName;
+ const QString outputDir = "%1/src/%2"_L1.arg(options.outputDirectory,
+ QString(javaPackage).replace(u'.', u'/'));
+ const QString buildPath(QDir(options.buildDirectory).absolutePath());
+ const QString domBinaryPath(options.qmlDomBinaryPath);
+ const bool leafEqualsLibname = javaPackage.endsWith(".%1"_L1.arg(libName));
+
+ fprintf(stdout, "Generating Java QML Components in %s directory.\n", qPrintable(outputDir));
+ if (!QDir().current().mkpath(outputDir)) {
+ fprintf(stderr, "Cannot create %s directory\n", qPrintable(outputDir));
+ return false;
+ }
+
+ QStringList appImports;
+ QStringList externalImports;
+ if (!getImportPaths(buildPath, libName, appImports, externalImports))
+ return false;
+
+ QTextStream outputStream;
+ std::unique_ptr<QFile> outputFile;
+
+ if (!leafEqualsLibname) {
+ outputFile.reset(new QFile("%1/%2.java"_L1.arg(outputDir, libClassname)));
+ if (outputFile->exists())
+ outputFile->remove();
+ if (!outputFile->open(QFile::ReadWrite)) {
+ fprintf(stderr, "Cannot open %s file to write.\n",
+ qPrintable(outputFile->fileName()));
+ return false;
+ }
+ outputStream.setDevice(outputFile.get());
+ createHeaderBlock(outputStream, javaPackage);
+ beginLibraryBlock(outputStream, libClassname);
+ }
+
+ int generatedComponents = 0;
+ for (const auto &importPath : appImports) {
+ ModuleInfo moduleInfo = getModuleInfo(importPath);
+ if (!moduleInfo.isValid())
+ continue;
+
+ const QString moduleClassname = moduleInfo.moduleName[0].toUpper()
+ + moduleInfo.moduleName.last(moduleInfo.moduleName.size() - 1);
+
+ int indentBase = 4;
+ if (leafEqualsLibname) {
+ indentBase = 0;
+ QIODevice *outputStreamDevice = outputStream.device();
+ if (outputStreamDevice) {
+ outputStream.flush();
+ outputStream.reset();
+ outputStreamDevice->close();
+ }
+
+ outputFile.reset(new QFile("%1/%2.java"_L1.arg(outputDir,moduleClassname)));
+ if (outputFile->exists() && !outputFile->remove())
+ return false;
+ if (!outputFile->open(QFile::ReadWrite)) {
+ fprintf(stderr, "Cannot open %s file to write.\n", qPrintable(outputFile->fileName()));
+ return false;
+ }
+
+ outputStream.setDevice(outputFile.get());
+ createHeaderBlock(outputStream, javaPackage);
+ }
+
+ beginModuleBlock(outputStream, moduleClassname, leafEqualsLibname, indentBase);
+ indentBase += 4;
+
+ for (const auto &qmlComponent : moduleInfo.qmlComponents) {
+ const bool isSelected = options.selectedJavaQmlComponents.contains(
+ "%1.%2"_L1.arg(moduleInfo.moduleName, qmlComponent.name));
+ if (!options.selectedJavaQmlComponents.isEmpty() && !isSelected)
+ continue;
+
+ QJsonObject domInfo = extractDomInfo(domBinaryPath, importPath, qmlComponent.path,
+ externalImports + appImports);
+ QJsonObject component = getComponent(domInfo);
+ if (component.isEmpty())
+ continue;
+
+ beginComponentBlock(outputStream, libName, moduleInfo.moduleName, moduleInfo.preferPath,
+ qmlComponent, indentBase);
+ indentBase += 4;
+
+ const QJsonArray properties = getProperties(component);
+ for (const QJsonValue &p : std::as_const(properties))
+ beginPropertyBlock(outputStream, p.toObject(), indentBase);
+
+ const QJsonArray methods = getMethods(component);
+ for (const QJsonValue &m : std::as_const(methods))
+ beginSignalBlock(outputStream, m.toObject(), indentBase);
+
+ indentBase -= 4;
+ endBlock(outputStream, indentBase);
+ generatedComponents++;
+ }
+ indentBase -= 4;
+ endBlock(outputStream, indentBase);
+ }
+ if (!leafEqualsLibname)
+ endBlock(outputStream, 0);
+
+ outputStream.flush();
+ outputStream.device()->close();
+ return generatedComponents;
+}
+
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
@@ -3383,6 +3856,16 @@ int main(int argc, char *argv[])
if (Q_UNLIKELY(options.timing))
fprintf(stdout, "[TIMING] %lld ns: Copied GNU STL\n", options.timer.nsecsElapsed());
+ if (options.generateJavaQmlComponents) {
+ if (!generateJavaQmlComponents(options))
+ return CannotGenerateJavaQmlComponents;
+ }
+
+ if (Q_UNLIKELY(options.timing)) {
+ fprintf(stdout, "[TIMING] %lld ns: Generate Java QtQmlComponents.\n",
+ options.timer.nsecsElapsed());
+ }
+
// If Unbundled deployment is used, remove app lib as we don't want it packaged inside the APK
if (options.deploymentMechanism == Options::Unbundled) {
QString appLibPath = "%1/libs/%2/lib%3_%2.so"_L1.
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
index bb51352519..89fb367ca7 100644
--- a/src/tools/moc/main.cpp
+++ b/src/tools/moc/main.cpp
@@ -19,7 +19,8 @@
#include <qcoreapplication.h>
#include <qcommandlineoption.h>
#include <qcommandlineparser.h>
-#include <qscopedpointer.h>
+
+#include <memory>
QT_BEGIN_NAMESPACE
@@ -58,10 +59,21 @@ void error(const char *msg = "Invalid argument")
fprintf(stderr, "moc: %s\n", msg);
}
-struct ScopedPointerFileCloser
+static auto openFileForWriting(const QString &name)
{
- static inline void cleanup(FILE *handle) { if (handle) fclose(handle); }
-};
+ struct Closer { void operator()(FILE *handle) const { fclose(handle); } };
+ using R = std::unique_ptr<FILE, Closer>;
+
+#ifdef _MSC_VER
+ FILE *file;
+ if (_wfopen_s(&file, reinterpret_cast<const wchar_t *>(name.utf16()), L"w") != 0)
+ return R{};
+ return R{file};
+#else
+ return R{fopen(QFile::encodeName(name).constData(), "w")};
+#endif
+}
+using File = decltype(openFileForWriting({}));
static inline bool hasNext(const Symbols &symbols, int i)
{ return (i < symbols.size()); }
@@ -178,7 +190,7 @@ int runMoc(int argc, char **argv)
QString filename;
QString output;
QFile in;
- FILE *out = nullptr;
+ File out;
// Note that moc isn't translated.
// If you use this code as an example for a translated app, make sure to translate the strings.
@@ -528,16 +540,12 @@ int runMoc(int argc, char **argv)
// 3. and output meta object code
- QScopedPointer<FILE, ScopedPointerFileCloser> jsonOutput;
+ File jsonOutput;
bool outputToFile = true;
if (output.size()) { // output file specified
-#if defined(_MSC_VER)
- if (_wfopen_s(&out, reinterpret_cast<const wchar_t *>(output.utf16()), L"w") != 0)
-#else
- out = fopen(QFile::encodeName(output).constData(), "w"); // create output file
+ out = openFileForWriting(output);
if (!out)
-#endif
{
const auto fopen_errno = errno;
fprintf(stderr, "moc: Cannot create %s. Error: %s\n",
@@ -548,37 +556,29 @@ int runMoc(int argc, char **argv)
if (parser.isSet(jsonOption)) {
const QString jsonOutputFileName = output + ".json"_L1;
- FILE *f;
-#if defined(_MSC_VER)
- if (_wfopen_s(&f, reinterpret_cast<const wchar_t *>(jsonOutputFileName.utf16()), L"w") != 0)
-#else
- f = fopen(QFile::encodeName(jsonOutputFileName).constData(), "w");
- if (!f)
-#endif
- {
+ jsonOutput = openFileForWriting(jsonOutputFileName);
+ if (!jsonOutput) {
const auto fopen_errno = errno;
fprintf(stderr, "moc: Cannot create JSON output file %s. Error: %s\n",
QFile::encodeName(jsonOutputFileName).constData(),
strerror(fopen_errno));
}
- jsonOutput.reset(f);
}
} else { // use stdout
- out = stdout;
+ out.reset(stdout);
outputToFile = false;
}
if (pp.preprocessOnly) {
- fprintf(out, "%s\n", composePreprocessorOutput(moc.symbols).constData());
+ fprintf(out.get(), "%s\n", composePreprocessorOutput(moc.symbols).constData());
} else {
if (moc.classList.isEmpty())
moc.note("No relevant classes found. No output generated.");
else
- moc.generate(out, jsonOutput.data());
+ moc.generate(out.get(), jsonOutput.get());
}
- if (output.size())
- fclose(out);
+ out.reset();
if (parser.isSet(depFileOption)) {
// 4. write a Make-style dependency file (can also be consumed by Ninja).
@@ -596,26 +596,17 @@ int runMoc(int argc, char **argv)
fprintf(stderr, "moc: Writing to stdout, but no depfile path specified.\n");
}
- QScopedPointer<FILE, ScopedPointerFileCloser> depFileHandle;
- FILE *depFileHandleRaw;
-#if defined(_MSC_VER)
- if (_wfopen_s(&depFileHandleRaw,
- reinterpret_cast<const wchar_t *>(depOutputFileName.utf16()), L"w") != 0)
-#else
- depFileHandleRaw = fopen(QFile::encodeName(depOutputFileName).constData(), "w");
- if (!depFileHandleRaw)
-#endif
- {
+ File depFileHandle = openFileForWriting(depOutputFileName);
+ if (!depFileHandle) {
const auto fopen_errno = errno;
fprintf(stderr, "moc: Cannot create dep output file '%s'. Error: %s\n",
QFile::encodeName(depOutputFileName).constData(),
strerror(fopen_errno));
}
- depFileHandle.reset(depFileHandleRaw);
- if (!depFileHandle.isNull()) {
+ if (depFileHandle) {
// First line is the path to the generated file.
- fprintf(depFileHandle.data(), "%s: ",
+ fprintf(depFileHandle.get(), "%s: ",
escapeAndEncodeDependencyPath(depRuleName).constData());
QByteArrayList dependencies;
@@ -647,7 +638,7 @@ int runMoc(int argc, char **argv)
// Join dependencies, output them, and output a final new line.
const auto dependenciesJoined = dependencies.join(QByteArrayLiteral(" \\\n "));
- fprintf(depFileHandle.data(), "%s\n", dependenciesJoined.constData());
+ fprintf(depFileHandle.get(), "%s\n", dependenciesJoined.constData());
}
}
diff --git a/src/tools/qlalr/cppgenerator.cpp b/src/tools/qlalr/cppgenerator.cpp
index fd56de106d..f12917f0eb 100644
--- a/src/tools/qlalr/cppgenerator.cpp
+++ b/src/tools/qlalr/cppgenerator.cpp
@@ -1,5 +1,7 @@
+// REUSE-IgnoreStart
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// REUSE-IgnoreEnd
#include "cppgenerator.h"
@@ -39,7 +41,7 @@ void generateList(const QList<int> &list, QTextStream &out)
}
}
-
+// REUSE-IgnoreStart
QString CppGenerator::copyrightHeader() const
{
return
@@ -47,6 +49,7 @@ QString CppGenerator::copyrightHeader() const
"// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0\n"
"\n"_L1;
}
+// REUSE-IgnoreEnd
QString CppGenerator::privateCopyrightHeader() const
{
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 2bda7f2977..a1089914fd 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -21,7 +21,7 @@
# include <zstd.h>
#endif
-// Note: A copy of this file is used in Qt Designer (qttools/src/designer/src/lib/shared/rcc.cpp)
+// Note: A copy of this file is used in Qt Widgets Designer (qttools/src/designer/src/lib/shared/rcc.cpp)
QT_BEGIN_NAMESPACE
@@ -512,6 +512,12 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
reader.raiseError("expected <RCC> tag"_L1);
else
tokens.push(RccTag);
+ } else if (reader.name() == m_strings.TAG_LEGAL) {
+ if (tokens.isEmpty() || tokens.top() != RccTag) {
+ reader.raiseError("unexpected <legal> tag"_L1);
+ } else {
+ m_legal = reader.readElementText().trimmed();
+ }
} else if (reader.name() == m_strings.TAG_RESOURCE) {
if (tokens.isEmpty() || tokens.top() != RccTag) {
reader.raiseError("unexpected <RESOURCE> tag"_L1);
@@ -1087,11 +1093,20 @@ void RCCResourceLibrary::writeNumber8(quint64 number)
bool RCCResourceLibrary::writeHeader()
{
+ auto writeCopyright = [this](QByteArrayView prefix) {
+ const QStringList lines = m_legal.split(u'\n', Qt::SkipEmptyParts);
+ for (const QString &line : lines) {
+ write(prefix.data(), prefix.size());
+ writeString(line.toUtf8().trimmed());
+ writeChar('\n');
+ }
+ };
switch (m_format) {
case C_Code:
case Pass1:
writeString("/****************************************************************************\n");
writeString("** Resource object code\n");
+ writeCopyright("** ");
writeString("**\n");
writeString("** Created by: The Resource Compiler for Qt version ");
writeByteArray(QT_VERSION_STR);
@@ -1105,6 +1120,7 @@ bool RCCResourceLibrary::writeHeader()
break;
case Python_Code:
writeString("# Resource object code (Python 3)\n");
+ writeCopyright("# ");
writeString("# Created by: object code\n");
writeString("# Created by: The Resource Compiler for Qt version ");
writeByteArray(QT_VERSION_STR);
diff --git a/src/tools/rcc/rcc.h b/src/tools/rcc/rcc.h
index 60af1c67cf..e2ae8c5240 100644
--- a/src/tools/rcc/rcc.h
+++ b/src/tools/rcc/rcc.h
@@ -2,7 +2,7 @@
// Copyright (C) 2018 Intel Corporation.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-// Note: A copy of this file is used in Qt Designer (qttools/src/designer/src/lib/shared/rcc_p.h)
+// Note: A copy of this file is used in Qt Widgets Designer (qttools/src/designer/src/lib/shared/rcc_p.h)
#ifndef RCC_H
#define RCC_H
@@ -93,6 +93,7 @@ private:
const QString TAG_RCC;
const QString TAG_RESOURCE;
const QString TAG_FILE;
+ const QString TAG_LEGAL = QLatin1StringView("legal");
const QString ATTRIBUTE_LANG;
const QString ATTRIBUTE_PREFIX;
const QString ATTRIBUTE_ALIAS;
@@ -134,6 +135,7 @@ private:
QString m_resourceRoot;
QString m_initName;
QString m_outputName;
+ QString m_legal;
Format m_format;
bool m_verbose;
CompressionAlgorithm m_compressionAlgo;
diff --git a/src/tools/syncqt/CMakeLists.txt b/src/tools/syncqt/CMakeLists.txt
index b3ab091aa4..b54dd72774 100644
--- a/src/tools/syncqt/CMakeLists.txt
+++ b/src/tools/syncqt/CMakeLists.txt
@@ -1,3 +1,5 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
if(NOT QT_INTERNAL_AVOID_OVERRIDING_SYNCQT_CONFIG)
qt_internal_get_configs_for_flag_manipulation(configs)
qt_internal_remove_known_optimization_flags(LANGUAGES CXX CONFIGS ${configs})
diff --git a/src/tools/syncqt/main.cpp b/src/tools/syncqt/main.cpp
index 5df7b03fd5..ab646e6cd1 100644
--- a/src/tools/syncqt/main.cpp
+++ b/src/tools/syncqt/main.cpp
@@ -1428,13 +1428,12 @@ public:
// - <class|stuct> StructName
// - template <> class ClassName
// - class ClassName : [public|protected|private] BaseClassName
- // - class ClassName [final|Q_DECL_FINAL|sealed]
+ // - class ClassName [QT_TEXT_STREAM_FINAL|Q_DECL_FINAL|final|sealed]
// And possible combinations of the above variants.
static const std::regex ClassRegex(
- "^ *(template *<.*> *)?(class|struct) +([^ <>]* "
- "+)?((?!Q_DECL_FINAL|final|sealed)[^<\\s\\:]+) ?(<[^>\\:]*> "
- "?)?\\s*(?:Q_DECL_FINAL|final|sealed)?\\s*((,|:)\\s*(public|protected|private)? "
- "*.*)? *$");
+ "^ *(template *<.*> *)?(class|struct +)([^<>:]*\\s+)?" // Preceding part
+ "((?!Q[A-Z_0-9]*_FINAL|final|sealed)Q[a-zA-Z0-9_]+)" // Actual symbol
+ "(\\s+Q[A-Z_0-9]*_FINAL|\\s+final|\\s+sealed)?\\s*(:|$).*"); // Trailing part
// This regex checks if line contains function pointer typedef declaration like:
// - typedef void (* QFunctionPointerType)(int, char);
@@ -1445,10 +1444,6 @@ public:
// - typedef AnySymbol<char> QAnySymbolType;
static const std::regex TypedefRegex("^ *typedef\\s+(.*)\\s+(Q\\w+); *$");
- // This regex checks if symbols is the Qt public symbol. Assume that Qt public symbols start
- // with the capital 'Q'.
- static const std::regex QtClassRegex("^Q\\w+$");
-
std::smatch match;
if (std::regex_match(line, match, FunctionPointerRegex)) {
symbol = match[1].str();
@@ -1456,8 +1451,6 @@ public:
symbol = match[2].str();
} else if (std::regex_match(line, match, ClassRegex)) {
symbol = match[4].str();
- if (!std::regex_match(symbol, QtClassRegex))
- symbol.clear();
} else {
return false;
}
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 205d6a50a9..c9356a4111 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -2155,7 +2155,7 @@ QString WriteInitialization::pixCall(const DomProperty *p) const
s = p->elementPixmap()->text();
break;
default:
- qWarning("%s: Warning: Unknown icon format encountered. The ui-file was generated with a too-recent version of Designer.",
+ qWarning("%s: Warning: Unknown icon format encountered. The ui-file was generated with a too-recent version of Qt Widgets Designer.",
qPrintable(m_option.messagePrefix()));
return "QIcon()"_L1;
break;
diff --git a/src/tools/uic/ui4.cpp b/src/tools/uic/ui4.cpp
index d65fc4a8c3..b6a8f4eb4b 100644
--- a/src/tools/uic/ui4.cpp
+++ b/src/tools/uic/ui4.cpp
@@ -77,7 +77,8 @@ void DomUI::read(QXmlStreamReader &reader)
setElementAuthor(reader.readElementText());
continue;
}
- if (!tag.compare(u"comment"_s, Qt::CaseInsensitive)) {
+ if (!tag.compare(u"comment"_s, Qt::CaseInsensitive)
+ || !tag.compare(u"legal"_s, Qt::CaseInsensitive)) {
setElementComment(reader.readElementText());
continue;
}
diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp
index fb0a37d21d..1b10e1d722 100644
--- a/src/tools/uic/uic.cpp
+++ b/src/tools/uic/uic.cpp
@@ -165,7 +165,7 @@ DomUI *Uic::parseUiFile(QXmlStreamReader &reader)
&& !ui) {
const double version = versionFromUiAttribute(reader);
if (version < 4.0) {
- const QString msg = QString::fromLatin1("uic: File generated with too old version of Qt Designer (%1)").arg(version);
+ const QString msg = QString::fromLatin1("uic: File generated with too old version of Qt Widgets Designer (%1)").arg(version);
fprintf(stderr, "%s\n", qPrintable(msg));
return nullptr;
}
@@ -202,7 +202,7 @@ bool Uic::write(QIODevice *in)
double version = ui->attributeVersion().toDouble();
if (version < 4.0) {
- fprintf(stderr, "uic: File generated with too old version of Qt Designer\n");
+ fprintf(stderr, "uic: File generated with too old version of Qt Widgets Designer\n");
return false;
}
diff --git a/src/tools/windeployqt/main.cpp b/src/tools/windeployqt/main.cpp
index 084345a4d8..dca9132e15 100644
--- a/src/tools/windeployqt/main.cpp
+++ b/src/tools/windeployqt/main.cpp
@@ -139,8 +139,10 @@ static Platform platformFromMkSpec(const QString &xSpec)
return WindowsDesktopClangMsvc;
if (xSpec.contains("arm"_L1))
return WindowsDesktopMsvcArm;
+ if (xSpec.contains("G++"_L1))
+ return WindowsDesktopMinGW;
- return xSpec.contains("g++"_L1) ? WindowsDesktopMinGW : WindowsDesktopMsvcIntel;
+ return WindowsDesktopMsvc;
}
return UnknownPlatform;
}
@@ -1928,6 +1930,24 @@ int main(int argc, char **argv)
}
options.platform = platformFromMkSpec(xSpec);
+ // We are on MSVC and not crosscompiling. We need the host arch
+ if (options.platform == WindowsDesktopMsvc) {
+ SYSTEM_INFO si;
+ GetSystemInfo(&si);
+ switch (si.wProcessorArchitecture) {
+ case PROCESSOR_ARCHITECTURE_INTEL:
+ case PROCESSOR_ARCHITECTURE_IA64:
+ case PROCESSOR_ARCHITECTURE_AMD64:
+ options.platform |= IntelBased;
+ break;
+ case PROCESSOR_ARCHITECTURE_ARM:
+ case PROCESSOR_ARCHITECTURE_ARM64:
+ options.platform |= ArmBased;
+ break;
+ default:
+ options.platform = UnknownPlatform;
+ }
+ }
if (options.platform == UnknownPlatform) {
std::wcerr << "Unsupported platform " << xSpec << '\n';
return 1;
diff --git a/src/widgets/Qt6WidgetsMacros.cmake b/src/widgets/Qt6WidgetsMacros.cmake
index b15d1fe81d..a7ff7af2f3 100644
--- a/src/widgets/Qt6WidgetsMacros.cmake
+++ b/src/widgets/Qt6WidgetsMacros.cmake
@@ -49,3 +49,293 @@ if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
set("${outfiles}" "${${outfiles}}" PARENT_SCOPE)
endfunction()
endif()
+
+function(qt6_add_ui target)
+ if(NOT TARGET ${target})
+ message(FATAL_ERROR "Target \"${target}\" does not exist.")
+ endif()
+
+ set(options)
+ set(oneValueArgs INCLUDE_PREFIX)
+ set(multiValueArgs SOURCES OPTIONS)
+
+ cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}"
+ ${ARGN})
+
+ set(sources ${arg_SOURCES})
+ set(ui_options ${arg_OPTIONS})
+ set(raw_include_prefix "${arg_INCLUDE_PREFIX}")
+
+ if("${sources}" STREQUAL "")
+ message(FATAL_ERROR "The \"SOURCES\" parameter is empty.")
+ endif()
+
+
+ # Disable AUTOUIC for the target explicitly to avoid the AUTOUIC
+ # error message when the AUTOUIC is enabled for the target.
+ set_target_properties(${target} PROPERTIES AUTOUIC OFF)
+
+ if(NOT "${raw_include_prefix}" STREQUAL "")
+ # generate dummy `_` folders from the given path
+ # e.g. if the given path is `../a/b/c`, then the generated path will be
+ # `_`. if the given path is ``../a/../b/c`, then the generated path will
+ # be `_/_`
+ function(_qt_internal_generate_dash_path_from_input input_path
+ out_generated_dash_path)
+ string(REGEX MATCHALL "\\.\\." upper_folder_list "${input_path}")
+
+ list(JOIN upper_folder_list "" upper_folder_list)
+ string(REGEX REPLACE "\\.\\." "_/" additional_path
+ "${upper_folder_list}")
+
+ # remove last / character
+ if(NOT "${additional_path}" STREQUAL "")
+ string(LENGTH "${additional_path}" additional_path_length)
+ math(EXPR additional_path_length "${additional_path_length} - 1")
+ string(SUBSTRING "${additional_path}" 0 ${additional_path_length}
+ additional_path)
+ endif()
+
+ set(${out_generated_dash_path} "${additional_path}" PARENT_SCOPE)
+ endfunction()
+ # NOTE: If previous folders are less than ../ folder count in
+ # ${raw_include_prefix}, relative path calculation will miscalculate,
+ # so we need to add dummy folders to calculate the relative path
+ # correctly
+ _qt_internal_generate_dash_path_from_input("${raw_include_prefix}"
+ dummy_path_for_relative_calculation)
+ if(NOT "${dummy_path_for_relative_calculation}" STREQUAL "")
+ set(dummy_path_for_relative_calculation
+ "/${dummy_path_for_relative_calculation}")
+ set(raw_include_prefix_to_compare
+ "${dummy_path_for_relative_calculation}/${raw_include_prefix}")
+ else()
+ set(dummy_path_for_relative_calculation "/")
+ set(raw_include_prefix_to_compare "/${raw_include_prefix}")
+ endif()
+ # NOTE: This relative path calculation could be done just by using the
+ # below code
+ # cmake_path(RELATIVE_PATH normalized_include_prefix "${CMAKE_CURRENT_SOURCE_DIR}"
+ # but due to the backward compatibility, we need to use
+ # file(RELATIVE_PATH) and ../ folder calculation the with
+ # _qt_internal_generate_dash_path_from_input() function
+ if(WIN32)
+ set(dummy_path_for_relative_calculation
+ "${CMAKE_CURRENT_SOURCE_DIR}/${dummy_path_for_relative_calculation}")
+ set(raw_include_prefix_to_compare
+ "${CMAKE_CURRENT_SOURCE_DIR}/${raw_include_prefix_to_compare}")
+ string(REGEX REPLACE "//" "/" dummy_path_for_relative_calculation
+ "${dummy_path_for_relative_calculation}")
+ string(REGEX REPLACE "//" "/" raw_include_prefix_to_compare
+ "${raw_include_prefix_to_compare}")
+ endif()
+
+ file(RELATIVE_PATH normalized_include_prefix
+ "${dummy_path_for_relative_calculation}"
+ "${raw_include_prefix_to_compare}")
+
+ # if normalized_include_prefix ends with `/` remove it
+ string(REGEX REPLACE "/$" "" normalized_include_prefix
+ "${normalized_include_prefix}")
+
+ _qt_internal_generate_dash_path_from_input("${normalized_include_prefix}"
+ additional_path)
+ endif()
+
+ if(ui_options MATCHES "\\$<CONFIG")
+ set(is_ui_options_contains_config true)
+ endif()
+ get_property(is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(is_multi AND is_ui_options_contains_config)
+ set(include_folder "$<CONFIG>")
+ endif()
+
+ set(include_folder_to_add "${include_folder}")
+ if(NOT "${additional_path}" STREQUAL "")
+ set(include_folder_to_add "${include_folder_to_add}/${additional_path}")
+ endif()
+
+ set(prefix_info_file_cmake
+ "${CMAKE_CURRENT_BINARY_DIR}/${target}_autogen/prefix_info.cmake")
+ if(EXISTS ${prefix_info_file_cmake})
+ include(${prefix_info_file_cmake})
+ set(prefix_info_file_cmake_exists true)
+ else()
+ set(prefix_info_file_cmake_exists false)
+ endif()
+
+ foreach(source_file ${sources})
+ get_filename_component(outfile "${source_file}" NAME_WE)
+ get_filename_component(infile "${source_file}" ABSOLUTE)
+ string(SHA1 infile_hash "${target}${infile}")
+ string(SUBSTRING "${infile_hash}" 0 6 short_hash)
+ set(file_ui_folder "${CMAKE_CURRENT_BINARY_DIR}/.qt/${short_hash}")
+ target_include_directories(${target} SYSTEM PRIVATE
+ "${file_ui_folder}/${include_folder_to_add}")
+
+ set(target_include_folder_with_add_path
+ "${file_ui_folder}/${include_folder}")
+ # Add additional path to include folder if it is not empty
+ if(NOT "${additional_path}" STREQUAL "")
+ set(target_include_folder_with_add_path
+ "${target_include_folder_with_add_path}/${additional_path}")
+ endif()
+
+ set(inc_dir_to_create "${target_include_folder_with_add_path}")
+ if(NOT "${raw_include_prefix}" STREQUAL "")
+ set(inc_dir_to_create
+ "${target_include_folder_with_add_path}/${raw_include_prefix}")
+ endif()
+
+ set(output_directory "${target_include_folder_with_add_path}")
+ if(NOT "${normalized_include_prefix}" STREQUAL "")
+ set(output_directory
+ "${output_directory}/${normalized_include_prefix}")
+ endif()
+
+ if(NOT EXISTS "${infile}")
+ message(FATAL_ERROR "${infile} does not exist.")
+ endif()
+ set_source_files_properties(${infile} PROPERTIES SKIP_AUTOUIC ON)
+
+ macro(_qt_internal_set_output_file_properties file)
+ set_source_files_properties(${file} PROPERTIES
+ SKIP_AUTOMOC TRUE
+ SKIP_AUTOUIC TRUE
+ SKIP_LINTING TRUE)
+ endmacro()
+
+ set(outfile "${output_directory}/ui_${outfile}.h")
+ # Before CMake 3.27, there is a bug for using $<CONFIG> in a generated
+ # file with Ninja Multi-Config generator. To avoid this issue, we need
+ # to add the generated file for each configuration.
+ # Explicitly set the output file properties for each configuration
+ # to avoid Policy CMP0071 warnings.
+ # See https://gitlab.kitware.com/cmake/cmake/-/issues/24848
+ # Xcode generator cannot handle $<CONFIG> in the output file name.
+ # it changes $<CONFIG> with NOCONFIG. That's why we need to add the
+ # generated file for each configuration for Xcode generator as well.
+ if(is_multi AND outfile MATCHES "\\$<CONFIG>"
+ AND CMAKE_VERSION VERSION_LESS "3.27"
+ OR CMAKE_GENERATOR MATCHES "Xcode")
+ foreach(config ${CMAKE_CONFIGURATION_TYPES})
+ string(REPLACE "$<CONFIG>" "${config}" outfile_with_config
+ "${outfile}")
+ _qt_internal_set_output_file_properties(
+ ${outfile_with_config})
+ target_sources(${target} PRIVATE ${outfile_with_config})
+ endforeach()
+ else()
+ _qt_internal_set_output_file_properties(${outfile})
+ target_sources(${target} PRIVATE ${outfile})
+ endif()
+ # remove double slashes
+ string(REGEX REPLACE "//" "/" outfile "${outfile}")
+
+ # Note: If INCLUDE_PREFIX is changed without changing the corresponding
+ # include path in the source file and Ninja generator is used, this
+ # casues the double build issue. To avoid this issue, we need to
+ # remove the output file in configure step if the include_prefix is
+ # changed.
+ if(CMAKE_GENERATOR MATCHES "Ninja")
+ if(prefix_info_file_cmake_exists)
+ if(NOT "${${short_hash}_prefix}" STREQUAL
+ "${normalized_include_prefix}")
+ file(REMOVE_RECURSE "${file_ui_folder}")
+ list(APPEND prefix_info_list
+ "set(${short_hash}_prefix \"${normalized_include_prefix}\")")
+ elseif(NOT DEFINED ${short_hash}_prefix)
+ list(APPEND prefix_info_list
+ "set(${short_hash}_prefix \"${normalized_include_prefix}\")")
+ endif()
+ else()
+ set(prefix_info_list "")
+ list(APPEND prefix_info_list
+ "set(${short_hash}_prefix \"${normalized_include_prefix}\")")
+ endif()
+ file(MAKE_DIRECTORY ${file_ui_folder})
+ endif()
+
+ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.17")
+ set(remove_command rm -rf)
+ else()
+ set(remove_command "remove_directory")
+ endif()
+
+ add_custom_command(OUTPUT ${outfile}
+ DEPENDS ${QT_CMAKE_EXPORT_NAMESPACE}::uic
+ COMMAND ${CMAKE_COMMAND} -E ${remove_command} "${file_ui_folder}/${include_folder}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${inc_dir_to_create}
+ COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::uic ${ui_options} -o
+ ${outfile} ${infile}
+ COMMAND_EXPAND_LISTS
+ MAIN_DEPENDENCY ${infile} VERBATIM)
+ endforeach()
+
+
+ get_target_property(is_guard_on ${target} _qt_ui_property_check_guard)
+ if(NOT is_guard_on)
+ # Ninja fails when a newline is used. That's why message is
+ # divided into parts.
+ set(error_message_1
+ "Error: The target \"${target}\" has \"AUTOUIC\" enabled.")
+ set(error_message_2
+ "Error: Please disable \"AUTOUIC\" for the target \"${target}\".")
+
+ set(ui_property_check_dummy_file
+ "${CMAKE_CURRENT_BINARY_DIR}/${target}_autogen/ui_property_check_timestamp")
+
+ add_custom_command(OUTPUT ${ui_property_check_dummy_file}
+ COMMAND ${CMAKE_COMMAND} -E make_directory
+ "${CMAKE_CURRENT_BINARY_DIR}/${target}_autogen"
+ COMMAND ${CMAKE_COMMAND} -E touch ${ui_property_check_dummy_file}
+ COMMAND
+ "$<$<BOOL:$<TARGET_PROPERTY:${target},AUTOUIC>>:${CMAKE_COMMAND}\
+;-E;echo;${error_message_1}>"
+ COMMAND
+ "$<$<BOOL:$<TARGET_PROPERTY:${target},AUTOUIC>>:${CMAKE_COMMAND}\
+;-E;echo;${error_message_2}>"
+ # Remove the dummy file so that the error message is shown until
+ # the AUTOUIC is disabled. Otherwise, the error message is shown
+ # only once when the AUTOUIC is enabled with Visual Studio generator.
+ COMMAND
+ "$<$<BOOL:$<TARGET_PROPERTY:${target},AUTOUIC>>:${CMAKE_COMMAND}\
+;-E;remove;${ui_property_check_dummy_file}>"
+ COMMAND
+ "$<$<BOOL:$<TARGET_PROPERTY:${target},AUTOUIC>>:${CMAKE_COMMAND}\
+;-E;false>"
+ COMMAND_EXPAND_LISTS
+ VERBATIM)
+
+ # When AUTOUIC is enabled, AUTOUIC runs before ${target}_ui_property_check
+ # target. So we need to add ${target}_ui_property_check as a dependency
+ # to ${target} to make sure that AUTOUIC runs after ${target}_ui_property_check
+ if (NOT QT_NO_MIX_UI_AUTOUIC_CHECK)
+ set_target_properties(${target} PROPERTIES
+ _qt_ui_property_check_guard ON)
+ add_custom_target(${target}_ui_property_check
+ ALL DEPENDS ${ui_property_check_dummy_file})
+ _qt_internal_assign_to_internal_targets_folder(
+ ${target}_ui_property_check)
+ add_dependencies(${target} ${target}_ui_property_check)
+ endif()
+ endif()
+
+ # write prefix info file
+ if(CMAKE_GENERATOR MATCHES "Ninja")
+ list(PREPEND prefix_info_list "include_guard()")
+ string(REPLACE ";" "\n" prefix_info_list "${prefix_info_list}")
+ file(WRITE "${prefix_info_file_cmake}" "${prefix_info_list}")
+ endif()
+endfunction()
+
+if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
+ function(qt_add_ui)
+ if(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
+ qt6_add_ui(${ARGN})
+ else()
+ message(FATAL_ERROR "qt_add_ui() is only available in Qt 6.")
+ endif()
+ endfunction()
+endif()
+
diff --git a/src/widgets/doc/snippets/cmake-macros/examples.cmake b/src/widgets/doc/snippets/cmake-macros/examples.cmake
index 3c58509fdf..7d0023aed4 100644
--- a/src/widgets/doc/snippets/cmake-macros/examples.cmake
+++ b/src/widgets/doc/snippets/cmake-macros/examples.cmake
@@ -6,3 +6,30 @@ set(SOURCES mainwindow.cpp main.cpp)
qt_wrap_ui(SOURCES mainwindow.ui)
qt_add_executable(myapp ${SOURCES})
#! [qt_wrap_ui]
+
+#! [qt6_add_ui_1]
+qt_add_executable(myapp mainwindow.cpp main.cpp)
+qt6_add_ui(myapp SOURCES mainwindow.ui)
+#! [qt6_add_ui_1]
+
+#! [qt6_add_ui_2]
+qt_add_executable(myapp mainwindow.cpp main.cpp)
+qt6_add_ui(myapp INCLUDE_PREFIX "src/files" SOURCES mainwindow.ui)
+#! [qt6_add_ui_2]
+
+#! [qt6_add_ui_3]
+qt_add_executable(myapp widget1.cpp widget2.cpp main.cpp)
+qt6_add_ui(myapp INCLUDE_PREFIX "src/files" SOURCES widget1.ui widget2.ui)
+#! [qt6_add_ui_3]
+
+#! [qt6_add_ui_4]
+qt_add_executable(myapp widget1.cpp widget2.cpp main.cpp)
+qt6_add_ui(myapp INCLUDE_PREFIX "src/files"
+ SOURCES "my_ui_files_1/widget1.ui" "my_ui_files_2/widget2.ui")
+#! [qt6_add_ui_4]
+
+#! [qt6_add_ui_5]
+qt_add_executable(myapp widget1.cpp widget2.cpp main.cpp)
+qt6_add_ui(myapp INCLUDE_PREFIX "src/files_1" SOURCES "my_ui_files/widget1.ui")
+qt6_add_ui(myapp INCLUDE_PREFIX "src/files_2" SOURCES "my_ui_files/widget2.ui")
+#! [qt6_add_ui_5]
diff --git a/src/widgets/doc/snippets/cmake-macros/examples.cpp b/src/widgets/doc/snippets/cmake-macros/examples.cpp
new file mode 100644
index 0000000000..683f8453e4
--- /dev/null
+++ b/src/widgets/doc/snippets/cmake-macros/examples.cpp
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+
+//! [qt6_add_ui_1]
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+//! [qt6_add_ui_1]
+
+//! [qt6_add_ui_2]
+#include "mainwindow.h"
+#include "src/files/ui_mainwindow.h"
+//! [qt6_add_ui_2]
+
+//! [qt6_add_ui_3_1]
+#include "src/files/ui_widget1.h"
+//! [qt6_add_ui_3_1]
+
+//! [qt6_add_ui_3_2]
+#include "src/files/ui_widget2.h"
+//! [qt6_add_ui_3_2]
+
+//! [qt6_add_ui_5]
+#include "src/files_1/ui_widget1.h"
+#include "src/files_2/ui_widget2.h"
+//! [qt6_add_ui_5]
diff --git a/src/widgets/doc/src/cmake-macros.qdoc b/src/widgets/doc/src/cmake-macros.qdoc
index 13bdcca67b..906a18b2b0 100644
--- a/src/widgets/doc/src/cmake-macros.qdoc
+++ b/src/widgets/doc/src/cmake-macros.qdoc
@@ -30,6 +30,10 @@ directory. The paths of the generated header files are added to \c{<VAR>}.
\note This is a low-level macro. See the \l{CMake AUTOUIC Documentation} for a
more convenient way to process \c{.ui} files with \c{uic}.
+Since 6.8:
+\note \l{qt6_add_ui}{qt_add_ui} is the recommended way to process \c{.ui}
+files.
+
\section1 Options
You can set additional \c{OPTIONS} that should be added to the \c{uic} calls.
@@ -39,3 +43,132 @@ You can find possible options in the \l{uic}{uic documentation}.
\snippet cmake-macros/examples.cmake qt_wrap_ui
*/
+
+/*!
+\page qt-add-ui.html
+\ingroup cmake-macros-qtwidgets
+
+\title qt_add_ui
+\keyword qt6_add_ui
+
+\summary {Adds .ui files to a target.}
+
+\include cmake-find-package-widgets.qdocinc
+
+\section1 Synopsis
+
+\badcode
+qt_add_ui(<TARGET>
+ SOURCES file1.ui [file2.ui ...]
+ [INCLUDE_PREFIX <PREFIX>]
+ [OPTIONS ...])
+\endcode
+
+\versionlessCMakeCommandsNote qt6_add_ui()
+
+\cmakecommandsince 6.8
+
+\section1 Description
+
+Creates rules for calling the \l{uic}{User Interface Compiler (uic)} on the
+\c{.ui} files. For each input file, a header file is generated in the build
+directory. The generated header files are added to sources of the target.
+
+\section1 Arguments
+
+\section2 TARGET
+
+The \c{TARGET} argument specifies the CMake target to which the generated header
+files will be added.
+
+\section2 SOURCES
+
+The \c{SOURCES} argument specifies the list of \c{.ui} files to process.
+
+\section2 INCLUDE_PREFIX
+
+\c INCLUDE_PREFIX specifies the include prefix for the generated header files.
+Use the same include prefix as in the \c{#include} directive in the source
+files. If \c{ui_<basename>.h} is included without a prefix, then this argument
+can be omitted.
+
+\section2 OPTIONS
+
+You can set additional \c{OPTIONS} that should be added to the \c{uic} calls.
+You can find possible options in the \l{uic}{uic documentation}.
+
+\section1 Examples
+
+\section2 Without INCLUDE_PREFIX
+
+In the following snippet, the \c{mainwindow.cpp} file includes
+\c{ui_mainwindow.h} and \c{mainwindow.h}.
+
+\snippet cmake-macros/examples.cpp qt6_add_ui_1
+
+\c{CMakeLists.txt} is implemented as follows and it calls
+\l{qt6_add_ui}{qt_add_ui} to add \c{ui_mainwindow.h} to the \c{myapp} target.
+
+\snippet cmake-macros/examples.cmake qt6_add_ui_1
+
+In the above example, \c{ui_mainwindow.h} is included without a prefix. So the
+\c{INCLUDE_PREFIX} argument is not specified.
+
+\section2 With INCLUDE_PREFIX
+
+\snippet cmake-macros/examples.cpp qt6_add_ui_2
+
+In the above snippet, \c{mainwindow.cpp} includes \c{ui_mainwindow.h} with a
+prefix.
+
+\snippet cmake-macros/examples.cmake qt6_add_ui_2
+
+Since \c{ui_mainwindow.h} is included with a prefix, the \c{INCLUDE_PREFIX}
+argument is specified as \c{src/files} in the above example.
+
+\section2 Multiple .ui files
+
+In the following snippets, both \c{widget1.cpp} and \c{widget2.cpp} include
+\c{ui_widget1.h} and \c{ui_widget2.h} respectively.
+
+\c{widget1.cpp}:
+
+\snippet cmake-macros/examples.cpp qt6_add_ui_3_1
+
+\c{widget2.cpp}:
+
+\snippet cmake-macros/examples.cpp qt6_add_ui_3_2
+
+Both \c{ui_widget1.h} and \c{ui_widget2.h} are included with the same prefix
+
+\snippet cmake-macros/examples.cmake qt6_add_ui_3
+
+In this case, the \c{INCLUDE_PREFIX} argument can be specified as \c{src/files}
+for both files in the above snippet.
+
+\section1 When to prefer \l{qt6_add_ui}{qt_add_ui} over \c{AUTOUIC}?
+
+\l{qt6_add_ui}{qt_add_ui} has some advantages over \c{AUTOUIC}:
+
+\list
+\li \l{qt6_add_ui}{qt_add_ui} ensures that the \c{.ui} files are generated
+correctly during the first build, for the \c{Ninja} and \c{Ninja Multi-Config}
+generators.
+
+\li \l{qt6_add_ui}{qt_add_ui} guarantees that the generated \c{.h} files are
+not leaked outside the build directory.
+
+\li Since \l{qt6_add_ui}{qt_add_ui} does not scan source files, it provides a
+faster build than \c{AUTOUIC}.
+
+\endlist
+
+\section1 When to prefer \l{qt6_add_ui}{qt_add_ui} over \c{qt_wrap_ui}?
+
+\l{qt6_add_ui}{qt_add_ui} has the \c{INCLUDE_PREFIX} argument, which can be used to
+specify the include prefix for the generated header files.
+
+\note It is not recommended to use both \l{qt6_add_ui}{qt_add_ui} and
+\c{AUTOUIC} for the same target.
+
+*/
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 744f29ca17..1ae81023c5 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1412,13 +1412,48 @@ QRect QTreeViewPrivate::intersectedRect(const QRect rect, const QModelIndex &top
const auto parentIdx = topLeft.parent();
executePostedLayout();
QRect updateRect;
- for (int r = topLeft.row(); r <= bottomRight.row(); ++r) {
- if (isRowHidden(model->index(r, 0, parentIdx)))
+ int left = std::numeric_limits<int>::max();
+ int right = std::numeric_limits<int>::min();
+ for (int row = topLeft.row(); row <= bottomRight.row(); ++row) {
+ const auto idxCol0 = model->index(row, 0, parentIdx);
+ if (isRowHidden(idxCol0))
continue;
- for (int c = topLeft.column(); c <= bottomRight.column(); ++c) {
- const QModelIndex idx(model->index(r, c, parentIdx));
- updateRect |= visualRect(idx, SingleSection);
+ QRect rowRect;
+ if (left != std::numeric_limits<int>::max()) {
+ // we already know left and right boundary of the rect to update
+ rowRect = visualRect(idxCol0, FullRow);
+ if (!rowRect.intersects(rect))
+ continue;
+ rowRect = QRect(left, rowRect.top(), right, rowRect.bottom());
+ } else if (!spanningIndexes.isEmpty() && spanningIndexes.contains(idxCol0)) {
+ // isFirstColumnSpanned re-creates the child index so take a shortcut here
+ // spans the whole row, therefore ask for FullRow instead for every cell
+ rowRect = visualRect(idxCol0, FullRow);
+ if (!rowRect.intersects(rect))
+ continue;
+ } else {
+ for (int col = topLeft.column(); col <= bottomRight.column(); ++col) {
+ if (header->isSectionHidden(col))
+ continue;
+ const QModelIndex idx(model->index(row, col, parentIdx));
+ const QRect idxRect = visualRect(idx, SingleSection);
+ if (idxRect.isNull())
+ continue;
+ // early exit when complete row is out of viewport
+ if (idxRect.top() > rect.bottom() && idxRect.bottom() < rect.top())
+ break;
+ if (!idxRect.intersects(rect))
+ continue;
+ rowRect = rowRect.united(idxRect);
+ if (rowRect.left() < rect.left() && rowRect.right() > rect.right())
+ break;
+ }
+ left = std::min(left, rowRect.left());
+ right = std::max(right, rowRect.right());
}
+ updateRect = updateRect.united(rowRect);
+ if (updateRect.contains(rect)) // already full rect covered?
+ break;
}
return rect.intersected(updateRect);
}
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index de7d93ce20..bf6b41cbcd 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -98,6 +98,8 @@ static void initResources()
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcWidgetPopup, "qt.widgets.popup");
+
using namespace Qt::StringLiterals;
Q_TRACE_PREFIX(qtwidgets,
@@ -352,8 +354,6 @@ Q_GLOBAL_STATIC(FontHash, app_fonts)
// Exported accessor for use outside of this file
FontHash *qt_app_fonts_hash() { return app_fonts(); }
-QWidgetList *QApplicationPrivate::popupWidgets = nullptr; // has keyboard input focus
-
QWidget *qt_desktopWidget = nullptr; // root window widgets
/*!
@@ -627,8 +627,8 @@ void QApplicationPrivate::initializeWidgetFontHash()
QWidget *QApplication::activePopupWidget()
{
- return QApplicationPrivate::popupWidgets && !QApplicationPrivate::popupWidgets->isEmpty() ?
- QApplicationPrivate::popupWidgets->constLast() : nullptr;
+ auto *win = qobject_cast<QWidgetWindow *>(QGuiApplicationPrivate::activePopupWindow());
+ return win ? win->widget() : nullptr;
}
@@ -1094,6 +1094,12 @@ QPalette QApplicationPrivate::basePalette() const
if (const QPalette *themePalette = platformTheme() ? platformTheme()->palette() : nullptr)
palette = themePalette->resolve(palette);
+ // This palette now is Qt-generated, so reset the resolve mask. This allows
+ // QStyle::polish implementations to respect palettes that are user provided,
+ // by checking if the palette has a brush set for a color that the style might
+ // otherwise overwrite.
+ palette.setResolveMask(0);
+
// Finish off by letting the application style polish the palette. This will
// not result in the polished palette becoming a user-set palette, as the
// resulting base palette is only used as a fallback, with the resolve mask
@@ -1869,7 +1875,7 @@ void QApplicationPrivate::setActiveWindow(QWidget* act)
QApplication::sendSpontaneousEvent(w, &activationChange);
}
- if (QApplicationPrivate::popupWidgets == nullptr) { // !inPopupMode()
+ if (!inPopupMode()) {
// then focus events
if (!QApplicationPrivate::active_window && QApplicationPrivate::focus_widget) {
QApplicationPrivate::setFocusWidget(nullptr, Qt::ActiveWindowFocusReason);
@@ -3293,11 +3299,12 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
bool QApplicationPrivate::inPopupMode()
{
- return QApplicationPrivate::popupWidgets != nullptr;
+ return QGuiApplicationPrivate::activePopupWindow() != nullptr;
}
static void ungrabKeyboardForPopup(QWidget *popup)
{
+ qCDebug(lcWidgetPopup) << "ungrab keyboard for" << popup;
if (QWidget::keyboardGrabber())
qt_widget_private(QWidget::keyboardGrabber())->stealKeyboardGrab(true);
else
@@ -3306,6 +3313,7 @@ static void ungrabKeyboardForPopup(QWidget *popup)
static void ungrabMouseForPopup(QWidget *popup)
{
+ qCDebug(lcWidgetPopup) << "ungrab mouse for" << popup;
if (QWidget::mouseGrabber())
qt_widget_private(QWidget::mouseGrabber())->stealMouseGrab(true);
else
@@ -3325,54 +3333,23 @@ static void grabForPopup(QWidget *popup)
ungrabKeyboardForPopup(popup);
}
}
-}
-
-extern QWidget *qt_popup_down;
-extern bool qt_replay_popup_mouse_event;
-extern bool qt_popup_down_closed;
-
-bool QApplicationPrivate::closeAllPopups()
-{
- // Close all popups: In case some popup refuses to close,
- // we give up after 1024 attempts (to avoid an infinite loop).
- int maxiter = 1024;
- QWidget *popup;
- while ((popup = QApplication::activePopupWidget()) && maxiter--)
- popup->close(); // this will call QApplicationPrivate::closePopup
- return true;
+ qCDebug(lcWidgetPopup) << "grabbed mouse and keyboard?" << popupGrabOk << "for popup" << popup;
}
void QApplicationPrivate::closePopup(QWidget *popup)
{
- if (!popupWidgets)
+ QWindow *win = popup->windowHandle();
+ if (!win)
+ return;
+ if (!QGuiApplicationPrivate::closePopup(win))
return;
- popupWidgets->removeAll(popup);
-
- if (popup == qt_popup_down) {
- qt_button_down = nullptr;
- qt_popup_down_closed = true;
- qt_popup_down = nullptr;
- }
- if (QApplicationPrivate::popupWidgets->size() == 0) { // this was the last popup
- delete QApplicationPrivate::popupWidgets;
- QApplicationPrivate::popupWidgets = nullptr;
- qt_popup_down_closed = false;
+ const QWindow *nextRemainingPopup = QGuiApplicationPrivate::activePopupWindow();
+ if (!nextRemainingPopup) { // this was the last popup
if (popupGrabOk) {
popupGrabOk = false;
- // TODO on multi-seat window systems, we have to know which mouse
- auto devPriv = QPointingDevicePrivate::get(QPointingDevice::primaryPointingDevice());
- auto mousePressPos = devPriv->pointById(0)->eventPoint.globalPressPosition();
- if (popup->geometry().contains(mousePressPos.toPoint())
- || popup->testAttribute(Qt::WA_NoMouseReplay)) {
- // mouse release event or inside
- qt_replay_popup_mouse_event = false;
- } else { // mouse press event
- qt_replay_popup_mouse_event = true;
- }
-
// transfer grab back to mouse grabber if any, otherwise release the grab
ungrabMouseForPopup(popup);
@@ -3391,30 +3368,23 @@ void QApplicationPrivate::closePopup(QWidget *popup)
}
}
- } else {
+ } else if (const auto *popupWin = qobject_cast<const QWidgetWindow *>(nextRemainingPopup)) {
// A popup was closed, so the previous popup gets the focus.
- QWidget* aw = QApplicationPrivate::popupWidgets->constLast();
- if (QWidget *fw = aw->focusWidget())
+ if (QWidget *fw = popupWin->widget()->focusWidget())
fw->setFocus(Qt::PopupFocusReason);
// can become nullptr due to setFocus() above
- if (QApplicationPrivate::popupWidgets &&
- QApplicationPrivate::popupWidgets->size() == 1) // grab mouse/keyboard
- grabForPopup(aw);
+ if (QGuiApplicationPrivate::popupCount() == 1) // grab mouse/keyboard
+ grabForPopup(popupWin->widget());
}
}
-int openPopupCount = 0;
-
void QApplicationPrivate::openPopup(QWidget *popup)
{
- openPopupCount++;
- if (!popupWidgets) // create list
- popupWidgets = new QWidgetList;
- popupWidgets->append(popup); // add to end of list
+ QGuiApplicationPrivate::activatePopup(popup->windowHandle());
- if (QApplicationPrivate::popupWidgets->size() == 1) // grab mouse/keyboard
+ if (QGuiApplicationPrivate::popupCount() == 1) // grab mouse/keyboard
grabForPopup(popup);
// popups are not focus-handled by the window system (the first
@@ -3422,7 +3392,7 @@ void QApplicationPrivate::openPopup(QWidget *popup)
// new popup gets the focus
if (popup->focusWidget()) {
popup->focusWidget()->setFocus(Qt::PopupFocusReason);
- } else if (popupWidgets->size() == 1) { // this was the first popup
+ } else if (QGuiApplicationPrivate::popupCount() == 1) { // this was the first popup
if (QWidget *fw = QApplication::focusWidget()) {
QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason);
QCoreApplication::sendEvent(fw, &e);
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 21b1605dfc..7de9f54b58 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -107,8 +107,6 @@ public:
static void setActiveWindow(QWidget* act);
static bool inPopupMode();
- bool popupActive() override { return inPopupMode(); }
- bool closeAllPopups() override;
void closePopup(QWidget *popup);
void openPopup(QWidget *popup);
static void setFocusWidget(QWidget *focus, Qt::FocusReason reason);
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index e8342a4788..46e0d2c76c 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1029,10 +1029,13 @@ void QWidgetPrivate::createRecursively()
QRhi *QWidgetPrivate::rhi() const
{
- if (QWidgetRepaintManager *repaintManager = maybeRepaintManager())
- return repaintManager->rhi();
- else
+ Q_Q(const QWidget);
+ if (auto *backingStore = q->backingStore()) {
+ auto *window = windowHandle(WindowHandleMode::Closest);
+ return backingStore->handle()->rhi(window);
+ } else {
return nullptr;
+ }
}
/*!
@@ -1112,8 +1115,15 @@ static bool q_evaluateRhiConfigRecursive(const QWidget *w, QPlatformBackingStore
}
for (const QObject *child : w->children()) {
if (const QWidget *childWidget = qobject_cast<const QWidget *>(child)) {
- if (q_evaluateRhiConfigRecursive(childWidget, outConfig, outType))
+ if (q_evaluateRhiConfigRecursive(childWidget, outConfig, outType)) {
+ static bool optOut = qEnvironmentVariableIsSet("QT_WIDGETS_NO_CHILD_RHI");
+ // Native child widgets should not trigger RHI for its parent
+ // hierarchy, but will still flush the native child using RHI.
+ if (!optOut && childWidget->testAttribute(Qt::WA_NativeWindow))
+ continue;
+
return true;
+ }
}
}
return false;
@@ -1356,19 +1366,19 @@ void QWidgetPrivate::create()
QBackingStore *store = q->backingStore();
usesRhiFlush = false;
- if (!store) {
- if (q->windowType() != Qt::Desktop) {
- if (q->isWindow()) {
- q->setBackingStore(new QBackingStore(win));
- QPlatformBackingStoreRhiConfig rhiConfig;
- usesRhiFlush = q_evaluateRhiConfig(q, &rhiConfig, nullptr);
- topData()->backingStore->handle()->setRhiConfig(rhiConfig);
- }
- } else {
- q->setAttribute(Qt::WA_PaintOnScreen, true);
+ if (q->windowType() == Qt::Desktop) {
+ q->setAttribute(Qt::WA_PaintOnScreen, true);
+ } else {
+ if (!store && q->isWindow())
+ q->setBackingStore(new QBackingStore(win));
+
+ QPlatformBackingStoreRhiConfig rhiConfig;
+ usesRhiFlush = q_evaluateRhiConfig(q, &rhiConfig, nullptr);
+ if (usesRhiFlush && q->backingStore()) {
+ // Trigger creation of support infrastructure up front,
+ // now that we have a specific RHI configuration.
+ q->backingStore()->handle()->createRhi(win, rhiConfig);
}
- } else if (win->handle()) {
- usesRhiFlush = q_evaluateRhiConfig(q, nullptr, nullptr);
}
setWindowModified_helper();
@@ -5160,6 +5170,7 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset,
const QRegion oldSystemClip = enginePriv->systemClip;
const QRegion oldBaseClip = enginePriv->baseSystemClip;
const QRegion oldSystemViewport = enginePriv->systemViewport;
+ const Qt::LayoutDirection oldLayoutDirection = painter->layoutDirection();
// This ensures that all painting triggered by render() is clipped to the current engine clip.
if (painter->hasClipping()) {
@@ -5168,6 +5179,7 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset,
} else {
enginePriv->setSystemViewport(oldSystemClip);
}
+ painter->setLayoutDirection(layoutDirection());
d->render(target, targetOffset, toBePainted, renderFlags);
@@ -5175,6 +5187,7 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset,
enginePriv->baseSystemClip = oldBaseClip;
enginePriv->setSystemTransformAndViewport(oldTransform, oldSystemViewport);
enginePriv->systemStateChanged();
+ painter->setLayoutDirection(oldLayoutDirection);
// Restore shared painter.
d->setSharedPainter(oldPainter);
@@ -6104,6 +6117,13 @@ void QWidget::setWindowTitle(const QString &title)
if (QWidget::windowTitle() == title && !title.isEmpty() && !title.isNull())
return;
+#if QT_CONFIG(accessibility)
+ QString oldAccessibleName;
+ const QAccessibleInterface *accessible = QAccessible::queryAccessibleInterface(this);
+ if (accessible)
+ oldAccessibleName = accessible->text(QAccessible::Name);
+#endif
+
Q_D(QWidget);
d->topData()->caption = title;
d->setWindowTitle_helper(title);
@@ -6112,6 +6132,13 @@ void QWidget::setWindowTitle(const QString &title)
QCoreApplication::sendEvent(this, &e);
emit windowTitleChanged(title);
+
+#if QT_CONFIG(accessibility)
+ if (accessible && accessible->text(QAccessible::Name) != oldAccessibleName) {
+ QAccessibleEvent event(this, QAccessible::NameChanged);
+ QAccessible::updateAccessibility(&event);
+ }
+#endif
}
@@ -7076,7 +7103,6 @@ void QWidgetPrivate::reparentFocusWidgets(QWidget * oldtlw)
if (focus_child)
focus_child->clearFocus();
- insertIntoFocusChain(QWidgetPrivate::FocusDirection::Previous, q->window());
reparentFocusChildren(QWidgetPrivate::FocusDirection::Next);
}
@@ -7691,11 +7717,15 @@ QMargins QWidgetPrivate::safeAreaMargins() const
return QMargins();
// Or, if one of our ancestors are in a layout that does not have WA_LayoutOnEntireRect
- // set, then we know that the layout has already taken care of placing us inside the
- // safe area, by taking the contents rect of its parent widget into account.
+ // set, and the widget respects the safe area, then we know that the layout has already
+ // taken care of placing us inside the safe area, by taking the contents rect of its
+ // parent widget into account.
const QWidget *assumedSafeWidget = nullptr;
for (const QWidget *w = q; w != nativeWidget; w = w->parentWidget()) {
QWidget *parentWidget = w->parentWidget();
+ if (!parentWidget->testAttribute(Qt::WA_ContentsMarginsRespectsSafeArea))
+ continue; // Layout can't help us
+
if (parentWidget->testAttribute(Qt::WA_LayoutOnEntireRect))
continue; // Layout not going to help us
@@ -10653,6 +10683,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
const bool wasCreated = testAttribute(Qt::WA_WState_Created);
QWidget *oldtlw = window();
Q_ASSERT(oldtlw);
+ QWidget *oldParentWithWindow = d->closestParentWidgetWithWindowHandle();
if (f & Qt::Window) // Frame geometry likely changes, refresh.
d->data.fstrut_dirty = true;
@@ -10695,7 +10726,8 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
// texture-based widgets need a pre-notification when their associated top-level window changes
// This is not under the wasCreated/newParent conditions above in order to also play nice with QDockWidget.
- if (oldtlw->d_func()->usesRhiFlush && ((!parent && parentWidget()) || (parent && parent->window() != oldtlw)))
+ const bool oldParentUsesRhiFlush = oldParentWithWindow ? oldParentWithWindow->d_func()->usesRhiFlush : false;
+ if (oldParentUsesRhiFlush && ((!parent && parentWidget()) || (parent && parent->window() != oldtlw)))
qSendWindowChangeToTextureChildrenRecursively(this, QEvent::WindowAboutToChangeInternal);
// If we get parented into another window, children will be folded
@@ -10776,7 +10808,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
// texture-based widgets need another event when their top-level window
// changes (more precisely, has already changed at this point)
- if (oldtlw->d_func()->usesRhiFlush && oldtlw != window())
+ if (oldParentUsesRhiFlush && oldtlw != window())
qSendWindowChangeToTextureChildrenRecursively(this, QEvent::WindowChangeInternal);
if (!wasCreated) {
@@ -10804,33 +10836,47 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
if (d->extra && d->extra->hasWindowContainer)
QWindowContainer::parentWasChanged(this);
- QWidget *newtlw = window();
- if (oldtlw != newtlw) {
+ QWidget *newParentWithWindow = d->closestParentWidgetWithWindowHandle();
+ if (newParentWithWindow && newParentWithWindow != oldParentWithWindow) {
+ // Check if the native parent now needs to switch to RHI
+ qCDebug(lcWidgetPainting) << "Evaluating whether reparenting of" << this
+ << "into" << parent << "requires RHI enablement for" << newParentWithWindow;
+
+ QPlatformBackingStoreRhiConfig rhiConfig;
QSurface::SurfaceType surfaceType = QSurface::RasterSurface;
- // Only evaluate the reparented subtree. While it might be tempting to
- // do it on newtlw instead, the performance implications of that are
+
+ // First evaluate whether the reparented widget uses RHI.
+ // We do this as a separate step because the performance
+ // implications of always checking the native parent are
// problematic when it comes to large widget trees.
- if (q_evaluateRhiConfig(this, nullptr, &surfaceType)) {
- const bool wasUsingRhiFlush = newtlw->d_func()->usesRhiFlush;
- newtlw->d_func()->usesRhiFlush = true;
- bool recreate = false;
- if (QWindow *w = newtlw->windowHandle()) {
- if (w->surfaceType() != surfaceType || !wasUsingRhiFlush)
- recreate = true;
- }
- // QTBUG-115652: Besides the toplevel the nativeParentWidget()'s QWindow must be checked as well.
- if (QWindow *w = d->windowHandle(QWidgetPrivate::WindowHandleMode::Closest)) {
- if (w->surfaceType() != surfaceType)
- recreate = true;
- }
- if (recreate) {
- const auto windowStateBeforeDestroy = newtlw->windowState();
- const auto visibilityBeforeDestroy = newtlw->isVisible();
- newtlw->destroy();
- newtlw->create();
- Q_ASSERT(newtlw->windowHandle());
- newtlw->windowHandle()->setWindowStates(windowStateBeforeDestroy);
- QWidgetPrivate::get(newtlw)->setVisible(visibilityBeforeDestroy);
+ if (q_evaluateRhiConfig(this, &rhiConfig, &surfaceType)) {
+ // Then check whether the native parent requires RHI
+ // as a result. It may not, if this widget is a native
+ // window, and can handle its own RHI flushing.
+ if (q_evaluateRhiConfig(newParentWithWindow, nullptr, nullptr)) {
+ // Finally, check whether we need to recreate the
+ // native parent to enable RHI flushing.
+ auto *existingWindow = newParentWithWindow->windowHandle();
+ auto existingSurfaceType = existingWindow->surfaceType();
+ if (existingSurfaceType != surfaceType) {
+ qCDebug(lcWidgetPainting)
+ << "Recreating" << existingWindow
+ << "with current type" << existingSurfaceType
+ << "to support" << surfaceType;
+ const auto windowStateBeforeDestroy = newParentWithWindow->windowState();
+ const auto visibilityBeforeDestroy = newParentWithWindow->isVisible();
+ newParentWithWindow->destroy();
+ newParentWithWindow->create();
+ Q_ASSERT(newParentWithWindow->windowHandle());
+ newParentWithWindow->windowHandle()->setWindowStates(windowStateBeforeDestroy);
+ QWidgetPrivate::get(newParentWithWindow)->setVisible(visibilityBeforeDestroy);
+ } else if (auto *backingStore = newParentWithWindow->backingStore()) {
+ // If we don't recreate we still need to make sure the native parent
+ // widget has a RHI config that the reparented widget can use.
+ backingStore->handle()->createRhi(existingWindow, rhiConfig);
+ // And that it knows it's now flushing with RHI
+ QWidgetPrivate::get(newParentWithWindow)->usesRhiFlush = true;
+ }
}
}
}
@@ -12288,8 +12334,10 @@ QBackingStore *QWidget::backingStore() const
if (extra && extra->backingStore)
return extra->backingStore;
- QWidgetRepaintManager *repaintManager = d->maybeRepaintManager();
- return repaintManager ? repaintManager->backingStore() : nullptr;
+ if (!isWindow())
+ return window()->backingStore();
+
+ return nullptr;
}
void QWidgetPrivate::getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const
@@ -12936,6 +12984,10 @@ int QWidget::metric(PaintDeviceMetric m) const
return resolveDevicePixelRatio();
case PdmDevicePixelRatioScaled:
return QPaintDevice::devicePixelRatioFScale() * resolveDevicePixelRatio();
+ case PdmDevicePixelRatioF_EncodedA:
+ Q_FALLTHROUGH();
+ case PdmDevicePixelRatioF_EncodedB:
+ return QPaintDevice::encodeMetricF(m, resolveDevicePixelRatio());
default:
break;
}
@@ -13348,32 +13400,61 @@ void QWidgetPrivate::initFocusChain()
void QWidgetPrivate::reparentFocusChildren(FocusDirection direction)
{
Q_Q(QWidget);
- QWidgetList focusChildrenInsideChain;
- QDuplicateTracker<QWidget *> seen;
- QWidget *widget = q->nextInFocusChain();
- while (q->isAncestorOf(widget)
- && !seen.hasSeen(widget)
- && widget != q->window()) {
- if (widget->focusPolicy() != Qt::NoFocus)
- focusChildrenInsideChain << widget;
-
- widget = direction == FocusDirection::Next ? widget->nextInFocusChain()
- : widget->previousInFocusChain();
- }
-
- const QWidgetList children = q->findChildren<QWidget *>(Qt::FindDirectChildrenOnly);
- QWidgetList focusChildrenOutsideChain;
- for (auto *child : children) {
- if (!focusChildrenInsideChain.contains(child))
- focusChildrenOutsideChain << child;
- }
- if (focusChildrenOutsideChain.isEmpty())
- return;
- QWidget *previous = q;
- for (auto *child : focusChildrenOutsideChain) {
- child->d_func()->insertIntoFocusChain(direction, previous);
- previous = child;
+ // separate the focus chain into new (children of myself) and old (the rest)
+ QWidget *firstOld = nullptr;
+ QWidget *lastOld = nullptr; // last in the old list
+ QWidget *lastNew = q; // last in the new list
+ bool prevWasNew = true;
+ QWidget *widget = nextPrevElementInFocusChain(direction);
+
+ // For efficiency, do not maintain the list invariant inside the loop.
+ // Append items to the relevant list, and we optimize by not changing pointers,
+ // when subsequent items are going into the same list.
+ while (widget != q) {
+ bool currentIsNew = q->isAncestorOf(widget);
+ if (currentIsNew) {
+ if (!prevWasNew) {
+ // previous was old => append to new list
+ FOCUS_NEXT(lastNew) = widget;
+ FOCUS_PREV(widget) = lastNew;
+ }
+ lastNew = widget;
+ } else {
+ if (prevWasNew) {
+ // prev was new => append to old list, if it exists
+ if (lastOld) {
+ FOCUS_NEXT(lastOld) = widget;
+ FOCUS_PREV(widget) = lastOld;
+ } else {
+ // start the old list
+ firstOld = widget;
+ }
+ }
+ lastOld = widget;
+ }
+ widget = widget->d_func()->nextPrevElementInFocusChain(direction);
+ prevWasNew = currentIsNew;
+ }
+
+ // repair old list:
+ if (firstOld) {
+ FOCUS_NEXT(lastOld) = firstOld;
+ FOCUS_PREV(firstOld) = lastOld;
+ }
+
+ if (!q->isWindow()) {
+ QWidget *topLevel = q->window();
+ // insert new chain into toplevel's chain
+ QWidget *prev = FOCUS_PREV(topLevel);
+ FOCUS_PREV(topLevel) = lastNew;
+ FOCUS_NEXT(prev) = q;
+ FOCUS_PREV(q) = prev;
+ FOCUS_NEXT(lastNew) = topLevel;
+ } else {
+ // repair new list
+ FOCUS_NEXT(lastNew) = q;
+ FOCUS_PREV(q) = lastNew;
}
}
diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp
index 607a767a20..0dee380a91 100644
--- a/src/widgets/kernel/qwidgetrepaintmanager.cpp
+++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp
@@ -1016,11 +1016,13 @@ void QWidgetRepaintManager::flush(QWidget *widget, const QRegion &region, QPlatf
if (tlw->testAttribute(Qt::WA_DontShowOnScreen) || widget->testAttribute(Qt::WA_DontShowOnScreen))
return;
+ QWindow *window = widget->windowHandle();
+ // We should only be flushing to native widgets
+ Q_ASSERT(window);
+
// Foreign Windows do not have backing store content and must not be flushed
- if (QWindow *widgetWindow = widget->windowHandle()) {
- if (widgetWindow->type() == Qt::ForeignWindow)
- return;
- }
+ if (window->type() == Qt::ForeignWindow)
+ return;
static bool fpsDebug = qEnvironmentVariableIntValue("QT_DEBUG_FPS");
if (fpsDebug) {
@@ -1037,69 +1039,51 @@ void QWidgetRepaintManager::flush(QWidget *widget, const QRegion &region, QPlatf
if (widget != tlw)
offset += widget->mapTo(tlw, QPoint());
- // Use a condition that tries to keep both QTBUG-108344 and QTBUG-113557
- // happy, i.e. support both (A) "native rhi-based child in a rhi-based
- // toplevel" and (B) "native raster child in a rhi-based toplevel".
- //
- // If the tlw and the backingstore are RHI-based, then there are two cases
- // to consider:
- //
- // (1) widget is not a native child, i.e. the QWindow for widget and tlw are
- // the same,
- //
- // (2) widget is a native child which we now attempt to flush with tlw's
- // backingstore to widget's native window. This is the interesting one.
- //
- // Using the condition tlw->usesRhiFlush on its own is insufficient since
- // it fails to capture the case of a raster-based native child widget
- // within tlw. (which must hit the non-rhi flush path)
- //
- // Extending the condition with tlw->windowHandle() == widget->windowHandle()
- // would be logical but wrong, when it comes to (A) since flushing a
- // RHI-based native child with a given 3D API using a RHI-based
- // tlw/backingstore with the same 3D API needs to be supported still. (this
- // happens when e.g. someone calls winId() on a QOpenGLWidget)
- //
- // Different 3D APIs do not need to be supported since we do not allow to
- // do things like having a QQuickWidget with Vulkan and a QOpenGLWidget in
- // the same toplevel, regardless of the widgets being native children or
- // not. Hence comparing the surfaceType() instead. This satisfies both (A)
- // and (B) given that an RHI-based toplevel cannot be RasterSurface.
- //
- if (tlw->d_func()->usesRhiFlush && tlw->windowHandle()->surfaceType() == widget->windowHandle()->surfaceType()) {
- QRhi *rhi = store->handle()->rhi();
- qCDebug(lcWidgetPainting) << "Flushing" << region << "of" << widget
- << "with QRhi" << rhi
- << "to window" << widget->windowHandle();
+ // A widget uses RHI flush if itself, or one of its non-native children
+ // uses RHI for its drawing. If so, we composite the backing store raster
+ // data along with textures produced by the RHI widgets.
+ const bool flushWithRhi = widget->d_func()->usesRhiFlush;
+
+ qCDebug(lcWidgetPainting) << "Flushing" << region << "of" << widget
+ << "to" << window << (flushWithRhi ? "using RHI" : "");
+
+ // A widget uses RHI flush if itself, or one of its non-native children
+ // uses RHI for its drawing. If so, we composite the backing store raster
+ // data along with textures produced by the RHI widgets.
+ if (flushWithRhi) {
if (!widgetTextures)
widgetTextures = qt_dummy_platformTextureList;
- QWidgetPrivate *widgetWindowPrivate = widget->window()->d_func();
- widgetWindowPrivate->sendComposeStatus(widget->window(), false);
+ // We only need to let the widget sub-hierarchy that
+ // we are flushing know that we're compositing.
+ auto *widgetPrivate = QWidgetPrivate::get(widget);
+ widgetPrivate->sendComposeStatus(widget, false);
+
// A window may have alpha even when the app did not request
// WA_TranslucentBackground. Therefore the compositor needs to know whether the app intends
// to rely on translucency, in order to decide if it should clear to transparent or opaque.
const bool translucentBackground = widget->testAttribute(Qt::WA_TranslucentBackground);
QPlatformBackingStore::FlushResult flushResult;
- flushResult = store->handle()->rhiFlush(widget->windowHandle(),
+ flushResult = store->handle()->rhiFlush(window,
widget->devicePixelRatio(),
region,
offset,
widgetTextures,
translucentBackground);
- widgetWindowPrivate->sendComposeStatus(widget->window(), true);
+
+ widgetPrivate->sendComposeStatus(widget, true);
+
if (flushResult == QPlatformBackingStore::FlushFailedDueToLostDevice) {
qSendWindowChangeToTextureChildrenRecursively(widget->window(),
QEvent::WindowAboutToChangeInternal);
- store->handle()->graphicsDeviceReportedLost();
+ store->handle()->graphicsDeviceReportedLost(window);
qSendWindowChangeToTextureChildrenRecursively(widget->window(),
QEvent::WindowChangeInternal);
widget->update();
}
} else {
- qCInfo(lcWidgetPainting) << "Flushing" << region << "of" << widget;
- store->flush(region, widget->windowHandle(), offset);
+ store->flush(region, window, offset);
}
}
@@ -1308,11 +1292,6 @@ void QWidgetPrivate::invalidateBackingStore_resizeHelper(const QPoint &oldPos, c
}
}
-QRhi *QWidgetRepaintManager::rhi() const
-{
- return store->handle()->rhi();
-}
-
QT_END_NAMESPACE
#include "qwidgetrepaintmanager.moc"
diff --git a/src/widgets/kernel/qwidgetrepaintmanager_p.h b/src/widgets/kernel/qwidgetrepaintmanager_p.h
index 4378974610..13190a0bb0 100644
--- a/src/widgets/kernel/qwidgetrepaintmanager_p.h
+++ b/src/widgets/kernel/qwidgetrepaintmanager_p.h
@@ -26,8 +26,6 @@ QT_BEGIN_NAMESPACE
class QPlatformTextureList;
class QPlatformTextureListWatcher;
class QWidgetRepaintManager;
-class QRhi;
-class QRhiSwapChain;
class Q_WIDGETS_EXPORT QWidgetRepaintManager
{
@@ -72,8 +70,6 @@ public:
bool bltRect(const QRect &rect, int dx, int dy, QWidget *widget);
- QRhi *rhi() const;
-
private:
void updateLists(QWidget *widget);
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index c5b045c8db..ce9bb44b45 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -27,9 +27,8 @@ Q_WIDGETS_EXPORT QWidget *qt_button_down = nullptr; // widget got last button-do
// popup control
QWidget *qt_popup_down = nullptr; // popup that contains the pressed widget
-extern int openPopupCount;
bool qt_popup_down_closed = false; // qt_popup_down has been closed
-bool qt_replay_popup_mouse_event = false;
+
extern bool qt_try_modal(QWidget *widget, QEvent::Type type);
class QWidgetWindowPrivate : public QWindowPrivate
@@ -77,7 +76,7 @@ public:
widget->focusWidget()->clearFocus();
}
- void setFocusToTarget(QWindowPrivate::FocusTarget target) override
+ void setFocusToTarget(FocusTarget target, Qt::FocusReason reason) override
{
Q_Q(QWidgetWindow);
QWidget *widget = q->widget();
@@ -107,7 +106,7 @@ public:
}
if (newFocusWidget)
- newFocusWidget->setFocus();
+ newFocusWidget->setFocus(reason);
}
QRectF closestAcceptableGeometry(const QRectF &rect) const override;
@@ -161,8 +160,8 @@ QWidgetWindow::QWidgetWindow(QWidget *widget)
updateObjectName();
if (!QCoreApplication::testAttribute(Qt::AA_ForceRasterWidgets)) {
QSurface::SurfaceType type = QSurface::RasterSurface;
- q_evaluateRhiConfig(m_widget, nullptr, &type);
- setSurfaceType(type);
+ if (q_evaluateRhiConfig(m_widget, nullptr, &type))
+ setSurfaceType(type);
}
connect(widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName);
@@ -505,9 +504,6 @@ void QWidgetWindow::handleNonClientAreaMouseEvent(QMouseEvent *e)
void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
{
- static const QEvent::Type contextMenuTrigger =
- QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::ContextMenuOnMouseRelease).toBool() ?
- QEvent::MouseButtonRelease : QEvent::MouseButtonPress;
if (QApplicationPrivate::inPopupMode()) {
QPointer<QWidget> activePopupWidget = QApplication::activePopupWidget();
QPointF mapped = event->position();
@@ -535,11 +531,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
break; // nothing for mouse move
}
- int oldOpenPopupCount = openPopupCount;
-
if (activePopupWidget->isEnabled()) {
// deliver event
- qt_replay_popup_mouse_event = false;
QPointer<QWidget> receiver = activePopupWidget;
QPointF widgetPos = mapped;
if (qt_button_down)
@@ -591,57 +584,6 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
}
}
- if (QApplication::activePopupWidget() != activePopupWidget
- && qt_replay_popup_mouse_event
- && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ReplayMousePressOutsidePopup).toBool()) {
- if (m_widget->windowType() != Qt::Popup)
- qt_button_down = nullptr;
- if (event->type() == QEvent::MouseButtonPress) {
- // the popup disappeared, replay the mouse press event
- QWidget *w = QApplication::widgetAt(event->globalPosition().toPoint());
- if (w && !QApplicationPrivate::isBlockedByModal(w)) {
- // activate window of the widget under mouse pointer
- if (!w->isActiveWindow()) {
- w->activateWindow();
- w->window()->raise();
- }
-
- if (auto win = qt_widget_private(w)->windowHandle(QWidgetPrivate::WindowHandleMode::Closest)) {
- const QRect globalGeometry = win->isTopLevel()
- ? win->geometry()
- : QRect(win->mapToGlobal(QPoint(0, 0)), win->size());
- if (globalGeometry.contains(event->globalPosition().toPoint())) {
- // Use postEvent() to ensure the local QEventLoop terminates when called from QMenu::exec()
- const QPoint localPos = win->mapFromGlobal(event->globalPosition().toPoint());
- QMouseEvent *e = new QMouseEvent(QEvent::MouseButtonPress, localPos, localPos, event->globalPosition().toPoint(),
- event->button(), event->buttons(), event->modifiers(), event->source());
- QCoreApplicationPrivate::setEventSpontaneous(e, true);
- e->setTimestamp(event->timestamp());
- QCoreApplication::postEvent(win, e);
- }
- }
- }
- }
- qt_replay_popup_mouse_event = false;
-#ifndef QT_NO_CONTEXTMENU
- } else if (event->type() == contextMenuTrigger
- && event->button() == Qt::RightButton
- && (openPopupCount == oldOpenPopupCount)) {
- QWidget *receiver = activePopupWidget;
- if (qt_button_down)
- receiver = qt_button_down;
- else if (popupChild)
- receiver = popupChild;
- const QPoint localPos = receiver->mapFromGlobal(event->globalPosition().toPoint());
- QContextMenuEvent e(QContextMenuEvent::Mouse, localPos, event->globalPosition().toPoint(), event->modifiers());
- QApplication::forwardEvent(receiver, &e, event);
- }
-#else
- Q_UNUSED(contextMenuTrigger);
- Q_UNUSED(oldOpenPopupCount);
- }
-#endif
-
if (releaseAfter) {
qt_button_down = nullptr;
qt_popup_down_closed = false;
@@ -671,6 +613,11 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
if (!receiver)
return;
+ if (d_func()->isPopup() && receiver->window()->windowHandle() != this) {
+ receiver = widget;
+ mapped = event->position().toPoint();
+ }
+
if ((event->type() != QEvent::MouseButtonPress) || !QMutableSinglePointEvent::from(event)->isDoubleClick()) {
// The preceding statement excludes MouseButtonPress events which caused
@@ -684,7 +631,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
event->setAccepted(translated.isAccepted());
}
#ifndef QT_NO_CONTEXTMENU
- if (event->type() == contextMenuTrigger && event->button() == Qt::RightButton
+ if (event->type() == QGuiApplicationPrivate::contextMenuEventType()
+ && event->button() == Qt::RightButton
&& m_widget->rect().contains(event->position().toPoint())) {
QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPosition().toPoint(), event->modifiers());
QGuiApplication::forwardEvent(receiver, &e, event);
@@ -862,6 +810,10 @@ void QWidgetWindow::handleResizeEvent(QResizeEvent *event)
void QWidgetWindow::closeEvent(QCloseEvent *event)
{
Q_D(QWidgetWindow);
+ if (qt_popup_down == m_widget) {
+ qt_popup_down = nullptr;
+ qt_popup_down_closed = true;
+ }
bool accepted = m_widget->d_func()->handleClose(d->inClose ? QWidgetPrivate::CloseWithEvent
: QWidgetPrivate::CloseWithSpontaneousEvent);
event->setAccepted(accepted);
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index 376a93c758..1aaf04af43 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -326,7 +326,7 @@ bool QWindowContainer::event(QEvent *e)
target = QWindowPrivate::FocusTarget::First;
else if (reason == Qt::BacktabFocusReason)
target = QWindowPrivate::FocusTarget::Last;
- qt_window_private(d->window)->setFocusToTarget(target);
+ qt_window_private(d->window)->setFocusToTarget(target, reason);
d->window->requestActivate();
}
}
diff --git a/src/widgets/styles/images/standardbutton-apply-128.png b/src/widgets/styles/images/standardbutton-apply-128.png
index 85f07a57ef..35eb54bfd0 100644
--- a/src/widgets/styles/images/standardbutton-apply-128.png
+++ b/src/widgets/styles/images/standardbutton-apply-128.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-apply-16.png b/src/widgets/styles/images/standardbutton-apply-16.png
index 8f11ce6504..1f97b52566 100644
--- a/src/widgets/styles/images/standardbutton-apply-16.png
+++ b/src/widgets/styles/images/standardbutton-apply-16.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-apply-32.png b/src/widgets/styles/images/standardbutton-apply-32.png
index e8f7853a1e..0837fae244 100644
--- a/src/widgets/styles/images/standardbutton-apply-32.png
+++ b/src/widgets/styles/images/standardbutton-apply-32.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-no-128.png b/src/widgets/styles/images/standardbutton-no-128.png
index 491c048ebd..4d9cdb1566 100644
--- a/src/widgets/styles/images/standardbutton-no-128.png
+++ b/src/widgets/styles/images/standardbutton-no-128.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-no-16.png b/src/widgets/styles/images/standardbutton-no-16.png
index 812d3f57dd..a04af9c37a 100644
--- a/src/widgets/styles/images/standardbutton-no-16.png
+++ b/src/widgets/styles/images/standardbutton-no-16.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-no-32.png b/src/widgets/styles/images/standardbutton-no-32.png
index 9548d59196..01d4401a2b 100644
--- a/src/widgets/styles/images/standardbutton-no-32.png
+++ b/src/widgets/styles/images/standardbutton-no-32.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-ok-128.png b/src/widgets/styles/images/standardbutton-ok-128.png
index 63cc5279ae..b204b6f272 100644
--- a/src/widgets/styles/images/standardbutton-ok-128.png
+++ b/src/widgets/styles/images/standardbutton-ok-128.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-yes-128.png b/src/widgets/styles/images/standardbutton-yes-128.png
index 79c8296016..6266e5bc6a 100644
--- a/src/widgets/styles/images/standardbutton-yes-128.png
+++ b/src/widgets/styles/images/standardbutton-yes-128.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-yes-16.png b/src/widgets/styles/images/standardbutton-yes-16.png
index cc16dbbec3..f66b5da6f2 100644
--- a/src/widgets/styles/images/standardbutton-yes-16.png
+++ b/src/widgets/styles/images/standardbutton-yes-16.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-yes-32.png b/src/widgets/styles/images/standardbutton-yes-32.png
index e3340c6453..6685d19e9f 100644
--- a/src/widgets/styles/images/standardbutton-yes-32.png
+++ b/src/widgets/styles/images/standardbutton-yes-32.png
Binary files differ
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 6ff85e2c1b..aab1192d50 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -761,56 +761,62 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
% HexString<uint>(pe),
opt, QSize(size, size), dpr);
if (!QPixmapCache::find(pixmapName, &pixmap)) {
- const qreal border = dpr * (size / 5.);
- const qreal sqsize = dpr * size;
- pixmap = QPixmap(QSize(size, size));
- pixmap.fill(Qt::transparent);
- QPainter imagePainter(&pixmap);
-
- QPolygonF poly;
+ // dpr scaling does not work well on such small pixel sizes, do it on our own
+ const int border = 1 * dpr;
+ const int sizeDpr = size * dpr;
+ int width = sizeDpr - 2 * border - 1;
+ int height = width / 2;
+ const int add = ((width & 1) == 1);
+ if (pe == PE_IndicatorArrowRight || pe == PE_IndicatorArrowLeft)
+ std::swap(width, height);
+ pixmap = styleCachePixmap(QSize(sizeDpr, sizeDpr), 1);
+
+ std::array<QPointF, 4> poly;
switch (pe) {
case PE_IndicatorArrowUp:
- poly = {QPointF(border, sqsize / 2), QPointF(sqsize / 2, border), QPointF(sqsize - border, sqsize / 2)};
+ poly = {QPointF(0, height), QPointF(width, height),
+ QPointF(width / 2 + add, 0), QPointF(width / 2, 0)};
break;
case PE_IndicatorArrowDown:
- poly = {QPointF(border, sqsize / 2), QPointF(sqsize / 2, sqsize - border), QPointF(sqsize - border, sqsize / 2)};
+ poly = {QPointF(0, 0), QPointF(width, 0),
+ QPointF(width / 2 + add, height), QPointF(width / 2, height)};
break;
case PE_IndicatorArrowRight:
- poly = {QPointF(sqsize - border, sqsize / 2), QPointF(sqsize / 2, border), QPointF(sqsize / 2, sqsize - border)};
+ poly = {QPointF(0, 0), QPointF(0, height),
+ QPointF(width, height / 2 + add), QPointF(width, height / 2)};
break;
case PE_IndicatorArrowLeft:
- poly = {QPointF(border, sqsize / 2), QPointF(sqsize / 2, border), QPointF(sqsize / 2, sqsize - border)};
+ poly = {QPointF(width, 0), QPointF(width, height),
+ QPointF(0, height / 2 + add), QPointF(0, height / 2)};
break;
default:
break;
}
- int bsx = 0;
- int bsy = 0;
-
+ QPainter imagePainter(&pixmap);
+ imagePainter.translate((sizeDpr - width) / 2, (sizeDpr - height) / 2);
if (opt->state & State_Sunken) {
- bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget);
- bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget);
+ const auto bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget);
+ const auto bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget);
+ imagePainter.translate(bsx, bsy);
}
-
- const QPointF boundsCenter = poly.boundingRect().center();
- const qreal sx = sqsize / 2 - boundsCenter.x();
- const qreal sy = sqsize / 2 - boundsCenter.y();
- imagePainter.translate(sx + bsx, sy + bsy);
imagePainter.setPen(opt->palette.buttonText().color());
imagePainter.setBrush(opt->palette.buttonText());
if (!(opt->state & State_Enabled)) {
- imagePainter.translate(1, 1);
+ const int ofs = qRound(1 * dpr);
+ imagePainter.translate(ofs, ofs);
imagePainter.setBrush(opt->palette.light().color());
imagePainter.setPen(opt->palette.light().color());
- imagePainter.drawPolygon(poly);
- imagePainter.translate(-1, -1);
+ imagePainter.drawPolygon(poly.data(), int(poly.size()));
+ imagePainter.drawPoints(poly.data(), int(poly.size()));
+ imagePainter.translate(-ofs, -ofs);
imagePainter.setBrush(opt->palette.mid().color());
imagePainter.setPen(opt->palette.mid().color());
}
-
- imagePainter.drawPolygon(poly);
+ imagePainter.drawPolygon(poly.data(), int(poly.size()));
+ // sometimes the corners are not drawn by drawPolygon for unknown reaons, so re-draw them again
+ imagePainter.drawPoints(poly.data(), int(poly.size()));
imagePainter.end();
pixmap.setDevicePixelRatio(dpr);
QPixmapCache::insert(pixmapName, pixmap);
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 34a0105b80..6b8fd979a9 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -3660,7 +3660,7 @@ QRect QFusionStyle::subElementRect(SubElement sr, const QStyleOption *opt, const
}
/*!
- \reimp
+ \internal
*/
QIcon QFusionStyle::iconFromTheme(StandardPixmap standardIcon) const
{
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index 02827de847..b4616b8c24 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -202,7 +202,7 @@ QPolygonF calcLines(const QStyleOptionSlider *dial)
qreal xc = width / 2 + 0.5;
qreal yc = height / 2 + 0.5;
const int ns = dial->tickInterval;
- if (!ns) // Invalid values may be set by Qt Designer.
+ if (!ns) // Invalid values may be set by Qt Widgets Designer.
return poly;
int notches = (dial->maximum + ns - 1 - dial->minimum) / ns;
if (notches <= 0)
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index f52321a3e1..21612ad6d1 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1308,6 +1308,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e)
case QEvent::Hide:
if (d->popup)
d->popup->hide();
+ break;
default:
break;
}
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index 034127b4f3..0495b20422 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -2731,12 +2731,29 @@ bool QCalendarWidget::isGridVisible() const
return d->m_view->showGrid();
}
+/*!
+ \since 5.14
+ Report the calendar system in use by this widget.
+
+ \sa setCalendar()
+*/
+
QCalendar QCalendarWidget::calendar() const
{
Q_D(const QCalendarWidget);
return d->m_model->m_calendar;
}
+/*!
+ \since 5.14
+ Set \a c as the calendar system to be used by this widget.
+
+ The widget can use any supported calendar system.
+ By default, it uses the Gregorian calendar.
+
+ \sa calendar()
+*/
+
void QCalendarWidget::setCalendar(QCalendar c)
{
Q_D(QCalendarWidget);
diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp
index 88cd603d70..3c03e9efa5 100644
--- a/src/widgets/widgets/qcheckbox.cpp
+++ b/src/widgets/widgets/qcheckbox.cpp
@@ -93,6 +93,11 @@ public:
\fn void QCheckBox::stateChanged(int state)
\deprecated [6.9] Use checkStateChanged(Qt::CheckState) instead.
+
+ This signal is emitted whenever the checkbox's state changes, i.e.,
+ whenever the user checks or unchecks it.
+
+ \a state contains the checkbox's new Qt::CheckState.
*/
/*!
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 01e52b2fa6..a9b5babde5 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -303,6 +303,12 @@ void QDateTimeEdit::setTime(QTime time)
}
}
+/*!
+ \since 5.14
+ Report the calendar system in use by this widget.
+
+ \sa setCalendar()
+*/
QCalendar QDateTimeEdit::calendar() const
{
@@ -310,6 +316,16 @@ QCalendar QDateTimeEdit::calendar() const
return d->calendar;
}
+/*!
+ \since 5.14
+ Set \a calendar as the calendar system to be used by this widget.
+
+ The widget can use any supported calendar system.
+ By default, it uses the Gregorian calendar.
+
+ \sa calendar()
+*/
+
void QDateTimeEdit::setCalendar(QCalendar calendar)
{
Q_D(QDateTimeEdit);
@@ -2462,7 +2478,7 @@ int QDateTimeEditPrivate::absoluteIndex(QDateTimeEdit::Section s, int index) con
return NoSectionIndex;
}
-int QDateTimeEditPrivate::absoluteIndex(const SectionNode &s) const
+int QDateTimeEditPrivate::absoluteIndex(SectionNode s) const
{
return sectionNodes.indexOf(s);
}
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index 215ee75bfe..f93afd1519 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -67,7 +67,7 @@ public:
int cursorPosition() const override { return edit ? edit->cursorPosition() : -1; }
int absoluteIndex(QDateTimeEdit::Section s, int index) const;
- int absoluteIndex(const SectionNode &s) const;
+ int absoluteIndex(SectionNode s) const;
QDateTime stepBy(int index, int steps, bool test = false) const;
int sectionAt(int pos) const;
int closestSection(int index, bool forward) const;
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 30ace89fa8..0b6a4df41a 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -374,7 +374,7 @@ QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardBut
button->setIcon(style->standardIcon(QStyle::StandardPixmap(icon), nullptr, q));
if (style != QApplication::style()) // Propagate style
button->setStyle(style);
- standardButtonHash.insert(button, sbutton);
+ standardButtonMap.insert(button, sbutton);
QPlatformDialogHelper::ButtonRole role = QPlatformDialogHelper::buttonRole(static_cast<QPlatformDialogHelper::StandardButton>(sbutton));
if (Q_UNLIKELY(role == QPlatformDialogHelper::InvalidRole))
qWarning("QDialogButtonBox::createButton: Invalid ButtonRole, button not added");
@@ -426,10 +426,10 @@ void QDialogButtonBoxPrivate::createStandardButtons(QDialogButtonBox::StandardBu
void QDialogButtonBoxPrivate::retranslateStrings()
{
- for (auto &&[key, value] : std::as_const(standardButtonHash).asKeyValueRange()) {
- const QString text = QGuiApplicationPrivate::platformTheme()->standardButtonText(value);
+ for (const auto &it : std::as_const(standardButtonMap)) {
+ const QString text = QGuiApplicationPrivate::platformTheme()->standardButtonText(it.second);
if (!text.isEmpty())
- key->setText(text);
+ it.first->setText(text);
}
}
@@ -644,15 +644,15 @@ void QDialogButtonBox::clear()
Q_D(QDialogButtonBox);
// Remove the created standard buttons, they should be in the other lists, which will
// do the deletion
- d->standardButtonHash.clear();
+ d->standardButtonMap.clear();
for (int i = 0; i < NRoles; ++i) {
QList<QAbstractButton *> &list = d->buttonLists[i];
- while (list.size()) {
- QAbstractButton *button = list.takeAt(0);
+ for (auto button : std::as_const(list)) {
QObjectPrivate::disconnect(button, &QAbstractButton::destroyed,
d, &QDialogButtonBoxPrivate::handleButtonDestroyed);
delete button;
}
+ list.clear();
}
}
@@ -680,7 +680,11 @@ QList<QAbstractButton *> QDialogButtonBoxPrivate::visibleButtons() const
QList<QAbstractButton *> QDialogButtonBoxPrivate::allButtons() const
{
- return visibleButtons() << hiddenButtons.keys();
+ QList<QAbstractButton *> ret(visibleButtons());
+ ret.reserve(ret.size() + hiddenButtons.size());
+ for (const auto &it : hiddenButtons)
+ ret.push_back(it.first);
+ return ret;
}
/*!
@@ -718,9 +722,9 @@ void QDialogButtonBox::removeButton(QAbstractButton *button)
Removes \param button.
\param reason determines the behavior following the removal:
\list
- \li \c ManualRemove disconnects all signals and removes the button from standardButtonHash.
- \li \c HideEvent keeps connections alive, standard buttons remain in standardButtonHash.
- \li \c Destroyed removes the button from standardButtonHash. Signals remain untouched, because
+ \li \c ManualRemove disconnects all signals and removes the button from standardButtonMap.
+ \li \c HideEvent keeps connections alive, standard buttons remain in standardButtonMap.
+ \li \c Destroyed removes the button from standardButtonMap. Signals remain untouched, because
the button might already be only a QObject, the destructor of which handles disconnecting.
\endlist
*/
@@ -744,7 +748,7 @@ void QDialogButtonBoxPrivate::removeButton(QAbstractButton *button, RemoveReason
button->removeEventFilter(filter.get());
Q_FALLTHROUGH();
case RemoveReason::Destroyed:
- standardButtonHash.remove(reinterpret_cast<QPushButton *>(button));
+ standardButtonMap.remove(reinterpret_cast<QPushButton *>(button));
break;
case RemoveReason::HideEvent:
break;
@@ -818,8 +822,9 @@ void QDialogButtonBox::setStandardButtons(StandardButtons buttons)
{
Q_D(QDialogButtonBox);
// Clear out all the old standard buttons, then recreate them.
- qDeleteAll(d->standardButtonHash.keyBegin(), d->standardButtonHash.keyEnd());
- d->standardButtonHash.clear();
+ const auto oldButtons = d->standardButtonMap.keys();
+ d->standardButtonMap.clear();
+ qDeleteAll(oldButtons);
d->createStandardButtons(buttons);
}
@@ -828,11 +833,8 @@ QDialogButtonBox::StandardButtons QDialogButtonBox::standardButtons() const
{
Q_D(const QDialogButtonBox);
StandardButtons standardButtons = NoButton;
- QHash<QPushButton *, StandardButton>::const_iterator it = d->standardButtonHash.constBegin();
- while (it != d->standardButtonHash.constEnd()) {
- standardButtons |= it.value();
- ++it;
- }
+ for (const auto value : d->standardButtonMap.values())
+ standardButtons |= value;
return standardButtons;
}
@@ -845,7 +847,12 @@ QDialogButtonBox::StandardButtons QDialogButtonBox::standardButtons() const
QPushButton *QDialogButtonBox::button(StandardButton which) const
{
Q_D(const QDialogButtonBox);
- return d->standardButtonHash.key(which);
+
+ for (const auto &it : std::as_const(d->standardButtonMap)) {
+ if (it.second == which)
+ return it.first;
+ }
+ return nullptr;
}
/*!
@@ -857,7 +864,7 @@ QPushButton *QDialogButtonBox::button(StandardButton which) const
QDialogButtonBox::StandardButton QDialogButtonBox::standardButton(QAbstractButton *button) const
{
Q_D(const QDialogButtonBox);
- return d->standardButtonHash.value(static_cast<QPushButton *>(button));
+ return d->standardButtonMap.value(static_cast<QPushButton *>(button));
}
void QDialogButtonBoxPrivate::handleButtonClicked()
@@ -965,16 +972,13 @@ bool QDialogButtonBox::centerButtons() const
*/
void QDialogButtonBox::changeEvent(QEvent *event)
{
- typedef QHash<QPushButton *, QDialogButtonBox::StandardButton> StandardButtonHash;
-
Q_D(QDialogButtonBox);
switch (event->type()) {
case QEvent::StyleChange: // Propagate style
- if (!d->standardButtonHash.empty()) {
+ if (!d->standardButtonMap.empty()) {
QStyle *newStyle = style();
- const StandardButtonHash::iterator end = d->standardButtonHash.end();
- for (StandardButtonHash::iterator it = d->standardButtonHash.begin(); it != end; ++it)
- it.key()->setStyle(newStyle);
+ for (auto key : d->standardButtonMap.keys())
+ key->setStyle(newStyle);
}
#ifdef Q_OS_MAC
Q_FALLTHROUGH();
diff --git a/src/widgets/widgets/qdialogbuttonbox_p.h b/src/widgets/widgets/qdialogbuttonbox_p.h
index c3d7e03489..e439819c49 100644
--- a/src/widgets/widgets/qdialogbuttonbox_p.h
+++ b/src/widgets/widgets/qdialogbuttonbox_p.h
@@ -16,6 +16,7 @@
//
#include <private/qwidget_p.h>
+#include <private/qflatmap_p.h>
#include <qdialogbuttonbox.h>
QT_BEGIN_NAMESPACE
@@ -42,8 +43,8 @@ public:
QDialogButtonBoxPrivate(Qt::Orientation orient);
QList<QAbstractButton *> buttonLists[QDialogButtonBox::NRoles];
- QHash<QPushButton *, QDialogButtonBox::StandardButton> standardButtonHash;
- QHash<QAbstractButton *, QDialogButtonBox::ButtonRole> hiddenButtons;
+ QVarLengthFlatMap<QPushButton *, QDialogButtonBox::StandardButton, 8> standardButtonMap;
+ QVarLengthFlatMap<QAbstractButton *, QDialogButtonBox::ButtonRole, 8> hiddenButtons;
Qt::Orientation orientation;
QDialogButtonBox::ButtonLayout layoutPolicy;
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 706306000c..f353525553 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1448,22 +1448,60 @@ QDockWidget::DockWidgetFeatures QDockWidget::features() const
void QDockWidget::setFloating(bool floating)
{
Q_D(QDockWidget);
+ d->setFloating(floating);
+}
+/*!
+ \internal implementation of setFloating
+ */
+void QDockWidgetPrivate::setFloating(bool floating)
+{
+ Q_Q(QDockWidget);
// the initial click of a double-click may have started a drag...
- if (d->state != nullptr)
- d->endDrag(QDockWidgetPrivate::EndDragMode::Abort);
+ if (state != nullptr)
+ endDrag(QDockWidgetPrivate::EndDragMode::Abort);
- QRect r = d->undockedGeometry;
// Keep position when undocking for the first time.
- if (floating && isVisible() && !r.isValid())
- r = QRect(mapToGlobal(QPoint(0, 0)), size());
+ QRect r = undockedGeometry;
+ if (floating && q->isVisible() && !r.isValid())
+ r = QRect(q->mapToGlobal(QPoint(0, 0)), q->size());
+
+ // Reparent, if setFloating() was called on a floating tab
+ // Reparenting has to happen before setWindowState.
+ // The reparented dock widget will inherit visibility from the floating tab.
+ // => Remember visibility and the necessity to update it.
+ enum class VisibilityRule {
+ NoUpdate,
+ Show,
+ Hide,
+ };
+
+ VisibilityRule updateRule = VisibilityRule::NoUpdate;
+
+ if (floating && !q->isFloating()) {
+ if (auto *groupWindow = qobject_cast<QDockWidgetGroupWindow *>(q->parentWidget())) {
+ updateRule = groupWindow->isVisible() ? VisibilityRule::Show : VisibilityRule::Hide;
+ q->setParent(groupWindow->parentWidget());
+ }
+ }
- d->setWindowState(floating, false, floating ? r : QRect());
+ setWindowState(floating, false, floating ? r : QRect());
if (floating && r.isNull()) {
- if (x() < 0 || y() < 0) //may happen if we have been hidden
- move(QPoint());
- setAttribute(Qt::WA_Moved, false); //we want it at the default position
+ if (q->x() < 0 || q->y() < 0) //may happen if we have been hidden
+ q->move(QPoint());
+ q->setAttribute(Qt::WA_Moved, false); //we want it at the default position
+ }
+
+ switch (updateRule) {
+ case VisibilityRule::NoUpdate:
+ break;
+ case VisibilityRule::Show:
+ q->show();
+ break;
+ case VisibilityRule::Hide:
+ q->hide();
+ break;
}
}
diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h
index fa936599c6..6d3d307729 100644
--- a/src/widgets/widgets/qdockwidget_p.h
+++ b/src/widgets/widgets/qdockwidget_p.h
@@ -104,6 +104,7 @@ public:
void unplug(const QRect &rect);
void plug(const QRect &rect);
void setResizerActive(bool active);
+ void setFloating(bool floating);
bool isAnimating() const;
bool isTabbed() const;
diff --git a/src/widgets/widgets/qframe.cpp b/src/widgets/widgets/qframe.cpp
index db8dc20be2..1973fd24ee 100644
--- a/src/widgets/widgets/qframe.cpp
+++ b/src/widgets/widgets/qframe.cpp
@@ -32,7 +32,13 @@ QFramePrivate::~QFramePrivate()
inline void QFramePrivate::init()
{
+ Q_Q(QFrame);
setLayoutItemMargins(QStyle::SE_FrameLayoutItem);
+
+ // The frameRect property is implemented in terms of the widget's
+ // contentsRect, which conflicts with the implicit inclusion of
+ // the safe area margins in the contentsRect.
+ q->setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, false);
}
/*!
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 8909ac80d9..0db46bf175 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -2211,11 +2211,13 @@ QMenu *QLineEdit::createStandardContextMenu()
if (!isReadOnly()) {
action = popup->addAction(QLineEdit::tr("&Undo") + ACCEL_KEY(QKeySequence::Undo));
action->setEnabled(d->control->isUndoAvailable());
+ action->setObjectName(QStringLiteral("edit-undo"));
setActionIcon(action, QStringLiteral("edit-undo"));
connect(action, &QAction::triggered, this, &QLineEdit::undo);
action = popup->addAction(QLineEdit::tr("&Redo") + ACCEL_KEY(QKeySequence::Redo));
action->setEnabled(d->control->isRedoAvailable());
+ action->setObjectName(QStringLiteral("edit-redo"));
setActionIcon(action, QStringLiteral("edit-redo"));
connect(action, &QAction::triggered, this, &QLineEdit::redo);
@@ -2227,6 +2229,7 @@ QMenu *QLineEdit::createStandardContextMenu()
action = popup->addAction(QLineEdit::tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut));
action->setEnabled(!d->control->isReadOnly() && d->control->hasSelectedText()
&& d->control->echoMode() == QLineEdit::Normal);
+ action->setObjectName(QStringLiteral("edit-cut"));
setActionIcon(action, QStringLiteral("edit-cut"));
connect(action, &QAction::triggered, this, &QLineEdit::cut);
}
@@ -2234,12 +2237,14 @@ QMenu *QLineEdit::createStandardContextMenu()
action = popup->addAction(QLineEdit::tr("&Copy") + ACCEL_KEY(QKeySequence::Copy));
action->setEnabled(d->control->hasSelectedText()
&& d->control->echoMode() == QLineEdit::Normal);
+ action->setObjectName(QStringLiteral("edit-copy"));
setActionIcon(action, QStringLiteral("edit-copy"));
connect(action, &QAction::triggered, this, &QLineEdit::copy);
if (!isReadOnly()) {
action = popup->addAction(QLineEdit::tr("&Paste") + ACCEL_KEY(QKeySequence::Paste));
action->setEnabled(!d->control->isReadOnly() && !QGuiApplication::clipboard()->text().isEmpty());
+ action->setObjectName(QStringLiteral("edit-paste"));
setActionIcon(action, QStringLiteral("edit-paste"));
connect(action, &QAction::triggered, this, &QLineEdit::paste);
}
@@ -2248,6 +2253,7 @@ QMenu *QLineEdit::createStandardContextMenu()
if (!isReadOnly()) {
action = popup->addAction(QLineEdit::tr("Delete"));
action->setEnabled(!d->control->isReadOnly() && !d->control->text().isEmpty() && d->control->hasSelectedText());
+ action->setObjectName(QStringLiteral("edit-delete"));
setActionIcon(action, QStringLiteral("edit-delete"));
connect(action, &QAction::triggered,
d->control, &QWidgetLineControl::_q_deleteSelected);
@@ -2258,6 +2264,7 @@ QMenu *QLineEdit::createStandardContextMenu()
action = popup->addAction(QLineEdit::tr("Select All") + ACCEL_KEY(QKeySequence::SelectAll));
action->setEnabled(!d->control->text().isEmpty() && !d->control->allSelected());
+ action->setObjectName(QStringLiteral("select-all"));
setActionIcon(action, QStringLiteral("edit-select-all"));
d->selectAllAction = action;
connect(action, &QAction::triggered, this, &QLineEdit::selectAll);